@g1cloud/bpmn-modeler-next 5.0.0-alpha.59 → 5.0.0-alpha.60

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,16 +1,16 @@
1
- (function(ae,Mt){typeof exports=="object"&&typeof module<"u"?Mt(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],Mt):(ae=typeof globalThis<"u"?globalThis:ae||self,Mt(ae.BpmnModeler={},ae.Vue))})(this,(function(ae,Mt){"use strict";var sL=Object.defineProperty;var cL=(ae,Mt,Ri)=>Mt in ae?sL(ae,Mt,{enumerable:!0,configurable:!0,writable:!0,value:Ri}):ae[Mt]=Ri;var Xr=(ae,Mt,Ri)=>cL(ae,typeof Mt!="symbol"?Mt+"":Mt,Ri);const Ri=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway"];function rd(e){return Ri.includes(e)}const od="http://g1project.net/spec/bpmn/bwl/1.0",Tu="bwl",Mu=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],ad={name:"bwl-hints",uri:od,prefix:Tu,xml:{tagAlias:"lowerCase"},types:[{name:"Placement",superClass:["Element"],properties:[{name:"anchor",isAttr:!0,type:"String"},{name:"side",isAttr:!0,type:"String"},{name:"offset",isAttr:!0,type:"Real"}]},{name:"Members",superClass:["Element"],properties:[{name:"refs",isAttr:!0,type:"String"}]},{name:"BandHint",extends:["bpmn:FlowNode"],properties:[{name:"band",isAttr:!0,type:"Integer"}]},{name:"PoolOrderHint",extends:["bpmn:Participant"],properties:[{name:"poolOrder",isAttr:!0,type:"Integer"}]}]},ku="bwl.undoEpisode",sd=new WeakSet;function R0(e){sd.has(e)||(e.register(ku,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),sd.add(e))}function cd(e,t){R0(e);const n={run:t};if(e.execute(ku,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const ud=["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"],C0={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},P0={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},A0={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},T0={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다.",properties:{id:{type:"string"},type:{type:"string",enum:[...Ri]},name:{type:"string"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},M0={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},k0={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},O0={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"}},required:["id","source","target"],additionalProperties:!1},D0={type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},L0={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},I0={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},B0={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},N0={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},$0={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...Mu]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function an(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const F0={"participant.add":an("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":an("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":an("node.add",{description:'플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 갈래 1, 2…) — 위/아래가 아니라 "주 흐름에서 몇 번째 갈래"다. 행 배치(어느 갈래가 위/아래인지)는 호스트가 정한다(대칭·메시지 방향). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.',properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["node"]}),"node.update":an("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:[...Ri]},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["id"]}),"sequenceFlow.add":an("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":an("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":an("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":an("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataStore.add":an("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":an("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataAssociation.add":an("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":an("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":an("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":an("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":an("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":an("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"element.remove":an("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},ld={anyOf:ud.map(e=>F0[e])},j0={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:P0,irParticipant:A0,irNode:T0,irFlowCondition:M0,irSequenceFlow:k0,irMessageFlow:O0,irDataStore:D0,irDataAssociation:L0,irTextAnnotation:I0,irAssociation:B0,irGroup:N0,bwlPlacement:$0,nullableString:C0,symbolicOp:ld}};function Ou(e){return Array.prototype.concat.apply([],e)}const Wo=Object.prototype.toString,H0=Object.prototype.hasOwnProperty;function Sr(e){return e===void 0}function Ft(e){return e!==void 0}function Zr(e){return e==null}function ke(e){return Wo.call(e)==="[object Array]"}function qt(e){return Wo.call(e)==="[object Object]"}function Ie(e){return Wo.call(e)==="[object Number]"}function Yt(e){const t=Wo.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function En(e){return Wo.call(e)==="[object String]"}function z0(e){if(!ke(e))throw new Error("must supply array")}function Sn(e,t){return!Zr(e)&&H0.call(e,t)}function pt(e,t){const n=ns(t);let i;return I(e,function(r,o){if(n(r,o))return i=r,!1}),i}function pd(e,t){const n=ns(t);let i=ke(e)?-1:void 0;return I(e,function(r,o){if(n(r,o))return i=o,!1}),i}function Ue(e,t){const n=ns(t);let i=[];return I(e,function(r,o){n(r,o)&&i.push(r)}),i}function I(e,t){let n,i;if(Sr(e))return;const r=ke(e)?q0:U0;for(let o in e)if(Sn(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function G0(e,t){if(Sr(e))return[];z0(e);const n=ns(t);return e.filter(function(i,r){return!n(i,r)})}function Rn(e,t,n){return I(e,function(i,r){n=t(n,i,r)}),n}function Rr(e,t){return!!Rn(e,function(n,i,r){return n&&t(i,r)},!0)}function Wi(e,t){return!!pt(e,t)}function sn(e,t){let n=[];return I(e,function(i,r){n.push(t(i,r))}),n}function ts(e){return e&&Object.keys(e)||[]}function V0(e){return ts(e).length}function Qr(e){return sn(e,t=>t)}function Jr(e,t,n={}){return t=Du(t),I(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function fd(e,...t){e=Du(e);let n={};return I(t,r=>Jr(r,e,n)),sn(n,function(r,o){return r[0]})}const W0=fd;function ci(e,t){t=Du(t);let n=[];return I(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)}),sn(n,i=>i.v)}function eo(e){return function(t){return Rr(e,function(n,i){return t[i]===n})}}function Du(e){return Yt(e)?e:t=>t[e]}function ns(e){return Yt(e)?e:t=>t===e}function U0(e){return e}function q0(e){return Number(e)}function Lu(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 u(){n&&a(!0),c()}function l(...f){o=Date.now(),i=f,r=this,n||s(t)}return l.flush=u,l.cancel=c,l}function bn(e,t){return e.bind(t)}function V(e,...t){return Object.assign(e,...t)}function Y0(e,t,n){let i=e;return I(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];Ft(a)&&Zr(s)&&(s=i[r]=isNaN(+a)?{}:[]),Sr(a)?Sr(n)?delete i[r]:i[r]=n:i=s}),e}function ii(e,t){let n={},i=Object(e);return I(t,function(r){r in i&&(n[r]=e[r])}),n}function ui(e,t){let n={},i=Object(e);return I(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function Iu(){}Iu.prototype.get=function(e){return this.$model.properties.get(this,e)},Iu.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function dd(e,t){this.model=e,this.properties=t}dd.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Iu.prototype);I(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}),I(a,bn(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 K0=V(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),hd=V(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 Bu(e,t){var n=hd[e];return n?n(t):t}function Nu(e){return!!K0[e]}function md(e){return!!hd[e]}function cn(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 Bn(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}Bn.prototype.build=function(){return ii(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},Bn.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)},Bn.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},Bn.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=cn(r[0],i),a=cn(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},Bn.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},Bn.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},Bn.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},Bn.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},Bn.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},Bn.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")},Bn.prototype.hasProperty=function(e){return this.propertiesByName[e]},Bn.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(I(e.properties,bn(function(o){o=V({},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 Ui(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,I(e,bn(this.registerPackage,this))}Ui.prototype.getPackage=function(e){return this.packageMap[e]},Ui.prototype.getPackages=function(){return this.packages},Ui.prototype.registerPackage=function(e){e=V({},e);var t=this.packageMap;gd(t,e,"prefix"),gd(t,e,"uri"),I(e.types,bn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Ui.prototype.registerType=function(e,t){e=V({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:V({},e.meta||{})});var n=cn(e.name,t.prefix),i=n.name,r=Object.create(null);I(e.properties,bn(function(o){var a=cn(o.name,n.prefix),s=a.name;Nu(o.type)||(o.type=cn(o.type,a.prefix).name),V(o,{ns:a,name:s}),r[s]=o},this)),V(e,{ns:n,name:i,propertiesByName:r}),I(e.extends,bn(function(o){var a=cn(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},Ui.prototype.mapTypes=function(e,t,n){var i=Nu(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,u){var l=cn(c,Nu(c)?"":e.prefix);r.mapTypes(l,t,u)}function a(c){return o(c,!0)}function s(c){return o(c,!1)}if(!i)throw new Error("unknown type <"+e.name+">");I(i.superClass,n?a:s),t(i,!n),I(i.traits,a)},Ui.prototype.getEffectiveDescriptor=function(e){var t=cn(e),n=new Bn(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},Ui.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function gd(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function Cr(e){this.model=e}Cr.prototype.set=function(e,t,n){if(!En(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;X0(n)?i?delete e[r]:delete e.$attrs[$u(t)]:i?r in e?e[r]=n:yd(e,i,n):e.$attrs[$u(t)]=n},Cr.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[$u(t)];var i=n.name;return!e[i]&&n.isMany&&yd(e,n,[]),e[i]},Cr.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=V({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},Cr.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Cr.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Cr.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 X0(e){return typeof e>"u"}function yd(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function $u(e){return e.replace(/^:/,"")}function zn(e,t={}){this.properties=new Cr(this),this.factory=new dd(this,this.properties),this.registry=new Ui(e,this.properties),this.typeCache=Object.create(null),this.config=t}zn.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},zn.prototype.getType=function(e){var t=this.typeCache,n=En(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},zn.prototype.createAny=function(e,t,n){var i=cn(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){Y0(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}),I(n,function(a,s){qt(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},zn.prototype.getPackage=function(e){return this.registry.getPackage(e)},zn.prototype.getPackages=function(){return this.registry.getPackages()},zn.prototype.getElementDescriptor=function(e){return e.$descriptor},zn.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},zn.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},zn.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var vd=String.fromCharCode,Z0=Object.prototype.hasOwnProperty,Q0=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,Uo={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(Uo).forEach(function(e){Uo[e.toUpperCase()]=Uo[e]});function J0(e,t,n,i){return i?Z0.call(Uo,i)?Uo[i]:"&"+i+";":vd(t||parseInt(n,16))}function Pr(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(Q0,J0):e}var bd="non-whitespace outside of root node";function qi(e){return new Error(e)}function ew(e){return"missing namespace for prefix <"+e+">"}function is(e){return{get:e,enumerable:!0}}function tw(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var _d=Symbol("nameCache");function Fu(e){return e+"$uri"}function nw(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[Fu(i)]=n;return t}function rs(){return{line:0,column:0}}function iw(e){throw e}function xd(e){if(!this)return new xd(e);var t=e&&e.proxy,n,i,r,o,a=iw,s,c,u,l,f=rs,p=!1,d=!1,g="",h=!1,m=!1,_=null,y=!1,x,S,P,C;function L(D){D instanceof Error||(D=qi(D)),_=D,a(D,f)}function T(D){s&&(D instanceof Error||(D=qi(D)),s(D,f))}this.on=function(D,z){if(typeof z!="function")throw qi("required args <name, cb>");switch(D){case"openTag":i=z;break;case"text":n=z;break;case"closeTag":r=z;break;case"error":a=z;break;case"warn":s=z;break;case"cdata":o=z;break;case"attention":l=z;break;case"question":u=z;break;case"comment":c=z;break;default:throw qi("unsupported event: "+D)}return this},this.ns=function(D){if(typeof D>"u"&&(D={}),typeof D!="object")throw qi("required args <nsMap={}>");var z=Object.create(null),se;for(se in D)z[se]=D[se];return m=!0,C=z,this};function j(){x=m?[]:null,S=m?nw(C):null,P=[],f=rs,y=!1,_=null,d=!1,g=""}this.parse=function(D){if(typeof D!="string")throw qi("required args <xml=string>");if(p)throw qi("parse during stream; call end() first");return j(),k(D),f=rs,y=!1,_},this.write=function(D){if(typeof D!="string")throw qi("required args <xml=string>");return p||(j(),p=!0),_||(g=k(g+D,!0)||""),this},this.end=function(){return p||j(),p=!1,_||k(g),g="",f=rs,y=!1,_},this.stop=function(){y=!0};function k(D,z=!1){var se=null,we=null,Ke,Y=0,ue=!1,_e=!1,pe=0,xe=0,ce,U,q,Z,Ve,Zt,M,E,b,H="",W=0,Q;function be(rt,Tt){var Jt=rt.indexOf(":");if(Jt===-1)return rt;var yn=S[rt.substring(0,Jt)];return yn?Tt===yn?rt.substr(Jt+1):yn+rt.substr(Jt):(T(ew(rt.substring(0,Jt))),null)}function Be(){if(Q!==null)return Q;var rt,Tt,Jt=m&&S.xmlns,yn=m&&h?[]:null,ut=W,Nt=H,$t=Nt.length,zo,Vt,vn,wn,Wt,Ur={},Za=new Set,In,Je,tt;e:for(;ut<$t;ut++)if(In=!1,Je=Nt.charCodeAt(ut),!(Je===32||Je<14&&Je>8)){for((Je<65||Je>122||Je>90&&Je<97)&&Je!==95&&Je!==58&&(T("illegal first char attribute name"),In=!0),tt=ut+1;tt<$t;tt++)if(Je=Nt.charCodeAt(tt),!(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){T("missing attribute value"),ut=tt;continue e}if(Je===61)break;T("illegal attribute name char"),In=!0}if(Wt=Nt.substring(ut,tt),Wt==="xmlns:xmlns"&&(T("illegal declaration of xmlns"),In=!0),Je=Nt.charCodeAt(tt+1),Je===34)tt=Nt.indexOf('"',ut=tt+2),tt===-1&&(tt=Nt.indexOf("'",ut),tt!==-1&&(T("attribute value quote missmatch"),In=!0));else if(Je===39)tt=Nt.indexOf("'",ut=tt+2),tt===-1&&(tt=Nt.indexOf('"',ut),tt!==-1&&(T("attribute value quote missmatch"),In=!0));else for(T("missing attribute value quotes"),In=!0,tt=tt+1;tt<$t&&(Je=Nt.charCodeAt(tt+1),!(Je===32||Je<14&&Je>8));tt++);for(tt===-1&&(T("missing closing quotes"),tt=$t,In=!0),In||(vn=Nt.substring(ut,tt)),ut=tt;tt+1<$t&&(Je=Nt.charCodeAt(tt+1),!(Je===32||Je<14&&Je>8));tt++)ut===tt&&(T("illegal character after attribute end"),In=!0);if(ut=tt+1,In)continue e;if(Za.has(Wt)){T("attribute <"+Wt+"> already defined");continue}if(Za.add(Wt),!m){Ur[Wt]=vn;continue}if(h){if(Vt=Wt==="xmlns"?"xmlns":Wt.charCodeAt(0)===120&&Wt.substr(0,6)==="xmlns:"?Wt.substr(6):null,Vt!==null){if(rt=Pr(vn),Tt=Fu(Vt),wn=C[rt],!wn){if(Vt==="xmlns"||Tt in S&&S[Tt]!==rt)do wn="ns"+Y++;while(typeof S[wn]<"u");else wn=Vt;C[rt]=wn}S[Vt]!==wn&&(zo||(S=tw(S),zo=!0),S[Vt]=wn,Vt==="xmlns"&&(S[Fu(wn)]=rt,Jt=wn),S[Tt]=rt),Ur[Wt]=vn;continue}yn.push(Wt,vn);continue}Wt=be(Wt,Jt),Wt!==null&&(Ur[Wt]=vn)}if(h)for(ut=0,$t=yn.length;ut<$t;ut++)Wt=be(yn[ut++],Jt),vn=yn[ut],Wt!==null&&(Ur[Wt]=vn);return Q=Ur}function et(){for(var rt=/(\r\n|\r|\n)/g,Tt=0,Jt=0,yn=0,ut=xe,Nt,$t;pe>=yn&&(Nt=rt.exec(D),!(!Nt||(ut=Nt[0].length+Nt.index,ut>pe)));)Tt+=1,yn=ut;return pe==-1?(Jt=ut,$t=D.substring(xe)):xe===0?$t=D.substring(xe,pe):(Jt=pe-yn,$t=xe==-1?D.substring(pe):D.substring(pe,xe+1)),{data:$t,line:Tt,column:Jt}}for(f=et,t&&(b=Object.create({},{name:is(function(){return M}),originalName:is(function(){return E}),attrs:is(Be),ns:is(function(){return S})}));xe!==-1;){if(D.charCodeAt(xe)===60?pe=xe:pe=D.indexOf("<",xe),pe===-1){if(z)return D.substring(xe);if(P.length)return L("unexpected end of file");if(!d)return L("missing start tag");xe<D.length&&D.substring(xe).trim()&&T(bd);return}if(d||(d=!0),xe!==pe){if(P.length){if(n&&(n(D.substring(xe,pe),Pr,f),y))return}else if(D.substring(xe,pe).trim()&&(T(bd),y))return}if(Z=D.charCodeAt(pe+1),Z===33){if(q=D.charCodeAt(pe+2),q===91&&D.substr(pe+3,6)==="CDATA["){if(xe=D.indexOf("]]>",pe),xe===-1)return z?D.substring(pe):L("unclosed cdata");if(o&&(o(D.substring(pe+9,xe),f),y))return;xe+=3;continue}if(q===45&&D.charCodeAt(pe+3)===45){if(xe=D.indexOf("-->",pe),xe===-1)return z?D.substring(pe):L("unclosed comment");if(c&&(c(D.substring(pe+4,xe),Pr,f),y))return;xe+=3;continue}}if(Z===63){if(xe=D.indexOf("?>",pe),xe===-1)return z?D.substring(pe):L("unclosed question");if(u&&(u(D.substring(pe,xe+2),f),y))return;xe+=2;continue}for(ce=pe+1;;ce++){if(Ve=D.charCodeAt(ce),isNaN(Ve))return z?D.substring(pe):(xe=-1,L("unclosed tag"));if(Ve===34)q=D.indexOf('"',ce+1),ce=q!==-1?q:ce;else if(Ve===39)q=D.indexOf("'",ce+1),ce=q!==-1?q:ce;else if(Ve===62){xe=ce;break}}if(Z===33){if(l&&(l(D.substring(pe,xe+1),Pr,f),y))return;xe+=1;continue}if(Q={},Z===47){if(ue=!1,_e=!0,!P.length)return L("missing open tag");if(ce=M=P.pop(),q=pe+2+ce.length,D.substring(pe+2,q)!==ce)return L("closing tag mismatch");for(;q<xe;q++)if(Z=D.charCodeAt(q),!(Z===32||Z>8&&Z<14))return L("close tag")}else{if(D.charCodeAt(xe-1)===47?(ce=M=D.substring(pe+1,xe-1),ue=!0,_e=!0):(ce=M=D.substring(pe+1,xe),ue=!0,_e=!1),!(Z>96&&Z<123||Z>64&&Z<91||Z===95||Z===58))return L("illegal first char nodeName");for(q=1,U=ce.length;q<U;q++)if(Z=ce.charCodeAt(q),!(Z>96&&Z<123||Z>64&&Z<91||Z>47&&Z<59||Z===45||Z===95||Z==46)){if(Z===32||Z<14&&Z>8){M=ce.substring(0,q),Q=null;break}return L("invalid nodeName")}_e||P.push(M)}if(m){Ke=S,ue&&(_e||x.push(Ke),Q===null&&(h=ce.indexOf("xmlns",q)!==-1)&&(W=q,H=ce,Be(),h=!1)),E=M,we!==S&&(se=S[_d],se===void 0&&(se=S[_d]=Object.create(null)),we=S);var yt=se[M];if(yt!==void 0)M=yt;else{if(Z=M.indexOf(":"),Z!==-1){if(Zt=S[M.substring(0,Z)],!Zt)return L("missing namespace on <"+E+">");M=M.substr(Z+1)}else Zt=S.xmlns;Zt&&(M=Zt+":"+M),se[E]=M}}if(ue&&(W=q,H=ce,i&&(t?i(b,Pr,_e,f):i(M,Be,Pr,_e,f),y)))return;if(_e){if(r&&(r(t?b:M,Pr,ue,f),y))return;m&&(ue?S=Ke:S=x.pop())}xe+=1}}}function wd(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var ju={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},Ed="property";function Sd(e){return e.xml&&e.xml.serialize}function rw(e){const t=Sd(e);return t!==Ed&&(t||null)}function ow(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Rd(e,t){return wd(t)?e.prefix+":"+ow(e.localName):e.name}function aw(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 sw(e,t,n){const i=cn(e,t.xmlns),r=`${t[i.prefix]||i.prefix}:${i.localName}`,o=cn(r);var a=n.getPackage(o.prefix);return aw(o,a)}function Yi(e){return new Error(e)}function Ci(e){return e.$descriptor}function cw(e){V(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw Yi("expected element");var n=this.elementsById,i=Ci(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 Yi("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function qo(){}qo.prototype.handleEnd=function(){},qo.prototype.handleText=function(){},qo.prototype.handleNode=function(){};function Hu(){}Hu.prototype=Object.create(qo.prototype),Hu.prototype.handleNode=function(){return this};function to(){}to.prototype=Object.create(qo.prototype),to.prototype.handleText=function(e){this.body=(this.body||"")+e};function Yo(e,t){this.property=e,this.context=t}Yo.prototype=Object.create(to.prototype),Yo.prototype.handleNode=function(e){if(this.element)throw Yi("expected no sub nodes");return this.element=this.createReference(e),this},Yo.prototype.handleEnd=function(){this.element.id=this.body},Yo.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function zu(e,t){this.element=t,this.propertyDesc=e}zu.prototype=Object.create(to.prototype),zu.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Bu(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function os(){}os.prototype=Object.create(to.prototype),os.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 fn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}fn.prototype=Object.create(os.prototype),fn.prototype.addReference=function(e){this.context.addReference(e)},fn.prototype.handleText=function(e){var t=this.element,n=Ci(t),i=n.bodyProperty;if(!i)throw Yi("unexpected body text <"+e+">");to.prototype.handleText.call(this,e)},fn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Ci(t),i=n.bodyProperty;i&&e!==void 0&&(e=Bu(i.type,e),t.set(i.name,e))},fn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=Ci(n),r=this.context,o=new n({}),a=this.model,s;return I(t,function(c,u){var l=i.propertiesByName[u],f;l&&l.isReference?l.isMany?(f=c.split(" "),I(f,function(p){r.addReference({element:o,property:l.ns.name,id:p})})):r.addReference({element:o,property:l.ns.name,id:c}):(l?c=Bu(l.type,c):u==="xmlns"?u=":"+u:(s=cn(u,i.ns.prefix),a.getPackage(s.prefix)&&r.addWarning({message:"unknown attribute <"+u+">",element:o,property:u,value:c})),o.set(u,c))}),o},fn.prototype.getPropertyForNode=function(e){var t=e.name,n=cn(t),i=this.type,r=this.model,o=Ci(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const u=rw(s);if(u){const l=e.attributes[u];if(l){const f=sw(l,e.ns,r),p=r.getType(f);return V({},s,{effectiveType:Ci(p).name})}}return s}var c=r.getPackage(n.prefix);if(c){const u=Rd(n,c),l=r.getType(u);if(s=pt(o.properties,function(f){return!f.isVirtual&&!f.isReference&&!f.isAttribute&&l.hasType(f.type)}),s)return V({},s,{effectiveType:Ci(l).name})}else if(s=pt(o.properties,function(u){return!u.isReference&&!u.isAttribute&&u.type==="Element"}),s)return s;throw Yi("unrecognized element <"+n.name+">")},fn.prototype.toString=function(){return"ElementDescriptor["+Ci(this.type).name+"]"},fn.prototype.valueHandler=function(e,t){return new zu(e,t)},fn.prototype.referenceHandler=function(e){return new Yo(e,this.context)},fn.prototype.handler=function(e){return e==="Element"?new no(this.model,e,this.context):new fn(this.model,e,this.context)},fn.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,md(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?(V(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function Gu(e,t,n){fn.call(this,e,t,n)}Gu.prototype=Object.create(fn.prototype),Gu.prototype.createElement=function(e){var t=e.name,n=cn(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&Rd(n,o)||t;if(!r.hasType(a))throw Yi("unexpected element <"+e.originalName+">");return fn.prototype.createElement.call(this,e)};function no(e,t,n){this.model=e,this.context=n}no.prototype=Object.create(os.prototype),no.prototype.createElement=function(e){var t=e.name,n=cn(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},no.prototype.handleChild=function(e){var t=new no(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},no.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function Vu(e){e instanceof zn&&(e={model:e}),V(this,{lax:!1},e)}Vu.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof fn?(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 cw(V({},t,{rootHandler:i})),s=new xd({proxy:!0}),c=uw();i.context=a,c.push(i);function u(P,C,L){var T=C(),j=T.line,k=T.column,D=T.data;D.charAt(0)==="<"&&D.indexOf(" ")!==-1&&(D=D.slice(0,D.indexOf(" "))+">");var z="unparsable content "+(D?D+" ":"")+`detected
1
+ (function(oe,Mt){typeof exports=="object"&&typeof module<"u"?Mt(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],Mt):(oe=typeof globalThis<"u"?globalThis:oe||self,Mt(oe.BpmnModeler={},oe.Vue))})(this,(function(oe,Mt){"use strict";var pL=Object.defineProperty;var fL=(oe,Mt,Pi)=>Mt in oe?pL(oe,Mt,{enumerable:!0,configurable:!0,writable:!0,value:Pi}):oe[Mt]=Pi;var Qr=(oe,Mt,Pi)=>fL(oe,typeof Mt!="symbol"?Mt+"":Mt,Pi);const Pi=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway"];function od(e){return Pi.includes(e)}const ad="http://g1project.net/spec/bpmn/bwl/1.0",Mu="bwl",ku=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],sd={name:"bwl-hints",uri:ad,prefix:Mu,xml:{tagAlias:"lowerCase"},types:[{name:"Placement",superClass:["Element"],properties:[{name:"anchor",isAttr:!0,type:"String"},{name:"side",isAttr:!0,type:"String"},{name:"offset",isAttr:!0,type:"Real"}]},{name:"Members",superClass:["Element"],properties:[{name:"refs",isAttr:!0,type:"String"}]},{name:"BandHint",extends:["bpmn:FlowNode"],properties:[{name:"band",isAttr:!0,type:"Integer"}]},{name:"PoolOrderHint",extends:["bpmn:Participant"],properties:[{name:"poolOrder",isAttr:!0,type:"Integer"}]}]},Ou="bwl.undoEpisode",cd=new WeakSet;function A0(e){cd.has(e)||(e.register(Ou,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),cd.add(e))}function ud(e,t){A0(e);const n={run:t};if(e.execute(Ou,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const ld=["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"],T0={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},M0={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},k0={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},O0={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다.",properties:{id:{type:"string"},type:{type:"string",enum:[...Pi]},name:{type:"string"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},D0={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},L0={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},I0={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"}},required:["id","source","target"],additionalProperties:!1},B0={type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},N0={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},$0={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},F0={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},j0={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},H0={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...ku]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function rn(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const z0={"participant.add":rn("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":rn("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":rn("node.add",{description:'플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 갈래 1, 2…) — 위/아래가 아니라 "주 흐름에서 몇 번째 갈래"다. 행 배치(어느 갈래가 위/아래인지)는 호스트가 정한다(대칭·메시지 방향). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.',properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["node"]}),"node.update":rn("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:[...Pi]},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["id"]}),"sequenceFlow.add":rn("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":rn("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":rn("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":rn("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataStore.add":rn("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":rn("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataAssociation.add":rn("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":rn("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":rn("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":rn("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":rn("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":rn("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"element.remove":rn("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},pd={anyOf:ld.map(e=>z0[e])},G0={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:M0,irParticipant:k0,irNode:O0,irFlowCondition:D0,irSequenceFlow:L0,irMessageFlow:I0,irDataStore:B0,irDataAssociation:N0,irTextAnnotation:$0,irAssociation:F0,irGroup:j0,bwlPlacement:H0,nullableString:T0,symbolicOp:pd}};function Du(e){return Array.prototype.concat.apply([],e)}const qo=Object.prototype.toString,V0=Object.prototype.hasOwnProperty;function Cr(e){return e===void 0}function Nt(e){return e!==void 0}function Jr(e){return e==null}function Oe(e){return qo.call(e)==="[object Array]"}function Wt(e){return qo.call(e)==="[object Object]"}function Ie(e){return qo.call(e)==="[object Number]"}function Ut(e){const t=qo.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function xn(e){return qo.call(e)==="[object String]"}function W0(e){if(!Oe(e))throw new Error("must supply array")}function wn(e,t){return!Jr(e)&&V0.call(e,t)}function lt(e,t){const n=is(t);let i;return I(e,function(r,o){if(n(r,o))return i=r,!1}),i}function fd(e,t){const n=is(t);let i=Oe(e)?-1:void 0;return I(e,function(r,o){if(n(r,o))return i=o,!1}),i}function Ge(e,t){const n=is(t);let i=[];return I(e,function(r,o){n(r,o)&&i.push(r)}),i}function I(e,t){let n,i;if(Cr(e))return;const r=Oe(e)?X0:K0;for(let o in e)if(wn(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function U0(e,t){if(Cr(e))return[];W0(e);const n=is(t);return e.filter(function(i,r){return!n(i,r)})}function En(e,t,n){return I(e,function(i,r){n=t(n,i,r)}),n}function Pr(e,t){return!!En(e,function(n,i,r){return n&&t(i,r)},!0)}function qi(e,t){return!!lt(e,t)}function on(e,t){let n=[];return I(e,function(i,r){n.push(t(i,r))}),n}function ns(e){return e&&Object.keys(e)||[]}function q0(e){return ns(e).length}function eo(e){return on(e,t=>t)}function to(e,t,n={}){return t=Lu(t),I(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function dd(e,...t){e=Lu(e);let n={};return I(t,r=>to(r,e,n)),on(n,function(r,o){return r[0]})}const Y0=dd;function ui(e,t){t=Lu(t);let n=[];return I(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)}),on(n,i=>i.v)}function no(e){return function(t){return Pr(e,function(n,i){return t[i]===n})}}function Lu(e){return Ut(e)?e:t=>t[e]}function is(e){return Ut(e)?e:t=>t===e}function K0(e){return e}function X0(e){return Number(e)}function Iu(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 u(){n&&a(!0),c()}function l(...f){o=Date.now(),i=f,r=this,n||s(t)}return l.flush=u,l.cancel=c,l}function vn(e,t){return e.bind(t)}function V(e,...t){return Object.assign(e,...t)}function Z0(e,t,n){let i=e;return I(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];Nt(a)&&Jr(s)&&(s=i[r]=isNaN(+a)?{}:[]),Cr(a)?Cr(n)?delete i[r]:i[r]=n:i=s}),e}function ri(e,t){let n={},i=Object(e);return I(t,function(r){r in i&&(n[r]=e[r])}),n}function li(e,t){let n={},i=Object(e);return I(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function Bu(){}Bu.prototype.get=function(e){return this.$model.properties.get(this,e)},Bu.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function hd(e,t){this.model=e,this.properties=t}hd.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Bu.prototype);I(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}),I(a,vn(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 Q0=V(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),md=V(Object.create(null),{String:function(e){return e},Boolean:function(e){return e==="true"},Integer:function(e){return parseInt(e,10)},Real:function(e){return parseFloat(e)}});function Nu(e,t){var n=md[e];return n?n(t):t}function $u(e){return!!Q0[e]}function gd(e){return!!md[e]}function an(e,t){var n=e.split(/:/),i,r;if(n.length===1)i=e,r=t;else if(n.length===2)i=n[1],r=n[0];else throw new Error("expected <prefix:localName> or <localName>, got "+e);return e=(r?r+":":"")+i,{name:e,prefix:r,localName:i}}function Dn(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}Dn.prototype.build=function(){return ri(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},Dn.prototype.addProperty=function(e,t,n){typeof t=="boolean"&&(n=t,t=void 0),this.addNamedProperty(e,n!==!1);var i=this.properties;t!==void 0?i.splice(t,0,e):i.push(e)},Dn.prototype.replaceProperty=function(e,t,n){var i=e.ns,r=this.properties,o=this.propertiesByName,a=e.name!==t.name;if(e.isId){if(!t.isId)throw new Error("property <"+t.ns.name+"> must be id property to refine <"+e.ns.name+">");this.setIdProperty(t,!1)}if(e.isBody){if(!t.isBody)throw new Error("property <"+t.ns.name+"> must be body property to refine <"+e.ns.name+">");this.setBodyProperty(t,!1)}var s=r.indexOf(e);if(s===-1)throw new Error("property <"+i.name+"> not found in property list");r.splice(s,1),this.addProperty(t,n?void 0:s,a),o[i.name]=o[i.localName]=t},Dn.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=an(r[0],i),a=an(r[1],o.prefix).name,s=this.propertiesByName[a];if(s)this.replaceProperty(s,e,n);else throw new Error("refined property <"+a+"> not found");delete e.redefines},Dn.prototype.addNamedProperty=function(e,t){var n=e.ns,i=this.propertiesByName;t&&(this.assertNotDefined(e,n.name),this.assertNotDefined(e,n.localName)),i[n.name]=i[n.localName]=e},Dn.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},Dn.prototype.setBodyProperty=function(e,t){if(t&&this.bodyProperty)throw new Error("body property defined multiple times (<"+this.bodyProperty.ns.name+">, <"+e.ns.name+">)");this.bodyProperty=e},Dn.prototype.setIdProperty=function(e,t){if(t&&this.idProperty)throw new Error("id property defined multiple times (<"+this.idProperty.ns.name+">, <"+e.ns.name+">)");this.idProperty=e},Dn.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},Dn.prototype.assertNotDefined=function(e,t){var n=e.name,i=this.propertiesByName[n];if(i)throw new Error("property <"+n+"> already defined; override of <"+i.definedBy.ns.name+"#"+i.ns.name+"> by <"+e.definedBy.ns.name+"#"+e.ns.name+"> not allowed without redefines")},Dn.prototype.hasProperty=function(e){return this.propertiesByName[e]},Dn.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(I(e.properties,vn(function(o){o=V({},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 Yi(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,I(e,vn(this.registerPackage,this))}Yi.prototype.getPackage=function(e){return this.packageMap[e]},Yi.prototype.getPackages=function(){return this.packages},Yi.prototype.registerPackage=function(e){e=V({},e);var t=this.packageMap;yd(t,e,"prefix"),yd(t,e,"uri"),I(e.types,vn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Yi.prototype.registerType=function(e,t){e=V({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:V({},e.meta||{})});var n=an(e.name,t.prefix),i=n.name,r=Object.create(null);I(e.properties,vn(function(o){var a=an(o.name,n.prefix),s=a.name;$u(o.type)||(o.type=an(o.type,a.prefix).name),V(o,{ns:a,name:s}),r[s]=o},this)),V(e,{ns:n,name:i,propertiesByName:r}),I(e.extends,vn(function(o){var a=an(o,n.prefix),s=this.typeMap[a.name];s.traits=s.traits||[],s.traits.push(i)},this)),this.definePackage(e,t),this.typeMap[i]=e},Yi.prototype.mapTypes=function(e,t,n){var i=$u(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,u){var l=an(c,$u(c)?"":e.prefix);r.mapTypes(l,t,u)}function a(c){return o(c,!0)}function s(c){return o(c,!1)}if(!i)throw new Error("unknown type <"+e.name+">");I(i.superClass,n?a:s),t(i,!n),I(i.traits,a)},Yi.prototype.getEffectiveDescriptor=function(e){var t=an(e),n=new Dn(t);this.mapTypes(t,function(r,o){n.addTrait(r,o)});var i=n.build();return this.definePackage(i,i.allTypes[i.allTypes.length-1].$pkg),i},Yi.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function yd(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function Ar(e){this.model=e}Ar.prototype.set=function(e,t,n){if(!xn(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;J0(n)?i?delete e[r]:delete e.$attrs[Fu(t)]:i?r in e?e[r]=n:vd(e,i,n):e.$attrs[Fu(t)]=n},Ar.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[Fu(t)];var i=n.name;return!e[i]&&n.isMany&&vd(e,n,[]),e[i]},Ar.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=V({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},Ar.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Ar.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Ar.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 J0(e){return typeof e>"u"}function vd(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Fu(e){return e.replace(/^:/,"")}function zn(e,t={}){this.properties=new Ar(this),this.factory=new hd(this,this.properties),this.registry=new Yi(e,this.properties),this.typeCache=Object.create(null),this.config=t}zn.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},zn.prototype.getType=function(e){var t=this.typeCache,n=xn(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},zn.prototype.createAny=function(e,t,n){var i=an(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){Z0(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}),I(n,function(a,s){Wt(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},zn.prototype.getPackage=function(e){return this.registry.getPackage(e)},zn.prototype.getPackages=function(){return this.registry.getPackages()},zn.prototype.getElementDescriptor=function(e){return e.$descriptor},zn.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},zn.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},zn.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var bd=String.fromCharCode,ew=Object.prototype.hasOwnProperty,tw=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,Yo={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(Yo).forEach(function(e){Yo[e.toUpperCase()]=Yo[e]});function nw(e,t,n,i){return i?ew.call(Yo,i)?Yo[i]:"&"+i+";":bd(t||parseInt(n,16))}function Tr(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(tw,nw):e}var _d="non-whitespace outside of root node";function Ki(e){return new Error(e)}function iw(e){return"missing namespace for prefix <"+e+">"}function rs(e){return{get:e,enumerable:!0}}function rw(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var xd=Symbol("nameCache");function ju(e){return e+"$uri"}function ow(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[ju(i)]=n;return t}function os(){return{line:0,column:0}}function aw(e){throw e}function wd(e){if(!this)return new wd(e);var t=e&&e.proxy,n,i,r,o,a=aw,s,c,u,l,f=os,p=!1,d=!1,g="",h=!1,m=!1,_=null,y=!1,x,S,P,C;function L(D){D instanceof Error||(D=Ki(D)),_=D,a(D,f)}function T(D){s&&(D instanceof Error||(D=Ki(D)),s(D,f))}this.on=function(D,z){if(typeof z!="function")throw Ki("required args <name, cb>");switch(D){case"openTag":i=z;break;case"text":n=z;break;case"closeTag":r=z;break;case"error":a=z;break;case"warn":s=z;break;case"cdata":o=z;break;case"attention":l=z;break;case"question":u=z;break;case"comment":c=z;break;default:throw Ki("unsupported event: "+D)}return this},this.ns=function(D){if(typeof D>"u"&&(D={}),typeof D!="object")throw Ki("required args <nsMap={}>");var z=Object.create(null),se;for(se in D)z[se]=D[se];return m=!0,C=z,this};function j(){x=m?[]:null,S=m?ow(C):null,P=[],f=os,y=!1,_=null,d=!1,g=""}this.parse=function(D){if(typeof D!="string")throw Ki("required args <xml=string>");if(p)throw Ki("parse during stream; call end() first");return j(),k(D),f=os,y=!1,_},this.write=function(D){if(typeof D!="string")throw Ki("required args <xml=string>");return p||(j(),p=!0),_||(g=k(g+D,!0)||""),this},this.end=function(){return p||j(),p=!1,_||k(g),g="",f=os,y=!1,_},this.stop=function(){y=!0};function k(D,z=!1){var se=null,Se=null,qe,K=0,fe=!1,we=!1,me=0,Ee=0,pe,q,Y,Z,He,Kt,M,E,b,H="",W=0,Q;function _e(tt,zt){var Gt=tt.indexOf(":");if(Gt===-1)return tt;var ln=S[tt.substring(0,Gt)];return ln?zt===ln?tt.substr(Gt+1):ln+tt.substr(Gt):(T(iw(tt.substring(0,Gt))),null)}function Fe(){if(Q!==null)return Q;var tt,zt,Gt=m&&S.xmlns,ln=m&&h?[]:null,ct=W,Tt=H,gn=Tt.length,Rr,Fn,yn,ii,ft,jn={},Yr=new Set,Hn,Je,it;e:for(;ct<gn;ct++)if(Hn=!1,Je=Tt.charCodeAt(ct),!(Je===32||Je<14&&Je>8)){for((Je<65||Je>122||Je>90&&Je<97)&&Je!==95&&Je!==58&&(T("illegal first char attribute name"),Hn=!0),it=ct+1;it<gn;it++)if(Je=Tt.charCodeAt(it),!(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){T("missing attribute value"),ct=it;continue e}if(Je===61)break;T("illegal attribute name char"),Hn=!0}if(ft=Tt.substring(ct,it),ft==="xmlns:xmlns"&&(T("illegal declaration of xmlns"),Hn=!0),Je=Tt.charCodeAt(it+1),Je===34)it=Tt.indexOf('"',ct=it+2),it===-1&&(it=Tt.indexOf("'",ct),it!==-1&&(T("attribute value quote missmatch"),Hn=!0));else if(Je===39)it=Tt.indexOf("'",ct=it+2),it===-1&&(it=Tt.indexOf('"',ct),it!==-1&&(T("attribute value quote missmatch"),Hn=!0));else for(T("missing attribute value quotes"),Hn=!0,it=it+1;it<gn&&(Je=Tt.charCodeAt(it+1),!(Je===32||Je<14&&Je>8));it++);for(it===-1&&(T("missing closing quotes"),it=gn,Hn=!0),Hn||(yn=Tt.substring(ct,it)),ct=it;it+1<gn&&(Je=Tt.charCodeAt(it+1),!(Je===32||Je<14&&Je>8));it++)ct===it&&(T("illegal character after attribute end"),Hn=!0);if(ct=it+1,Hn)continue e;if(Yr.has(ft)){T("attribute <"+ft+"> already defined");continue}if(Yr.add(ft),!m){jn[ft]=yn;continue}if(h){if(Fn=ft==="xmlns"?"xmlns":ft.charCodeAt(0)===120&&ft.substr(0,6)==="xmlns:"?ft.substr(6):null,Fn!==null){if(tt=Tr(yn),zt=ju(Fn),ii=C[tt],!ii){if(Fn==="xmlns"||zt in S&&S[zt]!==tt)do ii="ns"+K++;while(typeof S[ii]<"u");else ii=Fn;C[tt]=ii}S[Fn]!==ii&&(Rr||(S=rw(S),Rr=!0),S[Fn]=ii,Fn==="xmlns"&&(S[ju(ii)]=tt,Gt=ii),S[zt]=tt),jn[ft]=yn;continue}ln.push(ft,yn);continue}ft=_e(ft,Gt),ft!==null&&(jn[ft]=yn)}if(h)for(ct=0,gn=ln.length;ct<gn;ct++)ft=_e(ln[ct++],Gt),yn=ln[ct],ft!==null&&(jn[ft]=yn);return Q=jn}function Ze(){for(var tt=/(\r\n|\r|\n)/g,zt=0,Gt=0,ln=0,ct=Ee,Tt,gn;me>=ln&&(Tt=tt.exec(D),!(!Tt||(ct=Tt[0].length+Tt.index,ct>me)));)zt+=1,ln=ct;return me==-1?(Gt=ct,gn=D.substring(Ee)):Ee===0?gn=D.substring(Ee,me):(Gt=me-ln,gn=Ee==-1?D.substring(me):D.substring(me,Ee+1)),{data:gn,line:zt,column:Gt}}for(f=Ze,t&&(b=Object.create({},{name:rs(function(){return M}),originalName:rs(function(){return E}),attrs:rs(Fe),ns:rs(function(){return S})}));Ee!==-1;){if(D.charCodeAt(Ee)===60?me=Ee:me=D.indexOf("<",Ee),me===-1){if(z)return D.substring(Ee);if(P.length)return L("unexpected end of file");if(!d)return L("missing start tag");Ee<D.length&&D.substring(Ee).trim()&&T(_d);return}if(d||(d=!0),Ee!==me){if(P.length){if(n&&(n(D.substring(Ee,me),Tr,f),y))return}else if(D.substring(Ee,me).trim()&&(T(_d),y))return}if(Z=D.charCodeAt(me+1),Z===33){if(Y=D.charCodeAt(me+2),Y===91&&D.substr(me+3,6)==="CDATA["){if(Ee=D.indexOf("]]>",me),Ee===-1)return z?D.substring(me):L("unclosed cdata");if(o&&(o(D.substring(me+9,Ee),f),y))return;Ee+=3;continue}if(Y===45&&D.charCodeAt(me+3)===45){if(Ee=D.indexOf("-->",me),Ee===-1)return z?D.substring(me):L("unclosed comment");if(c&&(c(D.substring(me+4,Ee),Tr,f),y))return;Ee+=3;continue}}if(Z===63){if(Ee=D.indexOf("?>",me),Ee===-1)return z?D.substring(me):L("unclosed question");if(u&&(u(D.substring(me,Ee+2),f),y))return;Ee+=2;continue}for(pe=me+1;;pe++){if(He=D.charCodeAt(pe),isNaN(He))return z?D.substring(me):(Ee=-1,L("unclosed tag"));if(He===34)Y=D.indexOf('"',pe+1),pe=Y!==-1?Y:pe;else if(He===39)Y=D.indexOf("'",pe+1),pe=Y!==-1?Y:pe;else if(He===62){Ee=pe;break}}if(Z===33){if(l&&(l(D.substring(me,Ee+1),Tr,f),y))return;Ee+=1;continue}if(Q={},Z===47){if(fe=!1,we=!0,!P.length)return L("missing open tag");if(pe=M=P.pop(),Y=me+2+pe.length,D.substring(me+2,Y)!==pe)return L("closing tag mismatch");for(;Y<Ee;Y++)if(Z=D.charCodeAt(Y),!(Z===32||Z>8&&Z<14))return L("close tag")}else{if(D.charCodeAt(Ee-1)===47?(pe=M=D.substring(me+1,Ee-1),fe=!0,we=!0):(pe=M=D.substring(me+1,Ee),fe=!0,we=!1),!(Z>96&&Z<123||Z>64&&Z<91||Z===95||Z===58))return L("illegal first char nodeName");for(Y=1,q=pe.length;Y<q;Y++)if(Z=pe.charCodeAt(Y),!(Z>96&&Z<123||Z>64&&Z<91||Z>47&&Z<59||Z===45||Z===95||Z==46)){if(Z===32||Z<14&&Z>8){M=pe.substring(0,Y),Q=null;break}return L("invalid nodeName")}we||P.push(M)}if(m){qe=S,fe&&(we||x.push(qe),Q===null&&(h=pe.indexOf("xmlns",Y)!==-1)&&(W=Y,H=pe,Fe(),h=!1)),E=M,Se!==S&&(se=S[xd],se===void 0&&(se=S[xd]=Object.create(null)),Se=S);var bt=se[M];if(bt!==void 0)M=bt;else{if(Z=M.indexOf(":"),Z!==-1){if(Kt=S[M.substring(0,Z)],!Kt)return L("missing namespace on <"+E+">");M=M.substr(Z+1)}else Kt=S.xmlns;Kt&&(M=Kt+":"+M),se[E]=M}}if(fe&&(W=Y,H=pe,i&&(t?i(b,Tr,we,f):i(M,Fe,Tr,we,f),y)))return;if(we){if(r&&(r(t?b:M,Tr,fe,f),y))return;m&&(fe?S=qe:S=x.pop())}Ee+=1}}}function Ed(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var Hu={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},Sd="property";function Rd(e){return e.xml&&e.xml.serialize}function sw(e){const t=Rd(e);return t!==Sd&&(t||null)}function cw(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Cd(e,t){return Ed(t)?e.prefix+":"+cw(e.localName):e.name}function uw(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 lw(e,t,n){const i=an(e,t.xmlns),r=`${t[i.prefix]||i.prefix}:${i.localName}`,o=an(r);var a=n.getPackage(o.prefix);return uw(o,a)}function Xi(e){return new Error(e)}function Ai(e){return e.$descriptor}function pw(e){V(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw Xi("expected element");var n=this.elementsById,i=Ai(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 Xi("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function Ko(){}Ko.prototype.handleEnd=function(){},Ko.prototype.handleText=function(){},Ko.prototype.handleNode=function(){};function zu(){}zu.prototype=Object.create(Ko.prototype),zu.prototype.handleNode=function(){return this};function io(){}io.prototype=Object.create(Ko.prototype),io.prototype.handleText=function(e){this.body=(this.body||"")+e};function Xo(e,t){this.property=e,this.context=t}Xo.prototype=Object.create(io.prototype),Xo.prototype.handleNode=function(e){if(this.element)throw Xi("expected no sub nodes");return this.element=this.createReference(e),this},Xo.prototype.handleEnd=function(){this.element.id=this.body},Xo.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function Gu(e,t){this.element=t,this.propertyDesc=e}Gu.prototype=Object.create(io.prototype),Gu.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Nu(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function as(){}as.prototype=Object.create(io.prototype),as.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 pn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}pn.prototype=Object.create(as.prototype),pn.prototype.addReference=function(e){this.context.addReference(e)},pn.prototype.handleText=function(e){var t=this.element,n=Ai(t),i=n.bodyProperty;if(!i)throw Xi("unexpected body text <"+e+">");io.prototype.handleText.call(this,e)},pn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Ai(t),i=n.bodyProperty;i&&e!==void 0&&(e=Nu(i.type,e),t.set(i.name,e))},pn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=Ai(n),r=this.context,o=new n({}),a=this.model,s;return I(t,function(c,u){var l=i.propertiesByName[u],f;l&&l.isReference?l.isMany?(f=c.split(" "),I(f,function(p){r.addReference({element:o,property:l.ns.name,id:p})})):r.addReference({element:o,property:l.ns.name,id:c}):(l?c=Nu(l.type,c):u==="xmlns"?u=":"+u:(s=an(u,i.ns.prefix),a.getPackage(s.prefix)&&r.addWarning({message:"unknown attribute <"+u+">",element:o,property:u,value:c})),o.set(u,c))}),o},pn.prototype.getPropertyForNode=function(e){var t=e.name,n=an(t),i=this.type,r=this.model,o=Ai(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const u=sw(s);if(u){const l=e.attributes[u];if(l){const f=lw(l,e.ns,r),p=r.getType(f);return V({},s,{effectiveType:Ai(p).name})}}return s}var c=r.getPackage(n.prefix);if(c){const u=Cd(n,c),l=r.getType(u);if(s=lt(o.properties,function(f){return!f.isVirtual&&!f.isReference&&!f.isAttribute&&l.hasType(f.type)}),s)return V({},s,{effectiveType:Ai(l).name})}else if(s=lt(o.properties,function(u){return!u.isReference&&!u.isAttribute&&u.type==="Element"}),s)return s;throw Xi("unrecognized element <"+n.name+">")},pn.prototype.toString=function(){return"ElementDescriptor["+Ai(this.type).name+"]"},pn.prototype.valueHandler=function(e,t){return new Gu(e,t)},pn.prototype.referenceHandler=function(e){return new Xo(e,this.context)},pn.prototype.handler=function(e){return e==="Element"?new ro(this.model,e,this.context):new pn(this.model,e,this.context)},pn.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,gd(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?(V(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function Vu(e,t,n){pn.call(this,e,t,n)}Vu.prototype=Object.create(pn.prototype),Vu.prototype.createElement=function(e){var t=e.name,n=an(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&Cd(n,o)||t;if(!r.hasType(a))throw Xi("unexpected element <"+e.originalName+">");return pn.prototype.createElement.call(this,e)};function ro(e,t,n){this.model=e,this.context=n}ro.prototype=Object.create(as.prototype),ro.prototype.createElement=function(e){var t=e.name,n=an(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},ro.prototype.handleChild=function(e){var t=new ro(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},ro.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function Wu(e){e instanceof zn&&(e={model:e}),V(this,{lax:!1},e)}Wu.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof pn?(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 pw(V({},t,{rootHandler:i})),s=new wd({proxy:!0}),c=fw();i.context=a,c.push(i);function u(P,C,L){var T=C(),j=T.line,k=T.column,D=T.data;D.charAt(0)==="<"&&D.indexOf(" ")!==-1&&(D=D.slice(0,D.indexOf(" "))+">");var z="unparsable content "+(D?D+" ":"")+`detected
2
2
  line: `+j+`
3
3
  column: `+k+`
4
- nested error: `+P.message;if(L)return a.addWarning({message:z,error:P}),!0;throw Yi(z)}function l(P,C){return u(P,C,!0)}function f(){var P=a.elementsById,C=a.references,L,T;for(L=0;T=C[L];L++){var j=T.element,k=P[T.id],D=Ci(j).propertiesByName[T.property];if(k||a.addWarning({message:"unresolved reference <"+T.id+">",element:T.element,property:T.property,value:T.id}),D.isMany){var z=j.get(D.name),se=z.indexOf(T);se===-1&&(se=z.length),k?z[se]=k:z.splice(se,1)}else j.set(D.name,k)}}function p(){c.pop().handleEnd()}var d=/^<\?xml /i,g=/ encoding="([^"]+)"/i,h=/^utf-8$/i;function m(P){if(d.test(P)){var C=g.exec(P),L=C&&C[1];!L||h.test(L)||a.addWarning({message:"unsupported document encoding <"+L+">, falling back to UTF-8"})}}function _(P,C){var L=c.peek();try{c.push(L.handleNode(P))}catch(T){u(T,C,o)&&c.push(new Hu)}}function y(P,C){try{c.peek().handleText(P)}catch(L){l(L,C)}}function x(P,C){P.trim()&&y(P,C)}var S=r.getPackages().reduce(function(P,C){return P[C.uri]=C.prefix,P},Object.entries(ju).reduce(function(P,[C,L]){return P[L]=C,P},r.config&&r.config.nsMap||{}));return s.ns(S).on("openTag",function(P,C,L,T){var j=P.attrs||{},k=Object.keys(j).reduce(function(z,se){var we=C(j[se]);return z[se]=we,z},{}),D={name:P.name,originalName:P.originalName,attributes:k,ns:P.ns};_(D,T)}).on("question",m).on("closeTag",p).on("cdata",y).on("text",function(P,C,L){x(C(P),L)}).on("error",u).on("warn",l),new Promise(function(P,C){var L;try{s.parse(e),f()}catch(z){L=z}var T=i.element;!L&&!T&&(L=Yi("failed to parse document as <"+i.type.$descriptor.name+">"));var j=a.warnings,k=a.references,D=a.elementsById;return L?(L.warnings=j,C(L)):P({rootElement:T,elementsById:D,references:k,warnings:j})})},Vu.prototype.handler=function(e){return new Gu(this.model,e)};function uw(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var lw=`<?xml version="1.0" encoding="UTF-8"?>
5
- `,pw=/<|>|'|"|&|\n\r|\n/g,Cd=/<|>|&/g;function li(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}li.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},li.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},li.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},li.prototype.add=function(e,t){this.uriMap[e.uri]=e,t?this.wellknown.push(e):this.custom.push(e),this.mapPrefix(e.prefix,e.uri)},li.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},li.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},li.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},li.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},li.prototype.getUsed=function(e){var t=[].concat(this.wellknown,this.custom);return t.filter(n=>{var i=this.getNSKey(n);return this.used[i]})};function fw(e){return e.charAt(0).toLowerCase()+e.slice(1)}function dw(e,t){return wd(t)?fw(e):e}function Pd(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function Ad(e){return En(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function hw(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 mw(e,t){return t.isGeneric?V({localName:t.ns.localName},e):V({localName:dw(t.ns.localName,t.$pkg)},e)}function gw(e,t){return V({localName:t.ns.localName},e)}function yw(e){var t=e.$descriptor;return Ue(t.properties,function(n){var i=n.name;if(n.isVirtual||!Sn(e,i))return!1;var r=e[i];return r===n.default||r===null?!1:n.isMany?r.length:!0})}var vw={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},bw={"<":"lt",">":"gt","&":"amp"};function Td(e,t,n){return e=En(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function _w(e){return Td(e,pw,vw)}function xw(e){return Td(e,Cd,bw)}function ww(e){return Ue(e,function(t){return t.isAttr})}function Ew(e){return Ue(e,function(t){return!t.isAttr})}function Wu(e){this.tagName=e}Wu.prototype.build=function(e){return this.element=e,this},Wu.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function Ar(){}Ar.prototype.serializeValue=Ar.prototype.serializeTo=function(e){e.append(this.escape?xw(this.value):this.value)},Ar.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(Cd)!==-1&&(this.escape=!0),this};function Uu(e){this.tagName=e}Pd(Uu,Ar),Uu.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function bt(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}bt.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=yw(e),this.parseAttributes(ww(r)),this.parseContainments(Ew(r))),this.parseGenericAttributes(e,i),this},bt.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return mw(t,e)},bt.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return gw(t,e)},bt.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},bt.prototype.nsAttributeName=function(e){var t;if(En(e)?t=cn(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}:V({localName:t.localName},n)},bt.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}))},bt.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new Ar().build({type:"String"},t));var n=e.$children;n&&I(n,i=>{this.body.push(new bt(this).build(i))})},bt.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,r=cn(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)}},bt.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return I(n,function(r,o){var a=t.parseNsAttribute(e,o,r);a&&i.push(a)}),i},bt.prototype.parseGenericAttributes=function(e,t){var n=this;I(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)}})},bt.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;I(e,function(r){var o=i.get(r.name),a=r.isReference,s=r.isMany;if(s||(o=[o]),r.isBody)n.push(new Ar().build(r,o[0]));else if(md(r.type))I(o,function(u){n.push(new Uu(t.addTagName(t.nsPropertyTagName(r))).build(r,u))});else if(a)I(o,function(u){n.push(new Wu(t.addTagName(t.nsPropertyTagName(r))).build(u))});else{var c=Sd(r);I(o,function(u){var l;c?c===Ed?l=new bt(t,r):l=new as(t,r,c):l=new bt(t),n.push(l.build(u))})}})},bt.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new li(i):t=i),t},bt.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},bt.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},bt.prototype.parseAttributes=function(e){var t=this,n=this.element;I(e,function(i){var r=n.get(i.name);if(i.isReference)if(!i.isMany)r=r.id;else{var o=[];I(r,function(a){o.push(a.id)}),r=o.join(" ")}t.addAttribute(t.nsAttributeName(i),r)})},bt.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),Ad(e)},bt.prototype.addAttribute=function(e,t){var n=this.attrs;En(t)&&(t=_w(t));var i=pd(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)},bt.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=hw(n).concat(t)),I(t,function(i){e.append(" ").append(Ad(i.name)).append('="').append(i.value).append('"')})},bt.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==Ar;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),I(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function as(e,t,n){bt.call(this,e,t),this.serialization=n}Pd(as,bt),as.prototype.parseNsAttributes=function(e){var t=bt.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},as.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function Sw(){this.value="",this.write=function(e){this.value+=e}}function Rw(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 Cw(e){e=V({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new Sw,o=new Rw(r,e.format);e.preamble&&o.append(lw);var a=new bt,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(Pw(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function Pw(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in ju)n[i]=ju[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 ss(e,t){zn.call(this,e,t)}ss.prototype=Object.create(zn.prototype),ss.prototype.fromXML=function(e,t,n){En(t)||(n=t,t="bpmn:Definitions");var i=new Vu(V({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},ss.prototype.toXML=function(e,t){var n=new Cw(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var Aw="BPMN20",Tw="http://www.omg.org/spec/BPMN/20100524/MODEL",Mw="bpmn",kw=[],Ow=[{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"}]}],Dw=[{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"}]}],Lw={tagAlias:"lowerCase",typePrefix:"t"},Iw={name:Aw,uri:Tw,prefix:Mw,associations:kw,types:Ow,enumerations:Dw,xml:Lw},Bw="BPMNDI",Nw="http://www.omg.org/spec/BPMN/20100524/DI",$w="bpmndi",Fw=[{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"]}],jw=[{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"}]}],Hw=[],zw={name:Bw,uri:Nw,prefix:$w,types:Fw,enumerations:jw,associations:Hw},Gw="DC",Vw="http://www.omg.org/spec/DD/20100524/DC",Ww="dc",Uw=[{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}]}],qw=[],Yw={name:Gw,uri:Vw,prefix:Ww,types:Uw,associations:qw},Kw="DI",Xw="http://www.omg.org/spec/DD/20100524/DI",Zw="di",Qw=[{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"}]}],Jw=[],eE={tagAlias:"lowerCase"},tE={name:Kw,uri:Xw,prefix:Zw,types:Qw,associations:Jw,xml:eE},nE="bpmn.io colors for BPMN",iE="http://bpmn.io/schema/bpmn/biocolor/1.0",rE="bioc",oE=[{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"}]}],aE=[],sE=[],cE={name:nE,uri:iE,prefix:rE,types:oE,enumerations:aE,associations:sE},uE="BPMN in Color",lE="http://www.omg.org/spec/BPMN/non-normative/color/1.0",pE="color",fE=[{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"}]}],dE=[],hE=[],mE={name:uE,uri:lE,prefix:pE,types:fE,enumerations:dE,associations:hE};const gE={bpmn:Iw,bpmndi:zw,dc:Yw,di:tE,bioc:cE,color:mE};function Md(e,t){const n=V({},gE,e);return new ss(n,t)}const yE={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"}},vE="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",kd="i18n",cs={[kd]:yE,[Tu]:ad};function Od(){return Md(cs)}const Dd=Od();async function qu(e){const{rootElement:t,warnings:n}=await Dd.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function bE(e){const{xml:t}=await Dd.toXML(e,{format:!0});return t}function Yu(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const io={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},_E=/[ᄀ-ᇿ -〿぀-ヿ㐀-鿿가-힯＀-⦆]/;function xE(e){const t=io;return _E.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 ro(e,t){let n=0;for(const i of e)n+=t*xE(i);return n}function Ld(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&wE(e),EE(e),SE(e),RE(e)}function wE(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:ro(r,o),fontBoundingBoxAscent:o*io.ascentEm,fontBoundingBoxDescent:o*io.descentEm,actualBoundingBoxAscent:o*io.ascentEm,actualBoundingBoxDescent:o*io.descentEm}}};t.getContext=()=>n}function EE(e){if(e.SVGMatrix)return;class t{constructor(){Xr(this,"a",1);Xr(this,"b",0);Xr(this,"c",0);Xr(this,"d",1);Xr(this,"e",0);Xr(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 SE(e){var o;const t=()=>{const a=new e.SVGMatrix;return{type:0,matrix:a,setTranslate(s,c){a.e=s,a.f=c},setScale(s,c){a.a=s,a.d=c},setRotate(s,c=0,u=0){const l=s*Math.PI/180,f=Math.cos(l),p=Math.sin(l);a.a=f,a.b=p,a.c=-p,a.d=f,a.e=c-f*c+p*u,a.f=u-p*c-f*u},setMatrix(s){Object.assign(a,s)}}},n=a=>{const s=t();return Object.assign(s.matrix,a),s},i=(o=e.SVGSVGElement)==null?void 0:o.prototype;i&&!i.createSVGTransform&&(i.createSVGTransform=t,i.createSVGTransformFromMatrix=n,i.createSVGMatrix=()=>new e.SVGMatrix,i.createSVGPoint=()=>({x:0,y:0,matrixTransform:()=>({x:0,y:0})}));const r=e.SVGElement.prototype;Object.getOwnPropertyDescriptor(r,"transform")||Object.defineProperty(r,"transform",{configurable:!0,get(){if(!this.__headlessTransformList){const a=[];this.__headlessTransformList={baseVal:{get numberOfItems(){return a.length},clear:()=>{a.length=0},appendItem:s=>(a.push(s),s),getItem:s=>a[s],createSVGTransformFromMatrix:n,consolidate:()=>a[a.length-1]??null}}}return this.__headlessTransformList}})}function RE(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:ro(n,12),height:14}})}const us=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),CE=1,Ku=new Set(["bpmn:TextAnnotation","bpmn:DataStoreReference","bpmn:DataObjectReference","bpmn:DataInput","bpmn:DataOutput"]),PE=2;function ri(e){switch(e.kind){case"label-over-line":return`L|${e.edge}|${e.line}`;case"edge-crosses-shape":return`x|${e.edge}|${e.shape}`;case"shape-overlap":return`o|${e.shapes[0]}|${e.shapes[1]}`;case"shape-outside-container":return`c|${e.shape}|${e.container}`;case"edge-overlap-opposite":return`p|${e.edges[0]}|${e.edges[1]}`;case"edge-overlap-mixed":return`m|${e.edges[0]}|${e.edges[1]}`;case"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"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 Id=20,ls=5,Bd=3,AE=8,Nd=12,TE=Nd*1.2;function Xu(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(o=>ro(o,Nd))),r=n.length*TE;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-r/2,width:i,height:r}}const $d=1;function dn(e){const t=[];for(let n=0;n+1<e.waypoints.length;n++){const i=e.waypoints[n],r=e.waypoints[n+1];Math.abs(i.y-r.y)<.5&&Math.abs(i.x-r.x)>=.5?t.push({axis:"h",at:i.y,lo:Math.min(i.x,r.x),hi:Math.max(i.x,r.x),dir:r.x>i.x?1:-1}):Math.abs(i.x-r.x)<.5&&Math.abs(i.y-r.y)>=.5&&t.push({axis:"v",at:i.x,lo:Math.min(i.y,r.y),hi:Math.max(i.y,r.y),dir:r.y>i.y?1:-1})}return t}function oo(e,t){let n=null;const i=e.type!==t.type,o=!!(e.source&&e.target&&t.source&&t.target)&&e.source!==t.source&&e.source!==t.target&&e.target!==t.source&&e.target!==t.target;for(const a of dn(e))for(const s of dn(t)){if(a.axis!==s.axis||Math.abs(a.at-s.at)>$d)continue;const c=a.dir!==s.dir?"opposite":i?"mixed":o?"unrelated":null;if(!c)continue;const u=Math.min(a.hi,s.hi)-Math.max(a.lo,s.lo);u>=Id&&(!n||u>n.length)&&(n={axis:a.axis,length:u,kind:c})}return n}function Zu(e){return e.kind==="edge-overlap-opposite"||e.kind==="edge-overlap-mixed"||e.kind==="edge-overlap-unrelated"}function Fd(e,t){const n=oo(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function ME(e,t){let n=0;for(const i of t)i.id!==e.id&&Fd(e,i)&&n++;return n}function Nn(e,t){let n=0;for(const i of t)i.id!==e.id&&oo(e,i)&&n++;return n}const jd=15,Hd=20;function kE(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-Hd||t.at>n[1]+Hd)return null;const i=t.axis==="v"?[e.y,e.y+e.height]:[e.x,e.x+e.width],r=Math.max(i[0],t.lo),o=Math.min(i[1],t.hi);return o>r?[r,o]:null}const Qu=20;function ps(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>$d)continue;const r=Math.max(e.lo,i.lo),o=Math.min(e.hi,i.hi);o-r<Id||n.push([r-Qu,o+Qu])}return n}function fs(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of dn(e)){const o=kE(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of ps(r,dn(a)))if(Math.min(c,o[1])>Math.max(s,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const OE=1,DE=(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 LE(e,t,n,i){const r=n.x+i,o=n.y+i,a=n.x+n.width-i,s=n.y+n.height-i;if(a<=r||s<=o)return!1;const c=t.x-e.x,u=t.y-e.y;let l=0,f=1;const p=(d,g)=>{if(g===0)return d<=0;const h=d/g;if(g>0){if(h>f)return!1;h>l&&(l=h)}else{if(h<l)return!1;h<f&&(f=h)}return!0};return p(r-e.x,c)&&p(e.x-a,-c)&&p(o-e.y,u)&&p(e.y-s,-u)&&f>l}function Ju(e,t,n){return e.x+n<t.x+t.width-n&&t.x+n<e.x+e.width-n&&e.y+n<t.y+t.height-n&&t.y+n<e.y+e.height-n}const IE=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,ao=1;function Pi(e,t){const n=e.x+ao,i=e.x+e.width-ao,r=e.y+ao,o=e.y+e.height-ao;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 Ko(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 zd(e,t){const n=e.label;if(!n)return null;if(dn(e).some(i=>Pi(n,i)))return e.id;for(const i of[...t.edges].filter(r=>r.id!==e.id).sort((r,o)=>r.id.localeCompare(o.id)))if(dn(i).some(r=>Pi(n,r)))return i.id;for(const i of t.shapes.filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(Ko(i).some(r=>Pi(n,r)))return i.id;return null}function hn(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(LE(e.waypoints[o],e.waypoints[o+1],r,PE)){i.push(r);break}}return i}function BE(e,t,n,i){const r=(u,l,f)=>(l.x-u.x)*(f.y-u.y)-(l.y-u.y)*(f.x-u.x),o=r(n,i,e),a=r(n,i,t),s=r(e,t,n),c=r(e,t,i);return o*a<0&&s*c<0}const Gd=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function ds(e,t){let n=0;for(const i of t){if(i.id===e.id||Gd(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++)BE(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function $n(e,t){let n=0;for(const i of t)i.id===e.id||Gd(e,i)||ds(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function Vd(e){let t=0;const n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)ds(n[i],[n[r]])>0&&(t+=n[i].type===n[r].type?2:1);return t}function el(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(ds(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 Wd(e){const t=el(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),u=i.get(s);if(!c||!u)continue;const l=n(c.type),f=n(u.type);l==="solid"&&f==="solid"?r++:l==="dashed"&&f==="dashed"&&o++}return{pairs:t,solidPairs:r,dashedPairs:o,mixedPairs:t.length-r-o,crossPoolMessages:NE(e)}}function NE(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(u=>u.id!==o.id&&u.id!==a.id&&u.y>s&&u.y+u.height<c)&&i++}return i}function Ud(e,t,n){const i=new Set(t.flatMap(r=>[...r.members]));return e.shapes.filter(r=>!r.container&&!Ku.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 qd(e){var n;const t=(n=gt(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const r=gt(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 Yd=e=>e?{members:e}:{},Gn=e=>e.shapes.filter(t=>!t.container);function $E(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 Kd(e,t){const n=e.label;if(!n)return null;for(const i of[...t.edges].sort((r,o)=>r.id.localeCompare(o.id)))if(dn(i).some(r=>Pi(n,r)))return i.id;for(const i of[...t.shapes].filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(Ko(i).some(r=>Pi(n,r)))return i.id;return null}function so(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 Vn(e){const t=[],n=e.shapes.filter(h=>!h.container);for(const h of e.edges)for(const m of hn(h,n))t.push({kind:"edge-crosses-shape",edge:h.id,shape:m.id});const i=n.filter(h=>!h.attached);for(let h=0;h<i.length;h++)for(let m=h+1;m<i.length;m++){const _=i[h],y=i[m];if(!Ju(_,y,CE))continue;const x=_.id<y.id?[_.id,y.id]:[y.id,_.id];t.push({kind:"shape-overlap",shapes:x,identical:IE(_,y)})}const r=e.shapes.filter(h=>h.type==="bpmn:Group"&&Array.isArray(h.members)&&h.members.length>0);for(let h=0;h<r.length;h++)for(let m=h+1;m<r.length;m++){const _=r[h],y=r[m],x=Math.min(_.x+_.width,y.x+y.width)-Math.max(_.x,y.x),S=Math.min(_.y+_.height,y.y+y.height)-Math.max(_.y,y.y);if(x<=ls||S<=ls)continue;const P=_.id<y.id?[_.id,y.id]:[y.id,_.id],C=new Set(y.members);if(_.members.some(T=>C.has(T))){const T=Ud(e,r,{x:Math.max(_.x,y.x),y:Math.max(_.y,y.y),right:Math.min(_.x+_.width,y.x+y.width),bottom:Math.min(_.y+_.height,y.y+y.height)});T.length&&t.push({kind:"group-overlap-unreadable",reason:"orphan",groups:P,shapes:T});continue}const L=_.x<=y.x&&_.y<=y.y&&_.x+_.width>=y.x+y.width&&_.y+_.height>=y.y+y.height?_.id:y.x<=_.x&&y.y<=_.y&&y.x+y.width>=_.x+_.width&&y.y+y.height>=_.y+_.height?y.id:void 0;t.push({kind:"group-overlap-unintended",groups:P,...L?{container:L}:{}})}const o=new Set(r.flatMap(h=>[...h.members])),a=h=>e.shapes.filter(m=>!m.container&&!Ku.has(m.type)&&m.x>=h.x&&m.y>=h.y&&m.x+m.width<=h.x+h.width&&m.y+m.height<=h.y+h.height);for(const h of r){const m=a(h);if(!m.length)continue;const _=new Set(h.members),y=m.filter(x=>!_.has(x.id));y.some(x=>o.has(x.id))&&(y.length*2<m.length||t.push({kind:"group-overlap-unreadable",reason:"minority",group:h.id,shapes:y.map(x=>x.id).sort()}))}for(const h of r){const m=new Set(a(h).map(C=>C.id)),_=new Set(h.members),y=new Set([...m].filter(C=>!_.has(C)&&o.has(C)));if(!y.size)continue;let x=!1,S=!1,P=!1;for(const C of e.edges){if(C.type!=="bpmn:SequenceFlow"||!C.source||!C.target)continue;const L=y.has(C.source),T=y.has(C.target);!L&&T&&!m.has(C.source)?x=!0:L&&!T&&!m.has(C.target)?S=!0:L&&T&&(P=!0)}x&&S&&P&&t.push({kind:"group-overlap-unreadable",reason:"throughpass",group:h.id,shapes:[...y].sort()})}const s=e.shapes.filter(h=>h.type==="bpmn:Group");for(let h=0;h<s.length;h++)for(let m=h+1;m<s.length;m++)for(let _=m+1;_<s.length;_++){const y=[s[h],s[m],s[_]],x={x:Math.max(...y.map(C=>C.x)),y:Math.max(...y.map(C=>C.y)),right:Math.min(...y.map(C=>C.x+C.width)),bottom:Math.min(...y.map(C=>C.y+C.height))};if(x.right-x.x<=ls||x.bottom-x.y<=ls)continue;const S=Ud(e,[],x);if(!S.length)continue;const P=y.map(C=>C.id).sort();t.push({kind:"group-stack-unreadable",groups:P,shapes:S})}for(const h of e.shapes.filter(m=>m.type==="bpmn:Group"))for(const m of e.shapes){if(m.container||m.attached||Ku.has(m.type)||m.width<=0||m.height<=0)continue;const _=[["top",h.y,"h",h.x,h.x+h.width],["bottom",h.y+h.height,"h",h.x,h.x+h.width],["left",h.x,"v",h.y,h.y+h.height],["right",h.x+h.width,"v",h.y,h.y+h.height]];for(const[y,x,S,P,C]of _){const L=S==="h"?m.x:m.y,T=S==="h"?m.x+m.width:m.y+m.height;if(!(L<C&&P<T))continue;const j=S==="h"?m.y:m.x,k=S==="h"?m.y+m.height:m.x+m.width;if(!(j<x&&x<k))continue;const D=Math.min(x-j,k-x);D<AE||t.push({kind:"group-cuts-shape",group:h.id,shape:m.id,side:y,depth:D})}}const c=e.shapes.filter(h=>h.container&&h.type!=="bpmn:Group"&&h.type!=="bpmn:Lane");for(const h of e.shapes.filter(m=>m.type==="bpmn:Group"))for(const m of c){const _=h.x<m.x+m.width&&m.x<h.x+h.width,y=h.y<m.y+m.height&&m.y<h.y+h.height,x=[["top",h.y,m.y,_],["bottom",h.y+h.height,m.y+m.height,_],["left",h.x,m.x,y],["right",h.x+h.width,m.x+m.width,y]];for(const[S,P,C,L]of x)L&&Math.abs(P-C)<=Bd&&t.push({kind:"group-on-container-boundary",group:h.id,container:m.id,side:S})}const u=e.shapes.filter(h=>h.type==="bpmn:Group");for(let h=0;h<u.length;h++)for(let m=h+1;m<u.length;m++){const _=u[h],y=u[m],x=_.x<y.x+y.width&&y.x<_.x+_.width,S=_.y<y.y+y.height&&y.y<_.y+_.height,P=[["x",_.x+_.width,y.x,S],["x",y.x+y.width,_.x,S],["y",_.y+_.height,y.y,x],["y",y.y+y.height,_.y,x]];for(const[C,L,T,j]of P)if(j&&Math.abs(L-T)<=Bd){t.push({kind:"group-on-group-boundary",groups:_.id<y.id?[_.id,y.id]:[y.id,_.id],axis:C});break}}for(let h=0;h<e.edges.length;h++)for(let m=h+1;m<e.edges.length;m++){const _=e.edges[h],y=e.edges[m],x=oo(_,y);if(!x)continue;const S=_.id<y.id?[_.id,y.id]:[y.id,_.id];t.push({kind:x.kind==="opposite"?"edge-overlap-opposite":x.kind==="mixed"?"edge-overlap-mixed":"edge-overlap-unrelated",edges:S,axis:x.axis,length:Math.round(x.length)})}for(const h of e.edges){if(!h.label)continue;const m=fs(h,e.edges);m&&t.push({kind:"label-on-shared-segment",edge:h.id,other:m.other,axis:m.axis})}for(const h of e.edges){if(!h.label)continue;const m=zd(h,e);m&&t.push({kind:"label-over-line",edge:h.id,line:m})}const l=new Set(n.map(h=>h.id)),f=e.shapes.filter(h=>h.type==="bpmn:Participant"&&h.label);for(const h of[...n,...f.filter(m=>!l.has(m.id))]){if(!h.label)continue;const m=Kd(h,e);m&&t.push({kind:"label-over-line",edge:h.id,line:m})}const p=new Set(e.shapes.filter(h=>h.type==="bpmn:TextAnnotation").map(h=>h.id));for(const h of f)for(const{owner:m,rect:_}of so(e))m===h.id||p.has(m)||Ju(h.label,_,ao)&&t.push({kind:"pool-name-over-label",pool:h.id,label:m});const d=so(e);for(const h of n)if(h.type==="bpmn:TextAnnotation")for(const{owner:m,rect:_}of d)m!==h.id&&Ju(h,_,ao)&&t.push({kind:"annotation-over-label",annotation:h.id,label:m});const g=new Map(e.shapes.map(h=>[h.id,h]));for(const h of n){const m=h.parent??$E(h,e,g);if(!m)continue;const _=g.get(m);!_||!_.container||DE(_,h,OE)||t.push({kind:"shape-outside-container",shape:h.id,container:_.id})}return t.sort((h,m)=>ri(h).localeCompare(ri(m)))}const gt=e=>typeof e=="object"&&e!==null?e:void 0,Rt=e=>typeof e=="number"?e:0,Ai=e=>{const t=gt(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function FE(e){const t=gt(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=Ai(o);a&&n.push(a)}}return n}function jE(e){const t=gt(e);if(!t)return{};const n=Array.isArray(t.sourceRef)?void 0:Ai(t.sourceRef),i=Array.isArray(t.targetRef)?void 0:Ai(t.targetRef);return n&&i?{source:n,target:i}:{}}function HE(e,t){const n=gt(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const r=Ai(n);return r?t.get(r):void 0}if(us.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return Ai(n)}function Xd(e){var a,s,c,u,l;const t=[],n=[],i=((a=gt(e))==null?void 0:a.diagrams)??[],r=new Map,o=new Set;for(const f of((s=gt(e))==null?void 0:s.rootElements)??[]){const p=gt(f);if((p==null?void 0:p.$type)==="bpmn:Collaboration")for(const d of p.participants??[]){const g=gt(d),h=Ai(g),m=Ai(g==null?void 0:g.processRef);h&&m?r.set(m,h):h&&o.add(h)}}for(const f of i){const p=gt((c=gt(f))==null?void 0:c.plane),d=(p==null?void 0:p.planeElement)??[];for(const g of d){const h=gt(g);if(!h)continue;const m=gt(h.bpmnElement),_=typeof(m==null?void 0:m.id)=="string"?m.id:void 0;if(!_)continue;const y=typeof(m==null?void 0:m.$type)=="string"?m.$type:"",x=gt(h.bounds);if(x){const P=h.isExpanded===!1&&y!=="bpmn:Participant",C=gt((u=gt(h.label))==null?void 0:u.bounds),L={id:_,type:y,x:Rt(x.x),y:Rt(x.y),width:Rt(x.width),height:Rt(x.height),container:us.has(y)&&!P,attached:(m==null?void 0:m.attachedToRef)!==void 0,...m?{parent:HE(m,r)}:{},...C?{label:{x:Rt(C.x),y:Rt(C.y),width:Rt(C.width),height:Rt(C.height)}}:{},...y==="bpmn:Group"?Yd(qd(m)):{}},T=h.isHorizontal!==!1,j=typeof(m==null?void 0:m.name)=="string"?m.name:"";o.has(_)&&T&&j&&(L.label=Xu(L,j)),t.push(L);continue}const S=h.waypoint;if(Array.isArray(S)){const P=gt((l=gt(h.label))==null?void 0:l.bounds);n.push({id:_,type:y,waypoints:S.map(C=>{var L,T;return{x:Rt((L=gt(C))==null?void 0:L.x),y:Rt((T=gt(C))==null?void 0:T.y)}}),endpoints:FE(m),...jE(m),...P?{label:{x:Rt(P.x),y:Rt(P.y),width:Rt(P.width),height:Rt(P.height)}}:{}})}}}return{shapes:t,edges:n}}function Zd(e){return Vn(Xd(e))}async function zE(e){const{definitions:t,warnings:n}=await qu(e);return{findings:Zd(t),warnings:n}}function ft(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=gt(o.label),m=Ai(o.source),_=Ai(o.target);n.push({id:o.id,type:a,waypoints:s.map(y=>({x:Rt(y.x),y:Rt(y.y)})),endpoints:[m,_].filter(y=>!!y),...m&&_?{source:m,target:_}:{},...h&&typeof h.x=="number"?{label:{x:h.x,y:Rt(h.y),width:Rt(h.width),height:Rt(h.height)}}:{}});continue}if(typeof o.x!="number"||typeof o.y!="number")continue;const c=gt(o.businessObject),u=gt(o.label);let l=gt(o.parent);for(;l&&l.type==="bpmn:Lane";)l=gt(l.parent);const f=typeof(l==null?void 0:l.type)=="string"?l.type:"",p=l&&us.has(f)&&f!=="bpmn:Group"&&typeof l.id=="string"?l.id:void 0,d={id:o.id,type:a,x:o.x,y:o.y,width:Rt(o.width),height:Rt(o.height),container:us.has(a)&&(a==="bpmn:Participant"||o.collapsed!==!0),attached:(c==null?void 0:c.attachedToRef)!==void 0,...p!==void 0?{parent:p}:{},...u&&typeof u.x=="number"?{label:{x:u.x,y:Rt(u.y),width:Rt(u.width),height:Rt(u.height)}}:{},...a==="bpmn:Group"?Yd(qd(c)):{}},g=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&g&&((i=gt(o.di))==null?void 0:i.isHorizontal)!==!1&&(d.label=Xu(d,g)),t.push(d)}return{shapes:t,edges:n}}const GE={"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 VE(e,t){const n=GE[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function Qd(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function Jd(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 VE(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&Qd(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?Qd(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 tl=20,WE=4,dt=(e,t)=>Math.abs(e-t)<.5;function nl(e,t,n,i=tl){if(dt(e.y,t.y)&&!dt(e.x,t.x)){const r=Math.min(e.x,t.x),o=Math.max(e.x,t.x);if(!(r<n.x-i&&n.x+n.width+i<o))return null;const a=e.x<t.x?n.x-i:n.x+n.width+i,s=e.x<t.x?n.x+n.width+i:n.x-i,c=u=>[{x:a,y:e.y},{x:a,y:u},{x:s,y:u},{x:s,y:e.y}];return[c(n.y-i),c(n.y+n.height+i)]}if(dt(e.x,t.x)&&!dt(e.y,t.y)){const r=Math.min(e.y,t.y),o=Math.max(e.y,t.y);if(!(r<n.y-i&&n.y+n.height+i<o))return null;const a=e.y<t.y?n.y-i:n.y+n.height+i,s=e.y<t.y?n.y+n.height+i:n.y-i,c=u=>[{x:e.x,y:a},{x:u,y:a},{x:u,y:s},{x:e.x,y:s}];return[c(n.x-i),c(n.x+n.width+i)]}return null}function eh(e,t,n,i=tl){if(n.length<2)return null;if(dt(e.y,t.y)&&!dt(e.x,t.x)){const r=Math.min(e.x,t.x),o=Math.max(e.x,t.x),a=Math.min(...n.map(d=>d.x))-i,s=Math.max(...n.map(d=>d.x+d.width))+i;if(!(r<a&&s<o))return null;const c=e.x<t.x?a:s,u=e.x<t.x?s:a,l=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:u,y:d},{x:u,y:e.y}];return[p(l),p(f)]}if(dt(e.x,t.x)&&!dt(e.y,t.y)){const r=Math.min(e.y,t.y),o=Math.max(e.y,t.y),a=Math.min(...n.map(d=>d.y))-i,s=Math.max(...n.map(d=>d.y+d.height))+i;if(!(r<a&&s<o))return null;const c=e.y<t.y?a:s,u=e.y<t.y?s:a,l=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:u},{x:e.x,y:u}];return[p(l),p(f)]}return null}function th(e,t,n=tl){if(e.length!==4)return null;const[i,r,o,a]=e;if(dt(i.y,r.y)&&dt(r.x,o.x)&&dt(o.y,a.y)){const s=c=>[i,{x:c,y:i.y},{x:c,y:a.y},a];return[s(t.x-n),s(t.x+t.width+n)]}if(dt(i.x,r.x)&&dt(r.y,o.y)&&dt(o.x,a.x)){const s=c=>[i,{x:i.x,y:c},{x:a.x,y:c},a];return[s(t.y-n),s(t.y+t.height+n)]}return null}function il(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,u=[{x:n.x+n.width,y:r},{x:a,y:r},{x:a,y:c?i.y+i.height:i.y}],l=[{x:s,y:c?n.y:n.y+n.height},{x:s,y:o},{x:i.x,y:o}];return[u,l]}const nh=30,UE=[0,-25,25,-40,40];function qE(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+nh:s-nh,u=a?i.y+i.height:i.y,l=n.x+n.width/2,f=i.x+i.width/2;return UE.map(p=>[{x:l,y:s},{x:l,y:c},{x:f+p,y:c},{x:f+p,y:u}])}const ih=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],co=(e,t,n)=>hn({...e,waypoints:t},n).length;function rh(e,t,n,i){let r=[...e.waypoints],o=co(e,r,t);if(o===0)return null;let a=!1;for(const f of il(e,t))if(co(e,f,t)===0)return f;const s=(i??[]).filter(f=>f.id!==e.id).flatMap(dn),c=f=>dn({...e,waypoints:f}).some(p=>ps(p,s).length>0),u=qE(e,t).filter(f=>co(e,f,t)===0);if(u.length)return u.find(f=>!c(f))??u[0];const l=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&&dt(f.y+f.height/2,p.y+p.height/2)){const d=[r[0],r[r.length-1]];if(dt(d[0].y,d[1].y)&&!dt(d[0].x,d[1].x)){const g=t.filter(y=>!e.endpoints.includes(y.id)&&hn({...e,waypoints:d},[y]).length>0),h=g.length>=2?eh(d[0],d[1],g):null,_=(h?h.map(y=>[d[0],...y,d[1]]):g.length===1?(nl(d[0],d[1],g[0])??[]).map(y=>[d[0],...y,d[1]]):g.length===0?[d]:[]).filter(y=>co(e,y,t)===0&&y.length<=r.length).sort((y,x)=>Number(l(x))-Number(l(y)));if(_.length)return _.find(y=>!c(y))??_[0]}}}for(let f=0;f+1<r.length;f++){const p=r[f],d=r[f+1],g=t.filter(_=>!e.endpoints.includes(_.id)&&hn({...e,waypoints:[p,d]},[_]).length>0);if(g.length<2)continue;const h=eh(p,d,g);if(!h)continue;const m=h.map(_=>ih(r,f,_)).filter(_=>co(e,_,t)===0).sort((_,y)=>Number(l(y))-Number(l(_)));if(m.length)return m.find(_=>!c(_))??m[0]}for(let f=0;f<WE&&o>0;f++){let p=!1;for(let d=0;d+1<r.length&&!p;d++){const g=r[d],h=r[d+1];for(const m of t){if(e.endpoints.includes(m.id)||hn({...e,waypoints:[g,h]},[m]).length===0)continue;const _=nl(g,h,m),y=_?_.map(S=>ih(r,d,S)):th(r,m)??[];if(!y.length)continue;const x=[...y].sort((S,P)=>Number(l(P))-Number(l(S)));for(const S of x){const P=co(e,S,t);if(P<o){r=S,o=P,p=!0,a=!0;break}}if(p)break}}if(!p)break}return a&&o===0?r:null}function oh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=ft(n),o=Gn(r),a=Vn(r).filter(c=>c.kind==="edge-crosses-shape"&&!t.has(ri(c)));if(!a.length)return;const s=new Map;for(const c of a){if(c.kind!=="edge-crosses-shape"||s.has(c.edge))continue;const u=r.edges.find(l=>l.id===c.edge);u&&s.set(c.edge,u)}for(const[c,u]of s){const l=n.get(c);if(!l)continue;const f=l.parent,p=f&&typeof f.x=="number"&&typeof f.width=="number"?{x:f.x,y:f.y,width:f.width,height:f.height}:void 0,d=rh(u,o,p,r.edges);if(!d)continue;const g=r.edges.filter(_=>_.id!==c),h=Nn(u,g);Nn({...u,waypoints:d},g)>h||i.updateWaypoints(l,d)}}const YE=10;function ah(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 sh(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=ah(i,n),a=ah(r,n);if(!o||!a||o.id===a.id)return null;const s=a.y>o.y,c=s?o:a,u=s?a:o,l=n.filter(z=>z.id!==o.id&&z.id!==a.id&&z.y>=c.y+c.height&&z.y+z.height<=u.y).sort((z,se)=>z.y-se.y);if(!l.length)return null;const f=l[0],p=l[l.length-1],d=(c.y+c.height+f.y)/2,g=(p.y+p.height+u.y)/2,h=s?d:g,m=s?g:d,_=e.waypoints[0],y=e.waypoints[e.waypoints.length-1],x=Gn(t),S=t.edges.filter(z=>z.id!==e.id),P=$n(e,S),C=hn(e,x).length;if(P===0&&C===0||C===0&&e.waypoints.length===2)return null;const L=Math.min(...l.map(z=>z.x)),T=Math.max(...l.map(z=>z.x+z.width)),j=(_.x+y.x)/2,k=z=>z.filter((se,we)=>we===0||!(dt(se.x,z[we-1].x)&&dt(se.y,z[we-1].y)));let D;for(let z=L;z<=T;z+=YE){const se=k([_,{x:_.x,y:h},{x:z,y:h},{x:z,y:m},{x:y.x,y:m},y]),we={...e,waypoints:se};if(hn(we,x).length>0)continue;const Ke=$n(we,S),Y=Math.abs(z-j);(!D||Ke<D.cross||Ke===D.cross&&Y<D.detour)&&(D={pts:se,cross:Ke,detour:Y})}return D&&(C>0?D.cross<=P:D.cross<P)?D.pts:null}function ch(e,t){const{elementRegistry:n}=e,i=e.modeling,r=ft(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=ft(n),s=a.edges.find(l=>l.id===o.id);if(!s)continue;const c=sh(s,a);if(!c)continue;const u=n.get(o.id);u&&i.updateWaypoints(u,c)}}const Ki=[25,-25,40,-40],hs=35;function ms(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];if(i.x+i.width>n.x)return[];const r=n.y+n.height/2;if(r>=i.y&&r<=i.y+i.height)return[];const o=i.x+i.width/2,a=n.x+n.width/2,s=r<i.y,c=s?i.y:i.y+i.height,u=s?n.y:n.y+n.height,l=s?n.y-hs:n.y+n.height+hs,f=[];for(const y of[0,...Ki]){if(Math.abs(y)>=i.width/2-5)continue;const x=o+y;f.push({pts:[{x:n.x,y:r},{x,y:r},{x,y:c}],cost:Math.abs(y)});for(const S of[0,...Ki]){if(Math.abs(S)>=n.width/2-5)continue;const P=a+S;f.push({pts:[{x:P,y:u},{x:P,y:l},{x,y:l},{x,y:c}],cost:Math.abs(y)+Math.abs(S)})}}const p=50,d=i.y+i.height/2,g=s?n.y+n.height:n.y;for(const y of[0,...Ki]){if(Math.abs(y)>=n.width/2-5)continue;const x=a+y;f.push({pts:[{x,y:g},{x,y:d},{x:i.x+i.width,y:d}],cost:p+Math.abs(y)})}const h=60,m=s?i.y+i.height:i.y,_=s?i.y+i.height+hs:i.y-hs;for(const y of[0,...Ki]){if(Math.abs(y)>=i.width/2-5)continue;const x=o+y;for(const S of[0,...Ki]){if(Math.abs(S)>=n.width/2-5)continue;const P=a+S;f.push({pts:[{x:P,y:g},{x:P,y:_},{x,y:_},{x,y:m}],cost:h+Math.abs(y)+Math.abs(S)})}}return f}const gs=30;function uh(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],r=e[n+1],o=dt(i.y,r.y)&&!dt(i.x,r.x),a=dt(i.x,r.x)&&!dt(i.y,r.y);if(!(!o&&!a))for(const s of t)if(o){const c=Math.min(i.x,r.x);if(Math.max(i.x,r.x)<=s.x||c>=s.x+s.width)continue;if(Math.abs(i.y-s.y)<gs||Math.abs(i.y-(s.y+s.height))<gs)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)<gs||Math.abs(i.x-(s.x+s.width))<gs)return!0}}return!1}const ys=40;function KE(e,t,n){let i=0;for(const r of t){if(r.container||n.includes(r.id))continue;const o=r.x-ys,a=r.x+r.width+ys,s=r.y-ys,c=r.y+r.height+ys;for(let u=1;u<e.length-2;u++){const l=e[u],f=e[u+1],p={x:Math.min(l.x,f.x),y:Math.min(l.y,f.y)},d={x:Math.max(l.x,f.x),y:Math.max(l.y,f.y)};if(p.x<a&&d.x>o&&p.y<c&&d.y>s){i++;break}}}return i}function lh(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(C=>C.container),i=new Map(t.shapes.map(C=>[C.id,C])),r=Gn(t),o=t.edges.filter(C=>C.id!==e.id),a=Nn(e,o),s=$n(e,o),c=C=>KE(C,t.shapes,e.endpoints)+(uh(C,n)?1:0),u=c(e.waypoints),l=C=>{if(!C)return;const L=C.x+C.width/2,T=C.y+C.height/2;return n.find(j=>j.type==="bpmn:Lane"&&L>=j.x&&L<=j.x+j.width&&T>=j.y&&T<=j.y+j.height)},f=l(i.get(e.endpoints[0]??"")),p=l(i.get(e.endpoints[1]??"")),d=!!f&&!!p&&f.id!==p.id,g=C=>{if(!d||!p)return!1;for(let L=1;L<C.length-2;L++){const T=C[L],j=C[L+1];if(dt(T.y,j.y)&&!dt(T.x,j.x)&&T.y>p.y&&T.y<p.y+p.height)return!0}return!1},h=g(e.waypoints),_=(C=>{if(!C)return;const L=C.x+C.width/2,T=C.y+C.height/2;return n.filter(j=>j.type==="bpmn:Participant"&&L>=j.x&&L<=j.x+j.width&&T>=j.y&&T<=j.y+j.height).sort((j,k)=>j.width*j.height-k.width*k.height)[0]})(i.get(e.endpoints[0]??"")),y=C=>{if(!_)return 0;let L=0;for(let T=1;T<C.length-1;T++){const j=C[T];(j.x<_.x||j.x>_.x+_.width||j.y<_.y||j.y>_.y+_.height)&&L++}return L},x=y(e.waypoints);if(!uh(e.waypoints,n)&&!(d&&!h)&&x===0)return null;const S=C=>C.reduce((L,T,j)=>j?L+Math.abs(T.x-C[j-1].x)+Math.abs(T.y-C[j-1].y):0,0);let P;for(const{pts:C,cost:L}of ms(e,i)){const T={...e,waypoints:C};if(hn(T,r).length>0)continue;const j=Nn(T,o);if(j>a)continue;const k=y(C);if(k>x)continue;const D=k<x&&j===0;if(!D&&$n(T,o)>s)continue;const z=c(C),se=g(C);if(!D&&!(se&&!h)&&z>=u)continue;const Ke=se?0:1,Y=S(C);(!P||k<P.out||k===P.out&&(Ke<P.lane||Ke===P.lane&&(j<P.opp||j===P.opp&&(z<P.sc||z===P.sc&&(L<P.cost||L===P.cost&&Y<P.len)))))&&(P={pts:C,out:k,sc:z,lane:Ke,opp:j,cost:L,len:Y})}return(P==null?void 0:P.pts)??null}function XE(e,t){const{elementRegistry:n}=e,i=e.modeling,r=ft(n).edges.filter(o=>!t.has(o.id)&&o.waypoints.length>=4).map(o=>o.id).sort();for(const o of r){const a=ft(n),s=a.edges.find(d=>d.id===o);if(!s||s.waypoints.length<4)continue;const c=Gn(a),u=a.edges.filter(d=>d.id!==o),l=hn(s,c).length,f=Nn(s,u),p=$n(s,u);for(const d of il(s,a.shapes)){if(d.length>=s.waypoints.length)continue;const g={...s,waypoints:d};if(hn(g,c).length>l||Nn(g,u)>f||$n(g,u)>p)continue;const h=n.get(o);h&&i.updateWaypoints(h,d);break}}}function ph(e,t){const{elementRegistry:n}=e,i=e.modeling,r=ft(n).edges.filter(o=>o.type==="bpmn:SequenceFlow"&&!t.has(o.id)).map(o=>o.id).sort();for(const o of r){const a=ft(n),s=a.edges.find(l=>l.id===o);if(!s)continue;const c=lh(s,a);if(!c)continue;const u=n.get(o);u&&i.updateWaypoints(u,c)}}function rl(e,t){const n=e.waypoints;if(n.length<3)return[];const i=[],r=t.get(e.endpoints[0]??""),o=t.get(e.endpoints[1]??""),a=dt(n[0].x,n[1].x)&&!dt(n[0].y,n[1].y),s=dt(n[n.length-1].x,n[n.length-2].x)&&!dt(n[n.length-1].y,n[n.length-2].y);for(const c of Ki){if(a&&r&&Math.abs(c)<r.width/2-5){const u=n.map(l=>({...l}));u[0].x+=c,u[1].x+=c,i.push({pts:u,cost:Math.abs(c)})}if(s&&o&&Math.abs(c)<o.width/2-5){const u=n.map(l=>({...l}));u[u.length-1].x+=c,u[u.length-2].x+=c,i.push({pts:u,cost:Math.abs(c)})}}return i}function ZE(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,u=n.y+n.height/2,l=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,g=a?i.x:i.x+i.width,h=o?i.y:i.y+i.height,m=[];for(const _ of[0,...Ki])Math.abs(_)<i.width/2-5&&m.push({pts:[{x:p,y:u},{x:l+_,y:u},{x:l+_,y:h}],cost:Math.abs(_)}),Math.abs(_)<i.height/2-5&&m.push({pts:[{x:c,y:d},{x:c,y:f+_},{x:g,y:f+_}],cost:Math.abs(_)});return m}function ol(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,u=a?i.y+i.height:i.y,l=(r+o)/2,f=[];for(const p of[0,...Ki]){const d=l+p;d<=r||d>=o||f.push({pts:[{x:d,y:c},{x:d,y:u}],cost:Math.abs(p)})}return f}function fh(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=Gn(t),r=t.edges.filter(d=>d.id!==e.id),o=Nn(e,r);if(o===0)return null;const a=$n(e,r);let s;const c=d=>d.reduce((g,h,m)=>m?g+Math.abs(h.x-d[m-1].x)+Math.abs(h.y-d[m-1].y):0,0),u=3,l=d=>{const g=d[0],h=d[d.length-1],m=Math.hypot(h.x-g.x,h.y-g.y);return m>=1&&c(d)/m>=u?1:0},f=l(e.waypoints),p=[...ms(e,n),...ol(e,n),...rl(e,n)];for(const{pts:d,cost:g}of p){const h={...e,waypoints:d};if(hn(h,i).length>0)continue;const m=Nn(h,r),_=$n(h,r),y=o-m+(f-l(d));if(m>=o||_-a>y)continue;const x=c(d);(!s||m<s.opposite||m===s.opposite&&(_<s.cross||_===s.cross&&(g<s.cost||g===s.cost&&x<s.len)))&&(s={pts:d,opposite:m,cross:_,cost:g,len:x})}return(s==null?void 0:s.pts)??null}function dh(e,t){var i;let n=0;for(const r of t)r.id!==e.id&&((i=oo(e,r))==null?void 0:i.kind)==="unrelated"&&n++;return n}function QE(e,t){const n=new Map(t.shapes.map(p=>[p.id,p])),i=Gn(t),r=t.edges.filter(p=>p.id!==e.id),o=dh(e,r);if(o===0)return null;const a=Nn(e,r),s=$n(e,r),c=p=>p.reduce((d,g,h)=>h?d+Math.abs(g.x-p[h-1].x)+Math.abs(g.y-p[h-1].y):0,0),u=2;let l;const f=[...ms(e,n),...ol(e,n),...ZE(e,n),...rl(e,n)];for(const{pts:p,cost:d}of f){const g={...e,waypoints:p};if(hn(g,i).length>0)continue;const h=dh(g,r);if(h>=o)continue;const m=Nn(g,r);if(m-h>a-o)continue;const _=$n(g,r);if(_-s>(o-h)*u)continue;const y=c(p);(!l||h<l.fake||h===l.fake&&(m<l.unreadable||m===l.unreadable&&(_<l.cross||_===l.cross&&(d<l.cost||d===l.cost&&y<l.length))))&&(l={pts:p,fake:h,unreadable:m,cross:_,cost:d,length:y})}return(l==null?void 0:l.pts)??null}function hh(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Vn(ft(i)).filter(s=>s.kind==="edge-overlap-unrelated"&&!t.has(ri(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=ft(i),u=c.edges.find(p=>p.id===s);if(!u)continue;const l=QE(u,c);if(!l)continue;const f=i.get(s);f&&r.updateWaypoints(f,l)}}function mh(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 gh(e,t,n){var u;if(e.type!=="bpmn:SequenceFlow"||t.type!=="bpmn:SequenceFlow"||((u=oo(e,t))==null?void 0:u.kind)!=="opposite")return!1;const[i,r]=e.endpoints,[o,a]=t.endpoints,s=[i,r].filter(l=>l&&(l===o||l===a)).length;return!(!!r&&r===o||!!a&&a===i)||s!==1?!1:mh(e,n)&&mh(t,n)}function yh(e,t,n){let i=0;for(const r of t)r.id!==e.id&&gh(e,r,n)&&i++;return i}function JE(e,t){const n=new Map(t.shapes.map(p=>[p.id,p])),i=Gn(t),r=t.edges.filter(p=>p.id!==e.id),o=yh(e,r,n);if(o===0)return null;const a=Nn(e,r),s=$n(e,r),c=p=>p.reduce((d,g,h)=>h?d+Math.abs(g.x-p[h-1].x)+Math.abs(g.y-p[h-1].y):0,0),u=2;let l;const f=[...ms(e,n),...ol(e,n),...rl(e,n)];for(const{pts:p,cost:d}of f){const g={...e,waypoints:p};if(hn(g,i).length>0)continue;const h=yh(g,r,n);if(h>=o)continue;const m=Nn(g,r);if(m-h>a-o)continue;const _=$n(g,r);if(_-s>(o-h)*u)continue;const y=c(p);(!l||h<l.chain||h===l.chain&&(m<l.unreadable||m===l.unreadable&&(_<l.cross||_===l.cross&&(d<l.cost||d===l.cost&&y<l.length))))&&(l={pts:p,chain:h,unreadable:m,cross:_,cost:d,length:y})}return(l==null?void 0:l.pts)??null}function e1(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=ft(i),a=new Map(o.shapes.map(u=>[u.id,u])),s=Vn(o).filter(u=>u.kind==="edge-overlap-opposite"&&!t.has(ri(u)));if(!s.length)return;const c=new Set;for(const u of s){if(u.kind!=="edge-overlap-opposite")continue;const[l,f]=u.edges.map(p=>o.edges.find(d=>d.id===p));if(!(!l||!f||!gh(l,f,a)))for(const p of u.edges)n.has(p)||c.add(p)}for(const u of[...c].sort()){const l=ft(i),f=l.edges.find(g=>g.id===u);if(!f)continue;const p=JE(f,l);if(!p)continue;const d=i.get(u);d&&r.updateWaypoints(d,p)}}function vh(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=ft(i),a=Vn(o).filter(l=>Zu(l)&&!t.has(ri(l)));if(!a.length)return;const s=new Set;for(const l of a)if(Zu(l))for(const f of l.edges)n.has(f)||s.add(f);const c=l=>{var f;return((f=o.edges.find(p=>p.id===l))==null?void 0:f.type)??""},u=[...s].sort((l,f)=>{const p=c(l)==="bpmn:SequenceFlow"?0:1,d=c(f)==="bpmn:SequenceFlow"?0:1;return p!==d?p-d:l.localeCompare(f)});for(const l of u){const f=ft(i),p=f.edges.find(h=>h.id===l);if(!p)continue;const d=fh(p,f);if(!d)continue;const g=i.get(l);g&&r.updateWaypoints(g,d)}}const t1=10,n1=(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 bh(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!fs(e,i))return null;const r=Gn(t),o=i.flatMap(dn);for(const a of dn(e)){let s=[[a.lo,a.hi]];for(const[d,g]of ps(a,o))s=s.flatMap(([h,m])=>{const _=[];return d>h&&_.push([h,Math.min(m,d)]),g<m&&_.push([Math.max(h,g),m]),_.filter(([y,x])=>x>y)});const c=a.axis==="h"?n.width:n.height,u=s.find(([d,g])=>g-d>=c+t1*2);if(!u)continue;const l=(u[0]+u[1])/2,f=a.axis==="h"?{x:l,y:a.at-jd}:{x:a.at+Cn+n.width/2,y:l},p={x:f.x-n.width/2,y:f.y-n.height/2,width:n.width,height:n.height};if(!fs({...e,label:p},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&n1(p,d)))return p}return null}const Cn=8;function _h(e,t){const n=e.label;if(!n)return null;const i=dn(e);if(!i.length)return null;const r=n.x+n.width/2,o=n.y+n.height/2,a=p=>{const d=p.axis==="h"?r:o,g=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(g,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(dn),...t.shapes.filter(p=>p.container).flatMap(Ko)],u=p=>!c.some(d=>Pi(p,d));if(u(n))return null;const l=(s.axis==="v"?n.height:n.width)+Cn,f=[0,-l,l,-2*l,2*l];if(s.axis==="v")for(const p of[s.at+Cn,s.at-Cn-n.width])for(const d of f){const g=n.y+d;if(g<s.lo||g+n.height>s.hi)continue;const h={...n,x:p,y:g};if(u(h))return h}else for(const p of[s.at-Cn-n.height,s.at+Cn])for(const d of f){const g=n.x+d;if(g<s.lo||g+n.width>s.hi)continue;const h={...n,x:g,y:p};if(u(h))return h}return null}function xh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=ft(n);for(const o of r.edges){if(!o.label||t.has(o.id))continue;const a=_h(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=ft(i),a=Vn(o).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(ri(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 u=bh(c,o);if(!u)continue;const l=i.get(s.edge),f=l==null?void 0:l.label;f&&r.moveElements([f],{x:u.x-f.x,y:u.y-f.y})}}function Eh(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(dn),...t.shapes.filter(p=>p.container).flatMap(Ko)],r=i.filter(p=>Pi(n,p));if(!r.length)return null;const o=t.shapes.filter(p=>!p.container&&p.id!==e.id),a=so(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=>Pi(p,d))&&!o.some(d=>s(p,d))&&!a.some(d=>s(p,d)),u=[];for(const p of r)p.axis==="h"?u.push({...n,y:p.at-Cn-n.height},{...n,y:p.at+Cn}):u.push({...n,x:p.at-Cn-n.width},{...n,x:p.at+Cn});const l=e.x+e.width/2,f=e.y+e.height/2;return u.push({...n,x:l-n.width/2,y:e.y+e.height+Cn},{...n,x:l-n.width/2,y:e.y-Cn-n.height},{...n,x:e.x+e.width+Cn,y:f-n.height/2},{...n,x:e.x-Cn-n.width,y:f-n.height/2}),u.find(c)??null}function Sh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=ft(n);for(const o of r.shapes){if(o.container||!o.label||t.has(o.id))continue;const a=Eh(o,ft(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})}}const i1=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,Rh=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),Ch={"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}]},vs=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),al=e=>typeof e=="string"&&e!=="";function r1(e){const t=[];function n(i,r,o,a){if(a===null){al(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!vs(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)al(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{if(!vs(i)||!al(i.kind)||!(i.kind in Ch)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const o of Ch[i.kind]){const a=o.path.endsWith("[]"),s=a?o.path.slice(0,-2):o.path,c=s.split(".");let u=i;for(const f of c.slice(0,-1)){if(!vs(u))break;u=u[f]}if(!vs(u))continue;const l=u[c[c.length-1]];if(!(l===void 0&&o.optional)&&!(l===null&&o.optional)){if(!a){n(r,o.path,l,o.shape);continue}if(!Array.isArray(l)){t.push({kind:"payload-invalid",opIndex:r,field:o.path});continue}l.forEach((f,p)=>n(r,`${s}[${p}]`,f,o.shape))}}if(i.kind==="node.add"||i.kind==="node.update"){const o=i.band;o!==void 0&&(!Number.isInteger(o)||o<0)&&t.push({kind:"payload-invalid",opIndex:r,field:"band"})}}),t}function Ph(e,t){const n=r1(e);if(n.length>0)return n;const i=[],r=new Map,o=new Map;function a(p,d,g){if(!i1.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,{...g,opIndex:p})}e.forEach((p,d)=>{var g;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"}),(g=p.association)!=null&&g.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 u(p,d,g,h){const m=s(d);if(m===void 0){i.push({kind:"ref-missing",opIndex:p,ref:d,role:g});return}if(h&&!h.includes(m)){i.push({kind:"ref-category",opIndex:p,ref:d,role:g,expected:h.join("|"),actual:m});return}return m}const l=t.isCollaboration()||e.some(p=>p.kind==="participant.add");return e.forEach((p,d)=>{var g;switch(p.kind){case"participant.add":break;case"node.add":{const{participant:h,lane:m}=p.node;if(h===void 0){(l||m!==void 0)&&i.push({kind:"participant-required",opIndex:d,id:p.node.id});break}if(u(d,h,"participant",["participant"])===void 0)break;m!==void 0&&((((g=r.get(h))==null?void 0:g.lanes)??o.get(h)??t.lanesOf(h)).includes(m)||i.push({kind:"lane-unknown",opIndex:d,lane:m,participant:h}));break}case"sequenceFlow.add":{const{id:h,source:m,target:_,name:y,condition:x}=p.flow,S=u(d,m,"source",["flowNode"]),P=u(d,_,"target",["flowNode"]);S&&P&&c(m)!==c(_)&&i.push({kind:"flow-cross-pool",opIndex:d,id:h}),y!==void 0&&x!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:h});break}case"messageFlow.add":{const{id:h,source:m,target:_}=p.flow,y=u(d,m,"source",["flowNode","participant"]),x=u(d,_,"target",["flowNode","participant"]);if(y&&x){const S=c(m),P=c(_);S!==void 0&&S===P&&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(y=>y===p.dataStore.id).length!==1){i.push({kind:"data-association-ends",opIndex:d,source:h.source,target:h.target});continue}const _=h.source===p.dataStore.id?h.target:h.source;u(d,_,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:h,target:m}=p.association,_=u(d,h,"source"),y=u(d,m,"target");if(_&&y){const x=new Set([_,y]);x.has("dataStore")&&x.has("flowNode")||i.push({kind:"data-association-ends",opIndex:d,source:h,target:m})}break}case"association.add":{const{id:h,source:m,target:_}=p.association,y=u(d,m,"source"),x=u(d,_,"target");y&&x&&y!=="annotation"&&x!=="annotation"&&i.push({kind:"association-detached",opIndex:d,annotation:h??`${m}->${_}`});break}case"annotation.add":{if(p.association){const{source:h,target:m}=p.association;if(h!==p.annotation.id&&m!==p.annotation.id)i.push({kind:"association-detached",opIndex:d,annotation:p.annotation.id});else{const _=h===p.annotation.id?m:h;u(d,_,"association")}}p.placement&&u(d,p.placement.anchor,"anchor");break}case"group.add":{for(const h of p.group.members??[]){const m=u(d,h,"member");m&&Rh.has(m)&&i.push({kind:"ref-category",opIndex:d,ref:h,role:"member",expected:"shape",actual:m})}break}case"participant.update":{if(f(d,p.id,"participant")===void 0)break;if(p.lanes){const h=t.lanesOf(p.id),m=p.lanes.map(y=>y.id);for(const y of h)m.includes(y)||i.push({kind:"lane-shrink-unsupported",opIndex:d,participant:p.id,lane:y});for(const y of m)t.categoryOf(y)!==void 0&&!h.includes(y)&&i.push({kind:"id-duplicate",opIndex:d,id:y});const _=m.filter(y=>h.includes(y));_.length===h.length&&_.some((y,x)=>y!==h[x])&&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||u(d,p.source,"source",["flowNode"])!==void 0,m=p.target===void 0||u(d,p.target,"target",["flowNode"])!==void 0,_=t.endpointsOf(p.id),y=p.source??(_==null?void 0:_.source),x=p.target??(_==null?void 0:_.target);h&&m&&y!==void 0&&x!==void 0&&new Set([c(y),c(x),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&&u(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 m=u(d,h,"member");m&&Rh.has(m)&&i.push({kind:"ref-category",opIndex:d,ref:h,role:"member",expected:"shape",actual:m})}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,g){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(g&&h!==g){i.push({kind:"ref-category",opIndex:p,ref:d,role:"target",expected:g,actual:h});return}return h}}function Ah(e){return{modeling:e.get("modeling"),bpmnFactory:e.get("bpmnFactory"),elementFactory:e.get("elementFactory"),elementRegistry:e.get("elementRegistry"),canvas:e.get("canvas"),autoPlace:e.get("autoPlace"),bpmnReplace:e.get("bpmnReplace")}}function bs(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const _s={"top-left":[-1,-1],top:[0,-1],"top-right":[1,-1],right:[1,0],"bottom-right":[1,1],bottom:[0,1],"bottom-left":[-1,1],left:[-1,0]},en=10,Th=40,o1=10;function sl(e,t,n,i,r){const o=n,a=(k,D)=>{const[z,se]=_s[k];let we={x:t.x+t.width/2+z*(t.width/2+o.width/2+D),y:t.y+t.height/2+se*(t.height/2+o.height/2+D)};const Ke=i.x+en+o.width/2,Y=i.x+i.width-en-o.width/2,ue=i.y+en+o.height/2,_e=i.y+i.height-en-o.height/2,pe={x:Math.min(Y,Math.max(Ke,we.x)),y:Math.min(_e,Math.max(ue,we.y))};return(pe.x!==we.x||pe.y!==we.y)&&(we=Math.abs(pe.x-(t.x+t.width/2))<(t.width+o.width)/2+en&&Math.abs(pe.y-(t.y+t.height/2))<(t.height+o.height)/2+en?{x:t.x+t.width+en+o.width/2,y:pe.y}:pe),we},s=(i.children??[]).filter(k=>!("waypoints"in k&&k.waypoints)&&k.type!=="bpmn:Lane"&&k.type!=="label"&&typeof k.x=="number"&&k.id!==r.selfId),c=ft(e),u=k=>{var z,se;if(!r.selfId)return!1;const D=e.get(k);return!!D&&(((z=D.source)==null?void 0:z.id)===r.selfId||((se=D.target)==null?void 0:se.id)===r.selfId)},l=c.edges.filter(k=>!u(k.id)).flatMap(dn),f=so(c).filter(k=>k.owner!==r.selfId).map(k=>k.rect),p=k=>({x0:k.x-o.width/2-en,x1:k.x+o.width/2+en,y0:k.y-o.height/2-en,y1:k.y+o.height/2+en}),d=k=>{const D=p(k);return s.some(z=>D.x0<z.x+z.width&&D.x1>z.x&&D.y0<z.y+z.height&&D.y1>z.y)},g=k=>{const D=p(k);return l.some(z=>z.axis==="h"?z.at>D.y0&&z.at<D.y1&&z.lo<D.x1&&z.hi>D.x0:z.at>D.x0&&z.at<D.x1&&z.lo<D.y1&&z.hi>D.y0)},h=k=>{const D=p(k);return f.some(z=>D.x0<z.x+z.width&&D.x1>z.x&&D.y0<z.y+z.height&&D.y1>z.y)},m=c.shapes.filter(k=>k.type==="bpmn:Group").flatMap(k=>[{axis:"h",at:k.y,lo:k.x,hi:k.x+k.width},{axis:"h",at:k.y+k.height,lo:k.x,hi:k.x+k.width},{axis:"v",at:k.x,lo:k.y,hi:k.y+k.height},{axis:"v",at:k.x+k.width,lo:k.y,hi:k.y+k.height}]),_=k=>{const D=p(k);return m.some(z=>z.axis==="h"?z.at>D.y0&&z.at<D.y1&&z.lo<D.x1&&z.hi>D.x0:z.at>D.x0&&z.at<D.x1&&z.lo<D.y1&&z.hi>D.y0)},y=k=>d(k)||g(k)||h(k)||_(k),x=k=>k.x-o.width/2>=i.x&&k.x+o.width/2<=i.x+i.width&&k.y-o.height/2>=i.y&&k.y+o.height/2<=i.y+i.height;if(r.placement){const k=Y=>Y.startsWith("top")?Y.replace(/^top/,"bottom"):Y.replace(/^bottom/,"top"),D=Y=>Y.endsWith("left")?Y.replace(/left$/,"right"):Y.replace(/right$/,"left"),z=r.placement.side,se=[z,k(z),D(z),k(D(z)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],we=r.placement.offset??50;let Ke=a(z,we);if(y(Ke)){const Y=new Set;for(const ue of se){if(Y.has(ue))continue;Y.add(ue);const _e=a(ue,we);if(x(_e)&&!y(_e)){Ke=_e;break}}}return Ke}const S=r.from,P=i.x+en+o.width/2,C=i.x+i.width-en-o.width/2,L=i.y+en+o.height/2,T=i.y+i.height-en-o.height/2;let j={x:Math.min(C,Math.max(P,S.x)),y:Math.min(T,Math.max(L,S.y))};if(y(j)){const k=(t.width+o.width)/2+en,z=[{x:j.x+k,y:j.y},{x:j.x-k,y:j.y},{x:j.x,y:j.y-o.height-en},{x:j.x,y:j.y+o.height+en}].filter(x).find(se=>!y(se));z&&(j=z)}return j}function Kt(e,t){return e.filter(n=>n.kind===t)}function Mh(e,t){var n0,i0,r0,o0,a0,s0,c0,u0,l0,p0,f0,d0,h0,m0,g0,y0,v0,b0,_0,x0,w0,E0,S0;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:s,bpmnReplace:c}=t,u=()=>a.getRootElement(),l=v=>o.get(v),f=v=>{const R=l(v);if(!R)throw new Error(`하강 참조 해소 실패: ${v}`);return R},p=v=>{let R=v.parent;for(;R;){if(R.type==="bpmn:Participant")return R;R=R.parent}},d=new Map;for(const v of o.filter(R=>!("waypoints"in R&&R.waypoints)&&R.type!=="bpmn:Lane"&&R.type!=="label"&&typeof R.x=="number"))d.set(v.id,{x:v.x,y:v.y});const g=Kt(e,"participant.add"),h=Kt(e,"node.add"),m=Kt(e,"sequenceFlow.add"),_=Kt(e,"messageFlow.add"),y=Kt(e,"dataStore.add"),x=Kt(e,"dataAssociation.add"),S=Kt(e,"annotation.add"),P=Kt(e,"group.add"),C=new Map(h.map(v=>[v.node.id,v])),L=(v,R,A)=>{var $;const O=v.businessObject,F=((($=O.extensionElements)==null?void 0:$.values)??[]).filter(G=>G.$type!==R),B=A?[...F,i.create(R,A)]:F;if(!B.length){O.extensionElements&&n.updateProperties(v,{extensionElements:void 0});return}const N=i.create("bpmn:ExtensionElements",{values:B});B.forEach(G=>{G.$parent=N}),n.updateProperties(v,{extensionElements:N})},T=v=>({anchor:v.anchor,side:v.side,...v.offset!==void 0?{offset:v.offset}:{}});for(const v of Kt(e,"element.remove")){const R=l(v.id);R&&n.removeElements([R])}const j=v=>o.filter(R=>{var A;return R.type==="bpmn:Lane"&&((A=p(R))==null?void 0:A.id)===v}).sort((R,A)=>R.y-A.y);for(const v of Kt(e,"participant.update")){const R=f(v.id);if(v.name!==void 0&&n.updateProperties(R,{name:v.name??void 0}),!v.lanes)continue;const A=j(v.id);if(!A.length){n.splitLane(R,v.lanes.length),j(v.id).forEach((F,B)=>{const N=v.lanes[B];N&&n.updateProperties(F,{id:N.id,name:N.name})});continue}const O=new Set(A.map(F=>F.id));v.lanes.forEach((F,B)=>{if(O.has(F.id)){n.updateProperties(f(F.id),{name:F.name});return}const N=B===0?n.addLane(j(v.id)[0],"top"):n.addLane(f(v.lanes[B-1].id),"bottom");n.updateProperties(N,{id:F.id,name:F.name})})}const k=150,D=130,z=80,se=90,we=180,Ke=30,Y=30,ue=(v,R,A,O,F)=>{const B=A-R.width/2,N=O-R.height/2;return(v.children??[]).find($=>!("waypoints"in $&&$.waypoints)&&$.type!=="bpmn:Lane"&&$.type!=="label"&&!(F!=null&&F.has($.id))&&typeof $.x=="number"&&B<$.x+$.width+Y&&B+R.width+Y>$.x&&N<$.y+$.height&&N+R.height>$.y)},_e=new Set;for(const v of g){_e.add(`pool:${v.participant.id}`);for(const R of v.participant.lanes??[])_e.add(R.id)}const pe=new Map;for(const v of h){const R=v.node.lane??`pool:${v.node.participant??""}`;let A=pe.get(R);A||pe.set(R,A=new Set([0])),v.band!==void 0&&A.add(v.band)}const xe=new Map;for(const[v,R]of pe){if(!_e.has(v))continue;const A=[...R].sort((B,N)=>B-N),O=A.map((B,N)=>N===0?0:N%2===1?Math.ceil(N/2):-(N/2)),F=Math.min(...O);xe.set(v,new Map(A.map((B,N)=>[B,O[N]-F])))}{const v=new Map;for(const R of g)(R.participant.lanes??[]).forEach((A,O)=>v.set(A.id,O));for(const[R,A]of xe){if(!v.has(R)||A.size<2)continue;const O=v.get(R),F=A.get(0)??0,B=new Set;for(const re of h){if(re.node.lane!==R||(re.band??0)!==0||!re.node.type.endsWith("Gateway"))continue;const Le={in:new Set,out:new Set,cross:new Set};for(const me of m){const fe=me.flow.source===re.node.id;if(!fe&&me.flow.target!==re.node.id)continue;const ze=C.get(fe?me.flow.target:me.flow.source);if(!ze||ze.node.participant!==re.node.participant||!ze.node.lane)continue;let oe,ge=!1;if(ze.node.lane!==R){const Se=v.get(ze.node.lane);if(Se===void 0)continue;oe=Se>O?"down":"up",ge=!0}else{const Se=A.get(ze.band??0)??F;oe=Se>F?"down":Se<F?"up":void 0}oe&&(Le[fe?"out":"in"].add(oe),ge&&Le.cross.add(oe))}for(const me of["up","down"])Le.in.has(me)&&Le.out.has(me)&&Le.cross.has(me)&&B.add(me)}if(B.size!==1)continue;const[N]=B,$=Math.max(...A.values()),G=N==="down"?$:0;if(F===G)continue;const K=[...A.entries()].filter(([re])=>re!==0).sort((re,Le)=>re[1]-Le[1]),le=[...Array($+1).keys()].filter(re=>re!==G),Ee=new Map([[0,G]]);K.forEach(([re],Le)=>Ee.set(re,le[Le])),xe.set(R,Ee)}}const ce=v=>{var R;return(((R=pe.get(v))==null?void 0:R.size)??0)>1},U=v=>v.band??(v.node.lane||!ce(`pool:${v.node.participant??""}`)?void 0:0),q=new Map,Z=v=>q.get(v.node.id)??U(v),Ve=new Set,Zt=new Set;{const v=new Map;for(const O of m)v.set(O.flow.target,(v.get(O.flow.target)??0)+1);const R=O=>{const F=[],B=new Set([O]),N=[O];for(;N.length;){const $=N.shift();F.push($);for(const G of m)G.flow.source!==$||B.has(G.flow.target)||(v.get(G.flow.target)??0)!==1||(B.add(G.flow.target),N.push(G.flow.target))}return F},A=(O,F)=>{var B;return((B=xe.get(O))==null?void 0:B.get(F))??F};for(const O of h){if(!O.node.type.endsWith("Gateway"))continue;const F=O.node.lane??`pool:${O.node.participant??""}`,B=xe.get(F);if(!B||B.size<2)continue;const N=Z(O);if(N===void 0||A(F,N)!==A(F,0))continue;const $=A(F,N),G=m.filter(me=>me.flow.source===O.node.id).map(me=>C.get(me.flow.target)).filter(me=>!!me&&(me.node.lane??`pool:${me.node.participant??""}`)===F),K=G.filter(me=>{const fe=Z(me);return fe!==void 0&&A(F,fe)===$&&(v.get(me.node.id)??0)===1}),le=G.some(me=>{const fe=Z(me);return fe!==void 0&&A(F,fe)>$});if(K.length!==1||!le)continue;const Ee=new Set(G.flatMap(me=>R(me.node.id)));if(!m.some(me=>me.flow.target===O.node.id&&Ee.has(me.flow.source)))continue;const Le=new Map;for(const[me,fe]of B)Le.set(me,fe+1);Le.set(-1,0),xe.set(F,Le);for(const me of R(K[0].node.id))C.has(me)&&(q.set(me,-1),Zt.add(me));Ve.add(O.node.id)}}const M=(v,R)=>{var A;return((A=xe.get(v))==null?void 0:A.get(R))??R},E=new Map;for(const[v,R]of pe){let A=0;for(const O of R)A=Math.max(A,M(v,O));E.set(v,A)}const b=v=>we+k*v,H=(v,R,A)=>{const O=u().children.filter(F=>!("waypoints"in F&&F.waypoints)&&F.id!==R&&typeof F.y=="number"&&F.y>=v);O.length&&n.moveElements(O,{x:0,y:A})},W=(v,R,A)=>{const O=v.type==="bpmn:Participant"?v:void 0;if(!O||O.children.some($=>$.type==="bpmn:Lane"))return;const F=A+R.height/2+Ke-O.y;if(O.height>=F)return;const B=F-O.height,N=O.y+O.height;n.resizeShape(O,{x:O.x,y:O.y,width:O.width,height:F}),H(N,O.id,B)},Q=(v,R,A)=>{if(v){const N=f(v),$=b(R);if(N.height>=$)return;const G=$-N.height,K=p(N),le=K?K.y+K.height:N.y+N.height;n.resizeLane(N,{x:N.x,y:N.y,width:N.width,height:$},!1),H(le,K==null?void 0:K.id,G);return}if(!A)return;const O=k*(R+1);if(A.height>=O)return;const F=O-A.height,B=A.y+A.height;n.resizeShape(A,{x:A.x,y:A.y,width:A.width,height:O}),H(B,A.id,F)},be=g.map((v,R)=>({op:v,declared:R}));be.sort((v,R)=>{const A=v.op.order??Number.POSITIVE_INFINITY,O=R.op.order??Number.POSITIVE_INFINITY;return A!==O?A-O:v.declared-R.declared});let Be=80;for(const v of o.getAll())v.parent===u()&&"height"in v&&typeof v.y=="number"&&(Be=Math.max(Be,v.y+v.height+60));for(const{op:v}of be){const R=v.participant,A=h.filter(re=>re.node.participant===R.id).length,O=((n0=R.lanes)==null?void 0:n0.length)??0,F=Math.max(1200,A*160+300),B=(R.lanes??[]).map(re=>b(E.get(re.id)??0)),N=B.reduce((re,Le)=>re+Le,0);O&&N<300&&(B[O-1]+=300-N);const $=Math.max(300,k*((E.get(`pool:${R.id}`)??0)+1)),G=R.blackBox||A+O===0?120:O?Math.max(300,N):$,K=r.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:R.id,name:R.name,...v.order!==void 0?{"bwl:poolOrder":v.order}:{},...R.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:F,height:G,isExpanded:!0}),le=n.createShape(K,{x:100+F/2,y:Be+G/2},u()),Ee=R.lanes??[];if(Ee.length&&n.splitLane(le,Ee.length),Ee.length){const re=o.filter(Le=>{var me;return Le.type==="bpmn:Lane"&&((me=p(Le))==null?void 0:me.id)===R.id}).sort((Le,me)=>Le.y-me.y);if(re.forEach((Le,me)=>{const fe=Ee[me];fe&&n.updateProperties(Le,{id:fe.id,name:fe.name})}),B.some(Le=>Le!==le.height/O)){let Le=le.y;re.forEach((me,fe)=>{const ze=B[fe];n.resizeShape(me,{x:me.x,y:Le,width:me.width,height:ze}),Le+=ze})}}Be=le.y+le.height+60}const et=v=>{var O;const R=C.get(v);if(R)return R.node.participant??"";const A=l(v);return A?A.type==="bpmn:Participant"?A.id:((O=p(A))==null?void 0:O.id)??"":""},yt=new Map,rt=v=>{let R=yt.get(v);return R||yt.set(v,R={nodes:[],flows:[]}),R};for(const v of h)rt(v.node.participant??"").nodes.push(v);for(const v of m)rt(et(v.flow.source)).flows.push(v);const Tt=v=>{var R;return i.create("bpmn:SequenceFlow",{id:v.id,name:v.name??((R=v.condition)==null?void 0:R.label)})},Jt=(v,R)=>r.createShape({type:bs(v.type),businessObject:i.create(bs(v.type),{id:v.id,name:v.name,...R!==void 0?{"bwl:band":R}:{}})}),yn=[...be.map(({op:v})=>v.participant.id).filter(v=>yt.has(v)),...[...yt.keys()].filter(v=>!g.some(R=>R.participant.id===v))],ut=v=>v.endsWith("Gateway");for(const v of yn){const R=yt.get(v),A=v?f(v):void 0,O=A?A.x+150:250;let F=A?A.y+80:120;const B=(oe,ge,Se)=>{if(oe){const Ae=f(oe);return Ae.y+Math.min(Ae.height/2,se)+M(oe,ge??0)*k}return ge!==void 0&&A?A.y+z+M(`pool:${v}`,ge)*k:Se},N=(oe,ge,Se)=>{if(oe){const Ae=f(oe);return Ae.y+Math.min(Ae.height/2,se)+ge*k}return A?A.y+z+ge*k:Se},$=oe=>oe.participant?f(oe.participant):u(),G=(oe,ge,Se,Ae,nt,Ne)=>{const vt=Se!==void 0||Ae!==void 0,lt=M(Se??`pool:${v}`,Ae??0);if(vt)for(let ee=0;ee<4;ee++){const X=N(Se,lt+ee,Ne);if(!ue(oe,ge,nt,X))return Q(Se,lt+ee,A),{x:nt,y:X}}const J=B(Se,Ae,Ne);vt?Q(Se,lt,A):W(oe,ge,J);let Ce=nt;for(let ee=0;ee<64;ee++){const X=ue(oe,ge,Ce,J);if(!X)break;Ce=X.x+X.width+D+ge.width/2}return{x:Ce,y:J}},K=new Set(R.flows.map(oe=>oe.flow.target)),le=new Map;for(const oe of R.nodes){if(K.has(oe.node.id))continue;const ge=Jt(oe.node,oe.band),Se=U(oe),Ae=oe.node.lane?`${oe.node.lane}|${Se??""}`:Se!==void 0?`band:${Se}`:"",nt=$(oe.node),Ne=G(nt,ge,oe.node.lane,Se,le.get(Ae)??O,F);n.createShape(ge,Ne,nt),le.set(Ae,Ne.x+ge.width+D),!oe.node.lane&&Se===void 0&&(F+=160)}const Ee=new Set,re=new Map,Le=new Map,me=new Map;if(v&&_e.has(`pool:${v}`)){const oe=new Map;for(const J of R.flows)oe.set(J.flow.target,(oe.get(J.flow.target)??0)+1);const ge=J=>B(J.node.lane,Z(J),Number.NaN),Se=new Set,Ae=J=>{var X;const Ce=(X=C.get(J))==null?void 0:X.node.participant;if(Ce)return l(Ce);const ee=l(J);if(ee)return ee.type==="bpmn:Participant"?ee:p(ee)},nt=J=>{const Ce=[],ee=new Set([J]),X=[J];for(;X.length;){const he=X.shift(),Me=C.get(he);Me&&Ce.push(Me);for(const Re of R.flows)Re.flow.source!==he||ee.has(Re.flow.target)||(oe.get(Re.flow.target)??0)!==1||(ee.add(Re.flow.target),X.push(Re.flow.target))}return Ce},Ne=J=>{if(!A)return;const Ce=new Set(J.map(he=>he.node.id));let ee=!1,X=!1;for(const he of _){if(!Ce.has(he.flow.source))continue;const Me=Ae(he.flow.target);!Me||Me.id===A.id||(Me.y<A.y?ee=!0:X=!0)}return ee&&!X?"up":X&&!ee?"down":void 0};for(const J of R.nodes){if(!ut(J.node.type))continue;const Ce=B(J.node.lane,U(J),Number.NaN);if(Number.isNaN(Ce))continue;const ee=[];for(const Re of R.flows){if(Re.flow.source!==J.node.id)continue;const He=C.get(Re.flow.target);if(!He||He.node.lane!==J.node.lane||(oe.get(He.node.id)??0)!==1)continue;const it=U(He);if(it===void 0)continue;const Ut=B(He.node.lane,it,Number.NaN);if(Number.isNaN(Ut))continue;const si=nt(He.node.id),Pt=Ne(si);Pt&&ee.push({subtree:si,band:it,row:Ut,dir:Pt})}if(!ee.some(Re=>Re.dir==="up")||!ee.some(Re=>Re.dir==="down")||!ee.some(Re=>Re.dir==="up"&&ee.some(He=>He.dir==="down"&&He.row<Re.row)))continue;const he=[...ee].sort((Re,He)=>Re.row-He.row);[...ee.filter(Re=>Re.dir==="up"),...ee.filter(Re=>Re.dir==="down")].sort((Re,He)=>Re.dir===He.dir?Re.row-He.row:Re.dir==="up"?-1:1).forEach((Re,He)=>{const it=he[He].band;if(it!==Re.band){Se.add(J.node.id);for(const Ut of Re.subtree)U(Ut)===Re.band&&q.set(Ut.node.id,it)}})}const vt=J=>{if(!A)return;const Ce=new Set(J.map(he=>he.node.id));let ee=!1,X=!1;for(const he of _){if(!Ce.has(he.flow.target))continue;const Me=Ae(he.flow.source);!Me||Me.id===A.id||(Me.y<A.y?ee=!0:X=!0)}return ee&&!X?"up":X&&!ee?"down":void 0};for(const J of R.nodes){if(!ut(J.node.type))continue;const Ce=J.node.lane??`pool:${v}`,ee=xe.get(Ce);if(!ee||ee.size<2)continue;const X=ee.get(0);if(X===void 0)continue;const he=Math.max(...ee.values()),Me=X===he&&X!==0?"down":void 0;if(!Me)continue;const Re=[];for(const Pt of R.flows){if(Pt.flow.source!==J.node.id)continue;const mt=C.get(Pt.flow.target);if(!mt||mt.node.lane!==J.node.lane||(oe.get(mt.node.id)??0)!==1)continue;const es=Z(mt);es!==void 0&&Re.push({t:mt,subtree:nt(mt.node.id),band:es})}const He=Re.find(Pt=>(ee.get(Pt.band)??Pt.band)===X);if(!He||vt(He.subtree)===Me||Ne(He.subtree)===Me)continue;const it=Re.find(Pt=>Pt!==He&&vt(Pt.subtree)===Me);if(!it)continue;const Ut=He.band,si=it.band;for(const Pt of He.subtree)Z(Pt)===Ut&&q.set(Pt.node.id,si);for(const Pt of it.subtree)Z(Pt)===si&&q.set(Pt.node.id,Ut);Se.add(J.node.id)}for(const J of R.nodes){if(!ut(J.node.type))continue;const Ce=ge(J);if(Number.isNaN(Ce)||S.some(Re=>{var He,it;return(((He=Re.placement)==null?void 0:He.anchor)??(Re.association?Re.association.source===Re.annotation.id?Re.association.target:Re.association.source:void 0))===J.node.id&&((it=Re.placement)==null?void 0:it.side.startsWith("bottom"))}))continue;let X,he=!1,Me;for(const Re of R.flows){if(Re.flow.source!==J.node.id)continue;const He=C.get(Re.flow.target);if(!He||!He.node.lane&&U(He)===void 0)continue;const it=ge(He);Number.isNaN(it)||(Math.abs(it-Ce)<.5&&(he=!0),it>Ce?!X||it>X.row?X={id:He.node.id,row:it,count:1}:it===X.row&&X.count++:it<Ce&&He.node.lane===J.node.lane&&(!Me||it>Me.row?Me={op:He,row:it,count:1}:it===Me.row&&Me.count++))}X&&X.count===1&&(oe.get(X.id)??0)===1&&!Se.has(J.node.id)&&Ee.add(X.id),!he&&Me&&Me.count===1&&(oe.get(Me.op.node.id)??0)===1&&!Ve.has(J.node.id)&&re.set(Me.op.node.id,{lane:J.node.lane,band:Z(J)})}const lt=new Map;for(const J of _)lt.set(J.flow.target,[...lt.get(J.flow.target)??[],J]);for(const J of R.nodes){const Ce=lt.get(J.node.id);if(!Ce||Ce.length!==1||!oe.get(J.node.id)||!J.node.lane&&U(J)===void 0||Zt.has(J.node.id))continue;const ee=(i0=C.get(Ce[0].flow.source))==null?void 0:i0.node.participant,X=ee?l(ee):void 0;if(!X||!A||X.id===A.id)continue;const he=J.node.lane??`pool:${v}`,Me=xe.get(he);if(!Me)continue;const Re=Me.get(0)??0,He=(Me.get(Z(J)??0)??Re)-Re;if(He===0)continue;const it=X.y<A.y;if(it&&He<0||!it&&He>0)continue;let Ut;for(const[si,Pt]of Me){const mt=Pt-Re;(it&&mt<0&&(!Ut||mt<Ut.row)||!it&&mt>0&&(!Ut||mt>Ut.row))&&(Ut={band:si,row:mt})}Ut&&Le.set(J.node.id,{lane:J.node.lane,band:Ut.band})}}const fe=new Set;let ze=0;for(;ze++<R.nodes.length+2;){for(let Se=0;Se<R.nodes.length+R.flows.length+2;Se++){let Ae=!1;for(const nt of R.flows){const Ne=nt.flow;if(fe.has(Ne.id))continue;const vt=l(Ne.source);if(!vt)continue;const lt=l(Ne.target),J=C.get(Ne.target);if(!lt&&J){const Ce=Jt(J.node,J.band),ee=Z(J);if(J.node.lane||ee!==void 0){const X=$(J.node),he=vt,Me=he.x+(me.get(Ne.source)??0)+he.width+D,Re=re.get(Ne.target)??Le.get(Ne.target),He=G(X,Ce,Re?Re.lane:J.node.lane,Re?Re.band:ee,Ee.has(Ne.target)?he.x+he.width/2:Me,Number.NaN),it=n.createShape(Ce,He,X);Ee.has(Ne.target)&&me.set(Ne.target,Me-(it.x+it.width/2)),n.connect(vt,it,{type:"bpmn:SequenceFlow",businessObject:Tt(Ne)})}else s.append(vt,Ce,{connection:{type:"bpmn:SequenceFlow",businessObject:Tt(Ne)}})}else if(lt)n.connect(vt,lt,{type:"bpmn:SequenceFlow",businessObject:Tt(Ne)});else continue;fe.add(Ne.id),Ae=!0}if(!Ae)break}const oe=R.nodes.filter(Se=>!l(Se.node.id));if(!oe.length)break;const ge=oe[0];{const Se=Jt(ge.node,ge.band),Ae=$(ge.node),nt=U(ge);n.createShape(Se,G(Ae,Se,ge.node.lane,nt,O,F),Ae),!ge.node.lane&&nt===void 0&&(F+=160)}}}const Nt=40,$t=(v,R=()=>!0)=>{const A=l(v);if(!A)return[];const O=[A],F=new Set([v]);for(let B=0;B<O.length;B++){const N=O[B].id;for(const $ of m){const G=$.flow.target;if($.flow.source!==N||F.has(G)||!C.has(G))continue;F.add(G);const K=l(G);K&&R(K)&&O.push(K)}}return O},zo=(v,R=()=>!0)=>{const A=l(v);if(!A)return[];const O=[A],F=new Set([v]);for(let B=0;B<O.length;B++){const N=O[B].id;for(const $ of m){const G=$.flow.source;if($.flow.target!==N||F.has(G)||!C.has(G))continue;F.add(G);const K=l(G);K&&R(K)&&O.push(K)}}return O},Vt=30,vn=v=>!("waypoints"in v&&v.waypoints)&&v.type!=="bpmn:Lane"&&v.type!=="label"&&typeof v.x=="number",wn=(v,R)=>{const A=new Set(v.flatMap(N=>N.subtree.map($=>$.id)));for(const N of v){const $=(N.pool.children??[]).filter(vn).filter(K=>!A.has(K.id));if(N.subtree.some(K=>$.some(le=>K.x+R<le.x+le.width+Vt&&K.x+R+K.width+Vt>le.x&&K.y<le.y+le.height&&K.y+K.height>le.y)))return null}const O=v.map(N=>N.pool.width),F=o.filter(N=>N.type==="label").map(N=>({label:N,x:N.x,y:N.y}));n.moveElements(v.flatMap(N=>N.subtree),{x:R,y:0});const B=v.map(N=>{const G=Math.max(...N.subtree.map(K=>K.x+K.width))+150-(N.pool.x+N.pool.width);return G>0&&n.resizeShape(N.pool,{x:N.pool.x,y:N.pool.y,width:N.pool.width+G,height:N.pool.height}),G});return()=>{n.moveElements(v.flatMap(N=>N.subtree),{x:-R,y:0}),v.forEach((N,$)=>{B[$]>0&&n.resizeShape(N.pool,{x:N.pool.x,y:N.pool.y,width:O[$],height:N.pool.height})});for(let N=0;N<3;N++){let $=0;for(const G of F){const K=G.x-G.label.x,le=G.y-G.label.y;Math.abs(K)<=.5&&Math.abs(le)<=.5||(n.moveElements([G.label],{x:K,y:le}),$++)}if(!$)break}}},Wt=v=>{var F,B;const R=new Map,A=new Map;for(const N of o.getAll()){if(N.type!=="bpmn:Participant")continue;const $=N;($.children??[]).length||(R.set($.id,$),A.set($.id,[]))}for(const N of o.getAll()){if(N.type!=="bpmn:MessageFlow")continue;const $=N,G=(F=$.source)==null?void 0:F.id,K=(B=$.target)==null?void 0:B.id;G&&K&&A.has(G)&&A.get(G).push(K),G&&K&&A.has(K)&&A.get(K).push(G)}const O=[];for(const[N,$]of A)$.length&&$.every(G=>v.has(G))&&O.push(R.get(N));return O},Ur=(v,R)=>{if(!v.length)return null;const A=new Set(v.map(N=>N.id)),O=o.getAll().filter(N=>N.type==="bpmn:Participant"&&!A.has(N.id));if(v.some(N=>O.some($=>N.x+R<$.x+$.width+Vt&&N.x+R+N.width+Vt>$.x&&N.y<$.y+$.height&&N.y+N.height>$.y)))return null;const B=o.filter(N=>N.type==="label").map(N=>({label:N,x:N.x,y:N.y}));return n.moveElements(v,{x:R,y:0}),()=>{n.moveElements(v,{x:-R,y:0});for(let N=0;N<3;N++){let $=0;for(const G of B){const K=G.x-G.label.x,le=G.y-G.label.y;Math.abs(K)<=.5&&Math.abs(le)<=.5||(n.moveElements([G.label],{x:K,y:le}),$++)}if(!$)break}}},Za=()=>{let v=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++)v+=Math.hypot(A[O].x-A[O-1].x,A[O].y-A[O-1].y)}return v},In=()=>Vn(ft(o)).filter(v=>v.kind==="edge-crosses-shape").length,Je=v=>{const R=(v.children??[]).filter(vn);let A=0;for(let O=0;O<R.length;O++)for(let F=O+1;F<R.length;F++){const B=R[O],N=R[F];B.x<N.x+N.width&&B.x+B.width>N.x&&B.y<N.y+N.height&&B.y+B.height>N.y&&A++}return A},tt=()=>{const v=ft(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:v.edges.filter(A=>A.type==="bpmn:MessageFlow"&&A.waypoints.length===2).length,lines:v.edges.filter(A=>R(A.waypoints)).length}},qD=v=>{const R=F=>{const B=[F],N=new Set([F.id]);for(let $=0;$<B.length;$++)for(const G of B[$].outgoing??[]){if(G.type!=="bpmn:SequenceFlow")continue;const K=G.target;!K||N.has(K.id)||v.has(K.id)||!vn(K)||K.x<F.x||(N.add(K.id),B.push(K))}return B},A=new Set(v),O=[];for(const F of o.getAll()){if(F.type!=="bpmn:MessageFlow")continue;const B=F;if(!B.waypoints||B.waypoints.length!==2)continue;const N=B.source,$=B.target;if(!N||!$)continue;const G=v.has(N.id);if(G===v.has($.id))continue;const K=G?$:N,le=p(K);if(!le||A.has(K.id))continue;const Ee=R(K).filter(re=>!A.has(re.id));if(Ee.length){for(const re of Ee)A.add(re.id);O.push({subtree:Ee,pool:le})}}return O};for(const v of Kt(e,"sequenceFlow.update")){if(v.target===void 0)continue;const R=C.get(v.target);if(!R)continue;const A=l(v.target),O=l(v.id);if(!A||!O)continue;const F=v.source!==void 0?l(v.source):O.source,B=O.target;if(!F||!B||B.id===A.id)continue;const N=$t(v.target),$=new Set(N.map(ze=>ze.id)),G=Math.min(...N.map(ze=>ze.x)),K=Math.max(...N.map(ze=>ze.x+ze.width)),le=F.x+F.width,Ee=K-G+Nt*2-(B.x-le);let re=[];if(Ee>0){const ze=p(A),oe=(ze==null?void 0:ze.children)??[],ge=Ne=>Ne.type==="bpmn:Lane";re=(()=>{const Ne=new Set;for(const lt of oe)vn(lt)&&!$.has(lt.id)&&lt.x>=B.x&&Ne.add(lt.id);const vt=[];for(const lt of oe){if(lt.type!=="bpmn:DataStoreReference"&&lt.type!=="bpmn:DataObjectReference")continue;const J=lt,ee=[...J.incoming??[],...J.outgoing??[]].filter(X=>X.type==="bpmn:DataInputAssociation"||X.type==="bpmn:DataOutputAssociation").map(X=>X.source===J?X.target:X.source);ee.length&&ee.every(X=>X!==void 0&&Ne.has(X.id))&&vt.push(J)}return vt})();const Ae=oe.filter(Ne=>!("waypoints"in Ne&&Ne.waypoints)&&!ge(Ne)&&!$.has(Ne.id)&&Ne.x>=B.x),nt=ze?[ze,...oe.filter(Ne=>ge(Ne))]:[];if(Ae.length){const Ne=new Set(Ae.map(J=>J.id)),vt=qD(Ne),lt=Wt(Ne);n.createSpace(Ae,nt,{x:Ee,y:0},"e",B.x-1);for(const J of vt){const Ce=tt(),ee=wn([J],Ee);if(!ee)continue;const X=tt();(X.messages<=Ce.messages||X.lines<Ce.lines)&&ee()}if(lt.length){const J=tt(),Ce=Ur(lt,Ee);if(Ce){const ee=tt();(ee.messages<=J.messages||ee.lines<J.lines)&&Ce()}}}}const Le=R.node.lane||R.band!==void 0?A.y+A.height/2:F.y+F.height/2;n.moveElements(N,{x:le+Nt-G,y:Le-(A.y+A.height/2)});const me=p(A);if(R.node.lane===void 0&&R.band!==void 0&&me){const ze=me.y+z+M(`pool:${R.node.participant??""}`,R.band)*k,oe=ze-(A.y+A.height/2);oe!==0&&!ue(me,A,A.x+A.width/2,ze,$)&&n.moveElements([A],{x:0,y:oe})}const fe=re.length?p(re[0]):void 0;if(fe){const ze={assoc:Za(),overlaps:Je(fe),crosses:In()},oe=re.map(J=>({st:J,x:J.x})),ge=o.filter(J=>J.type==="label").map(J=>({label:J,x:J.x,y:J.y})),Se=Math.min(...re.flatMap(J=>[...J.incoming??[],...J.outgoing??[]].filter(Ce=>Ce.type==="bpmn:DataInputAssociation"||Ce.type==="bpmn:DataOutputAssociation").map(Ce=>(Ce.source===J?Ce.target:Ce.source).x))),Ae=new Set(re.map(J=>J.id)),nt=(fe.children??[]).filter(vn).filter(J=>!Ae.has(J.id));let Ne=Se;for(const J of[...re].sort((Ce,ee)=>Ce.x-ee.x)){let Ce=Ne;for(let ee=0;ee<100;ee++){const X=nt.find(he=>Ce<he.x+he.width+Vt&&Ce+J.width+Vt>he.x&&J.y<he.y+he.height&&J.y+J.height>he.y);if(!X)break;Ce=X.x+X.width+Vt}Ce!==J.x&&n.moveElements([J],{x:Ce-J.x,y:0}),Ne=Ce+J.width+Vt}const vt=Ne+150-(fe.x+fe.width);vt>0&&n.resizeShape(fe,{x:fe.x,y:fe.y,width:fe.width+vt,height:fe.height});const lt={assoc:Za(),overlaps:Je(fe),crosses:In()};if(lt.assoc>=ze.assoc||lt.overlaps>ze.overlaps||lt.crosses>ze.crosses){for(const{st:J,x:Ce}of oe)J.x!==Ce&&n.moveElements([J],{x:Ce-J.x,y:0});vt>0&&n.resizeShape(fe,{x:fe.x,y:fe.y,width:fe.width-vt,height:fe.height});for(const J of ge){const Ce=J.x-J.label.x,ee=J.y-J.label.y;(Ce!==0||ee!==0)&&n.moveElements([J.label],{x:Ce,y:ee})}}}}const jx=(v,R)=>{const A=R.target===v,O=f(R.source),F=f(R.target),B=A?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(O,F,R.id?{type:B,businessObject:i.create(B,{id:R.id})}:{type:B})},YD=100,Hx=v=>{for(const R of g){if(!R.participant.blackBox)continue;const A=l(R.participant.id);if(!A)continue;const O=[];for(const B of _){const N=B.flow.source===R.participant.id?B.flow.target:B.flow.target===R.participant.id?B.flow.source:void 0,$=N?l(N):void 0;$&&typeof $.x=="number"&&$.type!=="bpmn:Participant"&&O.push($)}if(!O.length)continue;const F=Math.max(...O.map(B=>B.x+B.width/2))+YD;if(F>A.x+A.width&&n.resizeShape(A,{x:A.x,y:A.y,width:F-A.x,height:A.height}),!!v)for(const B of _){const N=l(B.flow.id),$=B.flow.source===R.participant.id?B.flow.target:B.flow.target===R.participant.id?B.flow.source:void 0,G=$?l($):void 0;if(!N||!G||G.type==="bpmn:Participant")continue;const K=G.x+G.width/2;if(K<A.x+10||K>A.x+A.width-10)continue;const le=A.y>G.y,Ee=le?G.y+G.height:G.y,re=le?A.y:A.y+A.height,Le=B.flow.source===R.participant.id?[{x:K,y:re},{x:K,y:Ee}]:[{x:K,y:Ee},{x:K,y:re}],me=ft(o),fe={...me.edges.find(ze=>ze.id===B.flow.id),waypoints:Le};hn(fe,Gn(me)).length||n.updateWaypoints(N,Le)}}};Hx(!1);for(const v of _){const R=v.flow;n.connect(f(R.source),f(R.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:R.id,name:R.name})})}{const A=new Set([...m.map(G=>G.flow.id),..._.map(G=>G.flow.id)].filter(G=>!!G)),O=o.filter(G=>!!G.waypoints),F=(G,K)=>Math.abs(K.x-G.x)<2?"L":Math.abs(K.x-(G.x+G.width))<2?"R":Math.abs(K.y-G.y)<2?"T":Math.abs(K.y-(G.y+G.height))<2?"B":void 0,B=new Map,N=(G,K,le)=>{if(!G||!K||typeof G.x!="number")return;const Ee=F(G,K);if(!Ee)return;let re=B.get(G.id);re||B.set(G.id,re=new Map),re.set(Ee,[...re.get(Ee)??[],le])};for(const G of O){const K=G.waypoints;!K||K.length<2||(N(G.source,K[0],{id:G.id,dir:"out"}),N(G.target,K[K.length-1],{id:G.id,dir:"in"}))}const $=new Set;for(const[G,K]of B){const le=l(G);if(!le||typeof le.x!="number"||![...K.values()].some(ge=>{const Se=ge.filter(Ae=>Ae.dir==="in");return ge.length>=3&&Se.length>=1&&ge.some(Ae=>Ae.dir==="out")&&Se.some(Ae=>A.has(Ae.id))}))continue;const re=p(le);if(!re||$.has(re.id)||(re.children??[]).some(ge=>ge.type==="bpmn:Lane"))continue;const Le=(r0=K.get("T"))!=null&&r0.length?(o0=K.get("B"))!=null&&o0.length?void 0:"B":"T";if(!Le||(Le==="T"?le.y-re.y:re.y+re.height-(le.y+le.height))>=k)continue;const fe=(re.children??[]).filter(ge=>!("waypoints"in ge&&ge.waypoints)&&ge.type!=="label"&&typeof ge.x=="number"),ze=re.y+re.height;n.resizeShape(re,{x:re.x,y:re.y,width:re.width,height:re.height+k});const oe=u().children.filter(ge=>!("waypoints"in ge&&ge.waypoints)&&ge.id!==re.id&&typeof ge.y=="number"&&ge.y>=ze);oe.length&&n.moveElements(oe,{x:0,y:k}),Le==="T"&&fe.length&&n.moveElements(fe,{x:0,y:k}),$.add(re.id)}}const Jf=20,zx=4,KD=2,XD=[10,30,80],Go=()=>{const v=ft(o);return{bad:Vn(v).filter(R=>R.kind==="edge-crosses-shape"||R.kind==="edge-overlap-opposite"||R.kind==="edge-overlap-mixed").length,crossings:Vd(v),straight:v.edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.waypoints.length===2).length}},Vo=v=>{const R=ft(o),A=R.edges.find(O=>O.id===v);return A?hn(A,Gn(R)).length:0},Ru=v=>Vo(v)>0,Cu=v=>ft(o).edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.id!==v&&R.waypoints.length===2).length,ZD=(v,R,A)=>wn([{subtree:v,pool:R}],A),Gx=(v,R)=>R.bad>v.bad||R.crossings>v.crossings&&R.straight<=v.straight&&R.bad>=v.bad,Pu=(v,R)=>Gx(v,R)||R.straight<v.straight,Au=(v,R,A=()=>!0,O=Gx)=>{const F=Go(),B=wn(v,R);if(!B)return!1;const N=Go();return O(F,N)||!A()?(B(),!1):!0},Vx=(v,R,A,O=()=>!0)=>Au([{subtree:v,pool:R}],A,O),qr=v=>{var R;return!!((R=C.get(v))!=null&&R.node.participant)},Qa=new Map;for(const v of _){if(!qr(v.flow.target))continue;const R=Qa.get(v.flow.target)??[];R.push(v),Qa.set(v.flow.target,R)}const ed=[...Qa.keys()],Wx=new Set(m.map(v=>v.flow.target)),Ux=v=>be.findIndex(({op:R})=>R.participant.id===v);ed.sort((v,R)=>{var F,B;const A=Wx.has(v)?1:0,O=Wx.has(R)?1:0;return A!==O?A-O:Ux((F=C.get(v))==null?void 0:F.node.participant)-Ux((B=C.get(R))==null?void 0:B.node.participant)});const Yr=v=>v.x+v.width/2,QD=v=>{const R=new Map;for(const F of o.getAll()){const B=F;if(!B.waypoints||!B.source||!B.target)continue;(R.get(B.source.id)??R.set(B.source.id,[]).get(B.source.id)).push(B.target.id)}const A=new Set([v]),O=[v];for(let F=0;F<O.length;F++)for(const B of R.get(O[F])??[])A.has(B)||(A.add(B),O.push(B));return A},JD=(v,R)=>{const A=QD(R);let O;for(const F of o.getAll()){const B=F;if(B.type!=="bpmn:MessageFlow"||!B.source||!B.target||B.target.id!==v||A.has(B.source.id))continue;const N=B.source;if(typeof N.x!="number"||N.type==="bpmn:Participant")continue;const $=Yr(N);(O===void 0||$>O)&&(O=$)}return O},td=(v,R)=>{const A=l(v.flow.source);if(A)return A.type==="bpmn:Participant"?JD(A.id,R):Yr(A)},qx=v=>{let R;for(const A of Qa.get(v)??[]){const O=td(A,v);O!==void 0&&(!R||O>R.cx)&&(R={op:A,cx:O})}return R==null?void 0:R.op},eL=v=>{const R=qx(v),A=l(v),O=R?td(R,v):void 0;return A&&O!==void 0?O-Yr(A):void 0},tL=v=>{const R=eL(v);return R!==void 0&&Math.abs(R)<Jf},Yx=(v,R,A,O,F)=>{var B;for(let N=!0;N;){N=!1;for(const $ of _){if($.flow.id===A)continue;const G=R.has($.flow.source),K=R.has($.flow.target);if(G===K||O(G?$.flow.source:$.flow.target))continue;const le=G?$.flow.target:$.flow.source;if(F(le)||!qr(le))continue;const Ee=l($.flow.id);if(!(Ee!=null&&Ee.waypoints)||Ee.waypoints.length!==2)continue;const re=l(le),Le=(B=C.get(le))==null?void 0:B.node.participant;if(!re||!Le)continue;const me=$t(le,fe=>fe.x>=re.x).filter(fe=>!R.has(fe.id));if(!(!me.length||me.some(fe=>F(fe.id)))){for(const fe of me)R.add(fe.id);v.set(Le,[...v.get(Le)??[],...me]),N=!0}}}return[...v].map(([N,$])=>({subtree:$,pool:f(N)}))},Kx=(v,R,A,O,F)=>Yx(new Map([[R,[...v]]]),new Set(v.map(B=>B.id)),O,B=>B===A,B=>B===F),nd=v=>{const R=qx(v);if(!R)return null;const A=l(v),O=l(R.flow.source),F=td(R,v);if(!A||!O||F===void 0)return null;const B=F-Yr(A);if(B>=Jf){const N=C.get(v).node.participant,$=$t(v,G=>G.x>=A.x);return{groups:Kx($,N,v,R.flow.id,R.flow.source),dx:B}}if(-B>=Jf&&qr(R.flow.source)){const N=C.get(R.flow.source).node.participant,$=$t(R.flow.source,G=>G.x>=O.x&&!tL(G.id));return{groups:Kx($,N,R.flow.source,R.flow.id,v),dx:-B}}return null},Xx=()=>ed.map(v=>({id:v,plan:nd(v)})).filter(v=>!!v.plan).sort((v,R)=>Math.min(...v.plan.groups.flatMap(A=>A.subtree.map(O=>O.x)))-Math.min(...R.plan.groups.flatMap(A=>A.subtree.map(O=>O.x)))).map(v=>v.id);for(let v=0;v<3;v++){const R=Go(),A=[];for(const F of Xx()){const B=nd(F);if(!B)continue;const N=wn(B.groups,B.dx);N&&A.push(N)}if(!A.length)break;if(!Pu(R,Go()))continue;for(const F of A.reverse())F();let O=!1;for(const F of Xx()){const B=nd(F);B&&Au(B.groups,B.dx,()=>!0,Pu)&&(O=!0)}if(!O)break}for(const v of ed.flatMap(R=>Qa.get(R)??[])){if(!Ru(v.flow.id))continue;const R=l(v.flow.target);if(!R)continue;const A=f(C.get(v.flow.target).node.participant),O=$t(v.flow.target,$=>$.x>=R.x),F=R.width+D,B=Vo(v.flow.id),N=Cu(v.flow.id);for(let $=1;$<=zx;$++){const G=()=>Vo(v.flow.id)<B&&Cu(v.flow.id)>=N;if(Vx(O,A,F*$,G))break}}for(const v of _){if(!Ru(v.flow.id))continue;const R=l(v.flow.source),A=l(v.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[F,B]=R.y<A.y?[R.y+R.height,A.y]:[A.y+A.height,R.y],N=[...C.values()].map($=>l($.node.id)).filter($=>!!$&&$.id!==R.id&&$.id!==A.id).filter($=>$.x<=O&&O<=$.x+$.width&&$.y+$.height>F&&$.y<B).sort(($,G)=>$.x-G.x);for(const $ of N){const G=(a0=C.get($.id))==null?void 0:a0.node.participant,K=G?l(G):void 0;if(!K)continue;const le=[...C.values()].filter(Se=>Se.node.participant===G).map(Se=>Se.node.id),Ee=Se=>Se.map(Ae=>l(Ae)).filter(Ae=>!!Ae),Le=[zo($.id,Se=>{var Ae;return((Ae=C.get(Se.id))==null?void 0:Ae.node.participant)===G}),Ee(le)].filter(Se=>Se.length),me=$.width+D,fe=Vo(v.flow.id),ze=Cu(v.flow.id),oe=()=>Vo(v.flow.id)<fe&&Cu(v.flow.id)>=ze;let ge=!1;for(const Se of Le){for(let Ae=1;Ae<=zx;Ae++)if(Vx(Se,K,me*Ae,oe)){ge=!0;break}if(ge)break}if(!Ru(v.flow.id))break}}for(const v of _){if(!Ru(v.flow.id))continue;const R=l(v.flow.id);if(((s0=R==null?void 0:R.waypoints)==null?void 0:s0.length)!==2)continue;const A=l(v.flow.source),O=l(v.flow.target);if(!A||!O||A.type==="bpmn:Participant"||O.type==="bpmn:Participant"||!qr(v.flow.source)||!qr(v.flow.target)||Math.abs(Yr(A)-Yr(O))>KD)continue;const F=Yr(A),B=R.waypoints.map(fe=>fe.y),[N,$]=[Math.min(...B),Math.max(...B)],G=Gn(ft(o)).filter(fe=>fe.id!==A.id&&fe.id!==O.id&&fe.x<F&&F<fe.x+fe.width&&N<fe.y+fe.height&&fe.y<$);if(!G.length)continue;const K=(c0=C.get(v.flow.source))==null?void 0:c0.node.participant,le=(u0=C.get(v.flow.target))==null?void 0:u0.node.participant;if(!K||!le)continue;const Ee=new Map;for(const[fe,ze,oe]of[[v.flow.source,A,K],[v.flow.target,O,le]]){const ge=Ee.get(oe)??[],Se=$t(fe,Ae=>Ae.x>=ze.x).filter(Ae=>!ge.some(nt=>nt.id===Ae.id));Ee.set(oe,[...ge,...Se])}const re=new Set([...Ee.values()].flat().map(fe=>fe.id)),Le=Yx(Ee,re,v.flow.id,fe=>fe===v.flow.source||fe===v.flow.target,()=>!1),me=Math.max(...G.map(fe=>fe.x+fe.width));for(const fe of XD){const ze=me+fe-F;if(ze<=0)continue;if(Au(Le,ze,()=>{var ge,Se;return Vo(v.flow.id)===0&&((Se=(ge=l(v.flow.id))==null?void 0:ge.waypoints)==null?void 0:Se.length)===2},Pu))break}}{const v=A=>A.y+A.height/2,R=[];for(const A of C.keys()){if(!qr(A))continue;const O=m.filter(N=>N.flow.target===A);if(O.length!==1)continue;const F=l(O[0].flow.source),B=l(A);!F||!B||!C.has(F.id)||Math.abs(v(F)-v(B))>1||B.x-(F.x+F.width)<=D+1||R.push({id:A,pred:F,node:B})}R.sort((A,O)=>A.node.x-O.node.x);for(const{id:A}of R){const O=C.get(A),F=l(A),B=l(m.find(re=>re.flow.target===A).flow.source);if(!F||!B)continue;const N=F.x-(B.x+B.width);if(N<=D+1)continue;const $=f(O.node.participant),G=$t(A,re=>re.x>=F.x),K=Go(),le=ZD(G,$,-(N-D));if(!le)continue;const Ee=Go();(Ee.bad>K.bad||Ee.crossings>=K.crossings||Ee.straight<K.straight)&&le()}}Hx(!0);for(const v of y){const R=v.associations??[],A=R.map(B=>B.source===v.dataStore.id?B.target:B.source).map(l).find(Boolean),O=A?p(A)??u():u(),F=A?{x:A.x+A.width/2,y:A.y+A.height+110}:{x:200,y:Be+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:v.dataStore.id,name:v.dataStore.name})},F,O);for(const B of R)jx(v.dataStore.id,B)}for(const v of x){const A=f(v.association.target).type==="bpmn:DataStoreReference"?v.association.target:v.association.source;jx(A,v.association)}let Zx=0;const Kr=10,Qx=40,nL=(v,R)=>{const A=R.map(G=>p(G)).filter(G=>!!G);for(const G of A){const K=Kr,le=G.y,Ee=G.y+G.height,re=G.x,Le=G.x+G.width;if(Math.abs(v.y-le)<K){const me=le+K-v.y;v.y+=me,v.height-=me}if(Math.abs(v.y+v.height-Ee)<K&&(v.height=Ee-K-v.y),Math.abs(v.x-re)<K){const me=re+K-v.x;v.x+=me,v.width-=me}Math.abs(v.x+v.width-Le)<K&&(v.width=Le-K-v.x)}if(!A.length)return;const O=Math.min(...A.map(G=>G.y)),F=Math.max(...A.map(G=>G.y+G.height)),B=O-v.y,N=v.y+v.height-F,$=Qx-Kr;if(B>0!=N>0)if(B>0&&B<$){const G=B+Kr;v.y+=G,v.height-=G}else N>0&&N<$&&(v.height-=N+Kr)},iL=(v,R)=>{const A=Kr,O=30,F=o.filter(B=>B.type==="bpmn:Group"&&B.id!==R);for(const B of F){const N=B.x,$=B.x+B.width,G=B.y,K=B.y+B.height,le=v.y<K&&G<v.y+v.height,Ee=v.x<$&&N<v.x+v.width;if(le){if(Math.abs(v.x-$)<A){const re=Math.min($+A-v.x,O);re>0&&v.width-re>0&&(v.x+=re,v.width-=re)}if(Math.abs(v.x+v.width-N)<A){const re=Math.min(v.x+v.width-(N-A),O);re>0&&v.width-re>0&&(v.width-=re)}}if(Ee){if(Math.abs(v.y-K)<A){const re=Math.min(K+A-v.y,O);re>0&&v.height-re>0&&(v.y+=re,v.height-=re)}if(Math.abs(v.y+v.height-G)<A){const re=Math.min(v.y+v.height-(G-A),O);re>0&&v.height-re>0&&(v.height-=re)}}}},id=(v,R)=>{const A=Qx,O=Math.min(...v.map(G=>G.x))-A,F=Math.min(...v.map(G=>G.y))-A,B=Math.max(...v.map(G=>G.x+G.width))+A,N=Math.max(...v.map(G=>G.y+G.height))+A,$={x:O,y:F,width:B-O,height:N-F};return nL($,v),iL($,R),$};for(const v of P){const R=(v.group.members??[]).map(l).filter(F=>!!F);let A;R.length?A=id(R,v.group.id):(A={x:300+Zx*350,y:40,width:300,height:200},Zx++);const O=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:v.group.id}),width:A.width,height:A.height},{x:A.x+A.width/2,y:A.y+A.height/2},u());v.group.name&&n.updateLabel(O,v.group.name),(l0=v.group.members)!=null&&l0.length&&L(O,"bwl:Members",{refs:v.group.members.join(" ")})}{const v=o.filter(F=>!!F.waypoints),R=new Map,A=(F,B)=>{!F||!B||(R.has(F)||R.set(F,new Set),R.get(F).add(B))};for(const F of v){const B=(p0=F.source)==null?void 0:p0.id,N=(f0=F.target)==null?void 0:f0.id;A(B,N),((d0=F.type)!=null&&d0.includes("DataOutputAssociation")||(h0=F.type)!=null&&h0.includes("DataInputAssociation")||F.type==="bpmn:Association")&&A(N,B)}const O=o.filter(F=>F.type==="bpmn:Group");for(const F of O){const N=(((m0=F.businessObject.extensionElements)==null?void 0:m0.values)??[]).find(oe=>oe.$type==="bwl:Members"),$=((N==null?void 0:N.refs)??"").split(" ").filter(Boolean);if(!$.length)continue;const G=new Set($),K=[...$];for(;K.length;){const oe=K.shift();for(const ge of R.get(oe)??[])G.has(ge)||(G.add(ge),K.push(ge))}const le=F.x,Ee=F.x+F.width,re=F.y,Le=F.y+F.height,me=oe=>m.filter(ge=>ge.flow.target===oe).length,fe=oe=>{var Se;const ge=((Se=l(oe))==null?void 0:Se.type)??"";if(ge==="bpmn:StartEvent"&&me(oe)===0)return!1;if(ge.endsWith("Gateway")){const Ae=m.filter(nt=>nt.flow.target===oe).map(nt=>nt.flow.source);if(Ae.length&&Ae.every(nt=>{var Ne;return((Ne=l(nt))==null?void 0:Ne.type)==="bpmn:StartEvent"&&me(nt)===0}))return!1}return!0},ze=o.filter(oe=>vn(oe)).filter(oe=>oe.type!=="bpmn:Group"&&oe.type!=="bpmn:Participant"&&oe.type!=="bpmn:TextAnnotation"&&!G.has(oe.id)&&qr(oe.id)&&fe(oe.id)&&oe.x<Ee&&oe.x+oe.width>le&&oe.y<Le&&oe.y+oe.height>re);if(ze.length)for(const oe of[-1,1]){const ge=ze.filter(ee=>(ee.x+ee.width-le<=Ee-ee.x?-1:1)===oe);if(!ge.length)continue;const Se=[];for(const ee of ge){const X=Se.find(he=>he.some(Me=>ee.y<Me.y+Me.height&&ee.y+ee.height>Me.y));X?X.push(ee):Se.push([ee])}const Ae=new Map;for(const ee of Se){let X=oe<0?le-Kr:Ee+Kr;for(const he of[...ee].sort((Me,Re)=>oe<0?Re.x-Me.x:Me.x-Re.x)){const Me=oe<0?Math.min(he.x,X-he.width):Math.max(he.x,X);X=oe<0?Me-Vt:Me+he.width+Vt,Me!==he.x&&Math.sign(Me-he.x)===oe&&Ae.set(he.id,Me-he.x)}}const nt=new Map,Ne=ee=>nt.get(ee)===ee||!nt.get(ee)?ee:Ne(nt.get(ee));for(const ee of ge)nt.set(ee.id,ee.id);for(const ee of _){const X=Ae.has(ee.flow.source)?ee.flow.source:void 0,he=Ae.has(ee.flow.target)?ee.flow.target:void 0;if(!X||!he)continue;const Me=l(ee.flow.id);((g0=Me==null?void 0:Me.waypoints)==null?void 0:g0.length)===2&&nt.set(Ne(X),Ne(he))}const vt=new Map;for(const ee of ge){if(!Ae.has(ee.id))continue;const X=Ne(ee.id);vt.set(X,[...vt.get(X)??[],ee])}const lt=[...vt.values()].sort((ee,X)=>oe<0?Math.min(...ee.map(he=>he.x))-Math.min(...X.map(he=>he.x)):Math.max(...X.map(he=>he.x))-Math.max(...ee.map(he=>he.x))),J=[];let Ce=!0;for(const ee of lt){const X=ee.map(Re=>Ae.get(Re.id)??0).reduce((Re,He)=>Math.abs(He)>Math.abs(Re)?He:Re,0),he=new Map;let Me=!0;for(const Re of ee){const He=p(Re);if(!He){Me=!1;break}he.has(He.id)||he.set(He.id,{subtree:[],pool:He}),he.get(He.id).subtree.push(Re)}Me&&Au([...he.values()],X,()=>!0,Pu)?J.push({shapes:ee,dx:X}):Ce=!1}if(!Ce)for(const ee of J.reverse())n.moveElements(ee.shapes,{x:-ee.dx,y:0})}}}{const v=new Set([...P.map(R=>R.group.id),...Kt(e,"group.update").map(R=>R.id)]);for(const R of o.filter(A=>A.type==="bpmn:Group")){if(v.has(R.id))continue;const O=(((y0=R.businessObject.extensionElements)==null?void 0:y0.values)??[]).find($=>$.$type==="bwl:Members"),F=((O==null?void 0:O.refs)??"").split(" ").filter(Boolean).map(l).filter($=>!!$);!F.length||!F.some($=>{const G=d.get($.id);return!G||G.x!==$.x||G.y!==$.y})||!F.some($=>$.x<R.x||$.y<R.y||$.x+$.width>R.x+R.width||$.y+$.height>R.y+R.height)||n.resizeShape(R,id(F,R.id))}}{const R=new Map(so(ft(o)).map($=>[$.owner,$.rect])),A=o.filter($=>!!$.waypoints),O=new Map,F=($,G)=>{!$||!G||(O.has($)||O.set($,new Set),O.get($).add(G))};for(const $ of A){const G=(v0=$.source)==null?void 0:v0.id,K=(b0=$.target)==null?void 0:b0.id;F(G,K),((_0=$.type)!=null&&_0.includes("DataOutputAssociation")||(x0=$.type)!=null&&x0.includes("DataInputAssociation")||$.type==="bpmn:Association")&&F(K,G)}const B=$=>m.filter(G=>G.flow.target===$).length,N=$=>{var K;const G=((K=l($))==null?void 0:K.type)??"";if(G==="bpmn:StartEvent"&&B($)===0)return!1;if(G.endsWith("Gateway")){const le=m.filter(Ee=>Ee.flow.target===$).map(Ee=>Ee.flow.source);if(le.length&&le.every(Ee=>{var re;return((re=l(Ee))==null?void 0:re.type)==="bpmn:StartEvent"&&B(Ee)===0}))return!1}return!0};for(const $ of o.filter(G=>G.type==="bpmn:Group")){const K=(((w0=$.businessObject.extensionElements)==null?void 0:w0.values)??[]).find(X=>X.$type==="bwl:Members"),le=((K==null?void 0:K.refs)??"").split(" ").filter(Boolean);if(!le.length)continue;const Ee=le.map(l).filter(X=>!!X);if(!Ee.length||!(P.some(X=>X.group.id===$.id)||Kt(e,"group.update").some(X=>X.id===$.id)||Ee.some(X=>{const he=d.get(X.id);return!he||he.x!==X.x||he.y!==X.y})))continue;const Le=new Set(le),me=[...le];for(;me.length;){const X=me.shift();for(const he of O.get(X)??[])Le.has(he)||(Le.add(he),me.push(he))}const fe=$.x,ze=$.x+$.width,oe=$.y,ge=$.y+$.height,Se=X=>{const he=R.get(X.id),Me={x:X.x,y:X.y,width:X.width,height:X.height};return he?[Me,{x:he.x,y:he.y,width:he.width,height:he.height}]:[Me]},Ae=Ee.flatMap(Se),nt=Math.min(...Ae.map(X=>X.x)),Ne=Math.max(...Ae.map(X=>X.x+X.width)),vt=Math.min(...Ae.map(X=>X.y)),lt=Math.max(...Ae.map(X=>X.y+X.height)),J={L:nt-fe,R:ze-Ne,T:vt-oe,B:ge-lt},Ce=o.filter(X=>vn(X)).filter(X=>X.type!=="bpmn:Group"&&X.type!=="bpmn:Participant"&&X.type!=="bpmn:TextAnnotation"&&!Le.has(X.id)&&N(X.id)&&X.x<ze&&X.x+X.width>fe&&X.y<ge&&X.y+X.height>oe);if(!Ce.length)continue;const ee={L:0,R:0,T:0,B:0};for(const X of Ce){const he=Se(X),Me=Math.min(...he.map(mt=>mt.x)),Re=Math.max(...he.map(mt=>mt.x+mt.width)),He=Math.min(...he.map(mt=>mt.y)),it=Math.max(...he.map(mt=>mt.y+mt.height)),Ut={L:Re-fe,R:ze-Me,T:it-oe,B:ge-He},si=["L","R","T","B"].filter(mt=>Ut[mt]<=J[mt]+.001);if(!si.length)continue;const Pt=si.reduce((mt,es)=>Ut[es]<Ut[mt]?es:mt,si[0]);ee[Pt]=Math.max(ee[Pt],Math.min(Ut[Pt]+10,J[Pt]))}!ee.L&&!ee.R&&!ee.T&&!ee.B||n.resizeShape($,{x:$.x+ee.L,y:$.y+ee.T,width:$.width-ee.L-ee.R,height:$.height-ee.T-ee.B})}}const Jx=v=>{const R=v.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=v;return{x:A.x,y:A.y,width:A.width,height:A.height}};let Ja=0;const e0=12,t0=14,rL=15,oL=300,aL=v=>{const R=v.split(`
7
- `),A=Math.max(...R.map(B=>ro(B,e0))),O=Math.max(100,Math.min(oL,Math.ceil(A)+t0)),F=R.reduce((B,N)=>B+Math.max(1,Math.ceil((ro(N,e0)+t0)/O)),0);return{width:O,height:Math.max(30,F*rL+10)}};for(const v of S){const R=v.association,A=((E0=v.placement)==null?void 0:E0.anchor)??(R?R.source===v.annotation.id?R.target:R.source:void 0),O=A?l(A):void 0,F=O?Jx(O):void 0,B=aL(v.annotation.text??"");let N;if(F&&v.placement){const[le,Ee]=_s[v.placement.side],re=v.placement.offset??50;N={x:F.x+F.width/2+le*(F.width/2+B.width/2+re),y:F.y+F.height/2+Ee*(F.height/2+B.height/2+re)}}else F?(N={x:F.x+F.width/2+180+Ja%3*260,y:F.y-110-Ja%2*95},Ja++):(N={x:300+Ja*260,y:60},Ja++);const $=O?p(O)??u():u(),G=$;F&&typeof G.x=="number"&&typeof G.width=="number"&&G.type==="bpmn:Participant"&&(N=sl(o,F,B,G,v.placement?{placement:v.placement}:{from:N}));const K=n.createShape({type:"bpmn:TextAnnotation",width:B.width,height:B.height,businessObject:i.create("bpmn:TextAnnotation",{id:v.annotation.id,text:v.annotation.text})},N,$);if(R){const le=Ee=>Ee===v.annotation.id?K:f(Ee);n.connect(le(R.source),le(R.target),R.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:R.id})}:{type:"bpmn:Association"})}v.placement&&L(K,"bwl:Placement",T(v.placement))}for(const v of Kt(e,"association.add")){const R=v.association;n.connect(f(R.source),f(R.target),R.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:R.id})}:{type:"bpmn:Association"})}for(const v of Kt(e,"node.update")){let R=f(v.id);if(v.type&&bs(v.type)!==R.type&&(R=c.replaceElement(R,{type:bs(v.type)})),v.name!==void 0&&n.updateProperties(R,{name:v.name??void 0}),v.lane||v.band!==void 0){v.band!==void 0&&n.updateProperties(R,{"bwl:band":v.band});const A=R.y+R.height/2,O=p(R),F=v.lane?f(v.lane):((O==null?void 0:O.children)??[]).find(N=>N.type==="bpmn:Lane"&&A>=N.y&&A<=N.y+N.height);v.band!==void 0&&Q(F==null?void 0:F.id,v.band,O);const B=F?F.y+(v.band===void 0?F.height/2:Math.min(F.height/2,se)+M(F.id,v.band)*k):v.band!==void 0&&O?O.y+z+M(`pool:${O.id}`,v.band)*k:void 0;if(B!==void 0){const N=B-A;N!==0&&n.moveElements([R],{x:0,y:N})}}}for(const v of Kt(e,"sequenceFlow.update")){const R=f(v.id);if(v.source!==void 0||v.target!==void 0){const A=R,O=v.source!==void 0?f(v.source):A.source,F=v.target!==void 0?f(v.target):A.target,B=N=>({x:N.x+N.width/2,y:N.y+N.height/2});n.reconnect(A,O,F,[B(O),B(F)])}v.name!==void 0&&n.updateProperties(R,{name:v.name??void 0}),v.condition!==void 0&&n.updateProperties(R,{name:((S0=v.condition)==null?void 0:S0.label)??void 0})}for(const v of Kt(e,"messageFlow.update"))v.name!==void 0&&n.updateProperties(f(v.id),{name:v.name??void 0});for(const v of Kt(e,"dataStore.update"))v.name!==void 0&&n.updateProperties(f(v.id),{name:v.name??void 0});for(const v of Kt(e,"annotation.update")){const R=f(v.id);if(v.text!==void 0&&n.updateProperties(R,{text:v.text}),v.placement===null)L(R,"bwl:Placement",null);else if(v.placement){const A=f(v.placement.anchor),O=Jx(A),F=p(A)??u(),B=typeof F.x=="number"&&typeof F.width=="number"&&F.type==="bpmn:Participant",[N,$]=_s[v.placement.side],G=v.placement.offset??50,K={x:O.x+O.width/2+N*(O.width/2+R.width/2+G),y:O.y+O.height/2+$*(O.height/2+R.height/2+G)},le=B?sl(o,O,{width:R.width,height:R.height},F,{placement:v.placement,selfId:v.id}):K;n.moveElements([R],{x:le.x-(R.x+R.width/2),y:le.y-(R.y+R.height/2)}),L(R,"bwl:Placement",T(v.placement))}}for(const v of Kt(e,"group.update")){const R=f(v.id);if(v.name!==void 0&&n.updateLabel(R,v.name??""),v.members){const A=v.members.map(l).filter(O=>!!O);A.length&&n.resizeShape(R,id(A,v.id)),L(R,"bwl:Members",{refs:v.members.join(" ")})}}}function cl(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 a1(e,t,n){var l,f;const{elementRegistry:i}=e,r=e.modeling,o=p=>Vn(p).filter(d=>!t.has(ri(d))),a=p=>{var d;return((d=i.get(p))==null?void 0:d.type)==="bpmn:TextAnnotation"},s=ft(i),c=o(s),u=[...new Set(c.flatMap(cl))].filter(p=>n.has(p)&&a(p));if(u.length)for(const p of u){const d=i.get(p);if(!d||typeof d.x!="number"||typeof d.width!="number")continue;let g=d.parent,h;for(;g;){if(g.type==="bpmn:Participant"){h=g;break}g=g.parent}if(!h){const we=d.x+d.width/2,Ke=d.y+d.height/2;h=i.getAll().find(Y=>{if(Y.type!=="bpmn:Participant")return!1;const ue=Y;return typeof ue.x=="number"&&typeof ue.width=="number"&&we>=ue.x&&we<=ue.x+ue.width&&Ke>=ue.y&&Ke<=ue.y+ue.height})}if(!h||typeof h.x!="number"||typeof h.width!="number")continue;const _=(((l=d.businessObject.extensionElements)==null?void 0:l.values)??[]).find(we=>we.$type==="bwl:Placement"),y=[...d.incoming??[],...d.outgoing??[]].find(we=>we.type==="bpmn:Association"),x=(_!=null&&_.anchor?i.get(_.anchor):void 0)??(y?((f=y.source)==null?void 0:f.id)===p?y.target:y.source:void 0);if(!x)continue;const S=x.waypoints,P=S!=null&&S.length?{x:S[Math.floor((S.length-1)/2)].x,y:S[Math.floor((S.length-1)/2)].y,width:0,height:0}:{x:x.x,y:x.y,width:x.width,height:x.height},C={width:d.width,height:d.height},L={x:d.x+d.width/2,y:d.y+d.height/2},T=_==null?void 0:_.side,j=[];T&&T in _s&&j.push(sl(i,P,C,h,{placement:{side:T,offset:(_==null?void 0:_.offset)??null},selfId:p}));for(const[we,Ke]of[[-1,0],[1,0],[0,-1],[0,1]])for(let Y=1;Y<=o1;Y++)j.push({x:L.x+we*Th*Y,y:L.y+Ke*Th*Y});const k={...s,edges:s.edges.filter(we=>we.id!==(y==null?void 0:y.id))},D=o(k),z=D.filter(we=>cl(we).includes(p)).length;if(!z)continue;let se;for(const we of j){const Ke=we.x-L.x,Y=we.y-L.y;if(!Ke&&!Y||we.x-C.width/2<h.x||we.x+C.width/2>h.x+h.width||we.y-C.height/2<h.y||we.y+C.height/2>h.y+h.height)continue;const ue={...k,shapes:k.shapes.map(ce=>ce.id===p?{...ce,x:ce.x+Ke,y:ce.y+Y}:ce)},_e=o(ue),pe=_e.filter(ce=>cl(ce).includes(p)).length;if(pe>=z||_e.length>D.length)continue;const xe=Math.abs(Ke)+Math.abs(Y);if((!se||pe<se.mine||pe===se.mine&&(_e.length<se.all||_e.length===se.all&&xe<se.dist))&&(se={x:we.x,y:we.y,mine:pe,all:_e.length,dist:xe}),se.mine===0&&se.all<D.length)break}se&&r.moveElements([d],{x:se.x-L.x,y:se.y-L.y})}}function kh(e,t,n=Mh){const i=Ah(e),r=Ph(t,Jd(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=ft(i.elementRegistry),s=new Set(Vn(a).map(ri)),c=new Set(a.edges.map(h=>h.id)),u=new Set(a.shapes.map(h=>h.id)),l=el(a).length,f=e.get("commandStack");try{cd(f,()=>{n(t,i),ch(i,c),oh(i,s),vh(i,s,c),ph(i,c),XE(i,c),hh(i,s,c),e1(i,s,c),wh(i,s,c),xh(i,c),Sh(i,u),a1(i,s,u)})}catch(h){return{ok:!1,issues:[{kind:"lower-failed",message:h instanceof Error?h.message:String(h)}],findings:[],stats:o}}const p=ft(i.elementRegistry),d=Vn(p).filter(h=>!s.has(ri(h))),g=Wd(p);return{ok:!0,issues:[],findings:d,stats:{edgeCrossings:{before:l,after:g.pairs.length,pairs:g.pairs,solidPairs:g.solidPairs,dashedPairs:g.dashedPairs,mixedPairs:g.mixedPairs,crossPoolMessages:g.crossPoolMessages}}}}function s1(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function c1(e,t){return typeof e.get=="function"?e.get(t):e[t]}function Oh(e,t){const n=c1(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Dh(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function u1(e){return typeof e=="string"&&Mu.includes(e)}function pi(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function Lh(e){const t=e.rootElements??[],n=t.find(Y=>Y.$type==="bpmn:Collaboration"),i=new Map(t.filter(Y=>Y.$type==="bpmn:Process").map(Y=>[Y.id,Y])),r=[],o=[],a=[],s=[],c=[],u=[],l={poolOrders:{},bands:{},placements:{}},f=[],p=[],d=[],g=[],h=[],m=[],_=new Set,y=new Set,x=Y=>{Y&&_.add(Y)},S=Y=>{_.add(Y),y.add(Y)},P=Y=>{const ue=Dh(Y,"bwl:Placement");if(!ue)return;const _e=typeof ue.anchor=="string"?ue.anchor:void 0;if(!_e||!u1(ue.side))return;const pe=typeof ue.offset=="number"?ue.offset:void 0;h.push({owner:Y.id,anchor:_e,side:ue.side,...pe!==void 0?{offset:pe}:{}})},C=Y=>{const ue=Dh(Y,"bwl:Members"),_e=typeof(ue==null?void 0:ue.refs)=="string"?ue.refs.split(/\s+/).filter(Boolean):[];_e.length&&m.push({owner:Y.id,refs:_e})},L=Y=>{var ue;for(const _e of Y)switch(x(_e.id),_e.$type){case"bpmn:TextAnnotation":S(_e.id),s.push({id:_e.id,text:typeof _e.text=="string"?_e.text:""}),P(_e);break;case"bpmn:Association":d.push({id:_e.id,type:_e.$type,source:pi(_e.sourceRef),target:pi(_e.targetRef)});break;case"bpmn:Group":{S(_e.id);const pe=(ue=_e.categoryValueRef)==null?void 0:ue.value;c.push({id:_e.id,...typeof pe=="string"&&pe?{name:pe}:{}}),C(_e);break}default:u.push({id:_e.id,type:_e.$type,reason:"type-outside-mvp"})}},T=(Y,ue)=>{const _e=Y.flowElements??[],pe=(Y.laneSets??[]).flatMap(ce=>ce.lanes??[]),xe=new Map;for(const ce of pe){x(ce.id);for(const U of ce.flowNodeRef??[]){const q=pi(U);q&&xe.set(q,ce.id)}}for(const ce of _e){if(x(ce.id),ce.$type==="bpmn:SequenceFlow"){f.push({id:ce.id,source:pi(ce.sourceRef),target:pi(ce.targetRef),...typeof ce.name=="string"&&ce.name?{name:ce.name}:{}});continue}if(ce.$type==="bpmn:DataStoreReference"){S(ce.id),a.push({id:ce.id,...ce.name?{name:ce.name}:{}});continue}const U=s1(ce.$type);if(!rd(U)){u.push({id:ce.id,type:ce.$type,reason:"type-outside-mvp"});continue}S(ce.id),o.push({id:ce.id,type:U,...ce.name?{name:ce.name}:{},...ue?{participant:ue}:{},...xe.has(ce.id)?{lane:xe.get(ce.id)}:{}});const q=Oh(ce,"bwl:band");q!==void 0&&(l.bands[ce.id]=q);for(const Z of ce.dataOutputAssociations??[])x(Z.id),g.push({id:Z.id,type:Z.$type,source:ce.id,target:pi(Z.targetRef)});for(const Z of ce.dataInputAssociations??[])x(Z.id),g.push({id:Z.id,type:Z.$type,source:pi((Z.sourceRef??[])[0]),target:ce.id})}L(Y.artifacts??[])};if(n){const Y=new Set;for(const ue of n.participants??[]){S(ue.id);const _e=pi(ue.processRef);_e&&Y.add(_e);const pe=_e?i.get(_e):void 0,xe=((pe==null?void 0:pe.laneSets)??[]).flatMap(Z=>Z.lanes??[]),ce=xe.map(Z=>({id:Z.id,...Z.name?{name:Z.name}:{}}));for(const Z of ce)S(Z.id);const U=!pe||(pe.flowElements??[]).length===0&&xe.length===0&&(pe.artifacts??[]).length===0;r.push({id:ue.id,...ue.name?{name:ue.name}:{},...U?{blackBox:!0}:{},...ce.length?{lanes:ce}:{}});const q=Oh(ue,"bwl:poolOrder");q!==void 0&&(l.poolOrders[ue.id]=q),pe&&T(pe,ue.id)}for(const ue of n.messageFlows??[])x(ue.id),p.push({id:ue.id,source:pi(ue.sourceRef),target:pi(ue.targetRef),...typeof ue.name=="string"&&ue.name?{name:ue.name}:{}});L(n.artifacts??[]);for(const[ue,_e]of i)!Y.has(ue)&&(_e.flowElements??[]).length>0&&u.push({id:ue,type:_e.$type,reason:"unreachable-process"})}else for(const Y of i.values())T(Y);const j=[],k=[],D=[],z=[],se=(Y,ue)=>!!Y&&!!ue&&y.has(Y)&&y.has(ue);for(const Y of f){if(!se(Y.source,Y.target)){u.push({id:Y.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}j.push({id:Y.id,source:Y.source,target:Y.target,...Y.name?{name:Y.name}:{}}),y.add(Y.id)}for(const Y of p){if(!se(Y.source,Y.target)){u.push({id:Y.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}k.push({id:Y.id,source:Y.source,target:Y.target,...Y.name?{name:Y.name}:{}}),y.add(Y.id)}for(const Y of g){if(!se(Y.source,Y.target)){u.push({id:Y.id??"",type:Y.type,reason:"endpoint-outside-mvp"});continue}z.push({...Y.id?{id:Y.id}:{},source:Y.source,target:Y.target}),Y.id&&y.add(Y.id)}for(const Y of d){if(!se(Y.source,Y.target)){u.push({id:Y.id??"",type:Y.type,reason:"endpoint-outside-mvp"});continue}D.push({...Y.id?{id:Y.id}:{},source:Y.source,target:Y.target})}const we=new Map(c.map(Y=>[Y.id,Y]));for(const{owner:Y,refs:ue}of m){const _e=ue.filter(xe=>_.has(xe)),pe=we.get(Y);pe&&_e.length&&(pe.members=_e)}for(const Y of h)_.has(Y.anchor)&&(l.placements[Y.owner]={anchor:Y.anchor,side:Y.side,...Y.offset!==void 0?{offset:Y.offset}:{}});return{definition:{...r.length?{participants:r}:{},nodes:o,sequenceFlows:j,...k.length?{messageFlows:k}:{},...a.length?{dataStores:a}:{},...z.length?{dataAssociations:z}:{},...s.length?{annotations:s}:{},...D.length?{associations:D}:{},...c.length?{groups:c}:{}},hints:l,omitted:u}}async function l1(e){const{definitions:t,warnings:n}=await qu(e);return{...Lh(t),warnings:n}}function p1(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function Ih(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=kh(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 f1=Symbol("bpmn-editor");function d1(){const e=Mt.ref(!1),t=Mt.ref(!0),n=Mt.ref(!1);let i,r;const o=()=>{e.value=!0};function a(u,l){u.get("canvas").getContainer().style.pointerEvents=l?"":"none";const f=u.get("keyboard");l?(r&&f.bind(r),r=void 0):r||(r=f.getBinding(),f.unbind())}function s(){if(!i)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return i}function c(){return i==null?void 0:i.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,attach(u){i&&this.detach(),i=u,i.get("eventBus").on("commandStack.changed",o),t.value||a(i,!1)},detach(){i==null||i.get("eventBus").off("commandStack.changed",o),i&&!t.value&&a(i,!0),r=void 0,i=void 0},setEditable(u){t.value=u,i&&a(i,u)},async applyAgentBatch(u,l){const f=s();n.value=!0;try{const p=await Ih(f,u,{currentVersion:l});return p.status==="applied"&&(e.value=!1),p}finally{n.value=!1}},async importXml(u){const{warnings:l}=await s().importXML(u);return e.value=!1,{warnings:Yu(l)}},async saveXml(){const{xml:u}=await s().saveXML({format:!0});return e.value=!1,u??""},undo:()=>{var u;return(u=c())==null?void 0:u.undo()},redo:()=>{var u;return(u=c())==null?void 0:u.redo()},canUndo:()=>{var u;return((u=c())==null?void 0:u.canUndo())??!1},canRedo:()=>{var u;return((u=c())==null?void 0:u.canRedo())??!1}}}function ye(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function h1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ul={exports:{}},Bh;function m1(){if(Bh)return ul.exports;Bh=1;var e=ul.exports=function(t,n){if(n||(n=16),t===void 0&&(t=128),t<=0)return"0";for(var i=Math.log(Math.pow(2,t))/Math.log(n),r=2;i===1/0;r*=2)i=Math.log(Math.pow(2,t/r))/Math.log(n)*r;for(var o=i-Math.floor(i),a="",r=0;r<Math.floor(i);r++){var s=Math.floor(Math.random()*n).toString(n);a=s+a}if(o){var c=Math.pow(n,o),s=Math.floor(Math.random()*c).toString(n);a=s+a}var u=parseInt(a,n);return u!==1/0&&u>=Math.pow(2,t)?e(t,n):a};return e.rack=function(t,n,i){var r=function(a){var s=0;do{if(s++>10)if(i)t+=i;else throw new Error("too many ID collisions, use more bits");var c=e(t,n)}while(Object.hasOwnProperty.call(o,c));return o[c]=a,c},o=r.hats={};return r.get=function(a){return r.hats[a]},r.set=function(a,s){return r.hats[a]=s,r},r.bits=t||128,r.base=n||16,r},ul.exports}var g1=m1(),y1=h1(g1);function fi(e){if(!(this instanceof fi))return new fi(e);e=e||[128,36,1],this._seed=e.length?y1.rack(e[0],e[1],e[2]):e}fi.prototype.next=function(e){return this._seed(e||!0)},fi.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},fi.prototype.claim=function(e,t){this._seed.set(e,t||!0)},fi.prototype.assigned=function(e){return this._seed.get(e)||!1},fi.prototype.unclaim=function(e){delete this._seed.hats[e]},fi.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const jt={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};jt.td=jt.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],jt.option=jt.optgroup=[1,'<select multiple="multiple">',"</select>"],jt.thead=jt.tbody=jt.colgroup=jt.caption=jt.tfoot=[1,"<table>","</table>"],jt.polyline=jt.ellipse=jt.polygon=jt.circle=jt.text=jt.line=jt.path=jt.rect=jt.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function ht(e,t=globalThis.document){var u;if(typeof e!="string")throw new TypeError("String expected");const n=/^<!--(.*?)-->$/s.exec(e);if(n)return t.createComment(n[1]);const i=(u=/<([\w:]+)/.exec(e))==null?void 0:u[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const l=t.createElement("html");l.innerHTML=e;const{lastChild:f}=l;return f.remove(),f}let[r,o,a]=Object.hasOwn(jt,i)?jt[i]:jt._default,s=t.createElement("div");for(s.innerHTML=o+e+a;r--;)s=s.lastChild;if(s.firstChild===s.lastChild){const{firstChild:l}=s;return l.remove(),l}const c=t.createDocumentFragment();return c.append(...s.childNodes),c}function v1(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 mn(e,...t){const n=e.style;return I(t,function(i){i&&I(i,function(r,o){n[o]=r})}),e}function un(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const b1=Object.prototype.toString;function _t(e){return new Xi(e)}function Xi(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Xi.prototype.add=function(e){return this.list.add(e),this},Xi.prototype.remove=function(e){return b1.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Xi.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},Xi.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Xi.prototype.array=function(){return Array.from(this.list)},Xi.prototype.has=Xi.prototype.contains=function(e){return this.list.contains(e)};function xs(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Tr(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function _1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ws={},Nh;function x1(){if(Nh)return ws;Nh=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return ws.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},ws.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},ws}var $h=x1(),w1=_1($h),$e=v1({__proto__:null,default:w1},[$h]),Fh=["focus","blur"];function E1(e,t,n,i,r){return Fh.indexOf(n)!==-1&&(r=!0),$e.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=Tr(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function S1(e,t,n,i){return Fh.indexOf(t)!==-1&&(i=!0),$e.unbind(e,t,n,i)}var Pn={bind:E1,unbind:S1};function ll(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function ot(e,t){return t=t||document,t.querySelector(e)}function Es(e,t){return t=t||document,t.querySelectorAll(e)}function di(e){e.parentNode&&e.parentNode.removeChild(e)}function R1(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function C1(e,t){return t.appendChild(R1(e,t))}function Fe(e,t){return C1(t,e),e}var pl=2,jh={"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":pl,"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":pl,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function P1(e,t){return jh[t]?e.style[t]:e.getAttributeNS(null,t)}function Hh(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=jh[i];r?(r===pl&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function A1(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)Hh(e,r,t[r])}function ve(e,t,n){if(typeof t=="string")if(n!==void 0)Hh(e,t,n);else return P1(e,t);else A1(e,t);return e}const T1=Object.prototype.toString;function Xe(e){return new Zi(e)}function Zi(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Zi.prototype.add=function(e){return this.list.add(e),this},Zi.prototype.remove=function(e){return T1.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Zi.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},Zi.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Zi.prototype.array=function(){return Array.from(this.list)},Zi.prototype.has=Zi.prototype.contains=function(e){return this.list.contains(e)};function Ss(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function zh(e){return e.cloneNode(!0)}var fl={svg:"http://www.w3.org/2000/svg"},Gh='<svg xmlns="'+fl.svg+'"';function M1(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(fl.svg)===-1&&(e=Gh+e.substring(4)):(e=Gh+">"+e+"</svg>",t=!0);var n=k1(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function k1(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function Pe(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=M1(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(fl.svg,e),t&&ve(n,t),n}var dl=null;function Vh(){return dl===null&&(dl=Pe("svg")),dl}function Wh(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function O1(e,t,n,i,r,o){var a=Vh().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return Wh(a,e);case 6:return Wh(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function Xo(e){return Vh().createSVGTransform()}var Uh=/([&<>]{1})/g,D1=/([&<>\n\r"]{1})/g,L1={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function hl(e,t){function n(i,r){return L1[r]||r}return e.replace(t,n)}function qh(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(hl(e.textContent,Uh));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,'="',hl(o.value,D1),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)qh(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",hl(e.nodeValue,Uh),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function I1(e){for(var t=e.firstChild,n=[];t;)qh(t,n),t=t.nextSibling;return n.join("")}function Yh(e,t){return I1(e)}function Ht(e){var t=e.parentNode;return t&&t.removeChild(e),e}function B1(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function N1(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(B1(e,i))}function Zo(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),N1(n,t)),n.consolidate()}const $1=/^class[ {]/;function F1(e){return $1.test(e.toString())}function ml(e){return Array.isArray(e)}function gl(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Rs(...e){e.length===1&&ml(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const j1=/constructor\s*[^(]*\(\s*([^)]*)\)/m,H1=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,z1=/\/\*([^*]*)\*\//m;function G1(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(F1(e)?j1:H1);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(z1);return(r&&r[1]||i).trim()})||[]}function Kh(e,t){const n=t||{get:function(x,S){if(i.push(x),S===!1)return null;throw s(`No provider for "${x}"!`)}},i=[],r=this._providers=Object.create(n._providers||null),o=this._instances=Object.create(null),a=o.injector=this,s=function(x){const S=i.join(" -> ");return i.length=0,new Error(S?`${x} (Resolving: ${S})`:x)};function c(x,S){if(!r[x]&&x.includes(".")){const P=x.split(".");let C=c(P.shift());for(;P.length;)C=C[P.shift()];return C}if(gl(o,x))return o[x];if(gl(r,x)){if(i.indexOf(x)!==-1)throw i.push(x),s("Cannot resolve circular dependency!");return i.push(x),o[x]=r[x][0](r[x][1]),i.pop(),o[x]}return n.get(x,S)}function u(x,S){if(typeof S>"u"&&(S={}),typeof x!="function")if(ml(x))x=Rs(x.slice());else throw s(`Cannot invoke "${x}". Expected a function!`);const C=(x.$inject||G1(x)).map(L=>gl(S,L)?S[L]:c(L));return{fn:x,dependencies:C}}function l(x){const{fn:S,dependencies:P}=u(x),C=Function.prototype.bind.call(S,null,...P);return new C}function f(x,S,P){const{fn:C,dependencies:L}=u(x,P);return C.apply(S,L)}function p(x){return Rs(S=>x.get(S))}function d(x,S){if(S&&S.length){const P=Object.create(null),C=Object.create(null),L=[],T=[],j=[];let k,D,z,se;for(let we in r)k=r[we],S.indexOf(we)!==-1&&(k[2]==="private"?(D=L.indexOf(k[3]),D===-1?(z=k[3].createChild([],S),se=p(z),L.push(k[3]),T.push(z),j.push(se),P[we]=[se,we,"private",z]):P[we]=[j[D],we,"private",T[D]]):P[we]=[k[2],k[1]],C[we]=!0),(k[2]==="factory"||k[2]==="type")&&k[1].$scope&&S.forEach(Ke=>{k[1].$scope.indexOf(Ke)!==-1&&(P[we]=[k[2],k[1]],C[Ke]=!0)});S.forEach(we=>{if(!C[we])throw new Error('No provider for "'+we+'". Cannot use provider from the parent!')}),x.unshift(P)}return new Kh(x,a)}const g={factory:f,type:l,value:function(x){return x}};function h(x,S){const P=x.__init__||[];return function(){P.forEach(C=>{typeof C=="string"?S.get(C):S.invoke(C)})}}function m(x){const S=x.__exports__;if(S){const P=x.__modules__,C=Object.keys(x).reduce((D,z)=>(z!=="__exports__"&&z!=="__modules__"&&z!=="__init__"&&z!=="__depends__"&&(D[z]=x[z]),D),Object.create(null)),L=(P||[]).concat(C),T=d(L),j=Rs(function(D){return T.get(D)});S.forEach(function(D){r[D]=[j,D,"private",T]});const k=(x.__init__||[]).slice();return k.unshift(function(){T.init()}),x=Object.assign({},x,{__init__:k}),h(x,T)}return Object.keys(x).forEach(function(P){if(P==="__init__"||P==="__depends__")return;const C=x[P];if(C[2]==="private"){r[P]=C;return}const L=C[0],T=C[1];r[P]=[g[L],V1(L,T),L]}),h(x,a)}function _(x,S){return x.indexOf(S)!==-1||(x=(S.__depends__||[]).reduce(_,x),x.indexOf(S)!==-1)?x:x.concat(S)}function y(x){const S=x.reduce(_,[]).map(m);let P=!1;return function(){P||(P=!0,S.forEach(C=>C()))}}this.get=c,this.invoke=f,this.instantiate=l,this.createChild=d,this.init=y(e)}function V1(e,t){return e!=="value"&&ml(t)&&(t=Rs(t.slice())),t}var W1=1e3;function Ti(e,t){var n=this;t=t||W1,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)})}Ti.prototype.canRender=function(e){},Ti.prototype.drawShape=function(e,t){},Ti.prototype.drawConnection=function(e,t){},Ti.prototype.getShapePath=function(e){},Ti.prototype.getConnectionPath=function(e){};function Mr(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function U1(e){return["M",e.x,e.y]}function yl(e){return["L",e.x,e.y]}function q1(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function Y1(e,t){const n=e.length,i=[U1(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(yl(a));continue}const c=Math.min(t,vl(a.x-o.x,a.y-o.y),vl(s.x-a.x,s.y-a.y));if(!c){i.push(yl(a));continue}const u=Cs(a,o,c),l=Cs(a,o,c*.5),f=Cs(a,s,c),p=Cs(a,s,c*.5);i.push(yl(u)),i.push(q1(l,p,f))}return i}function Cs(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=vl(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function vl(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Qo(e,t,n){Ie(t)&&(n=t,t=null),t||(t={});const i=Pe("path",t);return Ie(n)&&(i.dataset.cornerRadius=String(n)),bl(i,e)}function bl(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return ve(e,{d:Mr(Y1(t,n))}),e}function Ps(e){var t=new Set(e);return Ue(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function kr(e,t,n){n=n||0,ke(e)||(e=[e]),I(e,function(i,r){var o=t(i,r,n);ke(o)&&o.length&&kr(o,t,n+1)})}function _l(e,t,n){var i=new Set,r=new Set;return kr(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 Jo(e,t){return _l(e)}function K1(e,t,n){Sr(t)&&(t=!0),qt(t)&&(n=t,t=!0),n=n||{};var i=ea(n.allShapes),r=ea(n.allConnections),o=ea(n.enclosedElements),a=ea(n.enclosedConnections),s=ea(n.topLevel,t&&Jr(e,function(l){return l.id}));function c(l){s[l.source.id]&&s[l.target.id]&&(s[l.id]=[l]),i[l.source.id]&&i[l.target.id]&&(a[l.id]=o[l.id]=l),r[l.id]=l}function u(l){if(o[l.id]=l,l.waypoints)a[l.id]=r[l.id]=l;else return i[l.id]=l,I(l.incoming,c),I(l.outgoing,c),l.children}return kr(e,u),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function kt(e,t){t=!!t,ke(e)||(e=[e]);var n,i,r,o;return I(e,function(a){var s=a;a.waypoints&&!t&&(s=kt(a.waypoints,!0));var c=s.x,u=s.y,l=s.height||0,f=s.width||0;(c<n||n===void 0)&&(n=c),(u<i||i===void 0)&&(i=u),(c+f>r||r===void 0)&&(r=c+f),(u+l>o||o===void 0)&&(o=u+l)}),{x:n,y:i,height:o-i,width:r-n}}function uo(e,t){var n={};return I(e,function(i){var r=i;r.waypoints&&(r=kt(r)),!Ie(t.y)&&r.x>t.x&&(n[i.id]=i),!Ie(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(Ie(t.width)&&Ie(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!Ie(t.width)||!Ie(t.height))&&(n[i.id]=i)}),n}function Xh(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function Zh(e){return!!(e&&e.isFrame)}function ea(e,t){return V({},e||{},t||{})}var X1=1;function Qi(e,t){Ti.call(this,e,X1),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})}ye(Qi,Ti),Qi.prototype.canRender=function(){return!0},Qi.prototype.drawShape=function(t,n,i){var r=Pe("rect");return ve(r,{x:0,y:0,width:n.width||0,height:n.height||0}),Zh(n)?ve(r,V({},this.FRAME_STYLE,i||{})):ve(r,V({},this.SHAPE_STYLE,i||{})),Fe(t,r),r},Qi.prototype.drawConnection=function(t,n,i){var r=Qo(n.waypoints,V({},this.CONNECTION_STYLE,i||{}));return Fe(t,r),r},Qi.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 Mr(a)},Qi.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 Mr(o)},Qi.$inject=["eventBus","styles"];function Z1(){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 V(o,{class:n})},this.style=function(n,i){!ke(n)&&!i&&(i=n,n=[]);var r=Rn(n,function(o,a){return V(o,e[a]||{})},{});return i?V(r,i):r},this.computeStyle=function(n,i,r){return ke(i)||(r=i,i=[]),t.style(i||[],V({},r,n||{}))}}const Q1={__init__:["defaultRenderer"],defaultRenderer:["type",Qi],styles:["type",Z1]};function Ct(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function At(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 xl(e,t){return!e||!t?-1:e.indexOf(t)}function ta(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function wl(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=ta(e,t);return Math.abs(r/o)<=i}var J1=2;function Mi(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(eS(r,n))return o;return!1}function eS(e,t){const n=t[0];return Rr(t,function(i){return Math.abs(n[e]-i[e])<=J1})}function Qh(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 El(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var tS=/,?([a-z]),?/gi,Jh=parseFloat,Ot=Math,Ji=Ot.PI,hi=Ot.min,mi=Ot.max,em=Ot.pow,er=Ot.abs,nS=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,iS=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,tm=Array.isArray||function(e){return e instanceof Array};function rS(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function oS(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 aS(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 rS(r,i)?(oS(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function sS(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(nS,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(iS,function(c,u){u&&a.push(+u)}),s=="m"&&a.length>2&&(n.push([r,...a.splice(0,2)]),s="l",r=r=="m"?"l":"L");a.length>=t[s]&&(n.push([r,...a.splice(0,t[s])]),!!t[s]););}),n.toString=Rl,n}function cS(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 uS(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 Sl(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 Rl(){return this.join(",").replace(tS,"$1")}function lS(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=Rl,t}function nm(e,t,n,i,r,o,a,s,c){var u=1-c,l=em(u,3),f=em(u,2),p=c*c,d=p*c,g=l*e+f*3*c*n+u*3*c*c*r+d*a,h=l*t+f*3*c*i+u*3*c*c*o+d*s;return{x:As(g),y:As(h)}}function im(e){var t=gS(...e);return Sl(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function tr(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function pS(e,t){return e=Sl(e),t=Sl(t),tr(t,e.x,e.y)||tr(t,e.x2,e.y)||tr(t,e.x,e.y2)||tr(t,e.x2,e.y2)||tr(e,t.x,t.y)||tr(e,t.x2,t.y)||tr(e,t.x,t.y2)||tr(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 rm(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 om(e,t,n,i,r,o,a,s,c){c==null&&(c=1),c=c>1?1:c<0?0:c;for(var u=c/2,l=12,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,g=0;g<l;g++){var h=u*f[g]+u,m=rm(h,e,n,r,a),_=rm(h,t,i,o,s),y=m*m+_*_;d+=p[g]*Ot.sqrt(y)}return u*d}function fS(e,t,n,i,r,o,a,s){if(!(mi(e,n)<hi(r,a)||hi(e,n)>mi(r,a)||mi(t,i)<hi(o,s)||hi(t,i)>mi(o,s))){var c=(e*i-t*n)*(r-a)-(e-n)*(r*s-o*a),u=(e*i-t*n)*(o-s)-(t-i)*(r*s-o*a),l=(e-n)*(o-s)-(t-i)*(r-a);if(l){var f=As(c/l),p=As(u/l),d=+f.toFixed(2),g=+p.toFixed(2);if(!(d<+hi(e,n).toFixed(2)||d>+mi(e,n).toFixed(2)||d<+hi(r,a).toFixed(2)||d>+mi(r,a).toFixed(2)||g<+hi(t,i).toFixed(2)||g>+mi(t,i).toFixed(2)||g<+hi(o,s).toFixed(2)||g>+mi(o,s).toFixed(2)))return{x:f,y:p}}}}function As(e){return Math.round(e*1e11)/1e11}function dS(e,t,n){var i=im(e),r=im(t);if(!pS(i,r))return[];var o=om(...e),a=om(...t),s=sm(e)?1:~~(o/5)||1,c=sm(t)?1:~~(a/5)||1,u=new Array(s+1),l=new Array(c+1),f={},p=[],d,g;for(d=0;d<s+1;d++){var h=nm(...e,d/s);u[d]={x:h.x,y:h.y,t:d/s}}for(d=0;d<c+1;d++)h=nm(...t,d/c),l[d]={x:h.x,y:h.y,t:d/c};for(d=0;d<s;d++)for(g=0;g<c;g++){var m=u[d],_=u[d+1],y=l[g],x=l[g+1],S=er(_.x-m.x)<.01?"y":"x",P=er(x.x-y.x)<.01?"y":"x",C=fS(m.x,m.y,_.x,_.y,y.x,y.y,x.x,x.y),L;if(C){if(L=C.x.toFixed(9)+"#"+C.y.toFixed(9),f[L])continue;f[L]=!0;var T=m.t+er((C[S]-m[S])/(_[S]-m[S]))*(_.t-m.t),j=y.t+er((C[P]-y[P])/(x[P]-y[P]))*(x.t-y.t);T>=0&&T<=1&&j>=0&&j<=1&&p.push({x:C.x,y:C.y,t1:T,t2:j})}}return p}function am(e,t,n){e=lm(e),t=lm(t);for(var i,r,o,a,s,c,u,l,f,p,d=n?0:[],g=0,h=e.length;g<h;g++){var m=e[g];if(m[0]=="M")i=s=m[1],r=c=m[2];else{m[0]=="C"?(f=[i,r,...m.slice(1)],i=f[6],r=f[7]):(f=[i,r,i,r,s,c,s,c],i=s,r=c);for(var _=0,y=t.length;_<y;_++){var x=t[_];if(x[0]=="M")o=u=x[1],a=l=x[2];else{x[0]=="C"?(p=[o,a,...x.slice(1)],o=p[6],a=p[7]):(p=[o,a,o,a,u,l,u,l],o=u,a=l);var S=dS(f,p);{for(var P=0,C=S.length;P<C;P++)S[P].segment1=g,S[P].segment2=_,S[P].bez1=f,S[P].bez2=p;d=d.concat(S)}}}}}return d}function hS(e){return tm(e)&&tm(e[0])}function mS(e){if(cS(e))return e;var t=new Array(e.length),n=0,i=0,r=0,o=0,a=0,s;e[0][0]=="M"&&(n=+e[0][1],i=+e[0][2],r=n,o=i,a++,t[0]=["M",n,i]);for(var c,u,l=a,f=e.length;l<f;l++){if(u=e[l],s=u[0],t[l]=c=new Array(u.length),s!=s.toUpperCase())switch(c[0]=s.toUpperCase(),c[0]){case"A":c[1]=u[1],c[2]=u[2],c[3]=u[3],c[4]=u[4],c[5]=u[5],c[6]=+u[6]+n,c[7]=+u[7]+i;break;case"V":c[1]=+u[1]+i;break;case"H":c[1]=+u[1]+n;break;case"M":r=+u[1]+n,o=+u[2]+i;default:for(var p=1,d=u.length;p<d;p++)c[p]=+u[p]+(p%2?n:i)}else for(var g=0,h=u.length;g<h;g++)c[g]=u[g];switch(s=s.toUpperCase(),c[0]){case"Z":n=+r,i=+o;break;case"H":n=c[1];break;case"V":i=c[1];break;case"M":r=c[c.length-2],o=c[c.length-1];default:n=c[c.length-2],i=c[c.length-1]}}return t.toString=Rl,t}function sm(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Ts(e,t,n,i){return[e,t,n,i,n,i]}function cm(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 um(e,t,n,i,r,o,a,s,c,u){var l=Ji*120/180,f=Ji/180*(+r||0),p=[],d,g=aS(function(M,E,b){var H=M*Ot.cos(b)-E*Ot.sin(b),W=M*Ot.sin(b)+E*Ot.cos(b);return{x:H,y:W}});if(u)L=u[0],T=u[1],P=u[2],C=u[3];else{d=g(e,t,-f),e=d.x,t=d.y,d=g(s,c,-f),s=d.x,c=d.y;var h=(e-s)/2,m=(t-c)/2,_=h*h/(n*n)+m*m/(i*i);_>1&&(_=Ot.sqrt(_),n=_*n,i=_*i);var y=n*n,x=i*i,S=(o==a?-1:1)*Ot.sqrt(er((y*x-y*m*m-x*h*h)/(y*m*m+x*h*h))),P=S*n*m/i+(e+s)/2,C=S*-i*h/n+(t+c)/2,L=Ot.asin(((t-C)/i).toFixed(9)),T=Ot.asin(((c-C)/i).toFixed(9));L=e<P?Ji-L:L,T=s<P?Ji-T:T,L<0&&(L=Ji*2+L),T<0&&(T=Ji*2+T),a&&L>T&&(L=L-Ji*2),!a&&T>L&&(T=T-Ji*2)}var j=T-L;if(er(j)>l){var k=T,D=s,z=c;T=L+l*(a&&T>L?1:-1),s=P+n*Ot.cos(T),c=C+i*Ot.sin(T),p=um(s,c,n,i,r,0,a,D,z,[T,k,P,C])}j=T-L;var se=Ot.cos(L),we=Ot.sin(L),Ke=Ot.cos(T),Y=Ot.sin(T),ue=Ot.tan(j/4),_e=4/3*n*ue,pe=4/3*i*ue,xe=[e,t],ce=[e+_e*we,t-pe*se],U=[s+_e*Y,c-pe*Ke],q=[s,c];if(ce[0]=2*xe[0]-ce[0],ce[1]=2*xe[1]-ce[1],u)return[ce,U,q].concat(p);p=[ce,U,q].concat(p).join().split(",");for(var Z=[],Ve=0,Zt=p.length;Ve<Zt;Ve++)Z[Ve]=Ve%2?g(p[Ve-1],p[Ve],f).y:g(p[Ve],p[Ve+1],f).x;return Z}function gS(e,t,n,i,r,o,a,s){for(var c=[],u=[[],[]],l,f,p,d,g,h,m,_,y=0;y<2;++y){if(y==0?(f=6*e-12*n+6*r,l=-3*e+9*n-9*r+3*a,p=3*n-3*e):(f=6*t-12*i+6*o,l=-3*t+9*i-9*o+3*s,p=3*i-3*t),er(l)<1e-12){if(er(f)<1e-12)continue;d=-p/f,0<d&&d<1&&c.push(d);continue}m=f*f-4*p*l,_=Ot.sqrt(m),!(m<0)&&(g=(-f+_)/(2*l),0<g&&g<1&&c.push(g),h=(-f-_)/(2*l),0<h&&h<1&&c.push(h))}for(var x=c.length,S=x,P;x--;)d=c[x],P=1-d,u[0][x]=P*P*P*e+3*P*P*d*n+3*P*d*d*r+d*d*d*a,u[1][x]=P*P*P*t+3*P*P*d*i+3*P*d*d*o+d*d*d*s;return u[0][S]=e,u[1][S]=t,u[0][S+1]=a,u[1][S+1]=s,u[0].length=u[1].length=S+2,{x0:hi(...u[0]),y0:hi(...u[1]),x1:mi(...u[0]),y1:mi(...u[1])}}function lm(e){if(hS(e)||(e=sS(e)),uS(e))return e;for(var t=lS(mS(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(p,d,g){var h,m;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",...um(d.x,d.y,...p.slice(1))];break;case"S":g=="C"||g=="S"?(h=d.x*2-d.bx,m=d.y*2-d.by):(h=d.x,m=d.y),p=["C",h,m,...p.slice(1)];break;case"T":g=="Q"||g=="T"?(d.qx=d.x*2-d.qx,d.qy=d.y*2-d.qy):(d.qx=d.x,d.qy=d.y),p=["C",...cm(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",...cm(d.x,d.y,p[1],p[2],p[3],p[4])];break;case"L":p=["C",...Ts(d.x,d.y,p[1],p[2])];break;case"H":p=["C",...Ts(d.x,d.y,p[1],d.y)];break;case"V":p=["C",...Ts(d.x,d.y,d.x,p[1])];break;case"Z":p=["C",...Ts(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 g=p[d];g.length;)o[d]="A",p.splice(d++,0,["C",...g.splice(0,6)]);p.splice(d,1),u=t.length}},o=[],a="",s="",c=0,u=t.length;c<u;c++){t[c]&&(a=t[c][0]),a!="C"&&(o[c]=a,c&&(s=o[c-1])),t[c]=i(t[c],n,s),o[c]!="A"&&a=="C"&&(o[c]="C"),r(t,c);var l=t[c],f=l.length;n.x=l[f-2],n.y=l[f-1],n.bx=Jh(l[f-4])||n.x,n.by=Jh(l[f-3])||n.y}return t}function at(e){return qt(e)&&Sn(e,"waypoints")}function Ge(e){return qt(e)&&Sn(e,"labelTarget")}function yS(e){return qt(e)&&Zr(e.parent)}function pm(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function ki(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Te(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Ms(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function vS(e){return ki({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function bS(e){for(var t=e.waypoints,n=t.reduce(function(u,l,f){var p=t[f-1];if(p){var d=u[u.length-1],g=d&&d.endLength||0,h=wS(p,l);u.push({start:p,end:l,startLength:g,endLength:g+h,length:h})}return u},[]),i=n.reduce(function(u,l){return u+l.length},0),r=i/2,o=0,a=n[o];a.endLength<r;)a=n[++o];var s=(r-a.startLength)/a.length,c={x:a.start.x+(a.end.x-a.start.x)*s,y:a.start.y+(a.end.y-a.start.y)*s};return c}function Oe(e){return at(e)?bS(e):vS(e)}function tn(e,t,n){n=n||0,qt(n)||(n={x:n,y:n});var i=Te(e),r=Te(t),o=i.bottom+n.y<=r.top,a=i.left-n.x>=r.right,s=i.top-n.y>=r.bottom,c=i.right+n.x<=r.left,u=o?"top":s?"bottom":null,l=c?"left":a?"right":null;return l&&u?u+"-"+l:l||u||"intersect"}function na(e,t,n){var i=_S(e,t);return i.length===1||i.length===2&&ta(i[0],i[1])<1?ki(i[0]):i.length>1?(i=ci(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),ki(i[n?0:i.length-1])):null}function _S(e,t){return am(e,t)}function xS(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],ta(n,r)===0||wl(i,r,n)?e.splice(t,1):t++;return e}function wS(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function ks(e,t){return Math.round(e*t)/t}function fm(e){return Ie(e)?e+"px":e}function ES(e){for(;e.parent;)e=e.parent;return e}function SS(e){e=V({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),mn(n,{position:"relative",overflow:"hidden",width:fm(e.width),height:fm(e.height)}),t.appendChild(n),n}function dm(e,t,n){const i=Pe("g");Xe(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const RS="base",hm=0,CS=1,PS={shape:["x","y","width","height"],connection:["waypoints"]};function De(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||{})}De.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],De.prototype._init=function(e){const t=this._eventBus,n=this._container=SS(e),i=this._svg=Pe("svg");ve(i,{width:"100%",height:"100%"}),un(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")}),Fe(n,i);const r=this._viewport=dm(i,"viewport");e.deferUpdate&&(this._viewboxChanged=Lu(this._viewboxChanged,300)),this._restoreFocus=Lu(this._restoreFocus,0),t.on("diagram.init",()=>{t.fire("canvas.init",{svg:i,viewport:r})}),t.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed","root.set"],()=>{delete this._cachedViewbox}),t.on("diagram.destroy",500,this._destroy,this),t.on("diagram.clear",500,this._clear,this)},De.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},De.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},De.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=Xh(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},De.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},De.prototype.restoreFocus=function(){this._restoreFocus()},De.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},De.prototype.isFocused=function(){return this._focused},De.prototype.getDefaultLayer=function(){return this.getLayer(RS,hm)},De.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},De.prototype._getChildIndex=function(e){return Rn(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},De.prototype._createLayer=function(e,t){typeof t>"u"&&(t=CS);const n=this._getChildIndex(t);return{group:dm(this._viewport,"layer-"+e,n),index:t,visible:!0}},De.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},De.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&&(Ht(n),t.visible=!1),n},De.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],Ht(t.group))},De.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},De.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(ES(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},De.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},De.prototype._findPlaneForRoot=function(e){return pt(this._planes,function(t){return t.rootElement===e})},De.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},De.prototype._resolveElements=function(e){return ke(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},De.prototype.getContainer=function(){return this._container},De.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&&(I([i.gfx,i.secondaryGfx],function(r){r&&(n?(e.markers.add(t),Xe(r).add(t)):(e.markers.delete(t),Xe(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},De.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},De.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},De.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},De.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},De.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},De.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,hm);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},De.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},De.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},De.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)},De.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})},De.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})},De.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=PS[e];if(!Rr(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},De.prototype._setParent=function(e,t,n){At(t.children,e,n),e.parent=t},De.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},De.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},De.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},De.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),Ct(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},De.prototype.removeShape=function(e){return this._removeElement(e,"shape")},De.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},De.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},De.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},De.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},De.prototype.viewbox=function(e){if(e===void 0&&this._cachedViewbox)return structuredClone(this._cachedViewbox);const t=this._viewport,n=this.getSize();let i,r,o,a,s,c,u;if(e)this._changeViewbox(function(){s=Math.min(n.width/e.width,n.height/e.height);const l=this._svg.createSVGMatrix().scale(s).translate(-e.x,-e.y);Zo(t,l)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=Zo(t),r=a?a.matrix:O1(),s=ks(r.a,1e3),c=ks(-r.e||0,1e3),u=ks(-r.f||0,1e3),e=this._cachedViewbox={x:c?c/s:0,y:u?u/s:0,width:n.width/s,height:n.height/s,scale:s,inner:{width:i.width||0,height:i.height||0,x:i.x||0,y:i.y||0},outer:n},e;return e},De.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=V({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),mm(t,n)}),{x:n.e,y:n.f}},De.prototype.scrollToElement=function(e,t){let n=100;const i=this._resolveElements(e);if(!i.length)return;const r=this.findRoot(i);if(!r)return;r!==this.getRootElement()&&this.setRootElement(r);const o=i.filter(g=>g!=r);if(!o.length)return;t||(t={}),typeof t=="number"&&(n=t),t={top:t.top||n,right:t.right||n,bottom:t.bottom||n,left:t.left||n};const a=kt(o),s=Te(a),c=this.viewbox(),u=this.zoom();let l,f;c.y+=t.top/u,c.x+=t.left/u,c.width-=(t.right+t.left)/u,c.height-=(t.bottom+t.top)/u;const p=Te(c);if(!(a.width<c.width&&a.height<c.height))l=a.x-c.x,f=a.y-c.y;else{const g=Math.max(0,s.right-p.right),h=Math.min(0,s.left-p.left),m=Math.max(0,s.bottom-p.bottom),_=Math.min(0,s.top-p.top);l=g||h,f=m||_}this.scroll({dx:-l*u,dy:-f*u})},De.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)}),ks(i.a,1e3)};function mm(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}De.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},De.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,r=n.createSVGMatrix(),o=n.createSVGPoint();let a,s,c,u,l;c=i.getCTM();const f=c.a;return t?(a=V(o,t),s=a.matrixTransform(c.inverse()),u=r.translate(s.x,s.y).scale(1/f*e).translate(-s.x,-s.y),l=c.multiply(u)):l=r.scale(e),mm(this._viewport,l),l},De.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},De.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}},De.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var lo="data-element-id";function Fn(e){this._elements={},this._eventBus=e}Fn.$inject=["eventBus"],Fn.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),ve(t,lo,i),n&&ve(n,lo,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},Fn.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(ve(i.gfx,lo,""),i.secondaryGfx&&ve(i.secondaryGfx,lo,""),delete t[n])},Fn.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)},Fn.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&ve(t,lo,i),t},Fn.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&ve(e,lo);var n=this._elements[t];return n&&n.element},Fn.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},Fn.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}},Fn.prototype.getAll=function(){return this.filter(function(e){return e})},Fn.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)})},Fn.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},Fn.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 AS(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 TS(e){return e.__refs_collection===!0}function MS(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function gm(e,t,n){var i=AS(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 kS(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 Wn(e,t){if(!(this instanceof Wn))return new Wn(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Wn.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?gm(this,t,e):kS(this,t,e)},Wn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return TS(n)||gm(this,t,e),n},Wn.prototype.ensureBound=function(e,t){MS(e,t)||this.bind(e,t)},Wn.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Wn.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var Cl=new Wn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),ym=new Wn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),vm=new Wn({name:"attachers",collection:!0},{name:"host"}),bm=new Wn({name:"outgoing",collection:!0},{name:"source"}),_m=new Wn({name:"incoming",collection:!0},{name:"target"});function po(){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)}}),Cl.bind(this,"parent"),ym.bind(this,"labels"),bm.bind(this,"outgoing"),_m.bind(this,"incoming")}function ia(){po.call(this),Cl.bind(this,"children"),vm.bind(this,"host"),vm.bind(this,"attachers")}ye(ia,po);function xm(){po.call(this),Cl.bind(this,"children")}ye(xm,ia);function wm(){ia.call(this),ym.bind(this,"labelTarget")}ye(wm,ia);function Em(){po.call(this),bm.bind(this,"source"),_m.bind(this,"target")}ye(Em,po);var OS={connection:Em,shape:ia,label:wm,root:xm};function DS(e,t){var n=OS[e];if(!n)throw new Error("unknown type: <"+e+">");return V(new n,t)}function LS(e){return e instanceof po}function Oi(){this._uid=12}Oi.prototype.createRoot=function(e){return this.create("root",e)},Oi.prototype.createLabel=function(e){return this.create("label",e)},Oi.prototype.createShape=function(e){return this.create("shape",e)},Oi.prototype.createConnection=function(e){return this.create("connection",e)},Oi.prototype.create=function(e,t){return t=V({},t||{}),t.id||(t.id=e+"_"+this._uid++),DS(e,t)};var Os="__fn",Sm=1e3,IS=Array.prototype.slice;function An(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}An.prototype.on=function(e,t,n,i){if(e=ke(e)?e:[e],Yt(t)&&(i=n,n=t,t=Sm),!Ie(t))throw new Error("priority must be a number");var r=n;i&&(r=bn(n,i),r[Os]=n[Os]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},An.prototype.once=function(e,t,n,i){var r=this;if(Yt(t)&&(i=n,n=t,t=Sm),!Ie(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[Os]=n,this.on(e,t,o)},An.prototype.off=function(e,t){e=ke(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},An.prototype.createEvent=function(e){var t=new ra;return t.init(e),t},An.prototype.fire=function(e,t){var n,i,r,o;if(o=IS.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 ra?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}},An.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},An.prototype._destroy=function(){this._listeners={}},An.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},An.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=BS(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},An.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},An.prototype._getListeners=function(e){return this._listeners[e]},An.prototype._setListeners=function(e,t){this._listeners[e]=t},An.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[Os]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function ra(){}ra.prototype.stopPropagation=function(){this.cancelBubble=!0},ra.prototype.preventDefault=function(){this.defaultPrevented=!0},ra.prototype.init=function(e){V(this,e||{})};function BS(e,t){return e.apply(null,t)}function Or(e){return e.childNodes[0]}function NS(e){return e.parentNode.childNodes[1]}function Ds(e,t,n,i,r){var o=Xo();o.setTranslate(t,n);var a=Xo();a.setRotate(i||0,0,0);var s=Xo();s.setScale(1,1),Zo(e,[o,a,s])}function nn(e,t,n){var i=Xo();i.setTranslate(t,n),Zo(e,i)}function Rm(e,t){var n=Xo();n.setRotate(t,0,0),Zo(e,n)}function jn(e,t){this._eventBus=e,this._elementRegistry=t}jn.$inject=["eventBus","elementRegistry"],jn.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=NS(t),n||(n=Pe("g"),Xe(n).add("djs-children"),Fe(t.parentNode,n))):n=t,n},jn.prototype._clear=function(e){var t=Or(e);return xs(t),t},jn.prototype._createContainer=function(e,t,n,i){var r=Pe("g");Xe(r).add("djs-group"),typeof n<"u"?$S(r,t,t.childNodes[n]):Fe(t,r);var o=Pe("g");Xe(o).add("djs-element"),Xe(o).add("djs-"+e),i&&Xe(o).add("djs-frame"),Fe(r,o);var a=Pe("g");return Xe(a).add("djs-visual"),Fe(o,a),o},jn.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,Zh(t))},jn.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=Rn(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),I(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r),s=a.firstChild;I(o,function(c){var u=n.getGraphics(c).parentNode;u===s?s=s.nextSibling:a.insertBefore(u,s)})}})},jn.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},jn.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},jn.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},jn.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},jn.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),nn(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?ve(n,"display","none"):ve(n,"display","block")}},jn.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);Ht(t.parentNode)};function $S(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const FS={__depends__:[Q1],__init__:["canvas"],canvas:["type",De],elementRegistry:["type",Fn],elementFactory:["type",Oi],eventBus:["type",An],graphicsFactory:["type",jn]};function jS(e){var t=new Kh(e);return t.init(),t}function HS(e){e=e||{};var t={config:["value",e]},n=[t,FS].concat(e.modules||[]);return jS(n)}function nr(e,t){this._injector=t||HS(e),this.get("eventBus").fire("diagram.init")}nr.prototype.get=function(e,t){return this._injector.get(e,t)},nr.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},nr.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},nr.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function ln(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function _n(e,t){return e.$instanceOf(t)}function zS(e){return pt(e.rootElements,function(t){return _n(t,"bpmn:Process")||_n(t,"bpmn:Collaboration")})}function GS(e){var t={},n=[],i={};function r(U,q){return function(Z){U(Z,q)}}function o(U){t[U.id]=U}function a(U){return t[U.id]}function s(U,q){var Z=U.gfx;if(Z)throw new Error(`already rendered ${ln(U)}`);return e.element(U,i[U.id],q)}function c(U,q){return e.root(U,i[U.id],q)}function u(U,q){try{var Z=i[U.id]&&s(U,q);return o(U),Z}catch(Ve){l(Ve.message,{element:U,error:Ve}),console.error(`failed to import ${ln(U)}`,Ve)}}function l(U,q){e.error(U,q)}var f=this.registerDi=function(q){var Z=q.bpmnElement;Z?i[Z.id]?l(`multiple DI elements defined for ${ln(Z)}`,{element:Z}):i[Z.id]=q:l(`no bpmnElement referenced in ${ln(q)}`,{element:q})};function p(U){d(U.plane)}function d(U){f(U),I(U.planeElement,g)}function g(U){f(U)}this.handleDefinitions=function(q,Z){var Ve=q.diagrams;if(Z&&Ve.indexOf(Z)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!Z&&Ve&&Ve.length&&(Z=Ve[0]),!Z)throw new Error("no diagram to display");i={},p(Z);var Zt=Z.plane;if(!Zt)throw new Error(`no plane for ${ln(Z)}`);var M=Zt.bpmnElement;if(!M)if(M=zS(q),M)l(`correcting missing bpmnElement on ${ln(Zt)} to ${ln(M)}`),Zt.bpmnElement=M,f(Zt);else throw new Error("no process or collaboration to display");var E=c(M,Zt);if(_n(M,"bpmn:Process")||_n(M,"bpmn:SubProcess"))m(M,E);else if(_n(M,"bpmn:Collaboration"))xe(M,E),_(q.rootElements,E);else throw new Error(`unsupported bpmnElement for ${ln(Zt)}: ${ln(M)}`);h(n)};var h=this.handleDeferred=function(){for(var q;n.length;)q=n.shift(),q()};function m(U,q){ue(U,q),j(U.ioSpecification,q),T(U.artifacts,q),o(U)}function _(U,q){var Z=Ue(U,function(Ve){return!a(Ve)&&_n(Ve,"bpmn:Process")&&Ve.laneSets});Z.forEach(r(m,q))}function y(U,q){u(U,q)}function x(U,q){I(U,r(y,q))}function S(U,q){u(U,q)}function P(U,q){u(U,q)}function C(U,q){u(U,q)}function L(U,q){u(U,q)}function T(U,q){I(U,function(Z){_n(Z,"bpmn:Association")?n.push(function(){L(Z,q)}):L(Z,q)})}function j(U,q){U&&(I(U.dataInputs,r(P,q)),I(U.dataOutputs,r(C,q)))}var k=this.handleSubProcess=function(q,Z){ue(q,Z),T(q.artifacts,Z)};function D(U,q){var Z=u(U,q);_n(U,"bpmn:SubProcess")&&k(U,Z||q),_n(U,"bpmn:Activity")&&j(U.ioSpecification,q),n.push(function(){I(U.dataInputAssociations,r(S,q)),I(U.dataOutputAssociations,r(S,q))})}function z(U,q){u(U,q)}function se(U,q){u(U,q)}function we(U,q){n.push(function(){var Z=u(U,q);U.childLaneSet&&Ke(U.childLaneSet,Z||q),ce(U)})}function Ke(U,q){I(U.lanes,r(we,q))}function Y(U,q){I(U,r(Ke,q))}function ue(U,q){_e(U.flowElements,q),U.laneSets&&Y(U.laneSets,q)}function _e(U,q){I(U,function(Z){_n(Z,"bpmn:SequenceFlow")?n.push(function(){z(Z,q)}):_n(Z,"bpmn:BoundaryEvent")?n.unshift(function(){D(Z,q)}):_n(Z,"bpmn:FlowNode")?D(Z,q):_n(Z,"bpmn:DataObject")||(_n(Z,"bpmn:DataStoreReference")||_n(Z,"bpmn:DataObjectReference")?se(Z,q):l(`unrecognized flowElement ${ln(Z)} in context ${ln(q&&q.businessObject)}`,{element:Z,context:q}))})}function pe(U,q){var Z=u(U,q),Ve=U.processRef;Ve&&m(Ve,Z||q)}function xe(U,q){I(U.participants,r(pe,q)),n.push(function(){x(U.messageFlows,q)}),T(U.artifacts,q)}function ce(U){I(U.flowNodeRef,function(q){var Z=q.get("lanes");Z&&Z.push(U)})}}function w(e,t){var n=ie(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function We(e,t){return Wi(t,function(n){return w(e,n)})}function ie(e){return e&&e.businessObject||e}function Ze(e){return e&&e.di}function VS(e,t,n){var i,r,o,a,s=[];function c(u,l){var f={root:function(h,m){return i.add(h,m)},element:function(h,m,_){return i.add(h,m,_)},error:function(h,m){s.push({message:h,context:m})}},p=new GS(f);l=l||u.diagrams&&u.diagrams[0];var d=WS(u,l);if(!d)throw new Error("no diagram to display");I(d,function(h){p.handleDefinitions(u,h)});var g=l.plane.bpmnElement.id;o.setRootElement(o.findRoot(g+"_plane")||o.findRoot(g))}return new Promise(function(u,l){try{return i=e.get("bpmnImporter"),r=e.get("eventBus"),o=e.get("canvas"),r.fire("import.render.start",{definitions:t}),c(t,n),r.fire("import.render.complete",{error:a,warnings:s}),u({warnings:s})}catch(f){return f.warnings=s,l(f)}})}function WS(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!w(n,"bpmn:Process")&&!w(n,"bpmn:Collaboration")&&(i=US(n));var r;w(i,"bpmn:Collaboration")?r=i:r=pt(e.rootElements,function(u){if(w(u,"bpmn:Collaboration"))return pt(u.participants,function(l){return l.processRef===i})});var o=[i];r&&(o=sn(r.participants,function(u){return u.processRef}),o.push(r));var a=Cm(o),s=[t],c=[n];return I(e.diagrams,function(u){if(u.plane){var l=u.plane.bpmnElement;a.indexOf(l)!==-1&&c.indexOf(l)===-1&&(s.push(u),c.push(l))}}),s}}function Cm(e){var t=[];return I(e,function(n){n&&(t.push(n),t=t.concat(Cm(n.flowElements)))}),t}function US(e){for(var t=e;t;){if(w(t,"bpmn:Process"))return t;t=t.$parent}}var qS='<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>',Pm=qS,Am={verticalAlign:"middle"},Tm={color:"#404040"},YS={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},KS={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},XS={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"},ZS='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+Pm+'</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>',gi;function QS(){gi=ht(ZS),mn(gi,YS),mn(ot("svg",gi),Am),mn(ot(".backdrop",gi),KS),mn(ot(".notice",gi),XS),mn(ot(".link",gi),Tm,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function JS(){gi||(QS(),Pn.bind(gi,".backdrop","click",function(e){document.body.removeChild(gi)})),document.body.appendChild(gi)}const Ls=5,Mm="djs-outline-hidden";function xt(e){e=V({},tR,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),iR(this._container)}ye(xt,nr),xt.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,u=a.warnings,l=a.elementsById;o=o.concat(u),s=this._emit("import.parse.complete",r({error:null,definitions:s,elementsById:l,references:c,warnings:o}))||s;const 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||[]),Is(s,o),s=eR(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},xt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},xt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw Is(o,[]),o}if(typeof t=="string"&&(i=nR(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw Is(o,[]),o}try{this.clear()}catch(o){throw Is(o,[]),o}const{warnings:r}=await VS(this,n,i);return{warnings:r}},xt.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},xt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=ot(":scope > defs",i._svg),a=Yh(r),s=o?"<defs>"+Yh(o)+"</defs>":"",c=i.getContainer();_t(c).add(Mm);let u;try{u=r.getBBox()}finally{_t(c).remove(Mm)}const l=u.x-Ls,f=u.y-Ls,p=u.width+Ls*2,d=u.height+Ls*2;t=`<?xml version="1.0" encoding="utf-8"?>
4
+ nested error: `+P.message;if(L)return a.addWarning({message:z,error:P}),!0;throw Xi(z)}function l(P,C){return u(P,C,!0)}function f(){var P=a.elementsById,C=a.references,L,T;for(L=0;T=C[L];L++){var j=T.element,k=P[T.id],D=Ai(j).propertiesByName[T.property];if(k||a.addWarning({message:"unresolved reference <"+T.id+">",element:T.element,property:T.property,value:T.id}),D.isMany){var z=j.get(D.name),se=z.indexOf(T);se===-1&&(se=z.length),k?z[se]=k:z.splice(se,1)}else j.set(D.name,k)}}function p(){c.pop().handleEnd()}var d=/^<\?xml /i,g=/ encoding="([^"]+)"/i,h=/^utf-8$/i;function m(P){if(d.test(P)){var C=g.exec(P),L=C&&C[1];!L||h.test(L)||a.addWarning({message:"unsupported document encoding <"+L+">, falling back to UTF-8"})}}function _(P,C){var L=c.peek();try{c.push(L.handleNode(P))}catch(T){u(T,C,o)&&c.push(new zu)}}function y(P,C){try{c.peek().handleText(P)}catch(L){l(L,C)}}function x(P,C){P.trim()&&y(P,C)}var S=r.getPackages().reduce(function(P,C){return P[C.uri]=C.prefix,P},Object.entries(Hu).reduce(function(P,[C,L]){return P[L]=C,P},r.config&&r.config.nsMap||{}));return s.ns(S).on("openTag",function(P,C,L,T){var j=P.attrs||{},k=Object.keys(j).reduce(function(z,se){var Se=C(j[se]);return z[se]=Se,z},{}),D={name:P.name,originalName:P.originalName,attributes:k,ns:P.ns};_(D,T)}).on("question",m).on("closeTag",p).on("cdata",y).on("text",function(P,C,L){x(C(P),L)}).on("error",u).on("warn",l),new Promise(function(P,C){var L;try{s.parse(e),f()}catch(z){L=z}var T=i.element;!L&&!T&&(L=Xi("failed to parse document as <"+i.type.$descriptor.name+">"));var j=a.warnings,k=a.references,D=a.elementsById;return L?(L.warnings=j,C(L)):P({rootElement:T,elementsById:D,references:k,warnings:j})})},Wu.prototype.handler=function(e){return new Vu(this.model,e)};function fw(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var dw=`<?xml version="1.0" encoding="UTF-8"?>
5
+ `,hw=/<|>|'|"|&|\n\r|\n/g,Pd=/<|>|&/g;function pi(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}pi.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},pi.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},pi.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},pi.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)},pi.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},pi.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},pi.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},pi.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},pi.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 mw(e){return e.charAt(0).toLowerCase()+e.slice(1)}function gw(e,t){return Ed(t)?mw(e):e}function Ad(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function Td(e){return xn(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function yw(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 vw(e,t){return t.isGeneric?V({localName:t.ns.localName},e):V({localName:gw(t.ns.localName,t.$pkg)},e)}function bw(e,t){return V({localName:t.ns.localName},e)}function _w(e){var t=e.$descriptor;return Ge(t.properties,function(n){var i=n.name;if(n.isVirtual||!wn(e,i))return!1;var r=e[i];return r===n.default||r===null?!1:n.isMany?r.length:!0})}var xw={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},ww={"<":"lt",">":"gt","&":"amp"};function Md(e,t,n){return e=xn(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function Ew(e){return Md(e,hw,xw)}function Sw(e){return Md(e,Pd,ww)}function Rw(e){return Ge(e,function(t){return t.isAttr})}function Cw(e){return Ge(e,function(t){return!t.isAttr})}function Uu(e){this.tagName=e}Uu.prototype.build=function(e){return this.element=e,this},Uu.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function Mr(){}Mr.prototype.serializeValue=Mr.prototype.serializeTo=function(e){e.append(this.escape?Sw(this.value):this.value)},Mr.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(Pd)!==-1&&(this.escape=!0),this};function qu(e){this.tagName=e}Ad(qu,Mr),qu.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function yt(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}yt.prototype.build=function(e){this.element=e;var t=e.$descriptor,n=this.propertyDescriptor,i,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=_w(e),this.parseAttributes(Rw(r)),this.parseContainments(Cw(r))),this.parseGenericAttributes(e,i),this},yt.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return vw(t,e)},yt.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return bw(t,e)},yt.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},yt.prototype.nsAttributeName=function(e){var t;if(xn(e)?t=an(e):t=e.ns,e.inherited)return{localName:t.localName};var n=this.logNamespaceUsed(t);return this.getNamespaces().logUsed(n),this.isLocalNs(n)?{localName:t.localName}:V({localName:t.localName},n)},yt.prototype.parseGenericNsAttributes=function(e){return Object.entries(e).filter(([t,n])=>!t.startsWith("$")&&this.parseNsAttribute(e,t,n)).map(([t,n])=>({name:t,value:n}))},yt.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new Mr().build({type:"String"},t));var n=e.$children;n&&I(n,i=>{this.body.push(new yt(this).build(i))})},yt.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,r=an(t),o;if(r.prefix==="xmlns"&&(o={prefix:r.localName,uri:n}),!r.prefix&&r.localName==="xmlns"&&(o={uri:n}),!o)return{name:t,value:n};if(i&&i.getPackage(n))this.logNamespace(o,!0,!0);else{var a=this.logNamespaceUsed(o,!0);this.getNamespaces().logUsed(a)}},yt.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return I(n,function(r,o){var a=t.parseNsAttribute(e,o,r);a&&i.push(a)}),i},yt.prototype.parseGenericAttributes=function(e,t){var n=this;I(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)}})},yt.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;I(e,function(r){var o=i.get(r.name),a=r.isReference,s=r.isMany;if(s||(o=[o]),r.isBody)n.push(new Mr().build(r,o[0]));else if(gd(r.type))I(o,function(u){n.push(new qu(t.addTagName(t.nsPropertyTagName(r))).build(r,u))});else if(a)I(o,function(u){n.push(new Uu(t.addTagName(t.nsPropertyTagName(r))).build(u))});else{var c=Rd(r);I(o,function(u){var l;c?c===Sd?l=new yt(t,r):l=new ss(t,r,c):l=new yt(t),n.push(l.build(u))})}})},yt.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new pi(i):t=i),t},yt.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},yt.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},yt.prototype.parseAttributes=function(e){var t=this,n=this.element;I(e,function(i){var r=n.get(i.name);if(i.isReference)if(!i.isMany)r=r.id;else{var o=[];I(r,function(a){o.push(a.id)}),r=o.join(" ")}t.addAttribute(t.nsAttributeName(i),r)})},yt.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),Td(e)},yt.prototype.addAttribute=function(e,t){var n=this.attrs;xn(t)&&(t=Ew(t));var i=fd(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)},yt.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=yw(n).concat(t)),I(t,function(i){e.append(" ").append(Td(i.name)).append('="').append(i.value).append('"')})},yt.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==Mr;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),I(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function ss(e,t,n){yt.call(this,e,t),this.serialization=n}Ad(ss,yt),ss.prototype.parseNsAttributes=function(e){var t=yt.prototype.parseNsAttributes.call(this,e).filter(a=>a.name!==this.serialization),n=e.$descriptor;if(n.name===this.propertyDescriptor.type)return t;var i=this.typeNs=this.nsTagName(n);this.getNamespaces().logUsed(this.typeNs);var 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},ss.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function Pw(){this.value="",this.write=function(e){this.value+=e}}function Aw(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 Tw(e){e=V({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new Pw,o=new Aw(r,e.format);e.preamble&&o.append(dw);var a=new yt,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(Mw(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function Mw(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in Hu)n[i]=Hu[i];for(const i in t){const r=t[i];n[r]=i}for(const i of e.getPackages())n[i.prefix]=i.uri;return n}function cs(e,t){zn.call(this,e,t)}cs.prototype=Object.create(zn.prototype),cs.prototype.fromXML=function(e,t,n){xn(t)||(n=t,t="bpmn:Definitions");var i=new Wu(V({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},cs.prototype.toXML=function(e,t){var n=new Tw(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var kw="BPMN20",Ow="http://www.omg.org/spec/BPMN/20100524/MODEL",Dw="bpmn",Lw=[],Iw=[{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"}]}],Bw=[{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"}]}],Nw={tagAlias:"lowerCase",typePrefix:"t"},$w={name:kw,uri:Ow,prefix:Dw,associations:Lw,types:Iw,enumerations:Bw,xml:Nw},Fw="BPMNDI",jw="http://www.omg.org/spec/BPMN/20100524/DI",Hw="bpmndi",zw=[{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"]}],Gw=[{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"}]}],Vw=[],Ww={name:Fw,uri:jw,prefix:Hw,types:zw,enumerations:Gw,associations:Vw},Uw="DC",qw="http://www.omg.org/spec/DD/20100524/DC",Yw="dc",Kw=[{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}]}],Xw=[],Zw={name:Uw,uri:qw,prefix:Yw,types:Kw,associations:Xw},Qw="DI",Jw="http://www.omg.org/spec/DD/20100524/DI",eE="di",tE=[{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"}]}],nE=[],iE={tagAlias:"lowerCase"},rE={name:Qw,uri:Jw,prefix:eE,types:tE,associations:nE,xml:iE},oE="bpmn.io colors for BPMN",aE="http://bpmn.io/schema/bpmn/biocolor/1.0",sE="bioc",cE=[{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"}]}],uE=[],lE=[],pE={name:oE,uri:aE,prefix:sE,types:cE,enumerations:uE,associations:lE},fE="BPMN in Color",dE="http://www.omg.org/spec/BPMN/non-normative/color/1.0",hE="color",mE=[{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"}]}],gE=[],yE=[],vE={name:fE,uri:dE,prefix:hE,types:mE,enumerations:gE,associations:yE};const bE={bpmn:$w,bpmndi:Ww,dc:Zw,di:rE,bioc:pE,color:vE};function kd(e,t){const n=V({},bE,e);return new cs(n,t)}const _E={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"}},xE="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",Od="i18n",us={[Od]:_E,[Mu]:sd};function Dd(){return kd(us)}const Ld=Dd();async function Yu(e){const{rootElement:t,warnings:n}=await Ld.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function wE(e){const{xml:t}=await Ld.toXML(e,{format:!0});return t}function Ku(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const oo={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},EE=/[ᄀ-ᇿ -〿぀-ヿ㐀-鿿가-힯＀-⦆]/;function SE(e){const t=oo;return EE.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 ao(e,t){let n=0;for(const i of e)n+=t*SE(i);return n}function Id(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&RE(e),CE(e),PE(e),AE(e)}function RE(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:ao(r,o),fontBoundingBoxAscent:o*oo.ascentEm,fontBoundingBoxDescent:o*oo.descentEm,actualBoundingBoxAscent:o*oo.ascentEm,actualBoundingBoxDescent:o*oo.descentEm}}};t.getContext=()=>n}function CE(e){if(e.SVGMatrix)return;class t{constructor(){Qr(this,"a",1);Qr(this,"b",0);Qr(this,"c",0);Qr(this,"d",1);Qr(this,"e",0);Qr(this,"f",0)}static of(i,r,o,a,s,c){return Object.assign(new t,{a:i,b:r,c:o,d:a,e:s,f:c})}multiply(i){return t.of(this.a*i.a+this.c*i.b,this.b*i.a+this.d*i.b,this.a*i.c+this.c*i.d,this.b*i.c+this.d*i.d,this.a*i.e+this.c*i.f+this.e,this.b*i.e+this.d*i.f+this.f)}translate(i,r){return this.multiply(t.of(1,0,0,1,i,r))}scale(i,r=i){return this.multiply(t.of(i,0,0,r,0,0))}inverse(){const i=this.a*this.d-this.b*this.c;return t.of(this.d/i,-this.b/i,-this.c/i,this.a/i,(this.c*this.f-this.d*this.e)/i,(this.b*this.e-this.a*this.f)/i)}}e.SVGMatrix=t}function PE(e){var o;const t=()=>{const a=new e.SVGMatrix;return{type:0,matrix:a,setTranslate(s,c){a.e=s,a.f=c},setScale(s,c){a.a=s,a.d=c},setRotate(s,c=0,u=0){const l=s*Math.PI/180,f=Math.cos(l),p=Math.sin(l);a.a=f,a.b=p,a.c=-p,a.d=f,a.e=c-f*c+p*u,a.f=u-p*c-f*u},setMatrix(s){Object.assign(a,s)}}},n=a=>{const s=t();return Object.assign(s.matrix,a),s},i=(o=e.SVGSVGElement)==null?void 0:o.prototype;i&&!i.createSVGTransform&&(i.createSVGTransform=t,i.createSVGTransformFromMatrix=n,i.createSVGMatrix=()=>new e.SVGMatrix,i.createSVGPoint=()=>({x:0,y:0,matrixTransform:()=>({x:0,y:0})}));const r=e.SVGElement.prototype;Object.getOwnPropertyDescriptor(r,"transform")||Object.defineProperty(r,"transform",{configurable:!0,get(){if(!this.__headlessTransformList){const a=[];this.__headlessTransformList={baseVal:{get numberOfItems(){return a.length},clear:()=>{a.length=0},appendItem:s=>(a.push(s),s),getItem:s=>a[s],createSVGTransformFromMatrix:n,consolidate:()=>a[a.length-1]??null}}}return this.__headlessTransformList}})}function AE(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:ao(n,12),height:14}})}const ls=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),TE=1,Xu=new Set(["bpmn:TextAnnotation","bpmn:DataStoreReference","bpmn:DataObjectReference","bpmn:DataInput","bpmn:DataOutput"]),ME=2;function oi(e){switch(e.kind){case"label-over-line":return`L|${e.edge}|${e.line}`;case"edge-crosses-shape":return`x|${e.edge}|${e.shape}`;case"shape-overlap":return`o|${e.shapes[0]}|${e.shapes[1]}`;case"shape-outside-container":return`c|${e.shape}|${e.container}`;case"edge-overlap-opposite":return`p|${e.edges[0]}|${e.edges[1]}`;case"edge-overlap-mixed":return`m|${e.edges[0]}|${e.edges[1]}`;case"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"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 Bd=20,ps=5,Nd=3,kE=8,$d=12,OE=$d*1.2;function Zu(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(o=>ao(o,$d))),r=n.length*OE;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-r/2,width:i,height:r}}const Fd=1;function fn(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 so(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 fn(e))for(const s of fn(t)){if(a.axis!==s.axis||Math.abs(a.at-s.at)>Fd)continue;const c=a.dir!==s.dir?"opposite":i?"mixed":o?"unrelated":null;if(!c)continue;const u=Math.min(a.hi,s.hi)-Math.max(a.lo,s.lo);u>=Bd&&(!n||u>n.length)&&(n={axis:a.axis,length:u,kind:c})}return n}function Qu(e){return e.kind==="edge-overlap-opposite"||e.kind==="edge-overlap-mixed"||e.kind==="edge-overlap-unrelated"}function jd(e,t){const n=so(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function DE(e,t){let n=0;for(const i of t)i.id!==e.id&&jd(e,i)&&n++;return n}function Ln(e,t){let n=0;for(const i of t)i.id!==e.id&&so(e,i)&&n++;return n}const Hd=15,zd=20;function LE(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-zd||t.at>n[1]+zd)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 Ju=20;function fs(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>Fd)continue;const r=Math.max(e.lo,i.lo),o=Math.min(e.hi,i.hi);o-r<Bd||n.push([r-Ju,o+Ju])}return n}function ds(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of fn(e)){const o=LE(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of fs(r,fn(a)))if(Math.min(c,o[1])>Math.max(s,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const IE=1,BE=(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 NE(e,t,n,i){const r=n.x+i,o=n.y+i,a=n.x+n.width-i,s=n.y+n.height-i;if(a<=r||s<=o)return!1;const c=t.x-e.x,u=t.y-e.y;let l=0,f=1;const p=(d,g)=>{if(g===0)return d<=0;const h=d/g;if(g>0){if(h>f)return!1;h>l&&(l=h)}else{if(h<l)return!1;h<f&&(f=h)}return!0};return p(r-e.x,c)&&p(e.x-a,-c)&&p(o-e.y,u)&&p(e.y-s,-u)&&f>l}function el(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 $E=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,co=1;function Ti(e,t){const n=e.x+co,i=e.x+e.width-co,r=e.y+co,o=e.y+e.height-co;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 Zo(e){return[{axis:"h",at:e.y,lo:e.x,hi:e.x+e.width,dir:1},{axis:"h",at:e.y+e.height,lo:e.x,hi:e.x+e.width,dir:1},{axis:"v",at:e.x,lo:e.y,hi:e.y+e.height,dir:1},{axis:"v",at:e.x+e.width,lo:e.y,hi:e.y+e.height,dir:1}]}function Gd(e,t){const n=e.label;if(!n)return null;if(fn(e).some(i=>Ti(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(fn(i).some(r=>Ti(n,r)))return i.id;for(const i of t.shapes.filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(Zo(i).some(r=>Ti(n,r)))return i.id;return null}function dn(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(NE(e.waypoints[o],e.waypoints[o+1],r,ME)){i.push(r);break}}return i}function FE(e,t,n,i){const r=(u,l,f)=>(l.x-u.x)*(f.y-u.y)-(l.y-u.y)*(f.x-u.x),o=r(n,i,e),a=r(n,i,t),s=r(e,t,n),c=r(e,t,i);return o*a<0&&s*c<0}const Vd=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function hs(e,t){let n=0;for(const i of t){if(i.id===e.id||Vd(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++)FE(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function In(e,t){let n=0;for(const i of t)i.id===e.id||Vd(e,i)||hs(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function Wd(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++)hs(n[i],[n[r]])>0&&(t+=n[i].type===n[r].type?2:1);return t}function tl(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(hs(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 Ud(e){const t=tl(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),u=i.get(s);if(!c||!u)continue;const l=n(c.type),f=n(u.type);l==="solid"&&f==="solid"?r++:l==="dashed"&&f==="dashed"&&o++}return{pairs:t,solidPairs:r,dashedPairs:o,mixedPairs:t.length-r-o,crossPoolMessages:jE(e)}}function jE(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(u=>u.id!==o.id&&u.id!==a.id&&u.y>s&&u.y+u.height<c)&&i++}return i}function qd(e,t,n){const i=new Set(t.flatMap(r=>[...r.members]));return e.shapes.filter(r=>!r.container&&!Xu.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 Yd(e){var n;const t=(n=gt(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const r=gt(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 Kd=e=>e?{members:e}:{},Gn=e=>e.shapes.filter(t=>!t.container);function HE(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 Xd(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(fn(i).some(r=>Ti(n,r)))return i.id;for(const i of[...t.shapes].filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(Zo(i).some(r=>Ti(n,r)))return i.id;return null}function uo(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 Vn(e){const t=[],n=e.shapes.filter(h=>!h.container);for(const h of e.edges)for(const m of dn(h,n))t.push({kind:"edge-crosses-shape",edge:h.id,shape:m.id});const i=n.filter(h=>!h.attached);for(let h=0;h<i.length;h++)for(let m=h+1;m<i.length;m++){const _=i[h],y=i[m];if(!el(_,y,TE))continue;const x=_.id<y.id?[_.id,y.id]:[y.id,_.id];t.push({kind:"shape-overlap",shapes:x,identical:$E(_,y)})}const r=e.shapes.filter(h=>h.type==="bpmn:Group"&&Array.isArray(h.members)&&h.members.length>0);for(let h=0;h<r.length;h++)for(let m=h+1;m<r.length;m++){const _=r[h],y=r[m],x=Math.min(_.x+_.width,y.x+y.width)-Math.max(_.x,y.x),S=Math.min(_.y+_.height,y.y+y.height)-Math.max(_.y,y.y);if(x<=ps||S<=ps)continue;const P=_.id<y.id?[_.id,y.id]:[y.id,_.id],C=new Set(y.members);if(_.members.some(T=>C.has(T))){const T=qd(e,r,{x:Math.max(_.x,y.x),y:Math.max(_.y,y.y),right:Math.min(_.x+_.width,y.x+y.width),bottom:Math.min(_.y+_.height,y.y+y.height)});T.length&&t.push({kind:"group-overlap-unreadable",reason:"orphan",groups:P,shapes:T});continue}const L=_.x<=y.x&&_.y<=y.y&&_.x+_.width>=y.x+y.width&&_.y+_.height>=y.y+y.height?_.id:y.x<=_.x&&y.y<=_.y&&y.x+y.width>=_.x+_.width&&y.y+y.height>=_.y+_.height?y.id:void 0;t.push({kind:"group-overlap-unintended",groups:P,...L?{container:L}:{}})}const o=new Set(r.flatMap(h=>[...h.members])),a=h=>e.shapes.filter(m=>!m.container&&!Xu.has(m.type)&&m.x>=h.x&&m.y>=h.y&&m.x+m.width<=h.x+h.width&&m.y+m.height<=h.y+h.height);for(const h of r){const m=a(h);if(!m.length)continue;const _=new Set(h.members),y=m.filter(x=>!_.has(x.id));y.some(x=>o.has(x.id))&&(y.length*2<m.length||t.push({kind:"group-overlap-unreadable",reason:"minority",group:h.id,shapes:y.map(x=>x.id).sort()}))}for(const h of r){const m=new Set(a(h).map(C=>C.id)),_=new Set(h.members),y=new Set([...m].filter(C=>!_.has(C)&&o.has(C)));if(!y.size)continue;let x=!1,S=!1,P=!1;for(const C of e.edges){if(C.type!=="bpmn:SequenceFlow"||!C.source||!C.target)continue;const L=y.has(C.source),T=y.has(C.target);!L&&T&&!m.has(C.source)?x=!0:L&&!T&&!m.has(C.target)?S=!0:L&&T&&(P=!0)}x&&S&&P&&t.push({kind:"group-overlap-unreadable",reason:"throughpass",group:h.id,shapes:[...y].sort()})}const s=e.shapes.filter(h=>h.type==="bpmn:Group");for(let h=0;h<s.length;h++)for(let m=h+1;m<s.length;m++)for(let _=m+1;_<s.length;_++){const y=[s[h],s[m],s[_]],x={x:Math.max(...y.map(C=>C.x)),y:Math.max(...y.map(C=>C.y)),right:Math.min(...y.map(C=>C.x+C.width)),bottom:Math.min(...y.map(C=>C.y+C.height))};if(x.right-x.x<=ps||x.bottom-x.y<=ps)continue;const S=qd(e,[],x);if(!S.length)continue;const P=y.map(C=>C.id).sort();t.push({kind:"group-stack-unreadable",groups:P,shapes:S})}for(const h of e.shapes.filter(m=>m.type==="bpmn:Group"))for(const m of e.shapes){if(m.container||m.attached||Xu.has(m.type)||m.width<=0||m.height<=0)continue;const _=[["top",h.y,"h",h.x,h.x+h.width],["bottom",h.y+h.height,"h",h.x,h.x+h.width],["left",h.x,"v",h.y,h.y+h.height],["right",h.x+h.width,"v",h.y,h.y+h.height]];for(const[y,x,S,P,C]of _){const L=S==="h"?m.x:m.y,T=S==="h"?m.x+m.width:m.y+m.height;if(!(L<C&&P<T))continue;const j=S==="h"?m.y:m.x,k=S==="h"?m.y+m.height:m.x+m.width;if(!(j<x&&x<k))continue;const D=Math.min(x-j,k-x);D<kE||t.push({kind:"group-cuts-shape",group:h.id,shape:m.id,side:y,depth:D})}}const c=e.shapes.filter(h=>h.container&&h.type!=="bpmn:Group"&&h.type!=="bpmn:Lane");for(const h of e.shapes.filter(m=>m.type==="bpmn:Group"))for(const m of c){const _=h.x<m.x+m.width&&m.x<h.x+h.width,y=h.y<m.y+m.height&&m.y<h.y+h.height,x=[["top",h.y,m.y,_],["bottom",h.y+h.height,m.y+m.height,_],["left",h.x,m.x,y],["right",h.x+h.width,m.x+m.width,y]];for(const[S,P,C,L]of x)L&&Math.abs(P-C)<=Nd&&t.push({kind:"group-on-container-boundary",group:h.id,container:m.id,side:S})}const u=e.shapes.filter(h=>h.type==="bpmn:Group");for(let h=0;h<u.length;h++)for(let m=h+1;m<u.length;m++){const _=u[h],y=u[m],x=_.x<y.x+y.width&&y.x<_.x+_.width,S=_.y<y.y+y.height&&y.y<_.y+_.height,P=[["x",_.x+_.width,y.x,S],["x",y.x+y.width,_.x,S],["y",_.y+_.height,y.y,x],["y",y.y+y.height,_.y,x]];for(const[C,L,T,j]of P)if(j&&Math.abs(L-T)<=Nd){t.push({kind:"group-on-group-boundary",groups:_.id<y.id?[_.id,y.id]:[y.id,_.id],axis:C});break}}for(let h=0;h<e.edges.length;h++)for(let m=h+1;m<e.edges.length;m++){const _=e.edges[h],y=e.edges[m],x=so(_,y);if(!x)continue;const S=_.id<y.id?[_.id,y.id]:[y.id,_.id];t.push({kind:x.kind==="opposite"?"edge-overlap-opposite":x.kind==="mixed"?"edge-overlap-mixed":"edge-overlap-unrelated",edges:S,axis:x.axis,length:Math.round(x.length)})}for(const h of e.edges){if(!h.label)continue;const m=ds(h,e.edges);m&&t.push({kind:"label-on-shared-segment",edge:h.id,other:m.other,axis:m.axis})}for(const h of e.edges){if(!h.label)continue;const m=Gd(h,e);m&&t.push({kind:"label-over-line",edge:h.id,line:m})}const l=new Set(n.map(h=>h.id)),f=e.shapes.filter(h=>h.type==="bpmn:Participant"&&h.label);for(const h of[...n,...f.filter(m=>!l.has(m.id))]){if(!h.label)continue;const m=Xd(h,e);m&&t.push({kind:"label-over-line",edge:h.id,line:m})}const p=new Set(e.shapes.filter(h=>h.type==="bpmn:TextAnnotation").map(h=>h.id));for(const h of f)for(const{owner:m,rect:_}of uo(e))m===h.id||p.has(m)||el(h.label,_,co)&&t.push({kind:"pool-name-over-label",pool:h.id,label:m});const d=uo(e);for(const h of n)if(h.type==="bpmn:TextAnnotation")for(const{owner:m,rect:_}of d)m!==h.id&&el(h,_,co)&&t.push({kind:"annotation-over-label",annotation:h.id,label:m});const g=new Map(e.shapes.map(h=>[h.id,h]));for(const h of n){const m=h.parent??HE(h,e,g);if(!m)continue;const _=g.get(m);!_||!_.container||BE(_,h,IE)||t.push({kind:"shape-outside-container",shape:h.id,container:_.id})}return t.sort((h,m)=>oi(h).localeCompare(oi(m)))}const gt=e=>typeof e=="object"&&e!==null?e:void 0,Rt=e=>typeof e=="number"?e:0,Mi=e=>{const t=gt(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function zE(e){const t=gt(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=Mi(o);a&&n.push(a)}}return n}function GE(e){const t=gt(e);if(!t)return{};const n=Array.isArray(t.sourceRef)?void 0:Mi(t.sourceRef),i=Array.isArray(t.targetRef)?void 0:Mi(t.targetRef);return n&&i?{source:n,target:i}:{}}function VE(e,t){const n=gt(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const r=Mi(n);return r?t.get(r):void 0}if(ls.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return Mi(n)}function Zd(e){var a,s,c,u,l;const t=[],n=[],i=((a=gt(e))==null?void 0:a.diagrams)??[],r=new Map,o=new Set;for(const f of((s=gt(e))==null?void 0:s.rootElements)??[]){const p=gt(f);if((p==null?void 0:p.$type)==="bpmn:Collaboration")for(const d of p.participants??[]){const g=gt(d),h=Mi(g),m=Mi(g==null?void 0:g.processRef);h&&m?r.set(m,h):h&&o.add(h)}}for(const f of i){const p=gt((c=gt(f))==null?void 0:c.plane),d=(p==null?void 0:p.planeElement)??[];for(const g of d){const h=gt(g);if(!h)continue;const m=gt(h.bpmnElement),_=typeof(m==null?void 0:m.id)=="string"?m.id:void 0;if(!_)continue;const y=typeof(m==null?void 0:m.$type)=="string"?m.$type:"",x=gt(h.bounds);if(x){const P=h.isExpanded===!1&&y!=="bpmn:Participant",C=gt((u=gt(h.label))==null?void 0:u.bounds),L={id:_,type:y,x:Rt(x.x),y:Rt(x.y),width:Rt(x.width),height:Rt(x.height),container:ls.has(y)&&!P,attached:(m==null?void 0:m.attachedToRef)!==void 0,...m?{parent:VE(m,r)}:{},...C?{label:{x:Rt(C.x),y:Rt(C.y),width:Rt(C.width),height:Rt(C.height)}}:{},...y==="bpmn:Group"?Kd(Yd(m)):{}},T=h.isHorizontal!==!1,j=typeof(m==null?void 0:m.name)=="string"?m.name:"";o.has(_)&&T&&j&&(L.label=Zu(L,j)),t.push(L);continue}const S=h.waypoint;if(Array.isArray(S)){const P=gt((l=gt(h.label))==null?void 0:l.bounds);n.push({id:_,type:y,waypoints:S.map(C=>{var L,T;return{x:Rt((L=gt(C))==null?void 0:L.x),y:Rt((T=gt(C))==null?void 0:T.y)}}),endpoints:zE(m),...GE(m),...P?{label:{x:Rt(P.x),y:Rt(P.y),width:Rt(P.width),height:Rt(P.height)}}:{}})}}}return{shapes:t,edges:n}}function Qd(e){return Vn(Zd(e))}async function WE(e){const{definitions:t,warnings:n}=await Yu(e);return{findings:Qd(t),warnings:n}}function pt(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=gt(o.label),m=Mi(o.source),_=Mi(o.target);n.push({id:o.id,type:a,waypoints:s.map(y=>({x:Rt(y.x),y:Rt(y.y)})),endpoints:[m,_].filter(y=>!!y),...m&&_?{source:m,target:_}:{},...h&&typeof h.x=="number"?{label:{x:h.x,y:Rt(h.y),width:Rt(h.width),height:Rt(h.height)}}:{}});continue}if(typeof o.x!="number"||typeof o.y!="number")continue;const c=gt(o.businessObject),u=gt(o.label);let l=gt(o.parent);for(;l&&l.type==="bpmn:Lane";)l=gt(l.parent);const f=typeof(l==null?void 0:l.type)=="string"?l.type:"",p=l&&ls.has(f)&&f!=="bpmn:Group"&&typeof l.id=="string"?l.id:void 0,d={id:o.id,type:a,x:o.x,y:o.y,width:Rt(o.width),height:Rt(o.height),container:ls.has(a)&&(a==="bpmn:Participant"||o.collapsed!==!0),attached:(c==null?void 0:c.attachedToRef)!==void 0,...p!==void 0?{parent:p}:{},...u&&typeof u.x=="number"?{label:{x:u.x,y:Rt(u.y),width:Rt(u.width),height:Rt(u.height)}}:{},...a==="bpmn:Group"?Kd(Yd(c)):{}},g=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&g&&((i=gt(o.di))==null?void 0:i.isHorizontal)!==!1&&(d.label=Zu(d,g)),t.push(d)}return{shapes:t,edges:n}}const UE={"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 qE(e,t){const n=UE[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function Jd(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 qE(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&Jd(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?Jd(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 nl=20,YE=4,dt=(e,t)=>Math.abs(e-t)<.5;function il(e,t,n,i=nl){if(dt(e.y,t.y)&&!dt(e.x,t.x)){const r=Math.min(e.x,t.x),o=Math.max(e.x,t.x);if(!(r<n.x-i&&n.x+n.width+i<o))return null;const a=e.x<t.x?n.x-i:n.x+n.width+i,s=e.x<t.x?n.x+n.width+i:n.x-i,c=u=>[{x:a,y:e.y},{x:a,y:u},{x:s,y:u},{x:s,y:e.y}];return[c(n.y-i),c(n.y+n.height+i)]}if(dt(e.x,t.x)&&!dt(e.y,t.y)){const r=Math.min(e.y,t.y),o=Math.max(e.y,t.y);if(!(r<n.y-i&&n.y+n.height+i<o))return null;const a=e.y<t.y?n.y-i:n.y+n.height+i,s=e.y<t.y?n.y+n.height+i:n.y-i,c=u=>[{x:e.x,y:a},{x:u,y:a},{x:u,y:s},{x:e.x,y:s}];return[c(n.x-i),c(n.x+n.width+i)]}return null}function th(e,t,n,i=nl){if(n.length<2)return null;if(dt(e.y,t.y)&&!dt(e.x,t.x)){const r=Math.min(e.x,t.x),o=Math.max(e.x,t.x),a=Math.min(...n.map(d=>d.x))-i,s=Math.max(...n.map(d=>d.x+d.width))+i;if(!(r<a&&s<o))return null;const c=e.x<t.x?a:s,u=e.x<t.x?s:a,l=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:u,y:d},{x:u,y:e.y}];return[p(l),p(f)]}if(dt(e.x,t.x)&&!dt(e.y,t.y)){const r=Math.min(e.y,t.y),o=Math.max(e.y,t.y),a=Math.min(...n.map(d=>d.y))-i,s=Math.max(...n.map(d=>d.y+d.height))+i;if(!(r<a&&s<o))return null;const c=e.y<t.y?a:s,u=e.y<t.y?s:a,l=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:u},{x:e.x,y:u}];return[p(l),p(f)]}return null}function nh(e,t,n=nl){if(e.length!==4)return null;const[i,r,o,a]=e;if(dt(i.y,r.y)&&dt(r.x,o.x)&&dt(o.y,a.y)){const s=c=>[i,{x:c,y:i.y},{x:c,y:a.y},a];return[s(t.x-n),s(t.x+t.width+n)]}if(dt(i.x,r.x)&&dt(r.y,o.y)&&dt(o.x,a.x)){const s=c=>[i,{x:i.x,y:c},{x:a.x,y:c},a];return[s(t.y-n),s(t.y+t.height+n)]}return null}function rl(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,u=[{x:n.x+n.width,y:r},{x:a,y:r},{x:a,y:c?i.y+i.height:i.y}],l=[{x:s,y:c?n.y:n.y+n.height},{x:s,y:o},{x:i.x,y:o}];return[u,l]}const ih=30,KE=[0,-25,25,-40,40];function XE(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+ih:s-ih,u=a?i.y+i.height:i.y,l=n.x+n.width/2,f=i.x+i.width/2;return KE.map(p=>[{x:l,y:s},{x:l,y:c},{x:f+p,y:c},{x:f+p,y:u}])}const rh=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],lo=(e,t,n)=>dn({...e,waypoints:t},n).length;function oh(e,t,n,i){let r=[...e.waypoints],o=lo(e,r,t);if(o===0)return null;let a=!1;for(const f of rl(e,t))if(lo(e,f,t)===0)return f;const s=(i??[]).filter(f=>f.id!==e.id).flatMap(fn),c=f=>fn({...e,waypoints:f}).some(p=>fs(p,s).length>0),u=XE(e,t).filter(f=>lo(e,f,t)===0);if(u.length)return u.find(f=>!c(f))??u[0];const l=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&&dt(f.y+f.height/2,p.y+p.height/2)){const d=[r[0],r[r.length-1]];if(dt(d[0].y,d[1].y)&&!dt(d[0].x,d[1].x)){const g=t.filter(y=>!e.endpoints.includes(y.id)&&dn({...e,waypoints:d},[y]).length>0),h=g.length>=2?th(d[0],d[1],g):null,_=(h?h.map(y=>[d[0],...y,d[1]]):g.length===1?(il(d[0],d[1],g[0])??[]).map(y=>[d[0],...y,d[1]]):g.length===0?[d]:[]).filter(y=>lo(e,y,t)===0&&y.length<=r.length).sort((y,x)=>Number(l(x))-Number(l(y)));if(_.length)return _.find(y=>!c(y))??_[0]}}}for(let f=0;f+1<r.length;f++){const p=r[f],d=r[f+1],g=t.filter(_=>!e.endpoints.includes(_.id)&&dn({...e,waypoints:[p,d]},[_]).length>0);if(g.length<2)continue;const h=th(p,d,g);if(!h)continue;const m=h.map(_=>rh(r,f,_)).filter(_=>lo(e,_,t)===0).sort((_,y)=>Number(l(y))-Number(l(_)));if(m.length)return m.find(_=>!c(_))??m[0]}for(let f=0;f<YE&&o>0;f++){let p=!1;for(let d=0;d+1<r.length&&!p;d++){const g=r[d],h=r[d+1];for(const m of t){if(e.endpoints.includes(m.id)||dn({...e,waypoints:[g,h]},[m]).length===0)continue;const _=il(g,h,m),y=_?_.map(S=>rh(r,d,S)):nh(r,m)??[];if(!y.length)continue;const x=[...y].sort((S,P)=>Number(l(P))-Number(l(S)));for(const S of x){const P=lo(e,S,t);if(P<o){r=S,o=P,p=!0,a=!0;break}}if(p)break}}if(!p)break}return a&&o===0?r:null}function ah(e,t){const{elementRegistry:n}=e,i=e.modeling,r=pt(n),o=Gn(r),a=Vn(r).filter(c=>c.kind==="edge-crosses-shape"&&!t.has(oi(c)));if(!a.length)return;const s=new Map;for(const c of a){if(c.kind!=="edge-crosses-shape"||s.has(c.edge))continue;const u=r.edges.find(l=>l.id===c.edge);u&&s.set(c.edge,u)}for(const[c,u]of s){const l=n.get(c);if(!l)continue;const f=l.parent,p=f&&typeof f.x=="number"&&typeof f.width=="number"?{x:f.x,y:f.y,width:f.width,height:f.height}:void 0,d=oh(u,o,p,r.edges);if(!d)continue;const g=r.edges.filter(_=>_.id!==c),h=Ln(u,g);Ln({...u,waypoints:d},g)>h||i.updateWaypoints(l,d)}}const ZE=10;function sh(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 ch(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=sh(i,n),a=sh(r,n);if(!o||!a||o.id===a.id)return null;const s=a.y>o.y,c=s?o:a,u=s?a:o,l=n.filter(z=>z.id!==o.id&&z.id!==a.id&&z.y>=c.y+c.height&&z.y+z.height<=u.y).sort((z,se)=>z.y-se.y);if(!l.length)return null;const f=l[0],p=l[l.length-1],d=(c.y+c.height+f.y)/2,g=(p.y+p.height+u.y)/2,h=s?d:g,m=s?g:d,_=e.waypoints[0],y=e.waypoints[e.waypoints.length-1],x=Gn(t),S=t.edges.filter(z=>z.id!==e.id),P=In(e,S),C=dn(e,x).length;if(P===0&&C===0||C===0&&e.waypoints.length===2)return null;const L=Math.min(...l.map(z=>z.x)),T=Math.max(...l.map(z=>z.x+z.width)),j=(_.x+y.x)/2,k=z=>z.filter((se,Se)=>Se===0||!(dt(se.x,z[Se-1].x)&&dt(se.y,z[Se-1].y)));let D;for(let z=L;z<=T;z+=ZE){const se=k([_,{x:_.x,y:h},{x:z,y:h},{x:z,y:m},{x:y.x,y:m},y]),Se={...e,waypoints:se};if(dn(Se,x).length>0)continue;const qe=In(Se,S),K=Math.abs(z-j);(!D||qe<D.cross||qe===D.cross&&K<D.detour)&&(D={pts:se,cross:qe,detour:K})}return D&&(C>0?D.cross<=P:D.cross<P)?D.pts:null}function uh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=pt(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=pt(n),s=a.edges.find(l=>l.id===o.id);if(!s)continue;const c=ch(s,a);if(!c)continue;const u=n.get(o.id);u&&i.updateWaypoints(u,c)}}const fi=[25,-25,40,-40],po=35;function QE(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)-po:Math.max(e.y+e.height,t.y+t.height)+po;for(const u of[0,...fi])if(!(Math.abs(u)>=e.width/2-5))for(const l of[0,...fi]){if(Math.abs(l)>=t.width/2-5)continue;const f=n+u,p=i+l;r.push({pts:[{x:f,y:a},{x:f,y:c},{x:p,y:c},{x:p,y:s}],cost:Math.abs(l)+Math.abs(u)})}}return r}function ms(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 QE(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,u=s?n.y:n.y+n.height,l=s?n.y-po:n.y+n.height+po,f=[];for(const y of[0,...fi]){if(Math.abs(y)>=i.width/2-5)continue;const x=o+y;f.push({pts:[{x:n.x,y:r},{x,y:r},{x,y:c}],cost:Math.abs(y)});for(const S of[0,...fi]){if(Math.abs(S)>=n.width/2-5)continue;const P=a+S;f.push({pts:[{x:P,y:u},{x:P,y:l},{x,y:l},{x,y:c}],cost:Math.abs(y)+Math.abs(S)})}}const p=50,d=i.y+i.height/2,g=s?n.y+n.height:n.y;for(const y of[0,...fi]){if(Math.abs(y)>=n.width/2-5)continue;const x=a+y;f.push({pts:[{x,y:g},{x,y:d},{x:i.x+i.width,y:d}],cost:p+Math.abs(y)})}const h=60,m=s?i.y+i.height:i.y,_=s?i.y+i.height+po:i.y-po;for(const y of[0,...fi]){if(Math.abs(y)>=i.width/2-5)continue;const x=o+y;for(const S of[0,...fi]){if(Math.abs(S)>=n.width/2-5)continue;const P=a+S;f.push({pts:[{x:P,y:g},{x:P,y:_},{x,y:_},{x,y:m}],cost:h+Math.abs(y)+Math.abs(S)})}}return f}const gs=30;function lh(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],r=e[n+1],o=dt(i.y,r.y)&&!dt(i.x,r.x),a=dt(i.x,r.x)&&!dt(i.y,r.y);if(!(!o&&!a))for(const s of t)if(o){const c=Math.min(i.x,r.x);if(Math.max(i.x,r.x)<=s.x||c>=s.x+s.width)continue;if(Math.abs(i.y-s.y)<gs||Math.abs(i.y-(s.y+s.height))<gs)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)<gs||Math.abs(i.x-(s.x+s.width))<gs)return!0}}return!1}const ys=40;function JE(e,t,n){let i=0;for(const r of t){if(r.container||n.includes(r.id))continue;const o=r.x-ys,a=r.x+r.width+ys,s=r.y-ys,c=r.y+r.height+ys;for(let u=1;u<e.length-2;u++){const l=e[u],f=e[u+1],p={x:Math.min(l.x,f.x),y:Math.min(l.y,f.y)},d={x:Math.max(l.x,f.x),y:Math.max(l.y,f.y)};if(p.x<a&&d.x>o&&p.y<c&&d.y>s){i++;break}}}return i}function ph(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(C=>C.container),i=new Map(t.shapes.map(C=>[C.id,C])),r=Gn(t),o=t.edges.filter(C=>C.id!==e.id),a=Ln(e,o),s=In(e,o),c=C=>JE(C,t.shapes,e.endpoints)+(lh(C,n)?1:0),u=c(e.waypoints),l=C=>{if(!C)return;const L=C.x+C.width/2,T=C.y+C.height/2;return n.find(j=>j.type==="bpmn:Lane"&&L>=j.x&&L<=j.x+j.width&&T>=j.y&&T<=j.y+j.height)},f=l(i.get(e.endpoints[0]??"")),p=l(i.get(e.endpoints[1]??"")),d=!!f&&!!p&&f.id!==p.id,g=C=>{if(!d||!p)return!1;for(let L=1;L<C.length-2;L++){const T=C[L],j=C[L+1];if(dt(T.y,j.y)&&!dt(T.x,j.x)&&T.y>p.y&&T.y<p.y+p.height)return!0}return!1},h=g(e.waypoints),_=(C=>{if(!C)return;const L=C.x+C.width/2,T=C.y+C.height/2;return n.filter(j=>j.type==="bpmn:Participant"&&L>=j.x&&L<=j.x+j.width&&T>=j.y&&T<=j.y+j.height).sort((j,k)=>j.width*j.height-k.width*k.height)[0]})(i.get(e.endpoints[0]??"")),y=C=>{if(!_)return 0;let L=0;for(let T=1;T<C.length-1;T++){const j=C[T];(j.x<_.x||j.x>_.x+_.width||j.y<_.y||j.y>_.y+_.height)&&L++}return L},x=y(e.waypoints);if(!lh(e.waypoints,n)&&!(d&&!h)&&x===0)return null;const S=C=>C.reduce((L,T,j)=>j?L+Math.abs(T.x-C[j-1].x)+Math.abs(T.y-C[j-1].y):0,0);let P;for(const{pts:C,cost:L}of ms(e,i)){const T={...e,waypoints:C};if(dn(T,r).length>0)continue;const j=Ln(T,o);if(j>a)continue;const k=y(C);if(k>x)continue;const D=k<x&&j===0;if(!D&&In(T,o)>s)continue;const z=c(C),se=g(C);if(!D&&!(se&&!h)&&z>=u)continue;const qe=se?0:1,K=S(C);(!P||k<P.out||k===P.out&&(qe<P.lane||qe===P.lane&&(j<P.opp||j===P.opp&&(z<P.sc||z===P.sc&&(L<P.cost||L===P.cost&&K<P.len)))))&&(P={pts:C,out:k,sc:z,lane:qe,opp:j,cost:L,len:K})}return(P==null?void 0:P.pts)??null}function e1(e,t){const{elementRegistry:n}=e,i=e.modeling,r=pt(n).edges.filter(o=>!t.has(o.id)&&o.waypoints.length>=4).map(o=>o.id).sort();for(const o of r){const a=pt(n),s=a.edges.find(d=>d.id===o);if(!s||s.waypoints.length<4)continue;const c=Gn(a),u=a.edges.filter(d=>d.id!==o),l=dn(s,c).length,f=Ln(s,u),p=In(s,u);for(const d of rl(s,a.shapes)){if(d.length>=s.waypoints.length)continue;const g={...s,waypoints:d};if(dn(g,c).length>l||Ln(g,u)>f||In(g,u)>p)continue;const h=n.get(o);h&&i.updateWaypoints(h,d);break}}}function fh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=pt(n).edges.filter(o=>o.type==="bpmn:SequenceFlow"&&!t.has(o.id)).map(o=>o.id).sort();for(const o of r){const a=pt(n),s=a.edges.find(l=>l.id===o);if(!s)continue;const c=ph(s,a);if(!c)continue;const u=n.get(o);u&&i.updateWaypoints(u,c)}}function ol(e,t){const n=e.waypoints;if(n.length<3)return[];const i=[],r=t.get(e.endpoints[0]??""),o=t.get(e.endpoints[1]??""),a=dt(n[0].x,n[1].x)&&!dt(n[0].y,n[1].y),s=dt(n[n.length-1].x,n[n.length-2].x)&&!dt(n[n.length-1].y,n[n.length-2].y);for(const c of fi){if(a&&r&&Math.abs(c)<r.width/2-5){const u=n.map(l=>({...l}));u[0].x+=c,u[1].x+=c,i.push({pts:u,cost:Math.abs(c)})}if(s&&o&&Math.abs(c)<o.width/2-5){const u=n.map(l=>({...l}));u[u.length-1].x+=c,u[u.length-2].x+=c,i.push({pts:u,cost:Math.abs(c)})}}return i}function t1(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,u=n.y+n.height/2,l=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,g=a?i.x:i.x+i.width,h=o?i.y:i.y+i.height,m=[];for(const _ of[0,...fi])Math.abs(_)<i.width/2-5&&m.push({pts:[{x:p,y:u},{x:l+_,y:u},{x:l+_,y:h}],cost:Math.abs(_)}),Math.abs(_)<i.height/2-5&&m.push({pts:[{x:c,y:d},{x:c,y:f+_},{x:g,y:f+_}],cost:Math.abs(_)});return m}function al(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,u=a?i.y+i.height:i.y,l=(r+o)/2,f=[];for(const p of[0,...fi]){const d=l+p;d<=r||d>=o||f.push({pts:[{x:d,y:c},{x:d,y:u}],cost:Math.abs(p)})}return f}function dh(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=Gn(t),r=t.edges.filter(d=>d.id!==e.id),o=Ln(e,r);if(o===0)return null;const a=In(e,r);let s;const c=d=>d.reduce((g,h,m)=>m?g+Math.abs(h.x-d[m-1].x)+Math.abs(h.y-d[m-1].y):0,0),u=3,l=d=>{const g=d[0],h=d[d.length-1],m=Math.hypot(h.x-g.x,h.y-g.y);return m>=1&&c(d)/m>=u?1:0},f=l(e.waypoints),p=[...ms(e,n),...al(e,n),...ol(e,n)];for(const{pts:d,cost:g}of p){const h={...e,waypoints:d};if(dn(h,i).length>0)continue;const m=Ln(h,r),_=In(h,r),y=o-m+(f-l(d));if(m>=o||_-a>y)continue;const x=c(d);(!s||m<s.opposite||m===s.opposite&&(_<s.cross||_===s.cross&&(g<s.cost||g===s.cost&&x<s.len)))&&(s={pts:d,opposite:m,cross:_,cost:g,len:x})}return(s==null?void 0:s.pts)??null}function hh(e,t){var i;let n=0;for(const r of t)r.id!==e.id&&((i=so(e,r))==null?void 0:i.kind)==="unrelated"&&n++;return n}function n1(e,t){const n=new Map(t.shapes.map(p=>[p.id,p])),i=Gn(t),r=t.edges.filter(p=>p.id!==e.id),o=hh(e,r);if(o===0)return null;const a=Ln(e,r),s=In(e,r),c=p=>p.reduce((d,g,h)=>h?d+Math.abs(g.x-p[h-1].x)+Math.abs(g.y-p[h-1].y):0,0),u=2;let l;const f=[...ms(e,n),...al(e,n),...t1(e,n),...ol(e,n)];for(const{pts:p,cost:d}of f){const g={...e,waypoints:p};if(dn(g,i).length>0)continue;const h=hh(g,r);if(h>=o)continue;const m=Ln(g,r);if(m-h>a-o)continue;const _=In(g,r);if(_-s>(o-h)*u)continue;const y=c(p);(!l||h<l.fake||h===l.fake&&(m<l.unreadable||m===l.unreadable&&(_<l.cross||_===l.cross&&(d<l.cost||d===l.cost&&y<l.length))))&&(l={pts:p,fake:h,unreadable:m,cross:_,cost:d,length:y})}return(l==null?void 0:l.pts)??null}function mh(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Vn(pt(i)).filter(s=>s.kind==="edge-overlap-unrelated"&&!t.has(oi(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=pt(i),u=c.edges.find(p=>p.id===s);if(!u)continue;const l=n1(u,c);if(!l)continue;const f=i.get(s);f&&r.updateWaypoints(f,l)}}function gh(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 yh(e,t,n){var u;if(e.type!=="bpmn:SequenceFlow"||t.type!=="bpmn:SequenceFlow"||((u=so(e,t))==null?void 0:u.kind)!=="opposite")return!1;const[i,r]=e.endpoints,[o,a]=t.endpoints,s=[i,r].filter(l=>l&&(l===o||l===a)).length;return!(!!r&&r===o||!!a&&a===i)||s!==1?!1:gh(e,n)&&gh(t,n)}function vh(e,t,n){let i=0;for(const r of t)r.id!==e.id&&yh(e,r,n)&&i++;return i}function i1(e,t){const n=new Map(t.shapes.map(p=>[p.id,p])),i=Gn(t),r=t.edges.filter(p=>p.id!==e.id),o=vh(e,r,n);if(o===0)return null;const a=Ln(e,r),s=In(e,r),c=p=>p.reduce((d,g,h)=>h?d+Math.abs(g.x-p[h-1].x)+Math.abs(g.y-p[h-1].y):0,0),u=2;let l;const f=[...ms(e,n),...al(e,n),...ol(e,n)];for(const{pts:p,cost:d}of f){const g={...e,waypoints:p};if(dn(g,i).length>0)continue;const h=vh(g,r,n);if(h>=o)continue;const m=Ln(g,r);if(m-h>a-o)continue;const _=In(g,r);if(_-s>(o-h)*u)continue;const y=c(p);(!l||h<l.chain||h===l.chain&&(m<l.unreadable||m===l.unreadable&&(_<l.cross||_===l.cross&&(d<l.cost||d===l.cost&&y<l.length))))&&(l={pts:p,chain:h,unreadable:m,cross:_,cost:d,length:y})}return(l==null?void 0:l.pts)??null}function r1(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=pt(i),a=new Map(o.shapes.map(u=>[u.id,u])),s=Vn(o).filter(u=>u.kind==="edge-overlap-opposite"&&!t.has(oi(u)));if(!s.length)return;const c=new Set;for(const u of s){if(u.kind!=="edge-overlap-opposite")continue;const[l,f]=u.edges.map(p=>o.edges.find(d=>d.id===p));if(!(!l||!f||!yh(l,f,a)))for(const p of u.edges)n.has(p)||c.add(p)}for(const u of[...c].sort()){const l=pt(i),f=l.edges.find(g=>g.id===u);if(!f)continue;const p=i1(f,l);if(!p)continue;const d=i.get(u);d&&r.updateWaypoints(d,p)}}function bh(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=pt(i),a=Vn(o).filter(l=>Qu(l)&&!t.has(oi(l)));if(!a.length)return;const s=new Set;for(const l of a)if(Qu(l))for(const f of l.edges)n.has(f)||s.add(f);const c=l=>{var f;return((f=o.edges.find(p=>p.id===l))==null?void 0:f.type)??""},u=[...s].sort((l,f)=>{const p=c(l)==="bpmn:SequenceFlow"?0:1,d=c(f)==="bpmn:SequenceFlow"?0:1;return p!==d?p-d:l.localeCompare(f)});for(const l of u){const f=pt(i),p=f.edges.find(h=>h.id===l);if(!p)continue;const d=dh(p,f);if(!d)continue;const g=i.get(l);g&&r.updateWaypoints(g,d)}}const o1=10,a1=(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 _h(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!ds(e,i))return null;const r=Gn(t),o=i.flatMap(fn);for(const a of fn(e)){let s=[[a.lo,a.hi]];for(const[d,g]of fs(a,o))s=s.flatMap(([h,m])=>{const _=[];return d>h&&_.push([h,Math.min(m,d)]),g<m&&_.push([Math.max(h,g),m]),_.filter(([y,x])=>x>y)});const c=a.axis==="h"?n.width:n.height,u=s.find(([d,g])=>g-d>=c+o1*2);if(!u)continue;const l=(u[0]+u[1])/2,f=a.axis==="h"?{x:l,y:a.at-Hd}:{x:a.at+Sn+n.width/2,y:l},p={x:f.x-n.width/2,y:f.y-n.height/2,width:n.width,height:n.height};if(!ds({...e,label:p},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&a1(p,d)))return p}return null}const Sn=8;function xh(e,t){const n=e.label;if(!n)return null;const i=fn(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,g=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(g,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(fn),...t.shapes.filter(p=>p.container).flatMap(Zo)],u=p=>!c.some(d=>Ti(p,d));if(u(n))return null;const l=(s.axis==="v"?n.height:n.width)+Sn,f=[0,-l,l,-2*l,2*l];if(s.axis==="v")for(const p of[s.at+Sn,s.at-Sn-n.width])for(const d of f){const g=n.y+d;if(g<s.lo||g+n.height>s.hi)continue;const h={...n,x:p,y:g};if(u(h))return h}else for(const p of[s.at-Sn-n.height,s.at+Sn])for(const d of f){const g=n.x+d;if(g<s.lo||g+n.width>s.hi)continue;const h={...n,x:g,y:p};if(u(h))return h}return null}function wh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=pt(n);for(const o of r.edges){if(!o.label||t.has(o.id))continue;const a=xh(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 Eh(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=pt(i),a=Vn(o).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(oi(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 u=_h(c,o);if(!u)continue;const l=i.get(s.edge),f=l==null?void 0:l.label;f&&r.moveElements([f],{x:u.x-f.x,y:u.y-f.y})}}function Sh(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(fn),...t.shapes.filter(p=>p.container).flatMap(Zo)],r=i.filter(p=>Ti(n,p));if(!r.length)return null;const o=t.shapes.filter(p=>!p.container&&p.id!==e.id),a=uo(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=>Ti(p,d))&&!o.some(d=>s(p,d))&&!a.some(d=>s(p,d)),u=[];for(const p of r)p.axis==="h"?u.push({...n,y:p.at-Sn-n.height},{...n,y:p.at+Sn}):u.push({...n,x:p.at-Sn-n.width},{...n,x:p.at+Sn});const l=e.x+e.width/2,f=e.y+e.height/2;return u.push({...n,x:l-n.width/2,y:e.y+e.height+Sn},{...n,x:l-n.width/2,y:e.y-Sn-n.height},{...n,x:e.x+e.width+Sn,y:f-n.height/2},{...n,x:e.x-Sn-n.width,y:f-n.height/2}),u.find(c)??null}function Rh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=pt(n);for(const o of r.shapes){if(o.container||!o.label||t.has(o.id))continue;const a=Sh(o,pt(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})}}const s1=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,Ch=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),Ph={"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}]},vs=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),sl=e=>typeof e=="string"&&e!=="";function c1(e){const t=[];function n(i,r,o,a){if(a===null){sl(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!vs(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)sl(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{if(!vs(i)||!sl(i.kind)||!(i.kind in Ph)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const o of Ph[i.kind]){const a=o.path.endsWith("[]"),s=a?o.path.slice(0,-2):o.path,c=s.split(".");let u=i;for(const f of c.slice(0,-1)){if(!vs(u))break;u=u[f]}if(!vs(u))continue;const l=u[c[c.length-1]];if(!(l===void 0&&o.optional)&&!(l===null&&o.optional)){if(!a){n(r,o.path,l,o.shape);continue}if(!Array.isArray(l)){t.push({kind:"payload-invalid",opIndex:r,field:o.path});continue}l.forEach((f,p)=>n(r,`${s}[${p}]`,f,o.shape))}}if(i.kind==="node.add"||i.kind==="node.update"){const o=i.band;o!==void 0&&(!Number.isInteger(o)||o<0)&&t.push({kind:"payload-invalid",opIndex:r,field:"band"})}}),t}function Ah(e,t){const n=c1(e);if(n.length>0)return n;const i=[],r=new Map,o=new Map;function a(p,d,g){if(!s1.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,{...g,opIndex:p})}e.forEach((p,d)=>{var g;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"}),(g=p.association)!=null&&g.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 u(p,d,g,h){const m=s(d);if(m===void 0){i.push({kind:"ref-missing",opIndex:p,ref:d,role:g});return}if(h&&!h.includes(m)){i.push({kind:"ref-category",opIndex:p,ref:d,role:g,expected:h.join("|"),actual:m});return}return m}const l=t.isCollaboration()||e.some(p=>p.kind==="participant.add");return e.forEach((p,d)=>{var g;switch(p.kind){case"participant.add":break;case"node.add":{const{participant:h,lane:m}=p.node;if(h===void 0){(l||m!==void 0)&&i.push({kind:"participant-required",opIndex:d,id:p.node.id});break}if(u(d,h,"participant",["participant"])===void 0)break;m!==void 0&&((((g=r.get(h))==null?void 0:g.lanes)??o.get(h)??t.lanesOf(h)).includes(m)||i.push({kind:"lane-unknown",opIndex:d,lane:m,participant:h}));break}case"sequenceFlow.add":{const{id:h,source:m,target:_,name:y,condition:x}=p.flow,S=u(d,m,"source",["flowNode"]),P=u(d,_,"target",["flowNode"]);S&&P&&c(m)!==c(_)&&i.push({kind:"flow-cross-pool",opIndex:d,id:h}),y!==void 0&&x!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:h});break}case"messageFlow.add":{const{id:h,source:m,target:_}=p.flow,y=u(d,m,"source",["flowNode","participant"]),x=u(d,_,"target",["flowNode","participant"]);if(y&&x){const S=c(m),P=c(_);S!==void 0&&S===P&&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(y=>y===p.dataStore.id).length!==1){i.push({kind:"data-association-ends",opIndex:d,source:h.source,target:h.target});continue}const _=h.source===p.dataStore.id?h.target:h.source;u(d,_,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:h,target:m}=p.association,_=u(d,h,"source"),y=u(d,m,"target");if(_&&y){const x=new Set([_,y]);x.has("dataStore")&&x.has("flowNode")||i.push({kind:"data-association-ends",opIndex:d,source:h,target:m})}break}case"association.add":{const{id:h,source:m,target:_}=p.association,y=u(d,m,"source"),x=u(d,_,"target");y&&x&&y!=="annotation"&&x!=="annotation"&&i.push({kind:"association-detached",opIndex:d,annotation:h??`${m}->${_}`});break}case"annotation.add":{if(p.association){const{source:h,target:m}=p.association;if(h!==p.annotation.id&&m!==p.annotation.id)i.push({kind:"association-detached",opIndex:d,annotation:p.annotation.id});else{const _=h===p.annotation.id?m:h;u(d,_,"association")}}p.placement&&u(d,p.placement.anchor,"anchor");break}case"group.add":{for(const h of p.group.members??[]){const m=u(d,h,"member");m&&Ch.has(m)&&i.push({kind:"ref-category",opIndex:d,ref:h,role:"member",expected:"shape",actual:m})}break}case"participant.update":{if(f(d,p.id,"participant")===void 0)break;if(p.lanes){const h=t.lanesOf(p.id),m=p.lanes.map(y=>y.id);for(const y of h)m.includes(y)||i.push({kind:"lane-shrink-unsupported",opIndex:d,participant:p.id,lane:y});for(const y of m)t.categoryOf(y)!==void 0&&!h.includes(y)&&i.push({kind:"id-duplicate",opIndex:d,id:y});const _=m.filter(y=>h.includes(y));_.length===h.length&&_.some((y,x)=>y!==h[x])&&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||u(d,p.source,"source",["flowNode"])!==void 0,m=p.target===void 0||u(d,p.target,"target",["flowNode"])!==void 0,_=t.endpointsOf(p.id),y=p.source??(_==null?void 0:_.source),x=p.target??(_==null?void 0:_.target);h&&m&&y!==void 0&&x!==void 0&&new Set([c(y),c(x),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&&u(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 m=u(d,h,"member");m&&Ch.has(m)&&i.push({kind:"ref-category",opIndex:d,ref:h,role:"member",expected:"shape",actual:m})}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,g){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(g&&h!==g){i.push({kind:"ref-category",opIndex:p,ref:d,role:"target",expected:g,actual:h});return}return h}}function Th(e){return{modeling:e.get("modeling"),bpmnFactory:e.get("bpmnFactory"),elementFactory:e.get("elementFactory"),elementRegistry:e.get("elementRegistry"),canvas:e.get("canvas"),autoPlace:e.get("autoPlace"),bpmnReplace:e.get("bpmnReplace")}}function bs(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const _s={"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]},Zt=10,Mh=40,u1=10;function cl(e,t,n,i,r){const o=n,a=(k,D)=>{const[z,se]=_s[k];let Se={x:t.x+t.width/2+z*(t.width/2+o.width/2+D),y:t.y+t.height/2+se*(t.height/2+o.height/2+D)};const qe=i.x+Zt+o.width/2,K=i.x+i.width-Zt-o.width/2,fe=i.y+Zt+o.height/2,we=i.y+i.height-Zt-o.height/2,me={x:Math.min(K,Math.max(qe,Se.x)),y:Math.min(we,Math.max(fe,Se.y))};return(me.x!==Se.x||me.y!==Se.y)&&(Se=Math.abs(me.x-(t.x+t.width/2))<(t.width+o.width)/2+Zt&&Math.abs(me.y-(t.y+t.height/2))<(t.height+o.height)/2+Zt?{x:t.x+t.width+Zt+o.width/2,y:me.y}:me),Se},s=(i.children??[]).filter(k=>!("waypoints"in k&&k.waypoints)&&k.type!=="bpmn:Lane"&&k.type!=="label"&&typeof k.x=="number"&&k.id!==r.selfId),c=pt(e),u=k=>{var z,se;if(!r.selfId)return!1;const D=e.get(k);return!!D&&(((z=D.source)==null?void 0:z.id)===r.selfId||((se=D.target)==null?void 0:se.id)===r.selfId)},l=c.edges.filter(k=>!u(k.id)).flatMap(fn),f=uo(c).filter(k=>k.owner!==r.selfId).map(k=>k.rect),p=k=>({x0:k.x-o.width/2-Zt,x1:k.x+o.width/2+Zt,y0:k.y-o.height/2-Zt,y1:k.y+o.height/2+Zt}),d=k=>{const D=p(k);return s.some(z=>D.x0<z.x+z.width&&D.x1>z.x&&D.y0<z.y+z.height&&D.y1>z.y)},g=k=>{const D=p(k);return l.some(z=>z.axis==="h"?z.at>D.y0&&z.at<D.y1&&z.lo<D.x1&&z.hi>D.x0:z.at>D.x0&&z.at<D.x1&&z.lo<D.y1&&z.hi>D.y0)},h=k=>{const D=p(k);return f.some(z=>D.x0<z.x+z.width&&D.x1>z.x&&D.y0<z.y+z.height&&D.y1>z.y)},m=c.shapes.filter(k=>k.type==="bpmn:Group").flatMap(k=>[{axis:"h",at:k.y,lo:k.x,hi:k.x+k.width},{axis:"h",at:k.y+k.height,lo:k.x,hi:k.x+k.width},{axis:"v",at:k.x,lo:k.y,hi:k.y+k.height},{axis:"v",at:k.x+k.width,lo:k.y,hi:k.y+k.height}]),_=k=>{const D=p(k);return m.some(z=>z.axis==="h"?z.at>D.y0&&z.at<D.y1&&z.lo<D.x1&&z.hi>D.x0:z.at>D.x0&&z.at<D.x1&&z.lo<D.y1&&z.hi>D.y0)},y=k=>d(k)||g(k)||h(k)||_(k),x=k=>k.x-o.width/2>=i.x&&k.x+o.width/2<=i.x+i.width&&k.y-o.height/2>=i.y&&k.y+o.height/2<=i.y+i.height;if(r.placement){const k=K=>K.startsWith("top")?K.replace(/^top/,"bottom"):K.replace(/^bottom/,"top"),D=K=>K.endsWith("left")?K.replace(/left$/,"right"):K.replace(/right$/,"left"),z=r.placement.side,se=[z,k(z),D(z),k(D(z)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],Se=r.placement.offset??50;let qe=a(z,Se);if(y(qe)){const K=new Set;for(const fe of se){if(K.has(fe))continue;K.add(fe);const we=a(fe,Se);if(x(we)&&!y(we)){qe=we;break}}}return qe}const S=r.from,P=i.x+Zt+o.width/2,C=i.x+i.width-Zt-o.width/2,L=i.y+Zt+o.height/2,T=i.y+i.height-Zt-o.height/2;let j={x:Math.min(C,Math.max(P,S.x)),y:Math.min(T,Math.max(L,S.y))};if(y(j)){const k=(t.width+o.width)/2+Zt,z=[{x:j.x+k,y:j.y},{x:j.x-k,y:j.y},{x:j.x,y:j.y-o.height-Zt},{x:j.x,y:j.y+o.height+Zt}].filter(x).find(se=>!y(se));z&&(j=z)}return j}function qt(e,t){return e.filter(n=>n.kind===t)}function kh(e,t){var o0,a0,s0,c0,u0,l0,p0,f0,d0,h0,m0,g0,y0,v0,b0,_0,x0,w0,E0,S0,R0,C0,P0;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:s,bpmnReplace:c}=t,u=()=>a.getRootElement(),l=v=>o.get(v),f=v=>{const R=l(v);if(!R)throw new Error(`하강 참조 해소 실패: ${v}`);return R},p=v=>{let R=v.parent;for(;R;){if(R.type==="bpmn:Participant")return R;R=R.parent}},d=new Map;for(const v of o.filter(R=>!("waypoints"in R&&R.waypoints)&&R.type!=="bpmn:Lane"&&R.type!=="label"&&typeof R.x=="number"))d.set(v.id,{x:v.x,y:v.y});const g=qt(e,"participant.add"),h=qt(e,"node.add"),m=qt(e,"sequenceFlow.add"),_=qt(e,"messageFlow.add"),y=qt(e,"dataStore.add"),x=qt(e,"dataAssociation.add"),S=qt(e,"annotation.add"),P=qt(e,"group.add"),C=new Map(h.map(v=>[v.node.id,v])),L=(v,R,A)=>{var $;const O=v.businessObject,F=((($=O.extensionElements)==null?void 0:$.values)??[]).filter(G=>G.$type!==R),B=A?[...F,i.create(R,A)]:F;if(!B.length){O.extensionElements&&n.updateProperties(v,{extensionElements:void 0});return}const N=i.create("bpmn:ExtensionElements",{values:B});B.forEach(G=>{G.$parent=N}),n.updateProperties(v,{extensionElements:N})},T=v=>({anchor:v.anchor,side:v.side,...v.offset!==void 0?{offset:v.offset}:{}});for(const v of qt(e,"element.remove")){const R=l(v.id);R&&n.removeElements([R])}const j=v=>o.filter(R=>{var A;return R.type==="bpmn:Lane"&&((A=p(R))==null?void 0:A.id)===v}).sort((R,A)=>R.y-A.y);for(const v of qt(e,"participant.update")){const R=f(v.id);if(v.name!==void 0&&n.updateProperties(R,{name:v.name??void 0}),!v.lanes)continue;const A=j(v.id);if(!A.length){n.splitLane(R,v.lanes.length),j(v.id).forEach((F,B)=>{const N=v.lanes[B];N&&n.updateProperties(F,{id:N.id,name:N.name})});continue}const O=new Set(A.map(F=>F.id));v.lanes.forEach((F,B)=>{if(O.has(F.id)){n.updateProperties(f(F.id),{name:F.name});return}const N=B===0?n.addLane(j(v.id)[0],"top"):n.addLane(f(v.lanes[B-1].id),"bottom");n.updateProperties(N,{id:F.id,name:F.name})})}const k=150,D=130,z=80,se=90,Se=180,qe=30,K=30,fe=(v,R,A,O,F)=>{const B=A-R.width/2,N=O-R.height/2;return(v.children??[]).find($=>!("waypoints"in $&&$.waypoints)&&$.type!=="bpmn:Lane"&&$.type!=="label"&&!(F!=null&&F.has($.id))&&typeof $.x=="number"&&B<$.x+$.width+K&&B+R.width+K>$.x&&N<$.y+$.height&&N+R.height>$.y)},we=new Set;for(const v of g){we.add(`pool:${v.participant.id}`);for(const R of v.participant.lanes??[])we.add(R.id)}const me=new Map;for(const v of h){const R=v.node.lane??`pool:${v.node.participant??""}`;let A=me.get(R);A||me.set(R,A=new Set([0])),v.band!==void 0&&A.add(v.band)}const Ee=new Map;for(const[v,R]of me){if(!we.has(v))continue;const A=[...R].sort((B,N)=>B-N),O=A.map((B,N)=>N===0?0:N%2===1?Math.ceil(N/2):-(N/2)),F=Math.min(...O);Ee.set(v,new Map(A.map((B,N)=>[B,O[N]-F])))}{const v=new Map;for(const R of g)(R.participant.lanes??[]).forEach((A,O)=>v.set(A.id,O));for(const[R,A]of Ee){if(!v.has(R)||A.size<2)continue;const O=v.get(R),F=A.get(0)??0,B=new Set;for(const re of h){if(re.node.lane!==R||(re.band??0)!==0||!re.node.type.endsWith("Gateway"))continue;const ke={in:new Set,out:new Set,cross:new Set};for(const xe of m){const Pe=xe.flow.source===re.node.id;if(!Pe&&xe.flow.target!==re.node.id)continue;const ut=C.get(Pe?xe.flow.target:xe.flow.source);if(!ut||ut.node.participant!==re.node.participant||!ut.node.lane)continue;let ae,ce=!1;if(ut.node.lane!==R){const ue=v.get(ut.node.lane);if(ue===void 0)continue;ae=ue>O?"down":"up",ce=!0}else{const ue=A.get(ut.band??0)??F;ae=ue>F?"down":ue<F?"up":void 0}ae&&(ke[Pe?"out":"in"].add(ae),ce&&ke.cross.add(ae))}for(const xe of["up","down"])ke.in.has(xe)&&ke.out.has(xe)&&ke.cross.has(xe)&&B.add(xe)}if(B.size!==1)continue;const[N]=B,$=Math.max(...A.values()),G=N==="down"?$:0;if(F===G)continue;const X=[...A.entries()].filter(([re])=>re!==0).sort((re,ke)=>re[1]-ke[1]),de=[...Array($+1).keys()].filter(re=>re!==G),Re=new Map([[0,G]]);X.forEach(([re],ke)=>Re.set(re,de[ke])),Ee.set(R,Re)}}const pe=v=>{var R;return(((R=me.get(v))==null?void 0:R.size)??0)>1},q=v=>v.band??(v.node.lane||!pe(`pool:${v.node.participant??""}`)?void 0:0),Y=new Map,Z=v=>Y.get(v.node.id)??q(v),He=new Set,Kt=new Set;{const v=new Map;for(const O of m)v.set(O.flow.target,(v.get(O.flow.target)??0)+1);const R=O=>{const F=[],B=new Set([O]),N=[O];for(;N.length;){const $=N.shift();F.push($);for(const G of m)G.flow.source!==$||B.has(G.flow.target)||(v.get(G.flow.target)??0)!==1||(B.add(G.flow.target),N.push(G.flow.target))}return F},A=(O,F)=>{var B;return((B=Ee.get(O))==null?void 0:B.get(F))??F};for(const O of h){if(!O.node.type.endsWith("Gateway"))continue;const F=O.node.lane??`pool:${O.node.participant??""}`,B=Ee.get(F);if(!B||B.size<2)continue;const N=Z(O);if(N===void 0||A(F,N)!==A(F,0))continue;const $=A(F,N),G=m.filter(xe=>xe.flow.source===O.node.id).map(xe=>C.get(xe.flow.target)).filter(xe=>!!xe&&(xe.node.lane??`pool:${xe.node.participant??""}`)===F),X=G.filter(xe=>{const Pe=Z(xe);return Pe!==void 0&&A(F,Pe)===$&&(v.get(xe.node.id)??0)===1}),de=G.some(xe=>{const Pe=Z(xe);return Pe!==void 0&&A(F,Pe)>$});if(X.length!==1||!de)continue;const Re=new Set(G.flatMap(xe=>R(xe.node.id)));if(!m.some(xe=>xe.flow.target===O.node.id&&Re.has(xe.flow.source)))continue;const ke=new Map;for(const[xe,Pe]of B)ke.set(xe,Pe+1);ke.set(-1,0),Ee.set(F,ke);for(const xe of R(X[0].node.id))C.has(xe)&&(Y.set(xe,-1),Kt.add(xe));He.add(O.node.id)}}const M=(v,R)=>{var A;return((A=Ee.get(v))==null?void 0:A.get(R))??R},E=new Map;for(const[v,R]of me){let A=0;for(const O of R)A=Math.max(A,M(v,O));E.set(v,A)}const b=v=>Se+k*v,H=(v,R,A)=>{const O=u().children.filter(F=>!("waypoints"in F&&F.waypoints)&&F.id!==R&&typeof F.y=="number"&&F.y>=v);O.length&&n.moveElements(O,{x:0,y:A})},W=(v,R,A)=>{const O=v.type==="bpmn:Participant"?v:void 0;if(!O||O.children.some($=>$.type==="bpmn:Lane"))return;const F=A+R.height/2+qe-O.y;if(O.height>=F)return;const B=F-O.height,N=O.y+O.height;n.resizeShape(O,{x:O.x,y:O.y,width:O.width,height:F}),H(N,O.id,B)},Q=(v,R,A)=>{if(v){const N=f(v),$=b(R);if(N.height>=$)return;const G=$-N.height,X=p(N),de=X?X.y+X.height:N.y+N.height;n.resizeLane(N,{x:N.x,y:N.y,width:N.width,height:$},!1),H(de,X==null?void 0:X.id,G);return}if(!A)return;const O=k*(R+1);if(A.height>=O)return;const F=O-A.height,B=A.y+A.height;n.resizeShape(A,{x:A.x,y:A.y,width:A.width,height:O}),H(B,A.id,F)},_e=new Map;for(const v of m)_e.set(v.flow.target,(_e.get(v.flow.target)??0)+1);const Fe=v=>(_e.get(v)??0)<=1,Ze=(v,R,A)=>{if(!v)return!0;const O=l(v);return O?A-R.height/2>=O.y&&A+R.height/2<=O.y+O.height:!0},bt=g.map((v,R)=>({op:v,declared:R}));bt.sort((v,R)=>{const A=v.op.order??Number.POSITIVE_INFINITY,O=R.op.order??Number.POSITIVE_INFINITY;return A!==O?A-O:v.declared-R.declared});let tt=80;for(const v of o.getAll())v.parent===u()&&"height"in v&&typeof v.y=="number"&&(tt=Math.max(tt,v.y+v.height+60));for(const{op:v}of bt){const R=v.participant,A=h.filter(re=>re.node.participant===R.id).length,O=((o0=R.lanes)==null?void 0:o0.length)??0,F=Math.max(1200,A*160+300),B=(R.lanes??[]).map(re=>b(E.get(re.id)??0)),N=B.reduce((re,ke)=>re+ke,0);O&&N<300&&(B[O-1]+=300-N);const $=Math.max(300,k*((E.get(`pool:${R.id}`)??0)+1)),G=R.blackBox||A+O===0?120:O?Math.max(300,N):$,X=r.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:R.id,name:R.name,...v.order!==void 0?{"bwl:poolOrder":v.order}:{},...R.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:F,height:G,isExpanded:!0}),de=n.createShape(X,{x:100+F/2,y:tt+G/2},u()),Re=R.lanes??[];if(Re.length&&n.splitLane(de,Re.length),Re.length){const re=o.filter(ke=>{var xe;return ke.type==="bpmn:Lane"&&((xe=p(ke))==null?void 0:xe.id)===R.id}).sort((ke,xe)=>ke.y-xe.y);if(re.forEach((ke,xe)=>{const Pe=Re[xe];Pe&&n.updateProperties(ke,{id:Pe.id,name:Pe.name})}),B.some(ke=>ke!==de.height/O)){let ke=de.y;re.forEach((xe,Pe)=>{const ut=B[Pe];n.resizeShape(xe,{x:xe.x,y:ke,width:xe.width,height:ut}),ke+=ut})}}tt=de.y+de.height+60}const zt=v=>{var O;const R=C.get(v);if(R)return R.node.participant??"";const A=l(v);return A?A.type==="bpmn:Participant"?A.id:((O=p(A))==null?void 0:O.id)??"":""},Gt=new Map,ln=v=>{let R=Gt.get(v);return R||Gt.set(v,R={nodes:[],flows:[]}),R};for(const v of h)ln(v.node.participant??"").nodes.push(v);for(const v of m)ln(zt(v.flow.source)).flows.push(v);const ct=v=>{var R;return i.create("bpmn:SequenceFlow",{id:v.id,name:v.name??((R=v.condition)==null?void 0:R.label)})},Tt=(v,R)=>r.createShape({type:bs(v.type),businessObject:i.create(bs(v.type),{id:v.id,name:v.name,...R!==void 0?{"bwl:band":R}:{}})}),gn=[...bt.map(({op:v})=>v.participant.id).filter(v=>Gt.has(v)),...[...Gt.keys()].filter(v=>!g.some(R=>R.participant.id===v))],Rr=v=>v.endsWith("Gateway");for(const v of gn){const R=Gt.get(v),A=v?f(v):void 0,O=A?A.x+150:250;let F=A?A.y+80:120;const B=(ae,ce,ue)=>{if(ae){const Ce=f(ae);return Ce.y+Math.min(Ce.height/2,se)+M(ae,ce??0)*k}return ce!==void 0&&A?A.y+z+M(`pool:${v}`,ce)*k:ue},N=(ae,ce,ue)=>{if(ae){const Ce=f(ae);return Ce.y+Math.min(Ce.height/2,se)+ce*k}return A?A.y+z+ce*k:ue},$=ae=>ae.participant?f(ae.participant):u(),G=(ae,ce,ue,Ce,Qe,et,St)=>{const nn=ue!==void 0||Ce!==void 0,le=M(ue??`pool:${v}`,Ce??0);if(Ce===void 0&&St!==void 0&&Ze(ue,ce,St)&&!fe(ae,ce,Qe,St))return{x:Qe,y:St};if(nn)for(let U=0;U<4;U++){const ne=N(ue,le+U,et);if(!fe(ae,ce,Qe,ne))return Q(ue,le+U,A),{x:Qe,y:ne}}const Ve=B(ue,Ce,et);nn?Q(ue,le,A):W(ae,ce,Ve);let te=Qe;for(let U=0;U<64;U++){const ne=fe(ae,ce,te,Ve);if(!ne)break;te=ne.x+ne.width+D+ce.width/2}return{x:te,y:Ve}},X=new Set(R.flows.map(ae=>ae.flow.target)),de=new Map;for(const ae of R.nodes){if(X.has(ae.node.id))continue;const ce=Tt(ae.node,ae.band),ue=q(ae),Ce=ae.node.lane?`${ae.node.lane}|${ue??""}`:ue!==void 0?`band:${ue}`:"",Qe=$(ae.node),et=G(Qe,ce,ae.node.lane,ue,de.get(Ce)??O,F);n.createShape(ce,et,Qe),de.set(Ce,et.x+ce.width+D),!ae.node.lane&&ue===void 0&&(F+=160)}const Re=new Set,re=new Map,ke=new Map,xe=new Map;if(v&&we.has(`pool:${v}`)){const ae=new Map;for(const le of R.flows)ae.set(le.flow.target,(ae.get(le.flow.target)??0)+1);const ce=le=>B(le.node.lane,Z(le),Number.NaN),ue=new Set,Ce=le=>{var U;const Ve=(U=C.get(le))==null?void 0:U.node.participant;if(Ve)return l(Ve);const te=l(le);if(te)return te.type==="bpmn:Participant"?te:p(te)},Qe=le=>{const Ve=[],te=new Set([le]),U=[le];for(;U.length;){const ne=U.shift(),be=C.get(ne);be&&Ve.push(be);for(const he of R.flows)he.flow.source!==ne||te.has(he.flow.target)||(ae.get(he.flow.target)??0)!==1||(te.add(he.flow.target),U.push(he.flow.target))}return Ve},et=le=>{if(!A)return;const Ve=new Set(le.map(ne=>ne.node.id));let te=!1,U=!1;for(const ne of _){if(!Ve.has(ne.flow.source))continue;const be=Ce(ne.flow.target);!be||be.id===A.id||(be.y<A.y?te=!0:U=!0)}return te&&!U?"up":U&&!te?"down":void 0};for(const le of R.nodes){if(!Rr(le.node.type))continue;const Ve=B(le.node.lane,q(le),Number.NaN);if(Number.isNaN(Ve))continue;const te=[];for(const he of R.flows){if(he.flow.source!==le.node.id)continue;const Me=C.get(he.flow.target);if(!Me||Me.node.lane!==le.node.lane||(ae.get(Me.node.id)??0)!==1)continue;const nt=q(Me);if(nt===void 0)continue;const Vt=B(Me.node.lane,nt,Number.NaN);if(Number.isNaN(Vt))continue;const ci=Qe(Me.node.id),Pt=et(ci);Pt&&te.push({subtree:ci,band:nt,row:Vt,dir:Pt})}if(!te.some(he=>he.dir==="up")||!te.some(he=>he.dir==="down")||!te.some(he=>he.dir==="up"&&te.some(Me=>Me.dir==="down"&&Me.row<he.row)))continue;const ne=[...te].sort((he,Me)=>he.row-Me.row);[...te.filter(he=>he.dir==="up"),...te.filter(he=>he.dir==="down")].sort((he,Me)=>he.dir===Me.dir?he.row-Me.row:he.dir==="up"?-1:1).forEach((he,Me)=>{const nt=ne[Me].band;if(nt!==he.band){ue.add(le.node.id);for(const Vt of he.subtree)q(Vt)===he.band&&Y.set(Vt.node.id,nt)}})}const St=le=>{if(!A)return;const Ve=new Set(le.map(ne=>ne.node.id));let te=!1,U=!1;for(const ne of _){if(!Ve.has(ne.flow.target))continue;const be=Ce(ne.flow.source);!be||be.id===A.id||(be.y<A.y?te=!0:U=!0)}return te&&!U?"up":U&&!te?"down":void 0};for(const le of R.nodes){if(!Rr(le.node.type))continue;const Ve=le.node.lane??`pool:${v}`,te=Ee.get(Ve);if(!te||te.size<2)continue;const U=te.get(0);if(U===void 0)continue;const ne=Math.max(...te.values()),be=U===ne&&U!==0?"down":void 0;if(!be)continue;const he=[];for(const Pt of R.flows){if(Pt.flow.source!==le.node.id)continue;const mt=C.get(Pt.flow.target);if(!mt||mt.node.lane!==le.node.lane||(ae.get(mt.node.id)??0)!==1)continue;const ts=Z(mt);ts!==void 0&&he.push({t:mt,subtree:Qe(mt.node.id),band:ts})}const Me=he.find(Pt=>(te.get(Pt.band)??Pt.band)===U);if(!Me||St(Me.subtree)===be||et(Me.subtree)===be)continue;const nt=he.find(Pt=>Pt!==Me&&St(Pt.subtree)===be);if(!nt)continue;const Vt=Me.band,ci=nt.band;for(const Pt of Me.subtree)Z(Pt)===Vt&&Y.set(Pt.node.id,ci);for(const Pt of nt.subtree)Z(Pt)===ci&&Y.set(Pt.node.id,Vt);ue.add(le.node.id)}for(const le of R.nodes){if(!Rr(le.node.type))continue;const Ve=ce(le);if(Number.isNaN(Ve)||S.some(he=>{var Me,nt;return(((Me=he.placement)==null?void 0:Me.anchor)??(he.association?he.association.source===he.annotation.id?he.association.target:he.association.source:void 0))===le.node.id&&((nt=he.placement)==null?void 0:nt.side.startsWith("bottom"))}))continue;let U,ne=!1,be;for(const he of R.flows){if(he.flow.source!==le.node.id)continue;const Me=C.get(he.flow.target);if(!Me||!Me.node.lane&&q(Me)===void 0)continue;const nt=ce(Me);Number.isNaN(nt)||(Math.abs(nt-Ve)<.5&&(ne=!0),nt>Ve?!U||nt>U.row?U={id:Me.node.id,row:nt,count:1}:nt===U.row&&U.count++:nt<Ve&&Me.node.lane===le.node.lane&&(!be||nt>be.row?be={op:Me,row:nt,count:1}:nt===be.row&&be.count++))}U&&U.count===1&&(ae.get(U.id)??0)===1&&!ue.has(le.node.id)&&Re.add(U.id),!ne&&be&&be.count===1&&(ae.get(be.op.node.id)??0)===1&&!He.has(le.node.id)&&re.set(be.op.node.id,{lane:le.node.lane,band:Z(le)})}const nn=new Map;for(const le of _)nn.set(le.flow.target,[...nn.get(le.flow.target)??[],le]);for(const le of R.nodes){const Ve=nn.get(le.node.id);if(!Ve||Ve.length!==1||!ae.get(le.node.id)||!le.node.lane&&q(le)===void 0||Kt.has(le.node.id))continue;const te=(a0=C.get(Ve[0].flow.source))==null?void 0:a0.node.participant,U=te?l(te):void 0;if(!U||!A||U.id===A.id)continue;const ne=le.node.lane??`pool:${v}`,be=Ee.get(ne);if(!be)continue;const he=be.get(0)??0,Me=(be.get(Z(le)??0)??he)-he;if(Me===0)continue;const nt=U.y<A.y;if(nt&&Me<0||!nt&&Me>0)continue;let Vt;for(const[ci,Pt]of be){const mt=Pt-he;(nt&&mt<0&&(!Vt||mt<Vt.row)||!nt&&mt>0&&(!Vt||mt>Vt.row))&&(Vt={band:ci,row:mt})}Vt&&ke.set(le.node.id,{lane:le.node.lane,band:Vt.band})}}const Pe=new Set;let ut=0;for(;ut++<R.nodes.length+2;){for(let ue=0;ue<R.nodes.length+R.flows.length+2;ue++){let Ce=!1;for(const Qe of R.flows){const et=Qe.flow;if(Pe.has(et.id))continue;const St=l(et.source);if(!St)continue;const nn=l(et.target),le=C.get(et.target);if(!nn&&le){const Ve=Tt(le.node,le.band),te=Z(le);if(le.node.lane||te!==void 0){const U=$(le.node),ne=St,be=ne.x+(xe.get(et.source)??0)+ne.width+D,he=re.get(et.target)??ke.get(et.target),Me=G(U,Ve,he?he.lane:le.node.lane,he?he.band:te,Re.has(et.target)?ne.x+ne.width/2:be,Number.NaN,he||!Fe(et.target)?void 0:ne.y+ne.height/2),nt=n.createShape(Ve,Me,U);Re.has(et.target)&&xe.set(et.target,be-(nt.x+nt.width/2)),n.connect(St,nt,{type:"bpmn:SequenceFlow",businessObject:ct(et)})}else s.append(St,Ve,{connection:{type:"bpmn:SequenceFlow",businessObject:ct(et)}})}else if(nn)n.connect(St,nn,{type:"bpmn:SequenceFlow",businessObject:ct(et)});else continue;Pe.add(et.id),Ce=!0}if(!Ce)break}const ae=R.nodes.filter(ue=>!l(ue.node.id));if(!ae.length)break;const ce=ae[0];{const ue=Tt(ce.node,ce.band),Ce=$(ce.node),Qe=q(ce);n.createShape(ue,G(Ce,ue,ce.node.lane,Qe,O,F),Ce),!ce.node.lane&&Qe===void 0&&(F+=160)}}}const Fn=40,yn=(v,R=()=>!0)=>{const A=l(v);if(!A)return[];const O=[A],F=new Set([v]);for(let B=0;B<O.length;B++){const N=O[B].id;for(const $ of m){const G=$.flow.target;if($.flow.source!==N||F.has(G)||!C.has(G))continue;F.add(G);const X=l(G);X&&R(X)&&O.push(X)}}return O},ii=(v,R=()=>!0)=>{const A=l(v);if(!A)return[];const O=[A],F=new Set([v]);for(let B=0;B<O.length;B++){const N=O[B].id;for(const $ of m){const G=$.flow.source;if($.flow.target!==N||F.has(G)||!C.has(G))continue;F.add(G);const X=l(G);X&&R(X)&&O.push(X)}}return O},ft=30,jn=v=>!("waypoints"in v&&v.waypoints)&&v.type!=="bpmn:Lane"&&v.type!=="label"&&typeof v.x=="number",Yr=(v,R)=>{const A=new Set(v.flatMap(N=>N.subtree.map($=>$.id)));for(const N of v){const $=(N.pool.children??[]).filter(jn).filter(X=>!A.has(X.id));if(N.subtree.some(X=>$.some(de=>X.x+R<de.x+de.width+ft&&X.x+R+X.width+ft>de.x&&X.y<de.y+de.height&&X.y+X.height>de.y)))return null}const O=v.map(N=>N.pool.width),F=o.filter(N=>N.type==="label").map(N=>({label:N,x:N.x,y:N.y}));n.moveElements(v.flatMap(N=>N.subtree),{x:R,y:0});const B=v.map(N=>{const G=Math.max(...N.subtree.map(X=>X.x+X.width))+150-(N.pool.x+N.pool.width);return G>0&&n.resizeShape(N.pool,{x:N.pool.x,y:N.pool.y,width:N.pool.width+G,height:N.pool.height}),G});return()=>{n.moveElements(v.flatMap(N=>N.subtree),{x:-R,y:0}),v.forEach((N,$)=>{B[$]>0&&n.resizeShape(N.pool,{x:N.pool.x,y:N.pool.y,width:O[$],height:N.pool.height})});for(let N=0;N<3;N++){let $=0;for(const G of F){const X=G.x-G.label.x,de=G.y-G.label.y;Math.abs(X)<=.5&&Math.abs(de)<=.5||(n.moveElements([G.label],{x:X,y:de}),$++)}if(!$)break}}},Hn=v=>{var F,B;const R=new Map,A=new Map;for(const N of o.getAll()){if(N.type!=="bpmn:Participant")continue;const $=N;($.children??[]).length||(R.set($.id,$),A.set($.id,[]))}for(const N of o.getAll()){if(N.type!=="bpmn:MessageFlow")continue;const $=N,G=(F=$.source)==null?void 0:F.id,X=(B=$.target)==null?void 0:B.id;G&&X&&A.has(G)&&A.get(G).push(X),G&&X&&A.has(X)&&A.get(X).push(G)}const O=[];for(const[N,$]of A)$.length&&$.every(G=>v.has(G))&&O.push(R.get(N));return O},Je=(v,R)=>{if(!v.length)return null;const A=new Set(v.map(N=>N.id)),O=o.getAll().filter(N=>N.type==="bpmn:Participant"&&!A.has(N.id));if(v.some(N=>O.some($=>N.x+R<$.x+$.width+ft&&N.x+R+N.width+ft>$.x&&N.y<$.y+$.height&&N.y+N.height>$.y)))return null;const B=o.filter(N=>N.type==="label").map(N=>({label:N,x:N.x,y:N.y}));return n.moveElements(v,{x:R,y:0}),()=>{n.moveElements(v,{x:-R,y:0});for(let N=0;N<3;N++){let $=0;for(const G of B){const X=G.x-G.label.x,de=G.y-G.label.y;Math.abs(X)<=.5&&Math.abs(de)<=.5||(n.moveElements([G.label],{x:X,y:de}),$++)}if(!$)break}}},it=()=>{let v=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++)v+=Math.hypot(A[O].x-A[O-1].x,A[O].y-A[O-1].y)}return v},Hx=()=>Vn(pt(o)).filter(v=>v.kind==="edge-crosses-shape").length,zx=v=>{const R=(v.children??[]).filter(jn);let A=0;for(let O=0;O<R.length;O++)for(let F=O+1;F<R.length;F++){const B=R[O],N=R[F];B.x<N.x+N.width&&B.x+B.width>N.x&&B.y<N.y+N.height&&B.y+B.height>N.y&&A++}return A},Ru=()=>{const v=pt(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:v.edges.filter(A=>A.type==="bpmn:MessageFlow"&&A.waypoints.length===2).length,lines:v.edges.filter(A=>R(A.waypoints)).length}},ZD=v=>{const R=F=>{const B=[F],N=new Set([F.id]);for(let $=0;$<B.length;$++)for(const G of B[$].outgoing??[]){if(G.type!=="bpmn:SequenceFlow")continue;const X=G.target;!X||N.has(X.id)||v.has(X.id)||!jn(X)||X.x<F.x||(N.add(X.id),B.push(X))}return B},A=new Set(v),O=[];for(const F of o.getAll()){if(F.type!=="bpmn:MessageFlow")continue;const B=F;if(!B.waypoints||B.waypoints.length!==2)continue;const N=B.source,$=B.target;if(!N||!$)continue;const G=v.has(N.id);if(G===v.has($.id))continue;const X=G?$:N,de=p(X);if(!de||A.has(X.id))continue;const Re=R(X).filter(re=>!A.has(re.id));if(Re.length){for(const re of Re)A.add(re.id);O.push({subtree:Re,pool:de})}}return O};for(const v of qt(e,"sequenceFlow.update")){if(v.target===void 0)continue;const R=C.get(v.target);if(!R)continue;const A=l(v.target),O=l(v.id);if(!A||!O)continue;const F=v.source!==void 0?l(v.source):O.source,B=O.target;if(!F||!B||B.id===A.id)continue;const N=yn(v.target),$=new Set(N.map(ue=>ue.id)),G=Math.min(...N.map(ue=>ue.x)),X=Math.max(...N.map(ue=>ue.x+ue.width)),de=F.x+F.width,Re=X-G+Fn*2-(B.x-de);let re=[];if(Re>0){const ue=p(A),Ce=(ue==null?void 0:ue.children)??[],Qe=le=>le.type==="bpmn:Lane";re=(()=>{const le=new Set;for(const te of Ce)jn(te)&&!$.has(te.id)&&te.x>=B.x&&le.add(te.id);const Ve=[];for(const te of Ce){if(te.type!=="bpmn:DataStoreReference"&&te.type!=="bpmn:DataObjectReference")continue;const U=te,be=[...U.incoming??[],...U.outgoing??[]].filter(he=>he.type==="bpmn:DataInputAssociation"||he.type==="bpmn:DataOutputAssociation").map(he=>he.source===U?he.target:he.source);be.length&&be.every(he=>he!==void 0&&le.has(he.id))&&Ve.push(U)}return Ve})();const St=Ce.filter(le=>!("waypoints"in le&&le.waypoints)&&!Qe(le)&&!$.has(le.id)&&le.x>=B.x),nn=ue?[ue,...Ce.filter(le=>Qe(le))]:[];if(St.length){const le=new Set(St.map(U=>U.id)),Ve=ZD(le),te=Hn(le);n.createSpace(St,nn,{x:Re,y:0},"e",B.x-1);for(const U of Ve){const ne=Ru(),be=Yr([U],Re);if(!be)continue;const he=Ru();(he.messages<=ne.messages||he.lines<ne.lines)&&be()}if(te.length){const U=Ru(),ne=Je(te,Re);if(ne){const be=Ru();(be.messages<=U.messages||be.lines<U.lines)&&ne()}}}}const ke=F.y+F.height/2,xe=ke-(A.y+A.height/2),ut=R.band===void 0&&Fe(v.target)&&N.every(ue=>{var Ce;return Ze((Ce=C.get(ue.id))==null?void 0:Ce.node.lane,ue,ue.y+ue.height/2+xe)})?ke:A.y+A.height/2;n.moveElements(N,{x:de+Fn-G,y:ut-(A.y+A.height/2)});const ae=p(A);if(R.node.lane===void 0&&R.band!==void 0&&ae){const ue=ae.y+z+M(`pool:${R.node.participant??""}`,R.band)*k,Ce=ue-(A.y+A.height/2);Ce!==0&&!fe(ae,A,A.x+A.width/2,ue,$)&&n.moveElements([A],{x:0,y:Ce})}const ce=re.length?p(re[0]):void 0;if(ce){const ue={assoc:it(),overlaps:zx(ce),crosses:Hx()},Ce=re.map(U=>({st:U,x:U.x})),Qe=o.filter(U=>U.type==="label").map(U=>({label:U,x:U.x,y:U.y})),et=Math.min(...re.flatMap(U=>[...U.incoming??[],...U.outgoing??[]].filter(ne=>ne.type==="bpmn:DataInputAssociation"||ne.type==="bpmn:DataOutputAssociation").map(ne=>(ne.source===U?ne.target:ne.source).x))),St=new Set(re.map(U=>U.id)),nn=(ce.children??[]).filter(jn).filter(U=>!St.has(U.id));let le=et;for(const U of[...re].sort((ne,be)=>ne.x-be.x)){let ne=le;for(let be=0;be<100;be++){const he=nn.find(Me=>ne<Me.x+Me.width+ft&&ne+U.width+ft>Me.x&&U.y<Me.y+Me.height&&U.y+U.height>Me.y);if(!he)break;ne=he.x+he.width+ft}ne!==U.x&&n.moveElements([U],{x:ne-U.x,y:0}),le=ne+U.width+ft}const Ve=le+150-(ce.x+ce.width);Ve>0&&n.resizeShape(ce,{x:ce.x,y:ce.y,width:ce.width+Ve,height:ce.height});const te={assoc:it(),overlaps:zx(ce),crosses:Hx()};if(te.assoc>=ue.assoc||te.overlaps>ue.overlaps||te.crosses>ue.crosses){for(const{st:U,x:ne}of Ce)U.x!==ne&&n.moveElements([U],{x:ne-U.x,y:0});Ve>0&&n.resizeShape(ce,{x:ce.x,y:ce.y,width:ce.width-Ve,height:ce.height});for(const U of Qe){const ne=U.x-U.label.x,be=U.y-U.label.y;(ne!==0||be!==0)&&n.moveElements([U.label],{x:ne,y:be})}}}}const Gx=(v,R)=>{const A=R.target===v,O=f(R.source),F=f(R.target),B=A?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(O,F,R.id?{type:B,businessObject:i.create(B,{id:R.id})}:{type:B})},QD=100,Vx=v=>{for(const R of g){if(!R.participant.blackBox)continue;const A=l(R.participant.id);if(!A)continue;const O=[];for(const B of _){const N=B.flow.source===R.participant.id?B.flow.target:B.flow.target===R.participant.id?B.flow.source:void 0,$=N?l(N):void 0;$&&typeof $.x=="number"&&$.type!=="bpmn:Participant"&&O.push($)}if(!O.length)continue;const F=Math.max(...O.map(B=>B.x+B.width/2))+QD;if(F>A.x+A.width&&n.resizeShape(A,{x:A.x,y:A.y,width:F-A.x,height:A.height}),!!v)for(const B of _){const N=l(B.flow.id),$=B.flow.source===R.participant.id?B.flow.target:B.flow.target===R.participant.id?B.flow.source:void 0,G=$?l($):void 0;if(!N||!G||G.type==="bpmn:Participant")continue;const X=G.x+G.width/2;if(X<A.x+10||X>A.x+A.width-10)continue;const de=A.y>G.y,Re=de?G.y+G.height:G.y,re=de?A.y:A.y+A.height,ke=B.flow.source===R.participant.id?[{x:X,y:re},{x:X,y:Re}]:[{x:X,y:Re},{x:X,y:re}],xe=pt(o),Pe={...xe.edges.find(ut=>ut.id===B.flow.id),waypoints:ke};dn(Pe,Gn(xe)).length||n.updateWaypoints(N,ke)}}};Vx(!1);for(const v of _){const R=v.flow;n.connect(f(R.source),f(R.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:R.id,name:R.name})})}{const A=new Set([...m.map(G=>G.flow.id),..._.map(G=>G.flow.id)].filter(G=>!!G)),O=o.filter(G=>!!G.waypoints),F=(G,X)=>Math.abs(X.x-G.x)<2?"L":Math.abs(X.x-(G.x+G.width))<2?"R":Math.abs(X.y-G.y)<2?"T":Math.abs(X.y-(G.y+G.height))<2?"B":void 0,B=new Map,N=(G,X,de)=>{if(!G||!X||typeof G.x!="number")return;const Re=F(G,X);if(!Re)return;let re=B.get(G.id);re||B.set(G.id,re=new Map),re.set(Re,[...re.get(Re)??[],de])};for(const G of O){const X=G.waypoints;!X||X.length<2||(N(G.source,X[0],{id:G.id,dir:"out"}),N(G.target,X[X.length-1],{id:G.id,dir:"in"}))}const $=new Set;for(const[G,X]of B){const de=l(G);if(!de||typeof de.x!="number"||![...X.values()].some(ce=>{const ue=ce.filter(Ce=>Ce.dir==="in");return ce.length>=3&&ue.length>=1&&ce.some(Ce=>Ce.dir==="out")&&ue.some(Ce=>A.has(Ce.id))}))continue;const re=p(de);if(!re||$.has(re.id)||(re.children??[]).some(ce=>ce.type==="bpmn:Lane"))continue;const ke=(s0=X.get("T"))!=null&&s0.length?(c0=X.get("B"))!=null&&c0.length?void 0:"B":"T";if(!ke||(ke==="T"?de.y-re.y:re.y+re.height-(de.y+de.height))>=k)continue;const Pe=(re.children??[]).filter(ce=>!("waypoints"in ce&&ce.waypoints)&&ce.type!=="label"&&typeof ce.x=="number"),ut=re.y+re.height;n.resizeShape(re,{x:re.x,y:re.y,width:re.width,height:re.height+k});const ae=u().children.filter(ce=>!("waypoints"in ce&&ce.waypoints)&&ce.id!==re.id&&typeof ce.y=="number"&&ce.y>=ut);ae.length&&n.moveElements(ae,{x:0,y:k}),ke==="T"&&Pe.length&&n.moveElements(Pe,{x:0,y:k}),$.add(re.id)}}const ed=20,Wx=4,JD=2,eL=[10,30,80],Wo=()=>{const v=pt(o);return{bad:Vn(v).filter(R=>R.kind==="edge-crosses-shape"||R.kind==="edge-overlap-opposite"||R.kind==="edge-overlap-mixed").length,crossings:Wd(v),straight:v.edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.waypoints.length===2).length}},Uo=v=>{const R=pt(o),A=R.edges.find(O=>O.id===v);return A?dn(A,Gn(R)).length:0},Cu=v=>Uo(v)>0,Pu=v=>pt(o).edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.id!==v&&R.waypoints.length===2).length,tL=(v,R,A)=>Yr([{subtree:v,pool:R}],A),Ux=(v,R)=>R.bad>v.bad||R.crossings>v.crossings&&R.straight<=v.straight&&R.bad>=v.bad,Au=(v,R)=>Ux(v,R)||R.straight<v.straight,Tu=(v,R,A=()=>!0,O=Ux)=>{const F=Wo(),B=Yr(v,R);if(!B)return!1;const N=Wo();return O(F,N)||!A()?(B(),!1):!0},qx=(v,R,A,O=()=>!0)=>Tu([{subtree:v,pool:R}],A,O),Kr=v=>{var R;return!!((R=C.get(v))!=null&&R.node.participant)},Ja=new Map;for(const v of _){if(!Kr(v.flow.target))continue;const R=Ja.get(v.flow.target)??[];R.push(v),Ja.set(v.flow.target,R)}const td=[...Ja.keys()],Yx=new Set(m.map(v=>v.flow.target)),Kx=v=>bt.findIndex(({op:R})=>R.participant.id===v);td.sort((v,R)=>{var F,B;const A=Yx.has(v)?1:0,O=Yx.has(R)?1:0;return A!==O?A-O:Kx((F=C.get(v))==null?void 0:F.node.participant)-Kx((B=C.get(R))==null?void 0:B.node.participant)});const Xr=v=>v.x+v.width/2,nL=v=>{const R=new Map;for(const F of o.getAll()){const B=F;if(!B.waypoints||!B.source||!B.target)continue;(R.get(B.source.id)??R.set(B.source.id,[]).get(B.source.id)).push(B.target.id)}const A=new Set([v]),O=[v];for(let F=0;F<O.length;F++)for(const B of R.get(O[F])??[])A.has(B)||(A.add(B),O.push(B));return A},iL=(v,R)=>{const A=nL(R);let O;for(const F of o.getAll()){const B=F;if(B.type!=="bpmn:MessageFlow"||!B.source||!B.target||B.target.id!==v||A.has(B.source.id))continue;const N=B.source;if(typeof N.x!="number"||N.type==="bpmn:Participant")continue;const $=Xr(N);(O===void 0||$>O)&&(O=$)}return O},nd=(v,R)=>{const A=l(v.flow.source);if(A)return A.type==="bpmn:Participant"?iL(A.id,R):Xr(A)},Xx=v=>{let R;for(const A of Ja.get(v)??[]){const O=nd(A,v);O!==void 0&&(!R||O>R.cx)&&(R={op:A,cx:O})}return R==null?void 0:R.op},rL=v=>{const R=Xx(v),A=l(v),O=R?nd(R,v):void 0;return A&&O!==void 0?O-Xr(A):void 0},oL=v=>{const R=rL(v);return R!==void 0&&Math.abs(R)<ed},Zx=(v,R,A,O,F)=>{var B;for(let N=!0;N;){N=!1;for(const $ of _){if($.flow.id===A)continue;const G=R.has($.flow.source),X=R.has($.flow.target);if(G===X||O(G?$.flow.source:$.flow.target))continue;const de=G?$.flow.target:$.flow.source;if(F(de)||!Kr(de))continue;const Re=l($.flow.id);if(!(Re!=null&&Re.waypoints)||Re.waypoints.length!==2)continue;const re=l(de),ke=(B=C.get(de))==null?void 0:B.node.participant;if(!re||!ke)continue;const xe=yn(de,Pe=>Pe.x>=re.x).filter(Pe=>!R.has(Pe.id));if(!(!xe.length||xe.some(Pe=>F(Pe.id)))){for(const Pe of xe)R.add(Pe.id);v.set(ke,[...v.get(ke)??[],...xe]),N=!0}}}return[...v].map(([N,$])=>({subtree:$,pool:f(N)}))},Qx=(v,R,A,O,F)=>Zx(new Map([[R,[...v]]]),new Set(v.map(B=>B.id)),O,B=>B===A,B=>B===F),id=v=>{const R=Xx(v);if(!R)return null;const A=l(v),O=l(R.flow.source),F=nd(R,v);if(!A||!O||F===void 0)return null;const B=F-Xr(A);if(B>=ed){const N=C.get(v).node.participant,$=yn(v,G=>G.x>=A.x);return{groups:Qx($,N,v,R.flow.id,R.flow.source),dx:B}}if(-B>=ed&&Kr(R.flow.source)){const N=C.get(R.flow.source).node.participant,$=yn(R.flow.source,G=>G.x>=O.x&&!oL(G.id));return{groups:Qx($,N,R.flow.source,R.flow.id,v),dx:-B}}return null},Jx=()=>td.map(v=>({id:v,plan:id(v)})).filter(v=>!!v.plan).sort((v,R)=>Math.min(...v.plan.groups.flatMap(A=>A.subtree.map(O=>O.x)))-Math.min(...R.plan.groups.flatMap(A=>A.subtree.map(O=>O.x)))).map(v=>v.id);for(let v=0;v<3;v++){const R=Wo(),A=[];for(const F of Jx()){const B=id(F);if(!B)continue;const N=Yr(B.groups,B.dx);N&&A.push(N)}if(!A.length)break;if(!Au(R,Wo()))continue;for(const F of A.reverse())F();let O=!1;for(const F of Jx()){const B=id(F);B&&Tu(B.groups,B.dx,()=>!0,Au)&&(O=!0)}if(!O)break}for(const v of td.flatMap(R=>Ja.get(R)??[])){if(!Cu(v.flow.id))continue;const R=l(v.flow.target);if(!R)continue;const A=f(C.get(v.flow.target).node.participant),O=yn(v.flow.target,$=>$.x>=R.x),F=R.width+D,B=Uo(v.flow.id),N=Pu(v.flow.id);for(let $=1;$<=Wx;$++){const G=()=>Uo(v.flow.id)<B&&Pu(v.flow.id)>=N;if(qx(O,A,F*$,G))break}}for(const v of _){if(!Cu(v.flow.id))continue;const R=l(v.flow.source),A=l(v.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[F,B]=R.y<A.y?[R.y+R.height,A.y]:[A.y+A.height,R.y],N=[...C.values()].map($=>l($.node.id)).filter($=>!!$&&$.id!==R.id&&$.id!==A.id).filter($=>$.x<=O&&O<=$.x+$.width&&$.y+$.height>F&&$.y<B).sort(($,G)=>$.x-G.x);for(const $ of N){const G=(u0=C.get($.id))==null?void 0:u0.node.participant,X=G?l(G):void 0;if(!X)continue;const de=[...C.values()].filter(ue=>ue.node.participant===G).map(ue=>ue.node.id),Re=ue=>ue.map(Ce=>l(Ce)).filter(Ce=>!!Ce),ke=[ii($.id,ue=>{var Ce;return((Ce=C.get(ue.id))==null?void 0:Ce.node.participant)===G}),Re(de)].filter(ue=>ue.length),xe=$.width+D,Pe=Uo(v.flow.id),ut=Pu(v.flow.id),ae=()=>Uo(v.flow.id)<Pe&&Pu(v.flow.id)>=ut;let ce=!1;for(const ue of ke){for(let Ce=1;Ce<=Wx;Ce++)if(qx(ue,X,xe*Ce,ae)){ce=!0;break}if(ce)break}if(!Cu(v.flow.id))break}}for(const v of _){if(!Cu(v.flow.id))continue;const R=l(v.flow.id);if(((l0=R==null?void 0:R.waypoints)==null?void 0:l0.length)!==2)continue;const A=l(v.flow.source),O=l(v.flow.target);if(!A||!O||A.type==="bpmn:Participant"||O.type==="bpmn:Participant"||!Kr(v.flow.source)||!Kr(v.flow.target)||Math.abs(Xr(A)-Xr(O))>JD)continue;const F=Xr(A),B=R.waypoints.map(Pe=>Pe.y),[N,$]=[Math.min(...B),Math.max(...B)],G=Gn(pt(o)).filter(Pe=>Pe.id!==A.id&&Pe.id!==O.id&&Pe.x<F&&F<Pe.x+Pe.width&&N<Pe.y+Pe.height&&Pe.y<$);if(!G.length)continue;const X=(p0=C.get(v.flow.source))==null?void 0:p0.node.participant,de=(f0=C.get(v.flow.target))==null?void 0:f0.node.participant;if(!X||!de)continue;const Re=new Map;for(const[Pe,ut,ae]of[[v.flow.source,A,X],[v.flow.target,O,de]]){const ce=Re.get(ae)??[],ue=yn(Pe,Ce=>Ce.x>=ut.x).filter(Ce=>!ce.some(Qe=>Qe.id===Ce.id));Re.set(ae,[...ce,...ue])}const re=new Set([...Re.values()].flat().map(Pe=>Pe.id)),ke=Zx(Re,re,v.flow.id,Pe=>Pe===v.flow.source||Pe===v.flow.target,()=>!1),xe=Math.max(...G.map(Pe=>Pe.x+Pe.width));for(const Pe of eL){const ut=xe+Pe-F;if(ut<=0)continue;if(Tu(ke,ut,()=>{var ce,ue;return Uo(v.flow.id)===0&&((ue=(ce=l(v.flow.id))==null?void 0:ce.waypoints)==null?void 0:ue.length)===2},Au))break}}{const v=A=>A.y+A.height/2,R=[];for(const A of C.keys()){if(!Kr(A))continue;const O=m.filter(N=>N.flow.target===A);if(O.length!==1)continue;const F=l(O[0].flow.source),B=l(A);!F||!B||!C.has(F.id)||Math.abs(v(F)-v(B))>1||B.x-(F.x+F.width)<=D+1||R.push({id:A,pred:F,node:B})}R.sort((A,O)=>A.node.x-O.node.x);for(const{id:A}of R){const O=C.get(A),F=l(A),B=l(m.find(re=>re.flow.target===A).flow.source);if(!F||!B)continue;const N=F.x-(B.x+B.width);if(N<=D+1)continue;const $=f(O.node.participant),G=yn(A,re=>re.x>=F.x),X=Wo(),de=tL(G,$,-(N-D));if(!de)continue;const Re=Wo();(Re.bad>X.bad||Re.crossings>=X.crossings||Re.straight<X.straight)&&de()}}Vx(!0);for(const v of y){const R=v.associations??[],A=R.map(B=>B.source===v.dataStore.id?B.target:B.source).map(l).find(Boolean),O=A?p(A)??u():u(),F=A?{x:A.x+A.width/2,y:A.y+A.height+110}:{x:200,y:tt+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:v.dataStore.id,name:v.dataStore.name})},F,O);for(const B of R)Gx(v.dataStore.id,B)}for(const v of x){const A=f(v.association.target).type==="bpmn:DataStoreReference"?v.association.target:v.association.source;Gx(A,v.association)}let e0=0;const Zr=10,t0=40,aL=(v,R)=>{const A=R.map(G=>p(G)).filter(G=>!!G);for(const G of A){const X=Zr,de=G.y,Re=G.y+G.height,re=G.x,ke=G.x+G.width;if(Math.abs(v.y-de)<X){const xe=de+X-v.y;v.y+=xe,v.height-=xe}if(Math.abs(v.y+v.height-Re)<X&&(v.height=Re-X-v.y),Math.abs(v.x-re)<X){const xe=re+X-v.x;v.x+=xe,v.width-=xe}Math.abs(v.x+v.width-ke)<X&&(v.width=ke-X-v.x)}if(!A.length)return;const O=Math.min(...A.map(G=>G.y)),F=Math.max(...A.map(G=>G.y+G.height)),B=O-v.y,N=v.y+v.height-F,$=t0-Zr;if(B>0!=N>0)if(B>0&&B<$){const G=B+Zr;v.y+=G,v.height-=G}else N>0&&N<$&&(v.height-=N+Zr)},sL=(v,R)=>{const A=Zr,O=30,F=o.filter(B=>B.type==="bpmn:Group"&&B.id!==R);for(const B of F){const N=B.x,$=B.x+B.width,G=B.y,X=B.y+B.height,de=v.y<X&&G<v.y+v.height,Re=v.x<$&&N<v.x+v.width;if(de){if(Math.abs(v.x-$)<A){const re=Math.min($+A-v.x,O);re>0&&v.width-re>0&&(v.x+=re,v.width-=re)}if(Math.abs(v.x+v.width-N)<A){const re=Math.min(v.x+v.width-(N-A),O);re>0&&v.width-re>0&&(v.width-=re)}}if(Re){if(Math.abs(v.y-X)<A){const re=Math.min(X+A-v.y,O);re>0&&v.height-re>0&&(v.y+=re,v.height-=re)}if(Math.abs(v.y+v.height-G)<A){const re=Math.min(v.y+v.height-(G-A),O);re>0&&v.height-re>0&&(v.height-=re)}}}},rd=(v,R)=>{const A=t0,O=Math.min(...v.map(G=>G.x))-A,F=Math.min(...v.map(G=>G.y))-A,B=Math.max(...v.map(G=>G.x+G.width))+A,N=Math.max(...v.map(G=>G.y+G.height))+A,$={x:O,y:F,width:B-O,height:N-F};return aL($,v),sL($,R),$};for(const v of P){const R=(v.group.members??[]).map(l).filter(F=>!!F);let A;R.length?A=rd(R,v.group.id):(A={x:300+e0*350,y:40,width:300,height:200},e0++);const O=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:v.group.id}),width:A.width,height:A.height},{x:A.x+A.width/2,y:A.y+A.height/2},u());v.group.name&&n.updateLabel(O,v.group.name),(d0=v.group.members)!=null&&d0.length&&L(O,"bwl:Members",{refs:v.group.members.join(" ")})}{const v=o.filter(F=>!!F.waypoints),R=new Map,A=(F,B)=>{!F||!B||(R.has(F)||R.set(F,new Set),R.get(F).add(B))};for(const F of v){const B=(h0=F.source)==null?void 0:h0.id,N=(m0=F.target)==null?void 0:m0.id;A(B,N),((g0=F.type)!=null&&g0.includes("DataOutputAssociation")||(y0=F.type)!=null&&y0.includes("DataInputAssociation")||F.type==="bpmn:Association")&&A(N,B)}const O=o.filter(F=>F.type==="bpmn:Group");for(const F of O){const N=(((v0=F.businessObject.extensionElements)==null?void 0:v0.values)??[]).find(ae=>ae.$type==="bwl:Members"),$=((N==null?void 0:N.refs)??"").split(" ").filter(Boolean);if(!$.length)continue;const G=new Set($),X=[...$];for(;X.length;){const ae=X.shift();for(const ce of R.get(ae)??[])G.has(ce)||(G.add(ce),X.push(ce))}const de=F.x,Re=F.x+F.width,re=F.y,ke=F.y+F.height,xe=ae=>m.filter(ce=>ce.flow.target===ae).length,Pe=ae=>{var ue;const ce=((ue=l(ae))==null?void 0:ue.type)??"";if(ce==="bpmn:StartEvent"&&xe(ae)===0)return!1;if(ce.endsWith("Gateway")){const Ce=m.filter(Qe=>Qe.flow.target===ae).map(Qe=>Qe.flow.source);if(Ce.length&&Ce.every(Qe=>{var et;return((et=l(Qe))==null?void 0:et.type)==="bpmn:StartEvent"&&xe(Qe)===0}))return!1}return!0},ut=o.filter(ae=>jn(ae)).filter(ae=>ae.type!=="bpmn:Group"&&ae.type!=="bpmn:Participant"&&ae.type!=="bpmn:TextAnnotation"&&!G.has(ae.id)&&Kr(ae.id)&&Pe(ae.id)&&ae.x<Re&&ae.x+ae.width>de&&ae.y<ke&&ae.y+ae.height>re);if(ut.length)for(const ae of[-1,1]){const ce=ut.filter(te=>(te.x+te.width-de<=Re-te.x?-1:1)===ae);if(!ce.length)continue;const ue=[];for(const te of ce){const U=ue.find(ne=>ne.some(be=>te.y<be.y+be.height&&te.y+te.height>be.y));U?U.push(te):ue.push([te])}const Ce=new Map;for(const te of ue){let U=ae<0?de-Zr:Re+Zr;for(const ne of[...te].sort((be,he)=>ae<0?he.x-be.x:be.x-he.x)){const be=ae<0?Math.min(ne.x,U-ne.width):Math.max(ne.x,U);U=ae<0?be-ft:be+ne.width+ft,be!==ne.x&&Math.sign(be-ne.x)===ae&&Ce.set(ne.id,be-ne.x)}}const Qe=new Map,et=te=>Qe.get(te)===te||!Qe.get(te)?te:et(Qe.get(te));for(const te of ce)Qe.set(te.id,te.id);for(const te of _){const U=Ce.has(te.flow.source)?te.flow.source:void 0,ne=Ce.has(te.flow.target)?te.flow.target:void 0;if(!U||!ne)continue;const be=l(te.flow.id);((b0=be==null?void 0:be.waypoints)==null?void 0:b0.length)===2&&Qe.set(et(U),et(ne))}const St=new Map;for(const te of ce){if(!Ce.has(te.id))continue;const U=et(te.id);St.set(U,[...St.get(U)??[],te])}const nn=[...St.values()].sort((te,U)=>ae<0?Math.min(...te.map(ne=>ne.x))-Math.min(...U.map(ne=>ne.x)):Math.max(...U.map(ne=>ne.x))-Math.max(...te.map(ne=>ne.x))),le=[];let Ve=!0;for(const te of nn){const U=te.map(he=>Ce.get(he.id)??0).reduce((he,Me)=>Math.abs(Me)>Math.abs(he)?Me:he,0),ne=new Map;let be=!0;for(const he of te){const Me=p(he);if(!Me){be=!1;break}ne.has(Me.id)||ne.set(Me.id,{subtree:[],pool:Me}),ne.get(Me.id).subtree.push(he)}be&&Tu([...ne.values()],U,()=>!0,Au)?le.push({shapes:te,dx:U}):Ve=!1}if(!Ve)for(const te of le.reverse())n.moveElements(te.shapes,{x:-te.dx,y:0})}}}{const v=new Set([...P.map(R=>R.group.id),...qt(e,"group.update").map(R=>R.id)]);for(const R of o.filter(A=>A.type==="bpmn:Group")){if(v.has(R.id))continue;const O=(((_0=R.businessObject.extensionElements)==null?void 0:_0.values)??[]).find($=>$.$type==="bwl:Members"),F=((O==null?void 0:O.refs)??"").split(" ").filter(Boolean).map(l).filter($=>!!$);!F.length||!F.some($=>{const G=d.get($.id);return!G||G.x!==$.x||G.y!==$.y})||!F.some($=>$.x<R.x||$.y<R.y||$.x+$.width>R.x+R.width||$.y+$.height>R.y+R.height)||n.resizeShape(R,rd(F,R.id))}}{const R=new Map(uo(pt(o)).map($=>[$.owner,$.rect])),A=o.filter($=>!!$.waypoints),O=new Map,F=($,G)=>{!$||!G||(O.has($)||O.set($,new Set),O.get($).add(G))};for(const $ of A){const G=(x0=$.source)==null?void 0:x0.id,X=(w0=$.target)==null?void 0:w0.id;F(G,X),((E0=$.type)!=null&&E0.includes("DataOutputAssociation")||(S0=$.type)!=null&&S0.includes("DataInputAssociation")||$.type==="bpmn:Association")&&F(X,G)}const B=$=>m.filter(G=>G.flow.target===$).length,N=$=>{var X;const G=((X=l($))==null?void 0:X.type)??"";if(G==="bpmn:StartEvent"&&B($)===0)return!1;if(G.endsWith("Gateway")){const de=m.filter(Re=>Re.flow.target===$).map(Re=>Re.flow.source);if(de.length&&de.every(Re=>{var re;return((re=l(Re))==null?void 0:re.type)==="bpmn:StartEvent"&&B(Re)===0}))return!1}return!0};for(const $ of o.filter(G=>G.type==="bpmn:Group")){const X=(((R0=$.businessObject.extensionElements)==null?void 0:R0.values)??[]).find(U=>U.$type==="bwl:Members"),de=((X==null?void 0:X.refs)??"").split(" ").filter(Boolean);if(!de.length)continue;const Re=de.map(l).filter(U=>!!U);if(!Re.length||!(P.some(U=>U.group.id===$.id)||qt(e,"group.update").some(U=>U.id===$.id)||Re.some(U=>{const ne=d.get(U.id);return!ne||ne.x!==U.x||ne.y!==U.y})))continue;const ke=new Set(de),xe=[...de];for(;xe.length;){const U=xe.shift();for(const ne of O.get(U)??[])ke.has(ne)||(ke.add(ne),xe.push(ne))}const Pe=$.x,ut=$.x+$.width,ae=$.y,ce=$.y+$.height,ue=U=>{const ne=R.get(U.id),be={x:U.x,y:U.y,width:U.width,height:U.height};return ne?[be,{x:ne.x,y:ne.y,width:ne.width,height:ne.height}]:[be]},Ce=Re.flatMap(ue),Qe=Math.min(...Ce.map(U=>U.x)),et=Math.max(...Ce.map(U=>U.x+U.width)),St=Math.min(...Ce.map(U=>U.y)),nn=Math.max(...Ce.map(U=>U.y+U.height)),le={L:Qe-Pe,R:ut-et,T:St-ae,B:ce-nn},Ve=o.filter(U=>jn(U)).filter(U=>U.type!=="bpmn:Group"&&U.type!=="bpmn:Participant"&&U.type!=="bpmn:TextAnnotation"&&!ke.has(U.id)&&N(U.id)&&U.x<ut&&U.x+U.width>Pe&&U.y<ce&&U.y+U.height>ae);if(!Ve.length)continue;const te={L:0,R:0,T:0,B:0};for(const U of Ve){const ne=ue(U),be=Math.min(...ne.map(mt=>mt.x)),he=Math.max(...ne.map(mt=>mt.x+mt.width)),Me=Math.min(...ne.map(mt=>mt.y)),nt=Math.max(...ne.map(mt=>mt.y+mt.height)),Vt={L:he-Pe,R:ut-be,T:nt-ae,B:ce-Me},ci=["L","R","T","B"].filter(mt=>Vt[mt]<=le[mt]+.001);if(!ci.length)continue;const Pt=ci.reduce((mt,ts)=>Vt[ts]<Vt[mt]?ts:mt,ci[0]);te[Pt]=Math.max(te[Pt],Math.min(Vt[Pt]+10,le[Pt]))}!te.L&&!te.R&&!te.T&&!te.B||n.resizeShape($,{x:$.x+te.L,y:$.y+te.T,width:$.width-te.L-te.R,height:$.height-te.T-te.B})}}const n0=v=>{const R=v.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=v;return{x:A.x,y:A.y,width:A.width,height:A.height}};let es=0;const i0=12,r0=14,cL=15,uL=300,lL=v=>{const R=v.split(`
7
+ `),A=Math.max(...R.map(B=>ao(B,i0))),O=Math.max(100,Math.min(uL,Math.ceil(A)+r0)),F=R.reduce((B,N)=>B+Math.max(1,Math.ceil((ao(N,i0)+r0)/O)),0);return{width:O,height:Math.max(30,F*cL+10)}};for(const v of S){const R=v.association,A=((C0=v.placement)==null?void 0:C0.anchor)??(R?R.source===v.annotation.id?R.target:R.source:void 0),O=A?l(A):void 0,F=O?n0(O):void 0,B=lL(v.annotation.text??"");let N;if(F&&v.placement){const[de,Re]=_s[v.placement.side],re=v.placement.offset??50;N={x:F.x+F.width/2+de*(F.width/2+B.width/2+re),y:F.y+F.height/2+Re*(F.height/2+B.height/2+re)}}else F?(N={x:F.x+F.width/2+180+es%3*260,y:F.y-110-es%2*95},es++):(N={x:300+es*260,y:60},es++);const $=O?p(O)??u():u(),G=$;F&&typeof G.x=="number"&&typeof G.width=="number"&&G.type==="bpmn:Participant"&&(N=cl(o,F,B,G,v.placement?{placement:v.placement}:{from:N}));const X=n.createShape({type:"bpmn:TextAnnotation",width:B.width,height:B.height,businessObject:i.create("bpmn:TextAnnotation",{id:v.annotation.id,text:v.annotation.text})},N,$);if(R){const de=Re=>Re===v.annotation.id?X:f(Re);n.connect(de(R.source),de(R.target),R.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:R.id})}:{type:"bpmn:Association"})}v.placement&&L(X,"bwl:Placement",T(v.placement))}for(const v of qt(e,"association.add")){const R=v.association;n.connect(f(R.source),f(R.target),R.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:R.id})}:{type:"bpmn:Association"})}for(const v of qt(e,"node.update")){let R=f(v.id);if(v.type&&bs(v.type)!==R.type&&(R=c.replaceElement(R,{type:bs(v.type)})),v.name!==void 0&&n.updateProperties(R,{name:v.name??void 0}),v.lane||v.band!==void 0){v.band!==void 0&&n.updateProperties(R,{"bwl:band":v.band});const A=R.y+R.height/2,O=p(R),F=v.lane?f(v.lane):((O==null?void 0:O.children)??[]).find(N=>N.type==="bpmn:Lane"&&A>=N.y&&A<=N.y+N.height);v.band!==void 0&&Q(F==null?void 0:F.id,v.band,O);const B=F?F.y+(v.band===void 0?F.height/2:Math.min(F.height/2,se)+M(F.id,v.band)*k):v.band!==void 0&&O?O.y+z+M(`pool:${O.id}`,v.band)*k:void 0;if(B!==void 0){const N=B-A;N!==0&&n.moveElements([R],{x:0,y:N})}}}for(const v of qt(e,"sequenceFlow.update")){const R=f(v.id);if(v.source!==void 0||v.target!==void 0){const A=R,O=v.source!==void 0?f(v.source):A.source,F=v.target!==void 0?f(v.target):A.target,B=N=>({x:N.x+N.width/2,y:N.y+N.height/2});n.reconnect(A,O,F,[B(O),B(F)])}v.name!==void 0&&n.updateProperties(R,{name:v.name??void 0}),v.condition!==void 0&&n.updateProperties(R,{name:((P0=v.condition)==null?void 0:P0.label)??void 0})}for(const v of qt(e,"messageFlow.update"))v.name!==void 0&&n.updateProperties(f(v.id),{name:v.name??void 0});for(const v of qt(e,"dataStore.update"))v.name!==void 0&&n.updateProperties(f(v.id),{name:v.name??void 0});for(const v of qt(e,"annotation.update")){const R=f(v.id);if(v.text!==void 0&&n.updateProperties(R,{text:v.text}),v.placement===null)L(R,"bwl:Placement",null);else if(v.placement){const A=f(v.placement.anchor),O=n0(A),F=p(A)??u(),B=typeof F.x=="number"&&typeof F.width=="number"&&F.type==="bpmn:Participant",[N,$]=_s[v.placement.side],G=v.placement.offset??50,X={x:O.x+O.width/2+N*(O.width/2+R.width/2+G),y:O.y+O.height/2+$*(O.height/2+R.height/2+G)},de=B?cl(o,O,{width:R.width,height:R.height},F,{placement:v.placement,selfId:v.id}):X;n.moveElements([R],{x:de.x-(R.x+R.width/2),y:de.y-(R.y+R.height/2)}),L(R,"bwl:Placement",T(v.placement))}}for(const v of qt(e,"group.update")){const R=f(v.id);if(v.name!==void 0&&n.updateLabel(R,v.name??""),v.members){const A=v.members.map(l).filter(O=>!!O);A.length&&n.resizeShape(R,rd(A,v.id)),L(R,"bwl:Members",{refs:v.members.join(" ")})}}}function ul(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 l1(e,t,n){var l,f;const{elementRegistry:i}=e,r=e.modeling,o=p=>Vn(p).filter(d=>!t.has(oi(d))),a=p=>{var d;return((d=i.get(p))==null?void 0:d.type)==="bpmn:TextAnnotation"},s=pt(i),c=o(s),u=[...new Set(c.flatMap(ul))].filter(p=>n.has(p)&&a(p));if(u.length)for(const p of u){const d=i.get(p);if(!d||typeof d.x!="number"||typeof d.width!="number")continue;let g=d.parent,h;for(;g;){if(g.type==="bpmn:Participant"){h=g;break}g=g.parent}if(!h){const Se=d.x+d.width/2,qe=d.y+d.height/2;h=i.getAll().find(K=>{if(K.type!=="bpmn:Participant")return!1;const fe=K;return typeof fe.x=="number"&&typeof fe.width=="number"&&Se>=fe.x&&Se<=fe.x+fe.width&&qe>=fe.y&&qe<=fe.y+fe.height})}if(!h||typeof h.x!="number"||typeof h.width!="number")continue;const _=(((l=d.businessObject.extensionElements)==null?void 0:l.values)??[]).find(Se=>Se.$type==="bwl:Placement"),y=[...d.incoming??[],...d.outgoing??[]].find(Se=>Se.type==="bpmn:Association"),x=(_!=null&&_.anchor?i.get(_.anchor):void 0)??(y?((f=y.source)==null?void 0:f.id)===p?y.target:y.source:void 0);if(!x)continue;const S=x.waypoints,P=S!=null&&S.length?{x:S[Math.floor((S.length-1)/2)].x,y:S[Math.floor((S.length-1)/2)].y,width:0,height:0}:{x:x.x,y:x.y,width:x.width,height:x.height},C={width:d.width,height:d.height},L={x:d.x+d.width/2,y:d.y+d.height/2},T=_==null?void 0:_.side,j=[];T&&T in _s&&j.push(cl(i,P,C,h,{placement:{side:T,offset:(_==null?void 0:_.offset)??null},selfId:p}));for(const[Se,qe]of[[-1,0],[1,0],[0,-1],[0,1]])for(let K=1;K<=u1;K++)j.push({x:L.x+Se*Mh*K,y:L.y+qe*Mh*K});const k={...s,edges:s.edges.filter(Se=>Se.id!==(y==null?void 0:y.id))},D=o(k),z=D.filter(Se=>ul(Se).includes(p)).length;if(!z)continue;let se;for(const Se of j){const qe=Se.x-L.x,K=Se.y-L.y;if(!qe&&!K||Se.x-C.width/2<h.x||Se.x+C.width/2>h.x+h.width||Se.y-C.height/2<h.y||Se.y+C.height/2>h.y+h.height)continue;const fe={...k,shapes:k.shapes.map(pe=>pe.id===p?{...pe,x:pe.x+qe,y:pe.y+K}:pe)},we=o(fe),me=we.filter(pe=>ul(pe).includes(p)).length;if(me>=z||we.length>D.length)continue;const Ee=Math.abs(qe)+Math.abs(K);if((!se||me<se.mine||me===se.mine&&(we.length<se.all||we.length===se.all&&Ee<se.dist))&&(se={x:Se.x,y:Se.y,mine:me,all:we.length,dist:Ee}),se.mine===0&&se.all<D.length)break}se&&r.moveElements([d],{x:se.x-L.x,y:se.y-L.y})}}function Oh(e,t,n=kh){const i=Th(e),r=Ah(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=pt(i.elementRegistry),s=new Set(Vn(a).map(oi)),c=new Set(a.edges.map(h=>h.id)),u=new Set(a.shapes.map(h=>h.id)),l=tl(a).length,f=e.get("commandStack");try{ud(f,()=>{n(t,i),uh(i,c),ah(i,s),bh(i,s,c),fh(i,c),e1(i,c),mh(i,s,c),r1(i,s,c),Eh(i,s,c),wh(i,c),Rh(i,u),l1(i,s,u)})}catch(h){return{ok:!1,issues:[{kind:"lower-failed",message:h instanceof Error?h.message:String(h)}],findings:[],stats:o}}const p=pt(i.elementRegistry),d=Vn(p).filter(h=>!s.has(oi(h))),g=Ud(p);return{ok:!0,issues:[],findings:d,stats:{edgeCrossings:{before:l,after:g.pairs.length,pairs:g.pairs,solidPairs:g.solidPairs,dashedPairs:g.dashedPairs,mixedPairs:g.mixedPairs,crossPoolMessages:g.crossPoolMessages}}}}function p1(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function f1(e,t){return typeof e.get=="function"?e.get(t):e[t]}function Dh(e,t){const n=f1(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Lh(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function d1(e){return typeof e=="string"&&ku.includes(e)}function di(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function Ih(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=[],u=[],l={poolOrders:{},bands:{},placements:{}},f=[],p=[],d=[],g=[],h=[],m=[],_=new Set,y=new Set,x=K=>{K&&_.add(K)},S=K=>{_.add(K),y.add(K)},P=K=>{const fe=Lh(K,"bwl:Placement");if(!fe)return;const we=typeof fe.anchor=="string"?fe.anchor:void 0;if(!we||!d1(fe.side))return;const me=typeof fe.offset=="number"?fe.offset:void 0;h.push({owner:K.id,anchor:we,side:fe.side,...me!==void 0?{offset:me}:{}})},C=K=>{const fe=Lh(K,"bwl:Members"),we=typeof(fe==null?void 0:fe.refs)=="string"?fe.refs.split(/\s+/).filter(Boolean):[];we.length&&m.push({owner:K.id,refs:we})},L=K=>{var fe;for(const we of K)switch(x(we.id),we.$type){case"bpmn:TextAnnotation":S(we.id),s.push({id:we.id,text:typeof we.text=="string"?we.text:""}),P(we);break;case"bpmn:Association":d.push({id:we.id,type:we.$type,source:di(we.sourceRef),target:di(we.targetRef)});break;case"bpmn:Group":{S(we.id);const me=(fe=we.categoryValueRef)==null?void 0:fe.value;c.push({id:we.id,...typeof me=="string"&&me?{name:me}:{}}),C(we);break}default:u.push({id:we.id,type:we.$type,reason:"type-outside-mvp"})}},T=(K,fe)=>{const we=K.flowElements??[],me=(K.laneSets??[]).flatMap(pe=>pe.lanes??[]),Ee=new Map;for(const pe of me){x(pe.id);for(const q of pe.flowNodeRef??[]){const Y=di(q);Y&&Ee.set(Y,pe.id)}}for(const pe of we){if(x(pe.id),pe.$type==="bpmn:SequenceFlow"){f.push({id:pe.id,source:di(pe.sourceRef),target:di(pe.targetRef),...typeof pe.name=="string"&&pe.name?{name:pe.name}:{}});continue}if(pe.$type==="bpmn:DataStoreReference"){S(pe.id),a.push({id:pe.id,...pe.name?{name:pe.name}:{}});continue}const q=p1(pe.$type);if(!od(q)){u.push({id:pe.id,type:pe.$type,reason:"type-outside-mvp"});continue}S(pe.id),o.push({id:pe.id,type:q,...pe.name?{name:pe.name}:{},...fe?{participant:fe}:{},...Ee.has(pe.id)?{lane:Ee.get(pe.id)}:{}});const Y=Dh(pe,"bwl:band");Y!==void 0&&(l.bands[pe.id]=Y);for(const Z of pe.dataOutputAssociations??[])x(Z.id),g.push({id:Z.id,type:Z.$type,source:pe.id,target:di(Z.targetRef)});for(const Z of pe.dataInputAssociations??[])x(Z.id),g.push({id:Z.id,type:Z.$type,source:di((Z.sourceRef??[])[0]),target:pe.id})}L(K.artifacts??[])};if(n){const K=new Set;for(const fe of n.participants??[]){S(fe.id);const we=di(fe.processRef);we&&K.add(we);const me=we?i.get(we):void 0,Ee=((me==null?void 0:me.laneSets)??[]).flatMap(Z=>Z.lanes??[]),pe=Ee.map(Z=>({id:Z.id,...Z.name?{name:Z.name}:{}}));for(const Z of pe)S(Z.id);const q=!me||(me.flowElements??[]).length===0&&Ee.length===0&&(me.artifacts??[]).length===0;r.push({id:fe.id,...fe.name?{name:fe.name}:{},...q?{blackBox:!0}:{},...pe.length?{lanes:pe}:{}});const Y=Dh(fe,"bwl:poolOrder");Y!==void 0&&(l.poolOrders[fe.id]=Y),me&&T(me,fe.id)}for(const fe of n.messageFlows??[])x(fe.id),p.push({id:fe.id,source:di(fe.sourceRef),target:di(fe.targetRef),...typeof fe.name=="string"&&fe.name?{name:fe.name}:{}});L(n.artifacts??[]);for(const[fe,we]of i)!K.has(fe)&&(we.flowElements??[]).length>0&&u.push({id:fe,type:we.$type,reason:"unreachable-process"})}else for(const K of i.values())T(K);const j=[],k=[],D=[],z=[],se=(K,fe)=>!!K&&!!fe&&y.has(K)&&y.has(fe);for(const K of f){if(!se(K.source,K.target)){u.push({id:K.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}j.push({id:K.id,source:K.source,target:K.target,...K.name?{name:K.name}:{}}),y.add(K.id)}for(const K of p){if(!se(K.source,K.target)){u.push({id:K.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}k.push({id:K.id,source:K.source,target:K.target,...K.name?{name:K.name}:{}}),y.add(K.id)}for(const K of g){if(!se(K.source,K.target)){u.push({id:K.id??"",type:K.type,reason:"endpoint-outside-mvp"});continue}z.push({...K.id?{id:K.id}:{},source:K.source,target:K.target}),K.id&&y.add(K.id)}for(const K of d){if(!se(K.source,K.target)){u.push({id:K.id??"",type:K.type,reason:"endpoint-outside-mvp"});continue}D.push({...K.id?{id:K.id}:{},source:K.source,target:K.target})}const Se=new Map(c.map(K=>[K.id,K]));for(const{owner:K,refs:fe}of m){const we=fe.filter(Ee=>_.has(Ee)),me=Se.get(K);me&&we.length&&(me.members=we)}for(const K of h)_.has(K.anchor)&&(l.placements[K.owner]={anchor:K.anchor,side:K.side,...K.offset!==void 0?{offset:K.offset}:{}});return{definition:{...r.length?{participants:r}:{},nodes:o,sequenceFlows:j,...k.length?{messageFlows:k}:{},...a.length?{dataStores:a}:{},...z.length?{dataAssociations:z}:{},...s.length?{annotations:s}:{},...D.length?{associations:D}:{},...c.length?{groups:c}:{}},hints:l,omitted:u}}async function h1(e){const{definitions:t,warnings:n}=await Yu(e);return{...Ih(t),warnings:n}}function m1(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function Bh(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=Oh(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 g1=Symbol("bpmn-editor");function y1(){const e=Mt.ref(!1),t=Mt.ref(!0),n=Mt.ref(!1);let i,r;const o=()=>{e.value=!0};function a(u,l){u.get("canvas").getContainer().style.pointerEvents=l?"":"none";const f=u.get("keyboard");l?(r&&f.bind(r),r=void 0):r||(r=f.getBinding(),f.unbind())}function s(){if(!i)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return i}function c(){return i==null?void 0:i.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,attach(u){i&&this.detach(),i=u,i.get("eventBus").on("commandStack.changed",o),t.value||a(i,!1)},detach(){i==null||i.get("eventBus").off("commandStack.changed",o),i&&!t.value&&a(i,!0),r=void 0,i=void 0},setEditable(u){t.value=u,i&&a(i,u)},async applyAgentBatch(u,l){const f=s();n.value=!0;try{const p=await Bh(f,u,{currentVersion:l});return p.status==="applied"&&(e.value=!1),p}finally{n.value=!1}},async importXml(u){const{warnings:l}=await s().importXML(u);return e.value=!1,{warnings:Ku(l)}},async saveXml(){const{xml:u}=await s().saveXML({format:!0});return e.value=!1,u??""},undo:()=>{var u;return(u=c())==null?void 0:u.undo()},redo:()=>{var u;return(u=c())==null?void 0:u.redo()},canUndo:()=>{var u;return((u=c())==null?void 0:u.canUndo())??!1},canRedo:()=>{var u;return((u=c())==null?void 0:u.canRedo())??!1}}}function ye(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function v1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ll={exports:{}},Nh;function b1(){if(Nh)return ll.exports;Nh=1;var e=ll.exports=function(t,n){if(n||(n=16),t===void 0&&(t=128),t<=0)return"0";for(var i=Math.log(Math.pow(2,t))/Math.log(n),r=2;i===1/0;r*=2)i=Math.log(Math.pow(2,t/r))/Math.log(n)*r;for(var o=i-Math.floor(i),a="",r=0;r<Math.floor(i);r++){var s=Math.floor(Math.random()*n).toString(n);a=s+a}if(o){var c=Math.pow(n,o),s=Math.floor(Math.random()*c).toString(n);a=s+a}var u=parseInt(a,n);return u!==1/0&&u>=Math.pow(2,t)?e(t,n):a};return e.rack=function(t,n,i){var r=function(a){var s=0;do{if(s++>10)if(i)t+=i;else throw new Error("too many ID collisions, use more bits");var c=e(t,n)}while(Object.hasOwnProperty.call(o,c));return o[c]=a,c},o=r.hats={};return r.get=function(a){return r.hats[a]},r.set=function(a,s){return r.hats[a]=s,r},r.bits=t||128,r.base=n||16,r},ll.exports}var _1=b1(),x1=v1(_1);function hi(e){if(!(this instanceof hi))return new hi(e);e=e||[128,36,1],this._seed=e.length?x1.rack(e[0],e[1],e[2]):e}hi.prototype.next=function(e){return this._seed(e||!0)},hi.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},hi.prototype.claim=function(e,t){this._seed.set(e,t||!0)},hi.prototype.assigned=function(e){return this._seed.get(e)||!1},hi.prototype.unclaim=function(e){delete this._seed.hats[e]},hi.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const $t={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};$t.td=$t.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],$t.option=$t.optgroup=[1,'<select multiple="multiple">',"</select>"],$t.thead=$t.tbody=$t.colgroup=$t.caption=$t.tfoot=[1,"<table>","</table>"],$t.polyline=$t.ellipse=$t.polygon=$t.circle=$t.text=$t.line=$t.path=$t.rect=$t.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function ht(e,t=globalThis.document){var u;if(typeof e!="string")throw new TypeError("String expected");const n=/^<!--(.*?)-->$/s.exec(e);if(n)return t.createComment(n[1]);const i=(u=/<([\w:]+)/.exec(e))==null?void 0:u[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const l=t.createElement("html");l.innerHTML=e;const{lastChild:f}=l;return f.remove(),f}let[r,o,a]=Object.hasOwn($t,i)?$t[i]:$t._default,s=t.createElement("div");for(s.innerHTML=o+e+a;r--;)s=s.lastChild;if(s.firstChild===s.lastChild){const{firstChild:l}=s;return l.remove(),l}const c=t.createDocumentFragment();return c.append(...s.childNodes),c}function w1(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 hn(e,...t){const n=e.style;return I(t,function(i){i&&I(i,function(r,o){n[o]=r})}),e}function sn(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const E1=Object.prototype.toString;function vt(e){return new Zi(e)}function Zi(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Zi.prototype.add=function(e){return this.list.add(e),this},Zi.prototype.remove=function(e){return E1.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Zi.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},Zi.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Zi.prototype.array=function(){return Array.from(this.list)},Zi.prototype.has=Zi.prototype.contains=function(e){return this.list.contains(e)};function xs(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function kr(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function S1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ws={},$h;function R1(){if($h)return ws;$h=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return ws.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},ws.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},ws}var Fh=R1(),C1=S1(Fh),Be=w1({__proto__:null,default:C1},[Fh]),jh=["focus","blur"];function P1(e,t,n,i,r){return jh.indexOf(n)!==-1&&(r=!0),Be.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=kr(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function A1(e,t,n,i){return jh.indexOf(t)!==-1&&(i=!0),Be.unbind(e,t,n,i)}var Rn={bind:P1,unbind:A1};function pl(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function rt(e,t){return t=t||document,t.querySelector(e)}function Es(e,t){return t=t||document,t.querySelectorAll(e)}function mi(e){e.parentNode&&e.parentNode.removeChild(e)}function T1(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function M1(e,t){return t.appendChild(T1(e,t))}function Ne(e,t){return M1(t,e),e}var fl=2,Hh={"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":fl,"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":fl,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function k1(e,t){return Hh[t]?e.style[t]:e.getAttributeNS(null,t)}function zh(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=Hh[i];r?(r===fl&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function O1(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)zh(e,r,t[r])}function ve(e,t,n){if(typeof t=="string")if(n!==void 0)zh(e,t,n);else return k1(e,t);else O1(e,t);return e}const D1=Object.prototype.toString;function Ye(e){return new Qi(e)}function Qi(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Qi.prototype.add=function(e){return this.list.add(e),this},Qi.prototype.remove=function(e){return D1.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Qi.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},Qi.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Qi.prototype.array=function(){return Array.from(this.list)},Qi.prototype.has=Qi.prototype.contains=function(e){return this.list.contains(e)};function Ss(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Gh(e){return e.cloneNode(!0)}var dl={svg:"http://www.w3.org/2000/svg"},Vh='<svg xmlns="'+dl.svg+'"';function L1(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(dl.svg)===-1&&(e=Vh+e.substring(4)):(e=Vh+">"+e+"</svg>",t=!0);var n=I1(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function I1(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function Ae(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=L1(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(dl.svg,e),t&&ve(n,t),n}var hl=null;function Wh(){return hl===null&&(hl=Ae("svg")),hl}function Uh(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function B1(e,t,n,i,r,o){var a=Wh().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return Uh(a,e);case 6:return Uh(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function Qo(e){return Wh().createSVGTransform()}var qh=/([&<>]{1})/g,N1=/([&<>\n\r"]{1})/g,$1={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function ml(e,t){function n(i,r){return $1[r]||r}return e.replace(t,n)}function Yh(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(ml(e.textContent,qh));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,'="',ml(o.value,N1),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)Yh(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",ml(e.nodeValue,qh),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function F1(e){for(var t=e.firstChild,n=[];t;)Yh(t,n),t=t.nextSibling;return n.join("")}function Kh(e,t){return F1(e)}function Ft(e){var t=e.parentNode;return t&&t.removeChild(e),e}function j1(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function H1(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(j1(e,i))}function Jo(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),H1(n,t)),n.consolidate()}const z1=/^class[ {]/;function G1(e){return z1.test(e.toString())}function gl(e){return Array.isArray(e)}function yl(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Rs(...e){e.length===1&&gl(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const V1=/constructor\s*[^(]*\(\s*([^)]*)\)/m,W1=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,U1=/\/\*([^*]*)\*\//m;function q1(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(G1(e)?V1:W1);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(U1);return(r&&r[1]||i).trim()})||[]}function Xh(e,t){const n=t||{get:function(x,S){if(i.push(x),S===!1)return null;throw s(`No provider for "${x}"!`)}},i=[],r=this._providers=Object.create(n._providers||null),o=this._instances=Object.create(null),a=o.injector=this,s=function(x){const S=i.join(" -> ");return i.length=0,new Error(S?`${x} (Resolving: ${S})`:x)};function c(x,S){if(!r[x]&&x.includes(".")){const P=x.split(".");let C=c(P.shift());for(;P.length;)C=C[P.shift()];return C}if(yl(o,x))return o[x];if(yl(r,x)){if(i.indexOf(x)!==-1)throw i.push(x),s("Cannot resolve circular dependency!");return i.push(x),o[x]=r[x][0](r[x][1]),i.pop(),o[x]}return n.get(x,S)}function u(x,S){if(typeof S>"u"&&(S={}),typeof x!="function")if(gl(x))x=Rs(x.slice());else throw s(`Cannot invoke "${x}". Expected a function!`);const C=(x.$inject||q1(x)).map(L=>yl(S,L)?S[L]:c(L));return{fn:x,dependencies:C}}function l(x){const{fn:S,dependencies:P}=u(x),C=Function.prototype.bind.call(S,null,...P);return new C}function f(x,S,P){const{fn:C,dependencies:L}=u(x,P);return C.apply(S,L)}function p(x){return Rs(S=>x.get(S))}function d(x,S){if(S&&S.length){const P=Object.create(null),C=Object.create(null),L=[],T=[],j=[];let k,D,z,se;for(let Se in r)k=r[Se],S.indexOf(Se)!==-1&&(k[2]==="private"?(D=L.indexOf(k[3]),D===-1?(z=k[3].createChild([],S),se=p(z),L.push(k[3]),T.push(z),j.push(se),P[Se]=[se,Se,"private",z]):P[Se]=[j[D],Se,"private",T[D]]):P[Se]=[k[2],k[1]],C[Se]=!0),(k[2]==="factory"||k[2]==="type")&&k[1].$scope&&S.forEach(qe=>{k[1].$scope.indexOf(qe)!==-1&&(P[Se]=[k[2],k[1]],C[qe]=!0)});S.forEach(Se=>{if(!C[Se])throw new Error('No provider for "'+Se+'". Cannot use provider from the parent!')}),x.unshift(P)}return new Xh(x,a)}const g={factory:f,type:l,value:function(x){return x}};function h(x,S){const P=x.__init__||[];return function(){P.forEach(C=>{typeof C=="string"?S.get(C):S.invoke(C)})}}function m(x){const S=x.__exports__;if(S){const P=x.__modules__,C=Object.keys(x).reduce((D,z)=>(z!=="__exports__"&&z!=="__modules__"&&z!=="__init__"&&z!=="__depends__"&&(D[z]=x[z]),D),Object.create(null)),L=(P||[]).concat(C),T=d(L),j=Rs(function(D){return T.get(D)});S.forEach(function(D){r[D]=[j,D,"private",T]});const k=(x.__init__||[]).slice();return k.unshift(function(){T.init()}),x=Object.assign({},x,{__init__:k}),h(x,T)}return Object.keys(x).forEach(function(P){if(P==="__init__"||P==="__depends__")return;const C=x[P];if(C[2]==="private"){r[P]=C;return}const L=C[0],T=C[1];r[P]=[g[L],Y1(L,T),L]}),h(x,a)}function _(x,S){return x.indexOf(S)!==-1||(x=(S.__depends__||[]).reduce(_,x),x.indexOf(S)!==-1)?x:x.concat(S)}function y(x){const S=x.reduce(_,[]).map(m);let P=!1;return function(){P||(P=!0,S.forEach(C=>C()))}}this.get=c,this.invoke=f,this.instantiate=l,this.createChild=d,this.init=y(e)}function Y1(e,t){return e!=="value"&&gl(t)&&(t=Rs(t.slice())),t}var K1=1e3;function ki(e,t){var n=this;t=t||K1,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)})}ki.prototype.canRender=function(e){},ki.prototype.drawShape=function(e,t){},ki.prototype.drawConnection=function(e,t){},ki.prototype.getShapePath=function(e){},ki.prototype.getConnectionPath=function(e){};function Or(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function X1(e){return["M",e.x,e.y]}function vl(e){return["L",e.x,e.y]}function Z1(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function Q1(e,t){const n=e.length,i=[X1(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(vl(a));continue}const c=Math.min(t,bl(a.x-o.x,a.y-o.y),bl(s.x-a.x,s.y-a.y));if(!c){i.push(vl(a));continue}const u=Cs(a,o,c),l=Cs(a,o,c*.5),f=Cs(a,s,c),p=Cs(a,s,c*.5);i.push(vl(u)),i.push(Z1(l,p,f))}return i}function Cs(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=bl(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function bl(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function ea(e,t,n){Ie(t)&&(n=t,t=null),t||(t={});const i=Ae("path",t);return Ie(n)&&(i.dataset.cornerRadius=String(n)),_l(i,e)}function _l(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return ve(e,{d:Or(Q1(t,n))}),e}function Ps(e){var t=new Set(e);return Ge(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function Dr(e,t,n){n=n||0,Oe(e)||(e=[e]),I(e,function(i,r){var o=t(i,r,n);Oe(o)&&o.length&&Dr(o,t,n+1)})}function xl(e,t,n){var i=new Set,r=new Set;return Dr(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 ta(e,t){return xl(e)}function J1(e,t,n){Cr(t)&&(t=!0),Wt(t)&&(n=t,t=!0),n=n||{};var i=na(n.allShapes),r=na(n.allConnections),o=na(n.enclosedElements),a=na(n.enclosedConnections),s=na(n.topLevel,t&&to(e,function(l){return l.id}));function c(l){s[l.source.id]&&s[l.target.id]&&(s[l.id]=[l]),i[l.source.id]&&i[l.target.id]&&(a[l.id]=o[l.id]=l),r[l.id]=l}function u(l){if(o[l.id]=l,l.waypoints)a[l.id]=r[l.id]=l;else return i[l.id]=l,I(l.incoming,c),I(l.outgoing,c),l.children}return Dr(e,u),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function kt(e,t){t=!!t,Oe(e)||(e=[e]);var n,i,r,o;return I(e,function(a){var s=a;a.waypoints&&!t&&(s=kt(a.waypoints,!0));var c=s.x,u=s.y,l=s.height||0,f=s.width||0;(c<n||n===void 0)&&(n=c),(u<i||i===void 0)&&(i=u),(c+f>r||r===void 0)&&(r=c+f),(u+l>o||o===void 0)&&(o=u+l)}),{x:n,y:i,height:o-i,width:r-n}}function fo(e,t){var n={};return I(e,function(i){var r=i;r.waypoints&&(r=kt(r)),!Ie(t.y)&&r.x>t.x&&(n[i.id]=i),!Ie(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(Ie(t.width)&&Ie(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!Ie(t.width)||!Ie(t.height))&&(n[i.id]=i)}),n}function Zh(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function Qh(e){return!!(e&&e.isFrame)}function na(e,t){return V({},e||{},t||{})}var eS=1;function Ji(e,t){ki.call(this,e,eS),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})}ye(Ji,ki),Ji.prototype.canRender=function(){return!0},Ji.prototype.drawShape=function(t,n,i){var r=Ae("rect");return ve(r,{x:0,y:0,width:n.width||0,height:n.height||0}),Qh(n)?ve(r,V({},this.FRAME_STYLE,i||{})):ve(r,V({},this.SHAPE_STYLE,i||{})),Ne(t,r),r},Ji.prototype.drawConnection=function(t,n,i){var r=ea(n.waypoints,V({},this.CONNECTION_STYLE,i||{}));return Ne(t,r),r},Ji.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 Or(a)},Ji.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 Or(o)},Ji.$inject=["eventBus","styles"];function tS(){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 V(o,{class:n})},this.style=function(n,i){!Oe(n)&&!i&&(i=n,n=[]);var r=En(n,function(o,a){return V(o,e[a]||{})},{});return i?V(r,i):r},this.computeStyle=function(n,i,r){return Oe(i)||(r=i,i=[]),t.style(i||[],V({},r,n||{}))}}const nS={__init__:["defaultRenderer"],defaultRenderer:["type",Ji],styles:["type",tS]};function Ct(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function At(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 wl(e,t){return!e||!t?-1:e.indexOf(t)}function ia(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function El(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=ia(e,t);return Math.abs(r/o)<=i}var iS=2;function Oi(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(rS(r,n))return o;return!1}function rS(e,t){const n=t[0];return Pr(t,function(i){return Math.abs(n[e]-i[e])<=iS})}function Jh(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 Sl(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var oS=/,?([a-z]),?/gi,em=parseFloat,Ot=Math,er=Ot.PI,gi=Ot.min,yi=Ot.max,tm=Ot.pow,tr=Ot.abs,aS=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,sS=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,nm=Array.isArray||function(e){return e instanceof Array};function cS(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function uS(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 lS(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 cS(r,i)?(uS(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function pS(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(aS,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(sS,function(c,u){u&&a.push(+u)}),s=="m"&&a.length>2&&(n.push([r,...a.splice(0,2)]),s="l",r=r=="m"?"l":"L");a.length>=t[s]&&(n.push([r,...a.splice(0,t[s])]),!!t[s]););}),n.toString=Cl,n}function fS(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 dS(e){for(var t=0,n=e.length;t<n;t++){var i=e[t][0];if(i!=="M"&&i!=="C")return!1}return!0}function Rl(e,t,n,i){return arguments.length===1&&(t=e.y,n=e.width,i=e.height,e=e.x),{x:e,y:t,width:n,height:i,x2:e+n,y2:t+i}}function Cl(){return this.join(",").replace(oS,"$1")}function hS(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=Cl,t}function im(e,t,n,i,r,o,a,s,c){var u=1-c,l=tm(u,3),f=tm(u,2),p=c*c,d=p*c,g=l*e+f*3*c*n+u*3*c*c*r+d*a,h=l*t+f*3*c*i+u*3*c*c*o+d*s;return{x:As(g),y:As(h)}}function rm(e){var t=_S(...e);return Rl(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function nr(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function mS(e,t){return e=Rl(e),t=Rl(t),nr(t,e.x,e.y)||nr(t,e.x2,e.y)||nr(t,e.x,e.y2)||nr(t,e.x2,e.y2)||nr(e,t.x,t.y)||nr(e,t.x2,t.y)||nr(e,t.x,t.y2)||nr(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 om(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 am(e,t,n,i,r,o,a,s,c){c==null&&(c=1),c=c>1?1:c<0?0:c;for(var u=c/2,l=12,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,g=0;g<l;g++){var h=u*f[g]+u,m=om(h,e,n,r,a),_=om(h,t,i,o,s),y=m*m+_*_;d+=p[g]*Ot.sqrt(y)}return u*d}function gS(e,t,n,i,r,o,a,s){if(!(yi(e,n)<gi(r,a)||gi(e,n)>yi(r,a)||yi(t,i)<gi(o,s)||gi(t,i)>yi(o,s))){var c=(e*i-t*n)*(r-a)-(e-n)*(r*s-o*a),u=(e*i-t*n)*(o-s)-(t-i)*(r*s-o*a),l=(e-n)*(o-s)-(t-i)*(r-a);if(l){var f=As(c/l),p=As(u/l),d=+f.toFixed(2),g=+p.toFixed(2);if(!(d<+gi(e,n).toFixed(2)||d>+yi(e,n).toFixed(2)||d<+gi(r,a).toFixed(2)||d>+yi(r,a).toFixed(2)||g<+gi(t,i).toFixed(2)||g>+yi(t,i).toFixed(2)||g<+gi(o,s).toFixed(2)||g>+yi(o,s).toFixed(2)))return{x:f,y:p}}}}function As(e){return Math.round(e*1e11)/1e11}function yS(e,t,n){var i=rm(e),r=rm(t);if(!mS(i,r))return[];var o=am(...e),a=am(...t),s=cm(e)?1:~~(o/5)||1,c=cm(t)?1:~~(a/5)||1,u=new Array(s+1),l=new Array(c+1),f={},p=[],d,g;for(d=0;d<s+1;d++){var h=im(...e,d/s);u[d]={x:h.x,y:h.y,t:d/s}}for(d=0;d<c+1;d++)h=im(...t,d/c),l[d]={x:h.x,y:h.y,t:d/c};for(d=0;d<s;d++)for(g=0;g<c;g++){var m=u[d],_=u[d+1],y=l[g],x=l[g+1],S=tr(_.x-m.x)<.01?"y":"x",P=tr(x.x-y.x)<.01?"y":"x",C=gS(m.x,m.y,_.x,_.y,y.x,y.y,x.x,x.y),L;if(C){if(L=C.x.toFixed(9)+"#"+C.y.toFixed(9),f[L])continue;f[L]=!0;var T=m.t+tr((C[S]-m[S])/(_[S]-m[S]))*(_.t-m.t),j=y.t+tr((C[P]-y[P])/(x[P]-y[P]))*(x.t-y.t);T>=0&&T<=1&&j>=0&&j<=1&&p.push({x:C.x,y:C.y,t1:T,t2:j})}}return p}function sm(e,t,n){e=pm(e),t=pm(t);for(var i,r,o,a,s,c,u,l,f,p,d=n?0:[],g=0,h=e.length;g<h;g++){var m=e[g];if(m[0]=="M")i=s=m[1],r=c=m[2];else{m[0]=="C"?(f=[i,r,...m.slice(1)],i=f[6],r=f[7]):(f=[i,r,i,r,s,c,s,c],i=s,r=c);for(var _=0,y=t.length;_<y;_++){var x=t[_];if(x[0]=="M")o=u=x[1],a=l=x[2];else{x[0]=="C"?(p=[o,a,...x.slice(1)],o=p[6],a=p[7]):(p=[o,a,o,a,u,l,u,l],o=u,a=l);var S=yS(f,p);{for(var P=0,C=S.length;P<C;P++)S[P].segment1=g,S[P].segment2=_,S[P].bez1=f,S[P].bez2=p;d=d.concat(S)}}}}}return d}function vS(e){return nm(e)&&nm(e[0])}function bS(e){if(fS(e))return e;var t=new Array(e.length),n=0,i=0,r=0,o=0,a=0,s;e[0][0]=="M"&&(n=+e[0][1],i=+e[0][2],r=n,o=i,a++,t[0]=["M",n,i]);for(var c,u,l=a,f=e.length;l<f;l++){if(u=e[l],s=u[0],t[l]=c=new Array(u.length),s!=s.toUpperCase())switch(c[0]=s.toUpperCase(),c[0]){case"A":c[1]=u[1],c[2]=u[2],c[3]=u[3],c[4]=u[4],c[5]=u[5],c[6]=+u[6]+n,c[7]=+u[7]+i;break;case"V":c[1]=+u[1]+i;break;case"H":c[1]=+u[1]+n;break;case"M":r=+u[1]+n,o=+u[2]+i;default:for(var p=1,d=u.length;p<d;p++)c[p]=+u[p]+(p%2?n:i)}else for(var g=0,h=u.length;g<h;g++)c[g]=u[g];switch(s=s.toUpperCase(),c[0]){case"Z":n=+r,i=+o;break;case"H":n=c[1];break;case"V":i=c[1];break;case"M":r=c[c.length-2],o=c[c.length-1];default:n=c[c.length-2],i=c[c.length-1]}}return t.toString=Cl,t}function cm(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Ts(e,t,n,i){return[e,t,n,i,n,i]}function um(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 lm(e,t,n,i,r,o,a,s,c,u){var l=er*120/180,f=er/180*(+r||0),p=[],d,g=lS(function(M,E,b){var H=M*Ot.cos(b)-E*Ot.sin(b),W=M*Ot.sin(b)+E*Ot.cos(b);return{x:H,y:W}});if(u)L=u[0],T=u[1],P=u[2],C=u[3];else{d=g(e,t,-f),e=d.x,t=d.y,d=g(s,c,-f),s=d.x,c=d.y;var h=(e-s)/2,m=(t-c)/2,_=h*h/(n*n)+m*m/(i*i);_>1&&(_=Ot.sqrt(_),n=_*n,i=_*i);var y=n*n,x=i*i,S=(o==a?-1:1)*Ot.sqrt(tr((y*x-y*m*m-x*h*h)/(y*m*m+x*h*h))),P=S*n*m/i+(e+s)/2,C=S*-i*h/n+(t+c)/2,L=Ot.asin(((t-C)/i).toFixed(9)),T=Ot.asin(((c-C)/i).toFixed(9));L=e<P?er-L:L,T=s<P?er-T:T,L<0&&(L=er*2+L),T<0&&(T=er*2+T),a&&L>T&&(L=L-er*2),!a&&T>L&&(T=T-er*2)}var j=T-L;if(tr(j)>l){var k=T,D=s,z=c;T=L+l*(a&&T>L?1:-1),s=P+n*Ot.cos(T),c=C+i*Ot.sin(T),p=lm(s,c,n,i,r,0,a,D,z,[T,k,P,C])}j=T-L;var se=Ot.cos(L),Se=Ot.sin(L),qe=Ot.cos(T),K=Ot.sin(T),fe=Ot.tan(j/4),we=4/3*n*fe,me=4/3*i*fe,Ee=[e,t],pe=[e+we*Se,t-me*se],q=[s+we*K,c-me*qe],Y=[s,c];if(pe[0]=2*Ee[0]-pe[0],pe[1]=2*Ee[1]-pe[1],u)return[pe,q,Y].concat(p);p=[pe,q,Y].concat(p).join().split(",");for(var Z=[],He=0,Kt=p.length;He<Kt;He++)Z[He]=He%2?g(p[He-1],p[He],f).y:g(p[He],p[He+1],f).x;return Z}function _S(e,t,n,i,r,o,a,s){for(var c=[],u=[[],[]],l,f,p,d,g,h,m,_,y=0;y<2;++y){if(y==0?(f=6*e-12*n+6*r,l=-3*e+9*n-9*r+3*a,p=3*n-3*e):(f=6*t-12*i+6*o,l=-3*t+9*i-9*o+3*s,p=3*i-3*t),tr(l)<1e-12){if(tr(f)<1e-12)continue;d=-p/f,0<d&&d<1&&c.push(d);continue}m=f*f-4*p*l,_=Ot.sqrt(m),!(m<0)&&(g=(-f+_)/(2*l),0<g&&g<1&&c.push(g),h=(-f-_)/(2*l),0<h&&h<1&&c.push(h))}for(var x=c.length,S=x,P;x--;)d=c[x],P=1-d,u[0][x]=P*P*P*e+3*P*P*d*n+3*P*d*d*r+d*d*d*a,u[1][x]=P*P*P*t+3*P*P*d*i+3*P*d*d*o+d*d*d*s;return u[0][S]=e,u[1][S]=t,u[0][S+1]=a,u[1][S+1]=s,u[0].length=u[1].length=S+2,{x0:gi(...u[0]),y0:gi(...u[1]),x1:yi(...u[0]),y1:yi(...u[1])}}function pm(e){if(vS(e)||(e=pS(e)),dS(e))return e;for(var t=hS(bS(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(p,d,g){var h,m;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",...lm(d.x,d.y,...p.slice(1))];break;case"S":g=="C"||g=="S"?(h=d.x*2-d.bx,m=d.y*2-d.by):(h=d.x,m=d.y),p=["C",h,m,...p.slice(1)];break;case"T":g=="Q"||g=="T"?(d.qx=d.x*2-d.qx,d.qy=d.y*2-d.qy):(d.qx=d.x,d.qy=d.y),p=["C",...um(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",...um(d.x,d.y,p[1],p[2],p[3],p[4])];break;case"L":p=["C",...Ts(d.x,d.y,p[1],p[2])];break;case"H":p=["C",...Ts(d.x,d.y,p[1],d.y)];break;case"V":p=["C",...Ts(d.x,d.y,d.x,p[1])];break;case"Z":p=["C",...Ts(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 g=p[d];g.length;)o[d]="A",p.splice(d++,0,["C",...g.splice(0,6)]);p.splice(d,1),u=t.length}},o=[],a="",s="",c=0,u=t.length;c<u;c++){t[c]&&(a=t[c][0]),a!="C"&&(o[c]=a,c&&(s=o[c-1])),t[c]=i(t[c],n,s),o[c]!="A"&&a=="C"&&(o[c]="C"),r(t,c);var l=t[c],f=l.length;n.x=l[f-2],n.y=l[f-1],n.bx=em(l[f-4])||n.x,n.by=em(l[f-3])||n.y}return t}function ot(e){return Wt(e)&&wn(e,"waypoints")}function je(e){return Wt(e)&&wn(e,"labelTarget")}function xS(e){return Wt(e)&&Jr(e.parent)}function fm(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function Di(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Te(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Ms(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function wS(e){return Di({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function ES(e){for(var t=e.waypoints,n=t.reduce(function(u,l,f){var p=t[f-1];if(p){var d=u[u.length-1],g=d&&d.endLength||0,h=CS(p,l);u.push({start:p,end:l,startLength:g,endLength:g+h,length:h})}return u},[]),i=n.reduce(function(u,l){return u+l.length},0),r=i/2,o=0,a=n[o];a.endLength<r;)a=n[++o];var s=(r-a.startLength)/a.length,c={x:a.start.x+(a.end.x-a.start.x)*s,y:a.start.y+(a.end.y-a.start.y)*s};return c}function De(e){return ot(e)?ES(e):wS(e)}function Qt(e,t,n){n=n||0,Wt(n)||(n={x:n,y:n});var i=Te(e),r=Te(t),o=i.bottom+n.y<=r.top,a=i.left-n.x>=r.right,s=i.top-n.y>=r.bottom,c=i.right+n.x<=r.left,u=o?"top":s?"bottom":null,l=c?"left":a?"right":null;return l&&u?u+"-"+l:l||u||"intersect"}function ra(e,t,n){var i=SS(e,t);return i.length===1||i.length===2&&ia(i[0],i[1])<1?Di(i[0]):i.length>1?(i=ui(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),Di(i[n?0:i.length-1])):null}function SS(e,t){return sm(e,t)}function RS(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],ia(n,r)===0||El(i,r,n)?e.splice(t,1):t++;return e}function CS(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function ks(e,t){return Math.round(e*t)/t}function dm(e){return Ie(e)?e+"px":e}function PS(e){for(;e.parent;)e=e.parent;return e}function AS(e){e=V({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),hn(n,{position:"relative",overflow:"hidden",width:dm(e.width),height:dm(e.height)}),t.appendChild(n),n}function hm(e,t,n){const i=Ae("g");Ye(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const TS="base",mm=0,MS=1,kS={shape:["x","y","width","height"],connection:["waypoints"]};function Le(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||{})}Le.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],Le.prototype._init=function(e){const t=this._eventBus,n=this._container=AS(e),i=this._svg=Ae("svg");ve(i,{width:"100%",height:"100%"}),sn(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")}),Ne(n,i);const r=this._viewport=hm(i,"viewport");e.deferUpdate&&(this._viewboxChanged=Iu(this._viewboxChanged,300)),this._restoreFocus=Iu(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)},Le.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},Le.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},Le.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=Zh(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},Le.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},Le.prototype.restoreFocus=function(){this._restoreFocus()},Le.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},Le.prototype.isFocused=function(){return this._focused},Le.prototype.getDefaultLayer=function(){return this.getLayer(TS,mm)},Le.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},Le.prototype._getChildIndex=function(e){return En(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},Le.prototype._createLayer=function(e,t){typeof t>"u"&&(t=MS);const n=this._getChildIndex(t);return{group:hm(this._viewport,"layer-"+e,n),index:t,visible:!0}},Le.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},Le.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&&(Ft(n),t.visible=!1),n},Le.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],Ft(t.group))},Le.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},Le.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(PS(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},Le.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},Le.prototype._findPlaneForRoot=function(e){return lt(this._planes,function(t){return t.rootElement===e})},Le.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},Le.prototype._resolveElements=function(e){return Oe(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},Le.prototype.getContainer=function(){return this._container},Le.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&&(I([i.gfx,i.secondaryGfx],function(r){r&&(n?(e.markers.add(t),Ye(r).add(t)):(e.markers.delete(t),Ye(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},Le.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},Le.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},Le.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},Le.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},Le.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},Le.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,mm);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},Le.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},Le.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},Le.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)},Le.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})},Le.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})},Le.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=kS[e];if(!Pr(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},Le.prototype._setParent=function(e,t,n){At(t.children,e,n),e.parent=t},Le.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},Le.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},Le.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},Le.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),Ct(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},Le.prototype.removeShape=function(e){return this._removeElement(e,"shape")},Le.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},Le.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},Le.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},Le.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},Le.prototype.viewbox=function(e){if(e===void 0&&this._cachedViewbox)return structuredClone(this._cachedViewbox);const t=this._viewport,n=this.getSize();let i,r,o,a,s,c,u;if(e)this._changeViewbox(function(){s=Math.min(n.width/e.width,n.height/e.height);const l=this._svg.createSVGMatrix().scale(s).translate(-e.x,-e.y);Jo(t,l)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=Jo(t),r=a?a.matrix:B1(),s=ks(r.a,1e3),c=ks(-r.e||0,1e3),u=ks(-r.f||0,1e3),e=this._cachedViewbox={x:c?c/s:0,y:u?u/s:0,width:n.width/s,height:n.height/s,scale:s,inner:{width:i.width||0,height:i.height||0,x:i.x||0,y:i.y||0},outer:n},e;return e},Le.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=V({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),gm(t,n)}),{x:n.e,y:n.f}},Le.prototype.scrollToElement=function(e,t){let n=100;const i=this._resolveElements(e);if(!i.length)return;const r=this.findRoot(i);if(!r)return;r!==this.getRootElement()&&this.setRootElement(r);const o=i.filter(g=>g!=r);if(!o.length)return;t||(t={}),typeof t=="number"&&(n=t),t={top:t.top||n,right:t.right||n,bottom:t.bottom||n,left:t.left||n};const a=kt(o),s=Te(a),c=this.viewbox(),u=this.zoom();let l,f;c.y+=t.top/u,c.x+=t.left/u,c.width-=(t.right+t.left)/u,c.height-=(t.bottom+t.top)/u;const p=Te(c);if(!(a.width<c.width&&a.height<c.height))l=a.x-c.x,f=a.y-c.y;else{const g=Math.max(0,s.right-p.right),h=Math.min(0,s.left-p.left),m=Math.max(0,s.bottom-p.bottom),_=Math.min(0,s.top-p.top);l=g||h,f=m||_}this.scroll({dx:-l*u,dy:-f*u})},Le.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)}),ks(i.a,1e3)};function gm(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}Le.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},Le.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,r=n.createSVGMatrix(),o=n.createSVGPoint();let a,s,c,u,l;c=i.getCTM();const f=c.a;return t?(a=V(o,t),s=a.matrixTransform(c.inverse()),u=r.translate(s.x,s.y).scale(1/f*e).translate(-s.x,-s.y),l=c.multiply(u)):l=r.scale(e),gm(this._viewport,l),l},Le.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},Le.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}},Le.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var ho="data-element-id";function Bn(e){this._elements={},this._eventBus=e}Bn.$inject=["eventBus"],Bn.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),ve(t,ho,i),n&&ve(n,ho,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},Bn.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(ve(i.gfx,ho,""),i.secondaryGfx&&ve(i.secondaryGfx,ho,""),delete t[n])},Bn.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)},Bn.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&ve(t,ho,i),t},Bn.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&ve(e,ho);var n=this._elements[t];return n&&n.element},Bn.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},Bn.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}},Bn.prototype.getAll=function(){return this.filter(function(e){return e})},Bn.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)})},Bn.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},Bn.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 OS(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 DS(e){return e.__refs_collection===!0}function LS(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function ym(e,t,n){var i=OS(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 IS(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 Wn(e,t){if(!(this instanceof Wn))return new Wn(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Wn.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?ym(this,t,e):IS(this,t,e)},Wn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return DS(n)||ym(this,t,e),n},Wn.prototype.ensureBound=function(e,t){LS(e,t)||this.bind(e,t)},Wn.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Wn.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var Pl=new Wn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),vm=new Wn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),bm=new Wn({name:"attachers",collection:!0},{name:"host"}),_m=new Wn({name:"outgoing",collection:!0},{name:"source"}),xm=new Wn({name:"incoming",collection:!0},{name:"target"});function mo(){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)}}),Pl.bind(this,"parent"),vm.bind(this,"labels"),_m.bind(this,"outgoing"),xm.bind(this,"incoming")}function oa(){mo.call(this),Pl.bind(this,"children"),bm.bind(this,"host"),bm.bind(this,"attachers")}ye(oa,mo);function wm(){mo.call(this),Pl.bind(this,"children")}ye(wm,oa);function Em(){oa.call(this),vm.bind(this,"labelTarget")}ye(Em,oa);function Sm(){mo.call(this),_m.bind(this,"source"),xm.bind(this,"target")}ye(Sm,mo);var BS={connection:Sm,shape:oa,label:Em,root:wm};function NS(e,t){var n=BS[e];if(!n)throw new Error("unknown type: <"+e+">");return V(new n,t)}function $S(e){return e instanceof mo}function Li(){this._uid=12}Li.prototype.createRoot=function(e){return this.create("root",e)},Li.prototype.createLabel=function(e){return this.create("label",e)},Li.prototype.createShape=function(e){return this.create("shape",e)},Li.prototype.createConnection=function(e){return this.create("connection",e)},Li.prototype.create=function(e,t){return t=V({},t||{}),t.id||(t.id=e+"_"+this._uid++),NS(e,t)};var Os="__fn",Rm=1e3,FS=Array.prototype.slice;function Cn(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}Cn.prototype.on=function(e,t,n,i){if(e=Oe(e)?e:[e],Ut(t)&&(i=n,n=t,t=Rm),!Ie(t))throw new Error("priority must be a number");var r=n;i&&(r=vn(n,i),r[Os]=n[Os]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},Cn.prototype.once=function(e,t,n,i){var r=this;if(Ut(t)&&(i=n,n=t,t=Rm),!Ie(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[Os]=n,this.on(e,t,o)},Cn.prototype.off=function(e,t){e=Oe(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},Cn.prototype.createEvent=function(e){var t=new aa;return t.init(e),t},Cn.prototype.fire=function(e,t){var n,i,r,o;if(o=FS.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 aa?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}},Cn.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},Cn.prototype._destroy=function(){this._listeners={}},Cn.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},Cn.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=jS(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},Cn.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},Cn.prototype._getListeners=function(e){return this._listeners[e]},Cn.prototype._setListeners=function(e,t){this._listeners[e]=t},Cn.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[Os]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function aa(){}aa.prototype.stopPropagation=function(){this.cancelBubble=!0},aa.prototype.preventDefault=function(){this.defaultPrevented=!0},aa.prototype.init=function(e){V(this,e||{})};function jS(e,t){return e.apply(null,t)}function Lr(e){return e.childNodes[0]}function HS(e){return e.parentNode.childNodes[1]}function Ds(e,t,n,i,r){var o=Qo();o.setTranslate(t,n);var a=Qo();a.setRotate(i||0,0,0);var s=Qo();s.setScale(1,1),Jo(e,[o,a,s])}function Jt(e,t,n){var i=Qo();i.setTranslate(t,n),Jo(e,i)}function Cm(e,t){var n=Qo();n.setRotate(t,0,0),Jo(e,n)}function Nn(e,t){this._eventBus=e,this._elementRegistry=t}Nn.$inject=["eventBus","elementRegistry"],Nn.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=HS(t),n||(n=Ae("g"),Ye(n).add("djs-children"),Ne(t.parentNode,n))):n=t,n},Nn.prototype._clear=function(e){var t=Lr(e);return xs(t),t},Nn.prototype._createContainer=function(e,t,n,i){var r=Ae("g");Ye(r).add("djs-group"),typeof n<"u"?zS(r,t,t.childNodes[n]):Ne(t,r);var o=Ae("g");Ye(o).add("djs-element"),Ye(o).add("djs-"+e),i&&Ye(o).add("djs-frame"),Ne(r,o);var a=Ae("g");return Ye(a).add("djs-visual"),Ne(o,a),o},Nn.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,Qh(t))},Nn.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=En(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),I(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r),s=a.firstChild;I(o,function(c){var u=n.getGraphics(c).parentNode;u===s?s=s.nextSibling:a.insertBefore(u,s)})}})},Nn.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},Nn.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},Nn.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},Nn.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},Nn.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),Jt(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?ve(n,"display","none"):ve(n,"display","block")}},Nn.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);Ft(t.parentNode)};function zS(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const GS={__depends__:[nS],__init__:["canvas"],canvas:["type",Le],elementRegistry:["type",Bn],elementFactory:["type",Li],eventBus:["type",Cn],graphicsFactory:["type",Nn]};function VS(e){var t=new Xh(e);return t.init(),t}function WS(e){e=e||{};var t={config:["value",e]},n=[t,GS].concat(e.modules||[]);return VS(n)}function ir(e,t){this._injector=t||WS(e),this.get("eventBus").fire("diagram.init")}ir.prototype.get=function(e,t){return this._injector.get(e,t)},ir.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},ir.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},ir.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function cn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function bn(e,t){return e.$instanceOf(t)}function US(e){return lt(e.rootElements,function(t){return bn(t,"bpmn:Process")||bn(t,"bpmn:Collaboration")})}function qS(e){var t={},n=[],i={};function r(q,Y){return function(Z){q(Z,Y)}}function o(q){t[q.id]=q}function a(q){return t[q.id]}function s(q,Y){var Z=q.gfx;if(Z)throw new Error(`already rendered ${cn(q)}`);return e.element(q,i[q.id],Y)}function c(q,Y){return e.root(q,i[q.id],Y)}function u(q,Y){try{var Z=i[q.id]&&s(q,Y);return o(q),Z}catch(He){l(He.message,{element:q,error:He}),console.error(`failed to import ${cn(q)}`,He)}}function l(q,Y){e.error(q,Y)}var f=this.registerDi=function(Y){var Z=Y.bpmnElement;Z?i[Z.id]?l(`multiple DI elements defined for ${cn(Z)}`,{element:Z}):i[Z.id]=Y:l(`no bpmnElement referenced in ${cn(Y)}`,{element:Y})};function p(q){d(q.plane)}function d(q){f(q),I(q.planeElement,g)}function g(q){f(q)}this.handleDefinitions=function(Y,Z){var He=Y.diagrams;if(Z&&He.indexOf(Z)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!Z&&He&&He.length&&(Z=He[0]),!Z)throw new Error("no diagram to display");i={},p(Z);var Kt=Z.plane;if(!Kt)throw new Error(`no plane for ${cn(Z)}`);var M=Kt.bpmnElement;if(!M)if(M=US(Y),M)l(`correcting missing bpmnElement on ${cn(Kt)} to ${cn(M)}`),Kt.bpmnElement=M,f(Kt);else throw new Error("no process or collaboration to display");var E=c(M,Kt);if(bn(M,"bpmn:Process")||bn(M,"bpmn:SubProcess"))m(M,E);else if(bn(M,"bpmn:Collaboration"))Ee(M,E),_(Y.rootElements,E);else throw new Error(`unsupported bpmnElement for ${cn(Kt)}: ${cn(M)}`);h(n)};var h=this.handleDeferred=function(){for(var Y;n.length;)Y=n.shift(),Y()};function m(q,Y){fe(q,Y),j(q.ioSpecification,Y),T(q.artifacts,Y),o(q)}function _(q,Y){var Z=Ge(q,function(He){return!a(He)&&bn(He,"bpmn:Process")&&He.laneSets});Z.forEach(r(m,Y))}function y(q,Y){u(q,Y)}function x(q,Y){I(q,r(y,Y))}function S(q,Y){u(q,Y)}function P(q,Y){u(q,Y)}function C(q,Y){u(q,Y)}function L(q,Y){u(q,Y)}function T(q,Y){I(q,function(Z){bn(Z,"bpmn:Association")?n.push(function(){L(Z,Y)}):L(Z,Y)})}function j(q,Y){q&&(I(q.dataInputs,r(P,Y)),I(q.dataOutputs,r(C,Y)))}var k=this.handleSubProcess=function(Y,Z){fe(Y,Z),T(Y.artifacts,Z)};function D(q,Y){var Z=u(q,Y);bn(q,"bpmn:SubProcess")&&k(q,Z||Y),bn(q,"bpmn:Activity")&&j(q.ioSpecification,Y),n.push(function(){I(q.dataInputAssociations,r(S,Y)),I(q.dataOutputAssociations,r(S,Y))})}function z(q,Y){u(q,Y)}function se(q,Y){u(q,Y)}function Se(q,Y){n.push(function(){var Z=u(q,Y);q.childLaneSet&&qe(q.childLaneSet,Z||Y),pe(q)})}function qe(q,Y){I(q.lanes,r(Se,Y))}function K(q,Y){I(q,r(qe,Y))}function fe(q,Y){we(q.flowElements,Y),q.laneSets&&K(q.laneSets,Y)}function we(q,Y){I(q,function(Z){bn(Z,"bpmn:SequenceFlow")?n.push(function(){z(Z,Y)}):bn(Z,"bpmn:BoundaryEvent")?n.unshift(function(){D(Z,Y)}):bn(Z,"bpmn:FlowNode")?D(Z,Y):bn(Z,"bpmn:DataObject")||(bn(Z,"bpmn:DataStoreReference")||bn(Z,"bpmn:DataObjectReference")?se(Z,Y):l(`unrecognized flowElement ${cn(Z)} in context ${cn(Y&&Y.businessObject)}`,{element:Z,context:Y}))})}function me(q,Y){var Z=u(q,Y),He=q.processRef;He&&m(He,Z||Y)}function Ee(q,Y){I(q.participants,r(me,Y)),n.push(function(){x(q.messageFlows,Y)}),T(q.artifacts,Y)}function pe(q){I(q.flowNodeRef,function(Y){var Z=Y.get("lanes");Z&&Z.push(q)})}}function w(e,t){var n=ie(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function ze(e,t){return qi(t,function(n){return w(e,n)})}function ie(e){return e&&e.businessObject||e}function Ke(e){return e&&e.di}function YS(e,t,n){var i,r,o,a,s=[];function c(u,l){var f={root:function(h,m){return i.add(h,m)},element:function(h,m,_){return i.add(h,m,_)},error:function(h,m){s.push({message:h,context:m})}},p=new qS(f);l=l||u.diagrams&&u.diagrams[0];var d=KS(u,l);if(!d)throw new Error("no diagram to display");I(d,function(h){p.handleDefinitions(u,h)});var g=l.plane.bpmnElement.id;o.setRootElement(o.findRoot(g+"_plane")||o.findRoot(g))}return new Promise(function(u,l){try{return i=e.get("bpmnImporter"),r=e.get("eventBus"),o=e.get("canvas"),r.fire("import.render.start",{definitions:t}),c(t,n),r.fire("import.render.complete",{error:a,warnings:s}),u({warnings:s})}catch(f){return f.warnings=s,l(f)}})}function KS(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!w(n,"bpmn:Process")&&!w(n,"bpmn:Collaboration")&&(i=XS(n));var r;w(i,"bpmn:Collaboration")?r=i:r=lt(e.rootElements,function(u){if(w(u,"bpmn:Collaboration"))return lt(u.participants,function(l){return l.processRef===i})});var o=[i];r&&(o=on(r.participants,function(u){return u.processRef}),o.push(r));var a=Pm(o),s=[t],c=[n];return I(e.diagrams,function(u){if(u.plane){var l=u.plane.bpmnElement;a.indexOf(l)!==-1&&c.indexOf(l)===-1&&(s.push(u),c.push(l))}}),s}}function Pm(e){var t=[];return I(e,function(n){n&&(t.push(n),t=t.concat(Pm(n.flowElements)))}),t}function XS(e){for(var t=e;t;){if(w(t,"bpmn:Process"))return t;t=t.$parent}}var ZS='<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>',Am=ZS,Tm={verticalAlign:"middle"},Mm={color:"#404040"},QS={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},JS={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},eR={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"},tR='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+Am+'</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>',vi;function nR(){vi=ht(tR),hn(vi,QS),hn(rt("svg",vi),Tm),hn(rt(".backdrop",vi),JS),hn(rt(".notice",vi),eR),hn(rt(".link",vi),Mm,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function iR(){vi||(nR(),Rn.bind(vi,".backdrop","click",function(e){document.body.removeChild(vi)})),document.body.appendChild(vi)}const Ls=5,km="djs-outline-hidden";function _t(e){e=V({},oR,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),sR(this._container)}ye(_t,ir),_t.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,u=a.warnings,l=a.elementsById;o=o.concat(u),s=this._emit("import.parse.complete",r({error:null,definitions:s,elementsById:l,references:c,warnings:o}))||s;const 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||[]),Is(s,o),s=rR(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},_t.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},_t.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw Is(o,[]),o}if(typeof t=="string"&&(i=aR(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw Is(o,[]),o}try{this.clear()}catch(o){throw Is(o,[]),o}const{warnings:r}=await YS(this,n,i);return{warnings:r}},_t.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},_t.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=rt(":scope > defs",i._svg),a=Kh(r),s=o?"<defs>"+Kh(o)+"</defs>":"",c=i.getContainer();vt(c).add(km);let u;try{u=r.getBBox()}finally{vt(c).remove(km)}const l=u.x-Ls,f=u.y-Ls,p=u.width+Ls*2,d=u.height+Ls*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="'+l+" "+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}},xt.prototype._setDefinitions=function(e){this._definitions=e},xt.prototype.getModules=function(){return this._modules},xt.prototype.clear=function(){this.getDefinitions()&&nr.prototype.clear.call(this)},xt.prototype.destroy=function(){nr.prototype.destroy.call(this),di(this._container)},xt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},xt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},xt.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),typeof e=="string"&&(e=ot(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},xt.prototype.getDefinitions=function(){return this._definitions},xt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},xt.prototype._init=function(e,t,n){const i=n.modules||this.getModules(n),r=n.additionalModules||[],o=[{bpmnjs:["value",this],moddle:["value",t]}],a=[].concat(o,i,r),s=V(ui(n,["additionalModules"]),{canvas:V({},n.canvas,{container:e}),modules:a});nr.call(this,s),n&&n.container&&this.attachTo(n.container)},xt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},xt.prototype._createContainer=function(e){const t=ht('<div class="bjs-container"></div>');return mn(t,{width:km(e.width),height:km(e.height),position:e.position}),t},xt.prototype._createModdle=function(e){const t=V({},this._moddleExtensions,e.moddleExtensions);return new Md(t)},xt.prototype._modules=[];function Is(e,t){return e.warnings=t,e}function eR(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 tR={width:"100%",height:"100%",position:"relative"};function km(e){return e+(Ie(e)?"px":"")}function nR(e,t){return t&&pt(e.diagrams,function(n){return n.id===t})||null}function iR(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Pm+"</a>",i=ht(n);mn(ot("svg",i),Am),mn(i,Tm,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),$e.bind(i,"click",function(r){JS(),r.preventDefault()})}function fo(e){xt.call(this,e),this.on("import.parse.complete",function(t){t.error||this._collectIds(t.definitions,t.elementsById)},this),this.on("diagram.destroy",function(){this.get("moddle").ids.clear()},this)}ye(fo,xt),fo.prototype._createModdle=function(e){var t=xt.prototype._createModdle.call(this,e);return t.ids=new fi([32,36,1]),t},fo.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 Ye(e,t){return w(e,"bpmn:CallActivity")?!1:w(e,"bpmn:SubProcess")?(t=t||Ze(e),t&&w(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):w(e,"bpmn:Participant")?!!ie(e).processRef:!0}function Xt(e){if(!(!w(e,"bpmn:Participant")&&!w(e,"bpmn:Lane"))){var t=Ze(e).isHorizontal;return t===void 0?!0:t}}function rR(e){return e&&ie(e).isInterrupting!==!1}function pn(e){return e&&!!ie(e).triggeredByEvent}function ho(e,t){var n=ie(e).eventDefinitions;return Wi(n,function(i){return w(i,t)})}function oR(e){return ho(e,"bpmn:ErrorEventDefinition")}function aR(e){return ho(e,"bpmn:EscalationEventDefinition")}function sR(e){return ho(e,"bpmn:CompensateEventDefinition")}var Dr={width:90,height:20},Om=15;function ir(e){return w(e,"bpmn:Event")||w(e,"bpmn:Gateway")||w(e,"bpmn:DataStoreReference")||w(e,"bpmn:DataObjectReference")||w(e,"bpmn:DataInput")||w(e,"bpmn:DataOutput")||w(e,"bpmn:SequenceFlow")||w(e,"bpmn:MessageFlow")||w(e,"bpmn:Group")}function Bs(e){return Ge(e.label)}function cR(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=uR(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-=Om:a+=Om,{x:a,y:s}}function uR(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 Pl(e){return e.waypoints?cR(e.waypoints):w(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Dr.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Dr.height/2}}function lR(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(Dr.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=Pl(t),i=Dr),V({x:n.x-i.width/2,y:n.y-i.height/2},i)}function Dm(e){if(w(e,"bpmn:FlowElement")||w(e,"bpmn:Participant")||w(e,"bpmn:Lane")||w(e,"bpmn:SequenceFlow")||w(e,"bpmn:MessageFlow")||w(e,"bpmn:DataInput")||w(e,"bpmn:DataOutput"))return"name";if(w(e,"bpmn:TextAnnotation"))return"text";if(w(e,"bpmn:Group"))return"categoryValueRef"}function pR(e){var t=e.categoryValueRef;return t&&t.value||""}function Hn(e){var t=e.businessObject,n=Dm(t);if(n)return n==="categoryValueRef"?pR(t):t[n]||""}function fR(e,t){var n=e.businessObject,i=Dm(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function dR(e){return Ge(e)&&ir(e.labelTarget)}var mo=7;function Lm(e){let t=[];return I(e.incoming,n=>{w(n,"bpmn:Association")&&w(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),I(e.outgoing,n=>{w(n,"bpmn:Association")&&w(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function oa(e){const t=new Map;return I(_l(e),n=>{I(Lm(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 Al="hsl(225, 10%, 15%)",hR="white";function yi(e,t){return Wi(e.eventDefinitions,function(n){return n.$type===t})}function mR(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function gR(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function qe(e,t,n){var i=Ze(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||hR}function de(e,t,n){var i=Ze(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||Al}function aa(e,t,n,i){var r=Ze(e),o=r.get("label");return i||o&&o.get("color:color")||t||de(e,n)}function Im(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 Mr(r)}function Tl(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 Mr(a)}function yR(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 Mr(s)}function vR(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 Mr(o)}function sa(e,t={}){return{width:Un(e,t),height:Tn(e,t)}}function Un(e,t={}){return Sn(t,"width")?t.width:e.width}function Tn(e,t={}){return Sn(t,"height")?t.height:e.height}var bR=new fi,_R=10,Ns=3,xR=1.5,$s=10,wR=4,go=.95,ER=1,SR=.25;function Lr(e,t,n,i,r,o,a){Ti.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,u=e&&e.defaultLabelColor;function l(M){return n.computeStyle(M,{strokeLinecap:"round",strokeLinejoin:"round",stroke:Al,strokeWidth:2,fill:"white"})}function f(M){return n.computeStyle(M,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:Al,strokeWidth:2})}function p(M,E){var{ref:b={x:0,y:0},scale:H=1,element:W,parentGfx:Q=r._svg}=E,be=Pe("marker",{id:M,viewBox:"0 0 20 20",refX:b.x,refY:b.y,markerWidth:20*H,markerHeight:20*H,orient:"auto"});Fe(be,W);var Be=ot(":scope > defs",Q);Be||(Be=Pe("defs"),Fe(Q,Be)),Fe(Be,be)}function d(M,E,b,H){var W=bR.nextPrefixed("marker-");return g(M,W,E,b,H),"url(#"+W+")"}function g(M,E,b,H,W){if(b==="sequenceflow-end"){var Q=Pe("path",{d:"M 1 5 L 11 10 L 1 15 Z",...l({fill:W,stroke:W,strokeWidth:1})});p(E,{element:Q,ref:{x:11,y:10},scale:.5,parentGfx:M})}if(b==="messageflow-start"){var be=Pe("circle",{cx:6,cy:6,r:3.5,...l({fill:H,stroke:W,strokeWidth:1,strokeDasharray:[1e4,1]})});p(E,{element:be,ref:{x:6,y:6},parentGfx:M})}if(b==="messageflow-end"){var Be=Pe("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...l({fill:H,stroke:W,strokeWidth:1,strokeDasharray:[1e4,1]})});p(E,{element:Be,ref:{x:8.5,y:5},parentGfx:M})}if(b==="association-start"){var et=Pe("path",{d:"M 11 5 L 1 10 L 11 15",...f({fill:"none",stroke:W,strokeWidth:1.5,strokeDasharray:[1e4,1]})});p(E,{element:et,ref:{x:1,y:10},scale:.5,parentGfx:M})}if(b==="association-end"){var yt=Pe("path",{d:"M 1 5 L 11 10 L 1 15",...f({fill:"none",stroke:W,strokeWidth:1.5,strokeDasharray:[1e4,1]})});p(E,{element:yt,ref:{x:11,y:10},scale:.5,parentGfx:M})}if(b==="conditional-flow-marker"){var rt=Pe("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...l({fill:H,stroke:W})});p(E,{element:rt,ref:{x:-1,y:10},scale:.5,parentGfx:M})}if(b==="conditional-default-flow-marker"){var Tt=Pe("path",{d:"M 6 4 L 10 16",...l({stroke:W,fill:"none"})});p(E,{element:Tt,ref:{x:0,y:10},scale:.5,parentGfx:M})}}function h(M,E,b,H,W={}){qt(H)&&(W=H,H=0),H=H||0,W=l(W);var Q=E/2,be=b/2,Be=Pe("circle",{cx:Q,cy:be,r:Math.round((E+b)/4-H),...W});return Fe(M,Be),Be}function m(M,E,b,H,W,Q){qt(W)&&(Q=W,W=0),W=W||0,Q=l(Q);var be=Pe("rect",{x:W,y:W,width:E-W*2,height:b-W*2,rx:H,ry:H,...Q});return Fe(M,be),be}function _(M,E,b,H){var W=E/2,Q=b/2,be=[{x:W,y:0},{x:E,y:Q},{x:W,y:b},{x:0,y:Q}],Be=be.map(function(yt){return yt.x+","+yt.y}).join(" ");H=l(H);var et=Pe("polygon",{...H,points:Be});return Fe(M,et),et}function y(M,E,b,H){b=f(b);var W=Qo(E,b,H);return Fe(M,W),W}function x(M,E,b){return y(M,E,b,5)}function S(M,E,b){b=f(b);var H=Pe("path",{...b,d:E});return Fe(M,H),H}function P(M,E,b,H){return S(E,b,V({"data-marker":M},H))}function C(M){return Zt[M]}function L(M){return function(E,b,H){return C(M)(E,b,H)}}var T={"bpmn:MessageEventDefinition":function(M,E,b={},H){var W=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:b.width||E.width,containerHeight:b.height||E.height,position:{mx:.235,my:.315}}),Q=H?de(E,c,b.stroke):qe(E,s,b.fill),be=H?qe(E,s,b.fill):de(E,c,b.stroke),Be=S(M,W,{fill:Q,stroke:be,strokeWidth:1});return Be},"bpmn:TimerEventDefinition":function(M,E,b={}){var H=b.width||E.width,W=b.height||E.height,Q=b.width?1:2,be=h(M,H,W,.2*W,{fill:qe(E,s,b.fill),stroke:de(E,c,b.stroke),strokeWidth:Q}),Be=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:H,containerHeight:W,position:{mx:.5,my:.5}});S(M,Be,{stroke:de(E,c,b.stroke),strokeWidth:Q});for(var et=0;et<12;et++){var yt=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:H,containerHeight:W,position:{mx:.5,my:.5}}),rt=H/2,Tt=W/2;S(M,yt,{strokeWidth:1,stroke:de(E,c,b.stroke),transform:"rotate("+et*30+","+Tt+","+rt+")"})}return be},"bpmn:EscalationEventDefinition":function(M,E,b={},H){var W=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:b.width||E.width,containerHeight:b.height||E.height,position:{mx:.5,my:.2}}),Q=H?de(E,c,b.stroke):qe(E,s,b.fill);return S(M,W,{fill:Q,stroke:de(E,c,b.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(M,E,b={}){var H=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:b.width||E.width,containerHeight:b.height||E.height,position:{mx:.5,my:.222}});return S(M,H,{fill:qe(E,s,b.fill),stroke:de(E,c,b.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(M,E,b={},H){var W=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:.57,my:.263}}),Q=H?de(E,c,b.stroke):qe(E,s,b.fill);return S(M,W,{fill:Q,stroke:de(E,c,b.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(M,E,b={},H){var W=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:b.width||E.width,containerHeight:b.height||E.height,position:{mx:.2,my:.722}}),Q=H?de(E,c,b.stroke):qe(E,s,b.fill);return S(M,W,{fill:Q,stroke:de(E,c,b.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(M,E,b={},H){var W=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:.638,my:-.055}}),Q=H?de(E,c,b.stroke):"none",be=S(M,W,{fill:Q,stroke:de(E,c,b.stroke),strokeWidth:1});return Rm(be,45),be},"bpmn:CompensateEventDefinition":function(M,E,b={},H){var W=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:b.width||E.width,containerHeight:b.height||E.height,position:{mx:.22,my:.5}}),Q=H?de(E,c,b.stroke):qe(E,s,b.fill);return S(M,W,{fill:Q,stroke:de(E,c,b.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(M,E,b={},H){var W=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:b.width||E.width,containerHeight:b.height||E.height,position:{mx:.5,my:.2}}),Q=H?de(E,c,b.stroke):qe(E,s,b.fill);return S(M,W,{strokeWidth:1,fill:Q,stroke:de(E,c,b.stroke)})},"bpmn:MultipleEventDefinition":function(M,E,b={},H){var W=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:b.width||E.width,containerHeight:b.height||E.height,position:{mx:.211,my:.36}}),Q=H?de(E,c,b.stroke):qe(E,s,b.fill);return S(M,W,{fill:Q,stroke:de(E,c,b.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(M,E,b={}){var H=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:b.width||E.width,containerHeight:b.height||E.height,position:{mx:.458,my:.194}});return S(M,H,{fill:qe(E,s,b.fill),stroke:de(E,c,b.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(M,E,b={}){var H=h(M,E.width,E.height,8,{fill:de(E,c,b.stroke),stroke:de(E,c,b.stroke),strokeWidth:4});return H}};function j(M,E,b={},H){var W=ie(M),Q=mR(W),be=H||M;return W.get("eventDefinitions")&&W.get("eventDefinitions").length>1?W.get("parallelMultiple")?T["bpmn:ParallelMultipleEventDefinition"](E,be,b,Q):T["bpmn:MultipleEventDefinition"](E,be,b,Q):yi(W,"bpmn:MessageEventDefinition")?T["bpmn:MessageEventDefinition"](E,be,b,Q):yi(W,"bpmn:TimerEventDefinition")?T["bpmn:TimerEventDefinition"](E,be,b,Q):yi(W,"bpmn:ConditionalEventDefinition")?T["bpmn:ConditionalEventDefinition"](E,be,b,Q):yi(W,"bpmn:SignalEventDefinition")?T["bpmn:SignalEventDefinition"](E,be,b,Q):yi(W,"bpmn:EscalationEventDefinition")?T["bpmn:EscalationEventDefinition"](E,be,b,Q):yi(W,"bpmn:LinkEventDefinition")?T["bpmn:LinkEventDefinition"](E,be,b,Q):yi(W,"bpmn:ErrorEventDefinition")?T["bpmn:ErrorEventDefinition"](E,be,b,Q):yi(W,"bpmn:CancelEventDefinition")?T["bpmn:CancelEventDefinition"](E,be,b,Q):yi(W,"bpmn:CompensateEventDefinition")?T["bpmn:CompensateEventDefinition"](E,be,b,Q):yi(W,"bpmn:TerminateEventDefinition")?T["bpmn:TerminateEventDefinition"](E,be,b,Q):null}var k={ParticipantMultiplicityMarker:function(M,E,b={}){var H=Un(E,b),W=Tn(E,b),Q=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:H,containerHeight:W,position:{mx:(H/2-6)/H,my:(W-15)/W}});P("participant-multiplicity",M,Q,{strokeWidth:2,fill:qe(E,s,b.fill),stroke:de(E,c,b.stroke)})},SubProcessMarker:function(M,E,b={}){var H=m(M,14,14,0,{strokeWidth:1,fill:qe(E,s,b.fill),stroke:de(E,c,b.stroke)});nn(H,E.width/2-7.5,E.height-20);var W=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:E.width,containerHeight:E.height,position:{mx:(E.width/2-7.5)/E.width,my:(E.height-20)/E.height}});P("sub-process",M,W,{fill:qe(E,s,b.fill),stroke:de(E,c,b.stroke)})},ParallelMarker:function(M,E,b){var H=Un(E,b),W=Tn(E,b),Q=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:H,containerHeight:W,position:{mx:(H/2+b.parallel)/H,my:(W-20)/W}});P("parallel",M,Q,{fill:qe(E,s,b.fill),stroke:de(E,c,b.stroke)})},SequentialMarker:function(M,E,b){var H=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:(E.width/2+b.seq)/E.width,my:(E.height-19)/E.height}});P("sequential",M,H,{fill:qe(E,s,b.fill),stroke:de(E,c,b.stroke)})},CompensationMarker:function(M,E,b){var H=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:(E.width/2+b.compensation)/E.width,my:(E.height-13)/E.height}});P("compensation",M,H,{strokeWidth:1,fill:qe(E,s,b.fill),stroke:de(E,c,b.stroke)})},LoopMarker:function(M,E,b){var H=Un(E,b),W=Tn(E,b),Q=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:H,containerHeight:W,position:{mx:(H/2+b.loop)/H,my:(W-7)/W}});P("loop",M,Q,{strokeWidth:1.5,fill:"none",stroke:de(E,c,b.stroke),strokeMiterlimit:.5})},AdhocMarker:function(M,E,b){var H=Un(E,b),W=Tn(E,b),Q=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:H,containerHeight:W,position:{mx:(H/2+b.adhoc)/H,my:(W-15)/W}});P("adhoc",M,Q,{strokeWidth:1,fill:de(E,c,b.stroke),stroke:de(E,c,b.stroke)})}};function D(M,E,b,H){k[M](E,b,H)}function z(M,E,b=[],H={}){H={fill:H.fill,stroke:H.stroke,width:Un(E,H),height:Tn(E,H)};var W=ie(E),Q=b.includes("SubProcessMarker");Q?H={...H,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:H={...H,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},W.get("isForCompensation")&&b.push("CompensationMarker"),w(W,"bpmn:AdHocSubProcess")&&(b.push("AdhocMarker"),Q||V(H,{compensation:H.compensation-18}));var be=W.get("loopCharacteristics"),Be=be&&be.get("isSequential");be&&(V(H,{compensation:H.compensation-18}),b.includes("AdhocMarker")&&V(H,{seq:-23,loop:-18,parallel:-24}),Be===void 0&&b.push("LoopMarker"),Be===!1&&b.push("ParallelMarker"),Be===!0&&b.push("SequentialMarker")),b.includes("CompensationMarker")&&b.length===1&&V(H,{compensation:-8}),I(b,function(et){D(et,M,E,H)})}function se(M,E,b={}){b=V({size:{width:100}},b);var H=o.createText(E||"",b);return Xe(H).add("djs-label"),Fe(M,H),H}function we(M,E,b,H={}){var W=ie(E),Q=sa({x:E.x,y:E.y,width:E.width,height:E.height},H);return se(M,W.name,{align:b,box:Q,padding:7,style:{fill:aa(E,u,c,H.stroke)}})}function Ke(M,E,b={}){var H={width:E.width,height:E.height,x:E.width/2+E.x,y:E.height/2+E.y};return se(M,Hn(E),{box:H,style:V({},o.getExternalStyle(),{fill:aa(E,u,c,b.stroke)})})}function Y(M,E,b,H={}){var W=Xt(b),Q=se(M,E,{box:{height:30,width:W?Tn(b,H):Un(b,H)},align:"center-middle",style:{fill:aa(b,u,c,H.stroke)}});if(W){var be=-1*Tn(b,H);Ds(Q,0,-be,270)}}function ue(M,E,b={}){var{width:H,height:W}=sa(E,b);return m(M,H,W,$s,{...b,fill:qe(E,s,b.fill),fillOpacity:go,stroke:de(E,c,b.stroke)})}function _e(M,E,b={}){var H=ie(E),W=qe(E,s,b.fill),Q=de(E,c,b.stroke);return(H.get("associationDirection")==="One"||H.get("associationDirection")==="Both")&&(b.markerEnd=d(M,"association-end",W,Q)),H.get("associationDirection")==="Both"&&(b.markerStart=d(M,"association-start",W,Q)),b=Qe(b,["markerStart","markerEnd"]),x(M,E.waypoints,{...b,stroke:Q,strokeDasharray:"0, 5"})}function pe(M,E,b={}){var H=qe(E,s,b.fill),W=de(E,c,b.stroke),Q=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:.474,my:.296}}),be=S(M,Q,{fill:H,fillOpacity:go,stroke:W}),Be=ie(E);if(gR(Be)){var et=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:.33,my:(E.height-18)/E.height}});S(M,et,{strokeWidth:2,fill:H,stroke:W})}return be}function xe(M,E,b={}){return h(M,E.width,E.height,{fillOpacity:go,...b,fill:qe(E,s,b.fill),stroke:de(E,c,b.stroke)})}function ce(M,E,b={}){return _(M,E.width,E.height,{fill:qe(E,s,b.fill),fillOpacity:go,stroke:de(E,c,b.stroke)})}function U(M,E,b={}){var H=m(M,Un(E,b),Tn(E,b),0,{fill:qe(E,s,b.fill),fillOpacity:b.fillOpacity||go,stroke:de(E,c,b.stroke),strokeWidth:1.5}),W=ie(E);if(w(W,"bpmn:Lane")){var Q=W.get("name");Y(M,Q,E,b)}return H}function q(M,E,b={}){var H=ue(M,E,b),W=Ye(E);if(pn(E)&&(ve(H,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!W)){var Q=ie(E).flowElements||[],be=Q.filter(Be=>w(Be,"bpmn:StartEvent"));be.length===1&&Z(be[0],M,b,E)}return we(M,E,W?"center-top":"center-middle",b),W?z(M,E,void 0,b):z(M,E,["SubProcessMarker"],b),H}function Z(M,E,b,H){var W=22,Q={fill:qe(H,s,b.fill),stroke:de(H,c,b.stroke),width:W,height:W},be=ie(M).isInterrupting,Be=be?0:3,et=be?1:1.2,yt=20,rt=(W-yt)/2,Tt="translate("+rt+","+rt+")";h(E,yt,yt,{fill:Q.fill,stroke:Q.stroke,strokeWidth:et,strokeDasharray:Be,transform:Tt}),j(M,E,Q,H)}function Ve(M,E,b={}){var H=ue(M,E,b);return we(M,E,"center-middle",b),z(M,E,void 0,b),H}var Zt=this.handlers={"bpmn:AdHocSubProcess":function(M,E,b={}){return Ye(E)?b=Qe(b,["fill","stroke","width","height"]):b=Qe(b,["fill","stroke"]),q(M,E,b)},"bpmn:Association":function(M,E,b={}){return b=Qe(b,["fill","stroke"]),_e(M,E,b)},"bpmn:BoundaryEvent":function(M,E,b={}){var{renderIcon:H=!0}=b;b=Qe(b,["fill","stroke"]);var W=ie(E),Q=W.get("cancelActivity");b={strokeWidth:1.5,fill:qe(E,s,b.fill),fillOpacity:ER,stroke:de(E,c,b.stroke)},Q||(b.strokeDasharray="6");var be=xe(M,E,b);return h(M,E.width,E.height,Ns,{...b,fill:"none"}),H&&j(E,M,b),be},"bpmn:BusinessRuleTask":function(M,E,b={}){b=Qe(b,["fill","stroke"]);var H=Ve(M,E,b),W=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),Q=S(M,W);ve(Q,{fill:qe(E,s,b.fill),stroke:de(E,c,b.stroke),strokeWidth:1});var be=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),Be=S(M,be);return ve(Be,{fill:de(E,c,b.stroke),stroke:de(E,c,b.stroke),strokeWidth:1}),H},"bpmn:CallActivity":function(M,E,b={}){return b=Qe(b,["fill","stroke"]),q(M,E,{strokeWidth:5,...b})},"bpmn:ComplexGateway":function(M,E,b={}){b=Qe(b,["fill","stroke"]);var H=ce(M,E,b),W=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:E.width,containerHeight:E.height,position:{mx:.46,my:.26}});return S(M,W,{fill:de(E,c,b.stroke),stroke:de(E,c,b.stroke),strokeWidth:1}),H},"bpmn:DataInput":function(M,E,b={}){b=Qe(b,["fill","stroke"]);var H=i.getRawPath("DATA_ARROW"),W=pe(M,E,b);return S(M,H,{fill:"none",stroke:de(E,c,b.stroke),strokeWidth:1}),W},"bpmn:DataInputAssociation":function(M,E,b={}){return b=Qe(b,["fill","stroke"]),_e(M,E,{...b,markerEnd:d(M,"association-end",qe(E,s,b.fill),de(E,c,b.stroke))})},"bpmn:DataObject":function(M,E,b={}){return b=Qe(b,["fill","stroke"]),pe(M,E,b)},"bpmn:DataObjectReference":L("bpmn:DataObject"),"bpmn:DataOutput":function(M,E,b={}){b=Qe(b,["fill","stroke"]);var H=i.getRawPath("DATA_ARROW"),W=pe(M,E,b);return S(M,H,{strokeWidth:1,fill:de(E,c,b.stroke),stroke:de(E,c,b.stroke)}),W},"bpmn:DataOutputAssociation":function(M,E,b={}){return b=Qe(b,["fill","stroke"]),_e(M,E,{...b,markerEnd:d(M,"association-end",qe(E,s,b.fill),de(E,c,b.stroke))})},"bpmn:DataStoreReference":function(M,E,b={}){b=Qe(b,["fill","stroke"]);var H=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:0,my:.133}});return S(M,H,{fill:qe(E,s,b.fill),fillOpacity:go,stroke:de(E,c,b.stroke),strokeWidth:2})},"bpmn:EndEvent":function(M,E,b={}){var{renderIcon:H=!0}=b;b=Qe(b,["fill","stroke"]);var W=xe(M,E,{...b,strokeWidth:4});return H&&j(E,M,b),W},"bpmn:EventBasedGateway":function(M,E,b={}){b=Qe(b,["fill","stroke"]);var H=ie(E),W=ce(M,E,b);h(M,E.width,E.height,E.height*.2,{fill:qe(E,"none",b.fill),stroke:de(E,c,b.stroke),strokeWidth:1});var Q=H.get("eventGatewayType"),be=!!H.get("instantiate");function Be(){var yt=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:E.width,containerHeight:E.height,position:{mx:.36,my:.44}});S(M,yt,{fill:"none",stroke:de(E,c,b.stroke),strokeWidth:2})}if(Q==="Parallel"){var et=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:E.width,containerHeight:E.height,position:{mx:.474,my:.296}});S(M,et,{fill:"none",stroke:de(E,c,b.stroke),strokeWidth:1})}else Q==="Exclusive"&&(be||h(M,E.width,E.height,E.height*.26,{fill:"none",stroke:de(E,c,b.stroke),strokeWidth:1}),Be());return W},"bpmn:ExclusiveGateway":function(M,E,b={}){b=Qe(b,["fill","stroke"]);var H=ce(M,E,b),W=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:E.width,containerHeight:E.height,position:{mx:.32,my:.3}}),Q=Ze(E);return Q.get("isMarkerVisible")&&S(M,W,{fill:de(E,c,b.stroke),stroke:de(E,c,b.stroke),strokeWidth:1}),H},"bpmn:Gateway":function(M,E,b={}){return b=Qe(b,["fill","stroke"]),ce(M,E,b)},"bpmn:Group":function(M,E,b={}){return b=Qe(b,["fill","stroke","width","height"]),m(M,E.width,E.height,$s,{stroke:de(E,c,b.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:Un(E,b),height:Tn(E,b)})},"bpmn:InclusiveGateway":function(M,E,b={}){b=Qe(b,["fill","stroke"]);var H=ce(M,E,b);return h(M,E.width,E.height,E.height*.24,{fill:qe(E,s,b.fill),stroke:de(E,c,b.stroke),strokeWidth:2.5}),H},"bpmn:IntermediateEvent":function(M,E,b={}){var{renderIcon:H=!0}=b;b=Qe(b,["fill","stroke"]);var W=xe(M,E,{...b,strokeWidth:1.5});return h(M,E.width,E.height,Ns,{fill:"none",stroke:de(E,c,b.stroke),strokeWidth:1.5}),H&&j(E,M,b),W},"bpmn:IntermediateCatchEvent":L("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":L("bpmn:IntermediateEvent"),"bpmn:Lane":function(M,E,b={}){return b=Qe(b,["fill","stroke","width","height"]),U(M,E,{...b,fillOpacity:SR})},"bpmn:ManualTask":function(M,E,b={}){b=Qe(b,["fill","stroke"]);var H=Ve(M,E,b),W=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return S(M,W,{fill:qe(E,s,b.fill),stroke:de(E,c,b.stroke),strokeWidth:.5}),H},"bpmn:MessageFlow":function(M,E,b={}){b=Qe(b,["fill","stroke"]);var H=ie(E),W=Ze(E),Q=qe(E,s,b.fill),be=de(E,c,b.stroke),Be=x(M,E.waypoints,{markerEnd:d(M,"messageflow-end",Q,be),markerStart:d(M,"messageflow-start",Q,be),stroke:be,strokeDasharray:"10, 11",strokeWidth:1.5});if(H.get("messageRef")){var et=Be.getPointAtLength(Be.getTotalLength()/2),yt=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:et.x,y:et.y}}),rt={strokeWidth:1};W.get("messageVisibleKind")==="initiating"?(rt.fill=Q,rt.stroke=be):(rt.fill=be,rt.stroke=Q);var Tt=S(M,yt,rt),Jt=H.get("messageRef"),yn=Jt.get("name"),ut=se(M,yn,{align:"center-top",fitBox:!0,style:{fill:be}}),Nt=Tt.getBBox(),$t=ut.getBBox(),zo=et.x-$t.width/2,Vt=et.y+Nt.height/2+_R;Ds(ut,zo,Vt,0)}return Be},"bpmn:ParallelGateway":function(M,E,b={}){b=Qe(b,["fill","stroke"]);var H=ce(M,E,b),W=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:E.width,containerHeight:E.height,position:{mx:.46,my:.2}});return S(M,W,{fill:de(E,c,b.stroke),stroke:de(E,c,b.stroke),strokeWidth:1}),H},"bpmn:Participant":function(M,E,b={}){b=Qe(b,["fill","stroke","width","height"]);var H=U(M,E,b),W=Ye(E),Q=Xt(E),be=ie(E),Be=be.get("name");if(W){var et=Q?[{x:30,y:0},{x:30,y:Tn(E,b)}]:[{x:0,y:30},{x:Un(E,b),y:30}];y(M,et,{stroke:de(E,c,b.stroke),strokeWidth:xR}),Y(M,Be,E,b)}else{var yt=sa(E,b);Q||(yt.height=Un(E,b),yt.width=Tn(E,b));var rt=se(M,Be,{box:yt,align:"center-middle",style:{fill:aa(E,u,c,b.stroke)}});if(!Q){var Tt=-1*Tn(E,b);Ds(rt,0,-Tt,270)}}return be.get("participantMultiplicity")&&D("ParticipantMultiplicityMarker",M,E,b),H},"bpmn:ReceiveTask":function(M,E,b={}){b=Qe(b,["fill","stroke"]);var H=ie(E),W=Ve(M,E,b),Q;return H.get("instantiate")?(h(M,28,28,20*.22,{fill:qe(E,s,b.fill),stroke:de(E,c,b.stroke),strokeWidth:1}),Q=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):Q=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),S(M,Q,{fill:qe(E,s,b.fill),stroke:de(E,c,b.stroke),strokeWidth:1}),W},"bpmn:ScriptTask":function(M,E,b={}){b=Qe(b,["fill","stroke"]);var H=Ve(M,E,b),W=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return S(M,W,{fill:qe(E,s,b.fill),stroke:de(E,c,b.stroke),strokeWidth:1}),H},"bpmn:SendTask":function(M,E,b={}){b=Qe(b,["fill","stroke"]);var H=Ve(M,E,b),W=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return S(M,W,{fill:de(E,c,b.stroke),stroke:qe(E,s,b.fill),strokeWidth:1}),H},"bpmn:SequenceFlow":function(M,E,b={}){b=Qe(b,["fill","stroke"]);var H=qe(E,s,b.fill),W=de(E,c,b.stroke),Q=x(M,E.waypoints,{markerEnd:d(M,"sequenceflow-end",H,W),stroke:W}),be=ie(E),{source:Be}=E;if(Be){var et=ie(Be);be.get("conditionExpression")&&w(et,"bpmn:Activity")&&ve(Q,{markerStart:d(M,"conditional-flow-marker",H,W)}),et.get("default")&&(w(et,"bpmn:Gateway")||w(et,"bpmn:Activity"))&&et.get("default")===be&&ve(Q,{markerStart:d(M,"conditional-default-flow-marker",H,W)})}return Q},"bpmn:ServiceTask":function(M,E,b={}){b=Qe(b,["fill","stroke"]);var H=Ve(M,E,b);h(M,10,10,{fill:qe(E,s,b.fill),stroke:"none",transform:"translate(6, 6)"});var W=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});S(M,W,{fill:qe(E,s,b.fill),stroke:de(E,c,b.stroke),strokeWidth:1}),h(M,10,10,{fill:qe(E,s,b.fill),stroke:"none",transform:"translate(11, 10)"});var Q=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return S(M,Q,{fill:qe(E,s,b.fill),stroke:de(E,c,b.stroke),strokeWidth:1}),H},"bpmn:StartEvent":function(M,E,b={}){var{renderIcon:H=!0}=b;b=Qe(b,["fill","stroke"]);var W=ie(E);W.get("isInterrupting")||(b={...b,strokeDasharray:"6"});var Q=xe(M,E,b);return H&&j(E,M,b),Q},"bpmn:SubProcess":function(M,E,b={}){return Ye(E)?b=Qe(b,["fill","stroke","width","height"]):b=Qe(b,["fill","stroke"]),q(M,E,b)},"bpmn:Task":function(M,E,b={}){return b=Qe(b,["fill","stroke"]),Ve(M,E,b)},"bpmn:TextAnnotation":function(M,E,b={}){b=Qe(b,["fill","stroke"]);var{width:H,height:W}=sa(E,b),Q=m(M,H,W,0,0,{fill:"none",stroke:"none"}),be=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:H,containerHeight:W,position:{mx:0,my:0}});S(M,be,{stroke:de(E,c,b.stroke)});var Be=ie(E),et=Be.get("text")||"";return se(M,et,{align:"left-top",box:sa(E,b),padding:mo,style:{fill:aa(E,u,c,b.stroke)}}),Q},"bpmn:Transaction":function(M,E,b={}){Ye(E)?b=Qe(b,["fill","stroke","width","height"]):b=Qe(b,["fill","stroke"]);var H=q(M,E,{strokeWidth:1.5,...b}),W=n.style(["no-fill","no-events"],{stroke:de(E,c,b.stroke),strokeWidth:1.5}),Q=Ye(E);return Q||(b={}),m(M,Un(E,b),Tn(E,b),$s-Ns,Ns,W),H},"bpmn:UserTask":function(M,E,b={}){b=Qe(b,["fill","stroke"]);var H=Ve(M,E,b),W=15,Q=12,be=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:W,y:Q}});S(M,be,{fill:qe(E,s,b.fill),stroke:de(E,c,b.stroke),strokeWidth:.5});var Be=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:W,y:Q}});S(M,Be,{fill:qe(E,s,b.fill),stroke:de(E,c,b.stroke),strokeWidth:.5});var et=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:W,y:Q}});return S(M,et,{fill:de(E,c,b.stroke),stroke:de(E,c,b.stroke),strokeWidth:.5}),H},label:function(M,E,b={}){return Ke(M,E,b)}};this._drawPath=S,this._renderer=C}ye(Lr,Ti),Lr.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Lr.prototype.canRender=function(e){return w(e,"bpmn:BaseElement")},Lr.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Lr.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Lr.prototype.getShapePath=function(e){return Ge(e)?Tl(e,wR):w(e,"bpmn:Event")?Im(e):w(e,"bpmn:Activity")?Tl(e,$s):w(e,"bpmn:Gateway")?yR(e):vR(e)};function Qe(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var RR=0,CR={width:150,height:50};function PR(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function AR(e){return qt(e)?V({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var Ml=null;function TR(){return Ml||(Ml=document.createElement("canvas").getContext("2d")),Ml}function MR(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(Bm(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function Bm(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function kR(e,t){var n=TR();if(!n)return{width:0,height:0};n.font=MR(t),"letterSpacing"in n&&(n.letterSpacing=Bm(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 OR(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=kR(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return DR(e,r,i,o);r=IR(r,o.width,t)}}function DR(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 Nm="­";function LR(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===Nm)&&r.pop();break}var a=r[r.length-1];return a&&a===Nm&&(r[r.length-1]="-"),r.join("")}function IR(e,t,n){var i=Math.max(e.length*(n/t),1),r=LR(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function Fs(e){this._config=V({},{size:CR,padding:RR,style:{},align:"center-top"},e||{})}Fs.prototype.createText=function(e,t){return this.layoutText(e,t).element},Fs.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Fs.prototype.layoutText=function(e,t){for(var n=V({},this._config.size,t.box),i=V({},this._config.style,t.style),r=PR(t.align||this._config.align),o=AR(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=BR(i),c=e.split(/\u00AD?\r?\n/),u=[],l=n.width-o.left-o.right;c.length;)u.push(OR(c,l,i));r.vertical==="middle"&&(o.top=o.bottom=0);var f=Rn(u,function(m,_,y){return m+(s||_.height)},0)+o.top+o.bottom,p=Rn(u,function(m,_,y){return _.width>m?_.width:m},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-f)/2),d-=(s||u[0].height)/4;var g=Pe("text");ve(g,i),I(u,function(m){var _;switch(d+=s||m.height,r.horizontal){case"left":_=o.left;break;case"right":_=(a?p:l)-o.right-m.width;break;default:_=Math.max(((a?p:l)-m.width)/2+o.left,0)}var y=Pe("tspan");ve(y,{x:_,y:d}),y.textContent=m.text,Fe(g,y)});var h={width:p,height:f};return{dimensions:h,element:g}};function BR(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var NR=12,$R=1.2,FR=40;function $m(e){var t=V({fontFamily:"Arial, sans-serif",fontSize:NR,fontWeight:"normal",lineHeight:$R},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=V({},t,{fontSize:n},e&&e.externalStyle||{}),r=new Fs({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Dr.width),height:30},u=o(s,c,{style:i});return{x:Math.round(a.x+a.width/2-u.width/2),y:a.y,width:Math.ceil(u.width),height:Math.ceil(u.height)}},this.getTextAnnotationBounds=function(a,s){var c=o(s,a,{style:t,align:"left-top",padding:mo});return{x:a.x,y:a.y,width:a.width,height:Math.max(FR,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,V({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}$m.$inject=["config.textRenderer"];function jR(){this.pathMap={EVENT_MESSAGE:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:36,width:36,heightElements:[6,14],widthElements:[10.5,21]},EVENT_SIGNAL:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x1},0 Z",height:36,width:36,heightElements:[18],widthElements:[10,20]},EVENT_ESCALATION:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x0},-{e.y1} l -{e.x0},{e.y1} Z",height:36,width:36,heightElements:[20,7],widthElements:[8]},EVENT_CONDITIONAL:{d:"M {e.x0},{e.y0} l {e.x1},0 l 0,{e.y2} l -{e.x1},0 Z M {e.x2},{e.y3} l {e.x0},0 M {e.x2},{e.y4} l {e.x0},0 M {e.x2},{e.y5} l {e.x0},0 M {e.x2},{e.y6} l {e.x0},0 M {e.x2},{e.y7} l {e.x0},0 M {e.x2},{e.y8} l {e.x0},0 ",height:36,width:36,heightElements:[8.5,14.5,18,11.5,14.5,17.5,20.5,23.5,26.5],widthElements:[10.5,14.5,12.5]},EVENT_LINK:{d:"m {mx},{my} 0,{e.y0} -{e.x1},0 0,{e.y1} {e.x1},0 0,{e.y0} {e.x0},-{e.y2} -{e.x0},-{e.y2} z",height:36,width:36,heightElements:[4.4375,6.75,7.8125],widthElements:[9.84375,13.5]},EVENT_ERROR:{d:"m {mx},{my} {e.x0},-{e.y0} {e.x1},-{e.y1} {e.x2},{e.y2} {e.x3},-{e.y3} -{e.x4},{e.y4} -{e.x5},-{e.y5} z",height:36,width:36,heightElements:[.023,8.737,8.151,16.564,10.591,8.714],widthElements:[.085,6.672,6.97,4.273,5.337,6.636]},EVENT_CANCEL_45:{d:"m {mx},{my} -{e.x1},0 0,{e.x0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:36,width:36,heightElements:[4.75,8.5],widthElements:[4.75,8.5]},EVENT_COMPENSATION:{d:"m {mx},{my} {e.x0},-{e.y0} 0,{e.y1} z m {e.x1},-{e.y2} {e.x2},-{e.y3} 0,{e.y1} -{e.x2},-{e.y3} z",height:36,width:36,heightElements:[6.5,13,.4,6.1],widthElements:[9,9.3,8.7]},EVENT_TIMER_WH:{d:"M {mx},{my} l {e.x0},-{e.y0} m -{e.x0},{e.y0} l {e.x1},{e.y1} ",height:36,width:36,heightElements:[10,2],widthElements:[3,7]},EVENT_TIMER_LINE:{d:"M {mx},{my} m {e.x0},{e.y0} l -{e.x1},{e.y1} ",height:36,width:36,heightElements:[10,3],widthElements:[0,0]},EVENT_MULTIPLE:{d:"m {mx},{my} {e.x1},-{e.y0} {e.x1},{e.y0} -{e.x0},{e.y1} -{e.x2},0 z",height:36,width:36,heightElements:[6.28099,12.56199],widthElements:[3.1405,9.42149,12.56198]},EVENT_PARALLEL_MULTIPLE:{d:"m {mx},{my} {e.x0},0 0,{e.y1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} -{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z",height:36,width:36,heightElements:[2.56228,7.68683],widthElements:[2.56228,7.68683]},GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},GATEWAY_EVENT_BASED:{d:"m {mx},{my} {e.x0},{e.y0} {e.x0},{e.y1} {e.x1},{e.y2} {e.x2},0 z",height:11,width:11,heightElements:[-6,6,12,-12],widthElements:[9,-3,-12]},GATEWAY_COMPLEX:{d:"m {mx},{my} 0,{e.y0} -{e.x0},-{e.y1} -{e.x1},{e.y2} {e.x0},{e.y1} -{e.x2},0 0,{e.y3} {e.x2},0 -{e.x0},{e.y1} l {e.x1},{e.y2} {e.x0},-{e.y1} 0,{e.y0} {e.x3},0 0,-{e.y0} {e.x0},{e.y1} {e.x1},-{e.y2} -{e.x0},-{e.y1} {e.x2},0 0,-{e.y3} -{e.x2},0 {e.x0},-{e.y1} -{e.x1},-{e.y2} -{e.x0},{e.y1} 0,-{e.y0} -{e.x3},0 z",height:17.125,width:17.125,heightElements:[4.875,3.4375,2.125,3],widthElements:[3.4375,2.125,4.875,3]},DATA_OBJECT_PATH:{d:"m 0,0 {e.x1},0 {e.x0},{e.y0} 0,{e.y1} -{e.x2},0 0,-{e.y2} {e.x1},0 0,{e.y0} {e.x0},0",height:61,width:51,heightElements:[10,50,60],widthElements:[10,40,50,60]},DATA_OBJECT_COLLECTION_PATH:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},DATA_ARROW:{d:"m 5,9 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z",height:61,width:51,heightElements:[],widthElements:[]},DATA_STORE:{d:"m {mx},{my} l 0,{e.y2} c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 l 0,-{e.y2} c -{e.x0},-{e.y1} -{e.x1},-{e.y1} -{e.x2},0c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0",height:61,width:61,heightElements:[7,10,45],widthElements:[2,58,60]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_PARALLEL:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},MARKER_SEQUENTIAL:{d:"m{mx},{my} m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_COMPENSATION:{d:"m {mx},{my} 7,-5 0,10 z m 7.1,-0.3 6.9,-4.7 0,10 -6.9,-4.7 z",height:10,width:21,heightElements:[],widthElements:[]},MARKER_LOOP:{d:"m {mx},{my} c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 -6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902",height:13.9,width:13.7,heightElements:[],widthElements:[]},MARKER_ADHOC:{d:"m {mx},{my} m 0.84461,2.64411 c 1.05533,-1.23780996 2.64337,-2.07882 4.29653,-1.97997996 2.05163,0.0805 3.85579,1.15803 5.76082,1.79107 1.06385,0.34139996 2.24454,0.1438 3.18759,-0.43767 0.61743,-0.33642 1.2775,-0.64078 1.7542,-1.17511 0,0.56023 0,1.12046 0,1.6807 -0.98706,0.96237996 -2.29792,1.62393996 -3.6918,1.66181996 -1.24459,0.0927 -2.46671,-0.2491 -3.59505,-0.74812 -1.35789,-0.55965 -2.75133,-1.33436996 -4.27027,-1.18121996 -1.37741,0.14601 -2.41842,1.13685996 -3.44288,1.96782996 z",height:4,width:15,heightElements:[],widthElements:[]},TASK_TYPE_SEND:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:14,width:21,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"},TASK_TYPE_MANUAL:{d:"m {mx},{my} c 0.234,-0.01 5.604,0.008 8.029,0.004 0.808,0 1.271,-0.172 1.417,-0.752 0.227,-0.898 -0.334,-1.314 -1.338,-1.316 -2.467,-0.01 -7.886,-0.004 -8.108,-0.004 -0.014,-0.079 0.016,-0.533 0,-0.61 0.195,-0.042 8.507,0.006 9.616,0.002 0.877,-0.007 1.35,-0.438 1.353,-1.208 0.003,-0.768 -0.479,-1.09 -1.35,-1.091 -2.968,-0.002 -9.619,-0.013 -9.619,-0.013 v -0.591 c 0,0 5.052,-0.016 7.225,-0.016 0.888,-0.002 1.354,-0.416 1.351,-1.193 -0.006,-0.761 -0.492,-1.196 -1.361,-1.196 -3.473,-0.005 -10.86,-0.003 -11.0829995,-0.003 -0.022,-0.047 -0.045,-0.094 -0.069,-0.139 0.3939995,-0.319 2.0409995,-1.626 2.4149995,-2.017 0.469,-0.4870005 0.519,-1.1650005 0.162,-1.6040005 -0.414,-0.511 -0.973,-0.5 -1.48,-0.236 -1.4609995,0.764 -6.5999995,3.6430005 -7.7329995,4.2710005 -0.9,0.499 -1.516,1.253 -1.882,2.19 -0.37000002,0.95 -0.17,2.01 -0.166,2.979 0.004,0.718 -0.27300002,1.345 -0.055,2.063 0.629,2.087 2.425,3.312 4.859,3.318 4.6179995,0.014 9.2379995,-0.139 13.8569995,-0.158 0.755,-0.004 1.171,-0.301 1.182,-1.033 0.012,-0.754 -0.423,-0.969 -1.183,-0.973 -1.778,-0.01 -5.824,-0.004 -6.04,-0.004 10e-4,-0.084 0.003,-0.586 10e-4,-0.67 z"},TASK_TYPE_INSTANTIATING_SEND:{d:"m {mx},{my} l 0,8.4 l 12.6,0 l 0,-8.4 z l 6.3,3.6 l 6.3,-3.6"},TASK_TYPE_SERVICE:{d:"m {mx},{my} v -1.71335 c 0.352326,-0.0705 0.703932,-0.17838 1.047628,-0.32133 0.344416,-0.14465 0.665822,-0.32133 0.966377,-0.52145 l 1.19431,1.18005 1.567487,-1.57688 -1.195028,-1.18014 c 0.403376,-0.61394 0.683079,-1.29908 0.825447,-2.01824 l 1.622133,-0.01 v -2.2196 l -1.636514,0.01 c -0.07333,-0.35153 -0.178319,-0.70024 -0.323564,-1.04372 -0.145244,-0.34406 -0.321407,-0.6644 -0.522735,-0.96217 l 1.131035,-1.13631 -1.583305,-1.56293 -1.129598,1.13589 c -0.614052,-0.40108 -1.302883,-0.68093 -2.022633,-0.82247 l 0.0093,-1.61852 h -2.241173 l 0.0042,1.63124 c -0.353763,0.0736 -0.705369,0.17977 -1.049785,0.32371 -0.344415,0.14437 -0.665102,0.32092 -0.9635006,0.52046 l -1.1698628,-1.15823 -1.5667691,1.5792 1.1684265,1.15669 c -0.4026573,0.61283 -0.68308,1.29797 -0.8247287,2.01713 l -1.6588041,0.003 v 2.22174 l 1.6724648,-0.006 c 0.073327,0.35077 0.1797598,0.70243 0.3242851,1.04472 0.1452428,0.34448 0.3214064,0.6644 0.5227339,0.96066 l -1.1993431,1.19723 1.5840256,1.56011 1.1964668,-1.19348 c 0.6140517,0.40346 1.3028827,0.68232 2.0233517,0.82331 l 7.19e-4,1.69892 h 2.226848 z m 0.221462,-3.9957 c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_SERVICE_FILL:{d:"m {mx},{my} c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_BUSINESS_RULE_HEADER:{d:"m {mx},{my} 0,4 20,0 0,-4 z"},TASK_TYPE_BUSINESS_RULE_MAIN:{d:"m {mx},{my} 0,12 20,0 0,-12 zm 0,8 l 20,0 m -13,-4 l 0,8"},MESSAGE_FLOW_MARKER:{d:"m {mx},{my} m -10.5 ,-7 l 0,14 l 21,0 l 0,-14 z l 10.5,6 l 10.5,-6"}},this.getRawPath=function(t){return this.pathMap[t].d},this.getScaledPath=function(t,n){var i=this.pathMap[t],r,o;n.abspos?(r=n.abspos.x,o=n.abspos.y):(r=n.containerWidth*n.position.mx,o=n.containerHeight*n.position.my);var a={};if(n.position){for(var s=n.containerHeight/i.height*n.yScaleFactor,c=n.containerWidth/i.width*n.xScaleFactor,u=0;u<i.heightElements.length;u++)a["y"+u]=i.heightElements[u]*s;for(var l=0;l<i.widthElements.length;l++)a["x"+l]=i.widthElements[l]*c}var f=VR(i.d,{mx:r,my:o,e:a});return f}}var HR=/\{([^{}]+)\}/g,zR=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function GR(e,t,n){var i=n;return t.replace(zR,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 VR(e,t){return String(e).replace(HR,function(n,i){return GR(n,i,t)})}const WR={__init__:["bpmnRenderer"],bpmnRenderer:["type",Lr],textRenderer:["type",$m],pathMap:["type",jR]};function UR(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const ca={translate:["value",UR]};function js(e,t,n){return V({id:e.id,type:e.$type,businessObject:e,di:t},n)}function qR(e,t,n){var i=e.waypoint;return!i||i.length<2?[Oe(t),Oe(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function Fm(e,t,n){return new Error(`element ${ln(t)} referenced by ${ln(e)}#${n} not yet drawn`)}function Di(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}Di.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],Di.prototype.add=function(e,t,n){var i,r,o;if(w(t,"bpmndi:BPMNPlane")){var a=w(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(js(e,t,a)),this._canvas.addRootElement(i)}else if(w(t,"bpmndi:BPMNShape")){var s=!Ye(e,t),c=KR(e);r=n&&(n.hidden||n.collapsed);var u=t.bounds;i=this._elementFactory.createShape(js(e,t,{collapsed:s,hidden:r,x:Math.round(u.x),y:Math.round(u.y),width:Math.round(u.width),height:Math.round(u.height),isFrame:c})),w(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),w(e,"bpmn:Lane")&&(o=0),w(e,"bpmn:DataStoreReference")&&(YR(n,Oe(u))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else if(w(t,"bpmndi:BPMNEdge")){var l=this._getSource(e),f=this._getTarget(e);r=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(js(e,t,{hidden:r,source:l,target:f,waypoints:qR(t,l,f)})),w(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${ln(t)} for element ${ln(e)}`);return ir(e)&&Hn(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},Di.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${ln(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw Fm(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},Di.prototype.addLabel=function(e,t,n){var i,r,o;return i=lR(t,n),r=Hn(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(js(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!Hn(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)},Di.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?Fm(e,i,t+"Ref"):new Error(`${ln(e)}#${t} Ref not specified`)},Di.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},Di.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},Di.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function YR(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 KR(e){return w(e,"bpmn:Group")}const jm={__depends__:[WR,{__depends__:[ca],bpmnImporter:["type",Di]}]};function ua(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function oi(e,t){return{x:e.x-t.x,y:e.y-t.y}}function kl(e){return Math.log(e)/Math.log(10)}var XR=1e3;function ne(e){this._eventBus=e}ne.$inject=["eventBus"];function ZR(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}ne.prototype.on=function(e,t,n,i,r,o){if((Yt(t)||Ie(t))&&(o=r,r=i,i=n,n=t,t=null),Yt(n)&&(o=r,r=i,i=n,n=XR),qt(r)&&(o=r,r=!1),!Yt(i))throw new Error("handlerFn must be a function");ke(e)||(e=[e]);var a=this._eventBus;I(e,function(s){var c=["commandStack",s,t].filter(function(u){return u}).join(".");a.on(c,n,r?ZR(i,o):i,o)})},ne.prototype.canExecute=Li("canExecute"),ne.prototype.preExecute=Li("preExecute"),ne.prototype.preExecuted=Li("preExecuted"),ne.prototype.execute=Li("execute"),ne.prototype.executed=Li("executed"),ne.prototype.postExecute=Li("postExecute"),ne.prototype.postExecuted=Li("postExecuted"),ne.prototype.revert=Li("revert"),ne.prototype.reverted=Li("reverted");function Li(e){return function(n,i,r,o,a){(Yt(n)||Ie(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var Ol=["top","bottom","left","right"],Hs=10;function Dl(e,t){ne.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],function(r){var o=r.context,a=o.connection,s=a.source,c=a.target,u=o.hints||{};u.createElementsBehavior!==!1&&(n(s),n(c))}),this.postExecuted(["label.create"],function(r){var o=r.context,a=o.shape,s=o.hints||{};s.createElementsBehavior!==!1&&n(a.labelTarget)}),this.postExecuted(["elements.create"],function(r){var o=r.context,a=o.elements,s=o.hints||{};s.createElementsBehavior!==!1&&a.forEach(function(c){n(c)})});function n(r){if(Bs(r)&&!at(r)){var o=eC(r);o&&i(r,o)}}function i(r,o){var a=Oe(r),s=r.label,c=Oe(s);if(s.parent){var u=Te(r),l;switch(o){case"top":l={x:a.x,y:u.top-Hs-s.height/2};break;case"left":l={x:u.left-Hs-s.width/2,y:a.y};break;case"bottom":l={x:a.x,y:u.bottom+Hs+s.height/2};break;case"right":l={x:u.right+Hs+s.width/2,y:a.y};break}var f=oi(l,c);t.moveShape(s,f)}}}ye(Dl,ne),Dl.$inject=["eventBus","modeling"];function QR(e){var t=e.host,n=Oe(e),i=tn(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=Ol.filter(function(a){return r.indexOf(a)===-1});return o}function JR(e){var t=Oe(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 Hm(t,i)});return n}function eC(e){var t=Oe(e.label),n=Oe(e),i=Hm(n,t);if(tC(i)){var r=JR(e);if(e.host){var o=QR(e);r=r.concat(o)}var a=Ol.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?tn(e.label,e)!=="intersect"?void 0:i:a[0]}}function Hm(e,t){return tn(t,e,5)}function tC(e){return Ol.indexOf(e)!==-1}function Ll(e){ne.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(w(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)}ye(Ll,ne),Ll.$inject=["eventBus"];var nC=1500;function Il(e,t,n){e.invoke(ne,this),this.preExecute("elements.delete",nC,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=Ue(r,u=>w(u,"bpmn:Participant")||w(u,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(u=>w(u,"bpmn:Artifact"))),c=new Set;return I(o,u=>{const l=new Set(Qr(uo(Array.from(s),kt(u))));c=c.union(l),s=s.difference(l)}),Array.from(c)}}ye(Il,ne),Il.$inject=["injector","eventBus","canvas"];function Bl(e,t){e.invoke(ne,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=Ue(r.incoming.concat(r.outgoing),function(a){return w(a,"bpmn:Association")});I(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}ye(Bl,ne),Bl.$inject=["injector","modeling"];function yo(e,t){for(En(t)&&(t=[t]);e=e.parent;)if(We(e,t))return e;return null}function zm(e,t){var n=yo(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=yo(e,i),n)return Xt(n);if(We(e,i))return Xt(e);var r;for(r=ie(e);r&&!w(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?Xt(o):!0}var Gm=500;function zs(e,t){t.invoke(ne,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Gm,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return Vm(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",Gm,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];Vm(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}zs.$inject=["bpmnReplace","injector"],ye(zs,ne),zs.prototype._replaceShape=function(e,t){var n=iC(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function iC(e){var t=ie(e),n=t.eventDefinitions;return n&&n[0]}function Vm(e,t){return!Ge(e)&&We(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function Nl(e,t){ne.call(this,e);function n(i){return Ue(i.attachers,function(r){return w(r,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var r=i.context.source,o=i.context.target,a=n(o);w(r,"bpmn:EventBasedGateway")&&w(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var r=i.context.oldSource,o=i.context.newSource;w(r,"bpmn:Gateway")&&w(o,"bpmn:EventBasedGateway")&&I(o.outgoing,function(a){var s=a.target,c=n(s);w(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}Nl.$inject=["eventBus","modeling"],ye(Nl,ne);function Wm(e){return e.create("bpmn:Category")}function rC(e){return e.create("bpmn:CategoryValue")}function Um(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=rC(e)),n.$parent||(n.$parent=Wm(e)),n}function oC(e,t,n){return At(t.get("categoryValue"),e),e.$parent=t,At(n.get("rootElements"),t),t.$parent=n,e}function aC(e){var t=e.$parent;return t&&(Ct(t.get("categoryValue"),e),e.$parent=null),e}function sC(e){var t=e.$parent;return t&&(Ct(t.get("rootElements"),e),e.$parent=null),e}var cC=500;function $l(e,t,n){n.invoke(ne,this);function i(c){return t.filter(function(u){return w(u,"bpmn:Group")&&!u.labelTarget}).map(ie).filter(function(u){return u!==c})}function r(c,u){return i(u).some(function(l){return l.get("categoryValueRef")===c})}function o(c,u){return i(u).some(function(l){var f=l.get("categoryValueRef");return f&&f.$parent===c})}function a(c,u){c&&u&&oC(c,u,e.getDefinitions())}function s(c,u,l){u&&!o(u,l)&&sC(u),c&&!r(c,l)&&aC(c)}this.executed(["shape.create","label.create"],function(c){var u=c.labelTarget||c.shape;!w(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0),this.reverted(["shape.create","label.create"],function(c){var u=c.labelTarget||c.shape;!w(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,ie(u))},!0),this.executed(["shape.move","shape.resize"],cC,function(c){a(c.categoryValue,c.category)},!0),this.reverted(["shape.move","shape.resize"],function(c){var u=c.shape;c.categoryValue&&s(c.categoryValue,c.category,ie(u))},!0),this.executed("group.updateRefs",function(c){qm(c).forEach(function(u){a(u.categoryValue,u.category)})},!0),this.reverted("group.updateRefs",function(c){qm(c).forEach(function(u){s(u.categoryValue,u.category,ie(u.groupShape))})},!0),this.executed("shape.delete",function(c){var u=c.shape;!w(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,ie(u))},!0),this.reverted("shape.delete",function(c){var u=c.shape;!w(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0)}$l.$inject=["bpmnjs","elementRegistry","injector"],ye($l,ne);function qm(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function Fl(e,t,n){ne.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(m){const _=m.source,y=m.target;vo(_)&&la(y)&&l(y)}function r(m){const _=m.connection,y=m.source,x=m.target;vo(y)&&Gs(x)&&(u(x),p(y,[_]))}function o(m){const _=m.newTarget,y=m.oldSource,x=m.oldTarget;if(x!==_){const S=y;la(x)&&l(x),vo(S)&&Gs(_)&&u(_)}}function a(m){const{element:_}=m;la(_)?(f(_),d(_)):Gs(_)&&g(_)}function s(m){const{newData:_,oldShape:y}=m;if(vo(m.oldShape)&&_.eventDefinitionType!=="bpmn:CompensateEventDefinition"||_.type!=="bpmn:BoundaryEvent"){const x=y.outgoing.find(({target:S})=>la(S));x&&x.target&&(m._connectionTarget=x.target)}else if(!vo(m.oldShape)&&_.eventDefinitionType==="bpmn:CompensateEventDefinition"&&_.type==="bpmn:BoundaryEvent"){const x=y.outgoing.find(({target:S})=>Gs(S));x&&x.target&&(m._connectionTarget=x.target),h(y)}}function c(m){const{_connectionTarget:_,newShape:y}=m;_&&t.connect(y,_)}function u(m){t.updateProperties(m,{isForCompensation:!0})}function l(m){t.updateProperties(m,{isForCompensation:void 0})}function f(m){for(const _ of m.incoming)n.canConnect(_.source,m)||t.removeConnection(_);for(const _ of m.outgoing)n.canConnect(m,_.target)||t.removeConnection(_)}function p(m,_){m.outgoing.filter(S=>w(S,"bpmn:Association")).filter(S=>la(S.target)&&!_.includes(S)).forEach(S=>t.removeConnection(S))}function d(m){const _=m.attachers.slice();_.length&&t.removeElements(_)}function g(m){const _=m.incoming.filter(y=>vo(y.source));t.removeElements(_)}function h(m){const _=m.outgoing.filter(y=>w(y,"bpmn:SequenceFlow"));t.removeElements(_)}}ye(Fl,ne),Fl.$inject=["eventBus","modeling","bpmnRules"];function la(e){const t=ie(e);return t&&t.get("isForCompensation")}function vo(e){return e&&w(e,"bpmn:BoundaryEvent")&&ho(e,"bpmn:CompensateEventDefinition")}function Gs(e){return e&&w(e,"bpmn:Activity")&&!pn(e)}function jl(e){e.invoke(ne,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,r=n.shape;w(i,"bpmn:Lane")&&!w(r,"bpmn:Lane")&&(n.parent=yo(i,"bpmn:Participant"))})}jl.$inject=["injector"],ye(jl,ne);function Hl(e,t){ne.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,r=i.shape;if(w(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}})}Hl.$inject=["eventBus","bpmnFactory"],ye(Hl,ne);var zl=20,Gl=20,Ym=30,Vs=2e3;function Vl(e,t,n){ne.call(this,t),t.on(["create.start","shape.move.start"],Vs,function(r){var o=r.context,a=o.shape,s=e.getRootElement();if(!(!w(a,"bpmn:Participant")||!w(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(f){return!w(f,"bpmn:Group")&&!Ge(f)&&!at(f)});if(c.length){var u=kt(c),l=uC(a,u);V(a,l),o.createConstraints=lC(a,u)}}}),t.on("create.start",Vs,function(r){var o=r.context,a=o.shape,s=e.getRootElement(),c=e.getGraphics(s);function u(l){l.element=s,l.gfx=c}w(a,"bpmn:Participant")&&w(s,"bpmn:Process")&&(t.on("element.hover",Vs,u),t.once("create.cleanup",function(){t.off("element.hover",u)}))});function i(){var r=e.getRootElement();return w(r,"bpmn:Collaboration")?r:n.makeCollaboration()}this.preExecute("elements.create",Vs,function(r){var o=r.elements,a=r.parent,s=pC(o),c;s&&w(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;w(a,"bpmn:Participant")&&w(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,u=o.participant;a&&(!u||c===u)&&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 u=a.children.slice();c?s===c&&n.moveElements(u,{x:0,y:0},c):n.moveElements(u,{x:0,y:0},s)}},!0)}Vl.$inject=["canvas","eventBus","modeling"],ye(Vl,ne);function uC(e,t){t={width:t.width+zl*2+Ym,height:t.height+Gl*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 lC(e,t){return t=Te(t),{bottom:t.top+e.height/2-Gl,left:t.right-e.width/2+zl,top:t.bottom-e.height/2+Gl,right:t.left+e.width/2-zl-Ym}}function pC(e){return pt(e,function(t){return w(t,"bpmn:Participant")})}var Km="__targetRef_placeholder";function Wl(e,t){ne.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],Xm(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],Xm(o));function n(a,s,c){var u=a.get("dataInputAssociations");return pt(u,function(l){return l!==c&&l.targetRef===s})}function i(a,s){var c=a.get("properties"),u=pt(c,function(l){return l.name===Km});return!u&&s&&(u=t.create("bpmn:Property",{name:Km}),At(c,u)),u}function r(a,s){var c=i(a);c&&(n(a,c,s)||Ct(a.get("properties"),c))}function o(a){var s=a.context,c=s.connection,u=c.businessObject,l=c.target,f=l&&l.businessObject,p=s.newTarget,d=p&&p.businessObject,g=s.oldTarget||s.target,h=g&&g.businessObject,m=c.businessObject,_;h&&h!==f&&r(h,u),d&&d!==f&&r(d,u),f?(_=i(f,!0),m.targetRef=_):m.targetRef=null}}Wl.$inject=["eventBus","bpmnFactory"],ye(Wl,ne);function Xm(e){return function(t){var n=t.context,i=n.connection;if(w(i,"bpmn:DataInputAssociation"))return e(t)}}function Ws(e){this._bpmnUpdater=e}Ws.$inject=["bpmnUpdater"],Ws.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),[]},Ws.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 Ul(e,t,n,i){ne.call(this,i),t.registerHandler("dataStore.updateContainment",Ws);function r(){return n.filter(function(s){return w(s,"bpmn:Participant")&&ie(s).processRef})[0]}function o(s){return s.children.filter(function(c){return w(c,"bpmn:DataStoreReference")&&!c.labelTarget})}function a(s,c){var u=s.businessObject||s;if(c=c||r(),c){var l=c.businessObject||c;t.execute("dataStore.updateContainment",{dataStoreBo:u,dataStoreDi:Ze(s),newSemanticParent:l.processRef||l,newDiParent:Ze(c)})}}this.preExecute("shape.create",function(s){var c=s.context,u=c.shape;w(u,"bpmn:DataStoreReference")&&u.type!=="label"&&(c.hints||(c.hints={}),c.hints.autoResize=!1)}),this.preExecute("elements.move",function(s){var c=s.context,u=c.shapes,l=u.filter(function(f){return w(f,"bpmn:DataStoreReference")});l.length&&(c.hints||(c.hints={}),c.hints.autoResize=u.filter(function(f){return!w(f,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,u=c.shape,l=u.parent;w(u,"bpmn:DataStoreReference")&&u.type!=="label"&&w(l,"bpmn:Collaboration")&&a(u)}),this.postExecute("shape.move",function(s){var c=s.context,u=c.shape,l=c.oldParent,f=u.parent;if(!w(l,"bpmn:Collaboration")&&w(u,"bpmn:DataStoreReference")&&u.type!=="label"&&w(f,"bpmn:Collaboration")){var p=w(l,"bpmn:Participant")?l:dC(l,"bpmn:Participant");a(u,p)}}),this.postExecute("shape.delete",function(s){var c=s.context,u=c.shape,l=e.getRootElement();We(u,["bpmn:Participant","bpmn:SubProcess"])&&w(l,"bpmn:Collaboration")&&o(l).filter(function(f){return fC(f,u)}).forEach(function(f){a(f)})}),this.postExecute("canvas.updateRoot",function(s){var c=s.context,u=c.oldRoot,l=c.newRoot,f=o(u);f.forEach(function(p){w(l,"bpmn:Process")&&a(p,l)})})}Ul.$inject=["canvas","commandStack","elementRegistry","eventBus"],ye(Ul,ne);function fC(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 dC(e,t){for(;e.parent;){if(w(e.parent,t))return e.parent;e=e.parent}}var Us=Math.max,qs=Math.min,hC=20;function Zm(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function mC(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 gC(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 Ys(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return Ie(r)&&(i=(/top|left/.test(e)?qs:Us)(i,r)),Ie(o)&&(i=(/top|left/.test(e)?Us:qs)(i,o)),i}function yC(e,t){if(!t)return e;var n=Te(e);return Ms({top:Ys("top",n,t),right:Ys("right",n,t),bottom:Ys("bottom",n,t),left:Ys("left",n,t)})}function vC(e,t,n,i){var r=Te(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?Te(i):o,s={top:qs(o.top,a.top),left:qs(o.left,a.left),bottom:Us(o.bottom,a.bottom),right:Us(o.right,a.right)};return Ms(s)}function pa(e,t){return typeof e<"u"?e:hC}function bC(e,t){var n,i,r,o;return typeof t=="object"?(n=pa(t.left),i=pa(t.right),r=pa(t.top),o=pa(t.bottom)):n=i=r=o=pa(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function _C(e){return!(e.waypoints||e.type==="label")}function Qm(e,t){var n;if(e.length===void 0?n=Ue(e.children,_C):n=e,n.length)return bC(kt(n),t)}var rr=Math.abs;function xC(e,t){return Zm(Te(t),Te(e))}var wC=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],qn=30;function Ks(e,t){return t=t||[],e.children.filter(function(n){w(n,"bpmn:Lane")&&(Ks(n,t),t.push(n))}),t}function or(e){return e.children.filter(function(t){return w(t,"bpmn:Lane")})}function Yn(e){return yo(e,wC)||e}function EC(e,t){var n=Yn(e),i=w(n,"bpmn:Process")?[]:[n],r=Ks(n,i),o=Te(e),a=Te(t),s=xC(e,t),c=[],u=Xt(e);return r.forEach(function(l){if(l!==e){var f=u?0:s.top,p=u?s.right:0,d=u?0:s.bottom,g=u?s.left:0,h=Te(l);s.top&&(rr(h.bottom-o.top)<10&&(d=a.top-h.bottom),rr(h.top-o.top)<5&&(f=a.top-h.top)),s.left&&(rr(h.right-o.left)<10&&(p=a.left-h.right),rr(h.left-o.left)<5&&(g=a.left-h.left)),s.bottom&&(rr(h.top-o.bottom)<10&&(f=a.bottom-h.top),rr(h.bottom-o.bottom)<5&&(d=a.bottom-h.bottom)),s.right&&(rr(h.left-o.right)<10&&(g=a.right-h.left),rr(h.right-o.right)<5&&(p=a.right-h.right)),(f||p||d||g)&&c.push({shape:l,newBounds:gC(l,{top:f,right:p,bottom:d,left:g})})}}),c}var SC=500;function ql(e,t){ne.call(this,e);function n(i,r){var o=Xt(i),a=or(r),s=[],c=[],u=[],l=[];if(kr(a,function(m){return o?m.y>i.y?c.push(m):s.push(m):m.x>i.x?l.push(m):u.push(m),m.children}),!!a.length){var f;o?c.length&&s.length?f=i.height/2:f=i.height:l.length&&u.length?f=i.width/2:f=i.width;var p,d,g,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")),u.length&&(g=t.calculateAdjustments(u,"x",f,i.x-10),t.makeSpace(g.movingShapes,g.resizingShapes,{x:f,y:0},"e")),l.length&&(h=t.calculateAdjustments(l,"x",-f,i.x+i.width+10),t.makeSpace(h.movingShapes,h.resizingShapes,{x:-f,y:0},"w"))}}this.postExecuted("shape.delete",SC,function(i){var r=i.context,o=r.hints,a=r.shape,s=r.oldParent;w(a,"bpmn:Lane")&&(o&&o.nested||n(a,s))})}ql.$inject=["eventBus","spaceTool"],ye(ql,ne);var Jm=500;function Xs(e,t){t.invoke(ne,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Jm,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return eg(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",Jm,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;eg(a,CC(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}Xs.$inject=["bpmnReplace","injector"],ye(Xs,ne),Xs.prototype._replaceShape=function(e){var t=RC(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function RC(e){var t=ie(e),n=t.eventDefinitions;return n&&n[0]}function eg(e,t){return!Ge(e)&&w(e,"bpmn:BoundaryEvent")&&!t}function CC(e,t){return e.indexOf(t)!==-1}var Zs=Math.round,PC=Math.max;function AC(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 TC(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var tg=10;function MC(e,t){var n,i;for(n=0;i=e[n];n++)if(ta(i,t)<=tg)return{point:e[n],bendpoint:!0,index:n};return null}function kC(e,t){var n=am(AC(t,tg),TC(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=PC(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:Zs(i.x+r.x)/2,y:Zs(i.y+r.y)/2},index:i.segment2}:{point:{x:Zs(i.x),y:Zs(i.y)},index:i.segment2}:null}function Yl(e,t){return MC(e,t)||kC(e,t)}function Kl(e,t,n){ne.call(this,e);function i(r,o,a){var s=o.waypoints,c,u,l,f,p,d,g,h=r.outgoing.slice(),m=r.incoming.slice(),_;Ie(a.width)?_=Oe(a):_=a;var y=Yl(s,_);if(y){if(c=s.slice(0,y.index),u=s.slice(y.index+(y.bendpoint?1:0)),!c.length||!u.length)return;l=y.bendpoint?s[y.index]:_,(c.length===1||!ng(r,c[c.length-1]))&&c.push(ig(l)),(u.length===1||!ng(r,u[0]))&&u.unshift(ig(l))}f=o.source,p=o.target,t.canConnect(f,r,o)&&(n.reconnectEnd(o,r,c||_),d=o),t.canConnect(r,p,o)&&(d?g=n.connect(r,p,{type:o.type,waypoints:u}):(n.reconnectStart(o,r,u||_),g=o));var x=[].concat(d&&Ue(m,function(S){return S.source===d.source})||[],g&&Ue(h,function(S){return S.target===g.target})||[]);x.length&&n.removeElements(x)}this.preExecute("elements.move",function(r){var o=r.newParent,a=r.shapes,s=r.delta,c=a[0];if(!(!c||!o)){o&&o.waypoints&&(r.newParent=o=o.parent);var u=Oe(c),l={x:u.x+s.x,y:u.y+s.y},f=pt(o.children,function(p){var d=t.canInsert(a,p);return d&&Yl(p.waypoints,l)});f&&(r.targetFlow=f,r.position=l)}},!0),this.postExecuted("elements.move",function(r){var o=r.shapes,a=r.targetFlow,s=r.position;a&&i(o[0],a,s)},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;t.canInsert(a,o)&&(r.targetFlow=o,r.parent=o.parent)},!0),this.postExecuted("shape.create",function(r){var o=r.shape,a=r.targetFlow,s=r.position;a&&i(o,a,s)},!0)}ye(Kl,ne),Kl.$inject=["eventBus","bpmnRules","modeling"];function ng(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 ig(e){return V({},e)}function Xl(e,t){ne.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)&&bo(r)){var c=[];w(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(u=>u!==r&&bo(u)):c=a.incoming.filter(u=>u!==r&&bo(u)&&w(u.source,"bpmn:EventBasedGateway")),c.forEach(function(u){t.removeConnection(u)})}}),this.preExecuted("shape.replace",function(n){var i=n.context,r=i.newShape;if(w(r,"bpmn:EventBasedGateway")){var o=r.outgoing.filter(bo).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(bo).forEach(function(s){const c=a.incoming.filter(bo).filter(function(u){return u.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}Xl.$inject=["eventBus","modeling"],ye(Xl,ne);function bo(e){return w(e,"bpmn:SequenceFlow")}var Qs=1500,rg=2e3;function og(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"],Qs,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;w(a,"bpmn:Lane")&&!We(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Yn(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||We(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"],Qs,function(i){var r=i.hover;w(r,"bpmn:Lane")&&(i.hover=Yn(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Qs,function(i){var r=i.context,o=i.hover,a=r.type;w(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Yn(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Qs,function(i){var r=i.context,o=r.start;w(o,"bpmn:Lane")&&(r.start=Yn(o)||o)}),t.on("shape.move.start",rg,function(i){var r=i.shape;w(r,"bpmn:Lane")&&(i.shape=Yn(r)||r)}),t.on("spaceTool.move",rg,function(i){var r=i.hover;r&&w(r,"bpmn:Lane")&&(i.hover=Yn(r))})}og.$inject=["elementRegistry","eventBus","canvas"];var ag=770;function Zl(e,t,n,i){n.invoke(ne,this);function r(s,c){var u=ie(s),l=c.categoryValue||u.categoryValueRef;l||(l=Um(e,u));var f=c.category||l.$parent||Wm(e);u.categoryValueRef=l,l.$parent=f,c.categoryValue=l,c.category=f}function o(s,c){var u=ie(s),l=c.categoryValue||u.categoryValueRef,f=c.category||l&&l.$parent;l&&(c.categoryValue=l,c.category=f,u.categoryValueRef=null)}this.execute("label.create",function(s){var c=s.context,u=c.labelTarget;w(u,"bpmn:Group")&&r(u,c)}),this.revert("label.create",function(s){var c=s.context,u=c.labelTarget;w(u,"bpmn:Group")&&o(u,c)}),this.execute("shape.delete",function(s){var c=s.context,u=c.shape,l=ie(u);if(!(!w(u,"bpmn:Group")||u.labelTarget)){var f=c.categoryValue=l.categoryValueRef;f&&(c.category=f.$parent,l.categoryValueRef=null)}}),this.reverted("shape.delete",function(s){var c=s.context,u=c.shape;if(!(!w(u,"bpmn:Group")||u.labelTarget)){var l=c.category,f=c.categoryValue,p=ie(u);f&&(p.categoryValueRef=f,f.$parent=l)}}),this.execute("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!w(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!ie(u).categoryValueRef&&!c.categoryValue||r(u,c)}),this.reverted("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!w(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!ie(u).categoryValueRef&&!c.categoryValue||o(u,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!w(u,"bpmn:Group")||u.labelTarget||ie(u).categoryValueRef||r(u,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!w(u,"bpmn:Group")||u.labelTarget||!c.categoryValue||o(u,c)});function a(s,c){var u=e.create(s.$type);return i.copyElement(s,u,null,c)}t.on("copyPaste.copyElement",ag,function(s){var c=s.descriptor,u=s.element;if(!(!w(u,"bpmn:Group")||u.labelTarget)){var l=ie(u);if(l.categoryValueRef){var f=l.categoryValueRef;c.categoryValue=a(f,!0),f.$parent&&(c.category=a(f.$parent,!0))}}}),t.on("copyPaste.pasteElement",ag,function(s){var c=s.descriptor,u=c.businessObject,l=c.categoryValue,f=c.category;l&&(l=u.categoryValueRef=a(l)),f&&(l.$parent=a(f)),delete c.category,delete c.categoryValue})}Zl.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],ye(Zl,ne);function Ql(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 sg(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=Ql(i,r,o,a),u=Ql(i,r,o,s),l;c&&u?cg(c,o)>cg(u,o)?l=u:l=c:l=c||u,i.original=l}function n(i){var r=i.waypoints;t(r[0],r[1],Oe(i.source)),t(r[r.length-1],r[r.length-2],Oe(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}sg.$inject=["eventBus"];function cg(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Jl(e){ne.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=Ze(i);if(We(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}Jl.$inject=["eventBus"],ye(Jl,ne);function ug(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function lg(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function OC(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 DC(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 ep(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=DC([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 pg(e,t){var n=ep(e,t),i={x:n.x-e.x,y:n.y-e.y};return ug(i)}function fa(e,t){return ug({x:e.x-t.x,y:e.y-t.y})}var fg=Math.sqrt,dg=Math.min,LC=Math.max,hg=Math.abs;function mg(e){return Math.pow(e,2)}function da(e,t){return fg(mg(e.x-t.x)+mg(e.y-t.y))}function IC(e,t){var n=0,i,r,o,a,s,c,u,l,f,p,d;for(n=0;n<t.length-1;n++){if(i=t[n],r=t[n+1],yg(i,r)?u=[i]:(o=da(e,i),a=da(e,r),c=dg(o,a),u=BC(i,r,e,c)),u.length<1)throw new Error("expected between [1, 2] circle -> line intersections");u.length===1&&(l={type:"bendpoint",position:u[0],segmentIndex:n,bendpointIndex:yg(i,u[0])?n:n+1}),u.length===2&&(s=$C(u[0],u[1]),l={type:"segment",position:s,segmentIndex:n,relativeLocation:da(i,s)/da(i,r)}),f=da(l.position,e),(!d||p>f)&&(d=l,p=f)}return d}function BC(e,t,n,i){var r=t.x-e.x,o=t.y-e.y,a=n.x-e.x,s=n.y-e.y,c=r*r+o*o,u=r*a+o*s,l=a*a+s*s-i*i,f=u/c,p=l/c,d=f*f-p;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var g=fg(d),h=-f+g,m=-f-g,_={x:e.x-r*h,y:e.y-o*h};if(d===0)return[_];var y={x:e.x-r*m,y:e.y-o*m};return[_,y].filter(function(x){return NC(x,e,t)})}function NC(e,t,n){return gg(e.x,t.x,n.x)&&gg(e.y,t.y,n.y)}function gg(e,t,n){return e>=dg(t,n)-Js&&e<=LC(t,n)+Js}function $C(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Js=.1;function yg(e,t){return hg(e.x-t.x)<=Js&&hg(e.y-t.y)<=Js}function FC(e,t,n,i){var r=n.segmentIndex,o=t.length-e.length;if(i.segmentMove){var a=i.segmentMove.segmentStartIndex,s=i.segmentMove.newSegmentStartIndex;return r===a?s:r>=s?r+o<s?s:r+o:r}if(i.bendpointMove){var c=i.bendpointMove.insert,u=i.bendpointMove.bendpointIndex,l;if(o===0)return r;if(r>=u&&(l=c?r+1:r-1),r<u&&(l=r,c&&n.type!=="bendpoint"&&u-1===r)){var f=bg(t,u);f<n.relativeLocation&&l++}return l}return o===0?r:i.connectionStart&&r===0?0:i.connectionEnd&&r===e.length-2?t.length-2:Math.floor((t.length-2)/2)}function vg(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=IC(e,n),c=s.segmentIndex,u=FC(n,t,s,i);if(u<0||u>t.length-2||u===null)return a;var l=_g(n,c),f=_g(t,u),p=s.position,d=HC(l,p),g=jC(l,f);if(s.type==="bendpoint"){var h=t.length-n.length,m=s.bendpointIndex,_=n[m];if(t.indexOf(_)!==-1)return a;if(h===0){var y=t[m];return r=y.x-s.position.x,o=y.y-s.position.y,{delta:{x:r,y:o},point:{x:e.x+r,y:e.y+o}}}h<0&&m!==0&&m<n.length-1&&(d=bg(n,m))}var x={x:(f[1].x-f[0].x)*d+f[0].x,y:(f[1].y-f[0].y)*d+f[0].y},S=OC({x:e.x-p.x,y:e.y-p.y},g);return r=x.x+S.x-e.x,o=x.y+S.y-e.y,{point:ki(x),delta:ki({x:r,y:o})}}function bg(e,t){var n=fa(e[t-1],e[t]),i=fa(e[t],e[t+1]),r=n/(n+i);return r}function jC(e,t){var n=lg(e),i=lg(t);return i-n}function _g(e,t){return[e[t],e[t+1]]}function HC(e,t){var n=fa(e[0],e[1]),i=fa(e[0],t);return n===0?0:i/n}function zC(e,t,n,i){var r=Oe(e);return vg(r,t,n,i).delta}function ha(e,t,n){var i=ua(t),r=ua(n),o=oi(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return ki({x:r.x+a.x,y:r.y+a.y})}function xg(e,t,n){var i=ua(e),r=ua(t),o=ua(n),a=oi(e,i),s=oi(i,r),c=GC(i,t,n);if(c)return c;var u={x:s.x*(n.width/t.width),y:s.y*(n.height/t.height)},l={x:o.x+u.x,y:o.y+u.y};return ki({x:l.x+a.x-e.x,y:l.y+a.y-e.y})}function GC(e,t,n){var i=Te(t),r=Te(n);if(VC(i,r))return null;var o=tn(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=tn(n,s),c!==o?null:a}function VC(e,t){return WC(e,t)||UC(e,t)}function WC(e,t){return e.right!==t.right&&e.left!==t.left}function UC(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var wg="name",Eg="text";function tp(e,t,n,i){ne.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,u=s.properties;if(wg in u&&t.updateLabel(c,u[wg]),Eg in u&&w(c,"bpmn:TextAnnotation")){var l=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},u[Eg]||"");t.updateLabel(c,u.text,l)}}this.postExecute(["shape.create","connection.create"],function(a){var s=a.context,c=s.hints||{};if(c.createElementsBehavior!==!1){var u=s.shape||s.connection;Ge(u)||!ir(u)||Hn(u)&&t.updateLabel(u,Hn(u))}}),this.postExecute("shape.delete",function(a){var s=a.context,c=s.labelTarget,u=s.hints||{};c&&u.unsetLabel!==!1&&t.updateLabel(c,null,null,{removeShape:!1})});function o(a){var s=a.context,c=s.connection,u=c.label,l=V({},s.hints),f=s.newWaypoints||c.waypoints,p=s.oldWaypoints;return typeof l.startChanged>"u"&&(l.startChanged=!!l.connectionStart),typeof l.endChanged>"u"&&(l.endChanged=!!l.connectionEnd),zC(u,f,p,l)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(a){var s=a.context,c=s.hints||{};if(c.labelBehavior!==!1){var u=s.connection,l=u.label,f;!l||!l.parent||(f=o(a),t.moveShape(l,f))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,u=s.oldShape,l=ie(c);l&&ir(l)&&u.label&&c.label&&(c.label.x=u.label.x,c.label.y=u.label.y)}),this.preExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.hints||{};if(!(!Ge(c)||u.autoResize)){var l=s.newBounds,f=i.getDimensions(Hn(c)||"",{box:l,style:i.getExternalStyle()}),p=Math.ceil(f.height),d=l.y!==c.y,g=c.y+c.height;s.newBounds={width:l.width,height:p,x:l.x,y:d?g-p:l.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.newBounds,l=s.oldBounds;if(Bs(c)){var f=c.label,p=Oe(f),d=KC(l),g=YC(p,d),h=qC(g,l,u);t.moveShape(f,h)}})}ye(tp,ne),tp.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function qC(e,t,n){var i=ha(e,t,n);return ki(oi(i,e))}function YC(e,t){if(t.length){var n=XC(e,t);return ep(e,n)}}function KC(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 XC(e,t){var n=t.map(function(r){return{line:r,distance:pg(e,r)}}),i=ci(n,"distance");return i[0].line}function ZC(e,t,n,i){return vg(e,t,n,i).point}function np(e,t){ne.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=V({},o.hints),c=o.newWaypoints||a.waypoints,u=o.oldWaypoints;return typeof s.startChanged>"u"&&(s.startChanged=!!s.connectionStart),typeof s.endChanged>"u"&&(s.endChanged=!!s.connectionEnd),ZC(r,c,u,s)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming;s.forEach(function(c){var u=c.waypoints[c.waypoints.length-1],l=n(i,u),f=[].concat(c.waypoints.slice(0,-1),[l]);t.updateWaypoints(c,f)}),a.forEach(function(c){var u=c.waypoints[0],l=n(i,u),f=[].concat([l],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(u){var l=u.waypoints[u.waypoints.length-1],f={x:l.x+c.x,y:l.y+c.y},p=[].concat(u.waypoints.slice(0,-1),[f]);t.updateWaypoints(u,p)}),a.forEach(function(u){var l=u.waypoints[0],f={x:l.x+c.x,y:l.y+c.y},p=[].concat([f],u.waypoints.slice(1));t.updateWaypoints(u,p)})})}ye(np,ne),np.$inject=["eventBus","modeling"];function ec(e,t,n){var i=nc(e),r=Rg(i,t),o=i[0];return r.length?r[r.length-1]:ha(o.original||o,n,t)}function tc(e,t,n){var i=nc(e),r=Rg(i,t),o=i[i.length-1];return r.length?r[0]:ha(o.original||o,n,t)}function ip(e,t,n){var i=nc(e),r=Sg(t,n),o=i[0];return ha(o.original||o,r,t)}function rp(e,t,n){var i=nc(e),r=Sg(t,n),o=i[i.length-1];return ha(o.original||o,r,t)}function Sg(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function nc(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Rg(e,t){var n=sn(e,JC);return Ue(n,function(i){return QC(i,t)})}function QC(e,t){return tn(t,e,1)==="intersect"}function JC(e){return e.original||e}function op(e,t){ne.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(eP(i,r)){var o=tP(i);o.incoming.forEach(function(a){var s=tc(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=ec(a,r,i);t.reconnectStart(a,r,s)})}},!0)}op.$inject=["eventBus","modeling"],ye(op,ne);function eP(e,t){return w(e,"bpmn:Participant")&&Ye(e)&&w(t,"bpmn:Participant")&&!Ye(t)}function tP(e){var t=Jo([e]),n=[],i=[];return t.forEach(function(r){r!==e&&(r.incoming.forEach(function(o){w(o,"bpmn:MessageFlow")&&n.push(o)}),r.outgoing.forEach(function(o){w(o,"bpmn:MessageFlow")&&i.push(o)}))},[]),{incoming:n,outgoing:i}}const nP=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Cg(e){const t=ie(e);if(!w(t,"bpmn:BoundaryEvent")&&!(w(t,"bpmn:StartEvent")&&pn(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:nP.some(i=>w(n[0],i))}function Pg(e){return w(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function ap(e,t){e.invoke(ne,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!Cg(r))return;const a=Pg(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=ie(i).get(a),u=ie(r).get(a);c!==u&&t.updateProperties(r,{[a]:c})})}ap.$inject=["injector","modeling"],ye(ap,ne);function sp(e,t){ne.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=Ze(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}ye(sp,ne),sp.$inject=["eventBus","modeling"];function cp(e,t,n){ne.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(!(!w(o,"bpmn:SequenceFlow")||!w(a,"bpmn:SequenceFlow"))&&t.canConnect(o.source,a.target,o)){var s=iP(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}ye(cp,ne),cp.$inject=["eventBus","bpmnRules","modeling"];function _o(e){return e.original||e}function iP(e,t){var n=Ql(_o(e[e.length-2]),_o(e[e.length-1]),_o(t[1]),_o(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[_o(e[0]),_o(t[t.length-1])]}function up(e,t){ne.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,r=i.parent;w(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)}up.$inject=["eventBus","modeling"],ye(up,ne);function lp(e,t,n,i){ne.call(this,e);var r=i.get("dragging",!1);function o(c){var u=c.source,l=c.target,f=c.parent;if(f){var p,d;w(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(u,l)||(d=!0),n.canConnectMessageFlow(u,l)&&(p="bpmn:MessageFlow")),w(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(u,l)||(d=!0),n.canConnectSequenceFlow(u,l)&&(p="bpmn:SequenceFlow")),d&&t.removeConnection(c),p&&t.connect(u,l,{type:p,waypoints:c.waypoints.slice()})}}function a(c){var u=c.context,l=u.connection,f=u.newSource||l.source,p=u.newTarget||l.target,d,g;d=n.canConnect(f,p),!(!d||d.type===l.type)&&(g=t.connect(f,p,{type:d.type,associationDirection:d.associationDirection,waypoints:l.waypoints.slice()}),l.parent&&t.removeConnection(l),u.connection=g,r&&s(l,g))}function s(c,u){var l=r.context(),f=l&&l.payload.previousSelection,p;!f||!f.length||(p=f.indexOf(c),p!==-1&&f.splice(p,1,u))}this.postExecuted("elements.move",function(c){var u=c.closure,l=u.allConnections;I(l,o)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var u=c.context,l=u.properties,f=u.element,p=f.businessObject,d;l.default&&(d=pt(f.outgoing,eo({id:f.businessObject.default.id})),d&&t.updateProperties(d,{conditionExpression:void 0})),l.conditionExpression&&p.sourceRef.default===p&&t.updateProperties(f.source,{default:void 0})})}ye(lp,ne),lp.$inject=["eventBus","modeling","bpmnRules","injector"];function ic(e,t,n,i,r,o){i.invoke(ne,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,function(a){var s=a.context,c=s.parent,u=s.elements,l=Rn(u,function(f,p){var d=t.canReplace([p],p.host||p.parent||c);return d?f.concat(d.replacements):f},[]);l.length&&this._replaceElements(u,l)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,u=s.newHost,l=[];I(s.closure.topLevel,function(p){pn(p)?l=l.concat(p.children):l=l.concat(p)}),l.length===1&&u&&(c=u);var f=t.canReplace(l,c);f&&this._replaceElements(l,f.replacements,u)},this),this.postExecute(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,u=s.newShape,l=c.attachers,f;l&&l.length&&(f=t.canReplace(l,u),this._replaceElements(l,f.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,u=s.newShape;r.unclaimId(c.businessObject.id,c.businessObject),r.updateProperties(u,{id:c.id})})}ye(ic,ne),ic.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;I(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)},ic.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var rP=1500,oP={width:140,height:120},pp={width:300,height:60},fp={width:60,height:300},rc={width:300,height:150},oc={width:150,height:300},Ag={width:140,height:120},Tg={width:100,height:40};function Mg(e){e.on("resize.start",rP,function(t){var n=t.context,i=n.shape,r=n.direction,o=n.balanced;(w(i,"bpmn:Lane")||w(i,"bpmn:Participant"))&&(n.resizeConstraints=lP(i,r,o)),w(i,"bpmn:SubProcess")&&Ye(i)&&(n.minDimensions=Ag),w(i,"bpmn:TextAnnotation")&&(n.minDimensions=Tg)})}Mg.$inject=["eventBus"];var ar=Math.abs,aP=Math.min,sP=Math.max;function kg(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function xo(e,t,n){return kg(e,t,n,aP)}function wo(e,t,n){return kg(e,t,n,sP)}var cP={top:20,left:50,right:20,bottom:20},uP={top:50,left:20,right:20,bottom:20};function lP(e,t,n){var i=Yn(e),r=!0,o=!0,a=Ks(i,[i]),s=Te(e),c={},u={},l=Xt(e),f=l?pp:fp;/n/.test(t)?u.top=s.bottom-f.height:/e/.test(t)?u.right=s.left+f.width:/s/.test(t)?u.bottom=s.top+f.height:/w/.test(t)&&(u.left=s.right-f.width),a.forEach(function(g){var h=Te(g);l?(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&&ar(s.top-h.bottom)<10&&wo(c,"top",h.top+f.height),ar(s.top-h.top)<5&&xo(u,"top",h.bottom-f.height)),/e/.test(t)&&(n&&ar(s.right-h.left)<10&&xo(c,"right",h.right-f.width),ar(s.right-h.right)<5&&wo(u,"right",h.left+f.width)),/s/.test(t)&&(n&&ar(s.bottom-h.top)<10&&xo(c,"bottom",h.bottom-f.height),ar(s.bottom-h.bottom)<5&&wo(u,"bottom",h.top+f.height)),/w/.test(t)&&(n&&ar(s.left-h.right)<10&&wo(c,"left",h.left+f.width),ar(s.left-h.left)<5&&xo(u,"left",h.right-f.width))});var p=i.children.filter(function(g){return!g.hidden&&!g.waypoints&&(w(g,"bpmn:FlowElement")||w(g,"bpmn:Artifact"))}),d=l?cP:uP;return p.forEach(function(g){var h=Te(g);/n/.test(t)&&(!l||r)&&xo(u,"top",h.top-d.top),/e/.test(t)&&(l||o)&&wo(u,"right",h.right+d.right),/s/.test(t)&&(!l||o)&&wo(u,"bottom",h.bottom+d.bottom),/w/.test(t)&&(l||r)&&xo(u,"left",h.left-d.left)}),{min:u,max:c}}function Og(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function Eo(e){return e.originalEvent||e.srcEvent}function dp(e){Og(e),Og(Eo(e))}function Ir(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 Dg(){return/mac/i.test(navigator.platform)}function Lg(e,t){return(Eo(e)||e).button===t}function sr(e){return Lg(e,0)}function pP(e){return Lg(e,1)}function ma(e){var t=Eo(e)||e;return sr(e)?Dg()?t.metaKey:t.ctrlKey:!1}function ac(e){var t=Eo(e)||e;return sr(e)&&t.shiftKey}var Ig=1001;function Bg(e,t){e.on("resize.start",Ig+500,function(n){var i=n.context,r=i.shape;(w(r,"bpmn:Lane")||w(r,"bpmn:Participant"))&&(i.balanced=!ma(n))}),e.on("resize.end",Ig,function(n){var i=n.context,r=i.shape,o=i.canExecute,a=i.newBounds;if(w(r,"bpmn:Lane")||w(r,"bpmn:Participant"))return o&&(a=pm(a),t.resizeLane(r,a,i.balanced)),!1})}Bg.$inject=["eventBus","modeling"];var fP=500;function hp(e,t,n,i,r){n.invoke(ne,this);function o(l){return We(l,["bpmn:ReceiveTask","bpmn:SendTask"])||dP(l,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(l){var f=e.getDefinitions(),p=f.get("rootElements");return!!pt(p,eo({id:l.id}))}function s(l){if(w(l,"bpmn:ErrorEventDefinition"))return"errorRef";if(w(l,"bpmn:EscalationEventDefinition"))return"escalationRef";if(w(l,"bpmn:MessageEventDefinition"))return"messageRef";if(w(l,"bpmn:SignalEventDefinition"))return"signalRef"}function c(l){if(We(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.get("messageRef");var f=l.get("eventDefinitions"),p=f[0];return p.get(s(p))}function u(l,f){if(We(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.set("messageRef",f);var p=l.get("eventDefinitions"),d=p[0];return d.set(s(d),f)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var f=l.shape||l.element;if(o(f)){var p=ie(f),d=c(p),g;d&&!a(d)&&(g=e.getDefinitions().get("rootElements"),At(g,d),l.addedRootElement=d)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var f=l.addedRootElement;if(f){var p=e.getDefinitions().get("rootElements");Ct(p,f)}},!0),t.on("copyPaste.copyElement",function(l){var f=l.descriptor,p=l.element;if(!(p.labelTarget||!o(p))){var d=ie(p),g=c(d);g&&(f.referencedRootElement=g)}}),t.on("copyPaste.pasteElement",fP,function(l){var f=l.descriptor,p=f.businessObject,d=f.referencedRootElement;d&&(a(d)||(d=i.copyElement(d,r.create(d.$type))),u(p,d),delete f.referencedRootElement)})}hp.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],ye(hp,ne);function dP(e,t){return ke(t)||(t=[t]),Wi(t,function(n){return ho(e,n)})}var Ng=Math.max;function $g(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return I(n,function(a){var s=a.id;w(a,"bpmn:Participant")&&(o[s]=mP(a,i,r)),w(a,"bpmn:Lane")&&(o[s]=Xt(a)?pp:fp),w(a,"bpmn:SubProcess")&&Ye(a)&&(o[s]=Ag),w(a,"bpmn:TextAnnotation")&&(o[s]=Tg),w(a,"bpmn:Group")&&(o[s]=oP)}),o})}$g.$inject=["eventBus"];function hP(e){return e==="x"}function mP(e,t,n){var i=Xt(e);if(!vP(e))return i?rc:oc;var r=hP(t),o={};return r?i?o=rc:o={width:yP(e,n,r),height:oc.height}:i?o={width:rc.width,height:gP(e,n,r)}:o=oc,o}function gP(e,t,n){var i;return i=bP(e,t,n),Ng(rc.height,i)}function yP(e,t,n){var i;return i=_P(e,t,n),Ng(oc.width,i)}function vP(e){return!!or(e).length}function bP(e,t,n){var i=or(e),r;return r=mp(i,t,n),e.height-r.height+pp.height}function _P(e,t,n){var i=or(e),r;return r=mp(i,t,n),e.width-r.width+fp.width}function mp(e,t,n){var i,r,o;for(i=0;i<e.length;i++)if(r=e[i],!n&&t>=r.y&&t<=r.y+r.height||n&&t>=r.x&&t<=r.x+r.width)return o=or(r),o.length?mp(o,t,n):r}var Fg="_plane";function jg(e){var t=e.id;return xP(t)}function vi(e){var t=e.id;return w(e,"bpmn:SubProcess")?Hg(t):t}function Br(e){return Hg(e)}function sc(e){var t=Ze(e);return w(t,"bpmndi:BPMNPlane")}function Hg(e){return e+Fg}function xP(e){return e.replace(new RegExp(Fg+"$"),"")}var zg=400,wP=600,Gg={x:180,y:160};function Ii(e,t,n,i,r,o,a){ne.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 w(f,"bpmn:SubProcess")&&!Ye(f)}function u(f){var p=f.shape,d=f.newRootElement,g=ie(p);d=s._addDiagram(d||g),f.newRootElement=e.addRootElement(d)}function l(f){var p=f.shape,d=ie(p);s._removeDiagram(d);var g=f.newRootElement=a.get(vi(d));e.removeRootElement(g)}this.executed("shape.create",function(f){var p=f.shape;c(p)&&u(f)},!0),this.postExecuted("elements.create",function(f){var p=f.elements;I(p,function(d){if(c(d)){var g=a.get(vi(d));if(!(!g||!d.children||!d.children.length)){var h=Vg(d);s._showRecursively(h),s._moveChildrenToShape(h,g)}}})},!0),this.reverted("shape.create",function(f){var p=f.shape;c(p)&&l(f)},!0),this.preExecute("shape.delete",function(f){var p=f.shape;!w(p,"bpmn:SubProcess")||!Ye(p)||I(oa([p]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(f){var p=f.shape;if(c(p)){var d=a.get(vi(p));d&&n.removeElements(d.children.slice())}},!0),this.executed("shape.delete",function(f){var p=f.shape;c(p)&&l(f)},!0),this.reverted("shape.delete",function(f){var p=f.shape;c(p)&&u(f)},!0),this.preExecuted("shape.replace",function(f){var p=f.oldShape,d=f.newShape;!c(p)||!c(d)||(f.oldRoot=e.removeRootElement(vi(p)))},!0),this.postExecuted("shape.replace",function(f){var p=f.newShape,d=f.oldRoot,g=e.findRoot(vi(p));if(!(!d||!g)){var h=d.children;n.moveElements(h,{x:0,y:0},g)}},!0),this.executed("element.updateProperties",function(f){var p=f.element;if(w(p,"bpmn:SubProcess")){var d=f.properties,g=f.oldProperties,h=g.id,m=d.id;if(h!==m){if(sc(p)){a.updateId(p,Br(m)),a.updateId(h,m);return}var _=a.get(Br(h));_&&a.updateId(Br(h),Br(m))}}},!0),this.reverted("element.updateProperties",function(f){var p=f.element;if(w(p,"bpmn:SubProcess")){var d=f.properties,g=f.oldProperties,h=g.id,m=d.id;if(h!==m){if(sc(p)){a.updateId(p,Br(h)),a.updateId(m,h);return}var _=a.get(Br(m));_&&a.updateId(_,Br(h))}}},!0),t.on("element.changed",function(f){var p=f.element;if(sc(p)){var d=p,g=a.get(jg(d));!g||g===d||t.fire("element.changed",{element:g})}}),this.executed("shape.toggleCollapse",zg,function(f){var p=f.shape;w(p,"bpmn:SubProcess")&&(Ye(p)?l(f):(u(f),s._showRecursively(p.children)))},!0),this.reverted("shape.toggleCollapse",zg,function(f){var p=f.shape;w(p,"bpmn:SubProcess")&&(Ye(p)?l(f):(u(f),s._showRecursively(p.children)))},!0),this.postExecuted("shape.toggleCollapse",wP,function(f){var p=f.shape;if(w(p,"bpmn:SubProcess")){var d=f.newRootElement;if(d)if(Ye(p))s._moveChildrenToShape(d.children.slice(),p),I(oa(p.children),h=>{n.moveShape(h.annotation,{x:0,y:0},p.parent),I(h.associations,m=>{n.moveConnection(m,{x:0,y:0},p.parent)})});else{s._disconnectSharedAnnotations(p);var g=Vg(p);s._moveChildrenToShape(g,d)}}},!0),t.on("copyPaste.createTree",function(f){var p=f.element,d=f.children;if(c(p)){var g=vi(p),h=a.get(g);h&&d.push.apply(d,h.children)}}),t.on("copyPaste.copyElement",function(f){var p=f.descriptor,d=f.element,g=f.elements,h=d.parent,m=w(Ze(h),"bpmndi:BPMNPlane");if(m){var _=jg(h),y=pt(g,function(x){return x.id===_});y&&(p.parent=y.id)}}),t.on("copyPaste.pasteElement",function(f){var p=f.descriptor;p.parent&&(c(p.parent)||p.parent.hidden)&&(p.hidden=!0)})}ye(Ii,ne),Ii.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=kt(i),o;if(!t.x)o={x:Gg.x-r.x,y:Gg.y-r.y};else{var a=Oe(t),s=Oe(r);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}},Ii.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(Lm(e).map(i=>i.annotation));n.size&&I(oa(e.children),i=>{n.has(i.annotation)&&I(i.associations,r=>{t.removeConnection(r)})})},Ii.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},Ii.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},Ii.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,i=t.create("bpmndi:BPMNPlane",{bpmnElement:e}),r=t.create("bpmndi:BPMNDiagram",{plane:i});i.$parent=r;var o=n.createRoot({id:vi(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},Ii.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=pt(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},Ii.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function EP(e){var t=[];return I(oa(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function Vg(e){return e.children.slice().concat(EP(e.children)).concat(SP(e))}function SP(e){return _l(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function gp(e,t){e.invoke(ne,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,r=n.context.newShape;if(!(!w(r,"bpmn:SubProcess")||w(r,"bpmn:AdHocSubProcess")||!(w(i,"bpmn:Task")||w(i,"bpmn:CallActivity"))||!Ye(r))){var o=RP(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}gp.$inject=["injector","modeling"],ye(gp,ne);function RP(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function yp(e,t){ne.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;w(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&&w(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(!(!w(r,"bpmn:TextAnnotation")||o.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,Hn(r)||""),c=a.y!==r.y&&Math.abs(a.y+a.height-(r.y+r.height))<=1,u=r.y+r.height;i.newBounds={width:a.width,height:s.height,x:a.x,y:c?u-s.height:a.y}}})}ye(yp,ne),yp.$inject=["eventBus","textRenderer"];function vp(e,t){ne.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(Ye(i))return;var r=Jo(i);r.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();I(s,function(u){o(u,!0)}),I(c,function(u){o(u,!1)})});function o(a,s){r.indexOf(a.source)!==-1&&r.indexOf(a.target)!==-1||w(a,"bpmn:Association")&&(w(a.source,"bpmn:TextAnnotation")||w(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,Oe(i)):t.reconnectStart(a,i,Oe(i)))}},!0)}ye(vp,ne),vp.$inject=["eventBus","modeling"];var bp=500;function _p(e,t,n){ne.call(this,e);function i(a){a.length&&a.forEach(function(s){s.type==="label"&&!s.businessObject.name&&(s.hidden=!0)})}function r(a,s){var c=a.children,u=s,l,f;return l=CP(c).concat([a]),f=Qm(l),f?(u.width=Math.max(f.width,u.width),u.height=Math.max(f.height,u.height),u.x=f.x+(f.width-u.width)/2,u.y=f.y+(f.height-u.height)/2):(u.x=a.x+(a.width-u.width)/2,u.y=a.y+(a.height-u.height)/2),u}function o(a,s){return{x:a.x+(a.width-s.width)/2,y:a.y+(a.height-s.height)/2,width:s.width,height:s.height}}this.executed(["shape.toggleCollapse"],bp,function(a){var s=a.context,c=s.shape;w(c,"bpmn:SubProcess")&&(c.collapsed?Ze(c).isExpanded=!1:(i(c.children),Ze(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],bp,function(a){var s=a.context,c=s.shape;c.collapsed?Ze(c).isExpanded=!1:Ze(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],bp,function(a){var s=a.context.shape,c=t.getDefaultSize(s),u;s.collapsed?u=o(s,c):u=r(s,c),n.resizeShape(s,u,null,{autoResize:s.collapsed?!1:"nwse"})})}ye(_p,ne),_p.$inject=["eventBus","elementFactory","modeling"];function CP(e){return e.filter(function(t){return!t.hidden})}function xp(e,t,n,i){t.invoke(ne,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;Ge(a)||(w(a,"bpmn:Participant")&&Ye(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;w(r,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}ye(xp,ne),xp.$inject=["canvas","injector","moddle","modeling"];function wp(e,t){ne.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;PP(r,o)&&t.updateProperties(o,{default:null})})}ye(wp,ne),wp.$inject=["eventBus","modeling"];function PP(e,t){if(!w(e,"bpmn:SequenceFlow"))return!1;var n=ie(t),i=ie(e);return n.get("default")===i}var AP=500,TP=5e3,Wg=["shape.create","shape.delete","shape.move","shape.resize"],Ug=[...Wg,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function Ep(e,t){ne.call(this,e);var n;function i(){return n=n||new MP,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(Ug,TP,function(){i()}),this.postExecuted(Ug,AP,function(){o()}),this.preExecute(Wg,function(a){var s=a.context,c=s.shape,u=r();!c||c.labelTarget||(w(c,"bpmn:Lane")&&u.addLane(c),w(c,"bpmn:FlowNode")&&u.addFlowNode(c))})}Ep.$inject=["eventBus","modeling"],ye(Ep,ne);function MP(){this.flowNodes=[],this.lanes=[],this.counter=0,this.addLane=function(e){this.lanes.push(e)},this.addFlowNode=function(e){this.flowNodes.push(e)},this.enter=function(){this.counter++},this.leave=function(){return this.counter--,!this.counter}}var kP=500,OP=5e3,qg=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],Yg=[...qg,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function Sp(e,t){ne.call(this,e);var n;function i(){return n=n||new DP,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(Yg,OP,function(){i()}),this.postExecuted(Yg,kP,function(){o()}),this.preExecute(qg,function(a){var s=a.context.connection||a.context.shape,c=r();!s||s.labelTarget||(w(s,"bpmn:FlowElement")&&c.addFlowElement(s),w(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;w(s,"bpmn:Group")&&r().addGroup(s)})}Sp.$inject=["eventBus","modeling"],ye(Sp,ne);function DP(){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 Rp(e,t){ne.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)LP(o)&&!BP(o)&&t.updateProperties(o,{isForCompensation:void 0})})}ye(Rp,ne),Rp.$inject=["eventBus","modeling"];function LP(e){const t=ie(e);return t&&t.isForCompensation}function IP(e){return e&&w(e,"bpmn:BoundaryEvent")&&ho(e,"bpmn:CompensateEventDefinition")}function BP(e){return e.incoming.filter(n=>IP(n.source)).length>0}const NP={__init__:["adaptiveLabelPositioningBehavior","appendBehavior","artifactBehavior","associationBehavior","attachEventBehavior","boundaryEventBehavior","categoryRootElementReferenceBehavior","compensateBoundaryEventBehaviour","createBehavior","createDataObjectBehavior","createParticipantBehavior","dataInputAssociationBehavior","dataStoreBehavior","deleteLaneBehavior","detachEventBehavior","dropOnFlowBehavior","eventBasedGatewayBehavior","fixHoverBehavior","groupBehavior","importDockingFix","isHorizontalFix","labelBehavior","layoutConnectionBehavior","messageFlowBehavior","nonInterruptingBehavior","removeElementBehavior","removeEmbeddedLabelBoundsBehavior","removeParticipantBehavior","replaceConnectionBehavior","replaceElementBehaviour","resizeBehavior","resizeLaneBehavior","rootElementReferenceBehavior","spaceToolBehavior","subProcessPlaneBehavior","subProcessStartEventBehavior","textAnnotationBehavior","toggleCollapseConnectionBehaviour","toggleElementCollapseBehaviour","unclaimIdBehavior","updateFlowNodeRefsBehavior","updateCategoryValueRefsBehavior","unsetDefaultFlowBehavior","setCompensationActivityAfterPasteBehavior"],adaptiveLabelPositioningBehavior:["type",Dl],appendBehavior:["type",Ll],associationBehavior:["type",Bl],attachEventBehavior:["type",zs],artifactBehavior:["type",Il],boundaryEventBehavior:["type",Nl],categoryRootElementReferenceBehavior:["type",$l],compensateBoundaryEventBehaviour:["type",Fl],createBehavior:["type",jl],createDataObjectBehavior:["type",Hl],createParticipantBehavior:["type",Vl],dataInputAssociationBehavior:["type",Wl],dataStoreBehavior:["type",Ul],deleteLaneBehavior:["type",ql],detachEventBehavior:["type",Xs],dropOnFlowBehavior:["type",Kl],eventBasedGatewayBehavior:["type",Xl],fixHoverBehavior:["type",og],groupBehavior:["type",Zl],importDockingFix:["type",sg],isHorizontalFix:["type",Jl],labelBehavior:["type",tp],layoutConnectionBehavior:["type",np],messageFlowBehavior:["type",op],nonInterruptingBehavior:["type",ap],removeElementBehavior:["type",cp],removeEmbeddedLabelBoundsBehavior:["type",sp],removeParticipantBehavior:["type",up],replaceConnectionBehavior:["type",lp],replaceElementBehaviour:["type",ic],resizeBehavior:["type",Mg],resizeLaneBehavior:["type",Bg],rootElementReferenceBehavior:["type",hp],spaceToolBehavior:["type",$g],subProcessPlaneBehavior:["type",Ii],subProcessStartEventBehavior:["type",gp],textAnnotationBehavior:["type",yp],toggleCollapseConnectionBehaviour:["type",vp],toggleElementCollapseBehaviour:["type",_p],unclaimIdBehavior:["type",xp],unsetDefaultFlowBehavior:["type",wp],updateFlowNodeRefsBehavior:["type",Ep],updateCategoryValueRefsBehavior:["type",Sp],setCompensationActivityAfterPasteBehavior:["type",Rp]};function Cp(e){this._commandStack=e.get("commandStack",!1)}Cp.$inject=["injector"],Cp.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const bi={__init__:["rules"],rules:["type",Cp]};function Kn(e){ne.call(this,e),this.init()}Kn.$inject=["eventBus"],ye(Kn,ne),Kn.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)})},Kn.prototype.init=function(){};function Kg(e,t){var n=tn(e,t,-15);return n!=="intersect"?n:null}function rn(e){Kn.call(this,e)}ye(rn,Kn),rn.$inject=["eventBus"],rn.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return $P(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 uc(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return uc(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 cy(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return at(i)&&!lc(t,i)?!1:Rr(t,function(r){return at(r)?uc(r.source,r.target,r):r.host?ga(r,r.host,null,n):Mp(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 ny(a)&&!n.includes(a.host)})?!1:ga(n,t,null,i)||ay(n,t,i)||sy(n,t)||lc(n,t)}),this.addRule("shape.create",function(e){return Mp(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return ga(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return dy(n,t)})},rn.prototype.canConnectMessageFlow=py,rn.prototype.canConnectSequenceFlow=fy,rn.prototype.canConnectDataAssociation=kp,rn.prototype.canConnectAssociation=uy,rn.prototype.canConnectCompensationAssociation=ly,rn.prototype.canMove=sy,rn.prototype.canAttach=ga,rn.prototype.canReplace=ay,rn.prototype.canDrop=So,rn.prototype.canInsert=lc,rn.prototype.canCreate=Mp,rn.prototype.canConnect=uc,rn.prototype.canResize=cy,rn.prototype.canCopy=dy;function $P(e){return Pp(e)?null:We(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function Pp(e){return!e||Ge(e)}function Xg(e){do{if(w(e,"bpmn:Process"))return ie(e);if(w(e,"bpmn:Participant"))return ie(e).processRef||ie(e)}while(e=e.parent)}function Ap(e){return w(e,"bpmn:TextAnnotation")}function Tp(e){return w(e,"bpmn:Group")&&!e.labelTarget}function Zg(e){return w(e,"bpmn:BoundaryEvent")&&_i(e,"bpmn:CompensateEventDefinition")}function cc(e){return ie(e).isForCompensation}function FP(e,t){var n=Xg(e),i=Xg(t);return n===i}function jP(e){return w(e,"bpmn:InteractionNode")&&!w(e,"bpmn:BoundaryEvent")&&(!w(e,"bpmn:Event")||w(e,"bpmn:ThrowEvent")&&ey(e,"bpmn:MessageEventDefinition"))}function HP(e){return w(e,"bpmn:InteractionNode")&&!cc(e)&&(!w(e,"bpmn:Event")||w(e,"bpmn:CatchEvent")&&ey(e,"bpmn:MessageEventDefinition"))&&!(w(e,"bpmn:BoundaryEvent")&&!_i(e,"bpmn:MessageEventDefinition"))}function Qg(e){for(var t=e;t=t.parent;){if(w(t,"bpmn:FlowElementsContainer"))return ie(t);if(w(t,"bpmn:Participant"))return ie(t).processRef}return null}function Jg(e,t){var n=Qg(e),i=Qg(t);return n===i}function _i(e,t){var n=ie(e);return!!pt(n.eventDefinitions||[],function(i){return w(i,t)})}function ey(e,t){var n=ie(e);return(n.eventDefinitions||[]).every(function(i){return w(i,t)})}function zP(e){return w(e,"bpmn:FlowNode")&&!w(e,"bpmn:EndEvent")&&!pn(e)&&!(w(e,"bpmn:IntermediateThrowEvent")&&_i(e,"bpmn:LinkEventDefinition"))&&!Zg(e)&&!cc(e)}function GP(e){return w(e,"bpmn:FlowNode")&&!w(e,"bpmn:StartEvent")&&!w(e,"bpmn:BoundaryEvent")&&!pn(e)&&!(w(e,"bpmn:IntermediateCatchEvent")&&_i(e,"bpmn:LinkEventDefinition"))&&!cc(e)}function VP(e){return w(e,"bpmn:ReceiveTask")||w(e,"bpmn:IntermediateCatchEvent")&&(_i(e,"bpmn:MessageEventDefinition")||_i(e,"bpmn:TimerEventDefinition")||_i(e,"bpmn:ConditionalEventDefinition")||_i(e,"bpmn:SignalEventDefinition"))}function WP(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function ty(e,t){var n=WP(t);return n.indexOf(e)!==-1}function uc(e,t,n){if(Pp(e)||Pp(t))return null;if(!w(n,"bpmn:DataAssociation")){if(py(e,t))return{type:"bpmn:MessageFlow"};if(fy(e,t))return{type:"bpmn:SequenceFlow"}}var i=kp(e,t);return i||(ly(e,t)?{type:"bpmn:Association",associationDirection:"One"}:uy(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function So(e,t){return Ge(e)||Tp(e)?!0:w(t,"bpmn:Participant")&&!Ye(t)?!1:w(e,"bpmn:Participant")?w(t,"bpmn:Process")||w(t,"bpmn:Collaboration"):We(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:w(e,"bpmn:Lane")?w(t,"bpmn:Participant")||w(t,"bpmn:Lane"):w(e,"bpmn:BoundaryEvent")&&!UP(e)?!1:w(e,"bpmn:FlowElement")&&!w(e,"bpmn:DataStoreReference")?w(t,"bpmn:FlowElementsContainer")?Ye(t):We(t,["bpmn:Participant","bpmn:Lane"]):w(e,"bpmn:DataStoreReference")&&w(t,"bpmn:Collaboration")?Wi(ie(t).get("participants"),function(n){return!!n.get("processRef")}):We(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?We(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):w(e,"bpmn:MessageFlow")?w(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function UP(e){return ie(e).cancelActivity&&(iy(e)||ry(e))}function ny(e){return!Ge(e)&&w(e,"bpmn:BoundaryEvent")}function qP(e){return w(e,"bpmn:Lane")}function YP(e){return ny(e)||w(e,"bpmn:IntermediateThrowEvent")&&iy(e)?!0:w(e,"bpmn:IntermediateCatchEvent")&&ry(e)}function iy(e){var t=ie(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function ry(e){return oy(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function oy(e,t){return t.some(function(n){return _i(e,n)})}function KP(e){return w(e,"bpmn:ReceiveTask")&&pt(e.incoming,function(t){return w(t.source,"bpmn:EventBasedGateway")})}function ga(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return Ge(r)||!YP(r)||pn(t)||!w(t,"bpmn:Activity")||cc(t)||i&&!Kg(i,t)||KP(t)?!1:"attach"}function ay(e,t,n){if(!t)return!1;var i={replacements:[]};return I(e,function(r){pn(t)||w(r,"bpmn:StartEvent")&&r.type!=="label"&&So(r,t)&&(rR(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(oR(r)||aR(r)||sR(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),oy(r,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&w(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"})),w(t,"bpmn:Transaction")||_i(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(w(r,"bpmn:EndEvent")&&So(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),w(r,"bpmn:BoundaryEvent")&&ga(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function sy(e,t){return Wi(e,qP)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return So(n,t)})}function Mp(e,t,n,i){return t?Ge(e)||Tp(e)?!0:So(e,t)||lc(e,t):!1}function cy(e,t,n){return w(e,"bpmn:SubProcess")?Ye(e)&&(!t||t.width>=100&&t.height>=80):w(e,"bpmn:Lane")||w(e,"bpmn:Participant")?!0:Ap(e)?n?n==="e"||n==="w":!0:Tp(e)?!0:Ge(e)?n?n==="e"||n==="w":!0:!1}function XP(e,t){var n=Ap(e),i=Ap(t);return(n||i)&&n!==i}function uy(e,t){return ty(t,e)||ty(e,t)?!1:XP(e,t)?!0:!!kp(e,t)}function ly(e,t){return Jg(e,t)&&Zg(e)&&w(t,"bpmn:Activity")&&!QP(t,e)&&!pn(t)}function py(e,t){return my(e)&&!my(t)?!1:jP(e)&&HP(t)&&!FP(e,t)}function fy(e,t){return zP(e)&&GP(t)&&Jg(e,t)&&!(w(e,"bpmn:EventBasedGateway")&&!VP(t))}function kp(e,t){return We(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&We(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:We(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&We(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function lc(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:We(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!Ge(t)&&w(e,"bpmn:FlowNode")&&!w(e,"bpmn:BoundaryEvent")&&So(e,t.parent)}function Op(e,t){return e&&t&&e.indexOf(t)!==-1}function dy(e,t){return Ge(t)?!0:!(w(t,"bpmn:Lane")&&!Op(e,t.parent)||w(t,"bpmn:MessageFlow")&&!ZP(e,t))}function ZP(e,t){var n=hy(t.source),i=hy(t.target);return Op(e,n)&&Op(e,i)}function hy(e){for(;e;e=e.parent)if(w(e,"bpmn:Participant"))return e;return null}function my(e){return yo(e,"bpmn:Process")||yo(e,"bpmn:Collaboration")}function QP(e,t){return e.attachers.includes(t)}const JP={__depends__:[bi],__init__:["bpmnRules"],bpmnRules:["type",rn]};var eA=2e3;function gy(e,t){e.on("saveXML.start",eA,n);function n(){var i=t.getRootElements();I(i,function(r){var o=Ze(r),a,s;a=Jo([r]),a=Ue(a,function(c){return c!==r&&!c.labelTarget}),s=sn(a,Ze),o.set("planeElement",s)})}}gy.$inject=["eventBus","canvas"];const tA={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",gy]};function pc(e){ne.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)})}pc.prototype.getOrdering=function(e,t){return null},ye(pc,ne);function Dp(e,t){pc.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=pt(n,function(c){return We(a,[c.type])});return s&&s.order||{level:1}}function r(a){var s=a.order;if(s||(a.order=s=i(a)),!s)throw new Error(`no order for <${a.id}>`);return s}function o(a,s,c){for(var u=s;u&&!We(u,c);)u=u.parent;if(!u)throw new Error(`no parent for <${a.id}> in <${s&&s.id}>`);return u}this.getOrdering=function(a,s){if(a.labelTarget||w(a,"bpmn:TextAnnotation"))return{parent:t.findRoot(s)||t.getRootElement(),index:-1};var c=r(a);c.containers&&(s=o(a,s,c.containers));var u=s.children.indexOf(a),l=pd(s.children,function(f){return!a.labelTarget&&f.labelTarget?!1:c.level<r(f).level});return l!==-1&&u!==-1&&u<l&&(l-=1),{index:l,parent:s}}}Dp.$inject=["eventBus","canvas"],ye(Dp,pc);const nA={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Dp]};function ya(){}ya.prototype.get=function(){return this._data},ya.prototype.set=function(e){this._data=e},ya.prototype.clear=function(){var e=this._data;return delete this._data,e},ya.prototype.isEmpty=function(){return!this._data};const iA={clipboard:["type",ya]};var yy=1500;function vy(e,t,n){var i=this,r=n.get("dragging",!1);function o(a){if(!a.hover){var s=a.originalEvent,c=i._findTargetGfx(s),u=c&&e.get(c);c&&u&&(a.stopPropagation(),r.hover({element:u,gfx:c}),r.move(s))}}r&&t.on("drag.start",function(a){t.once("drag.move",yy,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",yy,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=Ir(a),c=document.elementFromPoint(s.x,s.y),rA(c)}}vy.$inject=["elementRegistry","eventBus","injector"];function rA(e){return Tr(e,"svg, .djs-element",!0)}const oA={__init__:["hoverFix"],hoverFix:["type",vy]};function aA(e){return!0}function fc(e){return sr(e)||pP(e)}var by=500;function _y(e,t,n){var i=this;function r(T,j,k){if(!s(T,j)){var D,z,se;k?z=t.getGraphics(k):(D=j.delegateTarget||j.target,D&&(z=D,k=t.get(z))),!(!z||!k)&&(se=e.fire(T,{element:k,gfx:z,originalEvent:j}),se===!1&&(j.stopPropagation(),j.preventDefault()))}}var o={};function a(T){return o[T]}function s(T,j){var k=u[T]||sr;return!k(j)}var c={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},u={"element.contextmenu":aA,"element.mousedown":fc,"element.mouseup":fc,"element.click":fc,"element.dblclick":fc};function l(T,j,k){var D=c[T];if(!D)throw new Error("unmapped DOM event name <"+T+">");return r(D,j,k)}var f="svg, .djs-element";function p(T,j,k,D){var z=o[k]=function(se){r(k,se)};D&&(u[k]=D),z.$delegate=Pn.bind(T,f,j,z)}function d(T,j,k){var D=a(k);D&&Pn.unbind(T,j,D.$delegate)}function g(T){I(c,function(j,k){p(T,k,j)})}function h(T){I(c,function(j,k){d(T,k,j)})}e.on("canvas.destroy",function(T){h(T.svg)}),e.on("canvas.init",function(T){g(T.svg)}),e.on(["shape.added","connection.added"],function(T){var j=T.element,k=T.gfx;e.fire("interactionEvents.createHit",{element:j,gfx:k})}),e.on(["shape.changed","connection.changed"],by,function(T){var j=T.element,k=T.gfx;e.fire("interactionEvents.updateHit",{element:j,gfx:k})}),e.on("interactionEvents.createHit",by,function(T){var j=T.element,k=T.gfx;i.createDefaultHit(j,k)}),e.on("interactionEvents.updateHit",function(T){var j=T.element,k=T.gfx;i.updateDefaultHit(j,k)});var m=P("djs-hit djs-hit-stroke"),_=P("djs-hit djs-hit-click-stroke"),y=P("djs-hit djs-hit-all"),x=P("djs-hit djs-hit-no-move"),S={all:y,"click-stroke":_,stroke:m,"no-move":x};function P(T,j){return j=V({stroke:"white",strokeWidth:15},j||{}),n.cls(T,["no-fill","no-border"],j)}function C(T,j){var k=S[j];if(!k)throw new Error("invalid hit type <"+j+">");return ve(T,k),T}function L(T,j){Fe(T,j)}this.removeHits=function(T){var j=Es(".djs-hit",T);I(j,Ht)},this.createDefaultHit=function(T,j){var k=T.waypoints,D=T.isFrame,z;return k?this.createWaypointsHit(j,k):(z=D?"stroke":"all",this.createBoxHit(j,z,{width:T.width,height:T.height}))},this.createWaypointsHit=function(T,j){var k=Qo(j);return C(k,"stroke"),L(T,k),k},this.createBoxHit=function(T,j,k){k=V({x:0,y:0},k);var D=Pe("rect");return C(D,j),ve(D,k),L(T,D),D},this.updateDefaultHit=function(T,j){var k=ot(".djs-hit",j);if(k)return T.waypoints?bl(k,T.waypoints):ve(k,{width:T.width,height:T.height}),k},this.fire=r,this.triggerMouseEvent=l,this.mouseHandler=a,this.registerEvent=p,this.unregisterEvent=d}_y.$inject=["eventBus","elementRegistry","styles"];const dc={__init__:["interactionEvents"],interactionEvents:["type",_y]};function Ro(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)})}Ro.$inject=["eventBus","canvas"],Ro.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()})}},Ro.prototype.get=function(){return Array.from(this._selectedElements)},Ro.prototype.isSelected=function(e){return this._selectedElements.has(e)},Ro.prototype.select=function(e,t){var n=this.get();ke(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?I(e,o=>{this._selectedElements.add(o)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var xy="hover",wy="selected";function Ey(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(u){i(u,wy)}function a(u){n(u,wy)}var s=new Set(r.oldSelection),c=new Set(r.newSelection);for(let u of s)c.has(u)||o(u);for(let u of c)s.has(u)||a(u)})}Ey.$inject=["canvas","eventBus"];function Sy(e,t,n,i){e.on("create.end",500,function(r){var o=r.context,a=o.canExecute,s=o.elements,c=o.hints||{},u=c.autoSelect;if(a){if(u===!1)return;ke(u)?t.select(u):t.select(s.filter(sA))}}),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=pt(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(sr(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=ac(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}Sy.$inject=["eventBus","selection","canvas","elementRegistry"];function sA(e){return!e.hidden}const Xn={__init__:["selectionVisuals","selectionBehavior"],__depends__:[dc],selection:["type",Ro],selectionVisuals:["type",Ey],selectionBehavior:["type",Sy]};var cA=/^djs-cursor-.*$/;function hc(e){var t=_t(document.body);t.removeMatching(cA),e&&t.add("djs-cursor-"+e)}function Ry(){hc(null)}var uA=5e3;function Cy(e,t){t=t||"element.click";function n(){return!1}return e.once(t,uA,n),function(){e.off(t,n)}}var lA=["c","C"],pA=["v","V"],fA=["d","D"],dA=["x","X"],hA=["y","Y"],Py=["z","Z"];function mA(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Mn(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function zt(e,t){return e=ke(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function Lp(e){return e.shiftKey}function gA(e){return Mn(e)&&zt(lA,e)}function yA(e){return Mn(e)&&zt(pA,e)}function vA(e){return Mn(e)&&zt(fA,e)}function bA(e){return Mn(e)&&zt(dA,e)}function _A(e){return Mn(e)&&!Lp(e)&&zt(Py,e)}function xA(e){return Mn(e)&&(zt(hA,e)||zt(Py,e)&&Lp(e))}var Co=Math.round,Ay="djs-drag-active";function Nr(e){e.preventDefault()}function wA(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function EA(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Ty(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(x){var S=t.viewbox(),P=t._container.getBoundingClientRect();return{x:S.x+(x.x-P.left)/S.scale,y:S.y+(x.y-P.top)/S.scale}}function s(x,S){S=S||o;var P=e.createEvent(V({},S.payload,S.data,{isTouch:S.isTouch}));return e.fire("drag."+x,P)===!1?!1:e.fire(S.prefix+"."+x,P)}function c(x){var S=x.filter(function(P){return i.get(P.id)});S.length&&n.select(S)}function u(x,S){var P=o.payload,C=o.displacement,L=o.globalStart,T=Ir(x),j=oi(T,L),k=o.localStart,D=a(T),z=oi(D,k);if(!o.active&&(S||EA(j)>o.threshold)){if(V(P,{x:Co(k.x+C.x),y:Co(k.y+C.y),dx:0,dy:0},{originalEvent:x}),s("start")===!1)return m();o.active=!0,o.keepSelection||(P.previousSelection=n.get(),n.select(null)),o.cursor&&hc(o.cursor),t.addMarker(t.getRootElement(),Ay)}dp(x),o.active&&(V(P,{x:Co(D.x+C.x),y:Co(D.y+C.y),dx:Co(z.x),dy:Co(z.y)},{originalEvent:x}),s("move"))}function l(x){var S,P=!0;o.active&&(x&&(o.payload.originalEvent=x,dp(x)),P=s("end")),P===!1&&s("rejected"),S=_(P!==!0),s("ended",S)}function f(x){zt("Escape",x)&&(Nr(x),m())}function p(x){var S;o.active&&(S=Cy(e),setTimeout(S,400),Nr(x)),l(x)}function d(x){u(x)}function g(x){var S=o.payload;S.hoverGfx=x.gfx,S.hover=x.element,s("hover")}function h(x){s("out");var S=o.payload;S.hoverGfx=null,S.hover=null}function m(x){var S;if(o){var P=o.active;P&&s("cancel"),S=_(x),P&&s("canceled",S)}}function _(x){var S,P;s("cleanup"),Ry(),o.trapClick?P=p:P=l,$e.unbind(document,"mousemove",u),$e.unbind(document,"dragstart",Nr),$e.unbind(document,"selectstart",Nr),$e.unbind(document,"mousedown",P,!0),$e.unbind(document,"mouseup",P,!0),$e.unbind(document,"keyup",f),$e.unbind(document,"touchstart",d,!0),$e.unbind(document,"touchcancel",m,!0),$e.unbind(document,"touchmove",u,!0),$e.unbind(document,"touchend",l,!0),e.off("element.hover",g),e.off("element.out",h),t.removeMarker(t.getRootElement(),Ay);var C=o.payload.previousSelection;return x!==!1&&C&&!n.get().length&&c(C),S=o,o=null,S}function y(x,S,P,C){o&&m(!1),typeof S=="string"&&(C=P,P=S,S=null),C=V({},r,C||{});var L=C.data||{},T,j,k,D,z;if(C.trapClick?D=p:D=l,x?(T=Eo(x)||x,j=Ir(x),dp(x),T.type==="dragstart"&&Nr(T)):(T=null,j={x:0,y:0}),k=a(j),S||(S=k),z=wA(T),o=V({prefix:P,data:L,payload:{},globalStart:j,displacement:oi(S,k),localStart:k,isTouch:z},C),C.manual||(z?($e.bind(document,"touchstart",d,!0),$e.bind(document,"touchcancel",m,!0),$e.bind(document,"touchmove",u,!0),$e.bind(document,"touchend",l,!0)):($e.bind(document,"mousemove",u),$e.bind(document,"dragstart",Nr),$e.bind(document,"selectstart",Nr),$e.bind(document,"mousedown",D,!0),$e.bind(document,"mouseup",D,!0)),$e.bind(document,"keyup",f),e.on("element.hover",g),e.on("element.out",h)),s("init")===!1)return m(),!1;C.autoActivate&&u(x,!0)}e.on("diagram.destroy",m),this.init=y,this.move=u,this.hover=g,this.out=h,this.end=l,this.cancel=m,this.context=function(){return o},this.setOptions=function(x){V(r,x)}}Ty.$inject=["eventBus","canvas","selection","elementRegistry"];const Bi={__depends__:[oA,Xn],dragging:["type",Ty]};function Po(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}Po.prototype.next=function(){return this._prefix+ ++this._counter};const SA=new Po("ps");var RA=["marker-start","marker-mid","marker-end"],CA=["circle","ellipse","line","path","polygon","polyline","path","rect"];function cr(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}cr.$inject=["elementRegistry","eventBus","canvas","styles"],cr.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")},cr.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},cr.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=zh(n);return this._cloneMarkers(Or(r),i),ve(r,this._styles.cls(i,[])),Fe(t,r),ve(r,"data-preview-support-element-id",e.id),r},cr.prototype.addFrame=function(e,t){var n=Pe("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return Fe(t,n),ve(n,"data-preview-support-element-id",e.id),n},cr.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),MA(e)&&RA.forEach(function(r){if(ve(e,r)){var o=PA(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},cr.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,SA.next()].join("-"),a=ot("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||zh(n);s.id=o,Xe(s).add(r);var c=ot(":scope > defs",e);c||(c=Pe("defs"),Fe(e,c)),Fe(c,s);var u=TA(s.id);ve(t,i,u)};function PA(e,t,n){var i=AA(ve(e,t));return ot("marker#"+i,n||document)}function AA(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function TA(e){return"url(#"+e+")"}function MA(e){return CA.indexOf(e.nodeName)!==-1}const Ao={__init__:["previewSupport"],previewSupport:["type",cr]};var kA="drop-ok",My="drop-not-ok",ky="attach-ok",Oy="new-parent",Dy="create",OA=2e3;function Ly(e,t,n,i,r){function o(c,u,l,f,p){if(!u)return!1;c=Ue(c,function(y){var x=y.labelTarget;return!y.parent&&!(Ge(y)&&c.indexOf(x)!==-1)});var d=pt(c,function(y){return!at(y)}),g=!1,h=!1,m=!1;By(c)&&(g=r.allowed("shape.attach",{position:l,shape:d,target:u})),g||(By(c)?m=r.allowed("shape.create",{position:l,shape:d,source:f,target:u}):m=r.allowed("elements.create",{elements:c,position:l,target:u}));var _=p.connectionTarget;return m||g?(d&&f&&(h=r.allowed("connection.create",{source:_===f?d:f,target:_===f?f:d,hints:{targetParent:u,targetAttach:g}})),{attach:g,connect:h}):m===null||g===null?null:!1}function a(c,u){[ky,kA,My,Oy].forEach(function(l){l===u?e.addMarker(c,l):e.removeMarker(c,l)})}n.on(["create.move","create.hover"],function(c){var u=c.context,l=u.elements,f=c.hover,p=u.source,d=u.hints||{};if(!f){u.canExecute=!1,u.target=null;return}Iy(c);var g={x:c.x,y:c.y},h=u.canExecute=f&&o(l,f,g,p,d);f&&h!==null&&(u.target=f,h&&h.attach?a(f,ky):a(f,h?Oy:My))}),n.on(["create.end","create.out","create.cleanup"],function(c){var u=c.hover;u&&a(u,null)}),n.on("create.end",function(c){var u=c.context,l=u.source,f=u.shape,p=u.elements,d=u.target,g=u.canExecute,h=g&&g.attach,m=g&&g.connect,_=u.hints||{};if(g===!1||!d)return!1;Iy(c);var y={x:c.x,y:c.y};m?f=i.appendShape(l,f,y,d,{attach:h,connection:m===!0?{}:m,connectionTarget:_.connectionTarget}):(p=i.createElements(p,y,d,V({},_,{attach:h})),f=pt(p,function(x){return!at(x)})),V(u,{elements:p,shape:f}),V(c,{elements:p,shape:f})});function s(){var c=t.context();c&&c.prefix===Dy&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],OA,function(){n.off("elements.changed",s)})}),this.start=function(c,u,l){ke(u)||(u=[u]);var f=pt(u,function(g){return!at(g)});if(f){l=V({elements:u,hints:{},shape:f},l||{}),I(u,function(g){Ie(g.x)||(g.x=0),Ie(g.y)||(g.y=0)});var p=Ue(u,function(g){return!g.hidden}),d=kt(p);I(u,function(g){at(g)&&(g.waypoints=sn(g.waypoints,function(h){return{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2}})),V(g,{x:g.x-d.x-d.width/2,y:g.y-d.y-d.height/2})}),t.init(c,Dy,{cursor:"grabbing",autoActivate:!0,data:{shape:f,elements:u,context:l}})}}}Ly.$inject=["canvas","dragging","eventBus","modeling","rules"];function Iy(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 By(e){return e&&e.length===1&&!at(e[0])}var DA=750;function Ny(e,t,n,i,r){function o(a){var s=Pe("g");ve(s,r.cls("djs-drag-group",["no-events"]));var c=Pe("g");return a.forEach(function(u){var l;u.hidden||(u.waypoints?(l=n._createContainer("connection",c),n.drawConnection(Or(l),u)):(l=n._createContainer("shape",c),n.drawShape(Or(l),u),nn(l,u.x,u.y)),i.addDragger(u,s,l))}),s}t.on("create.move",DA,function(a){var s=a.hover,c=a.context,u=c.elements,l=c.dragGroup;l||(l=c.dragGroup=o(u));var f;s?(l.parentNode||(f=e.getActiveLayer(),Fe(f,l)),nn(l,a.x,a.y)):Ht(l)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&Ht(c)})}Ny.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const mc={__depends__:[Bi,Ao,bi,Xn],__init__:["create","createPreview"],create:["type",Ly],createPreview:["type",Ny]};function Ip(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)})}Ip.$inject=["eventBus"],Ip.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||LA(0,0)};function LA(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 va={__init__:["mouse"],mouse:["type",Ip]};var $y=2e3;function kn(e,t,n,i,r,o,a,s){this._canvas=e,this._create=t,this._elementFactory=i,this._eventBus=r,this._modeling=o,this._mouse=a,this._rules=s,r.on("copyPaste.copyElement",function(c){var u=c.descriptor,l=c.element,f=c.elementsSet;u.priority=1,u.id=l.id,f.has(l.parent)&&(u.parent=l.parent.id),IA(l)&&(u.priority=2,u.host=l.host.id),at(l)&&(u.priority=3,u.source=l.source.id,u.target=l.target.id,u.waypoints=BA(l)),Ge(l)&&(u.priority=4,u.labelTarget=l.labelTarget.id),I(["x","y","width","height"],function(p){Ie(l[p])&&(u[p]=l[p])}),u.hidden=l.hidden,u.collapsed=l.collapsed}),r.on("copyPaste.elementsCopied",$y,function(c){var u;((u=c.hints)==null?void 0:u.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",$y,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var u=c.hints;V(u,{createElementsBehavior:!1})})}kn.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],kn.prototype.copy=function(e,t={}){var n,i;return ke(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(ke(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},kn.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})}}},kn.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},kn.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},kn.prototype._getElementIdsFromTree=function(e){var t={};return I(e,function(n){I(n,function(i){i.id&&(t[i.id]=!0)})}),t},kn.prototype._paste=function(e,t,n,i){I(e,function(o){Ie(o.x)||(o.x=0),Ie(o.y)||(o.y=0)});var r=kt(e);return I(e,function(o){at(o)&&(o.waypoints=sn(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),V(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,V({},i))},kn.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return I(e,function(o,a){o=ci(o,"priority"),I(o,function(s){var c=V({},ui(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var u;if(at(c)){c.source=i[s.source],c.target=i[s.target],u=i[s.id]=t.createConnection(c),r.push(u);return}if(Ge(c)){c.labelTarget=i[c.labelTarget],u=i[s.id]=t.createLabel(c),r.push(u);return}c.host&&(c.host=i[c.host]),u=i[s.id]=t.createShape(c),r.push(u)})}),r},kn.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(ui(e,["id"]));return t},kn.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(ui(e,["id"]));return t},kn.prototype.createShape=function(e){var t=this._elementFactory.createShape(ui(e,["id"]));return t},kn.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(at(e)&&(!n.has(e.source)||!n.has(e.target))||Ge(e)&&!n.has(e.labelTarget))},kn.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=Ps(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 g={element:f,depth:p};r.push(g),o.set(f,g);return}if(d.depth<p){r=u(d,r);var h={element:d.element,depth:p};r.push(h),o.set(f,h)}}function u(f,p){var d=p.indexOf(f);return d!==-1&&p.splice(d,1),p}kr(a,function(f,p,d){if(Ge(f))return;I(f.labels,function(m){c(m,d)});function g(m){m&&m.length&&I(m,function(_){I(_.labels,function(y){c(y,d)}),c(_,d)})}I([f.attachers,f.incoming,f.outgoing],g),c(f,d);var h=[];return f.children&&(h=f.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:f,children:h}),h}),e=sn(r,function(f){return f.element});var l=new Set(e);return r=sn(r,function(f){return f.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:f.descriptor,element:f.element,elements:e,elementsSet:l}),f}),r=ci(r,function(f){return f.descriptor.priority}),e=sn(r,function(f){return f.element}),I(r,function(f){var p=f.depth;if(!n.hasRelations(f.element,e,l)){jy(f.element,e),l.delete(f.element);return}if(!s(f.element,e)){jy(f.element,e),l.delete(f.element);return}i[p]||(i[p]=[]),i[p].push(f.descriptor)}),i};function IA(e){return!!e.host}function BA(e){return sn(e.waypoints,function(t){return t=Fy(t),t.original&&(t.original=Fy(t.original)),t})}function Fy(e){return V({},e)}function jy(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const NA={__depends__:[iA,mc,va,bi],__init__:["copyPaste"],copyPaste:["type",kn]};function Bp(e,t,n){ke(n)||(n=[n]),I(n,function(i){Sr(e[i])||(t[i]=e[i])})}var Np=750;function Hy(e,t,n){function i(c,u){var l=e.create(c.$type);return n.copyElement(c,l,null,u)}t.on("copyPaste.copyElement",Np,function(c){var u=c.descriptor,l=c.element,f=ie(l);if(Ge(l))return u;var p=u.businessObject=i(f,!0),d=u.di=i(Ze(l),!0);d.bpmnElement=p,Bp(p,u,"name"),Bp(d,u,"isExpanded"),f.default&&(u.default=f.default.id)});var r="-bpmn-js-refs";function o(c){return c[r]=c[r]||{}}function a(c,u){c[r]=u}function s(c,u,l){var f=ie(c);return c.default&&(l[c.default]={element:f,property:"default"}),c.host&&(ie(c).attachedToRef=ie(u[c.host])),ui(l,Rn(l,function(p,d,g){var h=d.element,m=d.property;return g===c.id&&(h.set(m,f),p.push(c.id)),p},[]))}t.on("copyPaste.pasteElement",function(c){var u=c.cache,l=c.descriptor,f=l.businessObject,p=l.di;if(Ge(l)){l.businessObject=ie(u[l.labelTarget]),l.di=Ze(u[l.labelTarget]);return}f=l.businessObject=i(f),p=l.di=i(p),p.bpmnElement=f,Bp(l,f,["isExpanded","name"]),l.type=f.$type}),t.on("copyPaste.copyElement",Np,function(c){var u=c.descriptor,l=c.element;if(w(l,"bpmn:Participant")){var f=ie(l);f.processRef&&(u.processRef=i(f.processRef,!0))}}),t.on("copyPaste.pasteElement",function(c){var u=c.descriptor,l=u.processRef;l&&(u.processRef=i(l))}),t.on("copyPaste.createTree",function(c){var u=c.element,l=c.children;w(u,"bpmn:SubProcess")&&I(oa(l),f=>{l.push(f.annotation)})}),t.on("copyPaste.pasteElement",Np,function(c){var u=c.cache,l=c.descriptor;a(u,s(l,u,o(u)))})}Hy.$inject=["bpmnFactory","eventBus","moddleCopy"];const $A=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],FA=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function ba(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 ci(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=qt(r)&&r.$descriptor;if(a&&FA.includes(a))return o;if(a&&$A.includes(a)||a&&s&&!pt(s.properties,eo({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:r}=i;if(w(r,"bpmn:ExtensionElements")&&(!r.values||!r.values.length))return!1})}ba.$inject=["eventBus","bpmnFactory","moddle"],ba.prototype.copyElement=function(e,t,n,i=!1){n&&!ke(n)&&(n=[n]),n=n||$p(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(ke(r)&&(n=r),I(n,o=>{let a;Sn(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!Ft(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},ba.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):ke(e)?Rn(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},ba.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 $p(e,t){return Rn(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const zy={__depends__:[NA],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",Hy],moddleCopy:["type",ba]};var Gy=Math.round;function Fp(e,t){this._modeling=e,this._eventBus=t}Fp.$inject=["modeling","eventBus"],Fp.prototype.replaceElement=function(e,t,n){if(e.waypoints)return null;var i=this._modeling,r=this._eventBus;r.fire("replace.start",{element:e,attrs:t,hints:n});var o=t.width||e.width,a=t.height||e.height,s=t.x||e.x,c=t.y||e.y,u=Gy(s+o/2),l=Gy(c+a/2),f=i.replaceShape(e,V({},t,{x:u,y:l,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:f,hints:n}),f};function Vy(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}Vy.$inject=["selection","eventBus"];const jA={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Vy],replace:["type",Fp]};function HA(e,t,n){ke(n)||(n=[n]),I(n,function(i){Sr(e[i])||(t[i]=e[i])})}var zA=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function GA(e,t){var n=e&&Sn(e,"collapsed")?e.collapsed:!Ye(e),i;return t&&(Sn(t,"collapsed")||Sn(t,"isExpanded"))?i=Sn(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function Wy(e,t,n,i,r,o){function a(s,c,u){u=u||{};var l=c.type,f=s.businessObject;if(gc(f)&&(l==="bpmn:SubProcess"||l==="bpmn:AdHocSubProcess")&&GA(s,c))return i.toggleCollapse(s),s;var p=e.create(l),d={type:l,businessObject:p};d.di={},l==="bpmn:ExclusiveGateway"&&(d.di.isMarkerVisible=!0),HA(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var g=$p(f.$descriptor),h=$p(p.$descriptor,!0),m=VA(g,h);V(p,ii(c,zA));var _=Ue(m,function(S){return S==="eventDefinitions"?Uy(s,c.eventDefinitionType):S==="loopCharacteristics"?!pn(p):Sn(p,S)||S==="processRef"&&c.isExpanded===!1||S==="triggeredByEvent"?!1:S==="isForCompensation"?!pn(p):!0});if(p=n.copyElement(f,p,_),c.eventDefinitionType&&(Uy(p,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),w(f,"bpmn:Activity")){if(gc(f))d.isExpanded=Ye(s);else if(c&&Sn(c,"isExpanded")){d.isExpanded=c.isExpanded;var y=t.getDefaultSize(p,{isExpanded:d.isExpanded});d.width=y.width,d.height=y.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}Ye(s)&&!w(f,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(gc(f)&&!gc(p)&&(u.moveChildren=!1),w(f,"bpmn:Participant")){c.isExpanded===!0?p.processRef=e.create("bpmn:Process"):u.moveChildren=!1;var x=Xt(s);Ze(s).isHorizontal||(Ze(d).isHorizontal=x),d.width=x?s.width:t.getDefaultSize(d).width,d.height=x?t.getDefaultSize(d).height:s.height}return o.allowed("shape.resize",{shape:p})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),p.name=f.name,We(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&We(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(p.default=f.default),c.host&&!w(f,"bpmn:BoundaryEvent")&&w(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,{...u,targetElement:c})}this.replaceElement=a}Wy.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function gc(e){return w(e,"bpmn:SubProcess")}function Uy(e,t){var n=ie(e);return t&&n.get("eventDefinitions").some(function(i){return w(i,t)})}function VA(e,t){return e.filter(function(n){return t.includes(n)})}const qy={__depends__:[zy,jA,Xn],bpmnReplace:["type",Wy]};var WA=250;function $r(e){this._eventBus=e,this._tools=[],this._active=null}$r.$inject=["eventBus"],$r.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)},$r.prototype.isActive=function(e){return e&&this._active===e},$r.prototype.length=function(e){return this._tools.length},$r.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},$r.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),I(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,WA,function(r){this._active&&(UA(r)||this.setActive(null))},this)};function UA(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Tr(t,'.group[data-group="tools"]')}const yc={__depends__:[Bi],__init__:["toolManager"],toolManager:["type",$r]};function qA(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 YA(e,t){var n=[],i=new Set(e);I(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,s=o.outgoing;I(a.concat(s),function(c){var u=c.source,l=c.target;(i.has(u)||i.has(l))&&(r.has(c)||(r.add(c),n.push(c)))})}),n}function KA(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 jp=Math.abs,XA=Math.round,Ni={x:"width",y:"height"},Yy="crosshair",ur={n:"top",w:"left",s:"bottom",e:"right"},ZA=1500,vc={n:"s",w:"e",s:"n",e:"w"},bc=20;function Zn(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",ZA,function(c){var u=c.context,l=u.initialized;l||(l=u.initialized=s.init(c,u)),l&&Xy(c)}),n.on("spaceTool.end",function(c){var u=c.context,l=u.axis,f=u.direction,p=u.movingShapes,d=u.resizingShapes,g=u.start;if(u.initialized){Xy(c);var h={x:0,y:0};h[l]=XA(c["d"+l]),s.makeSpace(p,d,h,f,g),n.once("spaceTool.ended",function(m){s.activateSelection(m.originalEvent,!0,!0)})}})}Zn.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Zn.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:Yy,data:{context:{reactivate:n}},trapClick:!1})},Zn.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:Yy,data:{context:{}}})},Zn.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},Zn.prototype.init=function(e,t){var n=jp(e.dx)>jp(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(jp(i)<5)return!1;i<0&&(i*=-1),ma(e)&&(i*=-1);var o=qA(n,i),a=this._canvas.getRootElement();!ac(e)&&e.hover&&(a=e.hover);var s=[...Jo(a),...a.attachers||[]],c=this.calculateAdjustments(s,n,i,r),u=this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:c.resizingShapes,start:r}),l=QA(c,n,o,r,u);return V(t,c,{axis:n,direction:o,spaceToolConstraints:l,start:r}),hc("resize-"+(n==="x"?"ew":"ns")),!0},Zn.prototype.calculateAdjustments=function(e,t,n,i){var r=this._rules,o=[],a=[],s=new Set,c=new Set,u=[],l=[];function f(d){s.has(d)||(s.add(d),o.push(d));var g=d.label;g&&!s.has(g)&&(s.add(g),o.push(g))}function p(d){c.has(d)||(c.add(d),a.push(d))}return I(e,function(d){if(!(!d.parent||Ge(d))){if(at(d)){l.push(d);return}var g=d[t],h=g+d[Ni[t]];if(JA(d)&&(n>0&&Oe(d)[t]>i||n<0&&Oe(d)[t]<i)){u.push(d);return}if(n>0&&g>i||n<0&&h<i){f(d);return}if(g<i&&h>i&&r.allowed("shape.resize",{shape:d})){p(d);return}}}),I(o,function(d){var g=d.attachers;g&&I(g,function(h){f(h)})}),I(u,function(d){var g=d.host;(s.has(g)||c.has(g))&&f(d)}),I(l,function(d){var g=d.source,h=d.target,m=d.label;(s.has(g)||c.has(g))&&(s.has(h)||c.has(h))&&m&&f(m)}),{movingShapes:o,resizingShapes:a}},Zn.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Zn.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function Ky(e){return{top:e.top-bc,right:e.right+bc,bottom:e.bottom+bc,left:e.left-bc}}function Xy(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;Ie(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),Ie(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),Ie(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),Ie(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function QA(e,t,n,i,r){var o=e.movingShapes,a=e.resizingShapes;if(a.length){var s={},c,u,l=new Set(o),f=new Set(a);return I(a,function(p){var d=p.attachers,g=p.children,h=Te(p),m=Ue(g,function(z){return!at(z)&&!Ge(z)&&!l.has(z)&&!f.has(z)}),_=Ue(g,function(z){return!at(z)&&!Ge(z)&&l.has(z)}),y,x,S,P=[],C=[],L,T,j,k;m.length&&(x=Ky(Te(kt(m))),y=i-h[ur[n]]+x[ur[n]],n==="n"?s.bottom=u=Ie(u)?Math.min(u,y):y:n==="w"?s.right=u=Ie(u)?Math.min(u,y):y:n==="s"?s.top=c=Ie(c)?Math.max(c,y):y:n==="e"&&(s.left=c=Ie(c)?Math.max(c,y):y)),_.length&&(S=Ky(Te(kt(_))),y=i-S[ur[vc[n]]]+h[ur[vc[n]]],n==="n"?s.bottom=u=Ie(u)?Math.min(u,y):y:n==="w"?s.right=u=Ie(u)?Math.min(u,y):y:n==="s"?s.top=c=Ie(c)?Math.max(c,y):y:n==="e"&&(s.left=c=Ie(c)?Math.max(c,y):y)),d&&d.length&&(d.forEach(function(z){l.has(z)?P.push(z):C.push(z)}),P.length&&(L=Te(kt(P.map(Oe))),T=h[ur[vc[n]]]-(L[ur[vc[n]]]-i)),C.length&&(j=Te(kt(C.map(Oe))),k=j[ur[n]]-(h[ur[n]]-i)),n==="n"?(y=Math.min(T||1/0,k||1/0),s.bottom=u=Ie(u)?Math.min(u,y):y):n==="w"?(y=Math.min(T||1/0,k||1/0),s.right=u=Ie(u)?Math.min(u,y):y):n==="s"?(y=Math.max(T||-1/0,k||-1/0),s.top=c=Ie(c)?Math.max(c,y):y):n==="e"&&(y=Math.max(T||-1/0,k||-1/0),s.left=c=Ie(c)?Math.max(c,y):y));var D=r&&r[p.id];D&&(n==="n"?(y=i+p[Ni[t]]-D[Ni[t]],s.bottom=u=Ie(u)?Math.min(u,y):y):n==="w"?(y=i+p[Ni[t]]-D[Ni[t]],s.right=u=Ie(u)?Math.min(u,y):y):n==="s"?(y=i-p[Ni[t]]+D[Ni[t]],s.top=c=Ie(c)?Math.max(c,y):y):n==="e"&&(y=i-p[Ni[t]]+D[Ni[t]],s.left=c=Ie(c)?Math.max(c,y):y))}),s}}function JA(e){return!!e.host}var Hp="djs-dragging",Zy="djs-resizing",eT=250,_c=Math.max;function Qy(e,t,n,i,r){function o(a,s){I(a,function(c){r.addDragger(c,s),n.addMarker(c,Hp)})}e.on("spaceTool.selection.start",function(a){var s=n.getLayer("space"),c=a.context,u={x:"M 0,-10000 L 0,10000",y:"M -10000,0 L 10000,0"},l=Pe("g");ve(l,i.cls("djs-crosshair-group",["no-events"])),Fe(s,l);var f=Pe("path");ve(f,"d",u.x),Xe(f).add("djs-crosshair"),Fe(l,f);var p=Pe("path");ve(p,"d",u.y),Xe(p).add("djs-crosshair"),Fe(l,p),c.crosshairGroup=l}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;nn(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&Ht(c)}),e.on("spaceTool.move",eT,function(a){var s=a.context,c=s.line,u=s.axis,l=s.movingShapes,f=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var p=n.getLayer("space");c=Pe("path"),ve(c,"d","M0,0 L0,0"),Xe(c).add("djs-crosshair"),Fe(p,c),s.line=c;var d=Pe("g");ve(d,i.cls("djs-drag-group",["no-events"])),Fe(n.getActiveLayer(),d),o(l,d);var g=new Set(l);I(f,function(C){g.add(C)});var h=new Set,m=s.movingConnections=[];g.forEach(function(C){I(C.outgoing,function(L){h.has(L)||!at(L)||!g.has(L.target)||(h.add(L),m.push(L))})}),o(m,d),s.dragGroup=d}if(!s.frameGroup){var _=Pe("g");ve(_,i.cls("djs-frame-group",["no-events"])),Fe(n.getActiveLayer(),_);var y=[];I(f,function(C){var L=r.addFrame(C,_),T=L.getBBox();y.push({element:L,initialBounds:T}),n.addMarker(C,Zy)}),s.frameGroup=_,s.frames=y}var x={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};ve(c,{d:x[u]});var S={x:"y",y:"x"},P={x:a.dx,y:a.dy};P[S[s.axis]]=0,nn(s.dragGroup,P.x,P.y),I(s.frames,function(C){var L=C.element,T=C.initialBounds,j,k;s.direction==="e"?ve(L,{width:_c(T.width+P.x,5)}):(j=_c(T.width-P.x,5),ve(L,{width:j,x:T.x+T.width-j})),s.direction==="s"?ve(L,{height:_c(T.height+P.y,5)}):(k=_c(T.height-P.y,5),ve(L,{height:k,y:T.y+T.height-k}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,u=s.movingConnections,l=s.resizingShapes,f=s.line,p=s.dragGroup,d=s.frameGroup;I(c,function(g){n.removeMarker(g,Hp)}),I(u,function(g){n.removeMarker(g,Hp)}),p&&(Ht(f),Ht(p)),I(l,function(g){n.removeMarker(g,Zy)}),d&&Ht(d)})}Qy.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const tT={__init__:["spaceToolPreview"],__depends__:[Bi,bi,yc,Ao,va],spaceTool:["type",Zn],spaceToolPreview:["type",Qy]};function xc(e,t){e.invoke(Zn,this),this._canvas=t}xc.$inject=["injector","canvas"],ye(xc,Zn),xc.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=Qr(uo(r.children.filter(u=>w(u,"bpmn:Artifact")),kt(o))));const s=[...e,...a];var c=Zn.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(u){return!(w(u,"bpmn:TextAnnotation")||nT(u)&&(t==="y"&&Xt(u)||t==="x"&&!Xt(u)))}),c};function nT(e){return w(e,"bpmn:Participant")&&!ie(e).processRef}const Jy={__depends__:[tT],spaceTool:["type",xc]};function wt(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)}wt.$inject=["eventBus","injector"],wt.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()},wt.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},wt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},wt.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()}},wt.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()}},wt.prototype.register=function(e,t){this._setHandler(e,t)},wt.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)},wt.prototype.canUndo=function(){return!!this._getUndoAction()},wt.prototype.canRedo=function(){return!!this._getRedoAction()},wt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},wt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},wt.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)})},wt.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},wt.prototype._createId=function(){return this._uid++},wt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},wt.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()},wt.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)},wt.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:fd("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},wt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=ke(e)?e:[e],t.dirty=t.dirty.concat(e))},wt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},wt.prototype._revertedAction=function(e){this._stackIdx--},wt.prototype._getHandler=function(e){return this._handlerMap[e]},wt.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 iT={commandStack:["type",wt]};function lr(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 rT=250,ev=1400;function zp(e,t,n){ne.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",ev,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",rT,function(r){var o=r.context,a=new Set(o.shapes),s=new Set;for(const c of a)for(const u of c.labels)!u.hidden&&!a.has(u)&&s.add(u),c.labelTarget&&s.add(c);for(const c of s)i.makeDraggable(o,c,!0)}),this.preExecuted("elements.move",ev,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];I(s,function(u){I(u.labels,function(l){s[l.id]||c.push(l)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(r){var o=r.context,a=o.connection||o.shape;lr(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=xl(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&&(At(s.labels,a,c),a.labelTarget=s)})}ye(zp,ne),zp.$inject=["injector","eventBus","modeling"];function tv(e){var t=new Set(e);return Ue(e,function(n){return!t.has(n.labelTarget)})}const oT={__init__:["labelSupport"],labelSupport:["type",zp]};var aT=251,nv=1401,iv="attach-ok";function Gp(e,t,n,i,r){ne.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",nv,function(a){var s=a.context,c=s.shapes,u=s.validatedShapes;s.shapes=sT(c),s.validatedShapes=cT(u)}),o&&t.on("shape.move.start",aT,function(a){var s=a.context,c=s.shapes,u=Vp(c);I(u,function(l){o.makeDraggable(s,l,!0),I(l.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 u=c[0],l=u.host;l&&(n.addMarker(l,iv),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(l,iv)}))}}),this.preExecuted("elements.move",nv,function(a){var s=a.context,c=s.closure,u=s.shapes,l=Vp(u);I(l,function(f){c.add(f,c.topLevel[f.host.id])})}),this.postExecuted("elements.move",function(a){var s=a.context,c=s.shapes,u=s.newHost,l;u&&c.length!==1||(u?l=c:l=Ue(c,function(f){var p=f.host;return uT(f)&&!lT(c,p)}),I(l,function(f){r.updateAttachment(f,u)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;I(s,function(c){I(c.attachers,function(u){I(u.outgoing.slice(),function(l){var f=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});f||r.removeConnection(l)}),I(u.incoming.slice(),function(l){var f=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});f||r.removeConnection(l)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,u=s.host;u&&r.updateAttachment(c,u)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,u=s.newShape;lr(c.attachers,function(l){var f=i.allowed("elements.move",{target:u,shapes:[l]});f==="attach"?r.updateAttachment(l,u):r.removeShape(l)}),u.attachers.length&&I(u.attachers,function(l){var f=xg(l,c,u);r.moveShape(l,f,l.parent)})}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.oldBounds,l=s.newBounds,f=c.attachers,p=s.hints||{};p.attachSupport!==!1&&I(f,function(d){var g=xg(d,u,l);r.moveShape(d,g,d.parent),I(d.labels,function(h){r.moveShape(h,g,h.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;lr(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}ye(Gp,ne),Gp.$inject=["injector","eventBus","canvas","rules","modeling"];function Vp(e){return Ou(sn(e,function(t){return t.attachers||[]}))}function sT(e){var t=Vp(e);return W0("id",e,t)}function cT(e){var t=Jr(e,"id");return Ue(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function uT(e){return!!e.host}function lT(e,t){return e.indexOf(t)!==-1}const pT={__depends__:[bi],__init__:["attachSupport"],attachSupport:["type",Gp]};function rv(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(Xh(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)})}rv.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const Wp={__init__:["changeSupport"],changeSupport:["type",rv]};function Qn(e){this._model=e}Qn.$inject=["moddle"],Qn.prototype._needsId=function(e){return We(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"])},Qn.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;w(e,"bpmn:Activity")?t="Activity":w(e,"bpmn:Event")?t="Event":w(e,"bpmn:Gateway")?t="Gateway":We(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))},Qn.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Qn.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Qn.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",V({bpmnElement:e,bounds:this.createDiBounds()},t))},Qn.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Qn.prototype.createDiWaypoints=function(e){var t=this;return sn(e,function(n){return t.createDiWaypoint(n)})},Qn.prototype.createDiWaypoint=function(e){return this.create("dc:Point",ii(e,["x","y"]))},Qn.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",V({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Qn.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",V({bpmnElement:e},t))};function On(e,t,n){ne.call(this,e),this._bpmnFactory=t;var i=this;function r(d){var g=d.context,h=g.hints||{},m;!g.cropped&&h.createElementsBehavior!==!1&&(m=g.connection,m.waypoints=n.getCroppedWaypoints(m),g.cropped=!0)}this.executed(["connection.layout","connection.create"],r),this.reverted(["connection.layout"],function(d){delete d.context.cropped});function o(d){var g=d.context;i.updateParent(g.shape||g.connection,g.oldParent)}function a(d){var g=d.context,h=g.shape||g.connection,m=g.parent||g.newParent;i.updateParent(h,m)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Dn(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Dn(a));function s(d){var g=d.context,h=g.oldRoot,m=h.children;I(m,function(_){w(_,"bpmn:BaseElement")&&i.updateParent(_)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var g=d.context.shape;w(g,"bpmn:BaseElement")&&i.updateBounds(g)}this.executed(["shape.move","shape.create","shape.resize"],Dn(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],Dn(function(d){d.context.shape.type!=="label"&&c(d)})),e.on("shape.changed",function(d){d.element.type==="label"&&c({context:{shape:d.element}})});function u(d){i.updateConnection(d.context)}this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],Dn(u)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],Dn(u));function l(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],Dn(l)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],Dn(l)),this.executed("connection.reconnect",Dn(function(d){var g=d.context,h=g.connection,m=g.oldSource,_=g.newSource,y=ie(h),x=ie(m),S=ie(_);y.conditionExpression&&!We(S,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(g.oldConditionExpression=y.conditionExpression,delete y.conditionExpression),m!==_&&x.default===y&&(g.oldDefault=x.default,delete x.default)})),this.reverted("connection.reconnect",Dn(function(d){var g=d.context,h=g.connection,m=g.oldSource,_=g.newSource,y=ie(h),x=ie(m),S=ie(_);g.oldConditionExpression&&(y.conditionExpression=g.oldConditionExpression),g.oldDefault&&(x.default=g.oldDefault,delete S.default)}));function f(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],Dn(f)),this.reverted(["element.updateAttachment"],Dn(f)),this.executed("element.updateLabel",Dn(p)),this.reverted("element.updateLabel",Dn(p));function p(d){const{element:g}=d.context,h=Hn(g),m=Ze(g),_=m&&m.get("label");ir(g)||sc(g)||(h&&!_?m.set("label",t.create("bpmndi:BPMNLabel")):!h&&_&&m.set("label",void 0))}}ye(On,ne),On.$inject=["eventBus","bpmnFactory","connectionDocking"],On.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},On.prototype.updateParent=function(e,t){if(!Ge(e)&&!(w(e,"bpmn:DataStoreReference")&&e.parent&&w(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=Ze(e),o=n&&n.businessObject,a=Ze(n);w(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),w(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),w(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(i,o),w(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},On.prototype.updateBounds=function(e){var t=Ze(e),n=dT(e);if(n){var i=oi(n,t.get("bounds"));V(n,{x:e.x+i.x,y:e.y+i.y})}var r=Ge(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),V(o,{x:e.x,y:e.y,width:e.width,height:e.height})},On.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;w(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),Ct(i,e)),w(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),At(r,e))}},On.prototype.updateDiConnection=function(e,t,n){var i=Ze(e),r=Ze(t),o=Ze(n);i.sourceElement&&i.sourceElement.bpmnElement!==ie(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==ie(n)&&(i.targetElement=n&&o)},On.prototype.updateDiParent=function(e,t){if(t&&!w(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(Ct(n,e),e.$parent=null)}};function fT(e){for(;e&&!w(e,"bpmn:Definitions");)e=e.$parent;return e}On.prototype.getLaneSet=function(e){var t,n;return w(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(w(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)},On.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((w(e,"bpmn:DataInput")||w(e,"bpmn:DataOutput"))&&(w(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(w(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(w(e,"bpmn:FlowElement")){if(t){if(w(t,"bpmn:Participant"))t=t.processRef;else if(w(t,"bpmn:Lane"))do t=t.$parent.$parent;while(w(t,"bpmn:Lane"))}i="flowElements"}else if(w(e,"bpmn:Artifact")){for(;t&&!w(t,"bpmn:Process")&&!w(t,"bpmn:SubProcess")&&!w(t,"bpmn:Collaboration");)if(w(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(w(e,"bpmn:MessageFlow"))i="messageFlows";else if(w(e,"bpmn:Participant")){i="participants";var r=e.processRef,o;r&&(o=fT(e.$parent||t),e.$parent&&(Ct(o.get("rootElements"),r),r.$parent=null),t&&(At(o.get("rootElements"),r),r.$parent=o))}else w(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":w(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),Ct(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);Ct(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},On.prototype.updateConnectionWaypoints=function(e){var t=Ze(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},On.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(w(n,"bpmn:DataAssociation"))w(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=r,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):w(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||r,this.updateSemanticParent(n,r,s),n.targetRef=a);else{var c=w(n,"bpmn:SequenceFlow");n.sourceRef!==r&&(c&&(Ct(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(Ct(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)},On.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function Dn(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;w(i,"bpmn:BaseElement")&&e(t)}}function dT(e){if(w(e,"bpmn:Activity")){var t=Ze(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function pr(e,t){Oi.call(this),this._bpmnFactory=e,this._moddle=t}ye(pr,Oi),pr.$inject=["bpmnFactory","moddle"],pr.prototype._baseCreate=Oi.prototype.create,pr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,V({type:"label",di:n},Dr,t))}return this.createElement(e,t)},pr.prototype.createElement=function(e,t){t=V({},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(!mT(r)){var o=V({},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)}w(i,"bpmn:Group")&&(t=V({isFrame:!0},t)),t=hT(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Up(r,t,"isExpanded")),We(i,["bpmn:Lane","bpmn:Participant"])&&(t=Up(r,t,"isHorizontal")),w(i,"bpmn:SubProcess")&&(t.collapsed=!Ye(i,r)),w(i,"bpmn:ExclusiveGateway")&&(Sn(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),Ft(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),Ft(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=V({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},pr.prototype.getDefaultSize=function(e,t){var n=ie(e);if(t=t||Ze(e),w(n,"bpmn:SubProcess"))return Ye(n,t)?{width:350,height:200}:{width:100,height:80};if(w(n,"bpmn:Task"))return{width:100,height:80};if(w(n,"bpmn:Gateway"))return{width:50,height:50};if(w(n,"bpmn:Event"))return{width:36,height:36};if(w(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return Ye(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return w(n,"bpmn:Lane")?{width:400,height:100}:w(n,"bpmn:DataObjectReference")?{width:36,height:50}:w(n,"bpmn:DataStoreReference")?{width:50,height:50}:w(n,"bpmn:TextAnnotation")?{width:100,height:40}:w(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},pr.prototype.createParticipantShape=function(e){return qt(e)||(e={isExpanded:e}),e=V({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function hT(e,t,n){return I(n,function(i){t=Up(e,t,i)}),t}function Up(e,t,n){return t[n]===void 0?t:(e[n]=t[n],ui(t,[n]))}function mT(e){return We(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function wc(e,t){this._modeling=e,this._canvas=t}wc.$inject=["modeling","canvas"],wc.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;I(n,function(r){var o={x:0,y:0};Ft(i.left)?o.x=i.left-r.x:Ft(i.right)?o.x=i.right-r.width-r.x:Ft(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:Ft(i.top)?o.y=i.top-r.y:Ft(i.bottom)?o.y=i.bottom-r.height-r.y:Ft(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},wc.prototype.postExecute=function(e){};function Ec(e){this._modeling=e}Ec.$inject=["modeling"],Ec.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},Ec.prototype.postExecute=function(e){var t=e.hints||{};gT(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 gT(e,t){return Wi(e.outgoing,function(n){return n.target===t})}function Sc(e,t){this._canvas=e,this._layouter=t}Sc.$inject=["canvas","layouter"],Sc.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},Sc.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var Rc=Math.round;function qp(e){this._modeling=e}qp.$inject=["modeling"],qp.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;I(t,function(f){Ie(f.x)||(f.x=0),Ie(f.y)||(f.y=0)});var s=Ue(t,function(f){return!f.hidden}),c=kt(s);I(t,function(f){at(f)&&(f.waypoints=sn(f.waypoints,function(p){return{x:Rc(p.x-c.x-c.width/2+r.x),y:Rc(p.y-c.y-c.height/2+r.y)}})),V(f,{x:Rc(f.x-c.x-c.width/2+r.x),y:Rc(f.y-c.y-c.height/2+r.y)})});var u=new Set(Ps(t)),l={};I(t,function(f){if(at(f)){l[f.id]=Ie(i)?a.createConnection(l[f.source.id],l[f.target.id],i,f,f.parent||n,o):a.createConnection(l[f.source.id],l[f.target.id],f,f.parent||n,o);return}var p=V({},o);u.has(f)||(p.autoResize=!1),Ge(f)&&(p=ui(p,["attach"])),l[f.id]=Ie(i)?a.createShape(f,ii(f,["x","y","width","height"]),f.parent||n,i,p):a.createShape(f,ii(f,["x","y","width","height"]),f.parent||n,p)}),e.elements=Qr(l)};var ov=Math.round;function fr(e){this._canvas=e}fr.$inject=["canvas"],fr.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,r=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?V(t,n):V(t,{x:n.x-ov(t.width/2),y:n.y-ov(t.height/2)}),this._canvas.addShape(t,i,r),t},fr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function _a(e){fr.call(this,e)}ye(_a,fr),_a.$inject=["canvas"];var yT=fr.prototype.execute;_a.prototype.execute=function(e){var t=e.shape;return bT(t),t.labelTarget=e.labelTarget,yT.call(this,e)};var vT=fr.prototype.revert;_a.prototype.revert=function(e){return e.shape.labelTarget=null,vT.call(this,e)};function bT(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function xa(e,t){this._canvas=e,this._modeling=t}xa.$inject=["canvas","modeling"],xa.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;lr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),lr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},xa.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=xl(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},xa.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,At(n.children,t,i),this._canvas.addConnection(t,n),t};function Yp(e,t){this._modeling=e,this._elementRegistry=t}Yp.$inject=["modeling","elementRegistry"],Yp.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;I(i,function(r){n.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};function wa(e,t){this._canvas=e,this._modeling=t}wa.$inject=["canvas","modeling"],wa.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;lr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),lr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),lr(n.children,function(i){at(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},wa.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=xl(i.children,n),t.removeShape(n),n},wa.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return At(i.children,n,r),t.addShape(n,i),n};function Cc(e){this._modeling=e}Cc.$inject=["modeling"];var av={x:"y",y:"x"};Cc.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(m,_){m.range.min=Math.min(_[i],m.range.min),m.range.max=Math.max(_[i]+_[r],m.range.max)}function a(m){return m[i]+m[r]/2}function s(m){return m.length-1}function c(m){return m.max-m.min}function u(m,_){var y={y:0};y[i]=m-a(_),y[i]&&(y[av[i]]=0,t.moveElements([_],y,_.parent))}var l=n[0],f=s(n),p=n[f],d,g,h=0;I(n,function(m,_){var y,x,S;if(m.elements.length<2){_&&_!==n.length-1&&(o(m,m.elements[0]),h+=c(m.range));return}y=ci(m.elements,i),x=y[0],_===f&&(x=y[s(y)]),S=a(x),m.range=null,I(y,function(P){if(u(S,P),m.range===null){m.range={min:P[i],max:P[i]+P[r]};return}o(m,P)}),_&&_!==n.length-1&&(h+=c(m.range))}),g=Math.abs(p.range.min-l.range.max),d=Math.round((g-h)/(n.length-1)),!(d<n.length-1)&&I(n,function(m,_){var y={},x;m===l||m===p||(x=n[_-1],m.range.max=0,I(m.elements,function(S,P){y[av[i]]=0,y[i]=x.range.max-S[i]+d,m.range.min!==S[i]&&(y[i]+=S[i]-m.range.min),y[i]&&t.moveElements([S],y,S.parent),m.range.max=Math.max(S[i]+S[r],P?m.range.max:0)}))})},Cc.prototype.postExecute=function(e){};function Pc(e,t){this._layouter=e,this._canvas=t}Pc.$inject=["layouter","canvas"],Pc.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return V(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Pc.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Kp(){}Kp.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=Ct(o.children,t),At(i.children,t,r),t.parent=i,I(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},Kp.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return Ct(n.children,t),At(i.children,t,r),t.parent=i,I(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 Xp(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Xp.prototype.add=function(e,t){return this.addAll([e],t)},Xp.prototype.addAll=function(e,t){var n=K1(e,!!t,this);return V(this,n),this};function Ea(e){this._modeling=e}Ea.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},Ea.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,u=e.topLevel,l=!1;r&&r.parent===n&&(l=!0),I(a,function(f){o.moveShape(f,t,u[f.id]&&!l&&n,{recurse:!1,layout:!1})}),I(s,function(f){var p=!!a[f.source.id],d=!!a[f.target.id];c[f.id]&&p&&d?o.moveConnection(f,t,u[f.id]&&!l&&n):o.layoutConnection(f,{connectionStart:p&&ip(f,f.source,t),connectionEnd:d&&rp(f,f.target,t)})})},Ea.prototype.getClosure=function(e){return new Xp().addAll(e,!0)};function Ac(e){this._helper=new Ea(e)}Ac.$inject=["modeling"],Ac.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Ac.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 Fr(e){this._modeling=e,this._helper=new Ea(e)}Fr.$inject=["modeling"],Fr.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=ii(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=Ct(o.children,t),At(i.children,t,r),V(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Fr.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;i.layout!==!1&&(I(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:rp(o,t,n)})}),I(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:ip(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},Fr.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return At(n.children,t,i),V(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},Fr.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Fr.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function Sa(e){this._modeling=e}Sa.$inject=["modeling"],Sa.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 ke(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},Sa.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||sv(ke(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||sv(ke(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},Sa.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 sv(e){return e.original||e}function $i(e,t){this._modeling=e,this._rules=t}$i.$inject=["modeling","rules"],$i.prototype.preExecute=function(e){var t=this,n=this._modeling,i=this._rules,r=e.oldShape,o=e.newData,a=e.hints||{},s;function c(g,h,m){return i.allowed("connection.reconnect",{connection:m,source:g,target:h})}var u={x:o.x,y:o.y},l={x:r.x,y:r.y,width:r.width,height:r.height};s=e.newShape=e.newShape||t.createShape(o,u,r.parent,a),r.host&&n.updateAttachment(s,r.host);var 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();I(p,function(g){var h=g.source,m=c(h,s,g);m&&t.reconnectEnd(g,s,tc(g,s,l),a)}),I(d,function(g){var h=g.target,m=c(s,h,g);m&&t.reconnectStart(g,s,ec(g,s,l),a)})},$i.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},$i.prototype.execute=function(e){},$i.prototype.revert=function(e){},$i.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},$i.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},$i.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function Ra(e){this._modeling=e}Ra.$inject=["modeling"],Ra.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},V(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Ra.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(I(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:tc(o,n,i)})}),I(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:ec(o,n,i)})}))},Ra.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return V(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function dr(e){this._modeling=e}dr.$inject=["modeling"],dr.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),I(r,function(s){a[s.id]=xT(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(YA(i,r),t,n,o,i,r,a)},dr.prototype.execute=function(){},dr.prototype.revert=function(){},dr.prototype.moveShapes=function(e,t){var n=this;I(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},dr.prototype.resizeShapes=function(e,t,n){var i=this;I(e,function(r){var o=KA(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},dr.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=new Set(r),u=new Set(o);I(e,function(l){var f=l.source,p=l.target,d=_T(l),g=uv(n),h={},m=c.has(f)||u.has(f),_=c.has(p)||u.has(p);m&&_?(d=sn(d,function(y){return lv(y,i,n)&&(y[g]=y[g]+t[g]),y.original&&lv(y.original,i,n)&&(y.original[g]=y.original[g]+t[g]),y}),s._modeling.updateWaypoints(l,d,{labelBehavior:!1})):(m||_)&&(c.has(f)?h.connectionStart=ip(l,f,t):c.has(p)?h.connectionEnd=rp(l,p,t):u.has(f)?h.connectionStart=ec(l,f,a[f.id]):u.has(p)&&(h.connectionEnd=tc(l,p,a[p.id])),s._modeling.layoutConnection(l,h))})};function cv(e){return V({},e)}function _T(e){return sn(e.waypoints,function(t){return t=cv(t),t.original&&(t.original=cv(t.original)),t})}function uv(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function lv(e,t,n){var i=uv(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function xT(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Tc(e){this._modeling=e}Tc.$inject=["modeling"],Tc.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=pv(n),t.collapsed=!t.collapsed;var i=fv(n,t.collapsed);return[t].concat(i)},Tc.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=dv(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function pv(e){var t={};return I(e,function(n){t[n.id]=n.hidden,n.children&&(t=V({},t,pv(n.children)))}),t}function fv(e,t){var n=[];return I(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(fv(i.children,i.collapsed||t)))}),n}function dv(e,t){var n=[];return I(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(dv(i.children,t)))}),n}function Mc(e){this._modeling=e}Mc.$inject=["modeling"],Mc.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=hv(i,t),mv(n,t),t.host=n,t},Mc.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,hv(n,t),mv(i,t,r),t};function hv(e,t){return Ct(e&&e.attachers,t)}function mv(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),At(i,t,n)}}function Zp(){}Zp.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},Zp.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function st(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}st.$inject=["eventBus","elementFactory","commandStack"],st.prototype.getHandlers=function(){return{"shape.append":Ec,"shape.create":fr,"shape.delete":wa,"shape.move":Fr,"shape.resize":Ra,"shape.replace":$i,"shape.toggleCollapse":Tc,spaceTool:dr,"label.create":_a,"connection.create":Sc,"connection.delete":xa,"connection.move":Kp,"connection.layout":Pc,"connection.updateWaypoints":Zp,"connection.reconnect":Sa,"elements.create":qp,"elements.move":Ac,"elements.delete":Yp,"elements.distribute":Cc,"elements.align":wc,"element.updateAttachment":Mc}},st.prototype.registerHandlers=function(e){I(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},st.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)},st.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},st.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)},st.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)},st.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},st.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},st.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},st.prototype.createElements=function(e,t,n,i,r){ke(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},st.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},st.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},st.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},st.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},st.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},st.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},st.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},st.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},st.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},st.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)},st.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},st.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)},st.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,V(i,{docking:"source"}))},st.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,V(i,{docking:"target"}))},st.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},st.prototype._create=function(e,t){return LS(t)?t:this._elementFactory.create(e,t)},st.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function Ca(e){this._elementRegistry=e}Ca.$inject=["elementRegistry"],Ca.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||wT(n,ts(i));return gv(n,i),e.oldProperties=o,e.changed=r,r},Ca.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return gv(n,t),i},Ca.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return w(e,"bpmn:DataObject")?ET(e,t):[]};function wT(e,t){return Rn(t,function(n,i){return n[i]=e.get(i),n},{})}function gv(e,t){I(t,function(n,i){e.set(i,n)})}function ET(e,t){return t.filter(function(n){return w(n,"bpmn:DataObjectReference")&&ie(n).dataObjectRef===e})}var Pa="default",Fi="id",yv="di",ST={width:0,height:0};function Aa(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}Aa.$inject=["elementRegistry","moddle","modeling","textRenderer"],Aa.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=TT(e.properties),s=e.oldProperties||RT(t,a);return vv(a,o)&&(r.unclaim(o[Fi]),i.updateId(t,a[Fi]),r.claim(a[Fi],o)),Pa in a&&(a[Pa]&&n.push(i.get(a[Pa].id)),o[Pa]&&n.push(i.get(o[Pa].id))),bv(t,a),e.oldProperties=s,e.changed=n,n},Aa.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,ST)}},Aa.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 bv(t,i),vv(n,r)&&(a.unclaim(n[Fi]),o.updateId(t,i[Fi]),a.claim(i[Fi],r)),e.changed};function vv(e,t){return Fi in e&&e[Fi]!==t[Fi]}function RT(e,t){var n=ts(t),i=e.businessObject,r=Ze(e);return Rn(n,function(o,a){return a!==yv?o[a]=i.get(a):o[a]=CT(r,ts(t.di)),o},{})}function CT(e,t){return Rn(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function bv(e,t){var n=e.businessObject,i=Ze(e);I(t,function(r,o){o!==yv?n.set(o,r):i&&PT(i,r)})}function PT(e,t){I(t,function(n,i){e.set(i,n)})}var AT=["default"];function TT(e){var t=V({},e);return AT.forEach(function(n){n in e&&(t[n]=ie(t[n]))}),t}function kc(e,t){this._canvas=e,this._modeling=t}kc.$inject=["canvas","modeling"],kc.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=Ze(r);return t.setRootElement(n),t.removeRootElement(r),At(a.rootElements,i),i.$parent=a,Ct(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},kc.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=Ze(n);return t.setRootElement(r),t.removeRootElement(n),Ct(a.rootElements,i),i.$parent=null,At(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function Qp(e,t){this._modeling=e,this._spaceTool=t}Qp.$inject=["modeling","spaceTool"],Qp.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=Yn(i),a=o===i,s=a?i:i.parent,c=or(s),u=Xt(i);if(u?r==="left"?r="top":r==="right"&&(r="bottom"):r==="top"?r="left":r==="bottom"&&(r="right"),!c.length){var l=u?{x:i.x+qn,y:i.y,width:i.width-qn,height:i.height}:{x:i.x,y:i.y+qn,width:i.width,height:i.height-qn};n.createShape({type:"bpmn:Lane",isHorizontal:u},l,s)}var f=[];kr(o,function(S){return f.push(S),S.label&&f.push(S.label),S===i?[]:Ue(S.children,function(P){return P!==i})});var p,d,g,h,m;r==="top"?(p=-120,d=i.y,g=d+10,h="n",m="y"):r==="left"?(p=-120,d=i.x,g=d+10,h="w",m="x"):r==="bottom"?(p=120,d=i.y+i.height,g=d-10,h="s",m="y"):r==="right"&&(p=120,d=i.x+i.width,g=d-10,h="e",m="x");var _=t.calculateAdjustments(f,m,p,g),y=u?{x:0,y:p}:{x:p,y:0};t.makeSpace(_.movingShapes,_.resizingShapes,y,h,g);var x=u?{x:i.x+(a?qn:0),y:d-(r==="top"?120:0),width:i.width-(a?qn:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?qn:0),width:120,height:i.height-(a?qn:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:u},x,s)};function Jp(e){this._modeling=e}Jp.$inject=["modeling"],Jp.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=or(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=Xt(n),s=a?n.height:n.width,c=Math.round(s/i),u,l,f,p;for(p=0;p<i;p++)p===i-1?u=s-c*p:u=c,l=a?{x:n.x+qn,y:n.y+p*c,width:n.width-qn,height:u}:{x:n.x+p*c,y:n.y+qn,width:u,height:n.height-qn},p<o?t.resizeShape(r[p],l):(f={type:"bpmn:Lane",isHorizontal:a},t.createShape(f,l,n))};function Ta(e,t){this._modeling=e,this._spaceTool=t}Ta.$inject=["modeling","spaceTool"],Ta.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Ta.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=EC(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},Ta.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=Te(e),r=Te(t),o=Zm(r,i),a=Yn(e),s=[],c=[];kr(a,function(g){return s.push(g),(w(g,"bpmn:Lane")||w(g,"bpmn:Participant"))&&c.push(g),g.children});var u,l,f,p,d;(o.bottom||o.top)&&(u=o.bottom||o.top,l=e.y+(o.bottom?e.height:0)+(o.bottom?-10:10),f=o.bottom?"s":"n",p=o.top>0||o.bottom<0?-u:u,d=n.calculateAdjustments(s,"y",p,l),n.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:u},f)),(o.left||o.right)&&(u=o.right||o.left,l=e.x+(o.right?e.width:0)+(o.right?-10:100),f=o.right?"e":"w",p=o.left>0||o.right<0?-u:u,d=n.calculateAdjustments(c,"x",p,l),n.makeSpace(d.movingShapes,d.resizingShapes,{x:u,y:0},f))};var Ma="flowNodeRef",ef="lanes";function Oc(){}Oc.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(l,f){var p=Te(f),d={x:l.x+l.width/2,y:l.y+l.height/2};return d.x>p.left&&d.x<p.right&&d.y>p.top&&d.y<p.bottom}function s(l){n.indexOf(l)===-1&&(o.push(l),n.push(l))}function c(l){var f=Yn(l);return r[f.id]||(r[f.id]=Ks(f)),r[f.id]}function u(l){if(!l.parent)return[];var f=c(l);return f.filter(function(p){return a(l,p)}).map(function(p){return p.businessObject})}return t.forEach(function(l){var f=Yn(l);if(!(!f||n.indexOf(f)!==-1)){var p=f.children.filter(function(d){return w(d,"bpmn:FlowNode")});p.forEach(s),n.push(f)}}),e.forEach(s),o.forEach(function(l){var f=l.businessObject,p=f.get(ef),d=p.slice(),g=u(l);i.push({flowNode:f,remove:d,add:g})}),t.forEach(function(l){var f=l.businessObject;l.parent||f.get(Ma).forEach(function(p){i.push({flowNode:p,remove:[f],add:[]})})}),i},Oc.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(ef);n.remove.forEach(function(o){Ct(r,o),Ct(o.get(Ma),i)}),n.add.forEach(function(o){At(r,o),At(o.get(Ma),i)})}),[]},Oc.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(ef);n.add.forEach(function(o){Ct(r,o),Ct(o.get(Ma),i)}),n.remove.forEach(function(o){At(r,o),At(o.get(Ma),i)})}),[]};var tf="categoryValueRef";function ka(e,t){this._bpmnFactory=e,this._elementRegistry=t}ka.$inject=["bpmnFactory","elementRegistry"],ka.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,r=new Map,o=[],a=new Map;function s(y,x,S){if(x){var P=a.get(y);P||(P={},a.set(y,P)),!(S&&P.present)&&(!S&&P.past||(S?P.present={categoryValue:x,root:nf(y)}:P.past={categoryValue:x}))}}function c(y){r.set(y,ie(y))}function u(){n.filter(function(y){return w(y,"bpmn:FlowElement")&&!Ge(y)&&y.parent}).forEach(c)}function l(y){var x=ie(y),S=x.get("categoryValueRef");return S||(S=Um(i,x),o.push(MT(y,S))),S}function f(y){return y.reduce(function(x,S){var P=nf(S),C=x.get(P);return C||(C=[],x.set(P,C)),C.push(S),x},new Map)}e=Array.from(e||[]);var p=f(e);t.length&&u(),e.forEach(c),n.filter(function(y){return w(y,"bpmn:Group")&&!Ge(y)&&y.parent}).forEach(function(y){var x=ie(y).get("categoryValueRef");if(!x){var S=nf(y),P=p.get(S)||[],C=uo(P,y),L=Object.keys(C).length>0;L&&(x=l(y))}s(y,x,!0)}),t.forEach(function(y){s(y.groupShape,y.categoryValue,!1)}),o.length&&u();var d=Array.from(r.keys()),g=Array.from(a.values()).reduce(function(y,x){return x.present&&y.add(x.present.categoryValue),x.past&&y.add(x.past.categoryValue),y},new Set),h=new Map,m=f(d);a.forEach(function(y,x){var S=y.present;if(S){var P=m.get(S.root)||[],C=uo(P,x);P.forEach(function(L){if(C[L.id]){var T=h.get(L);T||(T=new Set,h.set(L,T)),T.add(S.categoryValue)}})}});var _=d.reduce(function(y,x){var S=r.get(x),P=S.get(tf),C=new Set(P),L=h.get(x)||new Set,T=Array.from(L).filter(function(k){return!C.has(k)}),j=P.filter(function(k){return g.has(k)&&!L.has(k)});return(T.length||j.length)&&y.push({businessObject:S,categoryValuesToAdd:T,categoryValuesToRemove:j}),y},[]);return{flowElements:_,groups:o}},ka.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),kT(t.groups),DT(t.flowElements),[]},ka.prototype.revert=function(e){var t=e.updates;return LT(t.flowElements),OT(t.groups),[]};function MT(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function kT(e){e.forEach(function(t){ie(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function OT(e){e.forEach(function(t){ie(t.groupShape).categoryValueRef=null})}function DT(e){e.forEach(function(t){var n=t.businessObject,i=n.get(tf);t.categoryValuesToRemove.forEach(function(r){Ct(i,r)}),t.categoryValuesToAdd.forEach(function(r){At(i,r,!0)})})}function LT(e){e.forEach(function(t){var n=t.businessObject,i=n.get(tf);t.categoryValuesToAdd.forEach(function(r){Ct(i,r)}),t.categoryValuesToRemove.forEach(function(r){At(i,r,!0)})})}function nf(e){for(;e.parent;)e=e.parent;return e}function Dc(e){this._moddle=e}Dc.$inject=["moddle"],Dc.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),[]},Dc.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 IT={fill:void 0,stroke:void 0};function rf(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(En(t)){var n=BT(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}rf.$inject=["commandStack"],rf.prototype.postExecute=function(e){var t=e.elements,n=e.colors||IT,i=this,r={};"fill"in n&&V(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&V(r,{"border-color":this._normalizeColor(n.stroke)}),I(t,function(o){var a=at(o)?ii(r,["border-color"]):r,s=Ze(o);if(NT(a),Ge(o)){if(!s||!w(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:s.label,properties:{color:r["border-color"]}})}else{if(!We(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function BT(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 NT(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var $T={width:0,height:0};function _v(e,t,n){function i(c,u){var l=c.label||c,f=c.labelTarget||c;return fR(l,u),[l,f]}function r(c){var u=c.element,l=u.businessObject,f=c.newLabel;if(!Ge(u)&&ir(u)&&!Bs(u)&&!xv(f)){var p=7,d=Pl(u);d={x:d.x,y:d.y+p},e.createLabel(u,d,{id:l.id+"_label",businessObject:l,di:u.di})}}function o(c){return c.oldLabel=Hn(c.element),i(c.element,c.newLabel)}function a(c){return i(c.element,c.oldLabel)}function s(c){var u=c.element,l=u.label||u,f=c.newLabel,p=c.newBounds,d=c.hints||{};if(!(!Ge(l)&&!w(l,"bpmn:TextAnnotation"))){if(Ge(l)&&xv(f)){d.removeShape!==!1&&e.removeShape(l,{unsetLabel:!1});return}var g=Hn(u);typeof p>"u"&&(p=t.getExternalLabelBounds(l,g)),p&&e.resizeShape(l,p,$T)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}_v.$inject=["modeling","textRenderer","bpmnFactory"];function xv(e){return!e||!e.trim()}function on(e,t,n,i){st.call(this,e,t,n),this._bpmnRules=i}ye(on,st),on.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],on.prototype.getHandlers=function(){var e=st.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=Ca,e["element.updateProperties"]=Aa,e["canvas.updateRoot"]=kc,e["lane.add"]=Qp,e["lane.resize"]=Ta,e["lane.split"]=Jp,e["lane.updateRefs"]=Oc,e["group.updateRefs"]=ka,e["id.updateClaim"]=Dc,e["element.setColor"]=rf,e["element.updateLabel"]=_v,e},on.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},on.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)},on.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},on.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},on.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},on.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},on.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},on.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},on.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},on.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},on.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},on.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},on.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},on.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function wv(){}wv.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||Oe(t.source||e.source),t.connectionEnd||Oe(t.target||e.target)]};var Lc=20,FT=5,Ic=Math.round,Ev=20,jT={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function HT(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function zT(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function Sv(e,t,n){var i=tn(t,e,FT),r=n.split(":")[0],o=Ic((t.x-e.x)/2+e.x),a=Ic((t.y-e.y)/2+e.y),s,c,u=zT(r,i),l=/h|r|l/.test(r),f=!1,p=!1;return u?(s=l?{x:o,y:e.y}:{x:e.x,y:a},c=l?"h:h":"v:v"):(f=HT(i,r),c=l?"h:v":"v:h",f?l?(p=a===e.y,s={x:e.x+Lc*(/l/.test(r)?-1:1),y:p?a+Lc:a}):(p=o===e.x,s={x:p?o+Lc:o,y:e.y+Lc*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:of(e,s,c).concat(s),directions:c,turnNextDirections:p}}function GT(e,t,n){return Sv(e,t,n)}function VT(e,t,n){var i=Sv(t,e,Rv(n));return{waypoints:i.waypoints.slice().reverse(),directions:Rv(i.directions),turnNextDirections:i.turnNextDirections}}function WT(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=of(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function Rv(e){return e.split(":").reverse().join(":")}function UT(e,t,n){var i=Ic((t.x-e.x)/2+e.x),r=Ic((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 of(e,t,n){if(n=n||"h:h",!tM(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Pv(n)){var i=GT(e,t,n),r=VT(e,t,n),o=WT(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return UT(e,t,n)}function qT(e,t,n){var i=of(e,t,n);return i.unshift(e),i.push(t),Tv(i)}function YT(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=G0(o,"straight")[0]||"h:h",s=jT[a]||0,c=tn(e,t,s),u=eM(c,a);n=n||Oe(e),i=i||Oe(t);var l=u.split(":"),f=Av(n,e,l[0],nM(c)),p=Av(i,t,l[1],c);return qT(f,p,u)}function KT(e,t,n,i,r,o){ke(n)&&(r=n,o=i,n=Oe(e),i=Oe(t)),o=V({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&ZT(e,t,n,i,o),c||(c=o.connectionEnd&&JT(t,e,i,r),c)||(c=o.connectionStart&&QT(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:YT(e,t,n,i,o)}function XT(e,t,n){return e>=t&&e<=n}function Cv(e,t,n){var i={x:"width",y:"height"};return XT(t[e],n[e],n[e]+n[i[e]])}function ZT(e,t,n,i,r){var o={},a,s;return s=tn(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?Cv(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:Cv(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 QT(e,t,n,i){return af(e,t,n,i)}function JT(e,t,n,i){var r=i.slice().reverse();return r=af(e,t,n,r),r?r.reverse():null}function af(e,t,n,i){function r(l){return l.length<3?!0:l.length>4?!1:!!pt(l,function(f,p){var d=l[p-1];return d&&ta(f,d)<3})}function o(l,f,p){var d=Mi(f,l);switch(d){case"v":return{x:p.x,y:l.y};case"h":return{x:l.x,y:p.y}}return{x:l.x,y:l.y}}function a(l,f,p){var d;for(d=l.length-2;d!==0;d--)if(Qh(l[d],f,Ev)||Qh(l[d],p,Ev))return l.slice(d);return l}if(r(i))return null;var s=i[0],c=i.slice(),u;return c[0]=n,c[1]=o(c[1],s,n),u=a(c,e,t),u!==c&&(c=af(e,t,n,u)),c&&Mi(c)?null:c}function eM(e,t){if(Pv(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 tM(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Pv(e){return e&&/t|r|b|l/.test(e)}function nM(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 Av(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 Tv(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return wl(r,o,n,0)||t.push(n),t},[])}var iM=-10,rM=40,oM={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},aM={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},sf={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Oa={top:"t",right:"r",bottom:"b",left:"l"};function Bc(e){this._elementRegistry=e}ye(Bc,wv),Bc.prototype.layoutConnection=function(e,t){t||(t={});var n=t.source||e.source,i=t.target||e.target,r=t.waypoints||e.waypoints,o=t.connectionStart,a=t.connectionEnd,s=this._elementRegistry,c,u;if(o||(o=Mv(r&&r[0],n)),a||(a=Mv(r&&r[r.length-1],i)),(w(e,"bpmn:Association")||w(e,"bpmn:DataAssociation"))&&r&&!kv(n,i))return[].concat([o],r.slice(1,-1),[a]);var l=zm(n,s)?oM:aM;return w(e,"bpmn:MessageFlow")?c=cM(n,i,l):(w(e,"bpmn:SequenceFlow")||kv(n,i))&&(n===i?c={preferredLayouts:hM(n,e,l)}:w(n,"bpmn:BoundaryEvent")?c={preferredLayouts:mM(n,i,a,l)}:Da(n)||Da(i)?c={preferredLayouts:l.subProcess,preserveDocking:lM(n)}:w(n,"bpmn:Gateway")?c={preferredLayouts:l.fromGateway}:w(i,"bpmn:Gateway")?c={preferredLayouts:l.toGateway}:c={preferredLayouts:l.default}),c&&(c=V(c,t),u=Tv(KT(n,i,o,a,r,c))),u||[o,a]};function sM(e){var t=e.host;return tn(Oe(e),t,iM)}function cM(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:uM(e,t)}}function uM(e,t){return w(t,"bpmn:Participant")?"source":w(e,"bpmn:Participant")?"target":Da(t)?"source":Da(e)||w(t,"bpmn:Event")?"target":w(e,"bpmn:Event")?"source":null}function lM(e){return Da(e)?"target":"source"}function Mv(e,t){return e?e.original||e:Oe(t)}function kv(e,t){return w(t,"bpmn:Activity")&&w(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Da(e){return w(e,"bpmn:SubProcess")&&Ye(e)}function jr(e,t){return e===t}function pM(e,t){return t.indexOf(e)!==-1}function To(e){var t=/right|left/.exec(e);return t&&t[0]}function Mo(e){var t=/top|bottom/.exec(e);return t&&t[0]}function Ov(e,t){return sf[e]===t}function fM(e,t){var n=To(e),i=sf[n];return t.indexOf(i)!==-1}function dM(e,t){var n=Mo(e),i=sf[n];return t.indexOf(i)!==-1}function Dv(e){return e==="right"||e==="left"}function hM(e,t,n){var i=t.waypoints,r=i&&i.length&&tn(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function mM(e,t,n,i){var r=Oe(e),o=Oe(t),a=sM(e),s,c,u=jr(e.host,t),l=pM(a,["top","right","bottom","left"]),f=tn(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?gM(a,l,e,t,n,i):(s=yM(a,f,l,i.isHorizontal),c=vM(a,f,l,i.isHorizontal),[s+":"+c])}function gM(e,t,n,i,r,o){var a=t?e:o.isHorizontal?Mo(e):To(e),s=Oa[a],c;return t?Dv(e)?c=Lv("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=Lv("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function Lv(e,t,n,i){var r=rM;return!(cf(e,i,n,r)||cf(e,i,{x:n.x+n.width,y:n.y+n.height},r)||cf(e,i,Oe(t),r))}function cf(e,t,n,i){return Math.abs(t[e]-n[e])<i}function yM(e,t,n,i){if(n)return Oa[e];var r=Mo(e),o=To(e),a=Mo(t),s=To(t);if(i){if(jr(r,a)||Ov(o,s))return Oa[r]}else if(jr(o,s)||Ov(r,a))return Oa[o];return Oa[i?o:r]}function vM(e,t,n,i){if(n)return Dv(e)?fM(e,t)||jr(e,t)?"h":"v":dM(e,t)||jr(e,t)?"v":"h";var r=Mo(e),o=To(e),a=Mo(t),s=To(t);return a&&!s?"v":s&&!a?"h":i?jr(r,a)?"h":"v":jr(o,s)?"v":"h"}Bc.$inject=["elementRegistry"];function Iv(e){return V({original:e.point.original||e.point},e.actual)}function hr(e,t){this._elementRegistry=e,this._graphicsFactory=t}hr.$inject=["elementRegistry","graphicsFactory"],hr.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),r=this.getDockingPoint(e,n),o=e.waypoints.slice(i.idx+1,r.idx);return o.unshift(Iv(i)),o.push(Iv(r)),o},hr.prototype.getDockingPoint=function(e,t,n){var i=e.waypoints,r,o,a;return r=n?0:i.length-1,o=i[r],a=this._getIntersection(t,e,n),{point:o,actual:a||o,idx:r}},hr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return na(i,r,n)},hr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},hr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},hr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const uf={__init__:["modeling","bpmnUpdater"],__depends__:[NP,JP,tA,nA,qy,iT,oT,pT,Xn,Wp,Jy],bpmnFactory:["type",Qn],bpmnUpdater:["type",On],elementFactory:["type",pr],modeling:["type",on],layouter:["type",Bc],connectionDocking:["type",hr]};var bM=10,Bv=50,_M=250;function lf(e,t,n,i){for(var r;r=xM(e,n,t);)n=i(t,n,r);return n}function pf(e){return function(t,n,i){var r={x:n.x,y:n.y};return["x","y"].forEach(function(o){var a=e[o];if(a){var s=o==="x"?"width":"height",c=a.margin,u=a.minDistance;c<0?r[o]=Math.min(i[o]+c-t[s]/2,n[o]-u+c):r[o]=Math.max(i[o]+i[s]+c+t[s]/2,n[o]+u+c)}}),r}}function xM(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=EM(e);return pt(r,function(o){if(o===n)return!1;var a=tn(o,i,bM);return a==="intersect"})}function wM(e,t){t||(t={});function n(g){return g.source===e?1:-1}var i=t.defaultDistance||Bv,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||_M,c=t.reference||"start";o||(o=CM);function u(g,h){return r==="n"?c==="start"?Te(g).top-Te(h).bottom:c==="center"?Te(g).top-Oe(h).y:Te(g).top-Te(h).top:r==="w"?c==="start"?Te(g).left-Te(h).right:c==="center"?Te(g).left-Oe(h).x:Te(g).left-Te(h).left:r==="s"?c==="start"?Te(h).top-Te(g).bottom:c==="center"?Oe(h).y-Te(g).bottom:Te(h).bottom-Te(g).bottom:c==="start"?Te(h).left-Te(g).right:c==="center"?Oe(h).x-Te(g).right:Te(h).right-Te(g).right}var l=e.incoming.filter(o).map(function(g){var h=a(g),m=h<0?u(g.source,e):u(e,g.source);return{id:g.source.id,distance:m,weight:h}}),f=e.outgoing.filter(o).map(function(g){var h=a(g),m=h>0?u(e,g.target):u(g.target,e);return{id:g.target.id,distance:m,weight:h}}),p=l.concat(f).reduce(function(g,h){return g[h.id+"__weight_"+h.weight]=h,g},{}),d=Rn(p,function(g,h){var m=h.distance,_=h.weight;return m<0||m>s||(g[String(m)]||(g[String(m)]=0),g[String(m)]+=1*_,(!g.distance||g[g.distance]<g[String(m)])&&(g.distance=m)),g},{});return d.distance||i}function EM(e){var t=ff(e);return e.host&&(t=t.concat(ff(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(ff(i))},[]))),t}function ff(e){return RM(e).concat(SM(e))}function SM(e){return e.incoming.map(function(t){return t.source})}function RM(e){return e.outgoing.map(function(t){return t.target})}function CM(){return!0}var PM=100;function Nv(e,t,n){e.on("autoPlace",PM,function(i){var r=i.shape,o=i.source;return AM(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}}Nv.$inject=["eventBus","modeling","canvas"];function AM(e,t,n){n||(n={});var i=n.defaultDistance||Bv,r=Oe(e),o=Te(e);return{x:o.right+i+t.width/2,y:r.y}}function $v(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}$v.$inject=["eventBus","selection"];const TM={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",Nv],autoPlaceSelectionBehavior:["type",$v]};function Fv(e,t,n){var i=zm(e,n);if(w(t,"bpmn:TextAnnotation"))return kM(e,t,i);if(We(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return OM(e,t,i);if(w(t,"bpmn:FlowNode"))return MM(e,t,i)}function MM(e,t,n){var i=Te(e),r=Oe(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=wM(e,{filter:function(d){return w(d,"bpmn:SequenceFlow")},direction:o.directionHint}),s=30,c=o.minDistance,u=o.baseOrientation;w(e,"bpmn:BoundaryEvent")&&(u=tn(e,e.host,-25),u.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var l=n?{x:i.right+a+t.width/2,y:r.y+jv(u,c,o)}:{x:r.x+jv(u,c,o),y:i.bottom+a+t.height/2},f={margin:s,minDistance:c},p=n?{y:f}:{x:f};return lf(e,t,l,pf(p))}function jv(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function kM(e,t,n){var i=Te(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};at(e)&&(r=Oe(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 lf(e,t,r,pf(a))}function OM(e,t,n){var i=Te(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 lf(e,t,r,pf(a))}function Hv(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return Fv(r,i,t)})}Hv.$inject=["eventBus","elementRegistry"];const Nc={__depends__:[TM],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",Hv]},zv=[jm,ca,uf,Nc];function DM(e={}){Ld(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new fo({container:t,moddleExtensions:e.moddleExtensions??cs,additionalModules:[...zv,...e.additionalModules??[]]})}var LM=new Po("ov"),IM=500;function Qt(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=LM,this._overlayDefaults=V({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=BM(n.getContainer()),this._init()}Qt.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Qt.prototype.get=function(e){if(En(e)&&(e={id:e}),En(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?Ue(t.overlays,eo({type:e.type})):t.overlays.slice():[]}else return e.type?Ue(this._overlays,eo({type:e.type})):e.id?this._overlays[e.id]:null},Qt.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=V({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},Qt.prototype.remove=function(e){var t=this.get(e)||[];ke(t)||(t=[t]);var n=this;I(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(di(i.html),di(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)}})},Qt.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Qt.prototype.show=function(){$c(this._overlayRoot)},Qt.prototype.hide=function(){$c(this._overlayRoot,!1)},Qt.prototype.clear=function(){this._overlays={},this._overlayContainers=[],xs(this._overlayRoot)},Qt.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=kt(t);i=o.x,r=o.y}Gv(n,i,r),un(e.html,"data-container-id",t.id)},Qt.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=kt(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=kt(i).height:s=i.height,o=t.bottom*-1+s}Gv(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Qt.prototype._createOverlayContainer=function(e){var t=ht('<div class="djs-overlays" />');mn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},Qt.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";Vv(this._overlayRoot,n)},Qt.prototype._getOverlayContainer=function(e,t){var n=pt(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},Qt.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)),En(i)&&(i=ht(i)),o=this._getOverlayContainer(n),r=ht('<div class="djs-overlay" data-overlay-id="'+t+'">'),mn(r,{position:"absolute"}),r.appendChild(i),e.type&&_t(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();$c(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())},Qt.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&&(Ft(r)&&r>t.scale||Ft(o)&&o<t.scale))&&(c=!1),$c(a,c),this._updateOverlayScale(e,t)},Qt.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),Ft(i)&&t.scale<i&&(a=(1/t.scale||1)*i),Ft(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),Ft(a)&&(s="scale("+a+","+a+")"),Vv(o,s)},Qt.prototype._updateOverlaysVisibilty=function(e){var t=this;I(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},Qt.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});I(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){di(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",IM,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&(I(o.overlays,function(a){t._updateOverlay(a)}),t._updateOverlayContainer(o))}),e.on("element.marker.update",function(i){var r=t._getOverlayContainer(i.element,!0);r&&_t(r.html)[i.add?"add":"remove"](i.marker)}),e.on("root.set",function(){t._updateOverlaysVisibilty(t._canvas.viewbox())}),e.on("diagram.clear",this.clear,this)};function BM(e){var t=ht('<div class="djs-overlay-container" />');return mn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function Gv(e,t,n){mn(e,{left:t+"px",top:n+"px"})}function $c(e,t){e.style.display=t===!1?"none":""}function Vv(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Fc={__init__:["overlays"],overlays:["type",Qt]};function df(e,t){t.invoke(ne,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)})}ye(df,ne),df.$inject=["canvas","injector"];const NM={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",df]};function La(e){return CSS.escape(e)}var $M={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function Wv(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return $M[t]})}var FM="bjs-breadcrumbs-shown";function Uv(e,t,n){var i=ht('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=_t(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var u=c.element,l=ie(u),f=pt(a,function(p){return p===l});f&&s()});function s(c){c&&(a=jM(c));var u=a.flatMap(function(f){var p=n.findRoot(vi(f))||n.findRoot(f.id);if(!p&&w(f,"bpmn:Process")){var d=t.find(function(m){var _=ie(m);return _&&_.get("processRef")===f});p=d&&n.findRoot(d.id)}if(!p)return[];var g=Wv(f.name||f.id),h=ht('<li><span class="bjs-crumb"><a title="'+g+'">'+g+"</a></span></li>");return h.addEventListener("click",function(){n.setRootElement(p)}),h});i.innerHTML="";var l=u.length>1;o.toggle(FM,l),u.forEach(function(f){i.appendChild(f)})}e.on("root.set",function(c){s(c.element)})}Uv.$inject=["eventBus","elementRegistry","canvas"];function jM(e){for(var t=ie(e),n=[],i=t;i;i=i.$parent)(w(i,"bpmn:SubProcess")||w(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function qv(e,t){var n=null,i=new HM;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,!(!w(o,"bpmn:SubProcess")&&!s)){s=s||{x:0,y:0,zoom:1};var c=(a.x-s.x)*a.scale,u=(a.y-s.y)*a.scale;(c!==0||u!==0)&&t.scroll({dx:c,dy:u}),s.zoom!==a.scale&&t.zoom(s.zoom,{x:0,y:0})}}),e.on("diagram.clear",function(){i.clear(),n=null})}qv.$inject=["eventBus","canvas"];function HM(){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 Yv={x:180,y:160};function Hr(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}Hr.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)})}},Hr.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;w(a,"bpmn:SubProcess")&&!o.isExpanded&&n.push(a),GM(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},Hr.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=zM(e),i={x:n.x-Yv.x,y:n.y-Yv.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)})},Hr.prototype._moveToDiPlane=function(e,t){var n=Kv(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},Hr.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},Hr.$inject=["eventBus","moddle"];function Kv(e){return w(e,"bpmndi:BPMNDiagram")?e:Kv(e.$parent)}function zM(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=Te(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),Ms(t)}function GM(e,t){var n=e.$parent;return!(!w(n,"bpmn:SubProcess")||n===t.bpmnElement||We(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var jc=250,VM='<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>',WM="bjs-drilldown-empty";function mr(e,t,n,i,r){ne.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",jc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",jc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],jc,function(a){var s=a.oldParent,c=a.newParent||a.parent,u=a.shape;o._canDrillDown(u)&&o._addOverlay(u),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(u)},!0),this.reverted(["shape.create","shape.move","shape.delete"],jc,function(a){var s=a.oldParent,c=a.newParent||a.parent,u=a.shape;o._canDrillDown(u)&&o._addOverlay(u),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(u)},!0),t.on("import.render.complete",function(){n.filter(function(a){return o._canDrillDown(a)}).map(function(a){o._addOverlay(a)})})}ye(mr,ne),mr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},mr.prototype._canDrillDown=function(e){var t=this._canvas;return w(e,"bpmn:SubProcess")&&t.findRoot(vi(e))},mr.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;_t(i.html).toggle(WM,!r)}},mr.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=ht('<button type="button" class="bjs-drilldown">'+VM+"</button>"),a=i.get("name")||i.get("id"),s=this._translate("Open {element}",{element:a});o.setAttribute("title",s),o.addEventListener("click",function(){t.setRootElement(t.findRoot(vi(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},mr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},mr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const UM={__depends__:[Fc,Wp,NM],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",Uv],drilldownCentering:["type",qv],drilldownOverlayBehavior:["type",mr],subprocessCompatibility:["type",Hr]};function gr(e){xt.call(this,e)}ye(gr,xt),gr.prototype._modules=[jm,UM,Fc,Xn,ca],gr.prototype._moddleExtensions={};var Hc="keyboard.keydown",qM="keyboard.keyup",YM=1e3,Xv="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 gn(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(Xv));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}gn.$inject=["config.keyboard","eventBus"],gn.prototype._keydownHandler=function(e){this._keyHandler(e,Hc)},gn.prototype._keyupHandler=function(e){this._keyHandler(e,qM)},gn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Hc,i),n&&e.preventDefault()}},gn.prototype._isEventIgnored=function(e){return!1},gn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(Xv)),this.unbind(),e=this._node=this._target,$e.bind(e,"keydown",this._keydownHandler),$e.bind(e,"keyup",this._keyupHandler),this._fire("bind")},gn.prototype.getBinding=function(){return this._node},gn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),$e.unbind(e,"keydown",this._keydownHandler),$e.unbind(e,"keyup",this._keyupHandler)),this._node=null},gn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},gn.prototype.addListener=function(e,t,n){Yt(e)&&(n=t,t=e,e=YM),this._eventBus.on(n||Hc,e,t)},gn.prototype.removeListener=function(e,t){this._eventBus.off(t||Hc,e)},gn.prototype.hasModifier=mA,gn.prototype.isCmd=Mn,gn.prototype.isShift=Lp,gn.prototype.isKey=zt;var KM=500;function ko(e,t){var n=this;e.on("editorActions.init",KM,function(i){var r=i.editorActions;n.registerBindings(t,r)})}ko.$inject=["eventBus","keyboard"],ko.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(_A(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(xA(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(gA(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(yA(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(vA(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(bA(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(zt(["+","Add","="],r)&&Mn(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(zt(["-","Subtract"],r)&&Mn(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(zt("0",r)&&Mn(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(zt(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const hf={__init__:["keyboard","keyboardBindings"],keyboard:["type",gn],keyboardBindings:["type",ko]};var XM={moveSpeed:50,moveSpeedAccelerated:200};function Zv(e,t,n){var i=this;this._config=V({},XM,e||{}),t.addListener(r);function r(o){var a=o.keyEvent,s=i._config;if(t.isCmd(a)&&t.isKey(["ArrowLeft","Left","ArrowUp","Up","ArrowDown","Down","ArrowRight","Right"],a)){var c=t.isShift(a)?s.moveSpeedAccelerated:s.moveSpeed,u;switch(a.key){case"ArrowLeft":case"Left":u="left";break;case"ArrowUp":case"Up":u="up";break;case"ArrowRight":case"Right":u="right";break;case"ArrowDown":case"Down":u="down";break}return i.moveCanvas({speed:c,direction:u}),!0}}this.moveCanvas=function(o){var a=0,s=0,c=o.speed,u=c/Math.min(Math.sqrt(n.viewbox().scale),1);switch(o.direction){case"left":a=u;break;case"up":s=u;break;case"right":a=-u;break;case"down":s=-u;break}n.scroll({dx:a,dy:s})}}Zv.$inject=["config.keyboardMove","keyboard","canvas"];const Qv={__depends__:[hf],__init__:["keyboardMove"],keyboardMove:["type",Zv]};var ZM=15;function Jv(e,t){var n;function i(s){return a(s.originalEvent)}e.on("canvas.focus.changed",function(s){s.focused?e.on("element.mousedown",500,i):e.off("element.mousedown",i)});function r(s){var c=n.start,u=n.button,l=Ir(s),f=oi(l,c);if(!n.dragging&&QM(f)>ZM&&(n.dragging=!0,u===0&&Cy(e),hc("grab")),n.dragging){var p=n.last||n.start;f=oi(l,p),t.scroll({dx:f.x,dy:f.y}),n.last=l}s.preventDefault()}function o(s){$e.unbind(document,"mousemove",r),$e.unbind(document,"mouseup",o),n=null,Ry()}function a(s){if(!Tr(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:Ir(s)},$e.bind(document,"mousemove",r),$e.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}Jv.$inject=["eventBus","canvas"];function QM(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const eb={__init__:["moveCanvas"],moveCanvas:["type",Jv]};function tb(e,t){var n=kl(e.min),i=kl(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function JM(e,t){return Math.max(e.min,Math.min(e.max,t))}var e2=Math.sign||function(e){return e>=0?1:-1},mf={min:.2,max:4},nb=10,t2=.1,n2=.75;function xi(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=bn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||n2;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}xi.$inject=["config.zoomScroll","eventBus","canvas"],xi.prototype.scroll=function(t){this._canvas.scroll(t)},xi.prototype.reset=function(){this._canvas.zoom("fit-viewport")},xi.prototype.zoom=function(t,n){var i=tb(mf,nb*2);this._totalDelta+=t,Math.abs(this._totalDelta)>t2&&(this._zoom(t,n,i),this._totalDelta=0)},xi.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||Dg()&&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))*e2(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)}},xi.prototype.stepZoom=function(t,n){var i=tb(mf,nb);this._zoom(t,n,i)},xi.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=kl(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(JM(mf,s),t)},xi.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&$e[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},xi.prototype._init=function(e){this.toggle(e)};const ib={__init__:["zoomScroll"],zoomScroll:["type",xi]};function Ia(e){gr.call(this,e)}ye(Ia,gr),Ia.prototype._navigationModules=[Qv,eb,ib],Ia.prototype._modules=[].concat(gr.prototype._modules,Ia.prototype._navigationModules);function gf(e){return e&&e[e.length-1]}function rb(e){return e.y}function ob(e){return e.x}var i2={left:ob,center:ob,right:function(e){return e.x+e.width},top:rb,middle:rb,bottom:function(e){return e.y+e.height}};function Oo(e,t){this._modeling=e,this._rules=t}Oo.$inject=["modeling","rules"],Oo.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}},Oo.prototype._isType=function(e,t){return t.indexOf(e)!==-1},Oo.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),i=n.axis,r=n.dimension,o={},a={},s=!1,c,u,l;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"]))l=gf(t),o[e]=l[i]+l[r];else if(this._isType(e,["center","middle"])){if(I(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=ci(a,function(p){return p.elements.length>1&&(s=!0),p.elements.length}),s)return o[e]=gf(c).center,o;u=t[0],t=ci(t,function(p){return p[i]+p[r]}),l=gf(t),o[e]=f(u,l)}return o},Oo.prototype.trigger=function(e,t){var n=this._modeling,i,r=Ue(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),ke(i)&&(r=i),!(r.length<2||!i)){var o=i2[t],a=ci(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const r2={__init__:["alignElements"],alignElements:["type",Oo]},o2=new Po;function Do(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Do.$inject=["eventBus"],Do.prototype.schedule=function(e,t=o2.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},Do.prototype._schedule=function(e,t){const n=a2();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}},Do.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Do.prototype._cancel=function(e){clearTimeout(e.executionId)};function a2(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const s2={scheduler:["type",Do]};var c2="djs-element-hidden",zc=".entry",u2=1e3,ab=8,l2=300;function Dt(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}Dt.$inject=["canvas","elementRegistry","eventBus","scheduler"],Dt.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=ke(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=ke(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},Dt.prototype._createContainer=function(){var e=ht('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},Dt.prototype.registerProvider=function(e,t){t||(t=e,e=u2),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},Dt.prototype.getEntries=function(e){var t=this._getProviders(),n=ke(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return I(t,function(r){if(Yt(r[n])){var o=r[n](e);Yt(o)?i=o(i):I(o,function(a,s){i[s]=a})}}),i},Dt.prototype.trigger=function(e,t,n){var i=this,r,o,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(r=un(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},l2);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,o,n)},Dt.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(Yt(s)){if(t==="click")return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},Dt.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))}},Dt.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Dt.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;I(t,function(r,o){var a=r.group||"default",s=ht(r.html||'<div class="entry" draggable="true"></div>'),c;un(s,"data-action",o),c=ot("[data-group="+La(a)+"]",n),c||(c=ht('<div class="group"></div>'),un(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&p2(s,r.className),r.title&&un(s,"title",r.title),r.imageUrl&&(i=ht("<img>"),un(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),_t(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},Dt.prototype._createHtml=function(e){var t=this,n=ht('<div class="djs-context-pad"></div>');return Pn.bind(n,zc,"click",function(i){t.trigger("click",i)}),Pn.bind(n,zc,"dragstart",function(i){t.trigger("dragstart",i)}),Pn.bind(n,zc,"mouseover",function(i){t.trigger("mouseover",i)}),Pn.bind(n,zc,"mouseout",function(i){t.trigger("mouseout",i)}),$e.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},Dt.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()&&d2(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},Dt.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},Dt.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return ke(e)!==ke(n)?!1:ke(e)?e.length===n.length&&Rr(e,function(i){return n.includes(i)}):n===e},Dt.prototype.isShown=function(){return this.isOpen()&&_t(this._current.html).has("open")},Dt.prototype.show=function(){this.isOpen()&&(_t(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},Dt.prototype.hide=function(){this.isOpen()&&(_t(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},Dt.prototype._getPosition=function(e){if(!ke(e)&&at(e)){var t=this._canvas.viewbox(),n=f2(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+ab*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+ab*this._canvas.zoom(),top:s.top-a.top}},Dt.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")},Dt.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=ke(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,c2)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},Dt.prototype._getTargetBounds=function(e){var t=this,n=ke(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 p2(e,t){var n=_t(e);t=ke(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function f2(e){return e.waypoints[e.waypoints.length-1]}function d2(e,t){return e=ke(e)?e:[e],t=ke(t)?t:[t],e.length===t.length&&Rr(e,function(n){return t.includes(n)})}const sb={__depends__:[dc,s2,Fc],contextPad:["type",Dt]};var Gc,Et,cb,yr,ub,lb,pb,yf,Vc,Ba,fb,vf,bf,_f,Wc={},Uc=[],h2=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,qc=Array.isArray;function ji(e,t){for(var n in t)e[n]=t[n];return e}function xf(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function db(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?Gc.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 Yc(e,a,i,r,null)}function Yc(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??++cb,__i:-1,__u:0};return r==null&&Et.vnode!=null&&Et.vnode(o),o}function Kc(e){return e.children}function Xc(e,t){this.props=e,this.context=t}function zr(e,t){if(t==null)return e.__?zr(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"?zr(e):null}function m2(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=ji({},t);o.__v=t.__v+1,Et.vnode&&Et.vnode(o),wf(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??zr(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,xb(i,o,r),t.__e=t.__=null,o.__e!=n&&hb(o)}}function hb(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}),hb(e)}function mb(e){(!e.__d&&(e.__d=!0)&&yr.push(e)&&!Zc.__r++||ub!=Et.debounceRendering)&&((ub=Et.debounceRendering)||lb)(Zc)}function Zc(){try{for(var e,t=1;yr.length;)yr.length>t&&yr.sort(pb),e=yr.shift(),t=yr.length,m2(e)}finally{yr.length=Zc.__r=0}}function gb(e,t,n,i,r,o,a,s,c,u,l){var f,p,d,g,h,m,_=i&&i.__k||Uc,y=t.length;for(c=g2(n,t,_,c,y),f=0;f<y;f++)(d=n.__k[f])!=null&&(p=d.__i!=-1&&_[d.__i]||Wc,d.__i=f,m=wf(e,d,p,r,o,a,s,c,u,l),g=d.__e,d.ref&&p.ref!=d.ref&&(p.ref&&Ef(p.ref,null,d),l.push(d.ref,d.__c||g,d)),h==null&&g!=null&&(h=g),4&d.__u?(c=yb(d,c,e),p.__e&&(p.__e=null)):typeof d.type=="function"&&m!==void 0?c=m:g&&(c=g.nextSibling),d.__u&=-7);return n.__e=h,c}function g2(e,t,n,i,r){var o,a,s,c,u,l=n.length,f=l,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]=Yc(null,a,null,null,null):qc(a)?a=e.__k[o]=Yc(Kc,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=Yc(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,(u=a.__i=y2(a,n,c,f))!=-1&&(f--,(s=n[u])&&(s.__u|=2)),s==null||s.__v==null?(u==-1&&(r>l?p--:r<l&&p++),typeof a.type!="function"&&(a.__u|=4)):u!=c&&(u==c-1?p--:u==c+1?p++:(u>c?p--:p++,a.__u|=4))):e.__k[o]=null;if(f)for(o=0;o<l;o++)(s=n[o])!=null&&(2&s.__u)==0&&(s.__e==i&&(i=zr(s)),Eb(s,s));return i}function yb(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=yb(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=zr(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function y2(e,t,n,i){var r,o,a,s=e.key,c=e.type,u=t[n],l=u!=null&&(2&u.__u)==0;if(u===null&&s==null||l&&s==u.key&&c==u.type)return n;if(i>(l?1:0)){for(r=n-1,o=n+1;r>=0||o<t.length;)if((u=t[a=r>=0?r--:o++])!=null&&(2&u.__u)==0&&s==u.key&&c==u.type)return a}return-1}function vb(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||h2.test(t)?n:n+"px"}function Qc(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||vb(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||vb(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(fb,"$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[Ba]=i[Ba]:(n[Ba]=vf,e.addEventListener(t,o?_f:bf,o)):e.removeEventListener(t,o?_f:bf,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 bb(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Vc]==null)t[Vc]=vf++;else if(t[Vc]<n[Ba])return;return n(Et.event?Et.event(t):t)}}}function wf(e,t,n,i,r,o,a,s,c,u){var l,f,p,d,g,h,m,_,y,x,S,P,C,L,T,j,k=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(l=Et.__b)&&l(t);e:if(typeof k=="function"){f=a.length;try{if(y=t.props,x=k.prototype&&k.prototype.render,S=(l=k.contextType)&&i[l.__c],P=l?S?S.props.value:l.__:i,n.__c?_=(p=t.__c=n.__c).__=p.__E:(x?t.__c=p=new k(y,P):(t.__c=p=new Xc(y,P),p.constructor=k,p.render=b2),S&&S.sub(p),p.state||(p.state={}),p.__n=i,d=p.__d=!0,p.__h=[],p._sb=[]),x&&p.__s==null&&(p.__s=p.state),x&&k.getDerivedStateFromProps!=null&&(p.__s==p.state&&(p.__s=ji({},p.__s)),ji(p.__s,k.getDerivedStateFromProps(y,p.__s))),g=p.props,h=p.state,p.__v=t,d)x&&k.getDerivedStateFromProps==null&&p.componentWillMount!=null&&p.componentWillMount(),x&&p.componentDidMount!=null&&p.__h.push(p.componentDidMount);else{if(x&&k.getDerivedStateFromProps==null&&y!==g&&p.componentWillReceiveProps!=null&&p.componentWillReceiveProps(y,P),t.__v==n.__v||!p.__e&&p.shouldComponentUpdate!=null&&p.shouldComponentUpdate(y,p.__s,P)===!1){t.__v!=n.__v&&(p.props=y,p.state=p.__s,p.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(D){D&&(D.__=t)}),Uc.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&a.push(p),s=zr(n);break e}p.componentWillUpdate!=null&&p.componentWillUpdate(y,p.__s,P),x&&p.componentDidUpdate!=null&&p.__h.push(function(){p.componentDidUpdate(g,h,m)})}if(p.context=P,p.props=y,p.__P=e,p.__e=!1,C=Et.__r,L=0,x)p.state=p.__s,p.__d=!1,C&&C(t),l=p.render(p.props,p.state,p.context),Uc.push.apply(p.__h,p._sb),p._sb=[];else do p.__d=!1,C&&C(t),l=p.render(p.props,p.state,p.context),p.state=p.__s;while(p.__d&&++L<25);p.state=p.__s,p.getChildContext!=null&&(i=ji(ji({},i),p.getChildContext())),x&&!d&&p.getSnapshotBeforeUpdate!=null&&(m=p.getSnapshotBeforeUpdate(g,h)),T=l!=null&&l.type===Kc&&l.key==null?wb(l.props.children):l,s=gb(e,qc(T)?T:[T],t,n,i,r,o,a,s,c,u),p.base=t.__e,t.__u&=-161,p.__h.length&&a.push(p),_&&(p.__E=p.__=null)}catch(D){if(a.length=f,t.__v=null,c||o!=null){if(D.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;o!=null&&(o[o.indexOf(s)]=null),t.__e=s}else if(o!=null)for(j=o.length;j--;)xf(o[j])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),D.then||_b(t),Et.__e(D,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=v2(n.__e,t,n,i,r,o,a,c,u);return(l=Et.diffed)&&l(t),128&t.__u?void 0:s}function _b(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(_b))}function xb(e,t,n){for(var i=0;i<n.length;i++)Ef(n[i],n[++i],n[++i]);Et.__c&&Et.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){Et.__e(o,r.__v)}})}function wb(e){return typeof e!="object"||e==null||e.__b>0?e:qc(e)?e.map(wb):e.constructor!==void 0?null:ji({},e)}function v2(e,t,n,i,r,o,a,s,c){var u,l,f,p,d,g,h,m=n.props||Wc,_=t.props,y=t.type;if(y=="svg"?r="http://www.w3.org/2000/svg":y=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),o!=null){for(u=0;u<o.length;u++)if((d=o[u])&&"setAttribute"in d==!!y&&(y?d.localName==y:d.nodeType==3)){e=d,o[u]=null;break}}if(e==null){if(y==null)return document.createTextNode(_);e=document.createElementNS(r,y,_.is&&_),s&&(Et.__m&&Et.__m(t,o),s=!1),o=null}if(y==null)m===_||s&&e.data==_||(e.data=_);else{if(o=y=="textarea"&&_.defaultValue!=null?null:o&&Gc.call(e.childNodes),!s&&o!=null)for(m={},u=0;u<e.attributes.length;u++)m[(d=e.attributes[u]).name]=d.value;for(u in m)d=m[u],u=="dangerouslySetInnerHTML"?f=d:u=="children"||u in _||u=="value"&&"defaultValue"in _||u=="checked"&&"defaultChecked"in _||Qc(e,u,null,d,r);for(u in _)d=_[u],u=="children"?p=d:u=="dangerouslySetInnerHTML"?l=d:u=="value"?g=d:u=="checked"?h=d:s&&typeof d!="function"||m[u]===d||Qc(e,u,d,m[u],r);if(l)s||f&&(l.__html==f.__html||l.__html==e.innerHTML)||(e.innerHTML=l.__html),t.__k=[];else if(f&&(e.innerHTML=""),gb(t.type=="template"?e.content:e,qc(p)?p:[p],t,n,i,y=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&zr(n,0),s,c),o!=null)for(u=o.length;u--;)xf(o[u]);s&&y!="textarea"||(u="value",y=="progress"&&g==null?e.removeAttribute("value"):g!=null&&(g!==e[u]||y=="progress"&&!g||y=="option"&&g!=m[u])&&Qc(e,u,g,m[u],r),u="checked",h!=null&&h!=e[u]&&Qc(e,u,h,m[u],r))}return e}function Ef(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){Et.__e(r,n)}}function Eb(e,t,n){var i,r;if(Et.unmount&&Et.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||Ef(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){Et.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&Eb(i[r],t,n||typeof e.type!="function");n||xf(e.__e),e.__c=e.__=e.__e=void 0}function b2(e,t,n){return this.constructor(e,n)}function Sb(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),Et.__&&Et.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],wf(t,e=t.__k=db(Kc,null,[e]),r||Wc,Wc,t.namespaceURI,r?null:t.firstChild?Gc.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),xb(o,e,a),e.props.children=null}Gc=Uc.slice,Et={__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}},cb=0,Xc.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=ji({},this.state),typeof e=="function"&&(e=e(ji({},n),this.props)),e&&ji(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),mb(this))},Xc.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),mb(this))},Xc.prototype.render=Kc,yr=[],lb=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,pb=function(e,t){return e.__v.__b-t.__v.__b},Zc.__r=0,yf=Math.random().toString(8),Vc="__d"+yf,Ba="__a"+yf,fb=/(PointerCapture)$|Capture$/i,vf=0,bf=bb(!1),_f=bb(!0);var Rb=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,Rb(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},Cb=new Map;function _2(e){var t=Cb.get(this);return t||(t=new Map,Cb.set(this,t)),(t=Rb(this,t.get(e)||(t.set(e,t=(function(n){for(var i,r,o=1,a="",s="",c=[0],u=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=""},l=0;l<n.length;l++){l&&(o===1&&u(),u(l));for(var f=0;f<n[l].length;f++)i=n[l][f],o===1?i==="<"?(u(),c=[c],o=3):a+=i:o===4?a==="--"&&i===">"?(o=1,a=""):a=i+a[0]:s?i===s?s="":a+=i:i==='"'||i==="'"?s=i:i===">"?(u(),o=1):o&&(i==="="?(o=5,r=a,a=""):i==="/"&&(o<5||n[l][f+1]===">")?(u(),o===3&&(c=c[0]),o=c,(c=c[0]).push(2,0,o),o=0):i===" "||i===" "||i===`
11
- `||i==="\r"?(u(),o=2):a+=i),o===3&&a==="!--"&&(o=4,c=c[0])}return u(),c})(e)),t),arguments,[])).length>1?t:t[0]}var ct=_2.bind(db),Lo,Lt,Sf,Pb,Na=0,Ab=[],Gt=Et,Tb=Gt.__b,Mb=Gt.__r,kb=Gt.diffed,Ob=Gt.__c,Db=Gt.unmount,Lb=Gt.__;function Jc(e,t){Gt.__h&&Gt.__h(Lt,e,Na||t),Na=0;var n=Lt.__H||(Lt.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Rf(e){return Na=1,x2(Bb,e)}function x2(e,t,n){var i=Jc(Lo++,2);if(i.t=e,!i.__c&&(i.__=[Bb(void 0,t),function(s){var c=i.__N?i.__N[0]:i.__[0],u=i.t(c,s);c!==u&&(i.__N=[u,i.__[1]],i.__c.setState({}))}],i.__c=Lt,!Lt.__f)){var r=function(s,c,u){if(!i.__c.__H)return!0;var l=!1,f=i.__c.props!==s;if(i.__c.__H.__.some(function(d){if(d.__N){l=!0;var g=d.__[0];d.__=d.__N,d.__N=void 0,g!==d.__[0]&&(f=!0)}}),o){var p=o.call(this,s,c,u);return l?p||f:p}return!l||f};Lt.__f=!0;var o=Lt.shouldComponentUpdate,a=Lt.componentWillUpdate;Lt.componentWillUpdate=function(s,c,u){if(this.__e){var l=o;o=void 0,r(s,c,u),o=l}a&&a.call(this,s,c,u)},Lt.shouldComponentUpdate=r}return i.__N||i.__}function eu(e,t){var n=Jc(Lo++,3);!Gt.__s&&Af(n.__H,t)&&(n.__=e,n.u=t,Lt.__H.__h.push(n))}function Cf(e,t){var n=Jc(Lo++,4);!Gt.__s&&Af(n.__H,t)&&(n.__=e,n.u=t,Lt.__h.push(n))}function tu(e){return Na=5,Hi(function(){return{current:e}},[])}function Hi(e,t){var n=Jc(Lo++,7);return Af(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function $a(e,t){return Na=8,Hi(function(){return e},t)}function w2(){for(var e;e=Ab.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(nu),t.__h.some(Pf),t.__h=[]}catch(n){t.__h=[],Gt.__e(n,e.__v)}}}Gt.__b=function(e){Lt=null,Tb&&Tb(e)},Gt.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Lb&&Lb(e,t)},Gt.__r=function(e){Mb&&Mb(e),Lo=0;var t=(Lt=e.__c).__H;t&&(Sf===Lt?(t.__h=[],Lt.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(nu),t.__h.some(Pf),t.__h=[],Lo=0)),Sf=Lt},Gt.diffed=function(e){kb&&kb(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Ab.push(t)!==1&&Pb===Gt.requestAnimationFrame||((Pb=Gt.requestAnimationFrame)||E2)(w2)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),Sf=Lt=null},Gt.__c=function(e,t){t.some(function(n){try{n.__h.some(nu),n.__h=n.__h.filter(function(i){return!i.__||Pf(i)})}catch(i){t.some(function(r){r.__h&&(r.__h=[])}),t=[],Gt.__e(i,n.__v)}}),Ob&&Ob(e,t)},Gt.unmount=function(e){Db&&Db(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{nu(i)}catch(r){t=r}}),n.__H=void 0,t&&Gt.__e(t,n.__v))};var Ib=typeof requestAnimationFrame=="function";function E2(e){var t,n=function(){clearTimeout(i),Ib&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);Ib&&(t=requestAnimationFrame(n))}function nu(e){var t=Lt,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),Lt=t}function Pf(e){var t=Lt;e.__c=e.__(),Lt=t}function Af(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function Bb(e,t){return typeof t=="function"?t(e):t}function S2(e){const{navigationStack:t,setNavigationStack:n}=e,i=Hi(()=>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 ct`
10
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="`+p+'" height="'+d+'" viewBox="'+l+" "+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}},_t.prototype._setDefinitions=function(e){this._definitions=e},_t.prototype.getModules=function(){return this._modules},_t.prototype.clear=function(){this.getDefinitions()&&ir.prototype.clear.call(this)},_t.prototype.destroy=function(){ir.prototype.destroy.call(this),mi(this._container)},_t.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},_t.prototype.off=function(e,t){this.get("eventBus").off(e,t)},_t.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),typeof e=="string"&&(e=rt(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},_t.prototype.getDefinitions=function(){return this._definitions},_t.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},_t.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=V(li(n,["additionalModules"]),{canvas:V({},n.canvas,{container:e}),modules:a});ir.call(this,s),n&&n.container&&this.attachTo(n.container)},_t.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},_t.prototype._createContainer=function(e){const t=ht('<div class="bjs-container"></div>');return hn(t,{width:Om(e.width),height:Om(e.height),position:e.position}),t},_t.prototype._createModdle=function(e){const t=V({},this._moddleExtensions,e.moddleExtensions);return new kd(t)},_t.prototype._modules=[];function Is(e,t){return e.warnings=t,e}function rR(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 oR={width:"100%",height:"100%",position:"relative"};function Om(e){return e+(Ie(e)?"px":"")}function aR(e,t){return t&&lt(e.diagrams,function(n){return n.id===t})||null}function sR(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Am+"</a>",i=ht(n);hn(rt("svg",i),Tm),hn(i,Mm,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),Be.bind(i,"click",function(r){iR(),r.preventDefault()})}function go(e){_t.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)}ye(go,_t),go.prototype._createModdle=function(e){var t=_t.prototype._createModdle.call(this,e);return t.ids=new hi([32,36,1]),t},go.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 Ue(e,t){return w(e,"bpmn:CallActivity")?!1:w(e,"bpmn:SubProcess")?(t=t||Ke(e),t&&w(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):w(e,"bpmn:Participant")?!!ie(e).processRef:!0}function Yt(e){if(!(!w(e,"bpmn:Participant")&&!w(e,"bpmn:Lane"))){var t=Ke(e).isHorizontal;return t===void 0?!0:t}}function cR(e){return e&&ie(e).isInterrupting!==!1}function un(e){return e&&!!ie(e).triggeredByEvent}function yo(e,t){var n=ie(e).eventDefinitions;return qi(n,function(i){return w(i,t)})}function uR(e){return yo(e,"bpmn:ErrorEventDefinition")}function lR(e){return yo(e,"bpmn:EscalationEventDefinition")}function pR(e){return yo(e,"bpmn:CompensateEventDefinition")}var Ir={width:90,height:20},Dm=15;function rr(e){return w(e,"bpmn:Event")||w(e,"bpmn:Gateway")||w(e,"bpmn:DataStoreReference")||w(e,"bpmn:DataObjectReference")||w(e,"bpmn:DataInput")||w(e,"bpmn:DataOutput")||w(e,"bpmn:SequenceFlow")||w(e,"bpmn:MessageFlow")||w(e,"bpmn:Group")}function Bs(e){return je(e.label)}function fR(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=dR(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-=Dm:a+=Dm,{x:a,y:s}}function dR(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 Al(e){return e.waypoints?fR(e.waypoints):w(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Ir.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Ir.height/2}}function hR(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(Ir.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=Al(t),i=Ir),V({x:n.x-i.width/2,y:n.y-i.height/2},i)}function Lm(e){if(w(e,"bpmn:FlowElement")||w(e,"bpmn:Participant")||w(e,"bpmn:Lane")||w(e,"bpmn:SequenceFlow")||w(e,"bpmn:MessageFlow")||w(e,"bpmn:DataInput")||w(e,"bpmn:DataOutput"))return"name";if(w(e,"bpmn:TextAnnotation"))return"text";if(w(e,"bpmn:Group"))return"categoryValueRef"}function mR(e){var t=e.categoryValueRef;return t&&t.value||""}function $n(e){var t=e.businessObject,n=Lm(t);if(n)return n==="categoryValueRef"?mR(t):t[n]||""}function gR(e,t){var n=e.businessObject,i=Lm(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function yR(e){return je(e)&&rr(e.labelTarget)}var vo=7;function Im(e){let t=[];return I(e.incoming,n=>{w(n,"bpmn:Association")&&w(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),I(e.outgoing,n=>{w(n,"bpmn:Association")&&w(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function sa(e){const t=new Map;return I(xl(e),n=>{I(Im(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 Tl="hsl(225, 10%, 15%)",vR="white";function bi(e,t){return qi(e.eventDefinitions,function(n){return n.$type===t})}function bR(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function _R(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function We(e,t,n){var i=Ke(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||vR}function ge(e,t,n){var i=Ke(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||Tl}function ca(e,t,n,i){var r=Ke(e),o=r.get("label");return i||o&&o.get("color:color")||t||ge(e,n)}function Bm(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 Or(r)}function Ml(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 Or(a)}function xR(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 Or(s)}function wR(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 Or(o)}function ua(e,t={}){return{width:Un(e,t),height:Pn(e,t)}}function Un(e,t={}){return wn(t,"width")?t.width:e.width}function Pn(e,t={}){return wn(t,"height")?t.height:e.height}var ER=new hi,SR=10,Ns=3,RR=1.5,$s=10,CR=4,bo=.95,PR=1,AR=.25;function Br(e,t,n,i,r,o,a){ki.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,u=e&&e.defaultLabelColor;function l(M){return n.computeStyle(M,{strokeLinecap:"round",strokeLinejoin:"round",stroke:Tl,strokeWidth:2,fill:"white"})}function f(M){return n.computeStyle(M,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:Tl,strokeWidth:2})}function p(M,E){var{ref:b={x:0,y:0},scale:H=1,element:W,parentGfx:Q=r._svg}=E,_e=Ae("marker",{id:M,viewBox:"0 0 20 20",refX:b.x,refY:b.y,markerWidth:20*H,markerHeight:20*H,orient:"auto"});Ne(_e,W);var Fe=rt(":scope > defs",Q);Fe||(Fe=Ae("defs"),Ne(Q,Fe)),Ne(Fe,_e)}function d(M,E,b,H){var W=ER.nextPrefixed("marker-");return g(M,W,E,b,H),"url(#"+W+")"}function g(M,E,b,H,W){if(b==="sequenceflow-end"){var Q=Ae("path",{d:"M 1 5 L 11 10 L 1 15 Z",...l({fill:W,stroke:W,strokeWidth:1})});p(E,{element:Q,ref:{x:11,y:10},scale:.5,parentGfx:M})}if(b==="messageflow-start"){var _e=Ae("circle",{cx:6,cy:6,r:3.5,...l({fill:H,stroke:W,strokeWidth:1,strokeDasharray:[1e4,1]})});p(E,{element:_e,ref:{x:6,y:6},parentGfx:M})}if(b==="messageflow-end"){var Fe=Ae("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...l({fill:H,stroke:W,strokeWidth:1,strokeDasharray:[1e4,1]})});p(E,{element:Fe,ref:{x:8.5,y:5},parentGfx:M})}if(b==="association-start"){var Ze=Ae("path",{d:"M 11 5 L 1 10 L 11 15",...f({fill:"none",stroke:W,strokeWidth:1.5,strokeDasharray:[1e4,1]})});p(E,{element:Ze,ref:{x:1,y:10},scale:.5,parentGfx:M})}if(b==="association-end"){var bt=Ae("path",{d:"M 1 5 L 11 10 L 1 15",...f({fill:"none",stroke:W,strokeWidth:1.5,strokeDasharray:[1e4,1]})});p(E,{element:bt,ref:{x:11,y:10},scale:.5,parentGfx:M})}if(b==="conditional-flow-marker"){var tt=Ae("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...l({fill:H,stroke:W})});p(E,{element:tt,ref:{x:-1,y:10},scale:.5,parentGfx:M})}if(b==="conditional-default-flow-marker"){var zt=Ae("path",{d:"M 6 4 L 10 16",...l({stroke:W,fill:"none"})});p(E,{element:zt,ref:{x:0,y:10},scale:.5,parentGfx:M})}}function h(M,E,b,H,W={}){Wt(H)&&(W=H,H=0),H=H||0,W=l(W);var Q=E/2,_e=b/2,Fe=Ae("circle",{cx:Q,cy:_e,r:Math.round((E+b)/4-H),...W});return Ne(M,Fe),Fe}function m(M,E,b,H,W,Q){Wt(W)&&(Q=W,W=0),W=W||0,Q=l(Q);var _e=Ae("rect",{x:W,y:W,width:E-W*2,height:b-W*2,rx:H,ry:H,...Q});return Ne(M,_e),_e}function _(M,E,b,H){var W=E/2,Q=b/2,_e=[{x:W,y:0},{x:E,y:Q},{x:W,y:b},{x:0,y:Q}],Fe=_e.map(function(bt){return bt.x+","+bt.y}).join(" ");H=l(H);var Ze=Ae("polygon",{...H,points:Fe});return Ne(M,Ze),Ze}function y(M,E,b,H){b=f(b);var W=ea(E,b,H);return Ne(M,W),W}function x(M,E,b){return y(M,E,b,5)}function S(M,E,b){b=f(b);var H=Ae("path",{...b,d:E});return Ne(M,H),H}function P(M,E,b,H){return S(E,b,V({"data-marker":M},H))}function C(M){return Kt[M]}function L(M){return function(E,b,H){return C(M)(E,b,H)}}var T={"bpmn:MessageEventDefinition":function(M,E,b={},H){var W=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:b.width||E.width,containerHeight:b.height||E.height,position:{mx:.235,my:.315}}),Q=H?ge(E,c,b.stroke):We(E,s,b.fill),_e=H?We(E,s,b.fill):ge(E,c,b.stroke),Fe=S(M,W,{fill:Q,stroke:_e,strokeWidth:1});return Fe},"bpmn:TimerEventDefinition":function(M,E,b={}){var H=b.width||E.width,W=b.height||E.height,Q=b.width?1:2,_e=h(M,H,W,.2*W,{fill:We(E,s,b.fill),stroke:ge(E,c,b.stroke),strokeWidth:Q}),Fe=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:H,containerHeight:W,position:{mx:.5,my:.5}});S(M,Fe,{stroke:ge(E,c,b.stroke),strokeWidth:Q});for(var Ze=0;Ze<12;Ze++){var bt=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:H,containerHeight:W,position:{mx:.5,my:.5}}),tt=H/2,zt=W/2;S(M,bt,{strokeWidth:1,stroke:ge(E,c,b.stroke),transform:"rotate("+Ze*30+","+zt+","+tt+")"})}return _e},"bpmn:EscalationEventDefinition":function(M,E,b={},H){var W=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:b.width||E.width,containerHeight:b.height||E.height,position:{mx:.5,my:.2}}),Q=H?ge(E,c,b.stroke):We(E,s,b.fill);return S(M,W,{fill:Q,stroke:ge(E,c,b.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(M,E,b={}){var H=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:b.width||E.width,containerHeight:b.height||E.height,position:{mx:.5,my:.222}});return S(M,H,{fill:We(E,s,b.fill),stroke:ge(E,c,b.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(M,E,b={},H){var W=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:.57,my:.263}}),Q=H?ge(E,c,b.stroke):We(E,s,b.fill);return S(M,W,{fill:Q,stroke:ge(E,c,b.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(M,E,b={},H){var W=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:b.width||E.width,containerHeight:b.height||E.height,position:{mx:.2,my:.722}}),Q=H?ge(E,c,b.stroke):We(E,s,b.fill);return S(M,W,{fill:Q,stroke:ge(E,c,b.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(M,E,b={},H){var W=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:.638,my:-.055}}),Q=H?ge(E,c,b.stroke):"none",_e=S(M,W,{fill:Q,stroke:ge(E,c,b.stroke),strokeWidth:1});return Cm(_e,45),_e},"bpmn:CompensateEventDefinition":function(M,E,b={},H){var W=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:b.width||E.width,containerHeight:b.height||E.height,position:{mx:.22,my:.5}}),Q=H?ge(E,c,b.stroke):We(E,s,b.fill);return S(M,W,{fill:Q,stroke:ge(E,c,b.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(M,E,b={},H){var W=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:b.width||E.width,containerHeight:b.height||E.height,position:{mx:.5,my:.2}}),Q=H?ge(E,c,b.stroke):We(E,s,b.fill);return S(M,W,{strokeWidth:1,fill:Q,stroke:ge(E,c,b.stroke)})},"bpmn:MultipleEventDefinition":function(M,E,b={},H){var W=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:b.width||E.width,containerHeight:b.height||E.height,position:{mx:.211,my:.36}}),Q=H?ge(E,c,b.stroke):We(E,s,b.fill);return S(M,W,{fill:Q,stroke:ge(E,c,b.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(M,E,b={}){var H=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:b.width||E.width,containerHeight:b.height||E.height,position:{mx:.458,my:.194}});return S(M,H,{fill:We(E,s,b.fill),stroke:ge(E,c,b.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(M,E,b={}){var H=h(M,E.width,E.height,8,{fill:ge(E,c,b.stroke),stroke:ge(E,c,b.stroke),strokeWidth:4});return H}};function j(M,E,b={},H){var W=ie(M),Q=bR(W),_e=H||M;return W.get("eventDefinitions")&&W.get("eventDefinitions").length>1?W.get("parallelMultiple")?T["bpmn:ParallelMultipleEventDefinition"](E,_e,b,Q):T["bpmn:MultipleEventDefinition"](E,_e,b,Q):bi(W,"bpmn:MessageEventDefinition")?T["bpmn:MessageEventDefinition"](E,_e,b,Q):bi(W,"bpmn:TimerEventDefinition")?T["bpmn:TimerEventDefinition"](E,_e,b,Q):bi(W,"bpmn:ConditionalEventDefinition")?T["bpmn:ConditionalEventDefinition"](E,_e,b,Q):bi(W,"bpmn:SignalEventDefinition")?T["bpmn:SignalEventDefinition"](E,_e,b,Q):bi(W,"bpmn:EscalationEventDefinition")?T["bpmn:EscalationEventDefinition"](E,_e,b,Q):bi(W,"bpmn:LinkEventDefinition")?T["bpmn:LinkEventDefinition"](E,_e,b,Q):bi(W,"bpmn:ErrorEventDefinition")?T["bpmn:ErrorEventDefinition"](E,_e,b,Q):bi(W,"bpmn:CancelEventDefinition")?T["bpmn:CancelEventDefinition"](E,_e,b,Q):bi(W,"bpmn:CompensateEventDefinition")?T["bpmn:CompensateEventDefinition"](E,_e,b,Q):bi(W,"bpmn:TerminateEventDefinition")?T["bpmn:TerminateEventDefinition"](E,_e,b,Q):null}var k={ParticipantMultiplicityMarker:function(M,E,b={}){var H=Un(E,b),W=Pn(E,b),Q=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:H,containerHeight:W,position:{mx:(H/2-6)/H,my:(W-15)/W}});P("participant-multiplicity",M,Q,{strokeWidth:2,fill:We(E,s,b.fill),stroke:ge(E,c,b.stroke)})},SubProcessMarker:function(M,E,b={}){var H=m(M,14,14,0,{strokeWidth:1,fill:We(E,s,b.fill),stroke:ge(E,c,b.stroke)});Jt(H,E.width/2-7.5,E.height-20);var W=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:E.width,containerHeight:E.height,position:{mx:(E.width/2-7.5)/E.width,my:(E.height-20)/E.height}});P("sub-process",M,W,{fill:We(E,s,b.fill),stroke:ge(E,c,b.stroke)})},ParallelMarker:function(M,E,b){var H=Un(E,b),W=Pn(E,b),Q=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:H,containerHeight:W,position:{mx:(H/2+b.parallel)/H,my:(W-20)/W}});P("parallel",M,Q,{fill:We(E,s,b.fill),stroke:ge(E,c,b.stroke)})},SequentialMarker:function(M,E,b){var H=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:(E.width/2+b.seq)/E.width,my:(E.height-19)/E.height}});P("sequential",M,H,{fill:We(E,s,b.fill),stroke:ge(E,c,b.stroke)})},CompensationMarker:function(M,E,b){var H=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:(E.width/2+b.compensation)/E.width,my:(E.height-13)/E.height}});P("compensation",M,H,{strokeWidth:1,fill:We(E,s,b.fill),stroke:ge(E,c,b.stroke)})},LoopMarker:function(M,E,b){var H=Un(E,b),W=Pn(E,b),Q=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:H,containerHeight:W,position:{mx:(H/2+b.loop)/H,my:(W-7)/W}});P("loop",M,Q,{strokeWidth:1.5,fill:"none",stroke:ge(E,c,b.stroke),strokeMiterlimit:.5})},AdhocMarker:function(M,E,b){var H=Un(E,b),W=Pn(E,b),Q=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:H,containerHeight:W,position:{mx:(H/2+b.adhoc)/H,my:(W-15)/W}});P("adhoc",M,Q,{strokeWidth:1,fill:ge(E,c,b.stroke),stroke:ge(E,c,b.stroke)})}};function D(M,E,b,H){k[M](E,b,H)}function z(M,E,b=[],H={}){H={fill:H.fill,stroke:H.stroke,width:Un(E,H),height:Pn(E,H)};var W=ie(E),Q=b.includes("SubProcessMarker");Q?H={...H,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:H={...H,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},W.get("isForCompensation")&&b.push("CompensationMarker"),w(W,"bpmn:AdHocSubProcess")&&(b.push("AdhocMarker"),Q||V(H,{compensation:H.compensation-18}));var _e=W.get("loopCharacteristics"),Fe=_e&&_e.get("isSequential");_e&&(V(H,{compensation:H.compensation-18}),b.includes("AdhocMarker")&&V(H,{seq:-23,loop:-18,parallel:-24}),Fe===void 0&&b.push("LoopMarker"),Fe===!1&&b.push("ParallelMarker"),Fe===!0&&b.push("SequentialMarker")),b.includes("CompensationMarker")&&b.length===1&&V(H,{compensation:-8}),I(b,function(Ze){D(Ze,M,E,H)})}function se(M,E,b={}){b=V({size:{width:100}},b);var H=o.createText(E||"",b);return Ye(H).add("djs-label"),Ne(M,H),H}function Se(M,E,b,H={}){var W=ie(E),Q=ua({x:E.x,y:E.y,width:E.width,height:E.height},H);return se(M,W.name,{align:b,box:Q,padding:7,style:{fill:ca(E,u,c,H.stroke)}})}function qe(M,E,b={}){var H={width:E.width,height:E.height,x:E.width/2+E.x,y:E.height/2+E.y};return se(M,$n(E),{box:H,style:V({},o.getExternalStyle(),{fill:ca(E,u,c,b.stroke)})})}function K(M,E,b,H={}){var W=Yt(b),Q=se(M,E,{box:{height:30,width:W?Pn(b,H):Un(b,H)},align:"center-middle",style:{fill:ca(b,u,c,H.stroke)}});if(W){var _e=-1*Pn(b,H);Ds(Q,0,-_e,270)}}function fe(M,E,b={}){var{width:H,height:W}=ua(E,b);return m(M,H,W,$s,{...b,fill:We(E,s,b.fill),fillOpacity:bo,stroke:ge(E,c,b.stroke)})}function we(M,E,b={}){var H=ie(E),W=We(E,s,b.fill),Q=ge(E,c,b.stroke);return(H.get("associationDirection")==="One"||H.get("associationDirection")==="Both")&&(b.markerEnd=d(M,"association-end",W,Q)),H.get("associationDirection")==="Both"&&(b.markerStart=d(M,"association-start",W,Q)),b=Xe(b,["markerStart","markerEnd"]),x(M,E.waypoints,{...b,stroke:Q,strokeDasharray:"0, 5"})}function me(M,E,b={}){var H=We(E,s,b.fill),W=ge(E,c,b.stroke),Q=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:.474,my:.296}}),_e=S(M,Q,{fill:H,fillOpacity:bo,stroke:W}),Fe=ie(E);if(_R(Fe)){var Ze=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:.33,my:(E.height-18)/E.height}});S(M,Ze,{strokeWidth:2,fill:H,stroke:W})}return _e}function Ee(M,E,b={}){return h(M,E.width,E.height,{fillOpacity:bo,...b,fill:We(E,s,b.fill),stroke:ge(E,c,b.stroke)})}function pe(M,E,b={}){return _(M,E.width,E.height,{fill:We(E,s,b.fill),fillOpacity:bo,stroke:ge(E,c,b.stroke)})}function q(M,E,b={}){var H=m(M,Un(E,b),Pn(E,b),0,{fill:We(E,s,b.fill),fillOpacity:b.fillOpacity||bo,stroke:ge(E,c,b.stroke),strokeWidth:1.5}),W=ie(E);if(w(W,"bpmn:Lane")){var Q=W.get("name");K(M,Q,E,b)}return H}function Y(M,E,b={}){var H=fe(M,E,b),W=Ue(E);if(un(E)&&(ve(H,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!W)){var Q=ie(E).flowElements||[],_e=Q.filter(Fe=>w(Fe,"bpmn:StartEvent"));_e.length===1&&Z(_e[0],M,b,E)}return Se(M,E,W?"center-top":"center-middle",b),W?z(M,E,void 0,b):z(M,E,["SubProcessMarker"],b),H}function Z(M,E,b,H){var W=22,Q={fill:We(H,s,b.fill),stroke:ge(H,c,b.stroke),width:W,height:W},_e=ie(M).isInterrupting,Fe=_e?0:3,Ze=_e?1:1.2,bt=20,tt=(W-bt)/2,zt="translate("+tt+","+tt+")";h(E,bt,bt,{fill:Q.fill,stroke:Q.stroke,strokeWidth:Ze,strokeDasharray:Fe,transform:zt}),j(M,E,Q,H)}function He(M,E,b={}){var H=fe(M,E,b);return Se(M,E,"center-middle",b),z(M,E,void 0,b),H}var Kt=this.handlers={"bpmn:AdHocSubProcess":function(M,E,b={}){return Ue(E)?b=Xe(b,["fill","stroke","width","height"]):b=Xe(b,["fill","stroke"]),Y(M,E,b)},"bpmn:Association":function(M,E,b={}){return b=Xe(b,["fill","stroke"]),we(M,E,b)},"bpmn:BoundaryEvent":function(M,E,b={}){var{renderIcon:H=!0}=b;b=Xe(b,["fill","stroke"]);var W=ie(E),Q=W.get("cancelActivity");b={strokeWidth:1.5,fill:We(E,s,b.fill),fillOpacity:PR,stroke:ge(E,c,b.stroke)},Q||(b.strokeDasharray="6");var _e=Ee(M,E,b);return h(M,E.width,E.height,Ns,{...b,fill:"none"}),H&&j(E,M,b),_e},"bpmn:BusinessRuleTask":function(M,E,b={}){b=Xe(b,["fill","stroke"]);var H=He(M,E,b),W=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),Q=S(M,W);ve(Q,{fill:We(E,s,b.fill),stroke:ge(E,c,b.stroke),strokeWidth:1});var _e=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),Fe=S(M,_e);return ve(Fe,{fill:ge(E,c,b.stroke),stroke:ge(E,c,b.stroke),strokeWidth:1}),H},"bpmn:CallActivity":function(M,E,b={}){return b=Xe(b,["fill","stroke"]),Y(M,E,{strokeWidth:5,...b})},"bpmn:ComplexGateway":function(M,E,b={}){b=Xe(b,["fill","stroke"]);var H=pe(M,E,b),W=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:E.width,containerHeight:E.height,position:{mx:.46,my:.26}});return S(M,W,{fill:ge(E,c,b.stroke),stroke:ge(E,c,b.stroke),strokeWidth:1}),H},"bpmn:DataInput":function(M,E,b={}){b=Xe(b,["fill","stroke"]);var H=i.getRawPath("DATA_ARROW"),W=me(M,E,b);return S(M,H,{fill:"none",stroke:ge(E,c,b.stroke),strokeWidth:1}),W},"bpmn:DataInputAssociation":function(M,E,b={}){return b=Xe(b,["fill","stroke"]),we(M,E,{...b,markerEnd:d(M,"association-end",We(E,s,b.fill),ge(E,c,b.stroke))})},"bpmn:DataObject":function(M,E,b={}){return b=Xe(b,["fill","stroke"]),me(M,E,b)},"bpmn:DataObjectReference":L("bpmn:DataObject"),"bpmn:DataOutput":function(M,E,b={}){b=Xe(b,["fill","stroke"]);var H=i.getRawPath("DATA_ARROW"),W=me(M,E,b);return S(M,H,{strokeWidth:1,fill:ge(E,c,b.stroke),stroke:ge(E,c,b.stroke)}),W},"bpmn:DataOutputAssociation":function(M,E,b={}){return b=Xe(b,["fill","stroke"]),we(M,E,{...b,markerEnd:d(M,"association-end",We(E,s,b.fill),ge(E,c,b.stroke))})},"bpmn:DataStoreReference":function(M,E,b={}){b=Xe(b,["fill","stroke"]);var H=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:0,my:.133}});return S(M,H,{fill:We(E,s,b.fill),fillOpacity:bo,stroke:ge(E,c,b.stroke),strokeWidth:2})},"bpmn:EndEvent":function(M,E,b={}){var{renderIcon:H=!0}=b;b=Xe(b,["fill","stroke"]);var W=Ee(M,E,{...b,strokeWidth:4});return H&&j(E,M,b),W},"bpmn:EventBasedGateway":function(M,E,b={}){b=Xe(b,["fill","stroke"]);var H=ie(E),W=pe(M,E,b);h(M,E.width,E.height,E.height*.2,{fill:We(E,"none",b.fill),stroke:ge(E,c,b.stroke),strokeWidth:1});var Q=H.get("eventGatewayType"),_e=!!H.get("instantiate");function Fe(){var bt=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:E.width,containerHeight:E.height,position:{mx:.36,my:.44}});S(M,bt,{fill:"none",stroke:ge(E,c,b.stroke),strokeWidth:2})}if(Q==="Parallel"){var Ze=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:E.width,containerHeight:E.height,position:{mx:.474,my:.296}});S(M,Ze,{fill:"none",stroke:ge(E,c,b.stroke),strokeWidth:1})}else Q==="Exclusive"&&(_e||h(M,E.width,E.height,E.height*.26,{fill:"none",stroke:ge(E,c,b.stroke),strokeWidth:1}),Fe());return W},"bpmn:ExclusiveGateway":function(M,E,b={}){b=Xe(b,["fill","stroke"]);var H=pe(M,E,b),W=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:E.width,containerHeight:E.height,position:{mx:.32,my:.3}}),Q=Ke(E);return Q.get("isMarkerVisible")&&S(M,W,{fill:ge(E,c,b.stroke),stroke:ge(E,c,b.stroke),strokeWidth:1}),H},"bpmn:Gateway":function(M,E,b={}){return b=Xe(b,["fill","stroke"]),pe(M,E,b)},"bpmn:Group":function(M,E,b={}){return b=Xe(b,["fill","stroke","width","height"]),m(M,E.width,E.height,$s,{stroke:ge(E,c,b.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:Un(E,b),height:Pn(E,b)})},"bpmn:InclusiveGateway":function(M,E,b={}){b=Xe(b,["fill","stroke"]);var H=pe(M,E,b);return h(M,E.width,E.height,E.height*.24,{fill:We(E,s,b.fill),stroke:ge(E,c,b.stroke),strokeWidth:2.5}),H},"bpmn:IntermediateEvent":function(M,E,b={}){var{renderIcon:H=!0}=b;b=Xe(b,["fill","stroke"]);var W=Ee(M,E,{...b,strokeWidth:1.5});return h(M,E.width,E.height,Ns,{fill:"none",stroke:ge(E,c,b.stroke),strokeWidth:1.5}),H&&j(E,M,b),W},"bpmn:IntermediateCatchEvent":L("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":L("bpmn:IntermediateEvent"),"bpmn:Lane":function(M,E,b={}){return b=Xe(b,["fill","stroke","width","height"]),q(M,E,{...b,fillOpacity:AR})},"bpmn:ManualTask":function(M,E,b={}){b=Xe(b,["fill","stroke"]);var H=He(M,E,b),W=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return S(M,W,{fill:We(E,s,b.fill),stroke:ge(E,c,b.stroke),strokeWidth:.5}),H},"bpmn:MessageFlow":function(M,E,b={}){b=Xe(b,["fill","stroke"]);var H=ie(E),W=Ke(E),Q=We(E,s,b.fill),_e=ge(E,c,b.stroke),Fe=x(M,E.waypoints,{markerEnd:d(M,"messageflow-end",Q,_e),markerStart:d(M,"messageflow-start",Q,_e),stroke:_e,strokeDasharray:"10, 11",strokeWidth:1.5});if(H.get("messageRef")){var Ze=Fe.getPointAtLength(Fe.getTotalLength()/2),bt=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:Ze.x,y:Ze.y}}),tt={strokeWidth:1};W.get("messageVisibleKind")==="initiating"?(tt.fill=Q,tt.stroke=_e):(tt.fill=_e,tt.stroke=Q);var zt=S(M,bt,tt),Gt=H.get("messageRef"),ln=Gt.get("name"),ct=se(M,ln,{align:"center-top",fitBox:!0,style:{fill:_e}}),Tt=zt.getBBox(),gn=ct.getBBox(),Rr=Ze.x-gn.width/2,Fn=Ze.y+Tt.height/2+SR;Ds(ct,Rr,Fn,0)}return Fe},"bpmn:ParallelGateway":function(M,E,b={}){b=Xe(b,["fill","stroke"]);var H=pe(M,E,b),W=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:E.width,containerHeight:E.height,position:{mx:.46,my:.2}});return S(M,W,{fill:ge(E,c,b.stroke),stroke:ge(E,c,b.stroke),strokeWidth:1}),H},"bpmn:Participant":function(M,E,b={}){b=Xe(b,["fill","stroke","width","height"]);var H=q(M,E,b),W=Ue(E),Q=Yt(E),_e=ie(E),Fe=_e.get("name");if(W){var Ze=Q?[{x:30,y:0},{x:30,y:Pn(E,b)}]:[{x:0,y:30},{x:Un(E,b),y:30}];y(M,Ze,{stroke:ge(E,c,b.stroke),strokeWidth:RR}),K(M,Fe,E,b)}else{var bt=ua(E,b);Q||(bt.height=Un(E,b),bt.width=Pn(E,b));var tt=se(M,Fe,{box:bt,align:"center-middle",style:{fill:ca(E,u,c,b.stroke)}});if(!Q){var zt=-1*Pn(E,b);Ds(tt,0,-zt,270)}}return _e.get("participantMultiplicity")&&D("ParticipantMultiplicityMarker",M,E,b),H},"bpmn:ReceiveTask":function(M,E,b={}){b=Xe(b,["fill","stroke"]);var H=ie(E),W=He(M,E,b),Q;return H.get("instantiate")?(h(M,28,28,20*.22,{fill:We(E,s,b.fill),stroke:ge(E,c,b.stroke),strokeWidth:1}),Q=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):Q=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),S(M,Q,{fill:We(E,s,b.fill),stroke:ge(E,c,b.stroke),strokeWidth:1}),W},"bpmn:ScriptTask":function(M,E,b={}){b=Xe(b,["fill","stroke"]);var H=He(M,E,b),W=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return S(M,W,{fill:We(E,s,b.fill),stroke:ge(E,c,b.stroke),strokeWidth:1}),H},"bpmn:SendTask":function(M,E,b={}){b=Xe(b,["fill","stroke"]);var H=He(M,E,b),W=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return S(M,W,{fill:ge(E,c,b.stroke),stroke:We(E,s,b.fill),strokeWidth:1}),H},"bpmn:SequenceFlow":function(M,E,b={}){b=Xe(b,["fill","stroke"]);var H=We(E,s,b.fill),W=ge(E,c,b.stroke),Q=x(M,E.waypoints,{markerEnd:d(M,"sequenceflow-end",H,W),stroke:W}),_e=ie(E),{source:Fe}=E;if(Fe){var Ze=ie(Fe);_e.get("conditionExpression")&&w(Ze,"bpmn:Activity")&&ve(Q,{markerStart:d(M,"conditional-flow-marker",H,W)}),Ze.get("default")&&(w(Ze,"bpmn:Gateway")||w(Ze,"bpmn:Activity"))&&Ze.get("default")===_e&&ve(Q,{markerStart:d(M,"conditional-default-flow-marker",H,W)})}return Q},"bpmn:ServiceTask":function(M,E,b={}){b=Xe(b,["fill","stroke"]);var H=He(M,E,b);h(M,10,10,{fill:We(E,s,b.fill),stroke:"none",transform:"translate(6, 6)"});var W=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});S(M,W,{fill:We(E,s,b.fill),stroke:ge(E,c,b.stroke),strokeWidth:1}),h(M,10,10,{fill:We(E,s,b.fill),stroke:"none",transform:"translate(11, 10)"});var Q=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return S(M,Q,{fill:We(E,s,b.fill),stroke:ge(E,c,b.stroke),strokeWidth:1}),H},"bpmn:StartEvent":function(M,E,b={}){var{renderIcon:H=!0}=b;b=Xe(b,["fill","stroke"]);var W=ie(E);W.get("isInterrupting")||(b={...b,strokeDasharray:"6"});var Q=Ee(M,E,b);return H&&j(E,M,b),Q},"bpmn:SubProcess":function(M,E,b={}){return Ue(E)?b=Xe(b,["fill","stroke","width","height"]):b=Xe(b,["fill","stroke"]),Y(M,E,b)},"bpmn:Task":function(M,E,b={}){return b=Xe(b,["fill","stroke"]),He(M,E,b)},"bpmn:TextAnnotation":function(M,E,b={}){b=Xe(b,["fill","stroke"]);var{width:H,height:W}=ua(E,b),Q=m(M,H,W,0,0,{fill:"none",stroke:"none"}),_e=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:H,containerHeight:W,position:{mx:0,my:0}});S(M,_e,{stroke:ge(E,c,b.stroke)});var Fe=ie(E),Ze=Fe.get("text")||"";return se(M,Ze,{align:"left-top",box:ua(E,b),padding:vo,style:{fill:ca(E,u,c,b.stroke)}}),Q},"bpmn:Transaction":function(M,E,b={}){Ue(E)?b=Xe(b,["fill","stroke","width","height"]):b=Xe(b,["fill","stroke"]);var H=Y(M,E,{strokeWidth:1.5,...b}),W=n.style(["no-fill","no-events"],{stroke:ge(E,c,b.stroke),strokeWidth:1.5}),Q=Ue(E);return Q||(b={}),m(M,Un(E,b),Pn(E,b),$s-Ns,Ns,W),H},"bpmn:UserTask":function(M,E,b={}){b=Xe(b,["fill","stroke"]);var H=He(M,E,b),W=15,Q=12,_e=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:W,y:Q}});S(M,_e,{fill:We(E,s,b.fill),stroke:ge(E,c,b.stroke),strokeWidth:.5});var Fe=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:W,y:Q}});S(M,Fe,{fill:We(E,s,b.fill),stroke:ge(E,c,b.stroke),strokeWidth:.5});var Ze=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:W,y:Q}});return S(M,Ze,{fill:ge(E,c,b.stroke),stroke:ge(E,c,b.stroke),strokeWidth:.5}),H},label:function(M,E,b={}){return qe(M,E,b)}};this._drawPath=S,this._renderer=C}ye(Br,ki),Br.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Br.prototype.canRender=function(e){return w(e,"bpmn:BaseElement")},Br.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Br.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Br.prototype.getShapePath=function(e){return je(e)?Ml(e,CR):w(e,"bpmn:Event")?Bm(e):w(e,"bpmn:Activity")?Ml(e,$s):w(e,"bpmn:Gateway")?xR(e):wR(e)};function Xe(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var TR=0,MR={width:150,height:50};function kR(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function OR(e){return Wt(e)?V({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var kl=null;function DR(){return kl||(kl=document.createElement("canvas").getContext("2d")),kl}function LR(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(Nm(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function Nm(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function IR(e,t){var n=DR();if(!n)return{width:0,height:0};n.font=LR(t),"letterSpacing"in n&&(n.letterSpacing=Nm(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 BR(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=IR(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return NR(e,r,i,o);r=FR(r,o.width,t)}}function NR(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 $m="­";function $R(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===$m)&&r.pop();break}var a=r[r.length-1];return a&&a===$m&&(r[r.length-1]="-"),r.join("")}function FR(e,t,n){var i=Math.max(e.length*(n/t),1),r=$R(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function Fs(e){this._config=V({},{size:MR,padding:TR,style:{},align:"center-top"},e||{})}Fs.prototype.createText=function(e,t){return this.layoutText(e,t).element},Fs.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Fs.prototype.layoutText=function(e,t){for(var n=V({},this._config.size,t.box),i=V({},this._config.style,t.style),r=kR(t.align||this._config.align),o=OR(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=jR(i),c=e.split(/\u00AD?\r?\n/),u=[],l=n.width-o.left-o.right;c.length;)u.push(BR(c,l,i));r.vertical==="middle"&&(o.top=o.bottom=0);var f=En(u,function(m,_,y){return m+(s||_.height)},0)+o.top+o.bottom,p=En(u,function(m,_,y){return _.width>m?_.width:m},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-f)/2),d-=(s||u[0].height)/4;var g=Ae("text");ve(g,i),I(u,function(m){var _;switch(d+=s||m.height,r.horizontal){case"left":_=o.left;break;case"right":_=(a?p:l)-o.right-m.width;break;default:_=Math.max(((a?p:l)-m.width)/2+o.left,0)}var y=Ae("tspan");ve(y,{x:_,y:d}),y.textContent=m.text,Ne(g,y)});var h={width:p,height:f};return{dimensions:h,element:g}};function jR(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var HR=12,zR=1.2,GR=40;function Fm(e){var t=V({fontFamily:"Arial, sans-serif",fontSize:HR,fontWeight:"normal",lineHeight:zR},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=V({},t,{fontSize:n},e&&e.externalStyle||{}),r=new Fs({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Ir.width),height:30},u=o(s,c,{style:i});return{x:Math.round(a.x+a.width/2-u.width/2),y:a.y,width:Math.ceil(u.width),height:Math.ceil(u.height)}},this.getTextAnnotationBounds=function(a,s){var c=o(s,a,{style:t,align:"left-top",padding:vo});return{x:a.x,y:a.y,width:a.width,height:Math.max(GR,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,V({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}Fm.$inject=["config.textRenderer"];function VR(){this.pathMap={EVENT_MESSAGE:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:36,width:36,heightElements:[6,14],widthElements:[10.5,21]},EVENT_SIGNAL:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x1},0 Z",height:36,width:36,heightElements:[18],widthElements:[10,20]},EVENT_ESCALATION:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x0},-{e.y1} l -{e.x0},{e.y1} Z",height:36,width:36,heightElements:[20,7],widthElements:[8]},EVENT_CONDITIONAL:{d:"M {e.x0},{e.y0} l {e.x1},0 l 0,{e.y2} l -{e.x1},0 Z M {e.x2},{e.y3} l {e.x0},0 M {e.x2},{e.y4} l {e.x0},0 M {e.x2},{e.y5} l {e.x0},0 M {e.x2},{e.y6} l {e.x0},0 M {e.x2},{e.y7} l {e.x0},0 M {e.x2},{e.y8} l {e.x0},0 ",height:36,width:36,heightElements:[8.5,14.5,18,11.5,14.5,17.5,20.5,23.5,26.5],widthElements:[10.5,14.5,12.5]},EVENT_LINK:{d:"m {mx},{my} 0,{e.y0} -{e.x1},0 0,{e.y1} {e.x1},0 0,{e.y0} {e.x0},-{e.y2} -{e.x0},-{e.y2} z",height:36,width:36,heightElements:[4.4375,6.75,7.8125],widthElements:[9.84375,13.5]},EVENT_ERROR:{d:"m {mx},{my} {e.x0},-{e.y0} {e.x1},-{e.y1} {e.x2},{e.y2} {e.x3},-{e.y3} -{e.x4},{e.y4} -{e.x5},-{e.y5} z",height:36,width:36,heightElements:[.023,8.737,8.151,16.564,10.591,8.714],widthElements:[.085,6.672,6.97,4.273,5.337,6.636]},EVENT_CANCEL_45:{d:"m {mx},{my} -{e.x1},0 0,{e.x0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:36,width:36,heightElements:[4.75,8.5],widthElements:[4.75,8.5]},EVENT_COMPENSATION:{d:"m {mx},{my} {e.x0},-{e.y0} 0,{e.y1} z m {e.x1},-{e.y2} {e.x2},-{e.y3} 0,{e.y1} -{e.x2},-{e.y3} z",height:36,width:36,heightElements:[6.5,13,.4,6.1],widthElements:[9,9.3,8.7]},EVENT_TIMER_WH:{d:"M {mx},{my} l {e.x0},-{e.y0} m -{e.x0},{e.y0} l {e.x1},{e.y1} ",height:36,width:36,heightElements:[10,2],widthElements:[3,7]},EVENT_TIMER_LINE:{d:"M {mx},{my} m {e.x0},{e.y0} l -{e.x1},{e.y1} ",height:36,width:36,heightElements:[10,3],widthElements:[0,0]},EVENT_MULTIPLE:{d:"m {mx},{my} {e.x1},-{e.y0} {e.x1},{e.y0} -{e.x0},{e.y1} -{e.x2},0 z",height:36,width:36,heightElements:[6.28099,12.56199],widthElements:[3.1405,9.42149,12.56198]},EVENT_PARALLEL_MULTIPLE:{d:"m {mx},{my} {e.x0},0 0,{e.y1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} -{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z",height:36,width:36,heightElements:[2.56228,7.68683],widthElements:[2.56228,7.68683]},GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},GATEWAY_EVENT_BASED:{d:"m {mx},{my} {e.x0},{e.y0} {e.x0},{e.y1} {e.x1},{e.y2} {e.x2},0 z",height:11,width:11,heightElements:[-6,6,12,-12],widthElements:[9,-3,-12]},GATEWAY_COMPLEX:{d:"m {mx},{my} 0,{e.y0} -{e.x0},-{e.y1} -{e.x1},{e.y2} {e.x0},{e.y1} -{e.x2},0 0,{e.y3} {e.x2},0 -{e.x0},{e.y1} l {e.x1},{e.y2} {e.x0},-{e.y1} 0,{e.y0} {e.x3},0 0,-{e.y0} {e.x0},{e.y1} {e.x1},-{e.y2} -{e.x0},-{e.y1} {e.x2},0 0,-{e.y3} -{e.x2},0 {e.x0},-{e.y1} -{e.x1},-{e.y2} -{e.x0},{e.y1} 0,-{e.y0} -{e.x3},0 z",height:17.125,width:17.125,heightElements:[4.875,3.4375,2.125,3],widthElements:[3.4375,2.125,4.875,3]},DATA_OBJECT_PATH:{d:"m 0,0 {e.x1},0 {e.x0},{e.y0} 0,{e.y1} -{e.x2},0 0,-{e.y2} {e.x1},0 0,{e.y0} {e.x0},0",height:61,width:51,heightElements:[10,50,60],widthElements:[10,40,50,60]},DATA_OBJECT_COLLECTION_PATH:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},DATA_ARROW:{d:"m 5,9 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z",height:61,width:51,heightElements:[],widthElements:[]},DATA_STORE:{d:"m {mx},{my} l 0,{e.y2} c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 l 0,-{e.y2} c -{e.x0},-{e.y1} -{e.x1},-{e.y1} -{e.x2},0c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0",height:61,width:61,heightElements:[7,10,45],widthElements:[2,58,60]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_PARALLEL:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},MARKER_SEQUENTIAL:{d:"m{mx},{my} m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_COMPENSATION:{d:"m {mx},{my} 7,-5 0,10 z m 7.1,-0.3 6.9,-4.7 0,10 -6.9,-4.7 z",height:10,width:21,heightElements:[],widthElements:[]},MARKER_LOOP:{d:"m {mx},{my} c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 -6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902",height:13.9,width:13.7,heightElements:[],widthElements:[]},MARKER_ADHOC:{d:"m {mx},{my} m 0.84461,2.64411 c 1.05533,-1.23780996 2.64337,-2.07882 4.29653,-1.97997996 2.05163,0.0805 3.85579,1.15803 5.76082,1.79107 1.06385,0.34139996 2.24454,0.1438 3.18759,-0.43767 0.61743,-0.33642 1.2775,-0.64078 1.7542,-1.17511 0,0.56023 0,1.12046 0,1.6807 -0.98706,0.96237996 -2.29792,1.62393996 -3.6918,1.66181996 -1.24459,0.0927 -2.46671,-0.2491 -3.59505,-0.74812 -1.35789,-0.55965 -2.75133,-1.33436996 -4.27027,-1.18121996 -1.37741,0.14601 -2.41842,1.13685996 -3.44288,1.96782996 z",height:4,width:15,heightElements:[],widthElements:[]},TASK_TYPE_SEND:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:14,width:21,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"},TASK_TYPE_MANUAL:{d:"m {mx},{my} c 0.234,-0.01 5.604,0.008 8.029,0.004 0.808,0 1.271,-0.172 1.417,-0.752 0.227,-0.898 -0.334,-1.314 -1.338,-1.316 -2.467,-0.01 -7.886,-0.004 -8.108,-0.004 -0.014,-0.079 0.016,-0.533 0,-0.61 0.195,-0.042 8.507,0.006 9.616,0.002 0.877,-0.007 1.35,-0.438 1.353,-1.208 0.003,-0.768 -0.479,-1.09 -1.35,-1.091 -2.968,-0.002 -9.619,-0.013 -9.619,-0.013 v -0.591 c 0,0 5.052,-0.016 7.225,-0.016 0.888,-0.002 1.354,-0.416 1.351,-1.193 -0.006,-0.761 -0.492,-1.196 -1.361,-1.196 -3.473,-0.005 -10.86,-0.003 -11.0829995,-0.003 -0.022,-0.047 -0.045,-0.094 -0.069,-0.139 0.3939995,-0.319 2.0409995,-1.626 2.4149995,-2.017 0.469,-0.4870005 0.519,-1.1650005 0.162,-1.6040005 -0.414,-0.511 -0.973,-0.5 -1.48,-0.236 -1.4609995,0.764 -6.5999995,3.6430005 -7.7329995,4.2710005 -0.9,0.499 -1.516,1.253 -1.882,2.19 -0.37000002,0.95 -0.17,2.01 -0.166,2.979 0.004,0.718 -0.27300002,1.345 -0.055,2.063 0.629,2.087 2.425,3.312 4.859,3.318 4.6179995,0.014 9.2379995,-0.139 13.8569995,-0.158 0.755,-0.004 1.171,-0.301 1.182,-1.033 0.012,-0.754 -0.423,-0.969 -1.183,-0.973 -1.778,-0.01 -5.824,-0.004 -6.04,-0.004 10e-4,-0.084 0.003,-0.586 10e-4,-0.67 z"},TASK_TYPE_INSTANTIATING_SEND:{d:"m {mx},{my} l 0,8.4 l 12.6,0 l 0,-8.4 z l 6.3,3.6 l 6.3,-3.6"},TASK_TYPE_SERVICE:{d:"m {mx},{my} v -1.71335 c 0.352326,-0.0705 0.703932,-0.17838 1.047628,-0.32133 0.344416,-0.14465 0.665822,-0.32133 0.966377,-0.52145 l 1.19431,1.18005 1.567487,-1.57688 -1.195028,-1.18014 c 0.403376,-0.61394 0.683079,-1.29908 0.825447,-2.01824 l 1.622133,-0.01 v -2.2196 l -1.636514,0.01 c -0.07333,-0.35153 -0.178319,-0.70024 -0.323564,-1.04372 -0.145244,-0.34406 -0.321407,-0.6644 -0.522735,-0.96217 l 1.131035,-1.13631 -1.583305,-1.56293 -1.129598,1.13589 c -0.614052,-0.40108 -1.302883,-0.68093 -2.022633,-0.82247 l 0.0093,-1.61852 h -2.241173 l 0.0042,1.63124 c -0.353763,0.0736 -0.705369,0.17977 -1.049785,0.32371 -0.344415,0.14437 -0.665102,0.32092 -0.9635006,0.52046 l -1.1698628,-1.15823 -1.5667691,1.5792 1.1684265,1.15669 c -0.4026573,0.61283 -0.68308,1.29797 -0.8247287,2.01713 l -1.6588041,0.003 v 2.22174 l 1.6724648,-0.006 c 0.073327,0.35077 0.1797598,0.70243 0.3242851,1.04472 0.1452428,0.34448 0.3214064,0.6644 0.5227339,0.96066 l -1.1993431,1.19723 1.5840256,1.56011 1.1964668,-1.19348 c 0.6140517,0.40346 1.3028827,0.68232 2.0233517,0.82331 l 7.19e-4,1.69892 h 2.226848 z m 0.221462,-3.9957 c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_SERVICE_FILL:{d:"m {mx},{my} c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_BUSINESS_RULE_HEADER:{d:"m {mx},{my} 0,4 20,0 0,-4 z"},TASK_TYPE_BUSINESS_RULE_MAIN:{d:"m {mx},{my} 0,12 20,0 0,-12 zm 0,8 l 20,0 m -13,-4 l 0,8"},MESSAGE_FLOW_MARKER:{d:"m {mx},{my} m -10.5 ,-7 l 0,14 l 21,0 l 0,-14 z l 10.5,6 l 10.5,-6"}},this.getRawPath=function(t){return this.pathMap[t].d},this.getScaledPath=function(t,n){var i=this.pathMap[t],r,o;n.abspos?(r=n.abspos.x,o=n.abspos.y):(r=n.containerWidth*n.position.mx,o=n.containerHeight*n.position.my);var a={};if(n.position){for(var s=n.containerHeight/i.height*n.yScaleFactor,c=n.containerWidth/i.width*n.xScaleFactor,u=0;u<i.heightElements.length;u++)a["y"+u]=i.heightElements[u]*s;for(var l=0;l<i.widthElements.length;l++)a["x"+l]=i.widthElements[l]*c}var f=YR(i.d,{mx:r,my:o,e:a});return f}}var WR=/\{([^{}]+)\}/g,UR=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function qR(e,t,n){var i=n;return t.replace(UR,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 YR(e,t){return String(e).replace(WR,function(n,i){return qR(n,i,t)})}const KR={__init__:["bpmnRenderer"],bpmnRenderer:["type",Br],textRenderer:["type",Fm],pathMap:["type",VR]};function XR(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const la={translate:["value",XR]};function js(e,t,n){return V({id:e.id,type:e.$type,businessObject:e,di:t},n)}function ZR(e,t,n){var i=e.waypoint;return!i||i.length<2?[De(t),De(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function jm(e,t,n){return new Error(`element ${cn(t)} referenced by ${cn(e)}#${n} not yet drawn`)}function Ii(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}Ii.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],Ii.prototype.add=function(e,t,n){var i,r,o;if(w(t,"bpmndi:BPMNPlane")){var a=w(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(js(e,t,a)),this._canvas.addRootElement(i)}else if(w(t,"bpmndi:BPMNShape")){var s=!Ue(e,t),c=JR(e);r=n&&(n.hidden||n.collapsed);var u=t.bounds;i=this._elementFactory.createShape(js(e,t,{collapsed:s,hidden:r,x:Math.round(u.x),y:Math.round(u.y),width:Math.round(u.width),height:Math.round(u.height),isFrame:c})),w(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),w(e,"bpmn:Lane")&&(o=0),w(e,"bpmn:DataStoreReference")&&(QR(n,De(u))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else if(w(t,"bpmndi:BPMNEdge")){var l=this._getSource(e),f=this._getTarget(e);r=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(js(e,t,{hidden:r,source:l,target:f,waypoints:ZR(t,l,f)})),w(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${cn(t)} for element ${cn(e)}`);return rr(e)&&$n(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},Ii.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${cn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw jm(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},Ii.prototype.addLabel=function(e,t,n){var i,r,o;return i=hR(t,n),r=$n(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(js(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!$n(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)},Ii.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?jm(e,i,t+"Ref"):new Error(`${cn(e)}#${t} Ref not specified`)},Ii.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},Ii.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},Ii.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function QR(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 JR(e){return w(e,"bpmn:Group")}const Hm={__depends__:[KR,{__depends__:[la],bpmnImporter:["type",Ii]}]};function pa(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function ai(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Ol(e){return Math.log(e)/Math.log(10)}var eC=1e3;function ee(e){this._eventBus=e}ee.$inject=["eventBus"];function tC(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}ee.prototype.on=function(e,t,n,i,r,o){if((Ut(t)||Ie(t))&&(o=r,r=i,i=n,n=t,t=null),Ut(n)&&(o=r,r=i,i=n,n=eC),Wt(r)&&(o=r,r=!1),!Ut(i))throw new Error("handlerFn must be a function");Oe(e)||(e=[e]);var a=this._eventBus;I(e,function(s){var c=["commandStack",s,t].filter(function(u){return u}).join(".");a.on(c,n,r?tC(i,o):i,o)})},ee.prototype.canExecute=Bi("canExecute"),ee.prototype.preExecute=Bi("preExecute"),ee.prototype.preExecuted=Bi("preExecuted"),ee.prototype.execute=Bi("execute"),ee.prototype.executed=Bi("executed"),ee.prototype.postExecute=Bi("postExecute"),ee.prototype.postExecuted=Bi("postExecuted"),ee.prototype.revert=Bi("revert"),ee.prototype.reverted=Bi("reverted");function Bi(e){return function(n,i,r,o,a){(Ut(n)||Ie(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var Dl=["top","bottom","left","right"],Hs=10;function Ll(e,t){ee.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],function(r){var o=r.context,a=o.connection,s=a.source,c=a.target,u=o.hints||{};u.createElementsBehavior!==!1&&(n(s),n(c))}),this.postExecuted(["label.create"],function(r){var o=r.context,a=o.shape,s=o.hints||{};s.createElementsBehavior!==!1&&n(a.labelTarget)}),this.postExecuted(["elements.create"],function(r){var o=r.context,a=o.elements,s=o.hints||{};s.createElementsBehavior!==!1&&a.forEach(function(c){n(c)})});function n(r){if(Bs(r)&&!ot(r)){var o=rC(r);o&&i(r,o)}}function i(r,o){var a=De(r),s=r.label,c=De(s);if(s.parent){var u=Te(r),l;switch(o){case"top":l={x:a.x,y:u.top-Hs-s.height/2};break;case"left":l={x:u.left-Hs-s.width/2,y:a.y};break;case"bottom":l={x:a.x,y:u.bottom+Hs+s.height/2};break;case"right":l={x:u.right+Hs+s.width/2,y:a.y};break}var f=ai(l,c);t.moveShape(s,f)}}}ye(Ll,ee),Ll.$inject=["eventBus","modeling"];function nC(e){var t=e.host,n=De(e),i=Qt(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=Dl.filter(function(a){return r.indexOf(a)===-1});return o}function iC(e){var t=De(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 zm(t,i)});return n}function rC(e){var t=De(e.label),n=De(e),i=zm(n,t);if(oC(i)){var r=iC(e);if(e.host){var o=nC(e);r=r.concat(o)}var a=Dl.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?Qt(e.label,e)!=="intersect"?void 0:i:a[0]}}function zm(e,t){return Qt(t,e,5)}function oC(e){return Dl.indexOf(e)!==-1}function Il(e){ee.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(w(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)}ye(Il,ee),Il.$inject=["eventBus"];var aC=1500;function Bl(e,t,n){e.invoke(ee,this),this.preExecute("elements.delete",aC,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=Ge(r,u=>w(u,"bpmn:Participant")||w(u,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(u=>w(u,"bpmn:Artifact"))),c=new Set;return I(o,u=>{const l=new Set(eo(fo(Array.from(s),kt(u))));c=c.union(l),s=s.difference(l)}),Array.from(c)}}ye(Bl,ee),Bl.$inject=["injector","eventBus","canvas"];function Nl(e,t){e.invoke(ee,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=Ge(r.incoming.concat(r.outgoing),function(a){return w(a,"bpmn:Association")});I(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}ye(Nl,ee),Nl.$inject=["injector","modeling"];function _o(e,t){for(xn(t)&&(t=[t]);e=e.parent;)if(ze(e,t))return e;return null}function Gm(e,t){var n=_o(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=_o(e,i),n)return Yt(n);if(ze(e,i))return Yt(e);var r;for(r=ie(e);r&&!w(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?Yt(o):!0}var Vm=500;function zs(e,t){t.invoke(ee,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Vm,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return Wm(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",Vm,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];Wm(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}zs.$inject=["bpmnReplace","injector"],ye(zs,ee),zs.prototype._replaceShape=function(e,t){var n=sC(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function sC(e){var t=ie(e),n=t.eventDefinitions;return n&&n[0]}function Wm(e,t){return!je(e)&&ze(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function $l(e,t){ee.call(this,e);function n(i){return Ge(i.attachers,function(r){return w(r,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var r=i.context.source,o=i.context.target,a=n(o);w(r,"bpmn:EventBasedGateway")&&w(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var r=i.context.oldSource,o=i.context.newSource;w(r,"bpmn:Gateway")&&w(o,"bpmn:EventBasedGateway")&&I(o.outgoing,function(a){var s=a.target,c=n(s);w(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}$l.$inject=["eventBus","modeling"],ye($l,ee);function Um(e){return e.create("bpmn:Category")}function cC(e){return e.create("bpmn:CategoryValue")}function qm(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=cC(e)),n.$parent||(n.$parent=Um(e)),n}function uC(e,t,n){return At(t.get("categoryValue"),e),e.$parent=t,At(n.get("rootElements"),t),t.$parent=n,e}function lC(e){var t=e.$parent;return t&&(Ct(t.get("categoryValue"),e),e.$parent=null),e}function pC(e){var t=e.$parent;return t&&(Ct(t.get("rootElements"),e),e.$parent=null),e}var fC=500;function Fl(e,t,n){n.invoke(ee,this);function i(c){return t.filter(function(u){return w(u,"bpmn:Group")&&!u.labelTarget}).map(ie).filter(function(u){return u!==c})}function r(c,u){return i(u).some(function(l){return l.get("categoryValueRef")===c})}function o(c,u){return i(u).some(function(l){var f=l.get("categoryValueRef");return f&&f.$parent===c})}function a(c,u){c&&u&&uC(c,u,e.getDefinitions())}function s(c,u,l){u&&!o(u,l)&&pC(u),c&&!r(c,l)&&lC(c)}this.executed(["shape.create","label.create"],function(c){var u=c.labelTarget||c.shape;!w(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0),this.reverted(["shape.create","label.create"],function(c){var u=c.labelTarget||c.shape;!w(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,ie(u))},!0),this.executed(["shape.move","shape.resize"],fC,function(c){a(c.categoryValue,c.category)},!0),this.reverted(["shape.move","shape.resize"],function(c){var u=c.shape;c.categoryValue&&s(c.categoryValue,c.category,ie(u))},!0),this.executed("group.updateRefs",function(c){Ym(c).forEach(function(u){a(u.categoryValue,u.category)})},!0),this.reverted("group.updateRefs",function(c){Ym(c).forEach(function(u){s(u.categoryValue,u.category,ie(u.groupShape))})},!0),this.executed("shape.delete",function(c){var u=c.shape;!w(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,ie(u))},!0),this.reverted("shape.delete",function(c){var u=c.shape;!w(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0)}Fl.$inject=["bpmnjs","elementRegistry","injector"],ye(Fl,ee);function Ym(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function jl(e,t,n){ee.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(m){const _=m.source,y=m.target;xo(_)&&fa(y)&&l(y)}function r(m){const _=m.connection,y=m.source,x=m.target;xo(y)&&Gs(x)&&(u(x),p(y,[_]))}function o(m){const _=m.newTarget,y=m.oldSource,x=m.oldTarget;if(x!==_){const S=y;fa(x)&&l(x),xo(S)&&Gs(_)&&u(_)}}function a(m){const{element:_}=m;fa(_)?(f(_),d(_)):Gs(_)&&g(_)}function s(m){const{newData:_,oldShape:y}=m;if(xo(m.oldShape)&&_.eventDefinitionType!=="bpmn:CompensateEventDefinition"||_.type!=="bpmn:BoundaryEvent"){const x=y.outgoing.find(({target:S})=>fa(S));x&&x.target&&(m._connectionTarget=x.target)}else if(!xo(m.oldShape)&&_.eventDefinitionType==="bpmn:CompensateEventDefinition"&&_.type==="bpmn:BoundaryEvent"){const x=y.outgoing.find(({target:S})=>Gs(S));x&&x.target&&(m._connectionTarget=x.target),h(y)}}function c(m){const{_connectionTarget:_,newShape:y}=m;_&&t.connect(y,_)}function u(m){t.updateProperties(m,{isForCompensation:!0})}function l(m){t.updateProperties(m,{isForCompensation:void 0})}function f(m){for(const _ of m.incoming)n.canConnect(_.source,m)||t.removeConnection(_);for(const _ of m.outgoing)n.canConnect(m,_.target)||t.removeConnection(_)}function p(m,_){m.outgoing.filter(S=>w(S,"bpmn:Association")).filter(S=>fa(S.target)&&!_.includes(S)).forEach(S=>t.removeConnection(S))}function d(m){const _=m.attachers.slice();_.length&&t.removeElements(_)}function g(m){const _=m.incoming.filter(y=>xo(y.source));t.removeElements(_)}function h(m){const _=m.outgoing.filter(y=>w(y,"bpmn:SequenceFlow"));t.removeElements(_)}}ye(jl,ee),jl.$inject=["eventBus","modeling","bpmnRules"];function fa(e){const t=ie(e);return t&&t.get("isForCompensation")}function xo(e){return e&&w(e,"bpmn:BoundaryEvent")&&yo(e,"bpmn:CompensateEventDefinition")}function Gs(e){return e&&w(e,"bpmn:Activity")&&!un(e)}function Hl(e){e.invoke(ee,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,r=n.shape;w(i,"bpmn:Lane")&&!w(r,"bpmn:Lane")&&(n.parent=_o(i,"bpmn:Participant"))})}Hl.$inject=["injector"],ye(Hl,ee);function zl(e,t){ee.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,r=i.shape;if(w(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}})}zl.$inject=["eventBus","bpmnFactory"],ye(zl,ee);var Gl=20,Vl=20,Km=30,Vs=2e3;function Wl(e,t,n){ee.call(this,t),t.on(["create.start","shape.move.start"],Vs,function(r){var o=r.context,a=o.shape,s=e.getRootElement();if(!(!w(a,"bpmn:Participant")||!w(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(f){return!w(f,"bpmn:Group")&&!je(f)&&!ot(f)});if(c.length){var u=kt(c),l=dC(a,u);V(a,l),o.createConstraints=hC(a,u)}}}),t.on("create.start",Vs,function(r){var o=r.context,a=o.shape,s=e.getRootElement(),c=e.getGraphics(s);function u(l){l.element=s,l.gfx=c}w(a,"bpmn:Participant")&&w(s,"bpmn:Process")&&(t.on("element.hover",Vs,u),t.once("create.cleanup",function(){t.off("element.hover",u)}))});function i(){var r=e.getRootElement();return w(r,"bpmn:Collaboration")?r:n.makeCollaboration()}this.preExecute("elements.create",Vs,function(r){var o=r.elements,a=r.parent,s=mC(o),c;s&&w(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;w(a,"bpmn:Participant")&&w(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,u=o.participant;a&&(!u||c===u)&&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 u=a.children.slice();c?s===c&&n.moveElements(u,{x:0,y:0},c):n.moveElements(u,{x:0,y:0},s)}},!0)}Wl.$inject=["canvas","eventBus","modeling"],ye(Wl,ee);function dC(e,t){t={width:t.width+Gl*2+Km,height:t.height+Vl*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 hC(e,t){return t=Te(t),{bottom:t.top+e.height/2-Vl,left:t.right-e.width/2+Gl,top:t.bottom-e.height/2+Vl,right:t.left+e.width/2-Gl-Km}}function mC(e){return lt(e,function(t){return w(t,"bpmn:Participant")})}var Xm="__targetRef_placeholder";function Ul(e,t){ee.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],Zm(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],Zm(o));function n(a,s,c){var u=a.get("dataInputAssociations");return lt(u,function(l){return l!==c&&l.targetRef===s})}function i(a,s){var c=a.get("properties"),u=lt(c,function(l){return l.name===Xm});return!u&&s&&(u=t.create("bpmn:Property",{name:Xm}),At(c,u)),u}function r(a,s){var c=i(a);c&&(n(a,c,s)||Ct(a.get("properties"),c))}function o(a){var s=a.context,c=s.connection,u=c.businessObject,l=c.target,f=l&&l.businessObject,p=s.newTarget,d=p&&p.businessObject,g=s.oldTarget||s.target,h=g&&g.businessObject,m=c.businessObject,_;h&&h!==f&&r(h,u),d&&d!==f&&r(d,u),f?(_=i(f,!0),m.targetRef=_):m.targetRef=null}}Ul.$inject=["eventBus","bpmnFactory"],ye(Ul,ee);function Zm(e){return function(t){var n=t.context,i=n.connection;if(w(i,"bpmn:DataInputAssociation"))return e(t)}}function Ws(e){this._bpmnUpdater=e}Ws.$inject=["bpmnUpdater"],Ws.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),[]},Ws.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 ql(e,t,n,i){ee.call(this,i),t.registerHandler("dataStore.updateContainment",Ws);function r(){return n.filter(function(s){return w(s,"bpmn:Participant")&&ie(s).processRef})[0]}function o(s){return s.children.filter(function(c){return w(c,"bpmn:DataStoreReference")&&!c.labelTarget})}function a(s,c){var u=s.businessObject||s;if(c=c||r(),c){var l=c.businessObject||c;t.execute("dataStore.updateContainment",{dataStoreBo:u,dataStoreDi:Ke(s),newSemanticParent:l.processRef||l,newDiParent:Ke(c)})}}this.preExecute("shape.create",function(s){var c=s.context,u=c.shape;w(u,"bpmn:DataStoreReference")&&u.type!=="label"&&(c.hints||(c.hints={}),c.hints.autoResize=!1)}),this.preExecute("elements.move",function(s){var c=s.context,u=c.shapes,l=u.filter(function(f){return w(f,"bpmn:DataStoreReference")});l.length&&(c.hints||(c.hints={}),c.hints.autoResize=u.filter(function(f){return!w(f,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,u=c.shape,l=u.parent;w(u,"bpmn:DataStoreReference")&&u.type!=="label"&&w(l,"bpmn:Collaboration")&&a(u)}),this.postExecute("shape.move",function(s){var c=s.context,u=c.shape,l=c.oldParent,f=u.parent;if(!w(l,"bpmn:Collaboration")&&w(u,"bpmn:DataStoreReference")&&u.type!=="label"&&w(f,"bpmn:Collaboration")){var p=w(l,"bpmn:Participant")?l:yC(l,"bpmn:Participant");a(u,p)}}),this.postExecute("shape.delete",function(s){var c=s.context,u=c.shape,l=e.getRootElement();ze(u,["bpmn:Participant","bpmn:SubProcess"])&&w(l,"bpmn:Collaboration")&&o(l).filter(function(f){return gC(f,u)}).forEach(function(f){a(f)})}),this.postExecute("canvas.updateRoot",function(s){var c=s.context,u=c.oldRoot,l=c.newRoot,f=o(u);f.forEach(function(p){w(l,"bpmn:Process")&&a(p,l)})})}ql.$inject=["canvas","commandStack","elementRegistry","eventBus"],ye(ql,ee);function gC(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 yC(e,t){for(;e.parent;){if(w(e.parent,t))return e.parent;e=e.parent}}var Us=Math.max,qs=Math.min,vC=20;function Qm(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function bC(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 _C(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 Ys(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return Ie(r)&&(i=(/top|left/.test(e)?qs:Us)(i,r)),Ie(o)&&(i=(/top|left/.test(e)?Us:qs)(i,o)),i}function xC(e,t){if(!t)return e;var n=Te(e);return Ms({top:Ys("top",n,t),right:Ys("right",n,t),bottom:Ys("bottom",n,t),left:Ys("left",n,t)})}function wC(e,t,n,i){var r=Te(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?Te(i):o,s={top:qs(o.top,a.top),left:qs(o.left,a.left),bottom:Us(o.bottom,a.bottom),right:Us(o.right,a.right)};return Ms(s)}function da(e,t){return typeof e<"u"?e:vC}function EC(e,t){var n,i,r,o;return typeof t=="object"?(n=da(t.left),i=da(t.right),r=da(t.top),o=da(t.bottom)):n=i=r=o=da(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function SC(e){return!(e.waypoints||e.type==="label")}function Jm(e,t){var n;if(e.length===void 0?n=Ge(e.children,SC):n=e,n.length)return EC(kt(n),t)}var or=Math.abs;function RC(e,t){return Qm(Te(t),Te(e))}var CC=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],qn=30;function Ks(e,t){return t=t||[],e.children.filter(function(n){w(n,"bpmn:Lane")&&(Ks(n,t),t.push(n))}),t}function ar(e){return e.children.filter(function(t){return w(t,"bpmn:Lane")})}function Yn(e){return _o(e,CC)||e}function PC(e,t){var n=Yn(e),i=w(n,"bpmn:Process")?[]:[n],r=Ks(n,i),o=Te(e),a=Te(t),s=RC(e,t),c=[],u=Yt(e);return r.forEach(function(l){if(l!==e){var f=u?0:s.top,p=u?s.right:0,d=u?0:s.bottom,g=u?s.left:0,h=Te(l);s.top&&(or(h.bottom-o.top)<10&&(d=a.top-h.bottom),or(h.top-o.top)<5&&(f=a.top-h.top)),s.left&&(or(h.right-o.left)<10&&(p=a.left-h.right),or(h.left-o.left)<5&&(g=a.left-h.left)),s.bottom&&(or(h.top-o.bottom)<10&&(f=a.bottom-h.top),or(h.bottom-o.bottom)<5&&(d=a.bottom-h.bottom)),s.right&&(or(h.left-o.right)<10&&(g=a.right-h.left),or(h.right-o.right)<5&&(p=a.right-h.right)),(f||p||d||g)&&c.push({shape:l,newBounds:_C(l,{top:f,right:p,bottom:d,left:g})})}}),c}var AC=500;function Yl(e,t){ee.call(this,e);function n(i,r){var o=Yt(i),a=ar(r),s=[],c=[],u=[],l=[];if(Dr(a,function(m){return o?m.y>i.y?c.push(m):s.push(m):m.x>i.x?l.push(m):u.push(m),m.children}),!!a.length){var f;o?c.length&&s.length?f=i.height/2:f=i.height:l.length&&u.length?f=i.width/2:f=i.width;var p,d,g,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")),u.length&&(g=t.calculateAdjustments(u,"x",f,i.x-10),t.makeSpace(g.movingShapes,g.resizingShapes,{x:f,y:0},"e")),l.length&&(h=t.calculateAdjustments(l,"x",-f,i.x+i.width+10),t.makeSpace(h.movingShapes,h.resizingShapes,{x:-f,y:0},"w"))}}this.postExecuted("shape.delete",AC,function(i){var r=i.context,o=r.hints,a=r.shape,s=r.oldParent;w(a,"bpmn:Lane")&&(o&&o.nested||n(a,s))})}Yl.$inject=["eventBus","spaceTool"],ye(Yl,ee);var eg=500;function Xs(e,t){t.invoke(ee,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",eg,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return tg(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",eg,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;tg(a,MC(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}Xs.$inject=["bpmnReplace","injector"],ye(Xs,ee),Xs.prototype._replaceShape=function(e){var t=TC(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function TC(e){var t=ie(e),n=t.eventDefinitions;return n&&n[0]}function tg(e,t){return!je(e)&&w(e,"bpmn:BoundaryEvent")&&!t}function MC(e,t){return e.indexOf(t)!==-1}var Zs=Math.round,kC=Math.max;function OC(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 DC(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var ng=10;function LC(e,t){var n,i;for(n=0;i=e[n];n++)if(ia(i,t)<=ng)return{point:e[n],bendpoint:!0,index:n};return null}function IC(e,t){var n=sm(OC(t,ng),DC(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=kC(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:Zs(i.x+r.x)/2,y:Zs(i.y+r.y)/2},index:i.segment2}:{point:{x:Zs(i.x),y:Zs(i.y)},index:i.segment2}:null}function Kl(e,t){return LC(e,t)||IC(e,t)}function Xl(e,t,n){ee.call(this,e);function i(r,o,a){var s=o.waypoints,c,u,l,f,p,d,g,h=r.outgoing.slice(),m=r.incoming.slice(),_;Ie(a.width)?_=De(a):_=a;var y=Kl(s,_);if(y){if(c=s.slice(0,y.index),u=s.slice(y.index+(y.bendpoint?1:0)),!c.length||!u.length)return;l=y.bendpoint?s[y.index]:_,(c.length===1||!ig(r,c[c.length-1]))&&c.push(rg(l)),(u.length===1||!ig(r,u[0]))&&u.unshift(rg(l))}f=o.source,p=o.target,t.canConnect(f,r,o)&&(n.reconnectEnd(o,r,c||_),d=o),t.canConnect(r,p,o)&&(d?g=n.connect(r,p,{type:o.type,waypoints:u}):(n.reconnectStart(o,r,u||_),g=o));var x=[].concat(d&&Ge(m,function(S){return S.source===d.source})||[],g&&Ge(h,function(S){return S.target===g.target})||[]);x.length&&n.removeElements(x)}this.preExecute("elements.move",function(r){var o=r.newParent,a=r.shapes,s=r.delta,c=a[0];if(!(!c||!o)){o&&o.waypoints&&(r.newParent=o=o.parent);var u=De(c),l={x:u.x+s.x,y:u.y+s.y},f=lt(o.children,function(p){var d=t.canInsert(a,p);return d&&Kl(p.waypoints,l)});f&&(r.targetFlow=f,r.position=l)}},!0),this.postExecuted("elements.move",function(r){var o=r.shapes,a=r.targetFlow,s=r.position;a&&i(o[0],a,s)},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;t.canInsert(a,o)&&(r.targetFlow=o,r.parent=o.parent)},!0),this.postExecuted("shape.create",function(r){var o=r.shape,a=r.targetFlow,s=r.position;a&&i(o,a,s)},!0)}ye(Xl,ee),Xl.$inject=["eventBus","bpmnRules","modeling"];function ig(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 rg(e){return V({},e)}function Zl(e,t){ee.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)&&wo(r)){var c=[];w(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(u=>u!==r&&wo(u)):c=a.incoming.filter(u=>u!==r&&wo(u)&&w(u.source,"bpmn:EventBasedGateway")),c.forEach(function(u){t.removeConnection(u)})}}),this.preExecuted("shape.replace",function(n){var i=n.context,r=i.newShape;if(w(r,"bpmn:EventBasedGateway")){var o=r.outgoing.filter(wo).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(wo).forEach(function(s){const c=a.incoming.filter(wo).filter(function(u){return u.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}Zl.$inject=["eventBus","modeling"],ye(Zl,ee);function wo(e){return w(e,"bpmn:SequenceFlow")}var Qs=1500,og=2e3;function ag(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"],Qs,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;w(a,"bpmn:Lane")&&!ze(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Yn(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||ze(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"],Qs,function(i){var r=i.hover;w(r,"bpmn:Lane")&&(i.hover=Yn(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Qs,function(i){var r=i.context,o=i.hover,a=r.type;w(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Yn(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Qs,function(i){var r=i.context,o=r.start;w(o,"bpmn:Lane")&&(r.start=Yn(o)||o)}),t.on("shape.move.start",og,function(i){var r=i.shape;w(r,"bpmn:Lane")&&(i.shape=Yn(r)||r)}),t.on("spaceTool.move",og,function(i){var r=i.hover;r&&w(r,"bpmn:Lane")&&(i.hover=Yn(r))})}ag.$inject=["elementRegistry","eventBus","canvas"];var sg=770;function Ql(e,t,n,i){n.invoke(ee,this);function r(s,c){var u=ie(s),l=c.categoryValue||u.categoryValueRef;l||(l=qm(e,u));var f=c.category||l.$parent||Um(e);u.categoryValueRef=l,l.$parent=f,c.categoryValue=l,c.category=f}function o(s,c){var u=ie(s),l=c.categoryValue||u.categoryValueRef,f=c.category||l&&l.$parent;l&&(c.categoryValue=l,c.category=f,u.categoryValueRef=null)}this.execute("label.create",function(s){var c=s.context,u=c.labelTarget;w(u,"bpmn:Group")&&r(u,c)}),this.revert("label.create",function(s){var c=s.context,u=c.labelTarget;w(u,"bpmn:Group")&&o(u,c)}),this.execute("shape.delete",function(s){var c=s.context,u=c.shape,l=ie(u);if(!(!w(u,"bpmn:Group")||u.labelTarget)){var f=c.categoryValue=l.categoryValueRef;f&&(c.category=f.$parent,l.categoryValueRef=null)}}),this.reverted("shape.delete",function(s){var c=s.context,u=c.shape;if(!(!w(u,"bpmn:Group")||u.labelTarget)){var l=c.category,f=c.categoryValue,p=ie(u);f&&(p.categoryValueRef=f,f.$parent=l)}}),this.execute("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!w(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!ie(u).categoryValueRef&&!c.categoryValue||r(u,c)}),this.reverted("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!w(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!ie(u).categoryValueRef&&!c.categoryValue||o(u,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!w(u,"bpmn:Group")||u.labelTarget||ie(u).categoryValueRef||r(u,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!w(u,"bpmn:Group")||u.labelTarget||!c.categoryValue||o(u,c)});function a(s,c){var u=e.create(s.$type);return i.copyElement(s,u,null,c)}t.on("copyPaste.copyElement",sg,function(s){var c=s.descriptor,u=s.element;if(!(!w(u,"bpmn:Group")||u.labelTarget)){var l=ie(u);if(l.categoryValueRef){var f=l.categoryValueRef;c.categoryValue=a(f,!0),f.$parent&&(c.category=a(f.$parent,!0))}}}),t.on("copyPaste.pasteElement",sg,function(s){var c=s.descriptor,u=c.businessObject,l=c.categoryValue,f=c.category;l&&(l=u.categoryValueRef=a(l)),f&&(l.$parent=a(f)),delete c.category,delete c.categoryValue})}Ql.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],ye(Ql,ee);function Jl(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 cg(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=Jl(i,r,o,a),u=Jl(i,r,o,s),l;c&&u?ug(c,o)>ug(u,o)?l=u:l=c:l=c||u,i.original=l}function n(i){var r=i.waypoints;t(r[0],r[1],De(i.source)),t(r[r.length-1],r[r.length-2],De(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}cg.$inject=["eventBus"];function ug(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function ep(e){ee.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=Ke(i);if(ze(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}ep.$inject=["eventBus"],ye(ep,ee);function lg(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function pg(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function BC(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 NC(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 tp(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=NC([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 fg(e,t){var n=tp(e,t),i={x:n.x-e.x,y:n.y-e.y};return lg(i)}function ha(e,t){return lg({x:e.x-t.x,y:e.y-t.y})}var dg=Math.sqrt,hg=Math.min,$C=Math.max,mg=Math.abs;function gg(e){return Math.pow(e,2)}function ma(e,t){return dg(gg(e.x-t.x)+gg(e.y-t.y))}function FC(e,t){var n=0,i,r,o,a,s,c,u,l,f,p,d;for(n=0;n<t.length-1;n++){if(i=t[n],r=t[n+1],vg(i,r)?u=[i]:(o=ma(e,i),a=ma(e,r),c=hg(o,a),u=jC(i,r,e,c)),u.length<1)throw new Error("expected between [1, 2] circle -> line intersections");u.length===1&&(l={type:"bendpoint",position:u[0],segmentIndex:n,bendpointIndex:vg(i,u[0])?n:n+1}),u.length===2&&(s=zC(u[0],u[1]),l={type:"segment",position:s,segmentIndex:n,relativeLocation:ma(i,s)/ma(i,r)}),f=ma(l.position,e),(!d||p>f)&&(d=l,p=f)}return d}function jC(e,t,n,i){var r=t.x-e.x,o=t.y-e.y,a=n.x-e.x,s=n.y-e.y,c=r*r+o*o,u=r*a+o*s,l=a*a+s*s-i*i,f=u/c,p=l/c,d=f*f-p;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var g=dg(d),h=-f+g,m=-f-g,_={x:e.x-r*h,y:e.y-o*h};if(d===0)return[_];var y={x:e.x-r*m,y:e.y-o*m};return[_,y].filter(function(x){return HC(x,e,t)})}function HC(e,t,n){return yg(e.x,t.x,n.x)&&yg(e.y,t.y,n.y)}function yg(e,t,n){return e>=hg(t,n)-Js&&e<=$C(t,n)+Js}function zC(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Js=.1;function vg(e,t){return mg(e.x-t.x)<=Js&&mg(e.y-t.y)<=Js}function GC(e,t,n,i){var r=n.segmentIndex,o=t.length-e.length;if(i.segmentMove){var a=i.segmentMove.segmentStartIndex,s=i.segmentMove.newSegmentStartIndex;return r===a?s:r>=s?r+o<s?s:r+o:r}if(i.bendpointMove){var c=i.bendpointMove.insert,u=i.bendpointMove.bendpointIndex,l;if(o===0)return r;if(r>=u&&(l=c?r+1:r-1),r<u&&(l=r,c&&n.type!=="bendpoint"&&u-1===r)){var f=_g(t,u);f<n.relativeLocation&&l++}return l}return o===0?r:i.connectionStart&&r===0?0:i.connectionEnd&&r===e.length-2?t.length-2:Math.floor((t.length-2)/2)}function bg(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=FC(e,n),c=s.segmentIndex,u=GC(n,t,s,i);if(u<0||u>t.length-2||u===null)return a;var l=xg(n,c),f=xg(t,u),p=s.position,d=WC(l,p),g=VC(l,f);if(s.type==="bendpoint"){var h=t.length-n.length,m=s.bendpointIndex,_=n[m];if(t.indexOf(_)!==-1)return a;if(h===0){var y=t[m];return r=y.x-s.position.x,o=y.y-s.position.y,{delta:{x:r,y:o},point:{x:e.x+r,y:e.y+o}}}h<0&&m!==0&&m<n.length-1&&(d=_g(n,m))}var x={x:(f[1].x-f[0].x)*d+f[0].x,y:(f[1].y-f[0].y)*d+f[0].y},S=BC({x:e.x-p.x,y:e.y-p.y},g);return r=x.x+S.x-e.x,o=x.y+S.y-e.y,{point:Di(x),delta:Di({x:r,y:o})}}function _g(e,t){var n=ha(e[t-1],e[t]),i=ha(e[t],e[t+1]),r=n/(n+i);return r}function VC(e,t){var n=pg(e),i=pg(t);return i-n}function xg(e,t){return[e[t],e[t+1]]}function WC(e,t){var n=ha(e[0],e[1]),i=ha(e[0],t);return n===0?0:i/n}function UC(e,t,n,i){var r=De(e);return bg(r,t,n,i).delta}function ga(e,t,n){var i=pa(t),r=pa(n),o=ai(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return Di({x:r.x+a.x,y:r.y+a.y})}function wg(e,t,n){var i=pa(e),r=pa(t),o=pa(n),a=ai(e,i),s=ai(i,r),c=qC(i,t,n);if(c)return c;var u={x:s.x*(n.width/t.width),y:s.y*(n.height/t.height)},l={x:o.x+u.x,y:o.y+u.y};return Di({x:l.x+a.x-e.x,y:l.y+a.y-e.y})}function qC(e,t,n){var i=Te(t),r=Te(n);if(YC(i,r))return null;var o=Qt(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=Qt(n,s),c!==o?null:a}function YC(e,t){return KC(e,t)||XC(e,t)}function KC(e,t){return e.right!==t.right&&e.left!==t.left}function XC(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var Eg="name",Sg="text";function np(e,t,n,i){ee.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,u=s.properties;if(Eg in u&&t.updateLabel(c,u[Eg]),Sg in u&&w(c,"bpmn:TextAnnotation")){var l=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},u[Sg]||"");t.updateLabel(c,u.text,l)}}this.postExecute(["shape.create","connection.create"],function(a){var s=a.context,c=s.hints||{};if(c.createElementsBehavior!==!1){var u=s.shape||s.connection;je(u)||!rr(u)||$n(u)&&t.updateLabel(u,$n(u))}}),this.postExecute("shape.delete",function(a){var s=a.context,c=s.labelTarget,u=s.hints||{};c&&u.unsetLabel!==!1&&t.updateLabel(c,null,null,{removeShape:!1})});function o(a){var s=a.context,c=s.connection,u=c.label,l=V({},s.hints),f=s.newWaypoints||c.waypoints,p=s.oldWaypoints;return typeof l.startChanged>"u"&&(l.startChanged=!!l.connectionStart),typeof l.endChanged>"u"&&(l.endChanged=!!l.connectionEnd),UC(u,f,p,l)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(a){var s=a.context,c=s.hints||{};if(c.labelBehavior!==!1){var u=s.connection,l=u.label,f;!l||!l.parent||(f=o(a),t.moveShape(l,f))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,u=s.oldShape,l=ie(c);l&&rr(l)&&u.label&&c.label&&(c.label.x=u.label.x,c.label.y=u.label.y)}),this.preExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.hints||{};if(!(!je(c)||u.autoResize)){var l=s.newBounds,f=i.getDimensions($n(c)||"",{box:l,style:i.getExternalStyle()}),p=Math.ceil(f.height),d=l.y!==c.y,g=c.y+c.height;s.newBounds={width:l.width,height:p,x:l.x,y:d?g-p:l.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.newBounds,l=s.oldBounds;if(Bs(c)){var f=c.label,p=De(f),d=JC(l),g=QC(p,d),h=ZC(g,l,u);t.moveShape(f,h)}})}ye(np,ee),np.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function ZC(e,t,n){var i=ga(e,t,n);return Di(ai(i,e))}function QC(e,t){if(t.length){var n=eP(e,t);return tp(e,n)}}function JC(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 eP(e,t){var n=t.map(function(r){return{line:r,distance:fg(e,r)}}),i=ui(n,"distance");return i[0].line}function tP(e,t,n,i){return bg(e,t,n,i).point}function ip(e,t){ee.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=V({},o.hints),c=o.newWaypoints||a.waypoints,u=o.oldWaypoints;return typeof s.startChanged>"u"&&(s.startChanged=!!s.connectionStart),typeof s.endChanged>"u"&&(s.endChanged=!!s.connectionEnd),tP(r,c,u,s)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming;s.forEach(function(c){var u=c.waypoints[c.waypoints.length-1],l=n(i,u),f=[].concat(c.waypoints.slice(0,-1),[l]);t.updateWaypoints(c,f)}),a.forEach(function(c){var u=c.waypoints[0],l=n(i,u),f=[].concat([l],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(u){var l=u.waypoints[u.waypoints.length-1],f={x:l.x+c.x,y:l.y+c.y},p=[].concat(u.waypoints.slice(0,-1),[f]);t.updateWaypoints(u,p)}),a.forEach(function(u){var l=u.waypoints[0],f={x:l.x+c.x,y:l.y+c.y},p=[].concat([f],u.waypoints.slice(1));t.updateWaypoints(u,p)})})}ye(ip,ee),ip.$inject=["eventBus","modeling"];function ec(e,t,n){var i=nc(e),r=Cg(i,t),o=i[0];return r.length?r[r.length-1]:ga(o.original||o,n,t)}function tc(e,t,n){var i=nc(e),r=Cg(i,t),o=i[i.length-1];return r.length?r[0]:ga(o.original||o,n,t)}function rp(e,t,n){var i=nc(e),r=Rg(t,n),o=i[0];return ga(o.original||o,r,t)}function op(e,t,n){var i=nc(e),r=Rg(t,n),o=i[i.length-1];return ga(o.original||o,r,t)}function Rg(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function nc(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Cg(e,t){var n=on(e,iP);return Ge(n,function(i){return nP(i,t)})}function nP(e,t){return Qt(t,e,1)==="intersect"}function iP(e){return e.original||e}function ap(e,t){ee.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(rP(i,r)){var o=oP(i);o.incoming.forEach(function(a){var s=tc(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=ec(a,r,i);t.reconnectStart(a,r,s)})}},!0)}ap.$inject=["eventBus","modeling"],ye(ap,ee);function rP(e,t){return w(e,"bpmn:Participant")&&Ue(e)&&w(t,"bpmn:Participant")&&!Ue(t)}function oP(e){var t=ta([e]),n=[],i=[];return t.forEach(function(r){r!==e&&(r.incoming.forEach(function(o){w(o,"bpmn:MessageFlow")&&n.push(o)}),r.outgoing.forEach(function(o){w(o,"bpmn:MessageFlow")&&i.push(o)}))},[]),{incoming:n,outgoing:i}}const aP=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Pg(e){const t=ie(e);if(!w(t,"bpmn:BoundaryEvent")&&!(w(t,"bpmn:StartEvent")&&un(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:aP.some(i=>w(n[0],i))}function Ag(e){return w(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function sp(e,t){e.invoke(ee,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!Pg(r))return;const a=Ag(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=ie(i).get(a),u=ie(r).get(a);c!==u&&t.updateProperties(r,{[a]:c})})}sp.$inject=["injector","modeling"],ye(sp,ee);function cp(e,t){ee.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=Ke(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}ye(cp,ee),cp.$inject=["eventBus","modeling"];function up(e,t,n){ee.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(!(!w(o,"bpmn:SequenceFlow")||!w(a,"bpmn:SequenceFlow"))&&t.canConnect(o.source,a.target,o)){var s=sP(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}ye(up,ee),up.$inject=["eventBus","bpmnRules","modeling"];function Eo(e){return e.original||e}function sP(e,t){var n=Jl(Eo(e[e.length-2]),Eo(e[e.length-1]),Eo(t[1]),Eo(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Eo(e[0]),Eo(t[t.length-1])]}function lp(e,t){ee.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,r=i.parent;w(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)}lp.$inject=["eventBus","modeling"],ye(lp,ee);function pp(e,t,n,i){ee.call(this,e);var r=i.get("dragging",!1);function o(c){var u=c.source,l=c.target,f=c.parent;if(f){var p,d;w(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(u,l)||(d=!0),n.canConnectMessageFlow(u,l)&&(p="bpmn:MessageFlow")),w(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(u,l)||(d=!0),n.canConnectSequenceFlow(u,l)&&(p="bpmn:SequenceFlow")),d&&t.removeConnection(c),p&&t.connect(u,l,{type:p,waypoints:c.waypoints.slice()})}}function a(c){var u=c.context,l=u.connection,f=u.newSource||l.source,p=u.newTarget||l.target,d,g;d=n.canConnect(f,p),!(!d||d.type===l.type)&&(g=t.connect(f,p,{type:d.type,associationDirection:d.associationDirection,waypoints:l.waypoints.slice()}),l.parent&&t.removeConnection(l),u.connection=g,r&&s(l,g))}function s(c,u){var l=r.context(),f=l&&l.payload.previousSelection,p;!f||!f.length||(p=f.indexOf(c),p!==-1&&f.splice(p,1,u))}this.postExecuted("elements.move",function(c){var u=c.closure,l=u.allConnections;I(l,o)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var u=c.context,l=u.properties,f=u.element,p=f.businessObject,d;l.default&&(d=lt(f.outgoing,no({id:f.businessObject.default.id})),d&&t.updateProperties(d,{conditionExpression:void 0})),l.conditionExpression&&p.sourceRef.default===p&&t.updateProperties(f.source,{default:void 0})})}ye(pp,ee),pp.$inject=["eventBus","modeling","bpmnRules","injector"];function ic(e,t,n,i,r,o){i.invoke(ee,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,function(a){var s=a.context,c=s.parent,u=s.elements,l=En(u,function(f,p){var d=t.canReplace([p],p.host||p.parent||c);return d?f.concat(d.replacements):f},[]);l.length&&this._replaceElements(u,l)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,u=s.newHost,l=[];I(s.closure.topLevel,function(p){un(p)?l=l.concat(p.children):l=l.concat(p)}),l.length===1&&u&&(c=u);var f=t.canReplace(l,c);f&&this._replaceElements(l,f.replacements,u)},this),this.postExecute(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,u=s.newShape,l=c.attachers,f;l&&l.length&&(f=t.canReplace(l,u),this._replaceElements(l,f.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,u=s.newShape;r.unclaimId(c.businessObject.id,c.businessObject),r.updateProperties(u,{id:c.id})})}ye(ic,ee),ic.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;I(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)},ic.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var cP=1500,uP={width:140,height:120},fp={width:300,height:60},dp={width:60,height:300},rc={width:300,height:150},oc={width:150,height:300},Tg={width:140,height:120},Mg={width:100,height:40};function kg(e){e.on("resize.start",cP,function(t){var n=t.context,i=n.shape,r=n.direction,o=n.balanced;(w(i,"bpmn:Lane")||w(i,"bpmn:Participant"))&&(n.resizeConstraints=hP(i,r,o)),w(i,"bpmn:SubProcess")&&Ue(i)&&(n.minDimensions=Tg),w(i,"bpmn:TextAnnotation")&&(n.minDimensions=Mg)})}kg.$inject=["eventBus"];var sr=Math.abs,lP=Math.min,pP=Math.max;function Og(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function So(e,t,n){return Og(e,t,n,lP)}function Ro(e,t,n){return Og(e,t,n,pP)}var fP={top:20,left:50,right:20,bottom:20},dP={top:50,left:20,right:20,bottom:20};function hP(e,t,n){var i=Yn(e),r=!0,o=!0,a=Ks(i,[i]),s=Te(e),c={},u={},l=Yt(e),f=l?fp:dp;/n/.test(t)?u.top=s.bottom-f.height:/e/.test(t)?u.right=s.left+f.width:/s/.test(t)?u.bottom=s.top+f.height:/w/.test(t)&&(u.left=s.right-f.width),a.forEach(function(g){var h=Te(g);l?(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&&sr(s.top-h.bottom)<10&&Ro(c,"top",h.top+f.height),sr(s.top-h.top)<5&&So(u,"top",h.bottom-f.height)),/e/.test(t)&&(n&&sr(s.right-h.left)<10&&So(c,"right",h.right-f.width),sr(s.right-h.right)<5&&Ro(u,"right",h.left+f.width)),/s/.test(t)&&(n&&sr(s.bottom-h.top)<10&&So(c,"bottom",h.bottom-f.height),sr(s.bottom-h.bottom)<5&&Ro(u,"bottom",h.top+f.height)),/w/.test(t)&&(n&&sr(s.left-h.right)<10&&Ro(c,"left",h.left+f.width),sr(s.left-h.left)<5&&So(u,"left",h.right-f.width))});var p=i.children.filter(function(g){return!g.hidden&&!g.waypoints&&(w(g,"bpmn:FlowElement")||w(g,"bpmn:Artifact"))}),d=l?fP:dP;return p.forEach(function(g){var h=Te(g);/n/.test(t)&&(!l||r)&&So(u,"top",h.top-d.top),/e/.test(t)&&(l||o)&&Ro(u,"right",h.right+d.right),/s/.test(t)&&(!l||o)&&Ro(u,"bottom",h.bottom+d.bottom),/w/.test(t)&&(l||r)&&So(u,"left",h.left-d.left)}),{min:u,max:c}}function Dg(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function Co(e){return e.originalEvent||e.srcEvent}function hp(e){Dg(e),Dg(Co(e))}function Nr(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 Lg(){return/mac/i.test(navigator.platform)}function Ig(e,t){return(Co(e)||e).button===t}function cr(e){return Ig(e,0)}function mP(e){return Ig(e,1)}function ya(e){var t=Co(e)||e;return cr(e)?Lg()?t.metaKey:t.ctrlKey:!1}function ac(e){var t=Co(e)||e;return cr(e)&&t.shiftKey}var Bg=1001;function Ng(e,t){e.on("resize.start",Bg+500,function(n){var i=n.context,r=i.shape;(w(r,"bpmn:Lane")||w(r,"bpmn:Participant"))&&(i.balanced=!ya(n))}),e.on("resize.end",Bg,function(n){var i=n.context,r=i.shape,o=i.canExecute,a=i.newBounds;if(w(r,"bpmn:Lane")||w(r,"bpmn:Participant"))return o&&(a=fm(a),t.resizeLane(r,a,i.balanced)),!1})}Ng.$inject=["eventBus","modeling"];var gP=500;function mp(e,t,n,i,r){n.invoke(ee,this);function o(l){return ze(l,["bpmn:ReceiveTask","bpmn:SendTask"])||yP(l,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(l){var f=e.getDefinitions(),p=f.get("rootElements");return!!lt(p,no({id:l.id}))}function s(l){if(w(l,"bpmn:ErrorEventDefinition"))return"errorRef";if(w(l,"bpmn:EscalationEventDefinition"))return"escalationRef";if(w(l,"bpmn:MessageEventDefinition"))return"messageRef";if(w(l,"bpmn:SignalEventDefinition"))return"signalRef"}function c(l){if(ze(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.get("messageRef");var f=l.get("eventDefinitions"),p=f[0];return p.get(s(p))}function u(l,f){if(ze(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.set("messageRef",f);var p=l.get("eventDefinitions"),d=p[0];return d.set(s(d),f)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var f=l.shape||l.element;if(o(f)){var p=ie(f),d=c(p),g;d&&!a(d)&&(g=e.getDefinitions().get("rootElements"),At(g,d),l.addedRootElement=d)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var f=l.addedRootElement;if(f){var p=e.getDefinitions().get("rootElements");Ct(p,f)}},!0),t.on("copyPaste.copyElement",function(l){var f=l.descriptor,p=l.element;if(!(p.labelTarget||!o(p))){var d=ie(p),g=c(d);g&&(f.referencedRootElement=g)}}),t.on("copyPaste.pasteElement",gP,function(l){var f=l.descriptor,p=f.businessObject,d=f.referencedRootElement;d&&(a(d)||(d=i.copyElement(d,r.create(d.$type))),u(p,d),delete f.referencedRootElement)})}mp.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],ye(mp,ee);function yP(e,t){return Oe(t)||(t=[t]),qi(t,function(n){return yo(e,n)})}var $g=Math.max;function Fg(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return I(n,function(a){var s=a.id;w(a,"bpmn:Participant")&&(o[s]=bP(a,i,r)),w(a,"bpmn:Lane")&&(o[s]=Yt(a)?fp:dp),w(a,"bpmn:SubProcess")&&Ue(a)&&(o[s]=Tg),w(a,"bpmn:TextAnnotation")&&(o[s]=Mg),w(a,"bpmn:Group")&&(o[s]=uP)}),o})}Fg.$inject=["eventBus"];function vP(e){return e==="x"}function bP(e,t,n){var i=Yt(e);if(!wP(e))return i?rc:oc;var r=vP(t),o={};return r?i?o=rc:o={width:xP(e,n,r),height:oc.height}:i?o={width:rc.width,height:_P(e,n,r)}:o=oc,o}function _P(e,t,n){var i;return i=EP(e,t,n),$g(rc.height,i)}function xP(e,t,n){var i;return i=SP(e,t,n),$g(oc.width,i)}function wP(e){return!!ar(e).length}function EP(e,t,n){var i=ar(e),r;return r=gp(i,t,n),e.height-r.height+fp.height}function SP(e,t,n){var i=ar(e),r;return r=gp(i,t,n),e.width-r.width+dp.width}function gp(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=ar(r),o.length?gp(o,t,n):r}var jg="_plane";function Hg(e){var t=e.id;return RP(t)}function _i(e){var t=e.id;return w(e,"bpmn:SubProcess")?zg(t):t}function $r(e){return zg(e)}function sc(e){var t=Ke(e);return w(t,"bpmndi:BPMNPlane")}function zg(e){return e+jg}function RP(e){return e.replace(new RegExp(jg+"$"),"")}var Gg=400,CP=600,Vg={x:180,y:160};function Ni(e,t,n,i,r,o,a){ee.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 w(f,"bpmn:SubProcess")&&!Ue(f)}function u(f){var p=f.shape,d=f.newRootElement,g=ie(p);d=s._addDiagram(d||g),f.newRootElement=e.addRootElement(d)}function l(f){var p=f.shape,d=ie(p);s._removeDiagram(d);var g=f.newRootElement=a.get(_i(d));e.removeRootElement(g)}this.executed("shape.create",function(f){var p=f.shape;c(p)&&u(f)},!0),this.postExecuted("elements.create",function(f){var p=f.elements;I(p,function(d){if(c(d)){var g=a.get(_i(d));if(!(!g||!d.children||!d.children.length)){var h=Wg(d);s._showRecursively(h),s._moveChildrenToShape(h,g)}}})},!0),this.reverted("shape.create",function(f){var p=f.shape;c(p)&&l(f)},!0),this.preExecute("shape.delete",function(f){var p=f.shape;!w(p,"bpmn:SubProcess")||!Ue(p)||I(sa([p]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(f){var p=f.shape;if(c(p)){var d=a.get(_i(p));d&&n.removeElements(d.children.slice())}},!0),this.executed("shape.delete",function(f){var p=f.shape;c(p)&&l(f)},!0),this.reverted("shape.delete",function(f){var p=f.shape;c(p)&&u(f)},!0),this.preExecuted("shape.replace",function(f){var p=f.oldShape,d=f.newShape;!c(p)||!c(d)||(f.oldRoot=e.removeRootElement(_i(p)))},!0),this.postExecuted("shape.replace",function(f){var p=f.newShape,d=f.oldRoot,g=e.findRoot(_i(p));if(!(!d||!g)){var h=d.children;n.moveElements(h,{x:0,y:0},g)}},!0),this.executed("element.updateProperties",function(f){var p=f.element;if(w(p,"bpmn:SubProcess")){var d=f.properties,g=f.oldProperties,h=g.id,m=d.id;if(h!==m){if(sc(p)){a.updateId(p,$r(m)),a.updateId(h,m);return}var _=a.get($r(h));_&&a.updateId($r(h),$r(m))}}},!0),this.reverted("element.updateProperties",function(f){var p=f.element;if(w(p,"bpmn:SubProcess")){var d=f.properties,g=f.oldProperties,h=g.id,m=d.id;if(h!==m){if(sc(p)){a.updateId(p,$r(h)),a.updateId(m,h);return}var _=a.get($r(m));_&&a.updateId(_,$r(h))}}},!0),t.on("element.changed",function(f){var p=f.element;if(sc(p)){var d=p,g=a.get(Hg(d));!g||g===d||t.fire("element.changed",{element:g})}}),this.executed("shape.toggleCollapse",Gg,function(f){var p=f.shape;w(p,"bpmn:SubProcess")&&(Ue(p)?l(f):(u(f),s._showRecursively(p.children)))},!0),this.reverted("shape.toggleCollapse",Gg,function(f){var p=f.shape;w(p,"bpmn:SubProcess")&&(Ue(p)?l(f):(u(f),s._showRecursively(p.children)))},!0),this.postExecuted("shape.toggleCollapse",CP,function(f){var p=f.shape;if(w(p,"bpmn:SubProcess")){var d=f.newRootElement;if(d)if(Ue(p))s._moveChildrenToShape(d.children.slice(),p),I(sa(p.children),h=>{n.moveShape(h.annotation,{x:0,y:0},p.parent),I(h.associations,m=>{n.moveConnection(m,{x:0,y:0},p.parent)})});else{s._disconnectSharedAnnotations(p);var g=Wg(p);s._moveChildrenToShape(g,d)}}},!0),t.on("copyPaste.createTree",function(f){var p=f.element,d=f.children;if(c(p)){var g=_i(p),h=a.get(g);h&&d.push.apply(d,h.children)}}),t.on("copyPaste.copyElement",function(f){var p=f.descriptor,d=f.element,g=f.elements,h=d.parent,m=w(Ke(h),"bpmndi:BPMNPlane");if(m){var _=Hg(h),y=lt(g,function(x){return x.id===_});y&&(p.parent=y.id)}}),t.on("copyPaste.pasteElement",function(f){var p=f.descriptor;p.parent&&(c(p.parent)||p.parent.hidden)&&(p.hidden=!0)})}ye(Ni,ee),Ni.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=kt(i),o;if(!t.x)o={x:Vg.x-r.x,y:Vg.y-r.y};else{var a=De(t),s=De(r);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}},Ni.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(Im(e).map(i=>i.annotation));n.size&&I(sa(e.children),i=>{n.has(i.annotation)&&I(i.associations,r=>{t.removeConnection(r)})})},Ni.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},Ni.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},Ni.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:_i(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},Ni.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=lt(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},Ni.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function PP(e){var t=[];return I(sa(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function Wg(e){return e.children.slice().concat(PP(e.children)).concat(AP(e))}function AP(e){return xl(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function yp(e,t){e.invoke(ee,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,r=n.context.newShape;if(!(!w(r,"bpmn:SubProcess")||w(r,"bpmn:AdHocSubProcess")||!(w(i,"bpmn:Task")||w(i,"bpmn:CallActivity"))||!Ue(r))){var o=TP(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}yp.$inject=["injector","modeling"],ye(yp,ee);function TP(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function vp(e,t){ee.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;w(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&&w(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(!(!w(r,"bpmn:TextAnnotation")||o.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,$n(r)||""),c=a.y!==r.y&&Math.abs(a.y+a.height-(r.y+r.height))<=1,u=r.y+r.height;i.newBounds={width:a.width,height:s.height,x:a.x,y:c?u-s.height:a.y}}})}ye(vp,ee),vp.$inject=["eventBus","textRenderer"];function bp(e,t){ee.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(Ue(i))return;var r=ta(i);r.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();I(s,function(u){o(u,!0)}),I(c,function(u){o(u,!1)})});function o(a,s){r.indexOf(a.source)!==-1&&r.indexOf(a.target)!==-1||w(a,"bpmn:Association")&&(w(a.source,"bpmn:TextAnnotation")||w(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,De(i)):t.reconnectStart(a,i,De(i)))}},!0)}ye(bp,ee),bp.$inject=["eventBus","modeling"];var _p=500;function xp(e,t,n){ee.call(this,e);function i(a){a.length&&a.forEach(function(s){s.type==="label"&&!s.businessObject.name&&(s.hidden=!0)})}function r(a,s){var c=a.children,u=s,l,f;return l=MP(c).concat([a]),f=Jm(l),f?(u.width=Math.max(f.width,u.width),u.height=Math.max(f.height,u.height),u.x=f.x+(f.width-u.width)/2,u.y=f.y+(f.height-u.height)/2):(u.x=a.x+(a.width-u.width)/2,u.y=a.y+(a.height-u.height)/2),u}function o(a,s){return{x:a.x+(a.width-s.width)/2,y:a.y+(a.height-s.height)/2,width:s.width,height:s.height}}this.executed(["shape.toggleCollapse"],_p,function(a){var s=a.context,c=s.shape;w(c,"bpmn:SubProcess")&&(c.collapsed?Ke(c).isExpanded=!1:(i(c.children),Ke(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],_p,function(a){var s=a.context,c=s.shape;c.collapsed?Ke(c).isExpanded=!1:Ke(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],_p,function(a){var s=a.context.shape,c=t.getDefaultSize(s),u;s.collapsed?u=o(s,c):u=r(s,c),n.resizeShape(s,u,null,{autoResize:s.collapsed?!1:"nwse"})})}ye(xp,ee),xp.$inject=["eventBus","elementFactory","modeling"];function MP(e){return e.filter(function(t){return!t.hidden})}function wp(e,t,n,i){t.invoke(ee,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;je(a)||(w(a,"bpmn:Participant")&&Ue(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;w(r,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}ye(wp,ee),wp.$inject=["canvas","injector","moddle","modeling"];function Ep(e,t){ee.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;kP(r,o)&&t.updateProperties(o,{default:null})})}ye(Ep,ee),Ep.$inject=["eventBus","modeling"];function kP(e,t){if(!w(e,"bpmn:SequenceFlow"))return!1;var n=ie(t),i=ie(e);return n.get("default")===i}var OP=500,DP=5e3,Ug=["shape.create","shape.delete","shape.move","shape.resize"],qg=[...Ug,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function Sp(e,t){ee.call(this,e);var n;function i(){return n=n||new LP,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(qg,DP,function(){i()}),this.postExecuted(qg,OP,function(){o()}),this.preExecute(Ug,function(a){var s=a.context,c=s.shape,u=r();!c||c.labelTarget||(w(c,"bpmn:Lane")&&u.addLane(c),w(c,"bpmn:FlowNode")&&u.addFlowNode(c))})}Sp.$inject=["eventBus","modeling"],ye(Sp,ee);function LP(){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 IP=500,BP=5e3,Yg=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],Kg=[...Yg,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function Rp(e,t){ee.call(this,e);var n;function i(){return n=n||new NP,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(Kg,BP,function(){i()}),this.postExecuted(Kg,IP,function(){o()}),this.preExecute(Yg,function(a){var s=a.context.connection||a.context.shape,c=r();!s||s.labelTarget||(w(s,"bpmn:FlowElement")&&c.addFlowElement(s),w(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;w(s,"bpmn:Group")&&r().addGroup(s)})}Rp.$inject=["eventBus","modeling"],ye(Rp,ee);function NP(){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 Cp(e,t){ee.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)$P(o)&&!jP(o)&&t.updateProperties(o,{isForCompensation:void 0})})}ye(Cp,ee),Cp.$inject=["eventBus","modeling"];function $P(e){const t=ie(e);return t&&t.isForCompensation}function FP(e){return e&&w(e,"bpmn:BoundaryEvent")&&yo(e,"bpmn:CompensateEventDefinition")}function jP(e){return e.incoming.filter(n=>FP(n.source)).length>0}const HP={__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",Ll],appendBehavior:["type",Il],associationBehavior:["type",Nl],attachEventBehavior:["type",zs],artifactBehavior:["type",Bl],boundaryEventBehavior:["type",$l],categoryRootElementReferenceBehavior:["type",Fl],compensateBoundaryEventBehaviour:["type",jl],createBehavior:["type",Hl],createDataObjectBehavior:["type",zl],createParticipantBehavior:["type",Wl],dataInputAssociationBehavior:["type",Ul],dataStoreBehavior:["type",ql],deleteLaneBehavior:["type",Yl],detachEventBehavior:["type",Xs],dropOnFlowBehavior:["type",Xl],eventBasedGatewayBehavior:["type",Zl],fixHoverBehavior:["type",ag],groupBehavior:["type",Ql],importDockingFix:["type",cg],isHorizontalFix:["type",ep],labelBehavior:["type",np],layoutConnectionBehavior:["type",ip],messageFlowBehavior:["type",ap],nonInterruptingBehavior:["type",sp],removeElementBehavior:["type",up],removeEmbeddedLabelBoundsBehavior:["type",cp],removeParticipantBehavior:["type",lp],replaceConnectionBehavior:["type",pp],replaceElementBehaviour:["type",ic],resizeBehavior:["type",kg],resizeLaneBehavior:["type",Ng],rootElementReferenceBehavior:["type",mp],spaceToolBehavior:["type",Fg],subProcessPlaneBehavior:["type",Ni],subProcessStartEventBehavior:["type",yp],textAnnotationBehavior:["type",vp],toggleCollapseConnectionBehaviour:["type",bp],toggleElementCollapseBehaviour:["type",xp],unclaimIdBehavior:["type",wp],unsetDefaultFlowBehavior:["type",Ep],updateFlowNodeRefsBehavior:["type",Sp],updateCategoryValueRefsBehavior:["type",Rp],setCompensationActivityAfterPasteBehavior:["type",Cp]};function Pp(e){this._commandStack=e.get("commandStack",!1)}Pp.$inject=["injector"],Pp.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const xi={__init__:["rules"],rules:["type",Pp]};function Kn(e){ee.call(this,e),this.init()}Kn.$inject=["eventBus"],ye(Kn,ee),Kn.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)})},Kn.prototype.init=function(){};function Xg(e,t){var n=Qt(e,t,-15);return n!=="intersect"?n:null}function en(e){Kn.call(this,e)}ye(en,Kn),en.$inject=["eventBus"],en.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return zP(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 uc(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return uc(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 uy(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return ot(i)&&!lc(t,i)?!1:Pr(t,function(r){return ot(r)?uc(r.source,r.target,r):r.host?va(r,r.host,null,n):kp(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 iy(a)&&!n.includes(a.host)})?!1:va(n,t,null,i)||sy(n,t,i)||cy(n,t)||lc(n,t)}),this.addRule("shape.create",function(e){return kp(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return va(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return hy(n,t)})},en.prototype.canConnectMessageFlow=fy,en.prototype.canConnectSequenceFlow=dy,en.prototype.canConnectDataAssociation=Op,en.prototype.canConnectAssociation=ly,en.prototype.canConnectCompensationAssociation=py,en.prototype.canMove=cy,en.prototype.canAttach=va,en.prototype.canReplace=sy,en.prototype.canDrop=Po,en.prototype.canInsert=lc,en.prototype.canCreate=kp,en.prototype.canConnect=uc,en.prototype.canResize=uy,en.prototype.canCopy=hy;function zP(e){return Ap(e)?null:ze(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function Ap(e){return!e||je(e)}function Zg(e){do{if(w(e,"bpmn:Process"))return ie(e);if(w(e,"bpmn:Participant"))return ie(e).processRef||ie(e)}while(e=e.parent)}function Tp(e){return w(e,"bpmn:TextAnnotation")}function Mp(e){return w(e,"bpmn:Group")&&!e.labelTarget}function Qg(e){return w(e,"bpmn:BoundaryEvent")&&wi(e,"bpmn:CompensateEventDefinition")}function cc(e){return ie(e).isForCompensation}function GP(e,t){var n=Zg(e),i=Zg(t);return n===i}function VP(e){return w(e,"bpmn:InteractionNode")&&!w(e,"bpmn:BoundaryEvent")&&(!w(e,"bpmn:Event")||w(e,"bpmn:ThrowEvent")&&ty(e,"bpmn:MessageEventDefinition"))}function WP(e){return w(e,"bpmn:InteractionNode")&&!cc(e)&&(!w(e,"bpmn:Event")||w(e,"bpmn:CatchEvent")&&ty(e,"bpmn:MessageEventDefinition"))&&!(w(e,"bpmn:BoundaryEvent")&&!wi(e,"bpmn:MessageEventDefinition"))}function Jg(e){for(var t=e;t=t.parent;){if(w(t,"bpmn:FlowElementsContainer"))return ie(t);if(w(t,"bpmn:Participant"))return ie(t).processRef}return null}function ey(e,t){var n=Jg(e),i=Jg(t);return n===i}function wi(e,t){var n=ie(e);return!!lt(n.eventDefinitions||[],function(i){return w(i,t)})}function ty(e,t){var n=ie(e);return(n.eventDefinitions||[]).every(function(i){return w(i,t)})}function UP(e){return w(e,"bpmn:FlowNode")&&!w(e,"bpmn:EndEvent")&&!un(e)&&!(w(e,"bpmn:IntermediateThrowEvent")&&wi(e,"bpmn:LinkEventDefinition"))&&!Qg(e)&&!cc(e)}function qP(e){return w(e,"bpmn:FlowNode")&&!w(e,"bpmn:StartEvent")&&!w(e,"bpmn:BoundaryEvent")&&!un(e)&&!(w(e,"bpmn:IntermediateCatchEvent")&&wi(e,"bpmn:LinkEventDefinition"))&&!cc(e)}function YP(e){return w(e,"bpmn:ReceiveTask")||w(e,"bpmn:IntermediateCatchEvent")&&(wi(e,"bpmn:MessageEventDefinition")||wi(e,"bpmn:TimerEventDefinition")||wi(e,"bpmn:ConditionalEventDefinition")||wi(e,"bpmn:SignalEventDefinition"))}function KP(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function ny(e,t){var n=KP(t);return n.indexOf(e)!==-1}function uc(e,t,n){if(Ap(e)||Ap(t))return null;if(!w(n,"bpmn:DataAssociation")){if(fy(e,t))return{type:"bpmn:MessageFlow"};if(dy(e,t))return{type:"bpmn:SequenceFlow"}}var i=Op(e,t);return i||(py(e,t)?{type:"bpmn:Association",associationDirection:"One"}:ly(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function Po(e,t){return je(e)||Mp(e)?!0:w(t,"bpmn:Participant")&&!Ue(t)?!1:w(e,"bpmn:Participant")?w(t,"bpmn:Process")||w(t,"bpmn:Collaboration"):ze(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:w(e,"bpmn:Lane")?w(t,"bpmn:Participant")||w(t,"bpmn:Lane"):w(e,"bpmn:BoundaryEvent")&&!XP(e)?!1:w(e,"bpmn:FlowElement")&&!w(e,"bpmn:DataStoreReference")?w(t,"bpmn:FlowElementsContainer")?Ue(t):ze(t,["bpmn:Participant","bpmn:Lane"]):w(e,"bpmn:DataStoreReference")&&w(t,"bpmn:Collaboration")?qi(ie(t).get("participants"),function(n){return!!n.get("processRef")}):ze(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?ze(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):w(e,"bpmn:MessageFlow")?w(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function XP(e){return ie(e).cancelActivity&&(ry(e)||oy(e))}function iy(e){return!je(e)&&w(e,"bpmn:BoundaryEvent")}function ZP(e){return w(e,"bpmn:Lane")}function QP(e){return iy(e)||w(e,"bpmn:IntermediateThrowEvent")&&ry(e)?!0:w(e,"bpmn:IntermediateCatchEvent")&&oy(e)}function ry(e){var t=ie(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function oy(e){return ay(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function ay(e,t){return t.some(function(n){return wi(e,n)})}function JP(e){return w(e,"bpmn:ReceiveTask")&&lt(e.incoming,function(t){return w(t.source,"bpmn:EventBasedGateway")})}function va(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return je(r)||!QP(r)||un(t)||!w(t,"bpmn:Activity")||cc(t)||i&&!Xg(i,t)||JP(t)?!1:"attach"}function sy(e,t,n){if(!t)return!1;var i={replacements:[]};return I(e,function(r){un(t)||w(r,"bpmn:StartEvent")&&r.type!=="label"&&Po(r,t)&&(cR(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(uR(r)||lR(r)||pR(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),ay(r,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&w(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"})),w(t,"bpmn:Transaction")||wi(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(w(r,"bpmn:EndEvent")&&Po(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),w(r,"bpmn:BoundaryEvent")&&va(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function cy(e,t){return qi(e,ZP)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return Po(n,t)})}function kp(e,t,n,i){return t?je(e)||Mp(e)?!0:Po(e,t)||lc(e,t):!1}function uy(e,t,n){return w(e,"bpmn:SubProcess")?Ue(e)&&(!t||t.width>=100&&t.height>=80):w(e,"bpmn:Lane")||w(e,"bpmn:Participant")?!0:Tp(e)?n?n==="e"||n==="w":!0:Mp(e)?!0:je(e)?n?n==="e"||n==="w":!0:!1}function eA(e,t){var n=Tp(e),i=Tp(t);return(n||i)&&n!==i}function ly(e,t){return ny(t,e)||ny(e,t)?!1:eA(e,t)?!0:!!Op(e,t)}function py(e,t){return ey(e,t)&&Qg(e)&&w(t,"bpmn:Activity")&&!nA(t,e)&&!un(t)}function fy(e,t){return gy(e)&&!gy(t)?!1:VP(e)&&WP(t)&&!GP(e,t)}function dy(e,t){return UP(e)&&qP(t)&&ey(e,t)&&!(w(e,"bpmn:EventBasedGateway")&&!YP(t))}function Op(e,t){return ze(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&ze(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:ze(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&ze(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function lc(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:ze(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!je(t)&&w(e,"bpmn:FlowNode")&&!w(e,"bpmn:BoundaryEvent")&&Po(e,t.parent)}function Dp(e,t){return e&&t&&e.indexOf(t)!==-1}function hy(e,t){return je(t)?!0:!(w(t,"bpmn:Lane")&&!Dp(e,t.parent)||w(t,"bpmn:MessageFlow")&&!tA(e,t))}function tA(e,t){var n=my(t.source),i=my(t.target);return Dp(e,n)&&Dp(e,i)}function my(e){for(;e;e=e.parent)if(w(e,"bpmn:Participant"))return e;return null}function gy(e){return _o(e,"bpmn:Process")||_o(e,"bpmn:Collaboration")}function nA(e,t){return e.attachers.includes(t)}const iA={__depends__:[xi],__init__:["bpmnRules"],bpmnRules:["type",en]};var rA=2e3;function yy(e,t){e.on("saveXML.start",rA,n);function n(){var i=t.getRootElements();I(i,function(r){var o=Ke(r),a,s;a=ta([r]),a=Ge(a,function(c){return c!==r&&!c.labelTarget}),s=on(a,Ke),o.set("planeElement",s)})}}yy.$inject=["eventBus","canvas"];const oA={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",yy]};function pc(e){ee.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)})}pc.prototype.getOrdering=function(e,t){return null},ye(pc,ee);function Lp(e,t){pc.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=lt(n,function(c){return ze(a,[c.type])});return s&&s.order||{level:1}}function r(a){var s=a.order;if(s||(a.order=s=i(a)),!s)throw new Error(`no order for <${a.id}>`);return s}function o(a,s,c){for(var u=s;u&&!ze(u,c);)u=u.parent;if(!u)throw new Error(`no parent for <${a.id}> in <${s&&s.id}>`);return u}this.getOrdering=function(a,s){if(a.labelTarget||w(a,"bpmn:TextAnnotation"))return{parent:t.findRoot(s)||t.getRootElement(),index:-1};var c=r(a);c.containers&&(s=o(a,s,c.containers));var u=s.children.indexOf(a),l=fd(s.children,function(f){return!a.labelTarget&&f.labelTarget?!1:c.level<r(f).level});return l!==-1&&u!==-1&&u<l&&(l-=1),{index:l,parent:s}}}Lp.$inject=["eventBus","canvas"],ye(Lp,pc);const aA={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Lp]};function ba(){}ba.prototype.get=function(){return this._data},ba.prototype.set=function(e){this._data=e},ba.prototype.clear=function(){var e=this._data;return delete this._data,e},ba.prototype.isEmpty=function(){return!this._data};const sA={clipboard:["type",ba]};var vy=1500;function by(e,t,n){var i=this,r=n.get("dragging",!1);function o(a){if(!a.hover){var s=a.originalEvent,c=i._findTargetGfx(s),u=c&&e.get(c);c&&u&&(a.stopPropagation(),r.hover({element:u,gfx:c}),r.move(s))}}r&&t.on("drag.start",function(a){t.once("drag.move",vy,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",vy,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=Nr(a),c=document.elementFromPoint(s.x,s.y),cA(c)}}by.$inject=["elementRegistry","eventBus","injector"];function cA(e){return kr(e,"svg, .djs-element",!0)}const uA={__init__:["hoverFix"],hoverFix:["type",by]};function lA(e){return!0}function fc(e){return cr(e)||mP(e)}var _y=500;function xy(e,t,n){var i=this;function r(T,j,k){if(!s(T,j)){var D,z,se;k?z=t.getGraphics(k):(D=j.delegateTarget||j.target,D&&(z=D,k=t.get(z))),!(!z||!k)&&(se=e.fire(T,{element:k,gfx:z,originalEvent:j}),se===!1&&(j.stopPropagation(),j.preventDefault()))}}var o={};function a(T){return o[T]}function s(T,j){var k=u[T]||cr;return!k(j)}var c={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},u={"element.contextmenu":lA,"element.mousedown":fc,"element.mouseup":fc,"element.click":fc,"element.dblclick":fc};function l(T,j,k){var D=c[T];if(!D)throw new Error("unmapped DOM event name <"+T+">");return r(D,j,k)}var f="svg, .djs-element";function p(T,j,k,D){var z=o[k]=function(se){r(k,se)};D&&(u[k]=D),z.$delegate=Rn.bind(T,f,j,z)}function d(T,j,k){var D=a(k);D&&Rn.unbind(T,j,D.$delegate)}function g(T){I(c,function(j,k){p(T,k,j)})}function h(T){I(c,function(j,k){d(T,k,j)})}e.on("canvas.destroy",function(T){h(T.svg)}),e.on("canvas.init",function(T){g(T.svg)}),e.on(["shape.added","connection.added"],function(T){var j=T.element,k=T.gfx;e.fire("interactionEvents.createHit",{element:j,gfx:k})}),e.on(["shape.changed","connection.changed"],_y,function(T){var j=T.element,k=T.gfx;e.fire("interactionEvents.updateHit",{element:j,gfx:k})}),e.on("interactionEvents.createHit",_y,function(T){var j=T.element,k=T.gfx;i.createDefaultHit(j,k)}),e.on("interactionEvents.updateHit",function(T){var j=T.element,k=T.gfx;i.updateDefaultHit(j,k)});var m=P("djs-hit djs-hit-stroke"),_=P("djs-hit djs-hit-click-stroke"),y=P("djs-hit djs-hit-all"),x=P("djs-hit djs-hit-no-move"),S={all:y,"click-stroke":_,stroke:m,"no-move":x};function P(T,j){return j=V({stroke:"white",strokeWidth:15},j||{}),n.cls(T,["no-fill","no-border"],j)}function C(T,j){var k=S[j];if(!k)throw new Error("invalid hit type <"+j+">");return ve(T,k),T}function L(T,j){Ne(T,j)}this.removeHits=function(T){var j=Es(".djs-hit",T);I(j,Ft)},this.createDefaultHit=function(T,j){var k=T.waypoints,D=T.isFrame,z;return k?this.createWaypointsHit(j,k):(z=D?"stroke":"all",this.createBoxHit(j,z,{width:T.width,height:T.height}))},this.createWaypointsHit=function(T,j){var k=ea(j);return C(k,"stroke"),L(T,k),k},this.createBoxHit=function(T,j,k){k=V({x:0,y:0},k);var D=Ae("rect");return C(D,j),ve(D,k),L(T,D),D},this.updateDefaultHit=function(T,j){var k=rt(".djs-hit",j);if(k)return T.waypoints?_l(k,T.waypoints):ve(k,{width:T.width,height:T.height}),k},this.fire=r,this.triggerMouseEvent=l,this.mouseHandler=a,this.registerEvent=p,this.unregisterEvent=d}xy.$inject=["eventBus","elementRegistry","styles"];const dc={__init__:["interactionEvents"],interactionEvents:["type",xy]};function Ao(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)})}Ao.$inject=["eventBus","canvas"],Ao.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()})}},Ao.prototype.get=function(){return Array.from(this._selectedElements)},Ao.prototype.isSelected=function(e){return this._selectedElements.has(e)},Ao.prototype.select=function(e,t){var n=this.get();Oe(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?I(e,o=>{this._selectedElements.add(o)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var wy="hover",Ey="selected";function Sy(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,wy)}),t.on("element.out",function(r){i(r.element,wy)}),t.on("selection.changed",function(r){function o(u){i(u,Ey)}function a(u){n(u,Ey)}var s=new Set(r.oldSelection),c=new Set(r.newSelection);for(let u of s)c.has(u)||o(u);for(let u of c)s.has(u)||a(u)})}Sy.$inject=["canvas","eventBus"];function Ry(e,t,n,i){e.on("create.end",500,function(r){var o=r.context,a=o.canExecute,s=o.elements,c=o.hints||{},u=c.autoSelect;if(a){if(u===!1)return;Oe(u)?t.select(u):t.select(s.filter(pA))}}),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=lt(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(cr(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=ac(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}Ry.$inject=["eventBus","selection","canvas","elementRegistry"];function pA(e){return!e.hidden}const Xn={__init__:["selectionVisuals","selectionBehavior"],__depends__:[dc],selection:["type",Ao],selectionVisuals:["type",Sy],selectionBehavior:["type",Ry]};var fA=/^djs-cursor-.*$/;function hc(e){var t=vt(document.body);t.removeMatching(fA),e&&t.add("djs-cursor-"+e)}function Cy(){hc(null)}var dA=5e3;function Py(e,t){t=t||"element.click";function n(){return!1}return e.once(t,dA,n),function(){e.off(t,n)}}var hA=["c","C"],mA=["v","V"],gA=["d","D"],yA=["x","X"],vA=["y","Y"],Ay=["z","Z"];function bA(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function An(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function jt(e,t){return e=Oe(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function Ip(e){return e.shiftKey}function _A(e){return An(e)&&jt(hA,e)}function xA(e){return An(e)&&jt(mA,e)}function wA(e){return An(e)&&jt(gA,e)}function EA(e){return An(e)&&jt(yA,e)}function SA(e){return An(e)&&!Ip(e)&&jt(Ay,e)}function RA(e){return An(e)&&(jt(vA,e)||jt(Ay,e)&&Ip(e))}var To=Math.round,Ty="djs-drag-active";function Fr(e){e.preventDefault()}function CA(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function PA(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function My(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(x){var S=t.viewbox(),P=t._container.getBoundingClientRect();return{x:S.x+(x.x-P.left)/S.scale,y:S.y+(x.y-P.top)/S.scale}}function s(x,S){S=S||o;var P=e.createEvent(V({},S.payload,S.data,{isTouch:S.isTouch}));return e.fire("drag."+x,P)===!1?!1:e.fire(S.prefix+"."+x,P)}function c(x){var S=x.filter(function(P){return i.get(P.id)});S.length&&n.select(S)}function u(x,S){var P=o.payload,C=o.displacement,L=o.globalStart,T=Nr(x),j=ai(T,L),k=o.localStart,D=a(T),z=ai(D,k);if(!o.active&&(S||PA(j)>o.threshold)){if(V(P,{x:To(k.x+C.x),y:To(k.y+C.y),dx:0,dy:0},{originalEvent:x}),s("start")===!1)return m();o.active=!0,o.keepSelection||(P.previousSelection=n.get(),n.select(null)),o.cursor&&hc(o.cursor),t.addMarker(t.getRootElement(),Ty)}hp(x),o.active&&(V(P,{x:To(D.x+C.x),y:To(D.y+C.y),dx:To(z.x),dy:To(z.y)},{originalEvent:x}),s("move"))}function l(x){var S,P=!0;o.active&&(x&&(o.payload.originalEvent=x,hp(x)),P=s("end")),P===!1&&s("rejected"),S=_(P!==!0),s("ended",S)}function f(x){jt("Escape",x)&&(Fr(x),m())}function p(x){var S;o.active&&(S=Py(e),setTimeout(S,400),Fr(x)),l(x)}function d(x){u(x)}function g(x){var S=o.payload;S.hoverGfx=x.gfx,S.hover=x.element,s("hover")}function h(x){s("out");var S=o.payload;S.hoverGfx=null,S.hover=null}function m(x){var S;if(o){var P=o.active;P&&s("cancel"),S=_(x),P&&s("canceled",S)}}function _(x){var S,P;s("cleanup"),Cy(),o.trapClick?P=p:P=l,Be.unbind(document,"mousemove",u),Be.unbind(document,"dragstart",Fr),Be.unbind(document,"selectstart",Fr),Be.unbind(document,"mousedown",P,!0),Be.unbind(document,"mouseup",P,!0),Be.unbind(document,"keyup",f),Be.unbind(document,"touchstart",d,!0),Be.unbind(document,"touchcancel",m,!0),Be.unbind(document,"touchmove",u,!0),Be.unbind(document,"touchend",l,!0),e.off("element.hover",g),e.off("element.out",h),t.removeMarker(t.getRootElement(),Ty);var C=o.payload.previousSelection;return x!==!1&&C&&!n.get().length&&c(C),S=o,o=null,S}function y(x,S,P,C){o&&m(!1),typeof S=="string"&&(C=P,P=S,S=null),C=V({},r,C||{});var L=C.data||{},T,j,k,D,z;if(C.trapClick?D=p:D=l,x?(T=Co(x)||x,j=Nr(x),hp(x),T.type==="dragstart"&&Fr(T)):(T=null,j={x:0,y:0}),k=a(j),S||(S=k),z=CA(T),o=V({prefix:P,data:L,payload:{},globalStart:j,displacement:ai(S,k),localStart:k,isTouch:z},C),C.manual||(z?(Be.bind(document,"touchstart",d,!0),Be.bind(document,"touchcancel",m,!0),Be.bind(document,"touchmove",u,!0),Be.bind(document,"touchend",l,!0)):(Be.bind(document,"mousemove",u),Be.bind(document,"dragstart",Fr),Be.bind(document,"selectstart",Fr),Be.bind(document,"mousedown",D,!0),Be.bind(document,"mouseup",D,!0)),Be.bind(document,"keyup",f),e.on("element.hover",g),e.on("element.out",h)),s("init")===!1)return m(),!1;C.autoActivate&&u(x,!0)}e.on("diagram.destroy",m),this.init=y,this.move=u,this.hover=g,this.out=h,this.end=l,this.cancel=m,this.context=function(){return o},this.setOptions=function(x){V(r,x)}}My.$inject=["eventBus","canvas","selection","elementRegistry"];const $i={__depends__:[uA,Xn],dragging:["type",My]};function Mo(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}Mo.prototype.next=function(){return this._prefix+ ++this._counter};const AA=new Mo("ps");var TA=["marker-start","marker-mid","marker-end"],MA=["circle","ellipse","line","path","polygon","polyline","path","rect"];function ur(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}ur.$inject=["elementRegistry","eventBus","canvas","styles"],ur.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")},ur.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},ur.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=Gh(n);return this._cloneMarkers(Lr(r),i),ve(r,this._styles.cls(i,[])),Ne(t,r),ve(r,"data-preview-support-element-id",e.id),r},ur.prototype.addFrame=function(e,t){var n=Ae("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return Ne(t,n),ve(n,"data-preview-support-element-id",e.id),n},ur.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),LA(e)&&TA.forEach(function(r){if(ve(e,r)){var o=kA(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},ur.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,AA.next()].join("-"),a=rt("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||Gh(n);s.id=o,Ye(s).add(r);var c=rt(":scope > defs",e);c||(c=Ae("defs"),Ne(e,c)),Ne(c,s);var u=DA(s.id);ve(t,i,u)};function kA(e,t,n){var i=OA(ve(e,t));return rt("marker#"+i,n||document)}function OA(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function DA(e){return"url(#"+e+")"}function LA(e){return MA.indexOf(e.nodeName)!==-1}const ko={__init__:["previewSupport"],previewSupport:["type",ur]};var IA="drop-ok",ky="drop-not-ok",Oy="attach-ok",Dy="new-parent",Ly="create",BA=2e3;function Iy(e,t,n,i,r){function o(c,u,l,f,p){if(!u)return!1;c=Ge(c,function(y){var x=y.labelTarget;return!y.parent&&!(je(y)&&c.indexOf(x)!==-1)});var d=lt(c,function(y){return!ot(y)}),g=!1,h=!1,m=!1;Ny(c)&&(g=r.allowed("shape.attach",{position:l,shape:d,target:u})),g||(Ny(c)?m=r.allowed("shape.create",{position:l,shape:d,source:f,target:u}):m=r.allowed("elements.create",{elements:c,position:l,target:u}));var _=p.connectionTarget;return m||g?(d&&f&&(h=r.allowed("connection.create",{source:_===f?d:f,target:_===f?f:d,hints:{targetParent:u,targetAttach:g}})),{attach:g,connect:h}):m===null||g===null?null:!1}function a(c,u){[Oy,IA,ky,Dy].forEach(function(l){l===u?e.addMarker(c,l):e.removeMarker(c,l)})}n.on(["create.move","create.hover"],function(c){var u=c.context,l=u.elements,f=c.hover,p=u.source,d=u.hints||{};if(!f){u.canExecute=!1,u.target=null;return}By(c);var g={x:c.x,y:c.y},h=u.canExecute=f&&o(l,f,g,p,d);f&&h!==null&&(u.target=f,h&&h.attach?a(f,Oy):a(f,h?Dy:ky))}),n.on(["create.end","create.out","create.cleanup"],function(c){var u=c.hover;u&&a(u,null)}),n.on("create.end",function(c){var u=c.context,l=u.source,f=u.shape,p=u.elements,d=u.target,g=u.canExecute,h=g&&g.attach,m=g&&g.connect,_=u.hints||{};if(g===!1||!d)return!1;By(c);var y={x:c.x,y:c.y};m?f=i.appendShape(l,f,y,d,{attach:h,connection:m===!0?{}:m,connectionTarget:_.connectionTarget}):(p=i.createElements(p,y,d,V({},_,{attach:h})),f=lt(p,function(x){return!ot(x)})),V(u,{elements:p,shape:f}),V(c,{elements:p,shape:f})});function s(){var c=t.context();c&&c.prefix===Ly&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],BA,function(){n.off("elements.changed",s)})}),this.start=function(c,u,l){Oe(u)||(u=[u]);var f=lt(u,function(g){return!ot(g)});if(f){l=V({elements:u,hints:{},shape:f},l||{}),I(u,function(g){Ie(g.x)||(g.x=0),Ie(g.y)||(g.y=0)});var p=Ge(u,function(g){return!g.hidden}),d=kt(p);I(u,function(g){ot(g)&&(g.waypoints=on(g.waypoints,function(h){return{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2}})),V(g,{x:g.x-d.x-d.width/2,y:g.y-d.y-d.height/2})}),t.init(c,Ly,{cursor:"grabbing",autoActivate:!0,data:{shape:f,elements:u,context:l}})}}}Iy.$inject=["canvas","dragging","eventBus","modeling","rules"];function By(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 Ny(e){return e&&e.length===1&&!ot(e[0])}var NA=750;function $y(e,t,n,i,r){function o(a){var s=Ae("g");ve(s,r.cls("djs-drag-group",["no-events"]));var c=Ae("g");return a.forEach(function(u){var l;u.hidden||(u.waypoints?(l=n._createContainer("connection",c),n.drawConnection(Lr(l),u)):(l=n._createContainer("shape",c),n.drawShape(Lr(l),u),Jt(l,u.x,u.y)),i.addDragger(u,s,l))}),s}t.on("create.move",NA,function(a){var s=a.hover,c=a.context,u=c.elements,l=c.dragGroup;l||(l=c.dragGroup=o(u));var f;s?(l.parentNode||(f=e.getActiveLayer(),Ne(f,l)),Jt(l,a.x,a.y)):Ft(l)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&Ft(c)})}$y.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const mc={__depends__:[$i,ko,xi,Xn],__init__:["create","createPreview"],create:["type",Iy],createPreview:["type",$y]};function Bp(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)})}Bp.$inject=["eventBus"],Bp.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||$A(0,0)};function $A(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 _a={__init__:["mouse"],mouse:["type",Bp]};var Fy=2e3;function Tn(e,t,n,i,r,o,a,s){this._canvas=e,this._create=t,this._elementFactory=i,this._eventBus=r,this._modeling=o,this._mouse=a,this._rules=s,r.on("copyPaste.copyElement",function(c){var u=c.descriptor,l=c.element,f=c.elementsSet;u.priority=1,u.id=l.id,f.has(l.parent)&&(u.parent=l.parent.id),FA(l)&&(u.priority=2,u.host=l.host.id),ot(l)&&(u.priority=3,u.source=l.source.id,u.target=l.target.id,u.waypoints=jA(l)),je(l)&&(u.priority=4,u.labelTarget=l.labelTarget.id),I(["x","y","width","height"],function(p){Ie(l[p])&&(u[p]=l[p])}),u.hidden=l.hidden,u.collapsed=l.collapsed}),r.on("copyPaste.elementsCopied",Fy,function(c){var u;((u=c.hints)==null?void 0:u.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",Fy,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var u=c.hints;V(u,{createElementsBehavior:!1})})}Tn.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],Tn.prototype.copy=function(e,t={}){var n,i;return Oe(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(Oe(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},Tn.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})}}},Tn.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},Tn.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},Tn.prototype._getElementIdsFromTree=function(e){var t={};return I(e,function(n){I(n,function(i){i.id&&(t[i.id]=!0)})}),t},Tn.prototype._paste=function(e,t,n,i){I(e,function(o){Ie(o.x)||(o.x=0),Ie(o.y)||(o.y=0)});var r=kt(e);return I(e,function(o){ot(o)&&(o.waypoints=on(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),V(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,V({},i))},Tn.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return I(e,function(o,a){o=ui(o,"priority"),I(o,function(s){var c=V({},li(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var u;if(ot(c)){c.source=i[s.source],c.target=i[s.target],u=i[s.id]=t.createConnection(c),r.push(u);return}if(je(c)){c.labelTarget=i[c.labelTarget],u=i[s.id]=t.createLabel(c),r.push(u);return}c.host&&(c.host=i[c.host]),u=i[s.id]=t.createShape(c),r.push(u)})}),r},Tn.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(li(e,["id"]));return t},Tn.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(li(e,["id"]));return t},Tn.prototype.createShape=function(e){var t=this._elementFactory.createShape(li(e,["id"]));return t},Tn.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(ot(e)&&(!n.has(e.source)||!n.has(e.target))||je(e)&&!n.has(e.labelTarget))},Tn.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=Ps(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 g={element:f,depth:p};r.push(g),o.set(f,g);return}if(d.depth<p){r=u(d,r);var h={element:d.element,depth:p};r.push(h),o.set(f,h)}}function u(f,p){var d=p.indexOf(f);return d!==-1&&p.splice(d,1),p}Dr(a,function(f,p,d){if(je(f))return;I(f.labels,function(m){c(m,d)});function g(m){m&&m.length&&I(m,function(_){I(_.labels,function(y){c(y,d)}),c(_,d)})}I([f.attachers,f.incoming,f.outgoing],g),c(f,d);var h=[];return f.children&&(h=f.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:f,children:h}),h}),e=on(r,function(f){return f.element});var l=new Set(e);return r=on(r,function(f){return f.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:f.descriptor,element:f.element,elements:e,elementsSet:l}),f}),r=ui(r,function(f){return f.descriptor.priority}),e=on(r,function(f){return f.element}),I(r,function(f){var p=f.depth;if(!n.hasRelations(f.element,e,l)){Hy(f.element,e),l.delete(f.element);return}if(!s(f.element,e)){Hy(f.element,e),l.delete(f.element);return}i[p]||(i[p]=[]),i[p].push(f.descriptor)}),i};function FA(e){return!!e.host}function jA(e){return on(e.waypoints,function(t){return t=jy(t),t.original&&(t.original=jy(t.original)),t})}function jy(e){return V({},e)}function Hy(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const HA={__depends__:[sA,mc,_a,xi],__init__:["copyPaste"],copyPaste:["type",Tn]};function Np(e,t,n){Oe(n)||(n=[n]),I(n,function(i){Cr(e[i])||(t[i]=e[i])})}var $p=750;function zy(e,t,n){function i(c,u){var l=e.create(c.$type);return n.copyElement(c,l,null,u)}t.on("copyPaste.copyElement",$p,function(c){var u=c.descriptor,l=c.element,f=ie(l);if(je(l))return u;var p=u.businessObject=i(f,!0),d=u.di=i(Ke(l),!0);d.bpmnElement=p,Np(p,u,"name"),Np(d,u,"isExpanded"),f.default&&(u.default=f.default.id)});var r="-bpmn-js-refs";function o(c){return c[r]=c[r]||{}}function a(c,u){c[r]=u}function s(c,u,l){var f=ie(c);return c.default&&(l[c.default]={element:f,property:"default"}),c.host&&(ie(c).attachedToRef=ie(u[c.host])),li(l,En(l,function(p,d,g){var h=d.element,m=d.property;return g===c.id&&(h.set(m,f),p.push(c.id)),p},[]))}t.on("copyPaste.pasteElement",function(c){var u=c.cache,l=c.descriptor,f=l.businessObject,p=l.di;if(je(l)){l.businessObject=ie(u[l.labelTarget]),l.di=Ke(u[l.labelTarget]);return}f=l.businessObject=i(f),p=l.di=i(p),p.bpmnElement=f,Np(l,f,["isExpanded","name"]),l.type=f.$type}),t.on("copyPaste.copyElement",$p,function(c){var u=c.descriptor,l=c.element;if(w(l,"bpmn:Participant")){var f=ie(l);f.processRef&&(u.processRef=i(f.processRef,!0))}}),t.on("copyPaste.pasteElement",function(c){var u=c.descriptor,l=u.processRef;l&&(u.processRef=i(l))}),t.on("copyPaste.createTree",function(c){var u=c.element,l=c.children;w(u,"bpmn:SubProcess")&&I(sa(l),f=>{l.push(f.annotation)})}),t.on("copyPaste.pasteElement",$p,function(c){var u=c.cache,l=c.descriptor;a(u,s(l,u,o(u)))})}zy.$inject=["bpmnFactory","eventBus","moddleCopy"];const zA=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],GA=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function xa(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 ui(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=Wt(r)&&r.$descriptor;if(a&&GA.includes(a))return o;if(a&&zA.includes(a)||a&&s&&!lt(s.properties,no({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:r}=i;if(w(r,"bpmn:ExtensionElements")&&(!r.values||!r.values.length))return!1})}xa.$inject=["eventBus","bpmnFactory","moddle"],xa.prototype.copyElement=function(e,t,n,i=!1){n&&!Oe(n)&&(n=[n]),n=n||Fp(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(Oe(r)&&(n=r),I(n,o=>{let a;wn(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!Nt(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},xa.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 Wt(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):Oe(e)?En(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):Wt(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},xa.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 Fp(e,t){return En(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const Gy={__depends__:[HA],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",zy],moddleCopy:["type",xa]};var Vy=Math.round;function jp(e,t){this._modeling=e,this._eventBus=t}jp.$inject=["modeling","eventBus"],jp.prototype.replaceElement=function(e,t,n){if(e.waypoints)return null;var i=this._modeling,r=this._eventBus;r.fire("replace.start",{element:e,attrs:t,hints:n});var o=t.width||e.width,a=t.height||e.height,s=t.x||e.x,c=t.y||e.y,u=Vy(s+o/2),l=Vy(c+a/2),f=i.replaceShape(e,V({},t,{x:u,y:l,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:f,hints:n}),f};function Wy(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}Wy.$inject=["selection","eventBus"];const VA={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Wy],replace:["type",jp]};function WA(e,t,n){Oe(n)||(n=[n]),I(n,function(i){Cr(e[i])||(t[i]=e[i])})}var UA=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function qA(e,t){var n=e&&wn(e,"collapsed")?e.collapsed:!Ue(e),i;return t&&(wn(t,"collapsed")||wn(t,"isExpanded"))?i=wn(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function Uy(e,t,n,i,r,o){function a(s,c,u){u=u||{};var l=c.type,f=s.businessObject;if(gc(f)&&(l==="bpmn:SubProcess"||l==="bpmn:AdHocSubProcess")&&qA(s,c))return i.toggleCollapse(s),s;var p=e.create(l),d={type:l,businessObject:p};d.di={},l==="bpmn:ExclusiveGateway"&&(d.di.isMarkerVisible=!0),WA(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var g=Fp(f.$descriptor),h=Fp(p.$descriptor,!0),m=YA(g,h);V(p,ri(c,UA));var _=Ge(m,function(S){return S==="eventDefinitions"?qy(s,c.eventDefinitionType):S==="loopCharacteristics"?!un(p):wn(p,S)||S==="processRef"&&c.isExpanded===!1||S==="triggeredByEvent"?!1:S==="isForCompensation"?!un(p):!0});if(p=n.copyElement(f,p,_),c.eventDefinitionType&&(qy(p,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),w(f,"bpmn:Activity")){if(gc(f))d.isExpanded=Ue(s);else if(c&&wn(c,"isExpanded")){d.isExpanded=c.isExpanded;var y=t.getDefaultSize(p,{isExpanded:d.isExpanded});d.width=y.width,d.height=y.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}Ue(s)&&!w(f,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(gc(f)&&!gc(p)&&(u.moveChildren=!1),w(f,"bpmn:Participant")){c.isExpanded===!0?p.processRef=e.create("bpmn:Process"):u.moveChildren=!1;var x=Yt(s);Ke(s).isHorizontal||(Ke(d).isHorizontal=x),d.width=x?s.width:t.getDefaultSize(d).width,d.height=x?t.getDefaultSize(d).height:s.height}return o.allowed("shape.resize",{shape:p})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),p.name=f.name,ze(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&ze(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(p.default=f.default),c.host&&!w(f,"bpmn:BoundaryEvent")&&w(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,{...u,targetElement:c})}this.replaceElement=a}Uy.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function gc(e){return w(e,"bpmn:SubProcess")}function qy(e,t){var n=ie(e);return t&&n.get("eventDefinitions").some(function(i){return w(i,t)})}function YA(e,t){return e.filter(function(n){return t.includes(n)})}const Yy={__depends__:[Gy,VA,Xn],bpmnReplace:["type",Uy]};var KA=250;function jr(e){this._eventBus=e,this._tools=[],this._active=null}jr.$inject=["eventBus"],jr.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)},jr.prototype.isActive=function(e){return e&&this._active===e},jr.prototype.length=function(e){return this._tools.length},jr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},jr.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),I(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,KA,function(r){this._active&&(XA(r)||this.setActive(null))},this)};function XA(e){var t=e.originalEvent&&e.originalEvent.target;return t&&kr(t,'.group[data-group="tools"]')}const yc={__depends__:[$i],__init__:["toolManager"],toolManager:["type",jr]};function ZA(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 QA(e,t){var n=[],i=new Set(e);I(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,s=o.outgoing;I(a.concat(s),function(c){var u=c.source,l=c.target;(i.has(u)||i.has(l))&&(r.has(c)||(r.add(c),n.push(c)))})}),n}function JA(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 Hp=Math.abs,eT=Math.round,Fi={x:"width",y:"height"},Ky="crosshair",lr={n:"top",w:"left",s:"bottom",e:"right"},tT=1500,vc={n:"s",w:"e",s:"n",e:"w"},bc=20;function Zn(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",tT,function(c){var u=c.context,l=u.initialized;l||(l=u.initialized=s.init(c,u)),l&&Zy(c)}),n.on("spaceTool.end",function(c){var u=c.context,l=u.axis,f=u.direction,p=u.movingShapes,d=u.resizingShapes,g=u.start;if(u.initialized){Zy(c);var h={x:0,y:0};h[l]=eT(c["d"+l]),s.makeSpace(p,d,h,f,g),n.once("spaceTool.ended",function(m){s.activateSelection(m.originalEvent,!0,!0)})}})}Zn.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Zn.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:Ky,data:{context:{reactivate:n}},trapClick:!1})},Zn.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:Ky,data:{context:{}}})},Zn.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},Zn.prototype.init=function(e,t){var n=Hp(e.dx)>Hp(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(Hp(i)<5)return!1;i<0&&(i*=-1),ya(e)&&(i*=-1);var o=ZA(n,i),a=this._canvas.getRootElement();!ac(e)&&e.hover&&(a=e.hover);var s=[...ta(a),...a.attachers||[]],c=this.calculateAdjustments(s,n,i,r),u=this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:c.resizingShapes,start:r}),l=nT(c,n,o,r,u);return V(t,c,{axis:n,direction:o,spaceToolConstraints:l,start:r}),hc("resize-"+(n==="x"?"ew":"ns")),!0},Zn.prototype.calculateAdjustments=function(e,t,n,i){var r=this._rules,o=[],a=[],s=new Set,c=new Set,u=[],l=[];function f(d){s.has(d)||(s.add(d),o.push(d));var g=d.label;g&&!s.has(g)&&(s.add(g),o.push(g))}function p(d){c.has(d)||(c.add(d),a.push(d))}return I(e,function(d){if(!(!d.parent||je(d))){if(ot(d)){l.push(d);return}var g=d[t],h=g+d[Fi[t]];if(iT(d)&&(n>0&&De(d)[t]>i||n<0&&De(d)[t]<i)){u.push(d);return}if(n>0&&g>i||n<0&&h<i){f(d);return}if(g<i&&h>i&&r.allowed("shape.resize",{shape:d})){p(d);return}}}),I(o,function(d){var g=d.attachers;g&&I(g,function(h){f(h)})}),I(u,function(d){var g=d.host;(s.has(g)||c.has(g))&&f(d)}),I(l,function(d){var g=d.source,h=d.target,m=d.label;(s.has(g)||c.has(g))&&(s.has(h)||c.has(h))&&m&&f(m)}),{movingShapes:o,resizingShapes:a}},Zn.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Zn.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function Xy(e){return{top:e.top-bc,right:e.right+bc,bottom:e.bottom+bc,left:e.left-bc}}function Zy(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;Ie(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),Ie(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),Ie(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),Ie(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function nT(e,t,n,i,r){var o=e.movingShapes,a=e.resizingShapes;if(a.length){var s={},c,u,l=new Set(o),f=new Set(a);return I(a,function(p){var d=p.attachers,g=p.children,h=Te(p),m=Ge(g,function(z){return!ot(z)&&!je(z)&&!l.has(z)&&!f.has(z)}),_=Ge(g,function(z){return!ot(z)&&!je(z)&&l.has(z)}),y,x,S,P=[],C=[],L,T,j,k;m.length&&(x=Xy(Te(kt(m))),y=i-h[lr[n]]+x[lr[n]],n==="n"?s.bottom=u=Ie(u)?Math.min(u,y):y:n==="w"?s.right=u=Ie(u)?Math.min(u,y):y:n==="s"?s.top=c=Ie(c)?Math.max(c,y):y:n==="e"&&(s.left=c=Ie(c)?Math.max(c,y):y)),_.length&&(S=Xy(Te(kt(_))),y=i-S[lr[vc[n]]]+h[lr[vc[n]]],n==="n"?s.bottom=u=Ie(u)?Math.min(u,y):y:n==="w"?s.right=u=Ie(u)?Math.min(u,y):y:n==="s"?s.top=c=Ie(c)?Math.max(c,y):y:n==="e"&&(s.left=c=Ie(c)?Math.max(c,y):y)),d&&d.length&&(d.forEach(function(z){l.has(z)?P.push(z):C.push(z)}),P.length&&(L=Te(kt(P.map(De))),T=h[lr[vc[n]]]-(L[lr[vc[n]]]-i)),C.length&&(j=Te(kt(C.map(De))),k=j[lr[n]]-(h[lr[n]]-i)),n==="n"?(y=Math.min(T||1/0,k||1/0),s.bottom=u=Ie(u)?Math.min(u,y):y):n==="w"?(y=Math.min(T||1/0,k||1/0),s.right=u=Ie(u)?Math.min(u,y):y):n==="s"?(y=Math.max(T||-1/0,k||-1/0),s.top=c=Ie(c)?Math.max(c,y):y):n==="e"&&(y=Math.max(T||-1/0,k||-1/0),s.left=c=Ie(c)?Math.max(c,y):y));var D=r&&r[p.id];D&&(n==="n"?(y=i+p[Fi[t]]-D[Fi[t]],s.bottom=u=Ie(u)?Math.min(u,y):y):n==="w"?(y=i+p[Fi[t]]-D[Fi[t]],s.right=u=Ie(u)?Math.min(u,y):y):n==="s"?(y=i-p[Fi[t]]+D[Fi[t]],s.top=c=Ie(c)?Math.max(c,y):y):n==="e"&&(y=i-p[Fi[t]]+D[Fi[t]],s.left=c=Ie(c)?Math.max(c,y):y))}),s}}function iT(e){return!!e.host}var zp="djs-dragging",Qy="djs-resizing",rT=250,_c=Math.max;function Jy(e,t,n,i,r){function o(a,s){I(a,function(c){r.addDragger(c,s),n.addMarker(c,zp)})}e.on("spaceTool.selection.start",function(a){var s=n.getLayer("space"),c=a.context,u={x:"M 0,-10000 L 0,10000",y:"M -10000,0 L 10000,0"},l=Ae("g");ve(l,i.cls("djs-crosshair-group",["no-events"])),Ne(s,l);var f=Ae("path");ve(f,"d",u.x),Ye(f).add("djs-crosshair"),Ne(l,f);var p=Ae("path");ve(p,"d",u.y),Ye(p).add("djs-crosshair"),Ne(l,p),c.crosshairGroup=l}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;Jt(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&Ft(c)}),e.on("spaceTool.move",rT,function(a){var s=a.context,c=s.line,u=s.axis,l=s.movingShapes,f=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var p=n.getLayer("space");c=Ae("path"),ve(c,"d","M0,0 L0,0"),Ye(c).add("djs-crosshair"),Ne(p,c),s.line=c;var d=Ae("g");ve(d,i.cls("djs-drag-group",["no-events"])),Ne(n.getActiveLayer(),d),o(l,d);var g=new Set(l);I(f,function(C){g.add(C)});var h=new Set,m=s.movingConnections=[];g.forEach(function(C){I(C.outgoing,function(L){h.has(L)||!ot(L)||!g.has(L.target)||(h.add(L),m.push(L))})}),o(m,d),s.dragGroup=d}if(!s.frameGroup){var _=Ae("g");ve(_,i.cls("djs-frame-group",["no-events"])),Ne(n.getActiveLayer(),_);var y=[];I(f,function(C){var L=r.addFrame(C,_),T=L.getBBox();y.push({element:L,initialBounds:T}),n.addMarker(C,Qy)}),s.frameGroup=_,s.frames=y}var x={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};ve(c,{d:x[u]});var S={x:"y",y:"x"},P={x:a.dx,y:a.dy};P[S[s.axis]]=0,Jt(s.dragGroup,P.x,P.y),I(s.frames,function(C){var L=C.element,T=C.initialBounds,j,k;s.direction==="e"?ve(L,{width:_c(T.width+P.x,5)}):(j=_c(T.width-P.x,5),ve(L,{width:j,x:T.x+T.width-j})),s.direction==="s"?ve(L,{height:_c(T.height+P.y,5)}):(k=_c(T.height-P.y,5),ve(L,{height:k,y:T.y+T.height-k}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,u=s.movingConnections,l=s.resizingShapes,f=s.line,p=s.dragGroup,d=s.frameGroup;I(c,function(g){n.removeMarker(g,zp)}),I(u,function(g){n.removeMarker(g,zp)}),p&&(Ft(f),Ft(p)),I(l,function(g){n.removeMarker(g,Qy)}),d&&Ft(d)})}Jy.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const oT={__init__:["spaceToolPreview"],__depends__:[$i,xi,yc,ko,_a],spaceTool:["type",Zn],spaceToolPreview:["type",Jy]};function xc(e,t){e.invoke(Zn,this),this._canvas=t}xc.$inject=["injector","canvas"],ye(xc,Zn),xc.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=eo(fo(r.children.filter(u=>w(u,"bpmn:Artifact")),kt(o))));const s=[...e,...a];var c=Zn.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(u){return!(w(u,"bpmn:TextAnnotation")||aT(u)&&(t==="y"&&Yt(u)||t==="x"&&!Yt(u)))}),c};function aT(e){return w(e,"bpmn:Participant")&&!ie(e).processRef}const ev={__depends__:[oT],spaceTool:["type",xc]};function xt(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)}xt.$inject=["eventBus","injector"],xt.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()},xt.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},xt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},xt.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()}},xt.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()}},xt.prototype.register=function(e,t){this._setHandler(e,t)},xt.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)},xt.prototype.canUndo=function(){return!!this._getUndoAction()},xt.prototype.canRedo=function(){return!!this._getRedoAction()},xt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},xt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},xt.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)})},xt.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},xt.prototype._createId=function(){return this._uid++},xt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},xt.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()},xt.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)},xt.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:dd("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},xt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=Oe(e)?e:[e],t.dirty=t.dirty.concat(e))},xt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},xt.prototype._revertedAction=function(e){this._stackIdx--},xt.prototype._getHandler=function(e){return this._handlerMap[e]},xt.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 sT={commandStack:["type",xt]};function pr(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 cT=250,tv=1400;function Gp(e,t,n){ee.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",tv,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=nv(a),o.validatedShapes=nv(s)}),i&&t.on("shape.move.start",cT,function(r){var o=r.context,a=new Set(o.shapes),s=new Set;for(const c of a)for(const u of c.labels)!u.hidden&&!a.has(u)&&s.add(u),c.labelTarget&&s.add(c);for(const c of s)i.makeDraggable(o,c,!0)}),this.preExecuted("elements.move",tv,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];I(s,function(u){I(u.labels,function(l){s[l.id]||c.push(l)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(r){var o=r.context,a=o.connection||o.shape;pr(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=wl(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&&(At(s.labels,a,c),a.labelTarget=s)})}ye(Gp,ee),Gp.$inject=["injector","eventBus","modeling"];function nv(e){var t=new Set(e);return Ge(e,function(n){return!t.has(n.labelTarget)})}const uT={__init__:["labelSupport"],labelSupport:["type",Gp]};var lT=251,iv=1401,rv="attach-ok";function Vp(e,t,n,i,r){ee.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",iv,function(a){var s=a.context,c=s.shapes,u=s.validatedShapes;s.shapes=pT(c),s.validatedShapes=fT(u)}),o&&t.on("shape.move.start",lT,function(a){var s=a.context,c=s.shapes,u=Wp(c);I(u,function(l){o.makeDraggable(s,l,!0),I(l.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 u=c[0],l=u.host;l&&(n.addMarker(l,rv),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(l,rv)}))}}),this.preExecuted("elements.move",iv,function(a){var s=a.context,c=s.closure,u=s.shapes,l=Wp(u);I(l,function(f){c.add(f,c.topLevel[f.host.id])})}),this.postExecuted("elements.move",function(a){var s=a.context,c=s.shapes,u=s.newHost,l;u&&c.length!==1||(u?l=c:l=Ge(c,function(f){var p=f.host;return dT(f)&&!hT(c,p)}),I(l,function(f){r.updateAttachment(f,u)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;I(s,function(c){I(c.attachers,function(u){I(u.outgoing.slice(),function(l){var f=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});f||r.removeConnection(l)}),I(u.incoming.slice(),function(l){var f=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});f||r.removeConnection(l)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,u=s.host;u&&r.updateAttachment(c,u)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,u=s.newShape;pr(c.attachers,function(l){var f=i.allowed("elements.move",{target:u,shapes:[l]});f==="attach"?r.updateAttachment(l,u):r.removeShape(l)}),u.attachers.length&&I(u.attachers,function(l){var f=wg(l,c,u);r.moveShape(l,f,l.parent)})}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.oldBounds,l=s.newBounds,f=c.attachers,p=s.hints||{};p.attachSupport!==!1&&I(f,function(d){var g=wg(d,u,l);r.moveShape(d,g,d.parent),I(d.labels,function(h){r.moveShape(h,g,h.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;pr(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}ye(Vp,ee),Vp.$inject=["injector","eventBus","canvas","rules","modeling"];function Wp(e){return Du(on(e,function(t){return t.attachers||[]}))}function pT(e){var t=Wp(e);return Y0("id",e,t)}function fT(e){var t=to(e,"id");return Ge(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function dT(e){return!!e.host}function hT(e,t){return e.indexOf(t)!==-1}const mT={__depends__:[xi],__init__:["attachSupport"],attachSupport:["type",Vp]};function ov(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(Zh(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)})}ov.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const Up={__init__:["changeSupport"],changeSupport:["type",ov]};function Qn(e){this._model=e}Qn.$inject=["moddle"],Qn.prototype._needsId=function(e){return ze(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"])},Qn.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;w(e,"bpmn:Activity")?t="Activity":w(e,"bpmn:Event")?t="Event":w(e,"bpmn:Gateway")?t="Gateway":ze(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))},Qn.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Qn.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Qn.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",V({bpmnElement:e,bounds:this.createDiBounds()},t))},Qn.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Qn.prototype.createDiWaypoints=function(e){var t=this;return on(e,function(n){return t.createDiWaypoint(n)})},Qn.prototype.createDiWaypoint=function(e){return this.create("dc:Point",ri(e,["x","y"]))},Qn.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",V({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Qn.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",V({bpmnElement:e},t))};function Mn(e,t,n){ee.call(this,e),this._bpmnFactory=t;var i=this;function r(d){var g=d.context,h=g.hints||{},m;!g.cropped&&h.createElementsBehavior!==!1&&(m=g.connection,m.waypoints=n.getCroppedWaypoints(m),g.cropped=!0)}this.executed(["connection.layout","connection.create"],r),this.reverted(["connection.layout"],function(d){delete d.context.cropped});function o(d){var g=d.context;i.updateParent(g.shape||g.connection,g.oldParent)}function a(d){var g=d.context,h=g.shape||g.connection,m=g.parent||g.newParent;i.updateParent(h,m)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],kn(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],kn(a));function s(d){var g=d.context,h=g.oldRoot,m=h.children;I(m,function(_){w(_,"bpmn:BaseElement")&&i.updateParent(_)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var g=d.context.shape;w(g,"bpmn:BaseElement")&&i.updateBounds(g)}this.executed(["shape.move","shape.create","shape.resize"],kn(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],kn(function(d){d.context.shape.type!=="label"&&c(d)})),e.on("shape.changed",function(d){d.element.type==="label"&&c({context:{shape:d.element}})});function u(d){i.updateConnection(d.context)}this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],kn(u)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],kn(u));function l(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],kn(l)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],kn(l)),this.executed("connection.reconnect",kn(function(d){var g=d.context,h=g.connection,m=g.oldSource,_=g.newSource,y=ie(h),x=ie(m),S=ie(_);y.conditionExpression&&!ze(S,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(g.oldConditionExpression=y.conditionExpression,delete y.conditionExpression),m!==_&&x.default===y&&(g.oldDefault=x.default,delete x.default)})),this.reverted("connection.reconnect",kn(function(d){var g=d.context,h=g.connection,m=g.oldSource,_=g.newSource,y=ie(h),x=ie(m),S=ie(_);g.oldConditionExpression&&(y.conditionExpression=g.oldConditionExpression),g.oldDefault&&(x.default=g.oldDefault,delete S.default)}));function f(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],kn(f)),this.reverted(["element.updateAttachment"],kn(f)),this.executed("element.updateLabel",kn(p)),this.reverted("element.updateLabel",kn(p));function p(d){const{element:g}=d.context,h=$n(g),m=Ke(g),_=m&&m.get("label");rr(g)||sc(g)||(h&&!_?m.set("label",t.create("bpmndi:BPMNLabel")):!h&&_&&m.set("label",void 0))}}ye(Mn,ee),Mn.$inject=["eventBus","bpmnFactory","connectionDocking"],Mn.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},Mn.prototype.updateParent=function(e,t){if(!je(e)&&!(w(e,"bpmn:DataStoreReference")&&e.parent&&w(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=Ke(e),o=n&&n.businessObject,a=Ke(n);w(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),w(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),w(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(i,o),w(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},Mn.prototype.updateBounds=function(e){var t=Ke(e),n=yT(e);if(n){var i=ai(n,t.get("bounds"));V(n,{x:e.x+i.x,y:e.y+i.y})}var r=je(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),V(o,{x:e.x,y:e.y,width:e.width,height:e.height})},Mn.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;w(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),Ct(i,e)),w(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),At(r,e))}},Mn.prototype.updateDiConnection=function(e,t,n){var i=Ke(e),r=Ke(t),o=Ke(n);i.sourceElement&&i.sourceElement.bpmnElement!==ie(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==ie(n)&&(i.targetElement=n&&o)},Mn.prototype.updateDiParent=function(e,t){if(t&&!w(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(Ct(n,e),e.$parent=null)}};function gT(e){for(;e&&!w(e,"bpmn:Definitions");)e=e.$parent;return e}Mn.prototype.getLaneSet=function(e){var t,n;return w(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(w(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)},Mn.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((w(e,"bpmn:DataInput")||w(e,"bpmn:DataOutput"))&&(w(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(w(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(w(e,"bpmn:FlowElement")){if(t){if(w(t,"bpmn:Participant"))t=t.processRef;else if(w(t,"bpmn:Lane"))do t=t.$parent.$parent;while(w(t,"bpmn:Lane"))}i="flowElements"}else if(w(e,"bpmn:Artifact")){for(;t&&!w(t,"bpmn:Process")&&!w(t,"bpmn:SubProcess")&&!w(t,"bpmn:Collaboration");)if(w(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(w(e,"bpmn:MessageFlow"))i="messageFlows";else if(w(e,"bpmn:Participant")){i="participants";var r=e.processRef,o;r&&(o=gT(e.$parent||t),e.$parent&&(Ct(o.get("rootElements"),r),r.$parent=null),t&&(At(o.get("rootElements"),r),r.$parent=o))}else w(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":w(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),Ct(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);Ct(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},Mn.prototype.updateConnectionWaypoints=function(e){var t=Ke(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},Mn.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(w(n,"bpmn:DataAssociation"))w(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=r,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):w(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||r,this.updateSemanticParent(n,r,s),n.targetRef=a);else{var c=w(n,"bpmn:SequenceFlow");n.sourceRef!==r&&(c&&(Ct(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(Ct(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)},Mn.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function kn(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;w(i,"bpmn:BaseElement")&&e(t)}}function yT(e){if(w(e,"bpmn:Activity")){var t=Ke(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function fr(e,t){Li.call(this),this._bpmnFactory=e,this._moddle=t}ye(fr,Li),fr.$inject=["bpmnFactory","moddle"],fr.prototype._baseCreate=Li.prototype.create,fr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,V({type:"label",di:n},Ir,t))}return this.createElement(e,t)},fr.prototype.createElement=function(e,t){t=V({},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(!bT(r)){var o=V({},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)}w(i,"bpmn:Group")&&(t=V({isFrame:!0},t)),t=vT(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=qp(r,t,"isExpanded")),ze(i,["bpmn:Lane","bpmn:Participant"])&&(t=qp(r,t,"isHorizontal")),w(i,"bpmn:SubProcess")&&(t.collapsed=!Ue(i,r)),w(i,"bpmn:ExclusiveGateway")&&(wn(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),Nt(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),Nt(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=V({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},fr.prototype.getDefaultSize=function(e,t){var n=ie(e);if(t=t||Ke(e),w(n,"bpmn:SubProcess"))return Ue(n,t)?{width:350,height:200}:{width:100,height:80};if(w(n,"bpmn:Task"))return{width:100,height:80};if(w(n,"bpmn:Gateway"))return{width:50,height:50};if(w(n,"bpmn:Event"))return{width:36,height:36};if(w(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return Ue(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return w(n,"bpmn:Lane")?{width:400,height:100}:w(n,"bpmn:DataObjectReference")?{width:36,height:50}:w(n,"bpmn:DataStoreReference")?{width:50,height:50}:w(n,"bpmn:TextAnnotation")?{width:100,height:40}:w(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},fr.prototype.createParticipantShape=function(e){return Wt(e)||(e={isExpanded:e}),e=V({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function vT(e,t,n){return I(n,function(i){t=qp(e,t,i)}),t}function qp(e,t,n){return t[n]===void 0?t:(e[n]=t[n],li(t,[n]))}function bT(e){return ze(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function wc(e,t){this._modeling=e,this._canvas=t}wc.$inject=["modeling","canvas"],wc.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;I(n,function(r){var o={x:0,y:0};Nt(i.left)?o.x=i.left-r.x:Nt(i.right)?o.x=i.right-r.width-r.x:Nt(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:Nt(i.top)?o.y=i.top-r.y:Nt(i.bottom)?o.y=i.bottom-r.height-r.y:Nt(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},wc.prototype.postExecute=function(e){};function Ec(e){this._modeling=e}Ec.$inject=["modeling"],Ec.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},Ec.prototype.postExecute=function(e){var t=e.hints||{};_T(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 _T(e,t){return qi(e.outgoing,function(n){return n.target===t})}function Sc(e,t){this._canvas=e,this._layouter=t}Sc.$inject=["canvas","layouter"],Sc.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},Sc.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var Rc=Math.round;function Yp(e){this._modeling=e}Yp.$inject=["modeling"],Yp.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;I(t,function(f){Ie(f.x)||(f.x=0),Ie(f.y)||(f.y=0)});var s=Ge(t,function(f){return!f.hidden}),c=kt(s);I(t,function(f){ot(f)&&(f.waypoints=on(f.waypoints,function(p){return{x:Rc(p.x-c.x-c.width/2+r.x),y:Rc(p.y-c.y-c.height/2+r.y)}})),V(f,{x:Rc(f.x-c.x-c.width/2+r.x),y:Rc(f.y-c.y-c.height/2+r.y)})});var u=new Set(Ps(t)),l={};I(t,function(f){if(ot(f)){l[f.id]=Ie(i)?a.createConnection(l[f.source.id],l[f.target.id],i,f,f.parent||n,o):a.createConnection(l[f.source.id],l[f.target.id],f,f.parent||n,o);return}var p=V({},o);u.has(f)||(p.autoResize=!1),je(f)&&(p=li(p,["attach"])),l[f.id]=Ie(i)?a.createShape(f,ri(f,["x","y","width","height"]),f.parent||n,i,p):a.createShape(f,ri(f,["x","y","width","height"]),f.parent||n,p)}),e.elements=eo(l)};var av=Math.round;function dr(e){this._canvas=e}dr.$inject=["canvas"],dr.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?V(t,n):V(t,{x:n.x-av(t.width/2),y:n.y-av(t.height/2)}),this._canvas.addShape(t,i,r),t},dr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function wa(e){dr.call(this,e)}ye(wa,dr),wa.$inject=["canvas"];var xT=dr.prototype.execute;wa.prototype.execute=function(e){var t=e.shape;return ET(t),t.labelTarget=e.labelTarget,xT.call(this,e)};var wT=dr.prototype.revert;wa.prototype.revert=function(e){return e.shape.labelTarget=null,wT.call(this,e)};function ET(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function Ea(e,t){this._canvas=e,this._modeling=t}Ea.$inject=["canvas","modeling"],Ea.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;pr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),pr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},Ea.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=wl(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Ea.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,At(n.children,t,i),this._canvas.addConnection(t,n),t};function Kp(e,t){this._modeling=e,this._elementRegistry=t}Kp.$inject=["modeling","elementRegistry"],Kp.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;I(i,function(r){n.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};function Sa(e,t){this._canvas=e,this._modeling=t}Sa.$inject=["canvas","modeling"],Sa.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;pr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),pr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),pr(n.children,function(i){ot(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},Sa.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=wl(i.children,n),t.removeShape(n),n},Sa.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return At(i.children,n,r),t.addShape(n,i),n};function Cc(e){this._modeling=e}Cc.$inject=["modeling"];var sv={x:"y",y:"x"};Cc.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(m,_){m.range.min=Math.min(_[i],m.range.min),m.range.max=Math.max(_[i]+_[r],m.range.max)}function a(m){return m[i]+m[r]/2}function s(m){return m.length-1}function c(m){return m.max-m.min}function u(m,_){var y={y:0};y[i]=m-a(_),y[i]&&(y[sv[i]]=0,t.moveElements([_],y,_.parent))}var l=n[0],f=s(n),p=n[f],d,g,h=0;I(n,function(m,_){var y,x,S;if(m.elements.length<2){_&&_!==n.length-1&&(o(m,m.elements[0]),h+=c(m.range));return}y=ui(m.elements,i),x=y[0],_===f&&(x=y[s(y)]),S=a(x),m.range=null,I(y,function(P){if(u(S,P),m.range===null){m.range={min:P[i],max:P[i]+P[r]};return}o(m,P)}),_&&_!==n.length-1&&(h+=c(m.range))}),g=Math.abs(p.range.min-l.range.max),d=Math.round((g-h)/(n.length-1)),!(d<n.length-1)&&I(n,function(m,_){var y={},x;m===l||m===p||(x=n[_-1],m.range.max=0,I(m.elements,function(S,P){y[sv[i]]=0,y[i]=x.range.max-S[i]+d,m.range.min!==S[i]&&(y[i]+=S[i]-m.range.min),y[i]&&t.moveElements([S],y,S.parent),m.range.max=Math.max(S[i]+S[r],P?m.range.max:0)}))})},Cc.prototype.postExecute=function(e){};function Pc(e,t){this._layouter=e,this._canvas=t}Pc.$inject=["layouter","canvas"],Pc.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return V(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Pc.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Xp(){}Xp.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=Ct(o.children,t),At(i.children,t,r),t.parent=i,I(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},Xp.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return Ct(n.children,t),At(i.children,t,r),t.parent=i,I(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 Zp(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Zp.prototype.add=function(e,t){return this.addAll([e],t)},Zp.prototype.addAll=function(e,t){var n=J1(e,!!t,this);return V(this,n),this};function Ra(e){this._modeling=e}Ra.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},Ra.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,u=e.topLevel,l=!1;r&&r.parent===n&&(l=!0),I(a,function(f){o.moveShape(f,t,u[f.id]&&!l&&n,{recurse:!1,layout:!1})}),I(s,function(f){var p=!!a[f.source.id],d=!!a[f.target.id];c[f.id]&&p&&d?o.moveConnection(f,t,u[f.id]&&!l&&n):o.layoutConnection(f,{connectionStart:p&&rp(f,f.source,t),connectionEnd:d&&op(f,f.target,t)})})},Ra.prototype.getClosure=function(e){return new Zp().addAll(e,!0)};function Ac(e){this._helper=new Ra(e)}Ac.$inject=["modeling"],Ac.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Ac.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 Hr(e){this._modeling=e,this._helper=new Ra(e)}Hr.$inject=["modeling"],Hr.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=ri(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=Ct(o.children,t),At(i.children,t,r),V(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Hr.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;i.layout!==!1&&(I(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:op(o,t,n)})}),I(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:rp(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},Hr.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return At(n.children,t,i),V(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},Hr.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Hr.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function Ca(e){this._modeling=e}Ca.$inject=["modeling"],Ca.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 Oe(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},Ca.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||cv(Oe(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||cv(Oe(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},Ca.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 cv(e){return e.original||e}function ji(e,t){this._modeling=e,this._rules=t}ji.$inject=["modeling","rules"],ji.prototype.preExecute=function(e){var t=this,n=this._modeling,i=this._rules,r=e.oldShape,o=e.newData,a=e.hints||{},s;function c(g,h,m){return i.allowed("connection.reconnect",{connection:m,source:g,target:h})}var u={x:o.x,y:o.y},l={x:r.x,y:r.y,width:r.width,height:r.height};s=e.newShape=e.newShape||t.createShape(o,u,r.parent,a),r.host&&n.updateAttachment(s,r.host);var 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();I(p,function(g){var h=g.source,m=c(h,s,g);m&&t.reconnectEnd(g,s,tc(g,s,l),a)}),I(d,function(g){var h=g.target,m=c(s,h,g);m&&t.reconnectStart(g,s,ec(g,s,l),a)})},ji.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},ji.prototype.execute=function(e){},ji.prototype.revert=function(e){},ji.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},ji.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},ji.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function Pa(e){this._modeling=e}Pa.$inject=["modeling"],Pa.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},V(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Pa.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(I(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:tc(o,n,i)})}),I(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:ec(o,n,i)})}))},Pa.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return V(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function hr(e){this._modeling=e}hr.$inject=["modeling"],hr.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),I(r,function(s){a[s.id]=RT(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(QA(i,r),t,n,o,i,r,a)},hr.prototype.execute=function(){},hr.prototype.revert=function(){},hr.prototype.moveShapes=function(e,t){var n=this;I(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},hr.prototype.resizeShapes=function(e,t,n){var i=this;I(e,function(r){var o=JA(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},hr.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=new Set(r),u=new Set(o);I(e,function(l){var f=l.source,p=l.target,d=ST(l),g=lv(n),h={},m=c.has(f)||u.has(f),_=c.has(p)||u.has(p);m&&_?(d=on(d,function(y){return pv(y,i,n)&&(y[g]=y[g]+t[g]),y.original&&pv(y.original,i,n)&&(y.original[g]=y.original[g]+t[g]),y}),s._modeling.updateWaypoints(l,d,{labelBehavior:!1})):(m||_)&&(c.has(f)?h.connectionStart=rp(l,f,t):c.has(p)?h.connectionEnd=op(l,p,t):u.has(f)?h.connectionStart=ec(l,f,a[f.id]):u.has(p)&&(h.connectionEnd=tc(l,p,a[p.id])),s._modeling.layoutConnection(l,h))})};function uv(e){return V({},e)}function ST(e){return on(e.waypoints,function(t){return t=uv(t),t.original&&(t.original=uv(t.original)),t})}function lv(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function pv(e,t,n){var i=lv(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function RT(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Tc(e){this._modeling=e}Tc.$inject=["modeling"],Tc.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=fv(n),t.collapsed=!t.collapsed;var i=dv(n,t.collapsed);return[t].concat(i)},Tc.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=hv(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function fv(e){var t={};return I(e,function(n){t[n.id]=n.hidden,n.children&&(t=V({},t,fv(n.children)))}),t}function dv(e,t){var n=[];return I(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(dv(i.children,i.collapsed||t)))}),n}function hv(e,t){var n=[];return I(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(hv(i.children,t)))}),n}function Mc(e){this._modeling=e}Mc.$inject=["modeling"],Mc.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=mv(i,t),gv(n,t),t.host=n,t},Mc.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,mv(n,t),gv(i,t,r),t};function mv(e,t){return Ct(e&&e.attachers,t)}function gv(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),At(i,t,n)}}function Qp(){}Qp.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},Qp.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function at(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}at.$inject=["eventBus","elementFactory","commandStack"],at.prototype.getHandlers=function(){return{"shape.append":Ec,"shape.create":dr,"shape.delete":Sa,"shape.move":Hr,"shape.resize":Pa,"shape.replace":ji,"shape.toggleCollapse":Tc,spaceTool:hr,"label.create":wa,"connection.create":Sc,"connection.delete":Ea,"connection.move":Xp,"connection.layout":Pc,"connection.updateWaypoints":Qp,"connection.reconnect":Ca,"elements.create":Yp,"elements.move":Ac,"elements.delete":Kp,"elements.distribute":Cc,"elements.align":wc,"element.updateAttachment":Mc}},at.prototype.registerHandlers=function(e){I(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},at.prototype.moveShape=function(e,t,n,i,r){typeof i=="object"&&(r=i,i=null);var o={shape:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("shape.move",o)},at.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},at.prototype.moveElements=function(e,t,n,i){i=i||{};var r=i.attach,o=n,a;r===!0?(a=n,o=n.parent):r===!1&&(a=null);var s={shapes:e,delta:t,newParent:o,newHost:a,hints:i};this._commandStack.execute("elements.move",s)},at.prototype.moveConnection=function(e,t,n,i,r){typeof i=="object"&&(r=i,i=void 0);var o={connection:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("connection.move",o)},at.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},at.prototype.createConnection=function(e,t,n,i,r,o){typeof n=="object"&&(o=r,r=i,i=n,n=void 0),i=this._create("connection",i);var a={source:e,target:t,parent:r,parentIndex:n,connection:i,hints:o};return this._commandStack.execute("connection.create",a),a.connection},at.prototype.createShape=function(e,t,n,i,r){typeof i!="number"&&(r=i,i=void 0),r=r||{};var o=r.attach,a,s;e=this._create("shape",e),o?(a=n.parent,s=n):a=n;var c={position:t,shape:e,parent:a,parentIndex:i,host:s,hints:r};return this._commandStack.execute("shape.create",c),c.shape},at.prototype.createElements=function(e,t,n,i,r){Oe(e)||(e=[e]),typeof i!="number"&&(r=i,i=void 0),r=r||{};var o={position:t,elements:e,parent:n,parentIndex:i,hints:r};return this._commandStack.execute("elements.create",o),o.elements},at.prototype.createLabel=function(e,t,n,i){n=this._create("label",n);var r={labelTarget:e,position:t,parent:i||e.parent,shape:n};return this._commandStack.execute("label.create",r),r.shape},at.prototype.appendShape=function(e,t,n,i,r){r=r||{},t=this._create("shape",t);var o={source:e,position:n,target:i,shape:t,connection:r.connection,connectionParent:r.connectionParent,hints:r};return this._commandStack.execute("shape.append",o),o.shape},at.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},at.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},at.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},at.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},at.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},at.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},at.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},at.prototype.createSpace=function(e,t,n,i,r){var o={delta:n,direction:i,movingShapes:e,resizingShapes:t,start:r};this._commandStack.execute("spaceTool",o)},at.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},at.prototype.reconnect=function(e,t,n,i,r){var o={connection:e,newSource:t,newTarget:n,dockingOrPoints:i,hints:r||{}};this._commandStack.execute("connection.reconnect",o)},at.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,V(i,{docking:"source"}))},at.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,V(i,{docking:"target"}))},at.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},at.prototype._create=function(e,t){return $S(t)?t:this._elementFactory.create(e,t)},at.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function Aa(e){this._elementRegistry=e}Aa.$inject=["elementRegistry"],Aa.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||CT(n,ns(i));return yv(n,i),e.oldProperties=o,e.changed=r,r},Aa.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return yv(n,t),i},Aa.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return w(e,"bpmn:DataObject")?PT(e,t):[]};function CT(e,t){return En(t,function(n,i){return n[i]=e.get(i),n},{})}function yv(e,t){I(t,function(n,i){e.set(i,n)})}function PT(e,t){return t.filter(function(n){return w(n,"bpmn:DataObjectReference")&&ie(n).dataObjectRef===e})}var Ta="default",Hi="id",vv="di",AT={width:0,height:0};function Ma(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}Ma.$inject=["elementRegistry","moddle","modeling","textRenderer"],Ma.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=DT(e.properties),s=e.oldProperties||TT(t,a);return bv(a,o)&&(r.unclaim(o[Hi]),i.updateId(t,a[Hi]),r.claim(a[Hi],o)),Ta in a&&(a[Ta]&&n.push(i.get(a[Ta].id)),o[Ta]&&n.push(i.get(o[Ta].id))),_v(t,a),e.oldProperties=s,e.changed=n,n},Ma.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,AT)}},Ma.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 _v(t,i),bv(n,r)&&(a.unclaim(n[Hi]),o.updateId(t,i[Hi]),a.claim(i[Hi],r)),e.changed};function bv(e,t){return Hi in e&&e[Hi]!==t[Hi]}function TT(e,t){var n=ns(t),i=e.businessObject,r=Ke(e);return En(n,function(o,a){return a!==vv?o[a]=i.get(a):o[a]=MT(r,ns(t.di)),o},{})}function MT(e,t){return En(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function _v(e,t){var n=e.businessObject,i=Ke(e);I(t,function(r,o){o!==vv?n.set(o,r):i&&kT(i,r)})}function kT(e,t){I(t,function(n,i){e.set(i,n)})}var OT=["default"];function DT(e){var t=V({},e);return OT.forEach(function(n){n in e&&(t[n]=ie(t[n]))}),t}function kc(e,t){this._canvas=e,this._modeling=t}kc.$inject=["canvas","modeling"],kc.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=Ke(r);return t.setRootElement(n),t.removeRootElement(r),At(a.rootElements,i),i.$parent=a,Ct(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},kc.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=Ke(n);return t.setRootElement(r),t.removeRootElement(n),Ct(a.rootElements,i),i.$parent=null,At(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function Jp(e,t){this._modeling=e,this._spaceTool=t}Jp.$inject=["modeling","spaceTool"],Jp.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=Yn(i),a=o===i,s=a?i:i.parent,c=ar(s),u=Yt(i);if(u?r==="left"?r="top":r==="right"&&(r="bottom"):r==="top"?r="left":r==="bottom"&&(r="right"),!c.length){var l=u?{x:i.x+qn,y:i.y,width:i.width-qn,height:i.height}:{x:i.x,y:i.y+qn,width:i.width,height:i.height-qn};n.createShape({type:"bpmn:Lane",isHorizontal:u},l,s)}var f=[];Dr(o,function(S){return f.push(S),S.label&&f.push(S.label),S===i?[]:Ge(S.children,function(P){return P!==i})});var p,d,g,h,m;r==="top"?(p=-120,d=i.y,g=d+10,h="n",m="y"):r==="left"?(p=-120,d=i.x,g=d+10,h="w",m="x"):r==="bottom"?(p=120,d=i.y+i.height,g=d-10,h="s",m="y"):r==="right"&&(p=120,d=i.x+i.width,g=d-10,h="e",m="x");var _=t.calculateAdjustments(f,m,p,g),y=u?{x:0,y:p}:{x:p,y:0};t.makeSpace(_.movingShapes,_.resizingShapes,y,h,g);var x=u?{x:i.x+(a?qn:0),y:d-(r==="top"?120:0),width:i.width-(a?qn:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?qn:0),width:120,height:i.height-(a?qn:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:u},x,s)};function ef(e){this._modeling=e}ef.$inject=["modeling"],ef.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=ar(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=Yt(n),s=a?n.height:n.width,c=Math.round(s/i),u,l,f,p;for(p=0;p<i;p++)p===i-1?u=s-c*p:u=c,l=a?{x:n.x+qn,y:n.y+p*c,width:n.width-qn,height:u}:{x:n.x+p*c,y:n.y+qn,width:u,height:n.height-qn},p<o?t.resizeShape(r[p],l):(f={type:"bpmn:Lane",isHorizontal:a},t.createShape(f,l,n))};function ka(e,t){this._modeling=e,this._spaceTool=t}ka.$inject=["modeling","spaceTool"],ka.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},ka.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=PC(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},ka.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=Te(e),r=Te(t),o=Qm(r,i),a=Yn(e),s=[],c=[];Dr(a,function(g){return s.push(g),(w(g,"bpmn:Lane")||w(g,"bpmn:Participant"))&&c.push(g),g.children});var u,l,f,p,d;(o.bottom||o.top)&&(u=o.bottom||o.top,l=e.y+(o.bottom?e.height:0)+(o.bottom?-10:10),f=o.bottom?"s":"n",p=o.top>0||o.bottom<0?-u:u,d=n.calculateAdjustments(s,"y",p,l),n.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:u},f)),(o.left||o.right)&&(u=o.right||o.left,l=e.x+(o.right?e.width:0)+(o.right?-10:100),f=o.right?"e":"w",p=o.left>0||o.right<0?-u:u,d=n.calculateAdjustments(c,"x",p,l),n.makeSpace(d.movingShapes,d.resizingShapes,{x:u,y:0},f))};var Oa="flowNodeRef",tf="lanes";function Oc(){}Oc.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(l,f){var p=Te(f),d={x:l.x+l.width/2,y:l.y+l.height/2};return d.x>p.left&&d.x<p.right&&d.y>p.top&&d.y<p.bottom}function s(l){n.indexOf(l)===-1&&(o.push(l),n.push(l))}function c(l){var f=Yn(l);return r[f.id]||(r[f.id]=Ks(f)),r[f.id]}function u(l){if(!l.parent)return[];var f=c(l);return f.filter(function(p){return a(l,p)}).map(function(p){return p.businessObject})}return t.forEach(function(l){var f=Yn(l);if(!(!f||n.indexOf(f)!==-1)){var p=f.children.filter(function(d){return w(d,"bpmn:FlowNode")});p.forEach(s),n.push(f)}}),e.forEach(s),o.forEach(function(l){var f=l.businessObject,p=f.get(tf),d=p.slice(),g=u(l);i.push({flowNode:f,remove:d,add:g})}),t.forEach(function(l){var f=l.businessObject;l.parent||f.get(Oa).forEach(function(p){i.push({flowNode:p,remove:[f],add:[]})})}),i},Oc.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(tf);n.remove.forEach(function(o){Ct(r,o),Ct(o.get(Oa),i)}),n.add.forEach(function(o){At(r,o),At(o.get(Oa),i)})}),[]},Oc.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(tf);n.add.forEach(function(o){Ct(r,o),Ct(o.get(Oa),i)}),n.remove.forEach(function(o){At(r,o),At(o.get(Oa),i)})}),[]};var nf="categoryValueRef";function Da(e,t){this._bpmnFactory=e,this._elementRegistry=t}Da.$inject=["bpmnFactory","elementRegistry"],Da.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,r=new Map,o=[],a=new Map;function s(y,x,S){if(x){var P=a.get(y);P||(P={},a.set(y,P)),!(S&&P.present)&&(!S&&P.past||(S?P.present={categoryValue:x,root:rf(y)}:P.past={categoryValue:x}))}}function c(y){r.set(y,ie(y))}function u(){n.filter(function(y){return w(y,"bpmn:FlowElement")&&!je(y)&&y.parent}).forEach(c)}function l(y){var x=ie(y),S=x.get("categoryValueRef");return S||(S=qm(i,x),o.push(LT(y,S))),S}function f(y){return y.reduce(function(x,S){var P=rf(S),C=x.get(P);return C||(C=[],x.set(P,C)),C.push(S),x},new Map)}e=Array.from(e||[]);var p=f(e);t.length&&u(),e.forEach(c),n.filter(function(y){return w(y,"bpmn:Group")&&!je(y)&&y.parent}).forEach(function(y){var x=ie(y).get("categoryValueRef");if(!x){var S=rf(y),P=p.get(S)||[],C=fo(P,y),L=Object.keys(C).length>0;L&&(x=l(y))}s(y,x,!0)}),t.forEach(function(y){s(y.groupShape,y.categoryValue,!1)}),o.length&&u();var d=Array.from(r.keys()),g=Array.from(a.values()).reduce(function(y,x){return x.present&&y.add(x.present.categoryValue),x.past&&y.add(x.past.categoryValue),y},new Set),h=new Map,m=f(d);a.forEach(function(y,x){var S=y.present;if(S){var P=m.get(S.root)||[],C=fo(P,x);P.forEach(function(L){if(C[L.id]){var T=h.get(L);T||(T=new Set,h.set(L,T)),T.add(S.categoryValue)}})}});var _=d.reduce(function(y,x){var S=r.get(x),P=S.get(nf),C=new Set(P),L=h.get(x)||new Set,T=Array.from(L).filter(function(k){return!C.has(k)}),j=P.filter(function(k){return g.has(k)&&!L.has(k)});return(T.length||j.length)&&y.push({businessObject:S,categoryValuesToAdd:T,categoryValuesToRemove:j}),y},[]);return{flowElements:_,groups:o}},Da.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),IT(t.groups),NT(t.flowElements),[]},Da.prototype.revert=function(e){var t=e.updates;return $T(t.flowElements),BT(t.groups),[]};function LT(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function IT(e){e.forEach(function(t){ie(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function BT(e){e.forEach(function(t){ie(t.groupShape).categoryValueRef=null})}function NT(e){e.forEach(function(t){var n=t.businessObject,i=n.get(nf);t.categoryValuesToRemove.forEach(function(r){Ct(i,r)}),t.categoryValuesToAdd.forEach(function(r){At(i,r,!0)})})}function $T(e){e.forEach(function(t){var n=t.businessObject,i=n.get(nf);t.categoryValuesToAdd.forEach(function(r){Ct(i,r)}),t.categoryValuesToRemove.forEach(function(r){At(i,r,!0)})})}function rf(e){for(;e.parent;)e=e.parent;return e}function Dc(e){this._moddle=e}Dc.$inject=["moddle"],Dc.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),[]},Dc.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 FT={fill:void 0,stroke:void 0};function of(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(xn(t)){var n=jT(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}of.$inject=["commandStack"],of.prototype.postExecute=function(e){var t=e.elements,n=e.colors||FT,i=this,r={};"fill"in n&&V(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&V(r,{"border-color":this._normalizeColor(n.stroke)}),I(t,function(o){var a=ot(o)?ri(r,["border-color"]):r,s=Ke(o);if(HT(a),je(o)){if(!s||!w(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:s.label,properties:{color:r["border-color"]}})}else{if(!ze(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function jT(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 HT(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var zT={width:0,height:0};function xv(e,t,n){function i(c,u){var l=c.label||c,f=c.labelTarget||c;return gR(l,u),[l,f]}function r(c){var u=c.element,l=u.businessObject,f=c.newLabel;if(!je(u)&&rr(u)&&!Bs(u)&&!wv(f)){var p=7,d=Al(u);d={x:d.x,y:d.y+p},e.createLabel(u,d,{id:l.id+"_label",businessObject:l,di:u.di})}}function o(c){return c.oldLabel=$n(c.element),i(c.element,c.newLabel)}function a(c){return i(c.element,c.oldLabel)}function s(c){var u=c.element,l=u.label||u,f=c.newLabel,p=c.newBounds,d=c.hints||{};if(!(!je(l)&&!w(l,"bpmn:TextAnnotation"))){if(je(l)&&wv(f)){d.removeShape!==!1&&e.removeShape(l,{unsetLabel:!1});return}var g=$n(u);typeof p>"u"&&(p=t.getExternalLabelBounds(l,g)),p&&e.resizeShape(l,p,zT)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}xv.$inject=["modeling","textRenderer","bpmnFactory"];function wv(e){return!e||!e.trim()}function tn(e,t,n,i){at.call(this,e,t,n),this._bpmnRules=i}ye(tn,at),tn.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],tn.prototype.getHandlers=function(){var e=at.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=Aa,e["element.updateProperties"]=Ma,e["canvas.updateRoot"]=kc,e["lane.add"]=Jp,e["lane.resize"]=ka,e["lane.split"]=ef,e["lane.updateRefs"]=Oc,e["group.updateRefs"]=Da,e["id.updateClaim"]=Dc,e["element.setColor"]=of,e["element.updateLabel"]=xv,e},tn.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},tn.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)},tn.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},tn.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},tn.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},tn.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},tn.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},tn.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},tn.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},tn.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},tn.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},tn.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},tn.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},tn.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function Ev(){}Ev.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||De(t.source||e.source),t.connectionEnd||De(t.target||e.target)]};var Lc=20,GT=5,Ic=Math.round,Sv=20,VT={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function WT(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function UT(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function Rv(e,t,n){var i=Qt(t,e,GT),r=n.split(":")[0],o=Ic((t.x-e.x)/2+e.x),a=Ic((t.y-e.y)/2+e.y),s,c,u=UT(r,i),l=/h|r|l/.test(r),f=!1,p=!1;return u?(s=l?{x:o,y:e.y}:{x:e.x,y:a},c=l?"h:h":"v:v"):(f=WT(i,r),c=l?"h:v":"v:h",f?l?(p=a===e.y,s={x:e.x+Lc*(/l/.test(r)?-1:1),y:p?a+Lc:a}):(p=o===e.x,s={x:p?o+Lc:o,y:e.y+Lc*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:af(e,s,c).concat(s),directions:c,turnNextDirections:p}}function qT(e,t,n){return Rv(e,t,n)}function YT(e,t,n){var i=Rv(t,e,Cv(n));return{waypoints:i.waypoints.slice().reverse(),directions:Cv(i.directions),turnNextDirections:i.turnNextDirections}}function KT(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=af(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function Cv(e){return e.split(":").reverse().join(":")}function XT(e,t,n){var i=Ic((t.x-e.x)/2+e.x),r=Ic((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 af(e,t,n){if(n=n||"h:h",!oM(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Av(n)){var i=qT(e,t,n),r=YT(e,t,n),o=KT(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return XT(e,t,n)}function ZT(e,t,n){var i=af(e,t,n);return i.unshift(e),i.push(t),Mv(i)}function QT(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=U0(o,"straight")[0]||"h:h",s=VT[a]||0,c=Qt(e,t,s),u=rM(c,a);n=n||De(e),i=i||De(t);var l=u.split(":"),f=Tv(n,e,l[0],aM(c)),p=Tv(i,t,l[1],c);return ZT(f,p,u)}function JT(e,t,n,i,r,o){Oe(n)&&(r=n,o=i,n=De(e),i=De(t)),o=V({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&tM(e,t,n,i,o),c||(c=o.connectionEnd&&iM(t,e,i,r),c)||(c=o.connectionStart&&nM(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:QT(e,t,n,i,o)}function eM(e,t,n){return e>=t&&e<=n}function Pv(e,t,n){var i={x:"width",y:"height"};return eM(t[e],n[e],n[e]+n[i[e]])}function tM(e,t,n,i,r){var o={},a,s;return s=Qt(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?Pv(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:Pv(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 nM(e,t,n,i){return sf(e,t,n,i)}function iM(e,t,n,i){var r=i.slice().reverse();return r=sf(e,t,n,r),r?r.reverse():null}function sf(e,t,n,i){function r(l){return l.length<3?!0:l.length>4?!1:!!lt(l,function(f,p){var d=l[p-1];return d&&ia(f,d)<3})}function o(l,f,p){var d=Oi(f,l);switch(d){case"v":return{x:p.x,y:l.y};case"h":return{x:l.x,y:p.y}}return{x:l.x,y:l.y}}function a(l,f,p){var d;for(d=l.length-2;d!==0;d--)if(Jh(l[d],f,Sv)||Jh(l[d],p,Sv))return l.slice(d);return l}if(r(i))return null;var s=i[0],c=i.slice(),u;return c[0]=n,c[1]=o(c[1],s,n),u=a(c,e,t),u!==c&&(c=sf(e,t,n,u)),c&&Oi(c)?null:c}function rM(e,t){if(Av(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 oM(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Av(e){return e&&/t|r|b|l/.test(e)}function aM(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 Tv(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 Mv(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return El(r,o,n,0)||t.push(n),t},[])}var sM=-10,cM=40,uM={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},lM={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},cf={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},La={top:"t",right:"r",bottom:"b",left:"l"};function Bc(e){this._elementRegistry=e}ye(Bc,Ev),Bc.prototype.layoutConnection=function(e,t){t||(t={});var n=t.source||e.source,i=t.target||e.target,r=t.waypoints||e.waypoints,o=t.connectionStart,a=t.connectionEnd,s=this._elementRegistry,c,u;if(o||(o=kv(r&&r[0],n)),a||(a=kv(r&&r[r.length-1],i)),(w(e,"bpmn:Association")||w(e,"bpmn:DataAssociation"))&&r&&!Ov(n,i))return[].concat([o],r.slice(1,-1),[a]);var l=Gm(n,s)?uM:lM;return w(e,"bpmn:MessageFlow")?c=fM(n,i,l):(w(e,"bpmn:SequenceFlow")||Ov(n,i))&&(n===i?c={preferredLayouts:vM(n,e,l)}:w(n,"bpmn:BoundaryEvent")?c={preferredLayouts:bM(n,i,a,l)}:Ia(n)||Ia(i)?c={preferredLayouts:l.subProcess,preserveDocking:hM(n)}:w(n,"bpmn:Gateway")?c={preferredLayouts:l.fromGateway}:w(i,"bpmn:Gateway")?c={preferredLayouts:l.toGateway}:c={preferredLayouts:l.default}),c&&(c=V(c,t),u=Mv(JT(n,i,o,a,r,c))),u||[o,a]};function pM(e){var t=e.host;return Qt(De(e),t,sM)}function fM(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:dM(e,t)}}function dM(e,t){return w(t,"bpmn:Participant")?"source":w(e,"bpmn:Participant")?"target":Ia(t)?"source":Ia(e)||w(t,"bpmn:Event")?"target":w(e,"bpmn:Event")?"source":null}function hM(e){return Ia(e)?"target":"source"}function kv(e,t){return e?e.original||e:De(t)}function Ov(e,t){return w(t,"bpmn:Activity")&&w(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Ia(e){return w(e,"bpmn:SubProcess")&&Ue(e)}function zr(e,t){return e===t}function mM(e,t){return t.indexOf(e)!==-1}function Oo(e){var t=/right|left/.exec(e);return t&&t[0]}function Do(e){var t=/top|bottom/.exec(e);return t&&t[0]}function Dv(e,t){return cf[e]===t}function gM(e,t){var n=Oo(e),i=cf[n];return t.indexOf(i)!==-1}function yM(e,t){var n=Do(e),i=cf[n];return t.indexOf(i)!==-1}function Lv(e){return e==="right"||e==="left"}function vM(e,t,n){var i=t.waypoints,r=i&&i.length&&Qt(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function bM(e,t,n,i){var r=De(e),o=De(t),a=pM(e),s,c,u=zr(e.host,t),l=mM(a,["top","right","bottom","left"]),f=Qt(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?_M(a,l,e,t,n,i):(s=xM(a,f,l,i.isHorizontal),c=wM(a,f,l,i.isHorizontal),[s+":"+c])}function _M(e,t,n,i,r,o){var a=t?e:o.isHorizontal?Do(e):Oo(e),s=La[a],c;return t?Lv(e)?c=Iv("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=Iv("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function Iv(e,t,n,i){var r=cM;return!(uf(e,i,n,r)||uf(e,i,{x:n.x+n.width,y:n.y+n.height},r)||uf(e,i,De(t),r))}function uf(e,t,n,i){return Math.abs(t[e]-n[e])<i}function xM(e,t,n,i){if(n)return La[e];var r=Do(e),o=Oo(e),a=Do(t),s=Oo(t);if(i){if(zr(r,a)||Dv(o,s))return La[r]}else if(zr(o,s)||Dv(r,a))return La[o];return La[i?o:r]}function wM(e,t,n,i){if(n)return Lv(e)?gM(e,t)||zr(e,t)?"h":"v":yM(e,t)||zr(e,t)?"v":"h";var r=Do(e),o=Oo(e),a=Do(t),s=Oo(t);return a&&!s?"v":s&&!a?"h":i?zr(r,a)?"h":"v":zr(o,s)?"v":"h"}Bc.$inject=["elementRegistry"];function Bv(e){return V({original:e.point.original||e.point},e.actual)}function mr(e,t){this._elementRegistry=e,this._graphicsFactory=t}mr.$inject=["elementRegistry","graphicsFactory"],mr.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(Bv(i)),o.push(Bv(r)),o},mr.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}},mr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return ra(i,r,n)},mr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},mr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},mr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const lf={__init__:["modeling","bpmnUpdater"],__depends__:[HP,iA,oA,aA,Yy,sT,uT,mT,Xn,Up,ev],bpmnFactory:["type",Qn],bpmnUpdater:["type",Mn],elementFactory:["type",fr],modeling:["type",tn],layouter:["type",Bc],connectionDocking:["type",mr]};var EM=10,Nv=50,SM=250;function pf(e,t,n,i){for(var r;r=RM(e,n,t);)n=i(t,n,r);return n}function ff(e){return function(t,n,i){var r={x:n.x,y:n.y};return["x","y"].forEach(function(o){var a=e[o];if(a){var s=o==="x"?"width":"height",c=a.margin,u=a.minDistance;c<0?r[o]=Math.min(i[o]+c-t[s]/2,n[o]-u+c):r[o]=Math.max(i[o]+i[s]+c+t[s]/2,n[o]+u+c)}}),r}}function RM(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=PM(e);return lt(r,function(o){if(o===n)return!1;var a=Qt(o,i,EM);return a==="intersect"})}function CM(e,t){t||(t={});function n(g){return g.source===e?1:-1}var i=t.defaultDistance||Nv,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||SM,c=t.reference||"start";o||(o=MM);function u(g,h){return r==="n"?c==="start"?Te(g).top-Te(h).bottom:c==="center"?Te(g).top-De(h).y:Te(g).top-Te(h).top:r==="w"?c==="start"?Te(g).left-Te(h).right:c==="center"?Te(g).left-De(h).x:Te(g).left-Te(h).left:r==="s"?c==="start"?Te(h).top-Te(g).bottom:c==="center"?De(h).y-Te(g).bottom:Te(h).bottom-Te(g).bottom:c==="start"?Te(h).left-Te(g).right:c==="center"?De(h).x-Te(g).right:Te(h).right-Te(g).right}var l=e.incoming.filter(o).map(function(g){var h=a(g),m=h<0?u(g.source,e):u(e,g.source);return{id:g.source.id,distance:m,weight:h}}),f=e.outgoing.filter(o).map(function(g){var h=a(g),m=h>0?u(e,g.target):u(g.target,e);return{id:g.target.id,distance:m,weight:h}}),p=l.concat(f).reduce(function(g,h){return g[h.id+"__weight_"+h.weight]=h,g},{}),d=En(p,function(g,h){var m=h.distance,_=h.weight;return m<0||m>s||(g[String(m)]||(g[String(m)]=0),g[String(m)]+=1*_,(!g.distance||g[g.distance]<g[String(m)])&&(g.distance=m)),g},{});return d.distance||i}function PM(e){var t=df(e);return e.host&&(t=t.concat(df(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(df(i))},[]))),t}function df(e){return TM(e).concat(AM(e))}function AM(e){return e.incoming.map(function(t){return t.source})}function TM(e){return e.outgoing.map(function(t){return t.target})}function MM(){return!0}var kM=100;function $v(e,t,n){e.on("autoPlace",kM,function(i){var r=i.shape,o=i.source;return OM(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}}$v.$inject=["eventBus","modeling","canvas"];function OM(e,t,n){n||(n={});var i=n.defaultDistance||Nv,r=De(e),o=Te(e);return{x:o.right+i+t.width/2,y:r.y}}function Fv(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}Fv.$inject=["eventBus","selection"];const DM={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",$v],autoPlaceSelectionBehavior:["type",Fv]};function jv(e,t,n){var i=Gm(e,n);if(w(t,"bpmn:TextAnnotation"))return IM(e,t,i);if(ze(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return BM(e,t,i);if(w(t,"bpmn:FlowNode"))return LM(e,t,i)}function LM(e,t,n){var i=Te(e),r=De(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=CM(e,{filter:function(d){return w(d,"bpmn:SequenceFlow")},direction:o.directionHint}),s=30,c=o.minDistance,u=o.baseOrientation;w(e,"bpmn:BoundaryEvent")&&(u=Qt(e,e.host,-25),u.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var l=n?{x:i.right+a+t.width/2,y:r.y+Hv(u,c,o)}:{x:r.x+Hv(u,c,o),y:i.bottom+a+t.height/2},f={margin:s,minDistance:c},p=n?{y:f}:{x:f};return pf(e,t,l,ff(p))}function Hv(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function IM(e,t,n){var i=Te(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};ot(e)&&(r=De(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 pf(e,t,r,ff(a))}function BM(e,t,n){var i=Te(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 pf(e,t,r,ff(a))}function zv(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return jv(r,i,t)})}zv.$inject=["eventBus","elementRegistry"];const Nc={__depends__:[DM],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",zv]},Gv=[Hm,la,lf,Nc];function NM(e={}){Id(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new go({container:t,moddleExtensions:e.moddleExtensions??us,additionalModules:[...Gv,...e.additionalModules??[]]})}var $M=new Mo("ov"),FM=500;function Xt(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=$M,this._overlayDefaults=V({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=jM(n.getContainer()),this._init()}Xt.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Xt.prototype.get=function(e){if(xn(e)&&(e={id:e}),xn(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?Ge(t.overlays,no({type:e.type})):t.overlays.slice():[]}else return e.type?Ge(this._overlays,no({type:e.type})):e.id?this._overlays[e.id]:null},Xt.prototype.add=function(e,t,n){if(Wt(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=V({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},Xt.prototype.remove=function(e){var t=this.get(e)||[];Oe(t)||(t=[t]);var n=this;I(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(mi(i.html),mi(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)}})},Xt.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Xt.prototype.show=function(){$c(this._overlayRoot)},Xt.prototype.hide=function(){$c(this._overlayRoot,!1)},Xt.prototype.clear=function(){this._overlays={},this._overlayContainers=[],xs(this._overlayRoot)},Xt.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=kt(t);i=o.x,r=o.y}Vv(n,i,r),sn(e.html,"data-container-id",t.id)},Xt.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=kt(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=kt(i).height:s=i.height,o=t.bottom*-1+s}Vv(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Xt.prototype._createOverlayContainer=function(e){var t=ht('<div class="djs-overlays" />');hn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},Xt.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";Wv(this._overlayRoot,n)},Xt.prototype._getOverlayContainer=function(e,t){var n=lt(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},Xt.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)),xn(i)&&(i=ht(i)),o=this._getOverlayContainer(n),r=ht('<div class="djs-overlay" data-overlay-id="'+t+'">'),hn(r,{position:"absolute"}),r.appendChild(i),e.type&&vt(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();$c(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())},Xt.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&&(Nt(r)&&r>t.scale||Nt(o)&&o<t.scale))&&(c=!1),$c(a,c),this._updateOverlayScale(e,t)},Xt.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),Nt(i)&&t.scale<i&&(a=(1/t.scale||1)*i),Nt(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),Nt(a)&&(s="scale("+a+","+a+")"),Wv(o,s)},Xt.prototype._updateOverlaysVisibilty=function(e){var t=this;I(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},Xt.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});I(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){mi(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",FM,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&(I(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&&vt(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 jM(e){var t=ht('<div class="djs-overlay-container" />');return hn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function Vv(e,t,n){hn(e,{left:t+"px",top:n+"px"})}function $c(e,t){e.style.display=t===!1?"none":""}function Wv(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Fc={__init__:["overlays"],overlays:["type",Xt]};function hf(e,t){t.invoke(ee,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)})}ye(hf,ee),hf.$inject=["canvas","injector"];const HM={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",hf]};function Ba(e){return CSS.escape(e)}var zM={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function Uv(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return zM[t]})}var GM="bjs-breadcrumbs-shown";function qv(e,t,n){var i=ht('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=vt(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var u=c.element,l=ie(u),f=lt(a,function(p){return p===l});f&&s()});function s(c){c&&(a=VM(c));var u=a.flatMap(function(f){var p=n.findRoot(_i(f))||n.findRoot(f.id);if(!p&&w(f,"bpmn:Process")){var d=t.find(function(m){var _=ie(m);return _&&_.get("processRef")===f});p=d&&n.findRoot(d.id)}if(!p)return[];var g=Uv(f.name||f.id),h=ht('<li><span class="bjs-crumb"><a title="'+g+'">'+g+"</a></span></li>");return h.addEventListener("click",function(){n.setRootElement(p)}),h});i.innerHTML="";var l=u.length>1;o.toggle(GM,l),u.forEach(function(f){i.appendChild(f)})}e.on("root.set",function(c){s(c.element)})}qv.$inject=["eventBus","elementRegistry","canvas"];function VM(e){for(var t=ie(e),n=[],i=t;i;i=i.$parent)(w(i,"bpmn:SubProcess")||w(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function Yv(e,t){var n=null,i=new WM;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,!(!w(o,"bpmn:SubProcess")&&!s)){s=s||{x:0,y:0,zoom:1};var c=(a.x-s.x)*a.scale,u=(a.y-s.y)*a.scale;(c!==0||u!==0)&&t.scroll({dx:c,dy:u}),s.zoom!==a.scale&&t.zoom(s.zoom,{x:0,y:0})}}),e.on("diagram.clear",function(){i.clear(),n=null})}Yv.$inject=["eventBus","canvas"];function WM(){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 Kv={x:180,y:160};function Gr(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}Gr.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)})}},Gr.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;w(a,"bpmn:SubProcess")&&!o.isExpanded&&n.push(a),qM(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},Gr.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=UM(e),i={x:n.x-Kv.x,y:n.y-Kv.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)})},Gr.prototype._moveToDiPlane=function(e,t){var n=Xv(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},Gr.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},Gr.$inject=["eventBus","moddle"];function Xv(e){return w(e,"bpmndi:BPMNDiagram")?e:Xv(e.$parent)}function UM(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=Te(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),Ms(t)}function qM(e,t){var n=e.$parent;return!(!w(n,"bpmn:SubProcess")||n===t.bpmnElement||ze(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var jc=250,YM='<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>',KM="bjs-drilldown-empty";function gr(e,t,n,i,r){ee.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",jc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",jc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],jc,function(a){var s=a.oldParent,c=a.newParent||a.parent,u=a.shape;o._canDrillDown(u)&&o._addOverlay(u),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(u)},!0),this.reverted(["shape.create","shape.move","shape.delete"],jc,function(a){var s=a.oldParent,c=a.newParent||a.parent,u=a.shape;o._canDrillDown(u)&&o._addOverlay(u),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(u)},!0),t.on("import.render.complete",function(){n.filter(function(a){return o._canDrillDown(a)}).map(function(a){o._addOverlay(a)})})}ye(gr,ee),gr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},gr.prototype._canDrillDown=function(e){var t=this._canvas;return w(e,"bpmn:SubProcess")&&t.findRoot(_i(e))},gr.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;vt(i.html).toggle(KM,!r)}},gr.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=ht('<button type="button" class="bjs-drilldown">'+YM+"</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(_i(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},gr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},gr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const XM={__depends__:[Fc,Up,HM],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",qv],drilldownCentering:["type",Yv],drilldownOverlayBehavior:["type",gr],subprocessCompatibility:["type",Gr]};function yr(e){_t.call(this,e)}ye(yr,_t),yr.prototype._modules=[Hm,XM,Fc,Xn,la],yr.prototype._moddleExtensions={};var Hc="keyboard.keydown",ZM="keyboard.keyup",QM=1e3,Zv="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 mn(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(Zv));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}mn.$inject=["config.keyboard","eventBus"],mn.prototype._keydownHandler=function(e){this._keyHandler(e,Hc)},mn.prototype._keyupHandler=function(e){this._keyHandler(e,ZM)},mn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Hc,i),n&&e.preventDefault()}},mn.prototype._isEventIgnored=function(e){return!1},mn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(Zv)),this.unbind(),e=this._node=this._target,Be.bind(e,"keydown",this._keydownHandler),Be.bind(e,"keyup",this._keyupHandler),this._fire("bind")},mn.prototype.getBinding=function(){return this._node},mn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),Be.unbind(e,"keydown",this._keydownHandler),Be.unbind(e,"keyup",this._keyupHandler)),this._node=null},mn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},mn.prototype.addListener=function(e,t,n){Ut(e)&&(n=t,t=e,e=QM),this._eventBus.on(n||Hc,e,t)},mn.prototype.removeListener=function(e,t){this._eventBus.off(t||Hc,e)},mn.prototype.hasModifier=bA,mn.prototype.isCmd=An,mn.prototype.isShift=Ip,mn.prototype.isKey=jt;var JM=500;function Lo(e,t){var n=this;e.on("editorActions.init",JM,function(i){var r=i.editorActions;n.registerBindings(t,r)})}Lo.$inject=["eventBus","keyboard"],Lo.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(SA(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(RA(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(_A(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(xA(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(wA(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(EA(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(jt(["+","Add","="],r)&&An(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(jt(["-","Subtract"],r)&&An(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(jt("0",r)&&An(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(jt(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const mf={__init__:["keyboard","keyboardBindings"],keyboard:["type",mn],keyboardBindings:["type",Lo]};var e2={moveSpeed:50,moveSpeedAccelerated:200};function Qv(e,t,n){var i=this;this._config=V({},e2,e||{}),t.addListener(r);function r(o){var a=o.keyEvent,s=i._config;if(t.isCmd(a)&&t.isKey(["ArrowLeft","Left","ArrowUp","Up","ArrowDown","Down","ArrowRight","Right"],a)){var c=t.isShift(a)?s.moveSpeedAccelerated:s.moveSpeed,u;switch(a.key){case"ArrowLeft":case"Left":u="left";break;case"ArrowUp":case"Up":u="up";break;case"ArrowRight":case"Right":u="right";break;case"ArrowDown":case"Down":u="down";break}return i.moveCanvas({speed:c,direction:u}),!0}}this.moveCanvas=function(o){var a=0,s=0,c=o.speed,u=c/Math.min(Math.sqrt(n.viewbox().scale),1);switch(o.direction){case"left":a=u;break;case"up":s=u;break;case"right":a=-u;break;case"down":s=-u;break}n.scroll({dx:a,dy:s})}}Qv.$inject=["config.keyboardMove","keyboard","canvas"];const Jv={__depends__:[mf],__init__:["keyboardMove"],keyboardMove:["type",Qv]};var t2=15;function eb(e,t){var n;function i(s){return a(s.originalEvent)}e.on("canvas.focus.changed",function(s){s.focused?e.on("element.mousedown",500,i):e.off("element.mousedown",i)});function r(s){var c=n.start,u=n.button,l=Nr(s),f=ai(l,c);if(!n.dragging&&n2(f)>t2&&(n.dragging=!0,u===0&&Py(e),hc("grab")),n.dragging){var p=n.last||n.start;f=ai(l,p),t.scroll({dx:f.x,dy:f.y}),n.last=l}s.preventDefault()}function o(s){Be.unbind(document,"mousemove",r),Be.unbind(document,"mouseup",o),n=null,Cy()}function a(s){if(!kr(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:Nr(s)},Be.bind(document,"mousemove",r),Be.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}eb.$inject=["eventBus","canvas"];function n2(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const tb={__init__:["moveCanvas"],moveCanvas:["type",eb]};function nb(e,t){var n=Ol(e.min),i=Ol(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function i2(e,t){return Math.max(e.min,Math.min(e.max,t))}var r2=Math.sign||function(e){return e>=0?1:-1},gf={min:.2,max:4},ib=10,o2=.1,a2=.75;function Ei(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=vn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||a2;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}Ei.$inject=["config.zoomScroll","eventBus","canvas"],Ei.prototype.scroll=function(t){this._canvas.scroll(t)},Ei.prototype.reset=function(){this._canvas.zoom("fit-viewport")},Ei.prototype.zoom=function(t,n){var i=nb(gf,ib*2);this._totalDelta+=t,Math.abs(this._totalDelta)>o2&&(this._zoom(t,n,i),this._totalDelta=0)},Ei.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||Lg()&&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))*r2(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)}},Ei.prototype.stepZoom=function(t,n){var i=nb(gf,ib);this._zoom(t,n,i)},Ei.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=Ol(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(i2(gf,s),t)},Ei.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&Be[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},Ei.prototype._init=function(e){this.toggle(e)};const rb={__init__:["zoomScroll"],zoomScroll:["type",Ei]};function Na(e){yr.call(this,e)}ye(Na,yr),Na.prototype._navigationModules=[Jv,tb,rb],Na.prototype._modules=[].concat(yr.prototype._modules,Na.prototype._navigationModules);function yf(e){return e&&e[e.length-1]}function ob(e){return e.y}function ab(e){return e.x}var s2={left:ab,center:ab,right:function(e){return e.x+e.width},top:ob,middle:ob,bottom:function(e){return e.y+e.height}};function Io(e,t){this._modeling=e,this._rules=t}Io.$inject=["modeling","rules"],Io.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}},Io.prototype._isType=function(e,t){return t.indexOf(e)!==-1},Io.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),i=n.axis,r=n.dimension,o={},a={},s=!1,c,u,l;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"]))l=yf(t),o[e]=l[i]+l[r];else if(this._isType(e,["center","middle"])){if(I(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=ui(a,function(p){return p.elements.length>1&&(s=!0),p.elements.length}),s)return o[e]=yf(c).center,o;u=t[0],t=ui(t,function(p){return p[i]+p[r]}),l=yf(t),o[e]=f(u,l)}return o},Io.prototype.trigger=function(e,t){var n=this._modeling,i,r=Ge(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),Oe(i)&&(r=i),!(r.length<2||!i)){var o=s2[t],a=ui(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const c2={__init__:["alignElements"],alignElements:["type",Io]},u2=new Mo;function Bo(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Bo.$inject=["eventBus"],Bo.prototype.schedule=function(e,t=u2.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},Bo.prototype._schedule=function(e,t){const n=l2();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}},Bo.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Bo.prototype._cancel=function(e){clearTimeout(e.executionId)};function l2(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const p2={scheduler:["type",Bo]};var f2="djs-element-hidden",zc=".entry",d2=1e3,sb=8,h2=300;function Dt(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}Dt.$inject=["canvas","elementRegistry","eventBus","scheduler"],Dt.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=Oe(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=Oe(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},Dt.prototype._createContainer=function(){var e=ht('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},Dt.prototype.registerProvider=function(e,t){t||(t=e,e=d2),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},Dt.prototype.getEntries=function(e){var t=this._getProviders(),n=Oe(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return I(t,function(r){if(Ut(r[n])){var o=r[n](e);Ut(o)?i=o(i):I(o,function(a,s){i[s]=a})}}),i},Dt.prototype.trigger=function(e,t,n){var i=this,r,o,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(r=sn(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},h2);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,o,n)},Dt.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(Ut(s)){if(t==="click")return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},Dt.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))}},Dt.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Dt.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;I(t,function(r,o){var a=r.group||"default",s=ht(r.html||'<div class="entry" draggable="true"></div>'),c;sn(s,"data-action",o),c=rt("[data-group="+Ba(a)+"]",n),c||(c=ht('<div class="group"></div>'),sn(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&m2(s,r.className),r.title&&sn(s,"title",r.title),r.imageUrl&&(i=ht("<img>"),sn(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),vt(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},Dt.prototype._createHtml=function(e){var t=this,n=ht('<div class="djs-context-pad"></div>');return Rn.bind(n,zc,"click",function(i){t.trigger("click",i)}),Rn.bind(n,zc,"dragstart",function(i){t.trigger("dragstart",i)}),Rn.bind(n,zc,"mouseover",function(i){t.trigger("mouseover",i)}),Rn.bind(n,zc,"mouseout",function(i){t.trigger("mouseout",i)}),Be.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},Dt.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()&&y2(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},Dt.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},Dt.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return Oe(e)!==Oe(n)?!1:Oe(e)?e.length===n.length&&Pr(e,function(i){return n.includes(i)}):n===e},Dt.prototype.isShown=function(){return this.isOpen()&&vt(this._current.html).has("open")},Dt.prototype.show=function(){this.isOpen()&&(vt(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},Dt.prototype.hide=function(){this.isOpen()&&(vt(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},Dt.prototype._getPosition=function(e){if(!Oe(e)&&ot(e)){var t=this._canvas.viewbox(),n=g2(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+sb*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+sb*this._canvas.zoom(),top:s.top-a.top}},Dt.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")},Dt.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=Oe(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,f2)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},Dt.prototype._getTargetBounds=function(e){var t=this,n=Oe(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 m2(e,t){var n=vt(e);t=Oe(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function g2(e){return e.waypoints[e.waypoints.length-1]}function y2(e,t){return e=Oe(e)?e:[e],t=Oe(t)?t:[t],e.length===t.length&&Pr(e,function(n){return t.includes(n)})}const cb={__depends__:[dc,p2,Fc],contextPad:["type",Dt]};var Gc,wt,ub,vr,lb,pb,fb,vf,Vc,$a,db,bf,_f,xf,Wc={},Uc=[],v2=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,qc=Array.isArray;function zi(e,t){for(var n in t)e[n]=t[n];return e}function wf(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function hb(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?Gc.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 Yc(e,a,i,r,null)}function Yc(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??++ub,__i:-1,__u:0};return r==null&&wt.vnode!=null&&wt.vnode(o),o}function Kc(e){return e.children}function Xc(e,t){this.props=e,this.context=t}function Vr(e,t){if(t==null)return e.__?Vr(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"?Vr(e):null}function b2(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=zi({},t);o.__v=t.__v+1,wt.vnode&&wt.vnode(o),Ef(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??Vr(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,wb(i,o,r),t.__e=t.__=null,o.__e!=n&&mb(o)}}function mb(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}),mb(e)}function gb(e){(!e.__d&&(e.__d=!0)&&vr.push(e)&&!Zc.__r++||lb!=wt.debounceRendering)&&((lb=wt.debounceRendering)||pb)(Zc)}function Zc(){try{for(var e,t=1;vr.length;)vr.length>t&&vr.sort(fb),e=vr.shift(),t=vr.length,b2(e)}finally{vr.length=Zc.__r=0}}function yb(e,t,n,i,r,o,a,s,c,u,l){var f,p,d,g,h,m,_=i&&i.__k||Uc,y=t.length;for(c=_2(n,t,_,c,y),f=0;f<y;f++)(d=n.__k[f])!=null&&(p=d.__i!=-1&&_[d.__i]||Wc,d.__i=f,m=Ef(e,d,p,r,o,a,s,c,u,l),g=d.__e,d.ref&&p.ref!=d.ref&&(p.ref&&Sf(p.ref,null,d),l.push(d.ref,d.__c||g,d)),h==null&&g!=null&&(h=g),4&d.__u?(c=vb(d,c,e),p.__e&&(p.__e=null)):typeof d.type=="function"&&m!==void 0?c=m:g&&(c=g.nextSibling),d.__u&=-7);return n.__e=h,c}function _2(e,t,n,i,r){var o,a,s,c,u,l=n.length,f=l,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]=Yc(null,a,null,null,null):qc(a)?a=e.__k[o]=Yc(Kc,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=Yc(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,(u=a.__i=x2(a,n,c,f))!=-1&&(f--,(s=n[u])&&(s.__u|=2)),s==null||s.__v==null?(u==-1&&(r>l?p--:r<l&&p++),typeof a.type!="function"&&(a.__u|=4)):u!=c&&(u==c-1?p--:u==c+1?p++:(u>c?p--:p++,a.__u|=4))):e.__k[o]=null;if(f)for(o=0;o<l;o++)(s=n[o])!=null&&(2&s.__u)==0&&(s.__e==i&&(i=Vr(s)),Sb(s,s));return i}function vb(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=vb(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Vr(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function x2(e,t,n,i){var r,o,a,s=e.key,c=e.type,u=t[n],l=u!=null&&(2&u.__u)==0;if(u===null&&s==null||l&&s==u.key&&c==u.type)return n;if(i>(l?1:0)){for(r=n-1,o=n+1;r>=0||o<t.length;)if((u=t[a=r>=0?r--:o++])!=null&&(2&u.__u)==0&&s==u.key&&c==u.type)return a}return-1}function bb(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||v2.test(t)?n:n+"px"}function Qc(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||bb(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||bb(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(db,"$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[$a]=i[$a]:(n[$a]=bf,e.addEventListener(t,o?xf:_f,o)):e.removeEventListener(t,o?xf:_f,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 _b(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Vc]==null)t[Vc]=bf++;else if(t[Vc]<n[$a])return;return n(wt.event?wt.event(t):t)}}}function Ef(e,t,n,i,r,o,a,s,c,u){var l,f,p,d,g,h,m,_,y,x,S,P,C,L,T,j,k=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(l=wt.__b)&&l(t);e:if(typeof k=="function"){f=a.length;try{if(y=t.props,x=k.prototype&&k.prototype.render,S=(l=k.contextType)&&i[l.__c],P=l?S?S.props.value:l.__:i,n.__c?_=(p=t.__c=n.__c).__=p.__E:(x?t.__c=p=new k(y,P):(t.__c=p=new Xc(y,P),p.constructor=k,p.render=E2),S&&S.sub(p),p.state||(p.state={}),p.__n=i,d=p.__d=!0,p.__h=[],p._sb=[]),x&&p.__s==null&&(p.__s=p.state),x&&k.getDerivedStateFromProps!=null&&(p.__s==p.state&&(p.__s=zi({},p.__s)),zi(p.__s,k.getDerivedStateFromProps(y,p.__s))),g=p.props,h=p.state,p.__v=t,d)x&&k.getDerivedStateFromProps==null&&p.componentWillMount!=null&&p.componentWillMount(),x&&p.componentDidMount!=null&&p.__h.push(p.componentDidMount);else{if(x&&k.getDerivedStateFromProps==null&&y!==g&&p.componentWillReceiveProps!=null&&p.componentWillReceiveProps(y,P),t.__v==n.__v||!p.__e&&p.shouldComponentUpdate!=null&&p.shouldComponentUpdate(y,p.__s,P)===!1){t.__v!=n.__v&&(p.props=y,p.state=p.__s,p.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(D){D&&(D.__=t)}),Uc.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&a.push(p),s=Vr(n);break e}p.componentWillUpdate!=null&&p.componentWillUpdate(y,p.__s,P),x&&p.componentDidUpdate!=null&&p.__h.push(function(){p.componentDidUpdate(g,h,m)})}if(p.context=P,p.props=y,p.__P=e,p.__e=!1,C=wt.__r,L=0,x)p.state=p.__s,p.__d=!1,C&&C(t),l=p.render(p.props,p.state,p.context),Uc.push.apply(p.__h,p._sb),p._sb=[];else do p.__d=!1,C&&C(t),l=p.render(p.props,p.state,p.context),p.state=p.__s;while(p.__d&&++L<25);p.state=p.__s,p.getChildContext!=null&&(i=zi(zi({},i),p.getChildContext())),x&&!d&&p.getSnapshotBeforeUpdate!=null&&(m=p.getSnapshotBeforeUpdate(g,h)),T=l!=null&&l.type===Kc&&l.key==null?Eb(l.props.children):l,s=yb(e,qc(T)?T:[T],t,n,i,r,o,a,s,c,u),p.base=t.__e,t.__u&=-161,p.__h.length&&a.push(p),_&&(p.__E=p.__=null)}catch(D){if(a.length=f,t.__v=null,c||o!=null){if(D.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;o!=null&&(o[o.indexOf(s)]=null),t.__e=s}else if(o!=null)for(j=o.length;j--;)wf(o[j])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),D.then||xb(t),wt.__e(D,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=w2(n.__e,t,n,i,r,o,a,c,u);return(l=wt.diffed)&&l(t),128&t.__u?void 0:s}function xb(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(xb))}function wb(e,t,n){for(var i=0;i<n.length;i++)Sf(n[i],n[++i],n[++i]);wt.__c&&wt.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){wt.__e(o,r.__v)}})}function Eb(e){return typeof e!="object"||e==null||e.__b>0?e:qc(e)?e.map(Eb):e.constructor!==void 0?null:zi({},e)}function w2(e,t,n,i,r,o,a,s,c){var u,l,f,p,d,g,h,m=n.props||Wc,_=t.props,y=t.type;if(y=="svg"?r="http://www.w3.org/2000/svg":y=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),o!=null){for(u=0;u<o.length;u++)if((d=o[u])&&"setAttribute"in d==!!y&&(y?d.localName==y:d.nodeType==3)){e=d,o[u]=null;break}}if(e==null){if(y==null)return document.createTextNode(_);e=document.createElementNS(r,y,_.is&&_),s&&(wt.__m&&wt.__m(t,o),s=!1),o=null}if(y==null)m===_||s&&e.data==_||(e.data=_);else{if(o=y=="textarea"&&_.defaultValue!=null?null:o&&Gc.call(e.childNodes),!s&&o!=null)for(m={},u=0;u<e.attributes.length;u++)m[(d=e.attributes[u]).name]=d.value;for(u in m)d=m[u],u=="dangerouslySetInnerHTML"?f=d:u=="children"||u in _||u=="value"&&"defaultValue"in _||u=="checked"&&"defaultChecked"in _||Qc(e,u,null,d,r);for(u in _)d=_[u],u=="children"?p=d:u=="dangerouslySetInnerHTML"?l=d:u=="value"?g=d:u=="checked"?h=d:s&&typeof d!="function"||m[u]===d||Qc(e,u,d,m[u],r);if(l)s||f&&(l.__html==f.__html||l.__html==e.innerHTML)||(e.innerHTML=l.__html),t.__k=[];else if(f&&(e.innerHTML=""),yb(t.type=="template"?e.content:e,qc(p)?p:[p],t,n,i,y=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&Vr(n,0),s,c),o!=null)for(u=o.length;u--;)wf(o[u]);s&&y!="textarea"||(u="value",y=="progress"&&g==null?e.removeAttribute("value"):g!=null&&(g!==e[u]||y=="progress"&&!g||y=="option"&&g!=m[u])&&Qc(e,u,g,m[u],r),u="checked",h!=null&&h!=e[u]&&Qc(e,u,h,m[u],r))}return e}function Sf(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){wt.__e(r,n)}}function Sb(e,t,n){var i,r;if(wt.unmount&&wt.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||Sf(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){wt.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&Sb(i[r],t,n||typeof e.type!="function");n||wf(e.__e),e.__c=e.__=e.__e=void 0}function E2(e,t,n){return this.constructor(e,n)}function Rb(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),wt.__&&wt.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],Ef(t,e=t.__k=hb(Kc,null,[e]),r||Wc,Wc,t.namespaceURI,r?null:t.firstChild?Gc.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),wb(o,e,a),e.props.children=null}Gc=Uc.slice,wt={__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}},ub=0,Xc.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=zi({},this.state),typeof e=="function"&&(e=e(zi({},n),this.props)),e&&zi(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),gb(this))},Xc.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),gb(this))},Xc.prototype.render=Kc,vr=[],pb=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,fb=function(e,t){return e.__v.__b-t.__v.__b},Zc.__r=0,vf=Math.random().toString(8),Vc="__d"+vf,$a="__a"+vf,db=/(PointerCapture)$|Capture$/i,bf=0,_f=_b(!1),xf=_b(!0);var Cb=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,Cb(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},Pb=new Map;function S2(e){var t=Pb.get(this);return t||(t=new Map,Pb.set(this,t)),(t=Cb(this,t.get(e)||(t.set(e,t=(function(n){for(var i,r,o=1,a="",s="",c=[0],u=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=""},l=0;l<n.length;l++){l&&(o===1&&u(),u(l));for(var f=0;f<n[l].length;f++)i=n[l][f],o===1?i==="<"?(u(),c=[c],o=3):a+=i:o===4?a==="--"&&i===">"?(o=1,a=""):a=i+a[0]:s?i===s?s="":a+=i:i==='"'||i==="'"?s=i:i===">"?(u(),o=1):o&&(i==="="?(o=5,r=a,a=""):i==="/"&&(o<5||n[l][f+1]===">")?(u(),o===3&&(c=c[0]),o=c,(c=c[0]).push(2,0,o),o=0):i===" "||i===" "||i===`
11
+ `||i==="\r"?(u(),o=2):a+=i),o===3&&a==="!--"&&(o=4,c=c[0])}return u(),c})(e)),t),arguments,[])).length>1?t:t[0]}var st=S2.bind(hb),No,Lt,Rf,Ab,Fa=0,Tb=[],Ht=wt,Mb=Ht.__b,kb=Ht.__r,Ob=Ht.diffed,Db=Ht.__c,Lb=Ht.unmount,Ib=Ht.__;function Jc(e,t){Ht.__h&&Ht.__h(Lt,e,Fa||t),Fa=0;var n=Lt.__H||(Lt.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Cf(e){return Fa=1,R2(Nb,e)}function R2(e,t,n){var i=Jc(No++,2);if(i.t=e,!i.__c&&(i.__=[Nb(void 0,t),function(s){var c=i.__N?i.__N[0]:i.__[0],u=i.t(c,s);c!==u&&(i.__N=[u,i.__[1]],i.__c.setState({}))}],i.__c=Lt,!Lt.__f)){var r=function(s,c,u){if(!i.__c.__H)return!0;var l=!1,f=i.__c.props!==s;if(i.__c.__H.__.some(function(d){if(d.__N){l=!0;var g=d.__[0];d.__=d.__N,d.__N=void 0,g!==d.__[0]&&(f=!0)}}),o){var p=o.call(this,s,c,u);return l?p||f:p}return!l||f};Lt.__f=!0;var o=Lt.shouldComponentUpdate,a=Lt.componentWillUpdate;Lt.componentWillUpdate=function(s,c,u){if(this.__e){var l=o;o=void 0,r(s,c,u),o=l}a&&a.call(this,s,c,u)},Lt.shouldComponentUpdate=r}return i.__N||i.__}function eu(e,t){var n=Jc(No++,3);!Ht.__s&&Tf(n.__H,t)&&(n.__=e,n.u=t,Lt.__H.__h.push(n))}function Pf(e,t){var n=Jc(No++,4);!Ht.__s&&Tf(n.__H,t)&&(n.__=e,n.u=t,Lt.__h.push(n))}function tu(e){return Fa=5,Gi(function(){return{current:e}},[])}function Gi(e,t){var n=Jc(No++,7);return Tf(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function ja(e,t){return Fa=8,Gi(function(){return e},t)}function C2(){for(var e;e=Tb.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(nu),t.__h.some(Af),t.__h=[]}catch(n){t.__h=[],Ht.__e(n,e.__v)}}}Ht.__b=function(e){Lt=null,Mb&&Mb(e)},Ht.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Ib&&Ib(e,t)},Ht.__r=function(e){kb&&kb(e),No=0;var t=(Lt=e.__c).__H;t&&(Rf===Lt?(t.__h=[],Lt.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(nu),t.__h.some(Af),t.__h=[],No=0)),Rf=Lt},Ht.diffed=function(e){Ob&&Ob(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Tb.push(t)!==1&&Ab===Ht.requestAnimationFrame||((Ab=Ht.requestAnimationFrame)||P2)(C2)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),Rf=Lt=null},Ht.__c=function(e,t){t.some(function(n){try{n.__h.some(nu),n.__h=n.__h.filter(function(i){return!i.__||Af(i)})}catch(i){t.some(function(r){r.__h&&(r.__h=[])}),t=[],Ht.__e(i,n.__v)}}),Db&&Db(e,t)},Ht.unmount=function(e){Lb&&Lb(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{nu(i)}catch(r){t=r}}),n.__H=void 0,t&&Ht.__e(t,n.__v))};var Bb=typeof requestAnimationFrame=="function";function P2(e){var t,n=function(){clearTimeout(i),Bb&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);Bb&&(t=requestAnimationFrame(n))}function nu(e){var t=Lt,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),Lt=t}function Af(e){var t=Lt;e.__c=e.__(),Lt=t}function Tf(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function Nb(e,t){return typeof t=="function"?t(e):t}function A2(e){const{navigationStack:t,setNavigationStack:n}=e,i=Gi(()=>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 st`
12
12
  <div class="djs-popup-breadcrumbs">
13
- ${r&&ct`
13
+ ${r&&st`
14
14
  <button
15
15
  type="button"
16
16
  class="djs-popup-breadcrumbs-item djs-popup-breadcrumbs-item--back"
@@ -23,7 +23,7 @@
23
23
  </svg>
24
24
  </button>
25
25
  `}
26
- ${i.map((a,s)=>ct`
26
+ ${i.map((a,s)=>st`
27
27
  <button
28
28
  key=${s}
29
29
  type="button"
@@ -35,22 +35,22 @@
35
35
  </button>
36
36
  <span class="djs-popup-breadcrumbs-item--separator" aria-hidden="true"></span>
37
37
  `)}
38
- ${o&&ct`
38
+ ${o&&st`
39
39
  <span class="djs-popup-breadcrumbs-item djs-popup-breadcrumbs-item--current" title=${o}>
40
40
  ${o}
41
41
  </span>
42
42
  `}
43
43
  </div>
44
- `}function Nb(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=Nb(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function iu(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=Nb(e))&&(i&&(i+=" "),i+=t);return i}function R2(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:r,title:o}=e,a=Hi(()=>C2(t),[t]),s=u=>u.action&&!u.disabled,c=(u,l)=>{if(s(l))return n(u,l)};return ct`
44
+ `}function $b(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=$b(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function iu(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=$b(e))&&(i&&(i+=" "),i+=t);return i}function T2(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:r,title:o}=e,a=Gi(()=>M2(t),[t]),s=u=>u.action&&!u.disabled,c=(u,l)=>{if(s(l))return n(u,l)};return st`
45
45
  <div class="djs-popup-header">
46
46
  <h3 class="djs-popup-title" title=${o}>${o}</h3>
47
- ${a.map(u=>ct`
47
+ ${a.map(u=>st`
48
48
  <ul key=${u.id} class="djs-popup-header-group" data-header-group=${u.id}>
49
49
 
50
- ${u.entries.map(l=>ct`
50
+ ${u.entries.map(l=>st`
51
51
  <li key=${l.id}>
52
52
  <${s(l)?"button":"span"}
53
- class=${P2(l,l===i)}
53
+ class=${k2(l,l===i)}
54
54
  onClick=${f=>c(f,l)}
55
55
  title=${l.title||l.label}
56
56
  data-id=${l.id}
@@ -60,8 +60,8 @@
60
60
  onFocus=${()=>s(l)&&r(l)}
61
61
  onBlur=${()=>s(l)&&r(null)}
62
62
  >
63
- ${l.imageUrl&&ct`<img class="djs-popup-entry-icon" src=${l.imageUrl} alt="" />`||l.imageHtml&&ct`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:l.imageHtml}} />`}
64
- ${l.label?ct`
63
+ ${l.imageUrl&&st`<img class="djs-popup-entry-icon" src=${l.imageUrl} alt="" />`||l.imageHtml&&st`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:l.imageHtml}} />`}
64
+ ${l.label?st`
65
65
  <span class="djs-popup-label">${l.label}</span>
66
66
  `:null}
67
67
  </${l.action?"button":"span"}>
@@ -70,11 +70,11 @@
70
70
  </ul>
71
71
  `)}
72
72
  </div>
73
- `}function C2(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 P2(e,t){return iu("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function $b(e,t){return`${e}-entry-${t.id}`}function A2(e){const{idPrefix:t,entry:n,selected:i,onMouseEnter:r,onMouseLeave:o,onAction:a}=e,s=(u,l)=>{if(!n.disabled)return a(u,n,l)},c=!n.entries;return ct`
73
+ `}function M2(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 k2(e,t){return iu("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function Fb(e,t){return`${e}-entry-${t.id}`}function O2(e){const{idPrefix:t,entry:n,selected:i,onMouseEnter:r,onMouseLeave:o,onAction:a}=e,s=(u,l)=>{if(!n.disabled)return a(u,n,l)},c=!n.entries;return st`
74
74
  <li
75
75
  class=${iu("entry",{selected:i,disabled:n.disabled})}
76
76
  data-id=${n.id}
77
- id=${$b(t,n)}
77
+ id=${Fb(t,n)}
78
78
  role="option"
79
79
  aria-selected=${i||void 0}
80
80
  aria-haspopup=${n.entries?"true":void 0}
@@ -90,15 +90,15 @@
90
90
  <span
91
91
  class=${iu("djs-popup-entry-name",n.className)}
92
92
  >
93
- ${n.imageUrl&&ct`<img class="djs-popup-entry-icon" src=${n.imageUrl} alt="" />`||n.imageHtml&&ct`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:n.imageHtml}} />`}
93
+ ${n.imageUrl&&st`<img class="djs-popup-entry-icon" src=${n.imageUrl} alt="" />`||n.imageHtml&&st`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:n.imageHtml}} />`}
94
94
 
95
- ${n.label?ct`
95
+ ${n.label?st`
96
96
  <span class="djs-popup-label">
97
97
  ${n.label}
98
98
  </span>
99
99
  `:null}
100
100
 
101
- ${n.documentationRef&&ct`
101
+ ${n.documentationRef&&st`
102
102
  <a
103
103
  class="djs-popup-entry-docs"
104
104
  href=${n.documentationRef}
@@ -115,7 +115,7 @@
115
115
  </a>
116
116
  `}
117
117
  </span>
118
- ${n.description&&ct`
118
+ ${n.description&&st`
119
119
  <span
120
120
  class="djs-popup-entry-description"
121
121
  >
@@ -123,7 +123,7 @@
123
123
  </span>
124
124
  `}
125
125
  </div>
126
- ${n.entries&&ct`
126
+ ${n.entries&&st`
127
127
  <div class="djs-popup-entry-chevron" aria-hidden="true">
128
128
  <svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
129
129
  <path fill-rule="evenodd" clip-rule="evenodd" d="M3.96967 1.46967C4.26256 1.17678 4.73744 1.17678 5.03033 1.46967L9.03033 5.46967C9.32322 5.76256 9.32322 6.23744 9.03033 6.53033L5.03033 10.5303C4.73744 10.8232 4.26256 10.8232 3.96967 10.5303C3.67678 10.2374 3.67678 9.76256 3.96967 9.46967L7.43934 6L3.96967 2.53033C3.67678 2.23744 3.67678 1.76256 3.96967 1.46967Z" fill="currentColor"/>
@@ -131,7 +131,7 @@
131
131
  </div>
132
132
  `}
133
133
  </li>
134
- `}function T2(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:r,idPrefix:o,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:u,...l}=e,f=tu();Cf(()=>{if(!r||!r.current)return;const h=f.current;if(!h)return;const m=h.querySelector(".selected");m&&M2(m)},[t]);const p=()=>{r.current=!1},d=h=>{r.current||n(h)},g=()=>{r.current||n(null)};return ct`
134
+ `}function D2(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:r,idPrefix:o,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:u,...l}=e,f=tu();Pf(()=>{if(!r||!r.current)return;const h=f.current;if(!h)return;const m=h.querySelector(".selected");m&&L2(m)},[t]);const p=()=>{r.current=!1},d=h=>{r.current||n(h)},g=()=>{r.current||n(null)};return st`
135
135
  <div
136
136
  class="djs-popup-results"
137
137
  ref=${f}
@@ -142,9 +142,9 @@
142
142
  aria-activedescendant=${u}
143
143
  onMouseMove=${p}
144
144
  >
145
- ${i.map(h=>ct`
146
- ${h.name&&ct`
147
- <div key=${h.id} id=${Fb(o,h)} class="entry-header" title=${h.name}>
145
+ ${i.map(h=>st`
146
+ ${h.name&&st`
147
+ <div key=${h.id} id=${jb(o,h)} class="entry-header" title=${h.name}>
148
148
  ${h.name}
149
149
  </div>
150
150
  `}
@@ -152,10 +152,10 @@
152
152
  class="djs-popup-group"
153
153
  data-group=${h.id}
154
154
  role="group"
155
- aria-labelledby=${h.name?Fb(o,h):void 0}
155
+ aria-labelledby=${h.name?jb(o,h):void 0}
156
156
  >
157
- ${h.entries.map(m=>ct`
158
- <${A2}
157
+ ${h.entries.map(m=>st`
158
+ <${O2}
159
159
  key=${m.id}
160
160
  idPrefix=${o}
161
161
  entry=${m}
@@ -168,19 +168,19 @@
168
168
  </ul>
169
169
  `)}
170
170
  </div>
171
- `}function Fb(e,t){return`${e}-group-${t.id}`}function M2(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const k2=new Po("djs-popup");function O2(e){const{onClose:t,onSelect:n,className:i,headerEntries:r,position:o,title:a,width:s,scale:c,search:u,emptyPlaceholder:l,searchFn:f,entries:p,onOpened:d,onClosed:g}=e,[h,m]=Rf([]);eu(()=>{m([])},[p]);const[_,y]=Rf(""),x=_.trim().length>0,S=Hi(()=>I2(p),[p]),P=Hi(()=>Ft(u)?S.length>5:!1,[u,S]),C=Hi(()=>{const U=h.length?h[h.length-1].entries:p;return P?x?f(S.filter(({searchable:q})=>q!==!1),_,{keys:["label","search","description"]}).map(({item:q})=>q):U.filter(({rank:q=0})=>q>=0):U},[P,x,S,_,f,h,p]),L=Hi(()=>x?C.length?[{id:"default",entries:C}]:[]:B2(C),[C,x]),[T,j]=Rf(C[0]),k=tu(null),D=tu(!1),z=Hi(()=>k2.next(),[]),se=`${z}-results`,we=T&&$b(z,T);eu(()=>{const U=k.current;U&&C.includes(U)?j(U):j(C[0]),k.current=null},[C]);const Ke=$a(U=>{const q=L2(L);let Ve=q.indexOf(T)+U;Ve<0&&(Ve=q.length-1),Ve>=q.length&&(Ve=0),D.current=!0,j(q[Ve])},[L,T]),Y=$a(U=>{U>0&&T&&T.entries&&(D.current=!0,m(q=>[...q,T])),U<0&&h.length>0&&(D.current=!0,k.current=h[h.length+U],m(q=>q.slice(0,U)))},[T,h]),ue=$a((U,q,Z)=>{if(!(!q||q.disabled))return q.entries?(U.preventDefault(),Y(1)):n(U,q,Z)},[n,Y]),_e=$a(U=>{if(U.key==="Enter"&&T){const q=U.target;return!!Tr(q,"a, button",!0)||T.disabled?void 0:ue(U,T)}if(U.key==="Backspace"){const q=U.target;if(!(ll(q,"input")&&q.value!==""))return Y(-1),U.preventDefault()}if(U.key==="ArrowUp")return Ke(-1),U.preventDefault();if(U.key==="ArrowDown")return Ke(1),U.preventDefault();if(U.key==="ArrowRight")return Y(1),U.preventDefault();if(U.key==="ArrowLeft")return Y(-1),U.preventDefault()},[T,Ke,Y,ue]),pe=$a(U=>{ll(U.target,"input")&&y(()=>U.target.value)},[y]);eu(()=>(d(),()=>{g()}),[]);const xe=!x&&h.length>0,ce=(a||r.length>0)&&!xe;return ct`
172
- <${jb}
171
+ `}function jb(e,t){return`${e}-group-${t.id}`}function L2(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const I2=new Mo("djs-popup");function B2(e){const{onClose:t,onSelect:n,className:i,headerEntries:r,position:o,title:a,width:s,scale:c,search:u,emptyPlaceholder:l,searchFn:f,entries:p,onOpened:d,onClosed:g}=e,[h,m]=Cf([]);eu(()=>{m([])},[p]);const[_,y]=Cf(""),x=_.trim().length>0,S=Gi(()=>F2(p),[p]),P=Gi(()=>Nt(u)?S.length>5:!1,[u,S]),C=Gi(()=>{const q=h.length?h[h.length-1].entries:p;return P?x?f(S.filter(({searchable:Y})=>Y!==!1),_,{keys:["label","search","description"]}).map(({item:Y})=>Y):q.filter(({rank:Y=0})=>Y>=0):q},[P,x,S,_,f,h,p]),L=Gi(()=>x?C.length?[{id:"default",entries:C}]:[]:j2(C),[C,x]),[T,j]=Cf(C[0]),k=tu(null),D=tu(!1),z=Gi(()=>I2.next(),[]),se=`${z}-results`,Se=T&&Fb(z,T);eu(()=>{const q=k.current;q&&C.includes(q)?j(q):j(C[0]),k.current=null},[C]);const qe=ja(q=>{const Y=$2(L);let He=Y.indexOf(T)+q;He<0&&(He=Y.length-1),He>=Y.length&&(He=0),D.current=!0,j(Y[He])},[L,T]),K=ja(q=>{q>0&&T&&T.entries&&(D.current=!0,m(Y=>[...Y,T])),q<0&&h.length>0&&(D.current=!0,k.current=h[h.length+q],m(Y=>Y.slice(0,q)))},[T,h]),fe=ja((q,Y,Z)=>{if(!(!Y||Y.disabled))return Y.entries?(q.preventDefault(),K(1)):n(q,Y,Z)},[n,K]),we=ja(q=>{if(q.key==="Enter"&&T){const Y=q.target;return!!kr(Y,"a, button",!0)||T.disabled?void 0:fe(q,T)}if(q.key==="Backspace"){const Y=q.target;if(!(pl(Y,"input")&&Y.value!==""))return K(-1),q.preventDefault()}if(q.key==="ArrowUp")return qe(-1),q.preventDefault();if(q.key==="ArrowDown")return qe(1),q.preventDefault();if(q.key==="ArrowRight")return K(1),q.preventDefault();if(q.key==="ArrowLeft")return K(-1),q.preventDefault()},[T,qe,K,fe]),me=ja(q=>{pl(q.target,"input")&&y(()=>q.target.value)},[y]);eu(()=>(d(),()=>{g()}),[]);const Ee=!x&&h.length>0,pe=(a||r.length>0)&&!Ee;return st`
172
+ <${Hb}
173
173
  onClose=${t}
174
- onKeyup=${pe}
175
- onKeydown=${_e}
174
+ onKeyup=${me}
175
+ onKeydown=${we}
176
176
  className=${i}
177
177
  position=${o}
178
178
  width=${s}
179
179
  scale=${c}
180
180
  navigationStack=${h}
181
181
  >
182
- ${ce&&ct`
183
- <${R2}
182
+ ${pe&&st`
183
+ <${T2}
184
184
  headerEntries=${r}
185
185
  onSelect=${n}
186
186
  selectedEntry=${T}
@@ -188,16 +188,16 @@
188
188
  title=${a}
189
189
  />
190
190
  `}
191
- ${xe&&ct`
192
- <${S2}
191
+ ${Ee&&st`
192
+ <${A2}
193
193
  navigationStack=${h}
194
194
  setNavigationStack=${m}
195
195
  />
196
196
  `}
197
- ${p.length>0&&ct`
197
+ ${p.length>0&&st`
198
198
  <div class="djs-popup-body">
199
199
 
200
- ${P&&ct`
200
+ ${P&&st`
201
201
  <div class="djs-popup-search">
202
202
  <svg class="djs-popup-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
203
203
  <path fill-rule="evenodd" clip-rule="evenodd" d="M9.0325 8.5H9.625L13.3675 12.25L12.25 13.3675L8.5 9.625V9.0325L8.2975 8.8225C7.4425 9.5575 6.3325 10 5.125 10C2.4325 10 0.25 7.8175 0.25 5.125C0.25 2.4325 2.4325 0.25 5.125 0.25C7.8175 0.25 10 2.4325 10 5.125C10 6.3325 9.5575 7.4425 8.8225 8.2975L9.0325 8.5ZM1.75 5.125C1.75 6.9925 3.2575 8.5 5.125 8.5C6.9925 8.5 8.5 6.9925 8.5 5.125C8.5 3.2575 6.9925 1.75 5.125 1.75C3.2575 1.75 1.75 3.2575 1.75 5.125Z" fill="#22242A"/>
@@ -209,37 +209,37 @@
209
209
  aria-label="${a||"Search"}"
210
210
  aria-expanded="true"
211
211
  aria-controls=${se}
212
- aria-activedescendant=${we||void 0}
212
+ aria-activedescendant=${Se||void 0}
213
213
  aria-autocomplete="list"
214
214
  />
215
215
  </div>
216
216
  `}
217
217
 
218
- ${x&&ct`
218
+ ${x&&st`
219
219
  <div class="djs-popup-search-count" aria-live="polite">
220
220
  ${C.length} ${C.length===1?"result":"results"} found
221
221
  </div>
222
222
  `}
223
223
 
224
- <${T2}
224
+ <${D2}
225
225
  groupedEntries=${L}
226
226
  selectedEntry=${T}
227
227
  setSelectedEntry=${j}
228
228
  keyboardSelection=${D}
229
- onAction=${ue}
229
+ onAction=${fe}
230
230
  idPrefix=${z}
231
231
  id=${se}
232
232
  ariaLabel=${a||"Results"}
233
233
  tabIndex=${P?-1:0}
234
- ariaActivedescendant=${P?void 0:we||void 0}
234
+ ariaActivedescendant=${P?void 0:Se||void 0}
235
235
  />
236
236
 
237
- ${T&&T.documentationRef&&ct`
237
+ ${T&&T.documentationRef&&st`
238
238
  <div class="djs-popup-footer">
239
239
  <a
240
240
  class="djs-popup-footer-docs"
241
241
  href=${T.documentationRef}
242
- onClick=${U=>U.stopPropagation()}
242
+ onClick=${q=>q.stopPropagation()}
243
243
  aria-label=${T.label?`Open entry documentation for ${T.label}`:"Open entry documentation"}
244
244
  target="_blank"
245
245
  rel="noopener"
@@ -254,14 +254,14 @@
254
254
  `}
255
255
  </div>
256
256
  `}
257
- ${l&&C.length===0&&ct`
258
- <div class="djs-popup-no-results">${Yt(l)?l(_):l}</div>
257
+ ${l&&C.length===0&&st`
258
+ <div class="djs-popup-no-results">${Ut(l)?l(_):l}</div>
259
259
  `}
260
- </${jb}>
261
- `}function jb(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,navigationStack:a,position:s}=e,c=tu();return Cf(()=>{if(typeof s!="function")return;const u=c.current,l=s(u);u.style.left=`${l.x}px`,u.style.top=`${l.y}px`},[c.current,s]),Cf(()=>{const u=c.current;if(!u)return;(u.querySelector("input")||u.querySelector('[role="listbox"]')||u).focus()},[a]),eu(()=>{const u=f=>{if(f.key==="Escape")return f.preventDefault(),t()},l=f=>{if(!Tr(f.target,".djs-popup",!0))return t()};return document.documentElement.addEventListener("keydown",u),document.body.addEventListener("click",l,!0),()=>{document.documentElement.removeEventListener("keydown",u),document.body.removeEventListener("click",l,!0)}},[]),ct`
260
+ </${Hb}>
261
+ `}function Hb(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,navigationStack:a,position:s}=e,c=tu();return Pf(()=>{if(typeof s!="function")return;const u=c.current,l=s(u);u.style.left=`${l.x}px`,u.style.top=`${l.y}px`},[c.current,s]),Pf(()=>{const u=c.current;if(!u)return;(u.querySelector("input")||u.querySelector('[role="listbox"]')||u).focus()},[a]),eu(()=>{const u=f=>{if(f.key==="Escape")return f.preventDefault(),t()},l=f=>{if(!kr(f.target,".djs-popup",!0))return t()};return document.documentElement.addEventListener("keydown",u),document.body.addEventListener("click",l,!0),()=>{document.documentElement.removeEventListener("keydown",u),document.body.removeEventListener("click",l,!0)}},[]),st`
262
262
  <div
263
263
  class=${iu("djs-popup",r)}
264
- style=${D2(e)}
264
+ style=${N2(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 D2(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:Ft(t)?n:void 0,maxWidth:Ft(t)?"unset":void 0,"transform-origin":"top left"}}function L2(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function I2(e){const t=[];function n(i){i.forEach(r=>{if(r.entries){n(r.entries);return}t.push(r)})}return n(e),t}function B2(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 N2="data-id",Hb=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],$2=1e3;function St(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var r=Ft(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()})}St.$inject=["config.popupMenu","eventBus","canvas","search"],St.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:r,options:o}=this._current,a=zb(n),s=Object.entries(i).map(([p,d])=>({id:p,...d})),c=e&&(p=>this._ensureVisible(p,e)),u=this._updateScale(this._current.container);Sb(ct`
273
- <${O2}
272
+ `}function N2(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:Nt(t)?n:void 0,maxWidth:Nt(t)?"unset":void 0,"transform-origin":"top left"}}function $2(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function F2(e){const t=[];function n(i){i.forEach(r=>{if(r.entries){n(r.entries);return}t.push(r)})}return n(e),t}function j2(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 H2="data-id",zb=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],z2=1e3;function Et(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var r=Nt(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()})}Et.$inject=["config.popupMenu","eventBus","canvas","search"],Et.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:r,options:o}=this._current,a=Gb(n),s=Object.entries(i).map(([p,d])=>({id:p,...d})),c=e&&(p=>this._ensureVisible(p,e)),u=this._updateScale(this._current.container);Rb(st`
273
+ <${B2}
274
274
  onClose=${p=>this.close(p)}
275
275
  onSelect=${(p,d,g)=>this.trigger(p,d,g)}
276
276
  position=${c}
@@ -284,7 +284,7 @@
284
284
  searchFn=${this._search}
285
285
  ...${{...o}}
286
286
  />
287
- `,this._current.container)},St.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()},St.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()},St.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)}},St.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},St.prototype.reset=function(){const e=this._current.container;Sb(null,e),di(e)},St.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},St.prototype._onOpened=function(){this._emit("opened")},St.prototype._onClosed=function(){this._emit("closed")},St.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=ht(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},St.prototype._bindAutoClose=function(){this._eventBus.once(Hb,this.close,this)},St.prototype._unbindAutoClose=function(){this._eventBus.off(Hb,this.close,this)},St.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),Ft(n)&&e<n&&(r=n),Ft(i)&&e>i&&(r=i)),r},St.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}},St.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},St.prototype.registerProvider=function(e,t,n){n||(n=t,t=$2),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},St.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},St.prototype._getEntries=function(e,t){var n={};return I(t,function(i){if(!i.getPopupMenuEntries){I(i.getEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=ui(o,["id"])});return}var r=i.getPopupMenuEntries(e);Yt(r)?n=r(n):I(r,function(o,a){n[a]=o})}),n},St.prototype._getHeaderEntries=function(e,t){var n={};return I(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;I(i.getHeaderEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=ui(o,["id"])});return}var r=i.getPopupMenuHeaderEntries(e);Yt(r)?n=r(n):I(r,function(o,a){n[a]=o})}),n},St.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>Yt(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},St.prototype.isOpen=function(){return!!this._current},St.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let r=Tr(e.delegateTarget||e.target,".entry",!0),o=un(r,N2);t={id:o,...this._getEntry(o)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(Yt(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},St.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 zb(e,t=[]){return Object.entries(e).map(([n,i])=>{const r={id:n,...i};return r.entries?r.entries=zb(r.entries,[...t,...Gb(r.search)]):t.length&&(r.search=[...t,...Gb(r.search)]),r})}function Gb(e){return e?ke(e)?e:[e]:[]}function F2(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=j2(o,r,i);return a?{item:o,tokens:a}:[]}).sort(H2(i))}function j2(e,t,n){const{matchedWords:i,tokens:r}=n.reduce((o,a)=>{const s=e[a],{tokens:c,matchedWords:u}=ke(s)?s.reduce((l,f)=>{const{tokens:p,matchedWords:d}=Yb(f,t);return{tokens:[...l.tokens,p],matchedWords:{...l.matchedWords,...d}}},{matchedWords:{},tokens:[]}):Yb(s,t);return{tokens:{...o.tokens,[a]:c},matchedWords:{...o.matchedWords,...u}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:r}function H2(e){return(t,n)=>{let i=0,r=1;for(const o of e){const a=z2(t.tokens[o],n.tokens[o]);if(a!==0){i+=a*r,r*=Vb;continue}const s=G2(t.item[o],n.item[o]);if(s!==0){i+=s*r,r*=Vb;continue}}return i}}function z2(e,t){return Wb(t)-Wb(e)}const Vb=.5,Io={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function Wb(e){const t=e.reduce((s,c)=>s+Ub(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 Ub(e){if(ke(e))return Math.max(...e.map(Ub));const t=Math.log(e.value.length);return e.match?(e.start?e.end?Io.FULL:e.wordEnd?Io.START_FULL_WORD:Io.START_WORD_PART:e.wordStart?Io.WORD_START:Io.WORD_PART)*t:Io.NO_MATCH*t}function qb(e=""){return ke(e)?e.join(", "):e}function G2(e,t){return qb(e).localeCompare(qb(t))}function Yb(e,t){var u;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map(V2),o=[`(?<all>${r.join("\\s+")})`,...r].join("|"),a=new RegExp(o,"ig");let s,c=0;for(;s=a.exec(e);){const[l]=s,f=s.index,p=s.index+l.length,d=f===0,g=p===e.length,h=!!((u=s.groups)!=null&&u.all),m=d||/\s/.test(e.charAt(f-1)),_=g||/\s/.test(e.charAt(p));s.index>c&&n.push({value:e.slice(c,s.index),index:c}),n.push({value:l,index:s.index,match:!0,wordStart:m,wordEnd:_,start:d,end:g,all:h});const y=h?t:[l];for(const x of y)i[x.toLowerCase()]=!0;c=s.index+l.length}return c<e.length&&n.push({value:e.slice(c),index:c}),{tokens:n,matchedWords:i}}function V2(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const Kb={search:["value",F2]},Tf={__depends__:[Kb],__init__:["popupMenu"],popupMenu:["type",St]};var Xb={align:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 2000">
287
+ `,this._current.container)},Et.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()},Et.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()},Et.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)}},Et.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},Et.prototype.reset=function(){const e=this._current.container;Rb(null,e),mi(e)},Et.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},Et.prototype._onOpened=function(){this._emit("opened")},Et.prototype._onClosed=function(){this._emit("closed")},Et.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=ht(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},Et.prototype._bindAutoClose=function(){this._eventBus.once(zb,this.close,this)},Et.prototype._unbindAutoClose=function(){this._eventBus.off(zb,this.close,this)},Et.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),Nt(n)&&e<n&&(r=n),Nt(i)&&e>i&&(r=i)),r},Et.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}},Et.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},Et.prototype.registerProvider=function(e,t,n){n||(n=t,t=z2),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},Et.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},Et.prototype._getEntries=function(e,t){var n={};return I(t,function(i){if(!i.getPopupMenuEntries){I(i.getEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=li(o,["id"])});return}var r=i.getPopupMenuEntries(e);Ut(r)?n=r(n):I(r,function(o,a){n[a]=o})}),n},Et.prototype._getHeaderEntries=function(e,t){var n={};return I(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;I(i.getHeaderEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=li(o,["id"])});return}var r=i.getPopupMenuHeaderEntries(e);Ut(r)?n=r(n):I(r,function(o,a){n[a]=o})}),n},Et.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>Ut(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},Et.prototype.isOpen=function(){return!!this._current},Et.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let r=kr(e.delegateTarget||e.target,".entry",!0),o=sn(r,H2);t={id:o,...this._getEntry(o)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(Ut(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},Et.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 Gb(e,t=[]){return Object.entries(e).map(([n,i])=>{const r={id:n,...i};return r.entries?r.entries=Gb(r.entries,[...t,...Vb(r.search)]):t.length&&(r.search=[...t,...Vb(r.search)]),r})}function Vb(e){return e?Oe(e)?e:[e]:[]}function G2(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=V2(o,r,i);return a?{item:o,tokens:a}:[]}).sort(W2(i))}function V2(e,t,n){const{matchedWords:i,tokens:r}=n.reduce((o,a)=>{const s=e[a],{tokens:c,matchedWords:u}=Oe(s)?s.reduce((l,f)=>{const{tokens:p,matchedWords:d}=Kb(f,t);return{tokens:[...l.tokens,p],matchedWords:{...l.matchedWords,...d}}},{matchedWords:{},tokens:[]}):Kb(s,t);return{tokens:{...o.tokens,[a]:c},matchedWords:{...o.matchedWords,...u}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:r}function W2(e){return(t,n)=>{let i=0,r=1;for(const o of e){const a=U2(t.tokens[o],n.tokens[o]);if(a!==0){i+=a*r,r*=Wb;continue}const s=q2(t.item[o],n.item[o]);if(s!==0){i+=s*r,r*=Wb;continue}}return i}}function U2(e,t){return Ub(t)-Ub(e)}const Wb=.5,$o={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function Ub(e){const t=e.reduce((s,c)=>s+qb(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 qb(e){if(Oe(e))return Math.max(...e.map(qb));const t=Math.log(e.value.length);return e.match?(e.start?e.end?$o.FULL:e.wordEnd?$o.START_FULL_WORD:$o.START_WORD_PART:e.wordStart?$o.WORD_START:$o.WORD_PART)*t:$o.NO_MATCH*t}function Yb(e=""){return Oe(e)?e.join(", "):e}function q2(e,t){return Yb(e).localeCompare(Yb(t))}function Kb(e,t){var u;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map(Y2),o=[`(?<all>${r.join("\\s+")})`,...r].join("|"),a=new RegExp(o,"ig");let s,c=0;for(;s=a.exec(e);){const[l]=s,f=s.index,p=s.index+l.length,d=f===0,g=p===e.length,h=!!((u=s.groups)!=null&&u.all),m=d||/\s/.test(e.charAt(f-1)),_=g||/\s/.test(e.charAt(p));s.index>c&&n.push({value:e.slice(c,s.index),index:c}),n.push({value:l,index:s.index,match:!0,wordStart:m,wordEnd:_,start:d,end:g,all:h});const y=h?t:[l];for(const x of y)i[x.toLowerCase()]=!0;c=s.index+l.length}return c<e.length&&n.push({value:e.slice(c),index:c}),{tokens:n,matchedWords:i}}function Y2(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const Xb={search:["value",G2]},Mf={__depends__:[Xb],__init__:["popupMenu"],popupMenu:["type",Et]};var Zb={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>`},W2=900;function Bo(e,t,n,i){e.registerProvider(W2,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}Bo.$inject=["contextPad","popupMenu","translate","canvas"],Bo.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&V(t,this._getEntries(e)),t},Bo.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Bo.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${Xb.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);V(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},Bo.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 U2=["left","center","right","top","middle","bottom"];function Fa(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}Fa.$inject=["popupMenu","alignElements","translate","rules"],Fa.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&V(t,this._getEntries(e)),t},Fa.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Fa.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return I(U2,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:Xb[o],action:function(){t.trigger(e,o),i.close()}}}),r};function ru(e){Kn.call(this,e)}ru.$inject=["eventBus"],ye(ru,Kn),ru.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=Ue(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=Ps(n),n.length<2?!1:n})};const q2={__depends__:[r2,sb,Tf],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Bo],alignElementsMenuProvider:["type",Fa],bpmnAlignElements:["type",ru]};function zi(e,t,n,i){ne.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=i;var r=this;this.postExecuted(["shape.create"],function(o){var a=o.context,s=a.hints||{},c=a.shape,u=a.parent||a.newParent;s.autoResize!==!1&&r._expand([c],u)}),this.postExecuted(["elements.move"],function(o){var a=o.context,s=Ou(Qr(a.closure.topLevel)),c=a.hints,u=c?c.autoResize:!0;if(u!==!1){var l=Jr(s,function(f){return f.parent.id});I(l,function(f,p){ke(u)&&(f=f.filter(function(d){return pt(u,eo({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,u=c.parent;s&&s.autoResize===!1||u&&r._expand([c],u)})}zi.$inject=["eventBus","elementRegistry","modeling","rules"],ye(zi,ne),zi.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=Te(kt(e)),o=Te(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),Ms(V({},o,a))},zi.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(Y2(i,t)){var r=K2(ii(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},zi.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},zi.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},zi.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function Y2(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function K2(e,t){var n="";return e=Te(e),t=Te(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 ou(e){e.invoke(zi,this)}ou.$inject=["injector"],ye(ou,zi),ou.prototype.resize=function(e,t,n){w(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function ja(e){Kn.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}ja.$inject=["eventBus"],ye(ja,Kn),ja.prototype.canResize=function(e,t){return!1};function au(e,t){ja.call(this,e),this._modeling=t}ye(au,ja),au.$inject=["eventBus","modeling"],au.prototype.canResize=function(e,t){if(w(t.di,"bpmndi:BPMNPlane")||!w(t,"bpmn:Participant")&&!w(t,"bpmn:Lane")&&!w(t,"bpmn:SubProcess"))return!1;var n=!0;return I(e,function(i){if(w(i,"bpmn:Lane")||Ge(i)){n=!1;return}}),n};const X2={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",ou],bpmnAutoResizeProvider:["type",au]};function No(e,t,n){this._canvas=n,this._opts=V({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()})}No.$inject=["config.autoScroll","eventBus","canvas"],No.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++)Z2(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 Z2(e,t,n){return t<e&&e<n}No.prototype.stopScroll=function(){clearTimeout(this._scrolling)},No.prototype.setOptions=function(e){this._opts=V({},this._opts,e)},No.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Ir(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const Q2={__depends__:[Bi],__init__:["autoScroll"],autoScroll:["type",No]};var Zb="djs-bendpoint",Qb="djs-segment-dragger";function J2(e,t){var n=Ir(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 Mf(e,t,n){var i=J2(e,n),r=Yl(t,i);return r}function kf(e,t){var n=Pe("g");Xe(n).add(Zb),Fe(e,n);var i=Pe("circle");ve(i,{cx:0,cy:0,r:4}),Xe(i).add("djs-visual"),Fe(n,i);var r=Pe("circle");return ve(r,{cx:0,cy:0,r:10}),Xe(r).add("djs-hit"),Fe(n,r),t&&Xe(n).add(t),n}function ek(e,t,n,i){var r=Pe("g");Fe(e,r);var o=18,a=6,s=11,c=nk(t,n,i),u=a+s,l=Pe("rect");ve(l,{x:-o/2,y:-a/2,width:o,height:a}),Xe(l).add("djs-visual"),Fe(r,l);var f=Pe("rect");return ve(f,{x:-c/2,y:-u/2,width:c,height:u}),Xe(f).add("djs-hit"),Fe(r,f),Rm(r,i==="v"?90:0),r}function Jb(e,t,n){var i=Pe("g"),r=El(t,n),o=Mi(t,n);return Fe(e,i),ek(i,t,n,o),Xe(i).add(Qb),Xe(i).add(o==="h"?"horizontal":"vertical"),nn(i,r.x,r.y),i}function Of(e){return Math.abs(Math.round(e*2/3))}function tk(e,t){var n=ik(e,t);return ep(e,n)}function nk(e,t,n){var i=t.x-e.x,r=t.y-e.y;return Of(n==="h"?i:r)}function ik(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=pg(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function e_(e,t,n,i,r){function o(x,S,P){var C=x.index,L=x.point,T,j,k,D,z,se;return C<=0||x.bendpoint?!1:(T=S[C-1],j=S[C],k=El(T,j),D=Mi(T,j),z=Math.abs(L.x-k.x),se=Math.abs(L.y-k.y),D&&z<=P&&se<=P)}function a(x,S){var P=x.waypoints,C,L,T,j;return S.index<=0||S.bendpoint||(C={start:P[S.index-1],end:P[S.index]},L=Mi(C.start,C.end),!L)?null:(L==="h"?T=C.end.x-C.start.x:T=C.end.y-C.start.y,j=Of(T)/2,j)}function s(x,S){var P=S.waypoints,C=Mf(t,P,x),L;if(C){L=a(S,C);var T;if(o(C,P,L)?T=r.start(x,S,C.index):T=i.start(x,S,C.index,!C.bendpoint),T!==!1)return!0}}function c(x,S,P){$e.bind(x,S,function(C){n.triggerMouseEvent(S,C,P),C.stopPropagation()})}function u(x,S){var P=t.getLayer("overlays"),C=ot('.djs-bendpoints[data-element-id="'+La(x.id)+'"]',P);return!C&&S&&(C=Pe("g"),ve(C,{"data-element-id":x.id}),Xe(C).add("djs-bendpoints"),Fe(P,C),c(C,"mousedown",x),c(C,"click",x),c(C,"dblclick",x)),C}function l(x,S){return ot('.djs-segment-dragger[data-segment-idx="'+x+'"]',S)}function f(x,S){S.waypoints.forEach(function(P,C){var L=kf(x);Fe(x,L),nn(L,P.x,P.y)}),kf(x,"floating")}function p(x,S){for(var P=S.waypoints,C,L,T,j=1;j<P.length;j++)C=P[j-1],L=P[j],Mi(C,L)&&(T=Jb(x,C,L),ve(T,{"data-segment-idx":j}),c(T,"mousemove",S))}function d(x){I(Es("."+Zb,x),function(S){Ht(S)})}function g(x){I(Es("."+Qb,x),function(S){Ht(S)})}function h(x){var S=u(x);return S||(S=u(x,!0),f(S,x),p(S,x)),S}function m(x){var S=u(x);S&&(g(S),d(S),p(S,x),f(S,x))}function _(x,S){var P=ot(".floating",x),C=S.point;P&&(nn(P,C.x,C.y),Xe(P).add("positioned"))}function y(x,S,P){var C=l(S.index,x),L=P[S.index-1],T=P[S.index],j=S.point,k=El(L,T),D=Mi(L,T),z,se;C&&(z=rk(C),se={x:j.x-k.x,y:j.y-k.y},D==="v"&&(se={x:se.y,y:se.x}),nn(z,se.x,se.y))}e.on("connection.changed",function(x){m(x.element)}),e.on("connection.remove",function(x){var S=u(x.element);S&&Ht(S)}),e.on("element.marker.update",function(x){var S=x.element,P;S.waypoints&&(P=h(S),x.add?Xe(P).add(x.marker):Xe(P).remove(x.marker))}),e.on("element.mousemove",function(x){var S=x.element,P=S.waypoints,C,L;if(P){if(C=u(S,!0),L=Mf(t,P,x.originalEvent),!L)return;_(C,L),L.bendpoint||y(C,L,P)}}),e.on("element.mousedown",function(x){if(sr(x)){var S=x.originalEvent,P=x.element;if(P.waypoints)return s(S,P)}}),e.on("selection.changed",function(x){var S=x.newSelection,P=S[0];P&&P.waypoints&&h(P)}),e.on("element.hover",function(x){var S=x.element;S.waypoints&&h(S)}),e.on("element.out",function(x){var S=x.element;if(S.waypoints){var P=u(S);if(P){var C=ot(".floating",P);C&&Xe(C).remove("positioned")}}}),e.on("element.updateId",function(x){var S=x.element,P=x.newId;if(S.waypoints){var C=u(S);C&&ve(C,{"data-element-id":P})}}),this.addHandles=h,this.updateHandles=m,this.getBendpointsContainer=u,this.getSegmentDragger=l}e_.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function rk(e){return ot(".djs-visual",e)}var t_=Math.round,Gr="reconnectStart",Vr="reconnectEnd",Ha="updateWaypoints";function Df(e,t,n,i,r,o){this._injector=e,this.start=function(a,s,c,u){var l=n.getGraphics(s),f=s.source,p=s.target,d=s.waypoints,g;!u&&c===0?g=Gr:!u&&c===d.length-1?g=Vr:g=Ha;var h=g===Ha?"connection.updateWaypoints":"connection.reconnect",m=r.allowed(h,{connection:s,source:f,target:p});if(m===!1&&(m=r.allowed(h,{connection:s,source:p,target:f})),m!==!1)return i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:l,context:{allowed:m,bendpointIndex:c,connection:s,source:f,target:p,insert:u,type:g}}})},t.on("bendpoint.move.hover",function(a){var s=a.context,c=s.connection,u=c.source,l=c.target,f=a.hover,p=s.type;s.hover=f;var d;if(f){var g=p===Ha?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(g,{connection:c,source:p===Gr?f:u,target:p===Vr?f:l}),d){s.source=p===Gr?f:u,s.target=p===Vr?f:l;return}d===!1&&(d=s.allowed=r.allowed(g,{connection:c,source:p===Vr?f:l,target:p===Gr?f:u})),d&&(s.source=p===Vr?f:l,s.target=p===Gr?f:u)}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(a){var s=a.context,c=s.type;s.hover=null,s.source=null,s.target=null,c!==Ha&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(a){var s=a.context,c=s.allowed,u=s.bendpointIndex,l=s.connection,f=s.insert,p=l.waypoints.slice(),d=s.source,g=s.target,h=s.type,m=s.hints||{},_={x:t_(a.x),y:t_(a.y)};if(!c)return!1;h===Ha?(f?p.splice(u,0,_):p[u]=_,m.bendpointMove={insert:f,bendpointIndex:u},p=this.cropWaypoints(l,p),o.updateWaypoints(l,xS(p),m)):(h===Gr?(m.docking="source",su(s)&&(m.docking="target",m.newWaypoints=p.reverse())):h===Vr&&(m.docking="target",su(s)&&(m.docking="source",m.newWaypoints=p.reverse())),o.reconnect(l,d,g,_,m))},this)}Df.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],Df.prototype.cropWaypoints=function(e,t){var n=this._injector.get("connectionDocking",!1);if(!n)return t;var i=e.waypoints;return e.waypoints=t,e.waypoints=n.getCroppedWaypoints(e),t=e.waypoints,e.waypoints=i,t};function su(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===Gr)return t&&i&&t===i&&n!==i;if(r===Vr)return t&&n&&t===n&&n!==i}var ok="reconnectStart",ak="reconnectEnd",n_="updateWaypoints",za="connect-ok",cu="connect-not-ok",i_="connect-hover",r_="djs-updating",o_="djs-dragging",a_=1100;function s_(e,t,n,i){this._injector=t;var r=t.get("connectionPreview",!1);n.on("bendpoint.move.start",function(o){var a=o.context,s=a.bendpointIndex,c=a.connection,u=a.insert,l=c.waypoints,f=l.slice();a.waypoints=l,u&&f.splice(s,0,{x:o.x,y:o.y}),c.waypoints=f;var p=a.draggerGfx=kf(i.getLayer("overlays"));Xe(p).add("djs-dragging"),i.addMarker(c,o_),i.addMarker(c,r_)}),n.on("bendpoint.move.hover",function(o){var a=o.context,s=a.allowed,c=a.hover,u=a.type;if(c){if(i.addMarker(c,i_),u===n_)return;s?(i.removeMarker(c,cu),i.addMarker(c,za)):s===!1&&(i.removeMarker(c,za),i.addMarker(c,cu))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],a_,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,i_),i.removeMarker(s,c?za:cu))}),n.on("bendpoint.move.move",function(o){var a=o.context,s=a.allowed,c=a.bendpointIndex,u=a.draggerGfx,l=a.hover,f=a.type,p=a.connection,d=p.source,g=p.target,h=p.waypoints.slice(),m={x:o.x,y:o.y},_=a.hints||{},y={};r&&(_.connectionStart&&(y.connectionStart=_.connectionStart),_.connectionEnd&&(y.connectionEnd=_.connectionEnd),f===ok?su(a)?(y.connectionEnd=y.connectionEnd||m,y.source=g,y.target=l||d,h=h.reverse()):(y.connectionStart=y.connectionStart||m,y.source=l||d,y.target=g):f===ak?su(a)?(y.connectionStart=y.connectionStart||m,y.source=l||g,y.target=d,h=h.reverse()):(y.connectionEnd=y.connectionEnd||m,y.source=d,y.target=l||g):(y.noCropping=!0,y.noLayout=!0,h[c]=m),f===n_&&(h=e.cropWaypoints(p,h)),y.waypoints=h,r.drawPreview(a,s,y)),nn(u,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],a_,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,u=a.hover,l=a.target,f=a.waypoints;s.waypoints=f,Ht(c),i.removeMarker(s,r_),i.removeMarker(s,o_),u&&(i.removeMarker(u,za),i.removeMarker(u,l?za:cu)),r&&r.cleanUp(a)})}s_.$inject=["bendpointMove","injector","eventBus","canvas"];var c_="connect-hover",u_="djs-updating";function l_(e,t,n){return Lf(e,t,e[t]+n)}function Lf(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function sk(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 Lf(t,i,s)}function p_(e){return e==="x"?"y":"x"}function f_(e,t,n){var i,r;return e.original?e.original:(i=Oe(t),r=p_(n),Lf(e,r,i[r]))}function d_(e,t,n,i,r,o){var a=e.get("connectionDocking",!1);this.start=function(f,p,d){var g,h=n.getGraphics(p),m=d-1,_=d,y=p.waypoints,x=y[m],S=y[_],P=Mf(n,y,f),C,L,T;if(C=Mi(x,S),!!C)return L=C==="v"?"x":"y",m===0&&(x=f_(x,p.source,L)),_===y.length-1&&(S=f_(S,p.target,L)),P?T=P.point:T={x:(x.x+S.x)/2,y:(x.y+S.y)/2},g={connection:p,segmentStartIndex:m,segmentEndIndex:_,segmentStart:x,segmentEnd:S,axis:L,dragPosition:T},i.init(f,T,"connectionSegment.move",{cursor:L==="x"?"resize-ew":"resize-ns",data:{connection:p,connectionGfx:h,context:g}})};function s(f,p){if(!a)return p;var d=f.waypoints,g;return f.waypoints=p,g=a.getCroppedWaypoints(f),f.waypoints=d,g}function c(f){r.update("connection",f.connection,f.connectionGfx)}function u(f,p,d){var g=f.newWaypoints,h=f.segmentStartIndex+p,m=g[h],_=f.segmentEndIndex+p,y=g[_],x=p_(f.axis),S=sk(d,m,y,x);nn(f.draggerGfx,S.x,S.y)}function l(f,p){var d=0,g=f.filter(function(h,m){return wl(f[m-1],f[m+1],h)?(d=m<=p?d-1:d,!1):!0});return{waypoints:g,segmentOffset:d}}t.on("connectionSegment.move.start",function(f){var p=f.context,d=f.connection,g=n.getLayer("overlays");p.originalWaypoints=d.waypoints.slice(),p.draggerGfx=Jb(g,p.segmentStart,p.segmentEnd),Xe(p.draggerGfx).add("djs-dragging"),n.addMarker(d,u_)}),t.on("connectionSegment.move.move",function(f){var p=f.context,d=p.connection,g=p.segmentStartIndex,h=p.segmentEndIndex,m=p.segmentStart,_=p.segmentEnd,y=p.axis,x=p.originalWaypoints.slice(),S=l_(m,y,f["d"+y]),P=l_(_,y,f["d"+y]),C=x.length,L=0;x[g]=S,x[h]=P;var T,j;g<2&&(T=tn(d.source,S),g===1?T==="intersect"&&(x.shift(),x[0]=S,L--):T!=="intersect"&&(x.unshift(m),L++)),h>C-3&&(j=tn(d.target,P),h===C-2?j==="intersect"&&(x.pop(),x[x.length-1]=P):j!=="intersect"&&x.push(_)),p.newWaypoints=d.waypoints=s(d,x),u(p,L,f),p.newSegmentStartIndex=g+L,c(f)}),t.on("connectionSegment.move.hover",function(f){f.context.hover=f.hover,n.addMarker(f.hover,c_)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(f){var p=f.context.hover;p&&n.removeMarker(p,c_)}),t.on("connectionSegment.move.cleanup",function(f){var p=f.context,d=p.connection;p.draggerGfx&&Ht(p.draggerGfx),n.removeMarker(d,u_)}),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,g=p.newWaypoints,h=p.newSegmentStartIndex;g=g.map(function(P){return{original:P.original,x:Math.round(P.x),y:Math.round(P.y)}});var m=l(g,h),_=m.waypoints,y=s(d,_),x=m.segmentOffset,S={segmentMove:{segmentStartIndex:p.segmentStartIndex,newSegmentStartIndex:h+x}};o.updateWaypoints(d,y,S)})}d_.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var ck=Math.abs,h_=Math.round;function uk(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],ck(r-e)<=n)return r}function m_(e){return{x:e.x,y:e.y}}function g_(e){return{x:e.x+e.width,y:e.y+e.height}}function Jn(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:h_(e.x+e.width/2),y:h_(e.y+e.height/2)}}function $o(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function It(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 y_(e){return e.children||[]}var lk=Math.abs,v_=Math.round,If=10;function b_(e){function t(o,a){if(ke(o)){for(var s=o.length;s--;)if(lk(o[s]-a)<=If)return o[s]}else{o=+o;var c=a%o;if(c<If)return a-c;if(c>o-If)return a-c+o}return a}function n(o,a){if(o.waypoints)return tk(a,o);if(o.width)return{x:v_(o.width/2+o.x),y:v_(o.height/2+o.y)}}function i(o){var a=o.context,s=a.snapPoints,c=a.connection,u=c.waypoints,l=a.segmentStart,f=a.segmentStartIndex,p=a.segmentEnd,d=a.segmentEndIndex,g=a.axis;if(s)return s;var h=[u[f-1],l,p,u[d+1]];return f<2&&h.unshift(n(c.source,o)),d>u.length-3&&h.unshift(n(c.target,o)),a.snapPoints=s={horizontal:[],vertical:[]},I(h,function(m){m&&(m=m.original||m,g==="y"&&s.horizontal.push(m.y),g==="x"&&s.vertical.push(m.x))}),s}e.on("connectionSegment.move.move",1500,function(o){var a=i(o),s=o.x,c=o.y,u,l;if(a){u=t(a.vertical,s),l=t(a.horizontal,c);var f=s-u,p=c-l;V(o,{dx:o.dx-f,dy:o.dy-p,x:u,y:l}),(f||a.vertical.indexOf(s)!==-1)&&It(o,"x",u),(p||a.horizontal.indexOf(c)!==-1)&&It(o,"y",l)}});function r(o){var a=o.snapPoints,s=o.connection.waypoints,c=o.bendpointIndex;if(a)return a;var u=[s[c-1],s[c+1]];return o.snapPoints=a={horizontal:[],vertical:[]},I(u,function(l){l&&(l=l.original||l,a.horizontal.push(l.y),a.vertical.push(l.x))}),a}e.on(["connect.hover","connect.move","connect.end"],1500,function(o){var a=o.context,s=a.hover,c=s&&n(s,o);!at(s)||!c||!c.x||!c.y||(It(o,"x",c.x),It(o,"y",c.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(o){var a=o.context,s=r(a),c=a.hover,u=c&&n(c,o),l=o.x,f=o.y,p,d;if(s){p=t(u?s.vertical.concat([u.x]):s.vertical,l),d=t(u?s.horizontal.concat([u.y]):s.horizontal,f);var g=l-p,h=f-d;V(o,{dx:o.dx-g,dy:o.dy-h,x:o.x-g,y:o.y-h}),(g||s.vertical.indexOf(l)!==-1)&&It(o,"x",p),(h||s.horizontal.indexOf(f)!==-1)&&It(o,"y",d)}})}b_.$inject=["eventBus"];const pk={__depends__:[Bi,bi],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",e_],bendpointMove:["type",Df],bendpointMovePreview:["type",s_],connectionSegmentMove:["type",d_],bendpointSnapping:["type",b_]};function __(e,t,n,i){function r(a,s){return i.allowed("connection.create",{source:a,target:s})}function o(a,s){return r(s,a)}e.on("connect.hover",function(a){var s=a.context,c=s.start,u=a.hover,l;if(s.hover=u,l=s.canExecute=r(c,u),!Zr(l)){if(l!==!1){s.source=c,s.target=u;return}l=s.canExecute=o(c,u),!Zr(l)&&l!==!1&&(s.source=u,s.target=c)}}),e.on(["connect.out","connect.cleanup"],function(a){var s=a.context;s.hover=null,s.source=null,s.target=null,s.canExecute=!1}),e.on("connect.end",function(a){var s=a.context,c=s.canExecute,u=s.connectionStart,l={x:a.x,y:a.y},f=s.source,p=s.target;if(!c)return!1;var d=null,g={connectionStart:Bf(s)?l:u,connectionEnd:Bf(s)?u:l};qt(c)&&(d=c),s.connection=n.connect(f,p,d,g)}),this.start=function(a,s,c,u){qt(c)||(u=c,c=Oe(s)),t.init(a,"connect",{autoActivate:u,data:{shape:s,context:{start:s,connectionStart:c}}})}}__.$inject=["eventBus","dragging","modeling","rules"];function Bf(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var fk=1100,dk=900,x_="connect-ok",w_="connect-not-ok";function E_(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",function(r){var o=r.context,a=o.canExecute,s=o.hover,c=o.source,u=o.start,l=o.startPosition,f=o.target,p=o.connectionStart||l,d=o.connectionEnd||{x:r.x,y:r.y},g=p,h=d;Bf(o)&&(g=d,h=p),i.drawPreview(o,a,{source:c||u,target:f||s,connectionStart:g,connectionEnd:h})}),t.on("connect.hover",dk,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?x_:w_)}),t.on(["connect.out","connect.cleanup"],fk,function(r){var o=r.hover;o&&(n.removeMarker(o,x_),n.removeMarker(o,w_))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}E_.$inject=["injector","eventBus","canvas"];const Nf={__depends__:[Xn,bi,Bi],__init__:["connectPreview"],connect:["type",__],connectPreview:["type",E_]};var hk="djs-dragger";function Gi(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)}Gi.$inject=["injector","canvas","graphicsFactory","elementFactory"],Gi.prototype.drawPreview=function(e,t,n){n=n||{};var i=e.connectionPreviewGfx,r=e.getConnection,o=n.source,a=n.target,s=n.waypoints,c=n.connectionStart,u=n.connectionEnd,l=n.noLayout,f=n.noCropping,p=n.noNoop,d,g=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),Ss(i),r||(r=e.getConnection=mk(function(h,m,_){return g.getConnection(h,m,_)})),t&&(d=r(t,o,a)),!d){!p&&this.drawNoopPreview(i,n);return}d.waypoints=s||[],this._layouter&&!l&&(d.waypoints=this._layouter.layoutConnection(d,{source:o,target:a,connectionStart:c,connectionEnd:u,waypoints:n.waypoints||d.waypoints})),(!d.waypoints||!d.waypoints.length)&&(d.waypoints=[o?Oe(o):c,a?Oe(a):u]),this._connectionDocking&&(o||a)&&!f&&(d.waypoints=this._connectionDocking.getCroppedWaypoints(d,o,a)),this._graphicsFactory.drawConnection(i,d,{stroke:"var(--element-dragger-color)"})},Gi.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||Oe(n),o=t.connectionEnd||Oe(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);Fe(e,s)},Gi.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&&na(o,s,!0)||e,t=i&&na(a,s,!1)||t,[e,t]},Gi.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&Ht(e.connectionPreviewGfx)},Gi.prototype.getConnection=function(e){var t=gk(e);return this._elementFactory.createConnection(t)},Gi.prototype.createConnectionPreviewGfx=function(){var e=Pe("g");return ve(e,{pointerEvents:"none"}),Xe(e).add(hk),Fe(this._canvas.getActiveLayer(),e),e},Gi.prototype.createNoopConnection=function(e,t){return Qo([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function mk(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 gk(e){return qt(e)?e:{}}const yk={__init__:["connectionPreview"],connectionPreview:["type",Gi]},uu="complex-preview";class S_{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(uu);n.filter(s=>!vk(s)).forEach(s=>{let c;at(s)?(c=this._graphicsFactory._createContainer("connection",Pe("g")),this._graphicsFactory.drawConnection(Or(c),s)):(c=this._graphicsFactory._createContainer("shape",Pe("g")),this._graphicsFactory.drawShape(Or(c),s),nn(c,s.x,s.y)),this._previewSupport.addDragger(s,a,c)}),i.forEach(({element:s,delta:c})=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"]);const u=this._previewSupport.addDragger(s,a);at(s)?nn(u,c.x,c.y):nn(u,s.x+c.x,s.y+c.y)}),r.forEach(s=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"])}),o.forEach(({shape:s,bounds:c})=>{this._canvas.addMarker(s,"djs-hidden"),this._markers.push([s,"djs-hidden"]),this._previewSupport.addDragger(s,a,void 0,"djs-dragging");const u=this._graphicsFactory._createContainer("shape",Pe("g"));this._graphicsFactory.drawShape(Or(u),s,{width:c.width,height:c.height}),nn(u,c.x,c.y),this._previewSupport.addDragger(s,a,u)})}cleanUp(){Ss(this._canvas.getLayer(uu)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(uu)}hide(){this._canvas.hideLayer(uu)}}S_.$inject=["canvas","graphicsFactory","previewSupport"];function vk(e){return e.hidden}const bk={__depends__:[Ao],__init__:["complexPreview"],complexPreview:["type",S_]},R_=Math.round;function lu(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}lu.prototype.create=function(e,t,n){const i=this._complexPreview,r=this._connectionDocking,o=this._elementFactory,a=this._eventBus,s=this._layouter,c=this._rules,u=o.createShape(V({type:t},n)),l=a.fire("autoPlace",{source:e,shape:u});if(!l)return;V(u,{x:l.x-R_(u.width/2),y:l.y-R_(u.height/2)});const f=c.allowed("connection.create",{source:e,target:u,hints:{targetParent:e.parent}});let p=null;f&&(p=o.createConnection(f),p.waypoints=s.layoutConnection(p,{source:e,target:u}),p.waypoints=r.getCroppedWaypoints(p,e,u)),i.create({created:[u,p].filter(d=>!Zr(d))})},lu.prototype.cleanUp=function(){this._complexPreview.cleanUp()},lu.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const _k={__depends__:[Nc,bk,uf],__init__:["appendPreview"],appendPreview:["type",lu]};var C_=Math.min,P_=Math.max;function $f(e){e.preventDefault()}function Ga(e){e.stopPropagation()}function xk(e){return e.nodeType===Node.TEXT_NODE}function wk(e){return[].slice.call(e)}function ai(e){this.container=e.container,this.parent=ht('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=ot("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=bn(this.autoResize,this),this.handlePaste=bn(this.handlePaste,this)}ai.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=ii(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);V(o.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},c);var u=ii(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return V(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},u),i.centerVertically&&V(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},u),a.innerText=n,$e.bind(a,"keydown",this.keyHandler),$e.bind(a,"mousedown",Ga),$e.bind(a,"paste",r.handlePaste),$e.bind(a,"focusout",this.focusoutHandler),i.autoResize&&$e.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},ai.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)}},ai.prototype.insertText=function(e){e=Ek(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},ai.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=wk(a.childNodes),c,u;if(xk(a)){var l=n.textContent;n.textContent=l.substring(0,r)+e+l.substring(o),c=n,u=r+e.length}else if(n===this.content&&i===this.content){var f=document.createTextNode(e);this.content.insertBefore(f,s[r]),c=f,u=f.textContent.length}else{var p=s.indexOf(n),d=s.indexOf(i);s.forEach(function(g,h){h===p?g.textContent=n.textContent.substring(0,r)+e+i.textContent.substring(o):h>p&&h<=d&&di(g)}),c=n,u=r+e.length}c&&u!==void 0&&setTimeout(function(){self.setSelection(c,u)})},ai.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})}},ai.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=ht('<div class="djs-direct-editing-resize-handle"></div>');var s,c,u,l,f=function(g){$f(g),Ga(g),s=g.clientX,c=g.clientY;var h=t.getBoundingClientRect();u=h.width,l=h.height,$e.bind(document,"mousemove",p),$e.bind(document,"mouseup",d)},p=function(g){$f(g),Ga(g);var h=C_(P_(u+g.clientX-s,i),o),m=C_(P_(l+g.clientY-c,r),a);t.style.width=h+"px",t.style.height=m+"px",e.resizeHandler({width:u,height:l,dx:g.clientX-s,dy:g.clientY-c})},d=function(g){$f(g),Ga(g),$e.unbind(document,"mousemove",p,!1),$e.unbind(document,"mouseup",d,!1)};$e.bind(n,"mousedown",f)}V(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)},ai.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),$e.unbind(t,"keydown",this.keyHandler),$e.unbind(t,"mousedown",Ga),$e.unbind(t,"input",this.autoResize),$e.unbind(t,"paste",this.handlePaste),$e.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),di(n)),di(e)},ai.prototype.getValue=function(){return this.content.innerText.trim()},ai.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},ai.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 Ek(e){return e.replace(/\r\n|\r|\n/g,`
316
- `)}function Ln(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new ai({container:t.getContainer(),keyHandler:bn(this._handleKey,this),resizeHandler:bn(this._handleResize,this),focusoutHandler:bn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}Ln.$inject=["eventBus","canvas"],Ln.prototype.registerProvider=function(e){this._providers.push(e)},Ln.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},Ln.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},Ln.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},Ln.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},Ln.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},Ln.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()}},Ln.prototype.getValue=function(){return this._textbox.getValue()},Ln.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()},Ln.prototype._handleResize=function(e){this._fire("resize",e)},Ln.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},Ln.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=pt(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 A_={__depends__:[dc],__init__:["directEditing"],directEditing:["type",Ln]};function Sk(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===Ye(e);return!o||!a||!s||!c}}const Rk={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 te(e,t={}){var n=Rk[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var Ck=[te("none-start-event",{actionName:"replace-with-none-start"}),te("none-intermediate-throwing"),te("none-end-event",{actionName:"replace-with-none-end"}),te("message-start"),te("timer-start"),te("conditional-start"),te("signal-start")],Pk=[te("none-start-event",{actionName:"replace-with-none-start"}),te("none-intermediate-throwing"),te("none-end-event",{actionName:"replace-with-none-end"})],Ak=[te("none-start-event",{actionName:"replace-with-none-start"}),te("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),te("none-end-event",{actionName:"replace-with-none-end"}),te("message-intermediate-catch"),te("message-intermediate-throw"),te("timer-intermediate-catch"),te("escalation-intermediate-throw"),te("conditional-intermediate-catch"),te("link-intermediate-catch"),te("link-intermediate-throw"),te("compensation-intermediate-throw"),te("signal-intermediate-catch"),te("signal-intermediate-throw")],Tk=[te("none-start-event",{actionName:"replace-with-none-start"}),te("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),te("none-end-event",{actionName:"replace-with-none-end"}),te("message-end"),te("escalation-end"),te("error-end"),te("cancel-end"),te("compensation-end"),te("signal-end"),te("terminate-end")],Mk=[te("exclusive-gateway"),te("parallel-gateway"),te("inclusive-gateway"),te("complex-gateway"),te("event-based-gateway")],kk=[te("transaction"),te("event-subprocess"),te("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),te("collapsed-subprocess")],Ok=[te("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),te("transaction"),te("event-subprocess"),te("collapsed-ad-hoc-subprocess")],T_=[te("transaction"),te("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),te("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),te("event-subprocess")],Dk=T_,M_=[te("task"),te("user-task"),te("service-task"),te("send-task"),te("receive-task"),te("manual-task"),te("rule-task"),te("script-task"),te("call-activity"),te("collapsed-subprocess"),te("expanded-subprocess"),te("collapsed-ad-hoc-subprocess"),te("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],Lk=[te("data-store-reference")],Ik=[te("data-object-reference")],Bk=[te("message-boundary"),te("timer-boundary"),te("escalation-boundary"),te("conditional-boundary"),te("error-boundary"),te("cancel-boundary"),te("signal-boundary"),te("compensation-boundary"),te("non-interrupting-message-boundary"),te("non-interrupting-timer-boundary"),te("non-interrupting-escalation-boundary"),te("non-interrupting-conditional-boundary"),te("non-interrupting-signal-boundary")],Nk=[te("message-start"),te("timer-start"),te("conditional-start"),te("signal-start"),te("error-start"),te("escalation-start"),te("compensation-start"),te("non-interrupting-message-start"),te("non-interrupting-timer-start"),te("non-interrupting-conditional-start"),te("non-interrupting-signal-start"),te("non-interrupting-escalation-start")],$k=[{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"}],Fk=[te("expanded-pool"),te("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],jk={"bpmn:MessageEventDefinition":[te("message-start"),te("message-intermediate-catch"),te("message-intermediate-throw"),te("message-end")],"bpmn:TimerEventDefinition":[te("timer-start"),te("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[te("conditional-start"),te("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[te("signal-start"),te("signal-intermediate-catch"),te("signal-intermediate-throw"),te("signal-end")],"bpmn:ErrorEventDefinition":[te("error-start"),te("error-end")],"bpmn:EscalationEventDefinition":[te("escalation-start"),te("escalation-intermediate-throw"),te("escalation-end")],"bpmn:CompensateEventDefinition":[te("compensation-start"),te("compensation-intermediate-throw"),te("compensation-end")]};const k_={"start-event-non-interrupting":`
315
+ </svg>`},K2=900;function Fo(e,t,n,i){e.registerProvider(K2,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}Fo.$inject=["contextPad","popupMenu","translate","canvas"],Fo.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&V(t,this._getEntries(e)),t},Fo.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Fo.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${Zb.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);V(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},Fo.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 X2=["left","center","right","top","middle","bottom"];function Ha(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}Ha.$inject=["popupMenu","alignElements","translate","rules"],Ha.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&V(t,this._getEntries(e)),t},Ha.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Ha.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return I(X2,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:Zb[o],action:function(){t.trigger(e,o),i.close()}}}),r};function ru(e){Kn.call(this,e)}ru.$inject=["eventBus"],ye(ru,Kn),ru.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=Ge(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=Ps(n),n.length<2?!1:n})};const Z2={__depends__:[c2,cb,Mf],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Fo],alignElementsMenuProvider:["type",Ha],bpmnAlignElements:["type",ru]};function Vi(e,t,n,i){ee.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=i;var r=this;this.postExecuted(["shape.create"],function(o){var a=o.context,s=a.hints||{},c=a.shape,u=a.parent||a.newParent;s.autoResize!==!1&&r._expand([c],u)}),this.postExecuted(["elements.move"],function(o){var a=o.context,s=Du(eo(a.closure.topLevel)),c=a.hints,u=c?c.autoResize:!0;if(u!==!1){var l=to(s,function(f){return f.parent.id});I(l,function(f,p){Oe(u)&&(f=f.filter(function(d){return lt(u,no({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,u=c.parent;s&&s.autoResize===!1||u&&r._expand([c],u)})}Vi.$inject=["eventBus","elementRegistry","modeling","rules"],ye(Vi,ee),Vi.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=Te(kt(e)),o=Te(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),Ms(V({},o,a))},Vi.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(Q2(i,t)){var r=J2(ri(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},Vi.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Vi.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Vi.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function Q2(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function J2(e,t){var n="";return e=Te(e),t=Te(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 ou(e){e.invoke(Vi,this)}ou.$inject=["injector"],ye(ou,Vi),ou.prototype.resize=function(e,t,n){w(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function za(e){Kn.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}za.$inject=["eventBus"],ye(za,Kn),za.prototype.canResize=function(e,t){return!1};function au(e,t){za.call(this,e),this._modeling=t}ye(au,za),au.$inject=["eventBus","modeling"],au.prototype.canResize=function(e,t){if(w(t.di,"bpmndi:BPMNPlane")||!w(t,"bpmn:Participant")&&!w(t,"bpmn:Lane")&&!w(t,"bpmn:SubProcess"))return!1;var n=!0;return I(e,function(i){if(w(i,"bpmn:Lane")||je(i)){n=!1;return}}),n};const ek={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",ou],bpmnAutoResizeProvider:["type",au]};function jo(e,t,n){this._canvas=n,this._opts=V({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()})}jo.$inject=["config.autoScroll","eventBus","canvas"],jo.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++)tk(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 tk(e,t,n){return t<e&&e<n}jo.prototype.stopScroll=function(){clearTimeout(this._scrolling)},jo.prototype.setOptions=function(e){this._opts=V({},this._opts,e)},jo.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Nr(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const nk={__depends__:[$i],__init__:["autoScroll"],autoScroll:["type",jo]};var Qb="djs-bendpoint",Jb="djs-segment-dragger";function ik(e,t){var n=Nr(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 kf(e,t,n){var i=ik(e,n),r=Kl(t,i);return r}function Of(e,t){var n=Ae("g");Ye(n).add(Qb),Ne(e,n);var i=Ae("circle");ve(i,{cx:0,cy:0,r:4}),Ye(i).add("djs-visual"),Ne(n,i);var r=Ae("circle");return ve(r,{cx:0,cy:0,r:10}),Ye(r).add("djs-hit"),Ne(n,r),t&&Ye(n).add(t),n}function rk(e,t,n,i){var r=Ae("g");Ne(e,r);var o=18,a=6,s=11,c=ak(t,n,i),u=a+s,l=Ae("rect");ve(l,{x:-o/2,y:-a/2,width:o,height:a}),Ye(l).add("djs-visual"),Ne(r,l);var f=Ae("rect");return ve(f,{x:-c/2,y:-u/2,width:c,height:u}),Ye(f).add("djs-hit"),Ne(r,f),Cm(r,i==="v"?90:0),r}function e_(e,t,n){var i=Ae("g"),r=Sl(t,n),o=Oi(t,n);return Ne(e,i),rk(i,t,n,o),Ye(i).add(Jb),Ye(i).add(o==="h"?"horizontal":"vertical"),Jt(i,r.x,r.y),i}function Df(e){return Math.abs(Math.round(e*2/3))}function ok(e,t){var n=sk(e,t);return tp(e,n)}function ak(e,t,n){var i=t.x-e.x,r=t.y-e.y;return Df(n==="h"?i:r)}function sk(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=fg(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function t_(e,t,n,i,r){function o(x,S,P){var C=x.index,L=x.point,T,j,k,D,z,se;return C<=0||x.bendpoint?!1:(T=S[C-1],j=S[C],k=Sl(T,j),D=Oi(T,j),z=Math.abs(L.x-k.x),se=Math.abs(L.y-k.y),D&&z<=P&&se<=P)}function a(x,S){var P=x.waypoints,C,L,T,j;return S.index<=0||S.bendpoint||(C={start:P[S.index-1],end:P[S.index]},L=Oi(C.start,C.end),!L)?null:(L==="h"?T=C.end.x-C.start.x:T=C.end.y-C.start.y,j=Df(T)/2,j)}function s(x,S){var P=S.waypoints,C=kf(t,P,x),L;if(C){L=a(S,C);var T;if(o(C,P,L)?T=r.start(x,S,C.index):T=i.start(x,S,C.index,!C.bendpoint),T!==!1)return!0}}function c(x,S,P){Be.bind(x,S,function(C){n.triggerMouseEvent(S,C,P),C.stopPropagation()})}function u(x,S){var P=t.getLayer("overlays"),C=rt('.djs-bendpoints[data-element-id="'+Ba(x.id)+'"]',P);return!C&&S&&(C=Ae("g"),ve(C,{"data-element-id":x.id}),Ye(C).add("djs-bendpoints"),Ne(P,C),c(C,"mousedown",x),c(C,"click",x),c(C,"dblclick",x)),C}function l(x,S){return rt('.djs-segment-dragger[data-segment-idx="'+x+'"]',S)}function f(x,S){S.waypoints.forEach(function(P,C){var L=Of(x);Ne(x,L),Jt(L,P.x,P.y)}),Of(x,"floating")}function p(x,S){for(var P=S.waypoints,C,L,T,j=1;j<P.length;j++)C=P[j-1],L=P[j],Oi(C,L)&&(T=e_(x,C,L),ve(T,{"data-segment-idx":j}),c(T,"mousemove",S))}function d(x){I(Es("."+Qb,x),function(S){Ft(S)})}function g(x){I(Es("."+Jb,x),function(S){Ft(S)})}function h(x){var S=u(x);return S||(S=u(x,!0),f(S,x),p(S,x)),S}function m(x){var S=u(x);S&&(g(S),d(S),p(S,x),f(S,x))}function _(x,S){var P=rt(".floating",x),C=S.point;P&&(Jt(P,C.x,C.y),Ye(P).add("positioned"))}function y(x,S,P){var C=l(S.index,x),L=P[S.index-1],T=P[S.index],j=S.point,k=Sl(L,T),D=Oi(L,T),z,se;C&&(z=ck(C),se={x:j.x-k.x,y:j.y-k.y},D==="v"&&(se={x:se.y,y:se.x}),Jt(z,se.x,se.y))}e.on("connection.changed",function(x){m(x.element)}),e.on("connection.remove",function(x){var S=u(x.element);S&&Ft(S)}),e.on("element.marker.update",function(x){var S=x.element,P;S.waypoints&&(P=h(S),x.add?Ye(P).add(x.marker):Ye(P).remove(x.marker))}),e.on("element.mousemove",function(x){var S=x.element,P=S.waypoints,C,L;if(P){if(C=u(S,!0),L=kf(t,P,x.originalEvent),!L)return;_(C,L),L.bendpoint||y(C,L,P)}}),e.on("element.mousedown",function(x){if(cr(x)){var S=x.originalEvent,P=x.element;if(P.waypoints)return s(S,P)}}),e.on("selection.changed",function(x){var S=x.newSelection,P=S[0];P&&P.waypoints&&h(P)}),e.on("element.hover",function(x){var S=x.element;S.waypoints&&h(S)}),e.on("element.out",function(x){var S=x.element;if(S.waypoints){var P=u(S);if(P){var C=rt(".floating",P);C&&Ye(C).remove("positioned")}}}),e.on("element.updateId",function(x){var S=x.element,P=x.newId;if(S.waypoints){var C=u(S);C&&ve(C,{"data-element-id":P})}}),this.addHandles=h,this.updateHandles=m,this.getBendpointsContainer=u,this.getSegmentDragger=l}t_.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function ck(e){return rt(".djs-visual",e)}var n_=Math.round,Wr="reconnectStart",Ur="reconnectEnd",Ga="updateWaypoints";function Lf(e,t,n,i,r,o){this._injector=e,this.start=function(a,s,c,u){var l=n.getGraphics(s),f=s.source,p=s.target,d=s.waypoints,g;!u&&c===0?g=Wr:!u&&c===d.length-1?g=Ur:g=Ga;var h=g===Ga?"connection.updateWaypoints":"connection.reconnect",m=r.allowed(h,{connection:s,source:f,target:p});if(m===!1&&(m=r.allowed(h,{connection:s,source:p,target:f})),m!==!1)return i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:l,context:{allowed:m,bendpointIndex:c,connection:s,source:f,target:p,insert:u,type:g}}})},t.on("bendpoint.move.hover",function(a){var s=a.context,c=s.connection,u=c.source,l=c.target,f=a.hover,p=s.type;s.hover=f;var d;if(f){var g=p===Ga?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(g,{connection:c,source:p===Wr?f:u,target:p===Ur?f:l}),d){s.source=p===Wr?f:u,s.target=p===Ur?f:l;return}d===!1&&(d=s.allowed=r.allowed(g,{connection:c,source:p===Ur?f:l,target:p===Wr?f:u})),d&&(s.source=p===Ur?f:l,s.target=p===Wr?f:u)}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(a){var s=a.context,c=s.type;s.hover=null,s.source=null,s.target=null,c!==Ga&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(a){var s=a.context,c=s.allowed,u=s.bendpointIndex,l=s.connection,f=s.insert,p=l.waypoints.slice(),d=s.source,g=s.target,h=s.type,m=s.hints||{},_={x:n_(a.x),y:n_(a.y)};if(!c)return!1;h===Ga?(f?p.splice(u,0,_):p[u]=_,m.bendpointMove={insert:f,bendpointIndex:u},p=this.cropWaypoints(l,p),o.updateWaypoints(l,RS(p),m)):(h===Wr?(m.docking="source",su(s)&&(m.docking="target",m.newWaypoints=p.reverse())):h===Ur&&(m.docking="target",su(s)&&(m.docking="source",m.newWaypoints=p.reverse())),o.reconnect(l,d,g,_,m))},this)}Lf.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],Lf.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 su(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===Wr)return t&&i&&t===i&&n!==i;if(r===Ur)return t&&n&&t===n&&n!==i}var uk="reconnectStart",lk="reconnectEnd",i_="updateWaypoints",Va="connect-ok",cu="connect-not-ok",r_="connect-hover",o_="djs-updating",a_="djs-dragging",s_=1100;function c_(e,t,n,i){this._injector=t;var r=t.get("connectionPreview",!1);n.on("bendpoint.move.start",function(o){var a=o.context,s=a.bendpointIndex,c=a.connection,u=a.insert,l=c.waypoints,f=l.slice();a.waypoints=l,u&&f.splice(s,0,{x:o.x,y:o.y}),c.waypoints=f;var p=a.draggerGfx=Of(i.getLayer("overlays"));Ye(p).add("djs-dragging"),i.addMarker(c,a_),i.addMarker(c,o_)}),n.on("bendpoint.move.hover",function(o){var a=o.context,s=a.allowed,c=a.hover,u=a.type;if(c){if(i.addMarker(c,r_),u===i_)return;s?(i.removeMarker(c,cu),i.addMarker(c,Va)):s===!1&&(i.removeMarker(c,Va),i.addMarker(c,cu))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],s_,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,r_),i.removeMarker(s,c?Va:cu))}),n.on("bendpoint.move.move",function(o){var a=o.context,s=a.allowed,c=a.bendpointIndex,u=a.draggerGfx,l=a.hover,f=a.type,p=a.connection,d=p.source,g=p.target,h=p.waypoints.slice(),m={x:o.x,y:o.y},_=a.hints||{},y={};r&&(_.connectionStart&&(y.connectionStart=_.connectionStart),_.connectionEnd&&(y.connectionEnd=_.connectionEnd),f===uk?su(a)?(y.connectionEnd=y.connectionEnd||m,y.source=g,y.target=l||d,h=h.reverse()):(y.connectionStart=y.connectionStart||m,y.source=l||d,y.target=g):f===lk?su(a)?(y.connectionStart=y.connectionStart||m,y.source=l||g,y.target=d,h=h.reverse()):(y.connectionEnd=y.connectionEnd||m,y.source=d,y.target=l||g):(y.noCropping=!0,y.noLayout=!0,h[c]=m),f===i_&&(h=e.cropWaypoints(p,h)),y.waypoints=h,r.drawPreview(a,s,y)),Jt(u,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],s_,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,u=a.hover,l=a.target,f=a.waypoints;s.waypoints=f,Ft(c),i.removeMarker(s,o_),i.removeMarker(s,a_),u&&(i.removeMarker(u,Va),i.removeMarker(u,l?Va:cu)),r&&r.cleanUp(a)})}c_.$inject=["bendpointMove","injector","eventBus","canvas"];var u_="connect-hover",l_="djs-updating";function p_(e,t,n){return If(e,t,e[t]+n)}function If(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function pk(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 If(t,i,s)}function f_(e){return e==="x"?"y":"x"}function d_(e,t,n){var i,r;return e.original?e.original:(i=De(t),r=f_(n),If(e,r,i[r]))}function h_(e,t,n,i,r,o){var a=e.get("connectionDocking",!1);this.start=function(f,p,d){var g,h=n.getGraphics(p),m=d-1,_=d,y=p.waypoints,x=y[m],S=y[_],P=kf(n,y,f),C,L,T;if(C=Oi(x,S),!!C)return L=C==="v"?"x":"y",m===0&&(x=d_(x,p.source,L)),_===y.length-1&&(S=d_(S,p.target,L)),P?T=P.point:T={x:(x.x+S.x)/2,y:(x.y+S.y)/2},g={connection:p,segmentStartIndex:m,segmentEndIndex:_,segmentStart:x,segmentEnd:S,axis:L,dragPosition:T},i.init(f,T,"connectionSegment.move",{cursor:L==="x"?"resize-ew":"resize-ns",data:{connection:p,connectionGfx:h,context:g}})};function s(f,p){if(!a)return p;var d=f.waypoints,g;return f.waypoints=p,g=a.getCroppedWaypoints(f),f.waypoints=d,g}function c(f){r.update("connection",f.connection,f.connectionGfx)}function u(f,p,d){var g=f.newWaypoints,h=f.segmentStartIndex+p,m=g[h],_=f.segmentEndIndex+p,y=g[_],x=f_(f.axis),S=pk(d,m,y,x);Jt(f.draggerGfx,S.x,S.y)}function l(f,p){var d=0,g=f.filter(function(h,m){return El(f[m-1],f[m+1],h)?(d=m<=p?d-1:d,!1):!0});return{waypoints:g,segmentOffset:d}}t.on("connectionSegment.move.start",function(f){var p=f.context,d=f.connection,g=n.getLayer("overlays");p.originalWaypoints=d.waypoints.slice(),p.draggerGfx=e_(g,p.segmentStart,p.segmentEnd),Ye(p.draggerGfx).add("djs-dragging"),n.addMarker(d,l_)}),t.on("connectionSegment.move.move",function(f){var p=f.context,d=p.connection,g=p.segmentStartIndex,h=p.segmentEndIndex,m=p.segmentStart,_=p.segmentEnd,y=p.axis,x=p.originalWaypoints.slice(),S=p_(m,y,f["d"+y]),P=p_(_,y,f["d"+y]),C=x.length,L=0;x[g]=S,x[h]=P;var T,j;g<2&&(T=Qt(d.source,S),g===1?T==="intersect"&&(x.shift(),x[0]=S,L--):T!=="intersect"&&(x.unshift(m),L++)),h>C-3&&(j=Qt(d.target,P),h===C-2?j==="intersect"&&(x.pop(),x[x.length-1]=P):j!=="intersect"&&x.push(_)),p.newWaypoints=d.waypoints=s(d,x),u(p,L,f),p.newSegmentStartIndex=g+L,c(f)}),t.on("connectionSegment.move.hover",function(f){f.context.hover=f.hover,n.addMarker(f.hover,u_)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(f){var p=f.context.hover;p&&n.removeMarker(p,u_)}),t.on("connectionSegment.move.cleanup",function(f){var p=f.context,d=p.connection;p.draggerGfx&&Ft(p.draggerGfx),n.removeMarker(d,l_)}),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,g=p.newWaypoints,h=p.newSegmentStartIndex;g=g.map(function(P){return{original:P.original,x:Math.round(P.x),y:Math.round(P.y)}});var m=l(g,h),_=m.waypoints,y=s(d,_),x=m.segmentOffset,S={segmentMove:{segmentStartIndex:p.segmentStartIndex,newSegmentStartIndex:h+x}};o.updateWaypoints(d,y,S)})}h_.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var fk=Math.abs,m_=Math.round;function dk(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],fk(r-e)<=n)return r}function g_(e){return{x:e.x,y:e.y}}function y_(e){return{x:e.x+e.width,y:e.y+e.height}}function Jn(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:m_(e.x+e.width/2),y:m_(e.y+e.height/2)}}function Ho(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function It(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 v_(e){return e.children||[]}var hk=Math.abs,b_=Math.round,Bf=10;function __(e){function t(o,a){if(Oe(o)){for(var s=o.length;s--;)if(hk(o[s]-a)<=Bf)return o[s]}else{o=+o;var c=a%o;if(c<Bf)return a-c;if(c>o-Bf)return a-c+o}return a}function n(o,a){if(o.waypoints)return ok(a,o);if(o.width)return{x:b_(o.width/2+o.x),y:b_(o.height/2+o.y)}}function i(o){var a=o.context,s=a.snapPoints,c=a.connection,u=c.waypoints,l=a.segmentStart,f=a.segmentStartIndex,p=a.segmentEnd,d=a.segmentEndIndex,g=a.axis;if(s)return s;var h=[u[f-1],l,p,u[d+1]];return f<2&&h.unshift(n(c.source,o)),d>u.length-3&&h.unshift(n(c.target,o)),a.snapPoints=s={horizontal:[],vertical:[]},I(h,function(m){m&&(m=m.original||m,g==="y"&&s.horizontal.push(m.y),g==="x"&&s.vertical.push(m.x))}),s}e.on("connectionSegment.move.move",1500,function(o){var a=i(o),s=o.x,c=o.y,u,l;if(a){u=t(a.vertical,s),l=t(a.horizontal,c);var f=s-u,p=c-l;V(o,{dx:o.dx-f,dy:o.dy-p,x:u,y:l}),(f||a.vertical.indexOf(s)!==-1)&&It(o,"x",u),(p||a.horizontal.indexOf(c)!==-1)&&It(o,"y",l)}});function r(o){var a=o.snapPoints,s=o.connection.waypoints,c=o.bendpointIndex;if(a)return a;var u=[s[c-1],s[c+1]];return o.snapPoints=a={horizontal:[],vertical:[]},I(u,function(l){l&&(l=l.original||l,a.horizontal.push(l.y),a.vertical.push(l.x))}),a}e.on(["connect.hover","connect.move","connect.end"],1500,function(o){var a=o.context,s=a.hover,c=s&&n(s,o);!ot(s)||!c||!c.x||!c.y||(It(o,"x",c.x),It(o,"y",c.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(o){var a=o.context,s=r(a),c=a.hover,u=c&&n(c,o),l=o.x,f=o.y,p,d;if(s){p=t(u?s.vertical.concat([u.x]):s.vertical,l),d=t(u?s.horizontal.concat([u.y]):s.horizontal,f);var g=l-p,h=f-d;V(o,{dx:o.dx-g,dy:o.dy-h,x:o.x-g,y:o.y-h}),(g||s.vertical.indexOf(l)!==-1)&&It(o,"x",p),(h||s.horizontal.indexOf(f)!==-1)&&It(o,"y",d)}})}__.$inject=["eventBus"];const mk={__depends__:[$i,xi],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",t_],bendpointMove:["type",Lf],bendpointMovePreview:["type",c_],connectionSegmentMove:["type",h_],bendpointSnapping:["type",__]};function x_(e,t,n,i){function r(a,s){return i.allowed("connection.create",{source:a,target:s})}function o(a,s){return r(s,a)}e.on("connect.hover",function(a){var s=a.context,c=s.start,u=a.hover,l;if(s.hover=u,l=s.canExecute=r(c,u),!Jr(l)){if(l!==!1){s.source=c,s.target=u;return}l=s.canExecute=o(c,u),!Jr(l)&&l!==!1&&(s.source=u,s.target=c)}}),e.on(["connect.out","connect.cleanup"],function(a){var s=a.context;s.hover=null,s.source=null,s.target=null,s.canExecute=!1}),e.on("connect.end",function(a){var s=a.context,c=s.canExecute,u=s.connectionStart,l={x:a.x,y:a.y},f=s.source,p=s.target;if(!c)return!1;var d=null,g={connectionStart:Nf(s)?l:u,connectionEnd:Nf(s)?u:l};Wt(c)&&(d=c),s.connection=n.connect(f,p,d,g)}),this.start=function(a,s,c,u){Wt(c)||(u=c,c=De(s)),t.init(a,"connect",{autoActivate:u,data:{shape:s,context:{start:s,connectionStart:c}}})}}x_.$inject=["eventBus","dragging","modeling","rules"];function Nf(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var gk=1100,yk=900,w_="connect-ok",E_="connect-not-ok";function S_(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",function(r){var o=r.context,a=o.canExecute,s=o.hover,c=o.source,u=o.start,l=o.startPosition,f=o.target,p=o.connectionStart||l,d=o.connectionEnd||{x:r.x,y:r.y},g=p,h=d;Nf(o)&&(g=d,h=p),i.drawPreview(o,a,{source:c||u,target:f||s,connectionStart:g,connectionEnd:h})}),t.on("connect.hover",yk,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?w_:E_)}),t.on(["connect.out","connect.cleanup"],gk,function(r){var o=r.hover;o&&(n.removeMarker(o,w_),n.removeMarker(o,E_))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}S_.$inject=["injector","eventBus","canvas"];const $f={__depends__:[Xn,xi,$i],__init__:["connectPreview"],connect:["type",x_],connectPreview:["type",S_]};var vk="djs-dragger";function Wi(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)}Wi.$inject=["injector","canvas","graphicsFactory","elementFactory"],Wi.prototype.drawPreview=function(e,t,n){n=n||{};var i=e.connectionPreviewGfx,r=e.getConnection,o=n.source,a=n.target,s=n.waypoints,c=n.connectionStart,u=n.connectionEnd,l=n.noLayout,f=n.noCropping,p=n.noNoop,d,g=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),Ss(i),r||(r=e.getConnection=bk(function(h,m,_){return g.getConnection(h,m,_)})),t&&(d=r(t,o,a)),!d){!p&&this.drawNoopPreview(i,n);return}d.waypoints=s||[],this._layouter&&!l&&(d.waypoints=this._layouter.layoutConnection(d,{source:o,target:a,connectionStart:c,connectionEnd:u,waypoints:n.waypoints||d.waypoints})),(!d.waypoints||!d.waypoints.length)&&(d.waypoints=[o?De(o):c,a?De(a):u]),this._connectionDocking&&(o||a)&&!f&&(d.waypoints=this._connectionDocking.getCroppedWaypoints(d,o,a)),this._graphicsFactory.drawConnection(i,d,{stroke:"var(--element-dragger-color)"})},Wi.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||De(n),o=t.connectionEnd||De(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);Ne(e,s)},Wi.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&&ra(o,s,!0)||e,t=i&&ra(a,s,!1)||t,[e,t]},Wi.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&Ft(e.connectionPreviewGfx)},Wi.prototype.getConnection=function(e){var t=_k(e);return this._elementFactory.createConnection(t)},Wi.prototype.createConnectionPreviewGfx=function(){var e=Ae("g");return ve(e,{pointerEvents:"none"}),Ye(e).add(vk),Ne(this._canvas.getActiveLayer(),e),e},Wi.prototype.createNoopConnection=function(e,t){return ea([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function bk(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 _k(e){return Wt(e)?e:{}}const xk={__init__:["connectionPreview"],connectionPreview:["type",Wi]},uu="complex-preview";class R_{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(uu);n.filter(s=>!wk(s)).forEach(s=>{let c;ot(s)?(c=this._graphicsFactory._createContainer("connection",Ae("g")),this._graphicsFactory.drawConnection(Lr(c),s)):(c=this._graphicsFactory._createContainer("shape",Ae("g")),this._graphicsFactory.drawShape(Lr(c),s),Jt(c,s.x,s.y)),this._previewSupport.addDragger(s,a,c)}),i.forEach(({element:s,delta:c})=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"]);const u=this._previewSupport.addDragger(s,a);ot(s)?Jt(u,c.x,c.y):Jt(u,s.x+c.x,s.y+c.y)}),r.forEach(s=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"])}),o.forEach(({shape:s,bounds:c})=>{this._canvas.addMarker(s,"djs-hidden"),this._markers.push([s,"djs-hidden"]),this._previewSupport.addDragger(s,a,void 0,"djs-dragging");const u=this._graphicsFactory._createContainer("shape",Ae("g"));this._graphicsFactory.drawShape(Lr(u),s,{width:c.width,height:c.height}),Jt(u,c.x,c.y),this._previewSupport.addDragger(s,a,u)})}cleanUp(){Ss(this._canvas.getLayer(uu)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(uu)}hide(){this._canvas.hideLayer(uu)}}R_.$inject=["canvas","graphicsFactory","previewSupport"];function wk(e){return e.hidden}const Ek={__depends__:[ko],__init__:["complexPreview"],complexPreview:["type",R_]},C_=Math.round;function lu(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}lu.prototype.create=function(e,t,n){const i=this._complexPreview,r=this._connectionDocking,o=this._elementFactory,a=this._eventBus,s=this._layouter,c=this._rules,u=o.createShape(V({type:t},n)),l=a.fire("autoPlace",{source:e,shape:u});if(!l)return;V(u,{x:l.x-C_(u.width/2),y:l.y-C_(u.height/2)});const f=c.allowed("connection.create",{source:e,target:u,hints:{targetParent:e.parent}});let p=null;f&&(p=o.createConnection(f),p.waypoints=s.layoutConnection(p,{source:e,target:u}),p.waypoints=r.getCroppedWaypoints(p,e,u)),i.create({created:[u,p].filter(d=>!Jr(d))})},lu.prototype.cleanUp=function(){this._complexPreview.cleanUp()},lu.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const Sk={__depends__:[Nc,Ek,lf],__init__:["appendPreview"],appendPreview:["type",lu]};var P_=Math.min,A_=Math.max;function Ff(e){e.preventDefault()}function Wa(e){e.stopPropagation()}function Rk(e){return e.nodeType===Node.TEXT_NODE}function Ck(e){return[].slice.call(e)}function si(e){this.container=e.container,this.parent=ht('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=rt("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=vn(this.autoResize,this),this.handlePaste=vn(this.handlePaste,this)}si.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=ri(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);V(o.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},c);var u=ri(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return V(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},u),i.centerVertically&&V(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},u),a.innerText=n,Be.bind(a,"keydown",this.keyHandler),Be.bind(a,"mousedown",Wa),Be.bind(a,"paste",r.handlePaste),Be.bind(a,"focusout",this.focusoutHandler),i.autoResize&&Be.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},si.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)}},si.prototype.insertText=function(e){e=Pk(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},si.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=Ck(a.childNodes),c,u;if(Rk(a)){var l=n.textContent;n.textContent=l.substring(0,r)+e+l.substring(o),c=n,u=r+e.length}else if(n===this.content&&i===this.content){var f=document.createTextNode(e);this.content.insertBefore(f,s[r]),c=f,u=f.textContent.length}else{var p=s.indexOf(n),d=s.indexOf(i);s.forEach(function(g,h){h===p?g.textContent=n.textContent.substring(0,r)+e+i.textContent.substring(o):h>p&&h<=d&&mi(g)}),c=n,u=r+e.length}c&&u!==void 0&&setTimeout(function(){self.setSelection(c,u)})},si.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})}},si.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=ht('<div class="djs-direct-editing-resize-handle"></div>');var s,c,u,l,f=function(g){Ff(g),Wa(g),s=g.clientX,c=g.clientY;var h=t.getBoundingClientRect();u=h.width,l=h.height,Be.bind(document,"mousemove",p),Be.bind(document,"mouseup",d)},p=function(g){Ff(g),Wa(g);var h=P_(A_(u+g.clientX-s,i),o),m=P_(A_(l+g.clientY-c,r),a);t.style.width=h+"px",t.style.height=m+"px",e.resizeHandler({width:u,height:l,dx:g.clientX-s,dy:g.clientY-c})},d=function(g){Ff(g),Wa(g),Be.unbind(document,"mousemove",p,!1),Be.unbind(document,"mouseup",d,!1)};Be.bind(n,"mousedown",f)}V(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)},si.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),Be.unbind(t,"keydown",this.keyHandler),Be.unbind(t,"mousedown",Wa),Be.unbind(t,"input",this.autoResize),Be.unbind(t,"paste",this.handlePaste),Be.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),mi(n)),mi(e)},si.prototype.getValue=function(){return this.content.innerText.trim()},si.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},si.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 Pk(e){return e.replace(/\r\n|\r|\n/g,`
316
+ `)}function On(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new si({container:t.getContainer(),keyHandler:vn(this._handleKey,this),resizeHandler:vn(this._handleResize,this),focusoutHandler:vn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}On.$inject=["eventBus","canvas"],On.prototype.registerProvider=function(e){this._providers.push(e)},On.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},On.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},On.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},On.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},On.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},On.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()}},On.prototype.getValue=function(){return this._textbox.getValue()},On.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()},On.prototype._handleResize=function(e){this._fire("resize",e)},On.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},On.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=lt(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 T_={__depends__:[dc],__init__:["directEditing"],directEditing:["type",On]};function Ak(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===Ue(e);return!o||!a||!s||!c}}const Tk={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=Tk[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var Mk=[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")],kk=[J("none-start-event",{actionName:"replace-with-none-start"}),J("none-intermediate-throwing"),J("none-end-event",{actionName:"replace-with-none-end"})],Ok=[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")],Dk=[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")],Lk=[J("exclusive-gateway"),J("parallel-gateway"),J("inclusive-gateway"),J("complex-gateway"),J("event-based-gateway")],Ik=[J("transaction"),J("event-subprocess"),J("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),J("collapsed-subprocess")],Bk=[J("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),J("transaction"),J("event-subprocess"),J("collapsed-ad-hoc-subprocess")],M_=[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")],Nk=M_,k_=[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"})],$k=[J("data-store-reference")],Fk=[J("data-object-reference")],jk=[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")],Hk=[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")],zk=[{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"}],Gk=[J("expanded-pool"),J("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],Vk={"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 O_={"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 ei(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()}ei.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],ei.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},ei.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],r,o=[];if(ke(e)||!n.allowed("shape.replace",{element:e}))return{};var a=Sk(e);return w(t,"bpmn:DataObjectReference")?this._createEntries(e,Lk):w(t,"bpmn:DataStoreReference")&&!w(e.parent,"bpmn:Collaboration")?this._createEntries(e,Ik):(w(t,"bpmn:Event")&&!w(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=jk[r]||[],!pn(t.$parent)&&w(t.$parent,"bpmn:SubProcess")&&(i=Ue(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),w(t,"bpmn:StartEvent")&&!w(t.$parent,"bpmn:SubProcess")?(o=Ue(Ck.concat(i),a),this._createEntries(e,o)):w(t,"bpmn:Participant")?(o=Ue(Fk,function(c){return Ye(e)!==c.target.isExpanded}),this._createEntries(e,o)):w(t,"bpmn:StartEvent")&&pn(t.$parent)?(o=Ue(Nk.concat(i),function(c){var u=c.target,l=u.isInterrupting!==!1,f=t.isInterrupting===l;return a(c)||!a(c)&&!f}),this._createEntries(e,o)):w(t,"bpmn:StartEvent")&&!pn(t.$parent)&&w(t.$parent,"bpmn:SubProcess")?(o=Ue(Pk.concat(i),a),this._createEntries(e,o)):w(t,"bpmn:EndEvent")?(o=Ue(Tk.concat(i),function(c){var u=c.target;return u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!w(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,o)):w(t,"bpmn:BoundaryEvent")?(o=Ue(Bk,function(c){var u=c.target;if(u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!w(t.attachedToRef,"bpmn:Transaction"))return!1;var l=u.cancelActivity!==!1,f=t.cancelActivity==l;return a(c)||!a(c)&&!f}),this._createEntries(e,o)):w(t,"bpmn:IntermediateCatchEvent")||w(t,"bpmn:IntermediateThrowEvent")?(o=Ue(Ak.concat(i),a),this._createEntries(e,o)):w(t,"bpmn:Gateway")?(o=Ue(Mk,a),this._createEntries(e,o)):w(t,"bpmn:Transaction")?(o=Ue(T_,a),this._createEntries(e,o)):pn(t)&&Ye(e)?(o=Ue(Dk,a),this._createEntries(e,o)):w(t,"bpmn:AdHocSubProcess")&&Ye(e)?(o=Ue(Ok,a),this._createEntries(e,o)):w(t,"bpmn:SubProcess")&&Ye(e)?(o=Ue(kk,a),this._createEntries(e,o)):w(t,"bpmn:SubProcess")&&!Ye(e)?(o=Ue(M_,function(c){var u=c.target.type===e.type,l=c.target.isExpanded===!0;return u===l}),this._createEntries(e,o)):w(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,$k):w(t,"bpmn:FlowNode")?(o=Ue(M_,a),this._createEntries(e,o)):{})},ei.prototype.getPopupMenuHeaderEntries=function(e){var t={};return w(e,"bpmn:Activity")&&!pn(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),w(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),w(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),Cg(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},ei.prototype._createEntries=function(e,t){var n={},i=this;return I(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},ei.prototype._createSequenceFlowEntries=function(e,t){var n=ie(e),i={},r=this._modeling,o=this._moddle,a=this;return I(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(w(n.sourceRef,"bpmn:ExclusiveGateway")||w(n.sourceRef,"bpmn:InclusiveGateway")||w(n.sourceRef,"bpmn:ComplexGateway")||w(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&&w(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:w(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e,{conditionExpression:void 0})})}),(w(n.sourceRef,"bpmn:ExclusiveGateway")||w(n.sourceRef,"bpmn:InclusiveGateway")||w(n.sourceRef,"bpmn:ComplexGateway")||w(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},ei.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}},ei.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(u,l){if(l.active){t._modeling.updateProperties(e,{loopCharacteristics:void 0});return}var f=e.businessObject.get("loopCharacteristics");f&&w(f,l.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,f,{isSequential:l.options.isSequential}):(f=t._moddle.create(l.options.loopCharacteristics,{isSequential:l.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"}}}},ei.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}}},ei.prototype._getParticipantMultiplicityHeaderEntries=function(e){var t=this,n=this._bpmnFactory,i=this._translate;function r(a,s){var c=s.active,u;c||(u=n.create("bpmn:ParticipantMultiplicity")),t._modeling.updateProperties(e,{participantMultiplicity:u})}var o=e.businessObject.participantMultiplicity;return{"toggle-participant-multiplicity":{className:"bpmn-icon-parallel-mi-marker",title:i("Participant multiplicity"),active:!!o,action:r}}},ei.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=ie(e),i=this,r=Pg(e),o=w(e,"bpmn:BoundaryEvent")?k_["intermediate-event-non-interrupting"]:k_["start-event-non-interrupting"],a=!n[r];return{"toggle-non-interrupting":{imageHtml:o,title:t("Toggle non-interrupting"),active:a,action:function(){i._modeling.updateProperties(e,{[r]:!!a})}}}};const Hk={__depends__:[Tf,qy,Nc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",ei]};function Va(e,t,n,i,r,o,a,s,c,u,l,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=u,this._rules=l,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 g=d.context,h=g.shape;if(!(!ma(d)||!i.isOpen(h))){var m=i.getEntries(h);m.replace&&m.replace.action.click(d,h)}}),n.on("contextPad.close",function(){p.cleanUp()})}Va.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Va.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&V(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},Va.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return ke(t)?Rr(e,n=>t.includes(n)):t},Va.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,r=this._connect,o=this._create,a=this._popupMenu,s=this._autoPlace,c=this._translate,u=this._appendPreview,l={};if(e.type==="label")return this._isDeleteAllowed([e])&&V(l,g()),l;var f=e.businessObject;function p(x,S){r.start(x,S)}function d(x,S){n.removeElements([S])}function g(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function h(x){var S=5,P=t.getPad(x).html,C=P.getBoundingClientRect(),L={x:C.left,y:C.bottom+S};return L}function m(x,S,P,C){function L(k,D){var z=i.createShape(V({type:x},C));o.start(k,z,{source:D})}var T=s?function(k,D){var z=i.createShape(V({type:x},C));s.append(D,z)}:L,j=s?function(k,D){return u.create(D,x,C),()=>{u.cleanUp()}}:null;return{group:"model",className:S,title:P,action:{dragstart:L,click:T,hover:j}}}function _(x){return function(S,P){n.splitLane(P,x),t.open(P,!0)}}if(We(f,["bpmn:Lane","bpmn:Participant"])&&Ye(e)){var y=or(e);V(l,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(x,S){n.addLane(S,"top")}}}}),y.length<2&&((Xt(e)?e.height>=120:e.width>=120)&&V(l,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:_(2)}}}),(Xt(e)?e.height>=180:e.width>=180)&&V(l,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:_(3)}}})),V(l,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(x,S){n.addLane(S,"bottom")}}}})}return w(f,"bpmn:FlowNode")&&(w(f,"bpmn:EventBasedGateway")?V(l,{"append.receive-task":m("bpmn:ReceiveTask","bpmn-icon-receive-task",c("Append receive task")),"append.message-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):O_(f,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?V(l,{"append.compensation-activity":m("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!w(f,"bpmn:EndEvent")&&!f.isForCompensation&&!O_(f,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!pn(f)&&V(l,{"append.end-event":m("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append end event")),"append.gateway":m("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append gateway")),"append.append-task":m("bpmn:Task","bpmn-icon-task",c("Append task")),"append.intermediate-event":m("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append intermediate/boundary event"))})),a.isEmpty(e,"bpmn-replace")||V(l,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(x,S){var P=V(h(S),{cursor:{x:x.x,y:x.y}});a.open(S,"bpmn-replace",P,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),w(f,"bpmn:SequenceFlow")&&V(l,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),w(f,"bpmn:MessageFlow")&&V(l,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),We(f,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&V(l,{"append.text-annotation":m("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}}}),w(f,"bpmn:TextAnnotation")&&V(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:p,dragstart:p}}}),We(f,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&V(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:p,dragstart:p}}}),w(f,"bpmn:Group")&&V(l,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&V(l,g()),l};function O_(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return I(o,function(a){a.$type===n&&(r=!0)}),i&&r}const zk={__depends__:[_k,A_,sb,Xn,Nf,mc,Hk],__init__:["contextPadProvider"],contextPadProvider:["type",Va]};var Gk={horizontal:["x","width"],vertical:["y","height"]},D_=5;function Vi(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return ke(i)?i:i?n:[]})}Vi.$inject=["modeling","rules"],Vi.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},Vi.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},Vi.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(I(t,function(o){r=o(r,n,i)}),r):e},Vi.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=ci(e,i);return I(o,function(a,s){var c=n._findRange(a,i,r),u,l=t[t.length-1];l&&n._hasIntersection(l.range,c)?t[t.length-1].elements.push(a):(u={range:c,elements:[a]},t.push(u))}),t},Vi.prototype._setOrientation=function(e){var t=Gk[e];this._axis=t[0],this._dimension=t[1]},Vi.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)},Vi.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+D_,max:t+n-D_}};const Vk={__init__:["distributeElements"],distributeElements:["type",Vi]};function pu(e){Kn.call(this,e)}pu.$inject=["eventBus"],ye(pu,Kn),pu.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=Ue(t,function(n){var i=We(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=Ps(t),t.length<3?!1:t})};var L_={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
327
+ </svg>`};function ei(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()}ei.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],ei.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},ei.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],r,o=[];if(Oe(e)||!n.allowed("shape.replace",{element:e}))return{};var a=Ak(e);return w(t,"bpmn:DataObjectReference")?this._createEntries(e,$k):w(t,"bpmn:DataStoreReference")&&!w(e.parent,"bpmn:Collaboration")?this._createEntries(e,Fk):(w(t,"bpmn:Event")&&!w(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=Vk[r]||[],!un(t.$parent)&&w(t.$parent,"bpmn:SubProcess")&&(i=Ge(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),w(t,"bpmn:StartEvent")&&!w(t.$parent,"bpmn:SubProcess")?(o=Ge(Mk.concat(i),a),this._createEntries(e,o)):w(t,"bpmn:Participant")?(o=Ge(Gk,function(c){return Ue(e)!==c.target.isExpanded}),this._createEntries(e,o)):w(t,"bpmn:StartEvent")&&un(t.$parent)?(o=Ge(Hk.concat(i),function(c){var u=c.target,l=u.isInterrupting!==!1,f=t.isInterrupting===l;return a(c)||!a(c)&&!f}),this._createEntries(e,o)):w(t,"bpmn:StartEvent")&&!un(t.$parent)&&w(t.$parent,"bpmn:SubProcess")?(o=Ge(kk.concat(i),a),this._createEntries(e,o)):w(t,"bpmn:EndEvent")?(o=Ge(Dk.concat(i),function(c){var u=c.target;return u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!w(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,o)):w(t,"bpmn:BoundaryEvent")?(o=Ge(jk,function(c){var u=c.target;if(u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!w(t.attachedToRef,"bpmn:Transaction"))return!1;var l=u.cancelActivity!==!1,f=t.cancelActivity==l;return a(c)||!a(c)&&!f}),this._createEntries(e,o)):w(t,"bpmn:IntermediateCatchEvent")||w(t,"bpmn:IntermediateThrowEvent")?(o=Ge(Ok.concat(i),a),this._createEntries(e,o)):w(t,"bpmn:Gateway")?(o=Ge(Lk,a),this._createEntries(e,o)):w(t,"bpmn:Transaction")?(o=Ge(M_,a),this._createEntries(e,o)):un(t)&&Ue(e)?(o=Ge(Nk,a),this._createEntries(e,o)):w(t,"bpmn:AdHocSubProcess")&&Ue(e)?(o=Ge(Bk,a),this._createEntries(e,o)):w(t,"bpmn:SubProcess")&&Ue(e)?(o=Ge(Ik,a),this._createEntries(e,o)):w(t,"bpmn:SubProcess")&&!Ue(e)?(o=Ge(k_,function(c){var u=c.target.type===e.type,l=c.target.isExpanded===!0;return u===l}),this._createEntries(e,o)):w(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,zk):w(t,"bpmn:FlowNode")?(o=Ge(k_,a),this._createEntries(e,o)):{})},ei.prototype.getPopupMenuHeaderEntries=function(e){var t={};return w(e,"bpmn:Activity")&&!un(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),w(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),w(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),Pg(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},ei.prototype._createEntries=function(e,t){var n={},i=this;return I(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},ei.prototype._createSequenceFlowEntries=function(e,t){var n=ie(e),i={},r=this._modeling,o=this._moddle,a=this;return I(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(w(n.sourceRef,"bpmn:ExclusiveGateway")||w(n.sourceRef,"bpmn:InclusiveGateway")||w(n.sourceRef,"bpmn:ComplexGateway")||w(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&&w(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:w(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e,{conditionExpression:void 0})})}),(w(n.sourceRef,"bpmn:ExclusiveGateway")||w(n.sourceRef,"bpmn:InclusiveGateway")||w(n.sourceRef,"bpmn:ComplexGateway")||w(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},ei.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}},ei.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(u,l){if(l.active){t._modeling.updateProperties(e,{loopCharacteristics:void 0});return}var f=e.businessObject.get("loopCharacteristics");f&&w(f,l.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,f,{isSequential:l.options.isSequential}):(f=t._moddle.create(l.options.loopCharacteristics,{isSequential:l.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"}}}},ei.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}}},ei.prototype._getParticipantMultiplicityHeaderEntries=function(e){var t=this,n=this._bpmnFactory,i=this._translate;function r(a,s){var c=s.active,u;c||(u=n.create("bpmn:ParticipantMultiplicity")),t._modeling.updateProperties(e,{participantMultiplicity:u})}var o=e.businessObject.participantMultiplicity;return{"toggle-participant-multiplicity":{className:"bpmn-icon-parallel-mi-marker",title:i("Participant multiplicity"),active:!!o,action:r}}},ei.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=ie(e),i=this,r=Ag(e),o=w(e,"bpmn:BoundaryEvent")?O_["intermediate-event-non-interrupting"]:O_["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 Wk={__depends__:[Mf,Yy,Nc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",ei]};function Ua(e,t,n,i,r,o,a,s,c,u,l,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=u,this._rules=l,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 g=d.context,h=g.shape;if(!(!ya(d)||!i.isOpen(h))){var m=i.getEntries(h);m.replace&&m.replace.action.click(d,h)}}),n.on("contextPad.close",function(){p.cleanUp()})}Ua.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Ua.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&V(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},Ua.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return Oe(t)?Pr(e,n=>t.includes(n)):t},Ua.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,r=this._connect,o=this._create,a=this._popupMenu,s=this._autoPlace,c=this._translate,u=this._appendPreview,l={};if(e.type==="label")return this._isDeleteAllowed([e])&&V(l,g()),l;var f=e.businessObject;function p(x,S){r.start(x,S)}function d(x,S){n.removeElements([S])}function g(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function h(x){var S=5,P=t.getPad(x).html,C=P.getBoundingClientRect(),L={x:C.left,y:C.bottom+S};return L}function m(x,S,P,C){function L(k,D){var z=i.createShape(V({type:x},C));o.start(k,z,{source:D})}var T=s?function(k,D){var z=i.createShape(V({type:x},C));s.append(D,z)}:L,j=s?function(k,D){return u.create(D,x,C),()=>{u.cleanUp()}}:null;return{group:"model",className:S,title:P,action:{dragstart:L,click:T,hover:j}}}function _(x){return function(S,P){n.splitLane(P,x),t.open(P,!0)}}if(ze(f,["bpmn:Lane","bpmn:Participant"])&&Ue(e)){var y=ar(e);V(l,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(x,S){n.addLane(S,"top")}}}}),y.length<2&&((Yt(e)?e.height>=120:e.width>=120)&&V(l,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:_(2)}}}),(Yt(e)?e.height>=180:e.width>=180)&&V(l,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:_(3)}}})),V(l,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(x,S){n.addLane(S,"bottom")}}}})}return w(f,"bpmn:FlowNode")&&(w(f,"bpmn:EventBasedGateway")?V(l,{"append.receive-task":m("bpmn:ReceiveTask","bpmn-icon-receive-task",c("Append receive task")),"append.message-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):D_(f,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?V(l,{"append.compensation-activity":m("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!w(f,"bpmn:EndEvent")&&!f.isForCompensation&&!D_(f,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!un(f)&&V(l,{"append.end-event":m("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append end event")),"append.gateway":m("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append gateway")),"append.append-task":m("bpmn:Task","bpmn-icon-task",c("Append task")),"append.intermediate-event":m("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append intermediate/boundary event"))})),a.isEmpty(e,"bpmn-replace")||V(l,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(x,S){var P=V(h(S),{cursor:{x:x.x,y:x.y}});a.open(S,"bpmn-replace",P,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),w(f,"bpmn:SequenceFlow")&&V(l,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),w(f,"bpmn:MessageFlow")&&V(l,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),ze(f,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&V(l,{"append.text-annotation":m("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}}}),w(f,"bpmn:TextAnnotation")&&V(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:p,dragstart:p}}}),ze(f,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&V(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:p,dragstart:p}}}),w(f,"bpmn:Group")&&V(l,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&V(l,g()),l};function D_(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return I(o,function(a){a.$type===n&&(r=!0)}),i&&r}const Uk={__depends__:[Sk,T_,cb,Xn,$f,mc,Wk],__init__:["contextPadProvider"],contextPadProvider:["type",Ua]};var qk={horizontal:["x","width"],vertical:["y","height"]},L_=5;function Ui(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return Oe(i)?i:i?n:[]})}Ui.$inject=["modeling","rules"],Ui.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},Ui.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},Ui.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(I(t,function(o){r=o(r,n,i)}),r):e},Ui.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=ui(e,i);return I(o,function(a,s){var c=n._findRange(a,i,r),u,l=t[t.length-1];l&&n._hasIntersection(l.range,c)?t[t.length-1].elements.push(a):(u={range:c,elements:[a]},t.push(u))}),t},Ui.prototype._setOrientation=function(e){var t=qk[e];this._axis=t[0],this._dimension=t[1]},Ui.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)},Ui.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+L_,max:t+n-L_}};const Yk={__init__:["distributeElements"],distributeElements:["type",Ui]};function pu(e){Kn.call(this,e)}pu.$inject=["eventBus"],ye(pu,Kn),pu.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=Ge(t,function(n){var i=ze(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=Ps(t),t.length<3?!1:t})};var I_={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>`},Wk=900;function Wa(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",Wk,this)}Wa.$inject=["popupMenu","distributeElements","translate","rules"],Wa.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&V(t,this._getEntries(e)),t},Wa.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Wa.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:L_.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:L_.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const Uk={__depends__:[Tf,Vk],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",pu],distributeElementsMenuProvider:["type",Wa]};var I_="is not a registered action",qk="is already registered";function ti(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}ti.$inject=["eventBus","injector"],ti.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),i=e.get("selection",!1),r=e.get("zoomScroll",!1),o=e.get("copyPaste",!1),a=e.get("canvas",!1),s=e.get("rules",!1),c=e.get("keyboardMove",!1),u=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),o&&i&&this.register("copy",function(){var l=i.get();if(l.length)return o.copy(l)}),o&&i&&this.register("duplicate",function(){var l=i.get();if(l.length)return o.duplicate(l)}),o&&this.register("paste",function(){o.paste()}),o&&i&&s&&this.register("cut",function(){var l=i.get();if(l.length){var f=s.allowed("elements.delete",{elements:l});if(f!==!1){var p=ke(f)?f:l;return o.cut(p.slice())}}}),r&&this.register("stepZoom",function(l){r.stepZoom(l.value)}),a&&this.register("zoom",function(l){a.zoom(l.value)}),n&&i&&s&&this.register("removeSelection",function(){var l=i.get();if(l.length){var f=s.allowed("elements.delete",{elements:l}),p;f!==!1&&(ke(f)?p=f:p=l,p.length&&n.removeElements(p.slice()))}}),c&&this.register("moveCanvas",function(l){c.moveCanvas(l)}),u&&this.register("moveSelection",function(l){u.moveSelection(l.direction,l.accelerated)})},ti.prototype.trigger=function(e,t){if(!this._actions[e])throw Ff(e,I_);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},ti.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);I(e,function(i,r){n._registerAction(r,i)})},ti.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Ff(e,qk);this._actions[e]=t},ti.prototype.unregister=function(e){if(!this.isRegistered(e))throw Ff(e,I_);this._actions[e]=void 0},ti.prototype.getActions=function(){return Object.keys(this._actions)},ti.prototype.isRegistered=function(e){return!!this._actions[e]};function Ff(e,t){return new Error(e+" "+t)}const Yk={__init__:["editorActions"],editorActions:["type",ti]};function fu(e){e.invoke(ti,this)}ye(fu,ti),fu.$inject=["injector"],fu.prototype._registerDefaultActions=function(e){ti.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),i=e.get("selection",!1),r=e.get("spaceTool",!1),o=e.get("lassoTool",!1),a=e.get("handTool",!1),s=e.get("globalConnect",!1),c=e.get("distributeElements",!1),u=e.get("alignElements",!1),l=e.get("directEditing",!1),f=e.get("searchPad",!1),p=e.get("modeling",!1),d=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",function(){var g=t.getRootElement(),h=n.filter(function(m){return m!==g});return i.select(h),h}),r&&this._registerAction("spaceTool",function(){r.toggle()}),o&&this._registerAction("lassoTool",function(){o.toggle()}),a&&this._registerAction("handTool",function(){a.toggle()}),s&&this._registerAction("globalConnectTool",function(){s.toggle()}),i&&c&&this._registerAction("distributeElements",function(g){var h=i.get(),m=g.type;h.length&&c.trigger(h,m)}),i&&u&&this._registerAction("alignElements",function(g){var h=i.get(),m=[],_=g.type;h.length&&(m=Ue(h,function(y){return!w(y,"bpmn:Lane")}),u.trigger(m,_))}),i&&p&&this._registerAction("setColor",function(g){var h=i.get();h.length&&p.setColor(h,g)}),i&&l&&this._registerAction("directEditing",function(){var g=i.get();g.length&&l.activate(g[0])}),f&&this._registerAction("find",function(){f.toggle()}),t&&p&&this._registerAction("moveToOrigin",function(){var g=t.getRootElement(),h,m;w(g,"bpmn:Collaboration")?m=n.filter(function(_){return w(_.parent,"bpmn:Collaboration")}):m=n.filter(function(_){return _!==g&&!w(_.parent,"bpmn:SubProcess")}),h=kt(m),p.moveElements(m,{x:-h.x,y:-h.y},g)}),i&&d&&this._registerAction("replaceElement",function(g){d.triggerEntry("replace","click",g)})};const Kk={__depends__:[Yk],editorActions:["type",fu]};function B_(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;We(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}B_.$inject=["eventBus"];function Wr(e,t){ne.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;En(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}Wr.$inject=["eventBus","gridSnapping","modeling"],ye(Wr,ne),Wr.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},Wr.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},Wr.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),V(e,o),e},Wr.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),V(e,o),e};var Xk=2e3;function N_(e,t){e.on(["spaceTool.move","spaceTool.end"],Xk,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)}})}N_.$inject=["eventBus","gridSnapping"];const Zk={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Wr],gridSnappingSpaceToolBehavior:["type",N_]};var du=10;function jf(e,t,n){return n||(n="round"),Math[n](e/t)*t}var Qk=1200,Jk=800;function vr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",Jk,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"],Qk,function(o){var a=o.originalEvent;if(!(!r.active||a&&Mn(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(u){var l={},f=tO(o,u,e);f&&(l.offset=f);var p=eO(o,u);p&&V(l,p),$o(o,u)||r.snapEvent(o,u,l)})}})}vr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);It(e,t,i)},vr.prototype.getGridSpacing=function(){return du},vr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=jf(e,du);var i,r;return t&&t.min&&(i=t.min,Ie(i)&&(i=jf(i+n,du,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,Ie(r)&&(r=jf(r+n,du,"floor"),e=Math.min(e,r))),e-=n,e},vr.prototype.isActive=function(){return this.active},vr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},vr.prototype.toggleActive=function(){this.setActive(!this.active)},vr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function eO(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&&(hu(t)?(a.x.min=i.left,a.x.max=i.right):(a.y.min=i.top,a.y.max=i.bottom));var c=r.min,u=r.max;return c&&(hu(t)?F_(s)?a.x.max=c.left:a.x.min=c.right:$_(s)?a.y.max=c.top:a.y.min=c.bottom),u&&(hu(t)?F_(s)?a.x.min=u.left:a.x.max=u.right:$_(s)?a.y.min=u.top:a.y.max=u.bottom),a[t]}function tO(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&Ie(s[t])||(s||(s=o.snapOffset={}),Ie(s[t])||(s[t]=0),!r)||(n.get(r.id)||(hu(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 hu(e){return e==="x"}function $_(e){return e.indexOf("n")!==-1}function F_(e){return e.indexOf("w")!==-1}const nO={__depends__:[Zk],__init__:["gridSnapping"],gridSnapping:["type",vr]};var iO=2e3;function j_(e,t,n){e.on("autoPlace",iO,function(i){var r=i.source,o=Oe(r),a=i.shape,s=Fv(r,a,n);return["x","y"].forEach(function(c){var u={};s[c]!==o[c]&&(s[c]>o[c]?u.min=s[c]:u.max=s[c],w(a,"bpmn:TextAnnotation")&&(rO(c)?u.offset=-a.width/2:u.offset=-a.height/2),s[c]=t.snapValue(s[c],u))}),s})}j_.$inject=["eventBus","gridSnapping","elementRegistry"];function rO(e){return e==="x"}var oO=1750;function H_(e,t,n){t.on(["create.start","shape.move.start"],oO,function(i){var r=i.context,o=r.shape,a=e.getRootElement();if(!(!w(o,"bpmn:Participant")||!w(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}))}})}H_.$inject=["canvas","eventBus","gridSnapping"];var aO=3e3;function mu(e,t,n){ne.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],aO,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||sO(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}mu.$inject=["eventBus","gridSnapping","modeling"],ye(mu,ne),mu.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=lO(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function sO(e){return e.length>3}function cO(e){return e==="h"}function uO(e){return e==="v"}function lO(e,t,n){var i=Mi(t,n),r={};return cO(i)&&(r.y=e.snapValue(t.y)),uO(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=V({},t,r),n=V({},n,r)),[t,n]}const pO={__depends__:[nO,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",j_],gridSnappingParticipantBehavior:["type",H_],gridSnappingLayoutConnectionBehavior:["type",mu]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",B_]};var fO=30,z_=30;function Ua(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var r=i.element,o=i.gfx;if(w(r,"bpmn:Lane"))return n._createParticipantHit(r,o);if(w(r,"bpmn:Participant"))return Ye(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(w(r,"bpmn:SubProcess"))return Ye(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}Ua.$inject=["eventBus","interactionEvents"],Ua.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Ua.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=Xt(e)?{width:fO,height:e.height}:{width:e.width,height:z_};return this._interactionEvents.createBoxHit(t,"all",n),!0},Ua.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:z_}),!0};const dO={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Ua]};function gu(e){e.invoke(ko,this)}ye(gu,ko),gu.$inject=["injector"],gu.prototype.registerBindings=function(e,t){ko.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 hO={__depends__:[hf],__init__:["keyboardBindings"],keyboardBindings:["type",gu]};var mO={moveSpeed:1,moveSpeedAccelerated:10},gO=1500,G_="left",V_="up",W_="right",U_="down",yO={ArrowLeft:G_,Left:G_,ArrowUp:V_,Up:V_,ArrowRight:W_,Right:W_,ArrowDown:U_,Down:U_},vO={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 q_(e,t,n,i,r){var o=this;this._config=V({},mO,e||{}),t.addListener(gO,function(a){var s=a.keyEvent,c=yO[s.key];if(c&&!t.isCmd(s)){var u=t.isShift(s);return o.moveSelection(c,u),!0}}),this.moveSelection=function(a,s){var c=r.get();if(c.length){var u=this._config[s?"moveSpeedAccelerated":"moveSpeed"],l=vO[a](u),f=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});f&&n.moveElements(c,l)}}}q_.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const bO={__depends__:[hf,Xn],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",q_]};var Y_=10;function qa(e,t,n,i){this._dragging=i,this._rules=t;var r=this;function o(c,u){var l=c.shape,f=c.direction,p=c.resizeConstraints,d;c.delta=u,d=mC(l,f,u),c.newBounds=yC(d,p),c.canExecute=r.canResize(c)}function a(c){var u=c.resizeConstraints,l=c.minBounds;u===void 0&&(l===void 0&&(l=r.computeMinResizeBox(c)),c.resizeConstraints={min:Te(l)})}function s(c){var u=c.shape,l=c.canExecute,f=c.newBounds;if(l){if(f=pm(f),!_O(u,f))return;n.resizeShape(u,f)}}e.on("resize.start",function(c){a(c.context)}),e.on("resize.move",function(c){var u={x:c.dx,y:c.dy};o(c.context,u)}),e.on("resize.end",function(c){s(c.context)})}qa.prototype.canResize=function(e){var t=this._rules,n=ii(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},qa.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=V({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:xO(o),data:{shape:t,context:r}})},qa.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:Y_,height:Y_},r=Qm(t,e.childrenBoxPadding),vC(n,t,i,r)},qa.$inject=["eventBus","rules","modeling","dragging"];function _O(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=Oe(e),i=Te(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 xO(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 X_="djs-resizing",Z_="resize-not-ok",wO=500;function Q_(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,X_)),s.width>5&&ve(c,{x:s.x,width:s.width}),s.height>5&&ve(c,{y:s.y,height:s.height}),o.canExecute?Xe(c).remove(Z_):Xe(c).add(Z_)}function r(o){var a=o.shape,s=o.frame;s&&Ht(o.frame),t.removeMarker(a,X_)}e.on("resize.move",wO,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}Q_.$inject=["eventBus","canvas","previewSupport"];var yu=-6,vu=8,bu=20,Ya="djs-resizer",EO=["n","w","s","e","nw","ne","se","sw"];function br(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&&I(a,bn(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}br.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){sr(o)&&i.activate(o,e,n)}$e.bind(t,"mousedown",r),$e.bind(t,"touchstart",r)},br.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=SO(i),a=Pe("g");Xe(a).add(Ya),Xe(a).add(Ya+"-"+e.id),Xe(a).add(Ya+"-"+i),Fe(r,a);var s=Pe("rect");ve(s,{x:-vu/2+o.x,y:-vu/2+o.y,width:vu,height:vu}),Xe(s).add(Ya+"-visual"),Fe(a,s);var c=Pe("rect");return ve(c,{x:-bu/2+o.x,y:-bu/2+o.y,width:bu,height:bu}),Xe(c).add(Ya+"-hit"),Fe(a,c),Ds(a,t,n),a},br.prototype.createResizer=function(e,t){var n=K_(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},br.prototype.addResizer=function(e){var t=this;at(e)||I(EO,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},br.prototype.removeResizers=function(){var e=this._getResizersParent();Ss(e)},br.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},br.$inject=["eventBus","canvas","selection","resize"];function SO(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-yu:e.indexOf("w")!==-1&&(t.x=yu),e.indexOf("s")!==-1?t.y=-yu:e.indexOf("n")!==-1&&(t.y=yu),t}const J_={__depends__:[bi,Bi,Ao],__init__:["resize","resizePreview","resizeHandles"],resize:["type",qa],resizePreview:["type",Q_],resizeHandles:["type",br]};var RO=2e3;function Ka(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"],RO,function(c){i.isActive(c.element)&&i.cancel()}),e.on(["commandStack.changed"],function(c){i.isActive()&&i.cancel()}),e.on("directEditing.activate",function(c){o.removeResizers()}),e.on("create.end",500,function(c){var u=c.context,l=u.shape,f=c.context.canExecute,p=c.isTouch;p||f&&(u.hints&&u.hints.createElementsBehavior===!1||s(l))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,u){(u||We(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}Ka.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Ka.prototype.activate=function(e){var t=Hn(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);V(n,i);var r={},o=n.style||{};return V(o,{backgroundColor:null,border:null}),(We(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||ex(e))&&V(r,{centerVertically:!0}),ir(e)&&(V(r,{resizable:!0,autoResize:!0}),V(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),w(e,"bpmn:TextAnnotation")&&(V(r,{resizable:!0,autoResize:!0}),V(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),V(n,{options:r,style:o}),n}},Ka.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),r={x:i.x+i.width/2,y:i.y+i.height/2},o={x:i.x,y:i.y},a=t.zoom(),s=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),u=c.fontSize*a,l=c.lineHeight,f=s.fontSize*a,p=s.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(w(e,"bpmn:Lane")||AO(e)){var g=Xt(e),h=g?{width:i.height,height:30*a,x:i.x-i.height/2+15*a,y:r.y-30*a/2}:{width:i.width,height:30*a};V(o,h),V(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:g?"rotate(-90deg)":null})}if(PO(e)){var m=Xt(e),_=m?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:r.x-i.height/2,y:r.y-i.width/2};V(o,_),V(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:m?null:"rotate(-90deg)"})}(We(e,["bpmn:Task","bpmn:CallActivity"])||ex(e))&&(V(o,{width:i.width,height:i.height}),V(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),CO(e)&&(V(o,{width:i.width,x:i.x}),V(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var y=1,x=i.width+2*y;if(n.labelTarget&&(V(o,{width:x,height:i.height+2*y,x:i.x-y,y:i.y-y}),V(d,{fontSize:u+"px",lineHeight:l})),ir(n)&&!Bs(n)&&!Ge(n)){var S=Pl(e),P=t.getAbsoluteBBox({x:S.x,y:S.y,width:0,height:0}),C=u,L=Dr.width*a+2*y;V(o,{width:L,height:C+2*y,x:P.x-L/2,y:P.y-C/2-y}),V(d,{fontSize:u+"px",lineHeight:l})}return w(e,"bpmn:TextAnnotation")&&(V(o,{width:i.width+2*y,height:i.height+2*y,x:i.x-y,y:i.y-y,minWidth:30*a,minHeight:10*a}),V(d,{textAlign:"left",paddingTop:mo*a+"px",paddingBottom:mo*a+"px",paddingLeft:mo*a+"px",paddingRight:mo*a+"px",fontSize:f+"px",lineHeight:p})),{bounds:o,style:d}},Ka.prototype.update=function(e,t,n,i){var r,o;w(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}),TO(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function ex(e){return w(e,"bpmn:SubProcess")&&!Ye(e)}function CO(e){return w(e,"bpmn:SubProcess")&&Ye(e)}function PO(e){return w(e,"bpmn:Participant")&&!Ye(e)}function AO(e){return w(e,"bpmn:Participant")&&Ye(e)}function TO(e){return!e||!e.trim()}var tx="djs-element-hidden",nx="djs-label-hidden";function ix(e,t,n){var i=this,r=t.getDefaultLayer(),o,a,s;e.on("directEditing.activate",function(c){var u=c.active;if(o=u.element.label||u.element,w(o,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(o),s=Pe("g");var l=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:o.height,position:{mx:0,my:0}}),f=i.path=Pe("path");ve(f,{d:l,strokeWidth:2,stroke:MO(o)}),Fe(s,f),Fe(r,s),nn(s,o.x,o.y)}w(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,tx):(w(o,"bpmn:Task")||w(o,"bpmn:CallActivity")||w(o,"bpmn:SubProcess")||w(o,"bpmn:Participant")||w(o,"bpmn:Lane"))&&t.addMarker(o,nx)}),e.on("directEditing.resize",function(c){if(w(o,"bpmn:TextAnnotation")){var u=c.height,l=c.dy,f=Math.max(o.height/a.height*(u+l),0),p=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:f,position:{mx:0,my:0}});ve(i.path,{d:p})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var u=c.active;u&&(t.removeMarker(u.element.label||u.element,tx),t.removeMarker(o,nx)),o=void 0,a=void 0,s&&(Ht(s),s=void 0)})}ix.$inject=["eventBus","canvas","pathMap"];function MO(e,t){var n=Ze(e);return n.get("stroke")||t||"black"}const kO={__depends__:[Wp,J_,A_],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Ka],labelEditingPreview:["type",ix]};var OO=500,DO=1e3;function wi(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){yS(o)||i.createOutline(o)}e.on("element.hover",function(o){r(o.element)}),e.on("selection.changed",function(o){I(o.newSelection,r)}),e.on(["shape.changed","connection.changed"],OO,function(o){var a=o.element,s=o.gfx,c=ot(".djs-outline",s);c&&i.updateOutline(a,c)})}wi.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=ot(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),Fe(t,n),this.updateOutline(e,n)),n},wi.prototype._createOutlineGfx=function(){var e=Pe("rect");return ve(e,V({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},wi.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},wi.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&I(i,function(r){n=n||r.updateOutline(t,e)}),n||ve(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},wi.prototype.updateConnectionOutline=function(e,t){var n=kt(t);ve(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},wi.prototype.registerProvider=function(e,t){t||(t=e,e=DO),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},wi.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},wi.prototype.getOutline=function(e){var t,n=this._getProviders();return I(n,function(i){Yt(i.getOutline)&&(t=t||i.getOutline(e))}),t},wi.$inject=["eventBus","styles","elementRegistry"];var _u=6;function Hf(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)})}Hf.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Ss(t);var n=e.length>1,i=this._canvas.getContainer();if(Xe(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=LO(kt(e)),o=Pe("rect");ve(o,V({rx:3},r)),Xe(o).add("djs-selection-outline"),Fe(t,o)}},Hf.$inject=["eventBus","canvas","selection"];function LO(e){return{x:e.x-_u,y:e.y-_u,width:e.width+_u*2,height:e.height+_u*2}}const zf={__depends__:[Xn],__init__:["outline","multiSelectionOutline"],outline:["type",wi],multiSelectionOutline:["type",Hf]},rx=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],ox={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},IO=15,xu=2;function ax(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(g=>We(g,rx));if(p.length===1){const g=p[0];Ge(g)?a(g,g.labelTarget):(d=g.labels)!=null&&d.length&&a(g.labels[0],g)}if(p.length===2){const g=p.find(Ge),h=p.find(m=>{var _;return(_=m.labels)==null?void 0:_.includes(g)});g&&h&&a(g,h)}}),e.on("shape.changed",function({element:f}){var p;!We(f,rx)||!l(f)||(Ge(f)?a(f,f.labelTarget):(p=f.labels)!=null&&p.length&&a(f.labels[0],f))});function a(f,p){const d=Qo([Oe(p),Oe(f)],ox),g=d.getAttribute("d"),m=r.isSelected(f)?c(f):u(f),_=na(m,g);if(!_)return;const x=r.isSelected(p)?c(p):u(p),S=na(x,g)||Oe(p);fa(S,_)<IO||(bl(d,[S,_]),Fe(o,d))}function s(){Es(`.${ox.class}`,o).forEach(Ht)}function c(f){const p=i.getOutline(f);if(!p)return u(f);if(p.x){const d={x:f.x+_r(p,"x")-xu,y:f.y+_r(p,"y")-xu,width:_r(p,"width")+xu*2,height:_r(p,"height")+xu*2};return Tl(d,_r(p,"rx"))}if(p.cx){const d=_r(p,"r"),g={x:f.x+_r(p,"cx")-d,y:f.y+_r(p,"cy")-d,width:d*2,height:d*2};return Im(g)}}function u(f){return n.getShapePath(f)}function l(f){return r.isSelected(f)}}ax.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function _r(e,t){return parseFloat(ve(e,t)||0)}const BO={__depends__:[Xn,zf],__init__:["labelLink"],labelLink:["type",ax]};var NO=new Po("tt");function $O(e){var t=ht('<div class="djs-tooltip-container" />');return mn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function FO(e,t,n){mn(e,{left:t+"px",top:n+"px"})}function Gf(e,t){e.style.display=t===!1?"none":""}var sx="djs-tooltip",Vf="."+sx;function xn(e,t){this._eventBus=e,this._canvas=t,this._ids=NO,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=$O(t.getContainer());var n=this;Pn.bind(this._tooltipRoot,Vf,"mousedown",function(i){i.stopPropagation()}),Pn.bind(this._tooltipRoot,Vf,"mouseover",function(i){n.trigger("mouseover",i)}),Pn.bind(this._tooltipRoot,Vf,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}xn.$inject=["eventBus","canvas"],xn.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=V({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},xn.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(un(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},xn.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},xn.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},xn.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)}},xn.prototype.remove=function(e){var t=this.get(e);t&&(di(t.html),di(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},xn.prototype.show=function(){Gf(this._tooltipRoot)},xn.prototype.hide=function(){Gf(this._tooltipRoot,!1)},xn.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},xn.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)),En(n)&&(n=ht(n)),i=ht('<div data-tooltip-id="'+t+'" class="'+sx+'">'),mn(i,{position:"absolute"}),i.appendChild(n),e.type&&_t(i).add("djs-tooltip-"+e.type),e.className&&_t(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},xn.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;FO(n,t.x,t.y)},xn.prototype._updateTooltipVisibilty=function(e){I(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),Gf(i,r))})},xn.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 jO={__init__:["tooltips"],tooltips:["type",xn]};var HO="flow elements must be children of pools/participants",zO="Data object must be placed within a pool/participant.";function cx(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;w(s,"bpmn:Collaboration")&&(w(a,"bpmn:FlowNode")?i(r,n(HO)):w(a,"bpmn:DataObjectReference")&&i(r,n(zO)))})}cx.$inject=["eventBus","tooltips","translate"];const GO={__depends__:[jO],__init__:["modelingFeedback"],modelingFeedback:["type",cx]};var VO=500,WO=1250,UO=1500,wu=Math.round;function qO(e){return{x:e.x+wu(e.width/2),y:e.y+wu(e.height/2)}}function ux(e,t,n,i,r){function o(s,c,u,l){return r.allowed("elements.move",{shapes:s,delta:c,position:u,target:l})}e.on("shape.move.start",UO,function(s){var c=s.context,u=s.shape,l=i.get().slice();l.indexOf(u)===-1&&(l=[u]),l=YO(l),V(c,{shapes:l,validatedShapes:l,shape:u})}),e.on("shape.move.start",WO,function(s){var c=s.context,u=c.validatedShapes,l;if(l=c.canExecute=o(u),!l)return!1}),e.on("shape.move.move",VO,function(s){var c=s.context,u=c.validatedShapes,l=s.hover,f={x:s.dx,y:s.dy},p={x:s.x,y:s.y},d;if(d=o(u,f,p,l),c.delta=f,c.canExecute=d,d===null){c.target=null;return}c.target=l}),e.on("shape.move.end",function(s){var c=s.context,u=c.delta,l=c.canExecute,f=l==="attach",p=c.shapes;if(l===!1)return!1;u.x=wu(u.x),u.y=wu(u.y),!(u.x===0&&u.y===0)&&n.moveElements(p,u,c.target,{primaryShape:c.shape,attach:f})}),e.on("element.mousedown",function(s){if(sr(s)){var c=Eo(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,u,l){if(qt(u)&&(l=u,u=!1),!(c.waypoints||!c.parent)&&!Xe(s.target).has("djs-hit-no-move")){var f=qO(c),p=t.init(s,f,"shape.move",{cursor:"grabbing",autoActivate:u,data:{shape:c,context:l||{}}});if(p!==!1)return!0}}this.start=a}ux.$inject=["eventBus","dragging","modeling","selection","rules"];function YO(e){var t=Jr(e,"id");return Ue(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var lx=499,Wf="djs-dragging",px="drop-ok",fx="drop-not-ok",dx="new-parent",hx="attach-ok";function mx(e,t,n,i){function r(c){var u=o(c),l=KO(u);return l}function o(c){var u=Jo(c),l=u.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),f=u.concat(l),p=[...new Set(f)];return p}function a(c,u){[hx,px,fx,dx].forEach(function(l){l===u?t.addMarker(c,l):t.removeMarker(c,l)})}function s(c,u,l){i.addDragger(u,c.dragGroup),l&&t.addMarker(u,Wf),c.allDraggedElements?c.allDraggedElements.push(u):c.allDraggedElements=[u]}e.on("shape.move.start",lx,function(c){var u=c.context,l=u.shapes,f=u.allDraggedElements,p=r(l);if(!u.dragGroup){var d=Pe("g");ve(d,n.cls("djs-drag-group",["no-events"]));var g=t.getActiveLayer();Fe(g,d),u.dragGroup=d}p.forEach(function(h){i.addDragger(h,u.dragGroup)}),f?f=Ou([f,o(l)]):f=o(l),I(f,function(h){t.addMarker(h,Wf)}),u.allDraggedElements=f,u.differentParents=XO(l)}),e.on("shape.move.move",lx,function(c){var u=c.context,l=u.dragGroup,f=u.target,p=u.shape.parent,d=u.canExecute;f&&(d==="attach"?a(f,hx):u.canExecute&&p&&f.id!==p.id?a(f,dx):a(f,u.canExecute?px:fx)),nn(l,c.dx,c.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(c){var u=c.context,l=u.target;l&&a(l,null)}),e.on("shape.move.cleanup",function(c){var u=c.context,l=u.allDraggedElements,f=u.dragGroup;I(l,function(p){t.removeMarker(p,Wf)}),f&&Ht(f)}),this.makeDraggable=s}mx.$inject=["eventBus","canvas","styles","previewSupport"];function KO(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=Ue(e,function(i){return at(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function XO(e){return V0(Jr(e,function(t){return t.parent&&t.parent.id}))!==1}const ZO={__depends__:[dc,Xn,zf,bi,Bi,Ao],__init__:["move","movePreview"],move:["type",ux],movePreview:["type",mx]};var gx=".djs-palette-toggle",yx=".entry",QO=gx+", "+yx,Uf="djs-palette-",JO="shown",qf="open",vx="two-column",eD=1e3;function Bt(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()})}Bt.$inject=["eventBus","canvas"],Bt.prototype.registerProvider=function(e,t){t||(t=e,e=eD),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},Bt.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(nD,{})},Bt.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},Bt.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=ht(Bt.HTML_MARKUP);n.appendChild(i),_t(n).add(Uf+JO),Pn.bind(i,QO,"click",function(r){var o=r.delegateTarget;if(ll(o,gx))return e.toggle();e.trigger("click",r)}),$e.bind(i,"mousedown",function(r){r.stopPropagation()}),Pn.bind(i,yx,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},Bt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},Bt.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,r,o=_t(n),a=_t(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(vx,r),a.toggle(Uf+vx,r),"open"in e&&(o.toggle(qf,e.open),a.toggle(Uf+qf,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},Bt.prototype._update=function(){var e=ot(".djs-palette-entries",this._container),t=this._entries=this.getEntries();xs(e),I(t,function(n,i){var r=n.group||"default",o=ot("[data-group="+La(r)+"]",e);o||(o=ht('<div class="group"></div>'),un(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=ht(a);if(o.appendChild(s),!n.separator&&(un(s,"data-action",i),n.title&&un(s,"title",n.title),n.className&&tD(s,n.className),n.imageUrl)){var c=ht("<img>");un(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},Bt.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=un(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},Bt.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(Yt(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},Bt.prototype._layoutChanged=function(){this._toggleState({})},Bt.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},Bt.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},Bt.prototype.open=function(){this._toggleState({open:!0})},Bt.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Bt.prototype.isActiveTool=function(e){return e&&this._activeTool===e},Bt.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=ot(".djs-palette-entries",this._container),this._toolsContainer=ot("[data-group=tools]",t)),n=this._toolsContainer,I(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=_t(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},Bt.prototype.isOpen=function(){return _t(this._container).has(qf)},Bt.prototype._getParentContainer=function(){return this._canvas.getContainer()},Bt.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function tD(e,t){var n=_t(e),i=ke(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function nD(e,t){var n=t.getPaletteEntries();return Yt(n)?n(e):(I(n,function(i,r){e[r]=i}),e)}const iD={__init__:["palette"],palette:["type",Bt]};var bx="crosshair",_x="selected",rD="djs-dragging-active-lasso";function xr(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=Pe("rect");ve(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),Fe(p,d),u(!0),this.update(f)},update:function(f){var p=f.frame,d=f.bbox;p&&d&&ve(p,{x:d.x,y:d.y,width:d.width,height:d.height});var g=f.marked,h=f.lastMarked;if(g&&h){for(const m of h)g.has(m)||t.removeMarker(m,_x);for(const m of g)h.has(m)||t.addMarker(m,_x)}},remove:function(f){this.update(f),f.frame&&Ht(f.frame),u(!1)}};function u(f){Xe(t.getContainer()).toggle(rD,f)}function l(f){var p=i.getAll();return new Set(Qr(uo(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=xx(f),p.add=ac(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=xx(f),g=l(d),h=p.initialMarked.union(g);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(ac(f))return s.activateLasso(f.originalEvent),!0})}xr.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],xr.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:bx,data:{context:{}},keepSelection:!0})},xr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:bx,data:{context:{}},keepSelection:!0})},xr.prototype._select=function(e){this._selection.select(e)},xr.prototype.select=function(e,t,n=[]){var i=Qr(uo(e,t));this._select([...n,...i])},xr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},xr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function xx(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 oD={__depends__:[yc,va],__init__:["lassoTool"],lassoTool:["type",xr]};var Yf=1500,wx="grab";function Fo(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",Yf,function(c){if(ma(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(Yf,function(c){if(!(!Ex(c.keyEvent)||a.isActive())){var u=a._mouse.getLastMoveEvent();a.activateMove(u,!!u)}},"keyboard.keydown"),s&&s.addListener(Yf,function(c){!Ex(c.keyEvent)||!a.isActive()||a.toggle()},"keyboard.keyup"),e.on("hand.end",function(c){var u=c.originalEvent.target;if(!c.hover&&!(u instanceof SVGElement))return!1;e.once("hand.ended",function(){a.activateMove(c.originalEvent,{reactivate:!0})})}),e.on("hand.move.move",function(c){var u=t.viewbox().scale;t.scroll({dx:c.dx*u,dy:c.dy*u})}),e.on("hand.move.end",function(c){var u=c.context,l=u.reactivate;return!ma(c)&&l&&e.once("hand.move.ended",function(f){a.activateHand(f.originalEvent,!0,!0)}),!1})}Fo.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Fo.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:wx,data:{context:n||{}}})},Fo.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:wx,data:{context:{reactivate:n}}})},Fo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Fo.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function Ex(e){return zt("Space",e)}const aD={__depends__:[yc,va],__init__:["handTool"],handTool:["type",Fo]};var Sx="connect-ok",Rx="connect-not-ok";function jo(e,t,n,i,r,o,a){var s=this;this._dragging=t,this._rules=o,this._mouse=a,r.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",function(c){var u=c.context,l=c.hover,f=u.canStartConnect=s.canStartConnect(l);f!==null&&(u.startTarget=l,i.addMarker(l,f?Sx:Rx))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var u=c.context.startTarget,l=c.context.canStartConnect;u&&i.removeMarker(u,l?Sx:Rx)}),e.on(["global-connect.ended"],function(c){var u=c.context,l=u.startTarget,f={x:c.x,y:c.y},p=s.canStartConnect(l);if(p)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,l,f)}),!1})}jo.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],jo.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},jo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},jo.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},jo.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const sD={__depends__:[Nf,bi,Bi,yc,va],globalConnect:["type",jo]};function Kf(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)}Kf.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],Kf.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,g,h){function m(_){var y=n.createShape(V({type:f},h));t.start(_,y)}return{group:p,className:d,title:g,action:{dragstart:m,click:m}}}function u(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 l(f){t.start(f,n.createParticipantShape())}return V(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:u,click:u}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:s("Create pool/participant"),action:{dragstart:l,click:l}},"create.group":c("bpmn:Group","artifact","bpmn-icon-group",s("Create group"))}),e};const cD={__depends__:[iD,mc,Jy,oD,aD,sD,ca],__init__:["paletteProvider"],paletteProvider:["type",Kf]};var uD=250;function Xf(e,t,n,i,r){ne.call(this,e);function o(s){var c=s.canExecute.replacements;I(c,function(u){var l=u.oldElementId,f={type:u.newElementType};if(!s.visualReplacements[l]){var p=t.get(l);V(f,{x:p.x,y:p.y});var d=n.createShape(f);i.addShape(d,p.parent);var g=ot('[data-element-id="'+La(p.id)+'"]',s.dragGroup);g&&ve(g,{display:"none"});var h=r.addDragger(d,s.dragGroup);s.visualReplacements[l]=h,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;I(c,function(u,l){var f=ot('[data-element-id="'+La(l)+'"]',s.dragGroup);f&&ve(f,{display:"inline"}),u.remove(),c[l]&&delete c[l]})}e.on("shape.move.move",uD,function(s){var c=s.context,u=c.canExecute;c.visualReplacements||(c.visualReplacements={}),u&&u.replacements?o(c):a(c)})}Xf.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],ye(Xf,ne);const lD={__depends__:[Ao],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Xf]};var pD=1250,Zf=40,fD=20,dD=10,Cx=20,Px=["x","y"],hD=Math.abs;function Ax(e){e.on(["connect.hover","connect.move","connect.end"],pD,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&Mn(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&mD(t,o,bD(o)),o&&vD(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Jn(r),We(o,["bpmn:Event","bpmn:Gateway"])&&Tx(t,Jn(o)),We(o,["bpmn:Task","bpmn:SubProcess"])&&gD(t,o),w(a,"bpmn:BoundaryEvent")&&s===a.host&&yD(t)):Mx(i,"bpmn:MessageFlow")?(w(r,"bpmn:Event")&&(n.connectionStart=Jn(r)),w(o,"bpmn:Event")&&Tx(t,Jn(o))):n.connectionStart=n.initialConnectionStart)})}Ax.$inject=["eventBus"];function mD(e,t,n){Px.forEach(function(i){var r=kx(i,t);e[i]<t[i]+n?It(e,i,t[i]+n):e[i]>t[i]+r-n&&It(e,i,t[i]+r-n)})}function gD(e,t){var n=Jn(t);Px.forEach(function(i){_D(e,t,i)&&It(e,i,n[i])})}function yD(e){var t=e.context,n=t.source,i=t.target;if(!xD(t)){var r=Jn(n),o=tn(r,i,-10),a=[];/top|bottom/.test(o)&&a.push("x"),/left|right/.test(o)&&a.push("y"),a.forEach(function(s){var c=e[s],u;hD(c-r[s])<Zf&&(c>r[s]?u=r[s]+Zf:u=r[s]-Zf,It(e,s,u))})}}function Tx(e,t){It(e,"x",t.x),It(e,"y",t.y)}function Mx(e,t){return e&&e.type===t}function vD(e,t){return Wi(t,function(n){return Mx(e,n)})}function kx(e,t){return e==="x"?t.width:t.height}function bD(e){return w(e,"bpmn:Task")?dD:fD}function _D(e,t,n){return e[n]>t[n]+Cx&&e[n]<t[n]+kx(n,t)-Cx}function xD(e){var t=e.hover,n=e.source;return t&&n&&t===n}function wr(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}wr.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},wr.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},wr.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},wr.prototype.getSnapLocations=function(){return this._snapLocations},wr.prototype.setSnapLocations=function(e){this._snapLocations=e},wr.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new Eu,n.initDefaults(this._defaultSnaps)),n};function Eu(){this._snapValues={}}Eu.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)},Eu.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&uk(e[n],r[n],i)},Eu.prototype.initDefaults=function(e){var t=this;I(e||{},function(n,i){I(n,function(r){t.add(i,r)})})};var wD=1250;function Ei(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"],wD,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&Mn(r.originalEvent))&&!($o(r)||!c)){var u=s.pointsForTarget(c);u.initialized||(u=i.addSnapTargetPoints(u,a,c),u.initialized=!0),n.snap(r,u)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){n.hide()})}Ei.$inject=["elementRegistry","eventBus","snapping"],Ei.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new wr);var o;t.get(i.id)?o=Jn(i,e):o={x:e.x+Jn(i).x,y:e.y+Jn(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}),Ge(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},Ei.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return I(i,function(r){if(Ge(r)){Ge(t)&&e.add("mid",Jn(r));return}if(at(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);I(o,function(a){e.add("mid",a)});return}e.add("mid",Jn(r))}),!Ie(t.x)||!Ie(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Jn(t)),e},Ei.prototype.getSnapTargets=function(e,t){return y_(t).filter(function(n){return!ED(n)})};function ED(e){return!!e.hidden}var Ox=1500;function Ho(e,t){t.invoke(Ei,this),e.on(["create.move","create.end"],Ox,PD),e.on(["create.move","create.end","shape.move.move","shape.move.end"],Ox,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!$o(n)&&SD(n,o)})}ye(Ho,Ei),Ho.$inject=["eventBus","injector"],Ho.prototype.initSnap=function(e){var t=Ei.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return I(n.outgoing,function(r){var o=r.waypoints[0];o=o.original||o,t.setSnapOrigin(r.id+"-docking",Lx(o,i,e))}),I(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",Lx(o,i,e))}),w(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Ho.prototype.addSnapTargetPoints=function(e,t,n){Ei.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);I(i,function(o){(CD(o)||RD([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",m_(o)),e.add("bottom-right",g_(o)))});var r=this._elementRegistry;return I(t.incoming,function(o){if(r.get(t.id)){Dx(i,o.source)||e.add("mid",Oe(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),I(t.outgoing,function(o){if(r.get(t.id)){Dx(i,o.target)||e.add("mid",Oe(o.target));var a=o.waypoints[o.waypoints.length-1];e.add(o.id+"-docking",a.original||a)}}),w(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},Ho.prototype.getSnapTargets=function(e,t){return Ei.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!w(n,"bpmn:Lane")})};function SD(e,t){var n=Te(t),i=Kg(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=Oe(o),/top/.test(i)?It(e,"y",n.top-a.y):/bottom/.test(i)&&It(e,"y",n.bottom-a.y),/left/.test(i)?It(e,"x",n.left-a.x):/right/.test(i)&&It(e,"x",n.right-a.x)}function RD(e,t){return e.every(function(n){return w(n,t)})}function CD(e){return w(e,"bpmn:SubProcess")&&Ye(e)?!0:w(e,"bpmn:Participant")}function PD(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)&&It(e,"x",e.x),(i&&i>=e.y||o&&o<=e.y)&&It(e,"y",e.y)}}function Dx(e,t){return e.indexOf(t)!==-1}function Lx(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var AD=1250;function Xa(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],AD,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&Mn(i.originalEvent))&&!$o(i)){var u=c.pointsForTarget(a);u.initialized||(u=n.addSnapTargetPoints(u,o,a,s),u.initialized=!0),kD(s)&&It(i,"x",i.x),OD(s)&&It(i,"y",i.y),t.snap(i,u)}}),e.on(["resize.cleanup"],function(){t.hide()})}Xa.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new wr);var o=Ix(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},Xa.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return I(r,function(o){e.add("corner",g_(o)),e.add("corner",m_(o))}),e.add("corner",Ix(t,i)),e},Xa.$inject=["eventBus","snapping"],Xa.prototype.getSnapTargets=function(e,t){return y_(t).filter(function(n){return!TD(n,e)&&!at(n)&&!MD(n)&&!Ge(n)})};function Ix(e,t){var n=Oe(e),i=Te(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 TD(e,t){return e.host===t}function MD(e){return!!e.hidden}function kD(e){return e==="n"||e==="s"}function OD(e){return e==="e"||e==="w"}var DD=7,LD=1e3;function Er(e){this._canvas=e,this._asyncHide=Lu(bn(this.hide,this),LD)}Er.$inject=["canvas"],Er.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:$o(e,"x"),y:$o(e,"y")};I(r,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(I(["x","y"],function(u){var l;o[u]||(l=t.snap(c,a,u,DD),l!==void 0&&(o[u]={value:l,originValue:l-s[u]}))}),o.x&&o.y)return!1}),this.showSnapLine("vertical",o.x&&o.x.value),this.showSnapLine("horizontal",o.y&&o.y.value),I(["x","y"],function(a){var s=o[a];qt(s)&&It(e,a,s.originValue)})},Er.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=Pe("path");return ve(n,{d:"M0,0 L0,0"}),Xe(n).add("djs-snap-line"),Fe(t,n),{update:function(i){Ie(i)?e==="horizontal"?ve(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):ve(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):ve(n,{display:"none"})}}},Er.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Er.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},Er.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Er.prototype.hide=function(){I(this._snapLines,function(e){e.update()})};const ID={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",Ei],resizeSnapping:["type",Xa],snapping:["type",Er]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",Ax],createMoveSnapping:["type",Ho]};var Bx=300;function je(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=ot(je.INPUT_SELECTOR,this._container),this._resultsContainer=ot(je.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}je.$inject=["canvas","eventBus","selection","translate"],je.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:Pn.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,je.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,je.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,je.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,je.INPUT_SELECTOR,"keydown",function(n){zt("ArrowUp",n)&&n.preventDefault(),zt("ArrowDown",n)&&n.preventDefault()}),t(this._container,je.INPUT_SELECTOR,"keyup",function(n){if(zt("Escape",n))return e.close();if(zt("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(zt("ArrowUp",n))return e._scrollToDirection(!0);if(zt("ArrowDown",n))return e._scrollToDirection();zt(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},je.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){Pn.unbind(e.el,e.type,e.listener)})},je.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=ot(je.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},je.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},je.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)}},je.prototype._clearResults=function(){xs(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},je.prototype._getCurrentResult=function(){return ot(je.RESULT_SELECTED_SELECTOR,this._resultsContainer)},je.prototype._createResultNode=function(e,t){var n=ht(je.RESULT_HTML);return e.primaryTokens.length>0&&Nx(n,e.primaryTokens,je.RESULT_PRIMARY_HTML),Nx(n,e.secondaryTokens,je.RESULT_SECONDARY_HTML),un(n,je.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},je.prototype.registerProvider=function(e){this._searchProvider=e},je.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._cachedRootElement=this._canvas.getRootElement(),this._cachedSelection=this._selection.get(),this._cachedViewbox=this._canvas.viewbox(),this._selection.select(null),this._bindEvents(),this._open=!0,_t(this._canvas.getContainer()).add("djs-search-open"),_t(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},je.prototype.close=function(e=!0){this.isOpen()&&(e&&(this._cachedRootElement&&this._canvas.setRootElement(this._cachedRootElement),this._cachedSelection&&this._selection.select(this._cachedSelection),this._cachedViewbox&&this._canvas.viewbox(this._cachedViewbox),this._eventBus.fire("searchPad.restored")),this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._unbindEvents(),this._open=!1,_t(this._canvas.getContainer()).remove("djs-search-open"),_t(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},je.prototype.toggle=function(){this.isOpen()?this.close():this.open()},je.prototype.isOpen=function(){return this._open},je.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&_t(t).remove(je.RESULT_SELECTED_CLASS);var n=un(e,je.RESULT_ID_ATTRIBUTE),i=this._results[n].element;_t(e).add(je.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:Bx}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},je.prototype._select=function(e){var t=un(e,je.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:Bx}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},je.prototype._getBoxHtml=function(){const e=ht(je.BOX_HTML),t=ot(je.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function Nx(e,t,n){var i=BD(t),r=ht(n);r.innerHTML=i,e.appendChild(r)}function BD(e){var t="";return e.forEach(function(n){var i=Wv(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+je.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}je.CONTAINER_SELECTOR=".djs-search-container",je.INPUT_SELECTOR=".djs-search-input input",je.RESULTS_CONTAINER_SELECTOR=".djs-search-results",je.RESULT_SELECTOR=".djs-search-result",je.RESULT_SELECTED_CLASS="djs-search-result-selected",je.RESULT_SELECTED_SELECTOR="."+je.RESULT_SELECTED_CLASS,je.RESULT_ID_ATTRIBUTE="data-result-id",je.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",je.BOX_HTML=`<div class="djs-search-container djs-scrollable">
335
+ </svg>`},Kk=900;function qa(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",Kk,this)}qa.$inject=["popupMenu","distributeElements","translate","rules"],qa.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&V(t,this._getEntries(e)),t},qa.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},qa.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:I_.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:I_.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const Xk={__depends__:[Mf,Yk],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",pu],distributeElementsMenuProvider:["type",qa]};var B_="is not a registered action",Zk="is already registered";function ti(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}ti.$inject=["eventBus","injector"],ti.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),i=e.get("selection",!1),r=e.get("zoomScroll",!1),o=e.get("copyPaste",!1),a=e.get("canvas",!1),s=e.get("rules",!1),c=e.get("keyboardMove",!1),u=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),o&&i&&this.register("copy",function(){var l=i.get();if(l.length)return o.copy(l)}),o&&i&&this.register("duplicate",function(){var l=i.get();if(l.length)return o.duplicate(l)}),o&&this.register("paste",function(){o.paste()}),o&&i&&s&&this.register("cut",function(){var l=i.get();if(l.length){var f=s.allowed("elements.delete",{elements:l});if(f!==!1){var p=Oe(f)?f:l;return o.cut(p.slice())}}}),r&&this.register("stepZoom",function(l){r.stepZoom(l.value)}),a&&this.register("zoom",function(l){a.zoom(l.value)}),n&&i&&s&&this.register("removeSelection",function(){var l=i.get();if(l.length){var f=s.allowed("elements.delete",{elements:l}),p;f!==!1&&(Oe(f)?p=f:p=l,p.length&&n.removeElements(p.slice()))}}),c&&this.register("moveCanvas",function(l){c.moveCanvas(l)}),u&&this.register("moveSelection",function(l){u.moveSelection(l.direction,l.accelerated)})},ti.prototype.trigger=function(e,t){if(!this._actions[e])throw jf(e,B_);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},ti.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);I(e,function(i,r){n._registerAction(r,i)})},ti.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw jf(e,Zk);this._actions[e]=t},ti.prototype.unregister=function(e){if(!this.isRegistered(e))throw jf(e,B_);this._actions[e]=void 0},ti.prototype.getActions=function(){return Object.keys(this._actions)},ti.prototype.isRegistered=function(e){return!!this._actions[e]};function jf(e,t){return new Error(e+" "+t)}const Qk={__init__:["editorActions"],editorActions:["type",ti]};function fu(e){e.invoke(ti,this)}ye(fu,ti),fu.$inject=["injector"],fu.prototype._registerDefaultActions=function(e){ti.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),i=e.get("selection",!1),r=e.get("spaceTool",!1),o=e.get("lassoTool",!1),a=e.get("handTool",!1),s=e.get("globalConnect",!1),c=e.get("distributeElements",!1),u=e.get("alignElements",!1),l=e.get("directEditing",!1),f=e.get("searchPad",!1),p=e.get("modeling",!1),d=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",function(){var g=t.getRootElement(),h=n.filter(function(m){return m!==g});return i.select(h),h}),r&&this._registerAction("spaceTool",function(){r.toggle()}),o&&this._registerAction("lassoTool",function(){o.toggle()}),a&&this._registerAction("handTool",function(){a.toggle()}),s&&this._registerAction("globalConnectTool",function(){s.toggle()}),i&&c&&this._registerAction("distributeElements",function(g){var h=i.get(),m=g.type;h.length&&c.trigger(h,m)}),i&&u&&this._registerAction("alignElements",function(g){var h=i.get(),m=[],_=g.type;h.length&&(m=Ge(h,function(y){return!w(y,"bpmn:Lane")}),u.trigger(m,_))}),i&&p&&this._registerAction("setColor",function(g){var h=i.get();h.length&&p.setColor(h,g)}),i&&l&&this._registerAction("directEditing",function(){var g=i.get();g.length&&l.activate(g[0])}),f&&this._registerAction("find",function(){f.toggle()}),t&&p&&this._registerAction("moveToOrigin",function(){var g=t.getRootElement(),h,m;w(g,"bpmn:Collaboration")?m=n.filter(function(_){return w(_.parent,"bpmn:Collaboration")}):m=n.filter(function(_){return _!==g&&!w(_.parent,"bpmn:SubProcess")}),h=kt(m),p.moveElements(m,{x:-h.x,y:-h.y},g)}),i&&d&&this._registerAction("replaceElement",function(g){d.triggerEntry("replace","click",g)})};const Jk={__depends__:[Qk],editorActions:["type",fu]};function N_(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;ze(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}N_.$inject=["eventBus"];function qr(e,t){ee.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;xn(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}qr.$inject=["eventBus","gridSnapping","modeling"],ye(qr,ee),qr.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},qr.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},qr.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),V(e,o),e},qr.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),V(e,o),e};var eO=2e3;function $_(e,t){e.on(["spaceTool.move","spaceTool.end"],eO,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)}})}$_.$inject=["eventBus","gridSnapping"];const tO={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",qr],gridSnappingSpaceToolBehavior:["type",$_]};var du=10;function Hf(e,t,n){return n||(n="round"),Math[n](e/t)*t}var nO=1200,iO=800;function br(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",iO,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"],nO,function(o){var a=o.originalEvent;if(!(!r.active||a&&An(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(u){var l={},f=oO(o,u,e);f&&(l.offset=f);var p=rO(o,u);p&&V(l,p),Ho(o,u)||r.snapEvent(o,u,l)})}})}br.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);It(e,t,i)},br.prototype.getGridSpacing=function(){return du},br.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=Hf(e,du);var i,r;return t&&t.min&&(i=t.min,Ie(i)&&(i=Hf(i+n,du,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,Ie(r)&&(r=Hf(r+n,du,"floor"),e=Math.min(e,r))),e-=n,e},br.prototype.isActive=function(){return this.active},br.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},br.prototype.toggleActive=function(){this.setActive(!this.active)},br.$inject=["elementRegistry","eventBus","config.gridSnapping"];function rO(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&&(hu(t)?(a.x.min=i.left,a.x.max=i.right):(a.y.min=i.top,a.y.max=i.bottom));var c=r.min,u=r.max;return c&&(hu(t)?j_(s)?a.x.max=c.left:a.x.min=c.right:F_(s)?a.y.max=c.top:a.y.min=c.bottom),u&&(hu(t)?j_(s)?a.x.min=u.left:a.x.max=u.right:F_(s)?a.y.min=u.top:a.y.max=u.bottom),a[t]}function oO(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&Ie(s[t])||(s||(s=o.snapOffset={}),Ie(s[t])||(s[t]=0),!r)||(n.get(r.id)||(hu(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 hu(e){return e==="x"}function F_(e){return e.indexOf("n")!==-1}function j_(e){return e.indexOf("w")!==-1}const aO={__depends__:[tO],__init__:["gridSnapping"],gridSnapping:["type",br]};var sO=2e3;function H_(e,t,n){e.on("autoPlace",sO,function(i){var r=i.source,o=De(r),a=i.shape,s=jv(r,a,n);return["x","y"].forEach(function(c){var u={};s[c]!==o[c]&&(s[c]>o[c]?u.min=s[c]:u.max=s[c],w(a,"bpmn:TextAnnotation")&&(cO(c)?u.offset=-a.width/2:u.offset=-a.height/2),s[c]=t.snapValue(s[c],u))}),s})}H_.$inject=["eventBus","gridSnapping","elementRegistry"];function cO(e){return e==="x"}var uO=1750;function z_(e,t,n){t.on(["create.start","shape.move.start"],uO,function(i){var r=i.context,o=r.shape,a=e.getRootElement();if(!(!w(o,"bpmn:Participant")||!w(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}))}})}z_.$inject=["canvas","eventBus","gridSnapping"];var lO=3e3;function mu(e,t,n){ee.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],lO,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||pO(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}mu.$inject=["eventBus","gridSnapping","modeling"],ye(mu,ee),mu.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=hO(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function pO(e){return e.length>3}function fO(e){return e==="h"}function dO(e){return e==="v"}function hO(e,t,n){var i=Oi(t,n),r={};return fO(i)&&(r.y=e.snapValue(t.y)),dO(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=V({},t,r),n=V({},n,r)),[t,n]}const mO={__depends__:[aO,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",H_],gridSnappingParticipantBehavior:["type",z_],gridSnappingLayoutConnectionBehavior:["type",mu]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",N_]};var gO=30,G_=30;function Ya(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var r=i.element,o=i.gfx;if(w(r,"bpmn:Lane"))return n._createParticipantHit(r,o);if(w(r,"bpmn:Participant"))return Ue(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(w(r,"bpmn:SubProcess"))return Ue(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}Ya.$inject=["eventBus","interactionEvents"],Ya.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Ya.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=Yt(e)?{width:gO,height:e.height}:{width:e.width,height:G_};return this._interactionEvents.createBoxHit(t,"all",n),!0},Ya.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:G_}),!0};const yO={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Ya]};function gu(e){e.invoke(Lo,this)}ye(gu,Lo),gu.$inject=["injector"],gu.prototype.registerBindings=function(e,t){Lo.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 vO={__depends__:[mf],__init__:["keyboardBindings"],keyboardBindings:["type",gu]};var bO={moveSpeed:1,moveSpeedAccelerated:10},_O=1500,V_="left",W_="up",U_="right",q_="down",xO={ArrowLeft:V_,Left:V_,ArrowUp:W_,Up:W_,ArrowRight:U_,Right:U_,ArrowDown:q_,Down:q_},wO={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 Y_(e,t,n,i,r){var o=this;this._config=V({},bO,e||{}),t.addListener(_O,function(a){var s=a.keyEvent,c=xO[s.key];if(c&&!t.isCmd(s)){var u=t.isShift(s);return o.moveSelection(c,u),!0}}),this.moveSelection=function(a,s){var c=r.get();if(c.length){var u=this._config[s?"moveSpeedAccelerated":"moveSpeed"],l=wO[a](u),f=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});f&&n.moveElements(c,l)}}}Y_.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const EO={__depends__:[mf,Xn],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",Y_]};var K_=10;function Ka(e,t,n,i){this._dragging=i,this._rules=t;var r=this;function o(c,u){var l=c.shape,f=c.direction,p=c.resizeConstraints,d;c.delta=u,d=bC(l,f,u),c.newBounds=xC(d,p),c.canExecute=r.canResize(c)}function a(c){var u=c.resizeConstraints,l=c.minBounds;u===void 0&&(l===void 0&&(l=r.computeMinResizeBox(c)),c.resizeConstraints={min:Te(l)})}function s(c){var u=c.shape,l=c.canExecute,f=c.newBounds;if(l){if(f=fm(f),!SO(u,f))return;n.resizeShape(u,f)}}e.on("resize.start",function(c){a(c.context)}),e.on("resize.move",function(c){var u={x:c.dx,y:c.dy};o(c.context,u)}),e.on("resize.end",function(c){s(c.context)})}Ka.prototype.canResize=function(e){var t=this._rules,n=ri(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Ka.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=V({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,X_(t,o),"resize",{autoActivate:!0,cursor:RO(o),data:{shape:t,context:r}})},Ka.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:K_,height:K_},r=Jm(t,e.childrenBoxPadding),wC(n,t,i,r)},Ka.$inject=["eventBus","rules","modeling","dragging"];function SO(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function X_(e,t){var n=De(e),i=Te(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 RO(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 Z_="djs-resizing",Q_="resize-not-ok",CO=500;function J_(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,Z_)),s.width>5&&ve(c,{x:s.x,width:s.width}),s.height>5&&ve(c,{y:s.y,height:s.height}),o.canExecute?Ye(c).remove(Q_):Ye(c).add(Q_)}function r(o){var a=o.shape,s=o.frame;s&&Ft(o.frame),t.removeMarker(a,Z_)}e.on("resize.move",CO,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}J_.$inject=["eventBus","canvas","previewSupport"];var yu=-6,vu=8,bu=20,Xa="djs-resizer",PO=["n","w","s","e","nw","ne","se","sw"];function _r(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&&I(a,vn(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}_r.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){cr(o)&&i.activate(o,e,n)}Be.bind(t,"mousedown",r),Be.bind(t,"touchstart",r)},_r.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=AO(i),a=Ae("g");Ye(a).add(Xa),Ye(a).add(Xa+"-"+e.id),Ye(a).add(Xa+"-"+i),Ne(r,a);var s=Ae("rect");ve(s,{x:-vu/2+o.x,y:-vu/2+o.y,width:vu,height:vu}),Ye(s).add(Xa+"-visual"),Ne(a,s);var c=Ae("rect");return ve(c,{x:-bu/2+o.x,y:-bu/2+o.y,width:bu,height:bu}),Ye(c).add(Xa+"-hit"),Ne(a,c),Ds(a,t,n),a},_r.prototype.createResizer=function(e,t){var n=X_(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},_r.prototype.addResizer=function(e){var t=this;ot(e)||I(PO,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},_r.prototype.removeResizers=function(){var e=this._getResizersParent();Ss(e)},_r.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},_r.$inject=["eventBus","canvas","selection","resize"];function AO(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-yu:e.indexOf("w")!==-1&&(t.x=yu),e.indexOf("s")!==-1?t.y=-yu:e.indexOf("n")!==-1&&(t.y=yu),t}const ex={__depends__:[xi,$i,ko],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Ka],resizePreview:["type",J_],resizeHandles:["type",_r]};var TO=2e3;function Za(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"],TO,function(c){i.isActive(c.element)&&i.cancel()}),e.on(["commandStack.changed"],function(c){i.isActive()&&i.cancel()}),e.on("directEditing.activate",function(c){o.removeResizers()}),e.on("create.end",500,function(c){var u=c.context,l=u.shape,f=c.context.canExecute,p=c.isTouch;p||f&&(u.hints&&u.hints.createElementsBehavior===!1||s(l))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,u){(u||ze(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}Za.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Za.prototype.activate=function(e){var t=$n(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);V(n,i);var r={},o=n.style||{};return V(o,{backgroundColor:null,border:null}),(ze(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||tx(e))&&V(r,{centerVertically:!0}),rr(e)&&(V(r,{resizable:!0,autoResize:!0}),V(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),w(e,"bpmn:TextAnnotation")&&(V(r,{resizable:!0,autoResize:!0}),V(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),V(n,{options:r,style:o}),n}},Za.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),r={x:i.x+i.width/2,y:i.y+i.height/2},o={x:i.x,y:i.y},a=t.zoom(),s=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),u=c.fontSize*a,l=c.lineHeight,f=s.fontSize*a,p=s.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(w(e,"bpmn:Lane")||OO(e)){var g=Yt(e),h=g?{width:i.height,height:30*a,x:i.x-i.height/2+15*a,y:r.y-30*a/2}:{width:i.width,height:30*a};V(o,h),V(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:g?"rotate(-90deg)":null})}if(kO(e)){var m=Yt(e),_=m?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:r.x-i.height/2,y:r.y-i.width/2};V(o,_),V(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:m?null:"rotate(-90deg)"})}(ze(e,["bpmn:Task","bpmn:CallActivity"])||tx(e))&&(V(o,{width:i.width,height:i.height}),V(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),MO(e)&&(V(o,{width:i.width,x:i.x}),V(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var y=1,x=i.width+2*y;if(n.labelTarget&&(V(o,{width:x,height:i.height+2*y,x:i.x-y,y:i.y-y}),V(d,{fontSize:u+"px",lineHeight:l})),rr(n)&&!Bs(n)&&!je(n)){var S=Al(e),P=t.getAbsoluteBBox({x:S.x,y:S.y,width:0,height:0}),C=u,L=Ir.width*a+2*y;V(o,{width:L,height:C+2*y,x:P.x-L/2,y:P.y-C/2-y}),V(d,{fontSize:u+"px",lineHeight:l})}return w(e,"bpmn:TextAnnotation")&&(V(o,{width:i.width+2*y,height:i.height+2*y,x:i.x-y,y:i.y-y,minWidth:30*a,minHeight:10*a}),V(d,{textAlign:"left",paddingTop:vo*a+"px",paddingBottom:vo*a+"px",paddingLeft:vo*a+"px",paddingRight:vo*a+"px",fontSize:f+"px",lineHeight:p})),{bounds:o,style:d}},Za.prototype.update=function(e,t,n,i){var r,o;w(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}),DO(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function tx(e){return w(e,"bpmn:SubProcess")&&!Ue(e)}function MO(e){return w(e,"bpmn:SubProcess")&&Ue(e)}function kO(e){return w(e,"bpmn:Participant")&&!Ue(e)}function OO(e){return w(e,"bpmn:Participant")&&Ue(e)}function DO(e){return!e||!e.trim()}var nx="djs-element-hidden",ix="djs-label-hidden";function rx(e,t,n){var i=this,r=t.getDefaultLayer(),o,a,s;e.on("directEditing.activate",function(c){var u=c.active;if(o=u.element.label||u.element,w(o,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(o),s=Ae("g");var l=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:o.height,position:{mx:0,my:0}}),f=i.path=Ae("path");ve(f,{d:l,strokeWidth:2,stroke:LO(o)}),Ne(s,f),Ne(r,s),Jt(s,o.x,o.y)}w(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,nx):(w(o,"bpmn:Task")||w(o,"bpmn:CallActivity")||w(o,"bpmn:SubProcess")||w(o,"bpmn:Participant")||w(o,"bpmn:Lane"))&&t.addMarker(o,ix)}),e.on("directEditing.resize",function(c){if(w(o,"bpmn:TextAnnotation")){var u=c.height,l=c.dy,f=Math.max(o.height/a.height*(u+l),0),p=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:f,position:{mx:0,my:0}});ve(i.path,{d:p})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var u=c.active;u&&(t.removeMarker(u.element.label||u.element,nx),t.removeMarker(o,ix)),o=void 0,a=void 0,s&&(Ft(s),s=void 0)})}rx.$inject=["eventBus","canvas","pathMap"];function LO(e,t){var n=Ke(e);return n.get("stroke")||t||"black"}const IO={__depends__:[Up,ex,T_],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Za],labelEditingPreview:["type",rx]};var BO=500,NO=1e3;function Si(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){xS(o)||i.createOutline(o)}e.on("element.hover",function(o){r(o.element)}),e.on("selection.changed",function(o){I(o.newSelection,r)}),e.on(["shape.changed","connection.changed"],BO,function(o){var a=o.element,s=o.gfx,c=rt(".djs-outline",s);c&&i.updateOutline(a,c)})}Si.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=rt(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),Ne(t,n),this.updateOutline(e,n)),n},Si.prototype._createOutlineGfx=function(){var e=Ae("rect");return ve(e,V({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},Si.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},Si.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&I(i,function(r){n=n||r.updateOutline(t,e)}),n||ve(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},Si.prototype.updateConnectionOutline=function(e,t){var n=kt(t);ve(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},Si.prototype.registerProvider=function(e,t){t||(t=e,e=NO),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},Si.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Si.prototype.getOutline=function(e){var t,n=this._getProviders();return I(n,function(i){Ut(i.getOutline)&&(t=t||i.getOutline(e))}),t},Si.$inject=["eventBus","styles","elementRegistry"];var _u=6;function zf(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)})}zf.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Ss(t);var n=e.length>1,i=this._canvas.getContainer();if(Ye(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=$O(kt(e)),o=Ae("rect");ve(o,V({rx:3},r)),Ye(o).add("djs-selection-outline"),Ne(t,o)}},zf.$inject=["eventBus","canvas","selection"];function $O(e){return{x:e.x-_u,y:e.y-_u,width:e.width+_u*2,height:e.height+_u*2}}const Gf={__depends__:[Xn],__init__:["outline","multiSelectionOutline"],outline:["type",Si],multiSelectionOutline:["type",zf]},ox=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],ax={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},FO=15,xu=2;function sx(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(g=>ze(g,ox));if(p.length===1){const g=p[0];je(g)?a(g,g.labelTarget):(d=g.labels)!=null&&d.length&&a(g.labels[0],g)}if(p.length===2){const g=p.find(je),h=p.find(m=>{var _;return(_=m.labels)==null?void 0:_.includes(g)});g&&h&&a(g,h)}}),e.on("shape.changed",function({element:f}){var p;!ze(f,ox)||!l(f)||(je(f)?a(f,f.labelTarget):(p=f.labels)!=null&&p.length&&a(f.labels[0],f))});function a(f,p){const d=ea([De(p),De(f)],ax),g=d.getAttribute("d"),m=r.isSelected(f)?c(f):u(f),_=ra(m,g);if(!_)return;const x=r.isSelected(p)?c(p):u(p),S=ra(x,g)||De(p);ha(S,_)<FO||(_l(d,[S,_]),Ne(o,d))}function s(){Es(`.${ax.class}`,o).forEach(Ft)}function c(f){const p=i.getOutline(f);if(!p)return u(f);if(p.x){const d={x:f.x+xr(p,"x")-xu,y:f.y+xr(p,"y")-xu,width:xr(p,"width")+xu*2,height:xr(p,"height")+xu*2};return Ml(d,xr(p,"rx"))}if(p.cx){const d=xr(p,"r"),g={x:f.x+xr(p,"cx")-d,y:f.y+xr(p,"cy")-d,width:d*2,height:d*2};return Bm(g)}}function u(f){return n.getShapePath(f)}function l(f){return r.isSelected(f)}}sx.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function xr(e,t){return parseFloat(ve(e,t)||0)}const jO={__depends__:[Xn,Gf],__init__:["labelLink"],labelLink:["type",sx]};var HO=new Mo("tt");function zO(e){var t=ht('<div class="djs-tooltip-container" />');return hn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function GO(e,t,n){hn(e,{left:t+"px",top:n+"px"})}function Vf(e,t){e.style.display=t===!1?"none":""}var cx="djs-tooltip",Wf="."+cx;function _n(e,t){this._eventBus=e,this._canvas=t,this._ids=HO,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=zO(t.getContainer());var n=this;Rn.bind(this._tooltipRoot,Wf,"mousedown",function(i){i.stopPropagation()}),Rn.bind(this._tooltipRoot,Wf,"mouseover",function(i){n.trigger("mouseover",i)}),Rn.bind(this._tooltipRoot,Wf,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}_n.$inject=["eventBus","canvas"],_n.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=V({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},_n.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(sn(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},_n.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},_n.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},_n.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)}},_n.prototype.remove=function(e){var t=this.get(e);t&&(mi(t.html),mi(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},_n.prototype.show=function(){Vf(this._tooltipRoot)},_n.prototype.hide=function(){Vf(this._tooltipRoot,!1)},_n.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},_n.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)),xn(n)&&(n=ht(n)),i=ht('<div data-tooltip-id="'+t+'" class="'+cx+'">'),hn(i,{position:"absolute"}),i.appendChild(n),e.type&&vt(i).add("djs-tooltip-"+e.type),e.className&&vt(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},_n.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;GO(n,t.x,t.y)},_n.prototype._updateTooltipVisibilty=function(e){I(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),Vf(i,r))})},_n.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 VO={__init__:["tooltips"],tooltips:["type",_n]};var WO="flow elements must be children of pools/participants",UO="Data object must be placed within a pool/participant.";function ux(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;w(s,"bpmn:Collaboration")&&(w(a,"bpmn:FlowNode")?i(r,n(WO)):w(a,"bpmn:DataObjectReference")&&i(r,n(UO)))})}ux.$inject=["eventBus","tooltips","translate"];const qO={__depends__:[VO],__init__:["modelingFeedback"],modelingFeedback:["type",ux]};var YO=500,KO=1250,XO=1500,wu=Math.round;function ZO(e){return{x:e.x+wu(e.width/2),y:e.y+wu(e.height/2)}}function lx(e,t,n,i,r){function o(s,c,u,l){return r.allowed("elements.move",{shapes:s,delta:c,position:u,target:l})}e.on("shape.move.start",XO,function(s){var c=s.context,u=s.shape,l=i.get().slice();l.indexOf(u)===-1&&(l=[u]),l=QO(l),V(c,{shapes:l,validatedShapes:l,shape:u})}),e.on("shape.move.start",KO,function(s){var c=s.context,u=c.validatedShapes,l;if(l=c.canExecute=o(u),!l)return!1}),e.on("shape.move.move",YO,function(s){var c=s.context,u=c.validatedShapes,l=s.hover,f={x:s.dx,y:s.dy},p={x:s.x,y:s.y},d;if(d=o(u,f,p,l),c.delta=f,c.canExecute=d,d===null){c.target=null;return}c.target=l}),e.on("shape.move.end",function(s){var c=s.context,u=c.delta,l=c.canExecute,f=l==="attach",p=c.shapes;if(l===!1)return!1;u.x=wu(u.x),u.y=wu(u.y),!(u.x===0&&u.y===0)&&n.moveElements(p,u,c.target,{primaryShape:c.shape,attach:f})}),e.on("element.mousedown",function(s){if(cr(s)){var c=Co(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,u,l){if(Wt(u)&&(l=u,u=!1),!(c.waypoints||!c.parent)&&!Ye(s.target).has("djs-hit-no-move")){var f=ZO(c),p=t.init(s,f,"shape.move",{cursor:"grabbing",autoActivate:u,data:{shape:c,context:l||{}}});if(p!==!1)return!0}}this.start=a}lx.$inject=["eventBus","dragging","modeling","selection","rules"];function QO(e){var t=to(e,"id");return Ge(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var px=499,Uf="djs-dragging",fx="drop-ok",dx="drop-not-ok",hx="new-parent",mx="attach-ok";function gx(e,t,n,i){function r(c){var u=o(c),l=JO(u);return l}function o(c){var u=ta(c),l=u.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),f=u.concat(l),p=[...new Set(f)];return p}function a(c,u){[mx,fx,dx,hx].forEach(function(l){l===u?t.addMarker(c,l):t.removeMarker(c,l)})}function s(c,u,l){i.addDragger(u,c.dragGroup),l&&t.addMarker(u,Uf),c.allDraggedElements?c.allDraggedElements.push(u):c.allDraggedElements=[u]}e.on("shape.move.start",px,function(c){var u=c.context,l=u.shapes,f=u.allDraggedElements,p=r(l);if(!u.dragGroup){var d=Ae("g");ve(d,n.cls("djs-drag-group",["no-events"]));var g=t.getActiveLayer();Ne(g,d),u.dragGroup=d}p.forEach(function(h){i.addDragger(h,u.dragGroup)}),f?f=Du([f,o(l)]):f=o(l),I(f,function(h){t.addMarker(h,Uf)}),u.allDraggedElements=f,u.differentParents=eD(l)}),e.on("shape.move.move",px,function(c){var u=c.context,l=u.dragGroup,f=u.target,p=u.shape.parent,d=u.canExecute;f&&(d==="attach"?a(f,mx):u.canExecute&&p&&f.id!==p.id?a(f,hx):a(f,u.canExecute?fx:dx)),Jt(l,c.dx,c.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(c){var u=c.context,l=u.target;l&&a(l,null)}),e.on("shape.move.cleanup",function(c){var u=c.context,l=u.allDraggedElements,f=u.dragGroup;I(l,function(p){t.removeMarker(p,Uf)}),f&&Ft(f)}),this.makeDraggable=s}gx.$inject=["eventBus","canvas","styles","previewSupport"];function JO(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=Ge(e,function(i){return ot(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function eD(e){return q0(to(e,function(t){return t.parent&&t.parent.id}))!==1}const tD={__depends__:[dc,Xn,Gf,xi,$i,ko],__init__:["move","movePreview"],move:["type",lx],movePreview:["type",gx]};var yx=".djs-palette-toggle",vx=".entry",nD=yx+", "+vx,qf="djs-palette-",iD="shown",Yf="open",bx="two-column",rD=1e3;function Bt(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()})}Bt.$inject=["eventBus","canvas"],Bt.prototype.registerProvider=function(e,t){t||(t=e,e=rD),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},Bt.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(aD,{})},Bt.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},Bt.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=ht(Bt.HTML_MARKUP);n.appendChild(i),vt(n).add(qf+iD),Rn.bind(i,nD,"click",function(r){var o=r.delegateTarget;if(pl(o,yx))return e.toggle();e.trigger("click",r)}),Be.bind(i,"mousedown",function(r){r.stopPropagation()}),Rn.bind(i,vx,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},Bt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},Bt.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,r,o=vt(n),a=vt(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(bx,r),a.toggle(qf+bx,r),"open"in e&&(o.toggle(Yf,e.open),a.toggle(qf+Yf,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},Bt.prototype._update=function(){var e=rt(".djs-palette-entries",this._container),t=this._entries=this.getEntries();xs(e),I(t,function(n,i){var r=n.group||"default",o=rt("[data-group="+Ba(r)+"]",e);o||(o=ht('<div class="group"></div>'),sn(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=ht(a);if(o.appendChild(s),!n.separator&&(sn(s,"data-action",i),n.title&&sn(s,"title",n.title),n.className&&oD(s,n.className),n.imageUrl)){var c=ht("<img>");sn(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},Bt.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=sn(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},Bt.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(Ut(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},Bt.prototype._layoutChanged=function(){this._toggleState({})},Bt.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},Bt.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},Bt.prototype.open=function(){this._toggleState({open:!0})},Bt.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Bt.prototype.isActiveTool=function(e){return e&&this._activeTool===e},Bt.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=rt(".djs-palette-entries",this._container),this._toolsContainer=rt("[data-group=tools]",t)),n=this._toolsContainer,I(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=vt(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},Bt.prototype.isOpen=function(){return vt(this._container).has(Yf)},Bt.prototype._getParentContainer=function(){return this._canvas.getContainer()},Bt.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function oD(e,t){var n=vt(e),i=Oe(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function aD(e,t){var n=t.getPaletteEntries();return Ut(n)?n(e):(I(n,function(i,r){e[r]=i}),e)}const sD={__init__:["palette"],palette:["type",Bt]};var _x="crosshair",xx="selected",cD="djs-dragging-active-lasso";function wr(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=Ae("rect");ve(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),Ne(p,d),u(!0),this.update(f)},update:function(f){var p=f.frame,d=f.bbox;p&&d&&ve(p,{x:d.x,y:d.y,width:d.width,height:d.height});var g=f.marked,h=f.lastMarked;if(g&&h){for(const m of h)g.has(m)||t.removeMarker(m,xx);for(const m of g)h.has(m)||t.addMarker(m,xx)}},remove:function(f){this.update(f),f.frame&&Ft(f.frame),u(!1)}};function u(f){Ye(t.getContainer()).toggle(cD,f)}function l(f){var p=i.getAll();return new Set(eo(fo(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=wx(f),p.add=ac(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=wx(f),g=l(d),h=p.initialMarked.union(g);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(ac(f))return s.activateLasso(f.originalEvent),!0})}wr.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],wr.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:_x,data:{context:{}},keepSelection:!0})},wr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:_x,data:{context:{}},keepSelection:!0})},wr.prototype._select=function(e){this._selection.select(e)},wr.prototype.select=function(e,t,n=[]){var i=eo(fo(e,t));this._select([...n,...i])},wr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},wr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function wx(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 uD={__depends__:[yc,_a],__init__:["lassoTool"],lassoTool:["type",wr]};var Kf=1500,Ex="grab";function zo(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",Kf,function(c){if(ya(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(Kf,function(c){if(!(!Sx(c.keyEvent)||a.isActive())){var u=a._mouse.getLastMoveEvent();a.activateMove(u,!!u)}},"keyboard.keydown"),s&&s.addListener(Kf,function(c){!Sx(c.keyEvent)||!a.isActive()||a.toggle()},"keyboard.keyup"),e.on("hand.end",function(c){var u=c.originalEvent.target;if(!c.hover&&!(u instanceof SVGElement))return!1;e.once("hand.ended",function(){a.activateMove(c.originalEvent,{reactivate:!0})})}),e.on("hand.move.move",function(c){var u=t.viewbox().scale;t.scroll({dx:c.dx*u,dy:c.dy*u})}),e.on("hand.move.end",function(c){var u=c.context,l=u.reactivate;return!ya(c)&&l&&e.once("hand.move.ended",function(f){a.activateHand(f.originalEvent,!0,!0)}),!1})}zo.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],zo.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:Ex,data:{context:n||{}}})},zo.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:Ex,data:{context:{reactivate:n}}})},zo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},zo.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function Sx(e){return jt("Space",e)}const lD={__depends__:[yc,_a],__init__:["handTool"],handTool:["type",zo]};var Rx="connect-ok",Cx="connect-not-ok";function Go(e,t,n,i,r,o,a){var s=this;this._dragging=t,this._rules=o,this._mouse=a,r.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",function(c){var u=c.context,l=c.hover,f=u.canStartConnect=s.canStartConnect(l);f!==null&&(u.startTarget=l,i.addMarker(l,f?Rx:Cx))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var u=c.context.startTarget,l=c.context.canStartConnect;u&&i.removeMarker(u,l?Rx:Cx)}),e.on(["global-connect.ended"],function(c){var u=c.context,l=u.startTarget,f={x:c.x,y:c.y},p=s.canStartConnect(l);if(p)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,l,f)}),!1})}Go.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Go.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Go.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Go.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Go.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const pD={__depends__:[$f,xi,$i,yc,_a],globalConnect:["type",Go]};function Xf(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)}Xf.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],Xf.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,g,h){function m(_){var y=n.createShape(V({type:f},h));t.start(_,y)}return{group:p,className:d,title:g,action:{dragstart:m,click:m}}}function u(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 l(f){t.start(f,n.createParticipantShape())}return V(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:u,click:u}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:s("Create pool/participant"),action:{dragstart:l,click:l}},"create.group":c("bpmn:Group","artifact","bpmn-icon-group",s("Create group"))}),e};const fD={__depends__:[sD,mc,ev,uD,lD,pD,la],__init__:["paletteProvider"],paletteProvider:["type",Xf]};var dD=250;function Zf(e,t,n,i,r){ee.call(this,e);function o(s){var c=s.canExecute.replacements;I(c,function(u){var l=u.oldElementId,f={type:u.newElementType};if(!s.visualReplacements[l]){var p=t.get(l);V(f,{x:p.x,y:p.y});var d=n.createShape(f);i.addShape(d,p.parent);var g=rt('[data-element-id="'+Ba(p.id)+'"]',s.dragGroup);g&&ve(g,{display:"none"});var h=r.addDragger(d,s.dragGroup);s.visualReplacements[l]=h,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;I(c,function(u,l){var f=rt('[data-element-id="'+Ba(l)+'"]',s.dragGroup);f&&ve(f,{display:"inline"}),u.remove(),c[l]&&delete c[l]})}e.on("shape.move.move",dD,function(s){var c=s.context,u=c.canExecute;c.visualReplacements||(c.visualReplacements={}),u&&u.replacements?o(c):a(c)})}Zf.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],ye(Zf,ee);const hD={__depends__:[ko],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Zf]};var mD=1250,Qf=40,gD=20,yD=10,Px=20,Ax=["x","y"],vD=Math.abs;function Tx(e){e.on(["connect.hover","connect.move","connect.end"],mD,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&An(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&bD(t,o,ED(o)),o&&wD(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Jn(r),ze(o,["bpmn:Event","bpmn:Gateway"])&&Mx(t,Jn(o)),ze(o,["bpmn:Task","bpmn:SubProcess"])&&_D(t,o),w(a,"bpmn:BoundaryEvent")&&s===a.host&&xD(t)):kx(i,"bpmn:MessageFlow")?(w(r,"bpmn:Event")&&(n.connectionStart=Jn(r)),w(o,"bpmn:Event")&&Mx(t,Jn(o))):n.connectionStart=n.initialConnectionStart)})}Tx.$inject=["eventBus"];function bD(e,t,n){Ax.forEach(function(i){var r=Ox(i,t);e[i]<t[i]+n?It(e,i,t[i]+n):e[i]>t[i]+r-n&&It(e,i,t[i]+r-n)})}function _D(e,t){var n=Jn(t);Ax.forEach(function(i){SD(e,t,i)&&It(e,i,n[i])})}function xD(e){var t=e.context,n=t.source,i=t.target;if(!RD(t)){var r=Jn(n),o=Qt(r,i,-10),a=[];/top|bottom/.test(o)&&a.push("x"),/left|right/.test(o)&&a.push("y"),a.forEach(function(s){var c=e[s],u;vD(c-r[s])<Qf&&(c>r[s]?u=r[s]+Qf:u=r[s]-Qf,It(e,s,u))})}}function Mx(e,t){It(e,"x",t.x),It(e,"y",t.y)}function kx(e,t){return e&&e.type===t}function wD(e,t){return qi(t,function(n){return kx(e,n)})}function Ox(e,t){return e==="x"?t.width:t.height}function ED(e){return w(e,"bpmn:Task")?yD:gD}function SD(e,t,n){return e[n]>t[n]+Px&&e[n]<t[n]+Ox(n,t)-Px}function RD(e){var t=e.hover,n=e.source;return t&&n&&t===n}function Er(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}Er.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},Er.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},Er.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},Er.prototype.getSnapLocations=function(){return this._snapLocations},Er.prototype.setSnapLocations=function(e){this._snapLocations=e},Er.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new Eu,n.initDefaults(this._defaultSnaps)),n};function Eu(){this._snapValues={}}Eu.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)},Eu.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&dk(e[n],r[n],i)},Eu.prototype.initDefaults=function(e){var t=this;I(e||{},function(n,i){I(n,function(r){t.add(i,r)})})};var CD=1250;function Ri(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"],CD,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&An(r.originalEvent))&&!(Ho(r)||!c)){var u=s.pointsForTarget(c);u.initialized||(u=i.addSnapTargetPoints(u,a,c),u.initialized=!0),n.snap(r,u)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){n.hide()})}Ri.$inject=["elementRegistry","eventBus","snapping"],Ri.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new Er);var o;t.get(i.id)?o=Jn(i,e):o={x:e.x+Jn(i).x,y:e.y+Jn(i).y};var a={x:o.x-i.width/2,y:o.y-i.height/2},s={x:o.x+i.width/2,y:o.y+i.height/2};return r.setSnapOrigin("mid",{x:o.x-e.x,y:o.y-e.y}),je(i)||(r.setSnapOrigin("top-left",{x:a.x-e.x,y:a.y-e.y}),r.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),r},Ri.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return I(i,function(r){if(je(r)){je(t)&&e.add("mid",Jn(r));return}if(ot(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);I(o,function(a){e.add("mid",a)});return}e.add("mid",Jn(r))}),!Ie(t.x)||!Ie(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Jn(t)),e},Ri.prototype.getSnapTargets=function(e,t){return v_(t).filter(function(n){return!PD(n)})};function PD(e){return!!e.hidden}var Dx=1500;function Vo(e,t){t.invoke(Ri,this),e.on(["create.move","create.end"],Dx,kD),e.on(["create.move","create.end","shape.move.move","shape.move.end"],Dx,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!Ho(n)&&AD(n,o)})}ye(Vo,Ri),Vo.$inject=["eventBus","injector"],Vo.prototype.initSnap=function(e){var t=Ri.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return I(n.outgoing,function(r){var o=r.waypoints[0];o=o.original||o,t.setSnapOrigin(r.id+"-docking",Ix(o,i,e))}),I(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",Ix(o,i,e))}),w(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Vo.prototype.addSnapTargetPoints=function(e,t,n){Ri.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);I(i,function(o){(MD(o)||TD([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",g_(o)),e.add("bottom-right",y_(o)))});var r=this._elementRegistry;return I(t.incoming,function(o){if(r.get(t.id)){Lx(i,o.source)||e.add("mid",De(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),I(t.outgoing,function(o){if(r.get(t.id)){Lx(i,o.target)||e.add("mid",De(o.target));var a=o.waypoints[o.waypoints.length-1];e.add(o.id+"-docking",a.original||a)}}),w(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},Vo.prototype.getSnapTargets=function(e,t){return Ri.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!w(n,"bpmn:Lane")})};function AD(e,t){var n=Te(t),i=Xg(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=De(o),/top/.test(i)?It(e,"y",n.top-a.y):/bottom/.test(i)&&It(e,"y",n.bottom-a.y),/left/.test(i)?It(e,"x",n.left-a.x):/right/.test(i)&&It(e,"x",n.right-a.x)}function TD(e,t){return e.every(function(n){return w(n,t)})}function MD(e){return w(e,"bpmn:SubProcess")&&Ue(e)?!0:w(e,"bpmn:Participant")}function kD(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)&&It(e,"x",e.x),(i&&i>=e.y||o&&o<=e.y)&&It(e,"y",e.y)}}function Lx(e,t){return e.indexOf(t)!==-1}function Ix(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var OD=1250;function Qa(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],OD,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&An(i.originalEvent))&&!Ho(i)){var u=c.pointsForTarget(a);u.initialized||(u=n.addSnapTargetPoints(u,o,a,s),u.initialized=!0),ID(s)&&It(i,"x",i.x),BD(s)&&It(i,"y",i.y),t.snap(i,u)}}),e.on(["resize.cleanup"],function(){t.hide()})}Qa.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new Er);var o=Bx(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},Qa.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return I(r,function(o){e.add("corner",y_(o)),e.add("corner",g_(o))}),e.add("corner",Bx(t,i)),e},Qa.$inject=["eventBus","snapping"],Qa.prototype.getSnapTargets=function(e,t){return v_(t).filter(function(n){return!DD(n,e)&&!ot(n)&&!LD(n)&&!je(n)})};function Bx(e,t){var n=De(e),i=Te(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 DD(e,t){return e.host===t}function LD(e){return!!e.hidden}function ID(e){return e==="n"||e==="s"}function BD(e){return e==="e"||e==="w"}var ND=7,$D=1e3;function Sr(e){this._canvas=e,this._asyncHide=Iu(vn(this.hide,this),$D)}Sr.$inject=["canvas"],Sr.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:Ho(e,"x"),y:Ho(e,"y")};I(r,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(I(["x","y"],function(u){var l;o[u]||(l=t.snap(c,a,u,ND),l!==void 0&&(o[u]={value:l,originValue:l-s[u]}))}),o.x&&o.y)return!1}),this.showSnapLine("vertical",o.x&&o.x.value),this.showSnapLine("horizontal",o.y&&o.y.value),I(["x","y"],function(a){var s=o[a];Wt(s)&&It(e,a,s.originValue)})},Sr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=Ae("path");return ve(n,{d:"M0,0 L0,0"}),Ye(n).add("djs-snap-line"),Ne(t,n),{update:function(i){Ie(i)?e==="horizontal"?ve(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):ve(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):ve(n,{display:"none"})}}},Sr.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Sr.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},Sr.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Sr.prototype.hide=function(){I(this._snapLines,function(e){e.update()})};const FD={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",Ri],resizeSnapping:["type",Qa],snapping:["type",Sr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",Tx],createMoveSnapping:["type",Vo]};var Nx=300;function $e(e,t,n,i){this._open=!1,this._results={},this._eventMaps=[],this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._canvas=e,this._eventBus=t,this._selection=n,this._translate=i,this._container=this._getBoxHtml(),this._searchInput=rt($e.INPUT_SELECTOR,this._container),this._resultsContainer=rt($e.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}$e.$inject=["canvas","eventBus","selection","translate"],$e.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:Rn.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,$e.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,$e.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,$e.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,$e.INPUT_SELECTOR,"keydown",function(n){jt("ArrowUp",n)&&n.preventDefault(),jt("ArrowDown",n)&&n.preventDefault()}),t(this._container,$e.INPUT_SELECTOR,"keyup",function(n){if(jt("Escape",n))return e.close();if(jt("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(jt("ArrowUp",n))return e._scrollToDirection(!0);if(jt("ArrowDown",n))return e._scrollToDirection();jt(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},$e.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){Rn.unbind(e.el,e.type,e.listener)})},$e.prototype._search=function(e){var t=this;if(this._clearResults(),!!e.trim()){var n=this._searchProvider.find(e);if(n=n.filter(function(r){return!t._canvas.getRootElements().includes(r.element)}),!n.length){this._selection.select(null);return}n.forEach(function(r){var o=r.element.id,a=t._createResultNode(r,o);t._results[o]={element:r.element,node:a}});var i=rt($e.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},$e.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},$e.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)}},$e.prototype._clearResults=function(){xs(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},$e.prototype._getCurrentResult=function(){return rt($e.RESULT_SELECTED_SELECTOR,this._resultsContainer)},$e.prototype._createResultNode=function(e,t){var n=ht($e.RESULT_HTML);return e.primaryTokens.length>0&&$x(n,e.primaryTokens,$e.RESULT_PRIMARY_HTML),$x(n,e.secondaryTokens,$e.RESULT_SECONDARY_HTML),sn(n,$e.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},$e.prototype.registerProvider=function(e){this._searchProvider=e},$e.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,vt(this._canvas.getContainer()).add("djs-search-open"),vt(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},$e.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,vt(this._canvas.getContainer()).remove("djs-search-open"),vt(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},$e.prototype.toggle=function(){this.isOpen()?this.close():this.open()},$e.prototype.isOpen=function(){return this._open},$e.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&vt(t).remove($e.RESULT_SELECTED_CLASS);var n=sn(e,$e.RESULT_ID_ATTRIBUTE),i=this._results[n].element;vt(e).add($e.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:Nx}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},$e.prototype._select=function(e){var t=sn(e,$e.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:Nx}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},$e.prototype._getBoxHtml=function(){const e=ht($e.BOX_HTML),t=rt($e.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function $x(e,t,n){var i=jD(t),r=ht(n);r.innerHTML=i,e.appendChild(r)}function jD(e){var t="";return e.forEach(function(n){var i=Uv(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+$e.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}$e.CONTAINER_SELECTOR=".djs-search-container",$e.INPUT_SELECTOR=".djs-search-input input",$e.RESULTS_CONTAINER_SELECTOR=".djs-search-results",$e.RESULT_SELECTOR=".djs-search-result",$e.RESULT_SELECTED_CLASS="djs-search-result-selected",$e.RESULT_SELECTED_SELECTOR="."+$e.RESULT_SELECTED_CLASS,$e.RESULT_ID_ATTRIBUTE="data-result-id",$e.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",$e.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>`,je.RESULT_HTML='<div class="djs-search-result"></div>',je.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',je.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const ND={__depends__:[ca,Fc,Xn],searchPad:["type",je]};function Qf(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}Qf.$inject=["elementRegistry","searchPad","canvas","search"],Qf.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!Ge(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:Hn(i),id:i.id})),e,{keys:["label","id"]}).map($D)};function $D(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const FD={__depends__:[ND,Kb],__init__:["bpmnSearch"],bpmnSearch:["type",Qf]},jD="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",HD="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",zD={width:36,height:50},GD={width:50,height:50};function $x(e,t,n){return Pe("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const ni=5;function Su(e,t){this._styles=t,e.registerProvider(this)}Su.$inject=["outline","styles"],Su.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(dR(e))return n=Pe("rect"),ve(n,V({x:-ni,y:-ni,rx:4,width:e.width+ni*2,height:e.height+ni*2},t)),n;if(!Ge(e))return w(e,"bpmn:Gateway")?(n=Pe("rect"),V(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),ve(n,V({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):We(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=Pe("rect"),ve(n,V({x:-ni,y:-ni,rx:14,width:e.width+ni*2,height:e.height+ni*2},t))):w(e,"bpmn:EndEvent")?(n=Pe("circle"),ve(n,V({cx:e.width/2,cy:e.height/2,r:e.width/2+ni+1},t))):w(e,"bpmn:Event")?(n=Pe("circle"),ve(n,V({cx:e.width/2,cy:e.height/2,r:e.width/2+ni},t))):w(e,"bpmn:DataObjectReference")&&Fx(e,"bpmn:DataObjectReference")?n=$x(jD,{x:-6,y:-6},t):w(e,"bpmn:DataStoreReference")&&Fx(e,"bpmn:DataStoreReference")&&(n=$x(HD,{x:-6,y:-6},t)),n},Su.prototype.updateOutline=function(e,t){if(!Ge(e))return We(e,["bpmn:SubProcess","bpmn:Group"])?(ve(t,{width:e.width+ni*2,height:e.height+ni*2}),!0):!!We(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function Fx(e,t){var n;return t==="bpmn:DataObjectReference"?n=zD:t==="bpmn:DataStoreReference"&&(n=GD),e.width===n.width&&e.height===n.height}const VD={__depends__:[zf],__init__:["outlineProvider"],outlineProvider:["type",Su]};var WD='<?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 Si(e){fo.call(this,e)}ye(Si,fo),Si.Viewer=gr,Si.NavigatedViewer=Ia,Si.prototype.createDiagram=function(){return this.importXML(WD)},Si.prototype._interactionModules=[Qv,eb,ib],Si.prototype._modelingModules=[q2,Nc,Q2,X2,pk,Nf,yk,zk,zy,mc,Uk,Kk,pO,dO,hO,bO,kO,BO,uf,GO,ZO,cD,lD,J_,ID,FD,VD],Si.prototype._modules=[].concat(gr.prototype._modules,Si.prototype._interactionModules,Si.prototype._modelingModules);const UD=((e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n})(Mt.defineComponent({__name:"BpmnModelerView",props:{xml:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,r=n,o=Mt.ref();let a;async function s(u){if(!a)throw new Error("modeler not mounted");try{const{warnings:l}=await a.importXML(u),f=Yu(l);return r("imported",f),{warnings:f}}catch(l){throw r("import-error",l),l}}async function c(){if(!a)throw new Error("modeler not mounted");const{xml:u}=await a.saveXML({format:!0});return u??""}return Mt.onMounted(async()=>{a=new Si({container:o.value,moddleExtensions:cs}),i.xml&&await s(i.xml),r("ready")}),Mt.watch(()=>i.xml,u=>{u&&a&&s(u)}),Mt.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(u,l)=>(Mt.openBlock(),Mt.createElementBlock("div",{ref_key:"container",ref:o,class:"bpmn-modeler-view"},null,512))}}),[["__scopeId","data-v-a9b41c97"]]);ae.APPLY_BPMN_OPS_SCHEMA=j0,ae.BPMN_MODDLE_EXTENSIONS=cs,ae.BWL_MODDLE_SCHEMA=ad,ae.BWL_NS=od,ae.BWL_PREFIX=Tu,ae.BWL_SIDES=Mu,ae.BpmnModelerView=UD,ae.EDITOR=f1,ae.FLOW_LABEL_INDENT=jd,ae.HEADLESS_BPMN_MODULES=zv,ae.HEADLESS_TEXT_METRICS=io,ae.I18N_NS=vE,ae.I18N_PREFIX=kd,ae.LABEL_FORK_MARGIN=Qu,ae.MVP_FLOW_NODE_TYPES=Ri,ae.SYMBOLIC_OP_KINDS=ud,ae.SYMBOLIC_OP_SCHEMA=ld,ae.UNDO_EPISODE_COMMAND=ku,ae.applyBpmnOpBatch=Ih,ae.applyBpmnOps=kh,ae.approximateTextWidth=ro,ae.auditBpmnGeometry=Zd,ae.auditBpmnGeometryXml=zE,ae.auditGeometry=Vn,ae.auditTargetsOf=Gn,ae.axisSegmentsOf=dn,ae.blackBoxNameRect=Xu,ae.buildBpmnOpBatch=p1,ae.buildRegistryIndex=Jd,ae.containerBoundarySegments=Ko,ae.createBpmnEditorController=d1,ae.createBpmnModdle=Od,ae.createHeadlessBpmnModeler=DM,ae.crossedShapesOf=hn,ae.crossingCost=$n,ae.describeProcess=Lh,ae.describeProcessXml=l1,ae.edgeCrossCount=ds,ae.edgeCrossingPairsOf=el,ae.edgeCrossingStatsOf=Wd,ae.executeAsUndoEpisode=cd,ae.forwardThreePointCandidates=il,ae.geometryFindingKey=ri,ae.installHeadlessBpmnDom=Ld,ae.isEdgeOverlapFinding=Zu,ae.isMvpFlowNodeType=rd,ae.labelRectsOf=so,ae.lineCrossesLabel=Pi,ae.lineThroughLabel=zd,ae.lineThroughShapeLabel=Kd,ae.loadBpmnXml=qu,ae.lowerOps=Mh,ae.oppositeOverlapCount=ME,ae.oppositeOverlapOf=Fd,ae.planBackEdgeBoundaryClearance=lh,ae.planCrossPoolRoute=sh,ae.planEdgeRepair=rh,ae.planLabelLineClearance=_h,ae.planLabelPlacement=bh,ae.planMiddleSegmentShifts=th,ae.planOppositeOverlapRepair=fh,ae.planSegmentDetours=nl,ae.planShapeLabelClearance=Eh,ae.repairIntroducedBoundaryHugging=ph,ae.repairIntroducedCrossings=oh,ae.repairIntroducedFakeMerges=hh,ae.repairIntroducedLabelLines=xh,ae.repairIntroducedOppositeOverlaps=vh,ae.repairIntroducedShapeLabelLines=Sh,ae.repairIntroducedSharedSegmentLabels=wh,ae.rerouteIntroducedCrossPoolEdges=ch,ae.resolverServicesOf=Ah,ae.saveBpmnXml=bE,ae.sceneCrossingCost=Vd,ae.sceneFromDefinitions=Xd,ae.sceneFromRegistry=ft,ae.sharedSegmentUnderLabel=fs,ae.sharedSpansOf=ps,ae.unreadableOverlapCount=Nn,ae.unreadableOverlapOf=oo,ae.validateOps=Ph,ae.warningMessages=Yu,Object.defineProperty(ae,Symbol.toStringTag,{value:"Module"})}));
343
+ </div>`,$e.RESULT_HTML='<div class="djs-search-result"></div>',$e.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',$e.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const HD={__depends__:[la,Fc,Xn],searchPad:["type",$e]};function Jf(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}Jf.$inject=["elementRegistry","searchPad","canvas","search"],Jf.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!je(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:$n(i),id:i.id})),e,{keys:["label","id"]}).map(zD)};function zD(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const GD={__depends__:[HD,Xb],__init__:["bpmnSearch"],bpmnSearch:["type",Jf]},VD="M44.7648 11.3263L36.9892 2.64074C36.0451 1.58628 34.5651 0.988708 33.1904 0.988708H5.98667C3.22688 0.988708 0.989624 3.34892 0.989624 6.26039V55.0235C0.989624 57.9349 3.22688 60.2952 5.98667 60.2952H40.966C43.7257 60.2952 45.963 57.9349 45.963 55.0235V14.9459C45.963 13.5998 45.6407 12.3048 44.7648 11.3263Z",WD="M1.03845 48.1347C1.03845 49.3511 1.07295 50.758 1.38342 52.064C1.69949 53.3938 2.32428 54.7154 3.56383 55.6428C6.02533 57.4841 10.1161 58.7685 14.8212 59.6067C19.5772 60.4538 25.1388 60.8738 30.6831 60.8738C36.2276 60.8738 41.7891 60.4538 46.545 59.6067C51.2504 58.7687 55.3412 57.4842 57.8028 55.6429C59.0424 54.7156 59.6673 53.3938 59.9834 52.064C60.2938 50.7579 60.3285 49.351 60.3285 48.1344V13.8415C60.3285 12.6249 60.2938 11.218 59.9834 9.91171C59.6673 8.58194 59.0423 7.2602 57.8027 6.33294C55.341 4.49168 51.2503 3.20723 46.545 2.36914C41.7891 1.522 36.2276 1.10204 30.6831 1.10205C25.1388 1.10206 19.5772 1.52206 14.8213 2.36923C10.1162 3.20734 6.02543 4.49183 3.5639 6.33314C2.32433 7.26038 1.69951 8.58206 1.38343 9.91181C1.07295 11.2179 1.03845 12.6247 1.03845 13.8411V48.1347Z",UD={width:36,height:50},qD={width:50,height:50};function Fx(e,t,n){return Ae("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const ni=5;function Su(e,t){this._styles=t,e.registerProvider(this)}Su.$inject=["outline","styles"],Su.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(yR(e))return n=Ae("rect"),ve(n,V({x:-ni,y:-ni,rx:4,width:e.width+ni*2,height:e.height+ni*2},t)),n;if(!je(e))return w(e,"bpmn:Gateway")?(n=Ae("rect"),V(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),ve(n,V({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):ze(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=Ae("rect"),ve(n,V({x:-ni,y:-ni,rx:14,width:e.width+ni*2,height:e.height+ni*2},t))):w(e,"bpmn:EndEvent")?(n=Ae("circle"),ve(n,V({cx:e.width/2,cy:e.height/2,r:e.width/2+ni+1},t))):w(e,"bpmn:Event")?(n=Ae("circle"),ve(n,V({cx:e.width/2,cy:e.height/2,r:e.width/2+ni},t))):w(e,"bpmn:DataObjectReference")&&jx(e,"bpmn:DataObjectReference")?n=Fx(VD,{x:-6,y:-6},t):w(e,"bpmn:DataStoreReference")&&jx(e,"bpmn:DataStoreReference")&&(n=Fx(WD,{x:-6,y:-6},t)),n},Su.prototype.updateOutline=function(e,t){if(!je(e))return ze(e,["bpmn:SubProcess","bpmn:Group"])?(ve(t,{width:e.width+ni*2,height:e.height+ni*2}),!0):!!ze(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function jx(e,t){var n;return t==="bpmn:DataObjectReference"?n=UD:t==="bpmn:DataStoreReference"&&(n=qD),e.width===n.width&&e.height===n.height}const YD={__depends__:[Gf],__init__:["outlineProvider"],outlineProvider:["type",Su]};var KD='<?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 Ci(e){go.call(this,e)}ye(Ci,go),Ci.Viewer=yr,Ci.NavigatedViewer=Na,Ci.prototype.createDiagram=function(){return this.importXML(KD)},Ci.prototype._interactionModules=[Jv,tb,rb],Ci.prototype._modelingModules=[Z2,Nc,nk,ek,mk,$f,xk,Uk,Gy,mc,Xk,Jk,mO,yO,vO,EO,IO,jO,lf,qO,tD,fD,hD,ex,FD,GD,YD],Ci.prototype._modules=[].concat(yr.prototype._modules,Ci.prototype._interactionModules,Ci.prototype._modelingModules);const XD=((e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n})(Mt.defineComponent({__name:"BpmnModelerView",props:{xml:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,r=n,o=Mt.ref();let a;async function s(u){if(!a)throw new Error("modeler not mounted");try{const{warnings:l}=await a.importXML(u),f=Ku(l);return r("imported",f),{warnings:f}}catch(l){throw r("import-error",l),l}}async function c(){if(!a)throw new Error("modeler not mounted");const{xml:u}=await a.saveXML({format:!0});return u??""}return Mt.onMounted(async()=>{a=new Ci({container:o.value,moddleExtensions:us}),i.xml&&await s(i.xml),r("ready")}),Mt.watch(()=>i.xml,u=>{u&&a&&s(u)}),Mt.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(u,l)=>(Mt.openBlock(),Mt.createElementBlock("div",{ref_key:"container",ref:o,class:"bpmn-modeler-view"},null,512))}}),[["__scopeId","data-v-a9b41c97"]]);oe.APPLY_BPMN_OPS_SCHEMA=G0,oe.BPMN_MODDLE_EXTENSIONS=us,oe.BWL_MODDLE_SCHEMA=sd,oe.BWL_NS=ad,oe.BWL_PREFIX=Mu,oe.BWL_SIDES=ku,oe.BpmnModelerView=XD,oe.EDITOR=g1,oe.FLOW_LABEL_INDENT=Hd,oe.HEADLESS_BPMN_MODULES=Gv,oe.HEADLESS_TEXT_METRICS=oo,oe.I18N_NS=xE,oe.I18N_PREFIX=Od,oe.LABEL_FORK_MARGIN=Ju,oe.MVP_FLOW_NODE_TYPES=Pi,oe.SYMBOLIC_OP_KINDS=ld,oe.SYMBOLIC_OP_SCHEMA=pd,oe.UNDO_EPISODE_COMMAND=Ou,oe.applyBpmnOpBatch=Bh,oe.applyBpmnOps=Oh,oe.approximateTextWidth=ao,oe.auditBpmnGeometry=Qd,oe.auditBpmnGeometryXml=WE,oe.auditGeometry=Vn,oe.auditTargetsOf=Gn,oe.axisSegmentsOf=fn,oe.blackBoxNameRect=Zu,oe.buildBpmnOpBatch=m1,oe.buildRegistryIndex=eh,oe.containerBoundarySegments=Zo,oe.createBpmnEditorController=y1,oe.createBpmnModdle=Dd,oe.createHeadlessBpmnModeler=NM,oe.crossedShapesOf=dn,oe.crossingCost=In,oe.describeProcess=Ih,oe.describeProcessXml=h1,oe.edgeCrossCount=hs,oe.edgeCrossingPairsOf=tl,oe.edgeCrossingStatsOf=Ud,oe.executeAsUndoEpisode=ud,oe.forwardThreePointCandidates=rl,oe.geometryFindingKey=oi,oe.installHeadlessBpmnDom=Id,oe.isEdgeOverlapFinding=Qu,oe.isMvpFlowNodeType=od,oe.labelRectsOf=uo,oe.lineCrossesLabel=Ti,oe.lineThroughLabel=Gd,oe.lineThroughShapeLabel=Xd,oe.loadBpmnXml=Yu,oe.lowerOps=kh,oe.oppositeOverlapCount=DE,oe.oppositeOverlapOf=jd,oe.planBackEdgeBoundaryClearance=ph,oe.planCrossPoolRoute=ch,oe.planEdgeRepair=oh,oe.planLabelLineClearance=xh,oe.planLabelPlacement=_h,oe.planMiddleSegmentShifts=nh,oe.planOppositeOverlapRepair=dh,oe.planSegmentDetours=il,oe.planShapeLabelClearance=Sh,oe.repairIntroducedBoundaryHugging=fh,oe.repairIntroducedCrossings=ah,oe.repairIntroducedFakeMerges=mh,oe.repairIntroducedLabelLines=wh,oe.repairIntroducedOppositeOverlaps=bh,oe.repairIntroducedShapeLabelLines=Rh,oe.repairIntroducedSharedSegmentLabels=Eh,oe.rerouteIntroducedCrossPoolEdges=uh,oe.resolverServicesOf=Th,oe.saveBpmnXml=wE,oe.sceneCrossingCost=Wd,oe.sceneFromDefinitions=Zd,oe.sceneFromRegistry=pt,oe.sharedSegmentUnderLabel=ds,oe.sharedSpansOf=fs,oe.unreadableOverlapCount=Ln,oe.unreadableOverlapOf=so,oe.validateOps=Ah,oe.warningMessages=Ku,Object.defineProperty(oe,Symbol.toStringTag,{value:"Module"})}));