@g1cloud/bpmn-modeler-next 5.0.0-alpha.26 → 5.0.0-alpha.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,14 +1,14 @@
1
- (function(J,Ct){typeof exports=="object"&&typeof module<"u"?Ct(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],Ct):(J=typeof globalThis<"u"?globalThis:J||self,Ct(J.BpmnModeler={},J.Vue))})(this,(function(J,Ct){"use strict";var qD=Object.defineProperty;var KD=(J,Ct,wi)=>Ct in J?qD(J,Ct,{enumerable:!0,configurable:!0,writable:!0,value:wi}):J[Ct]=wi;var Kr=(J,Ct,wi)=>KD(J,typeof Ct!="symbol"?Ct+"":Ct,wi);const wi=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway"];function Nf(e){return wi.includes(e)}const Bf="http://g1project.net/spec/bpmn/bwl/1.0",bu="bwl",xu=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],$f={name:"bwl-hints",uri:Bf,prefix:bu,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"}]}]},wu="bwl.undoEpisode",jf=new WeakSet;function Px(e){jf.has(e)||(e.register(wu,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),jf.add(e))}function Ff(e,t){Px(e);const n={run:t};if(e.execute(wu,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const Hf=["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"],Ax={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},Tx={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},Mx={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},kx={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다.",properties:{id:{type:"string"},type:{type:"string",enum:[...wi]},name:{type:"string"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},Dx={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},Ox={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},Lx={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"}},required:["id","source","target"],additionalProperties:!1},Ix={type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},Nx={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},Bx={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},$x={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},jx={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},Fx={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...xu]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function nn(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const Hx={"participant.add":nn("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":nn("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":nn("node.add",{description:'플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 갈래 1, 2…) — 위/아래가 아니라 "주 흐름에서 몇 번째 갈래"다. 행 배치(어느 갈래가 위/아래인지)는 호스트가 정한다(대칭·메시지 방향). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.',properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["node"]}),"node.update":nn("node.update",{description:"노드 이름/레인/타입 갱신. lane = 레인 재배정(이동), type = 태스크·이벤트 타입 전환.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lane:{type:"string"},type:{type:"string",enum:[...wi]}},required:["id"]}),"sequenceFlow.add":nn("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":nn("sequenceFlow.update",{description:"시퀀스 플로우 이름/조건/끝점 갱신. condition: null = 조건 제거. source/target = 끝점 재배선 — 중간 삽입은 기존 플로우를 지우지 말고 이것으로 한쪽 끝을 옮긴 뒤 새 플로우를 추가한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},condition:{description:"생략 = 보존, null = 제거.",anyOf:[{$ref:"#/$defs/irFlowCondition"},{type:"null"}]},source:{description:"새 출발 노드 id(생략 = 보존). 같은 배치에서 추가한 노드도 지목할 수 있다.",type:"string"},target:{description:"새 도착 노드 id(생략 = 보존). 같은 배치에서 추가한 노드도 지목할 수 있다.",type:"string"}},required:["id"]}),"messageFlow.add":nn("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":nn("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataStore.add":nn("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":nn("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataAssociation.add":nn("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":nn("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":nn("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":nn("annotation.update",{description:"주석 본문/방위 힌트 갱신. placement: null = 힌트 제거(휴리스틱 복귀). 주석 삭제는 element.remove.",properties:{id:{type:"string"},text:{type:"string"},placement:{description:"생략 = 보존, null = 힌트 제거.",anyOf:[{$ref:"#/$defs/bwlPlacement"},{type:"null"}]}},required:["id"]}),"group.add":nn("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":nn("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"element.remove":nn("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},zf={anyOf:Hf.map(e=>Hx[e])},zx={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:Tx,irParticipant:Mx,irNode:kx,irFlowCondition:Dx,irSequenceFlow:Ox,irMessageFlow:Lx,irDataStore:Ix,irDataAssociation:Nx,irTextAnnotation:Bx,irAssociation:$x,irGroup:jx,bwlPlacement:Fx,nullableString:Ax,symbolicOp:zf}};function Eu(e){return Array.prototype.concat.apply([],e)}const jo=Object.prototype.toString,Vx=Object.prototype.hasOwnProperty;function Sr(e){return e===void 0}function $t(e){return e!==void 0}function Xr(e){return e==null}function _e(e){return jo.call(e)==="[object Array]"}function Gt(e){return jo.call(e)==="[object Object]"}function we(e){return jo.call(e)==="[object Number]"}function Wt(e){const t=jo.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function xn(e){return jo.call(e)==="[object String]"}function Gx(e){if(!_e(e))throw new Error("must supply array")}function wn(e,t){return!Xr(e)&&Vx.call(e,t)}function st(e,t){const n=Xa(t);let i;return M(e,function(r,o){if(n(r,o))return i=r,!1}),i}function Vf(e,t){const n=Xa(t);let i=_e(e)?-1:void 0;return M(e,function(r,o){if(n(r,o))return i=o,!1}),i}function Oe(e,t){const n=Xa(t);let i=[];return M(e,function(r,o){n(r,o)&&i.push(r)}),i}function M(e,t){let n,i;if(Sr(e))return;const r=_e(e)?Kx:qx;for(let o in e)if(wn(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function Wx(e,t){if(Sr(e))return[];Gx(e);const n=Xa(t);return e.filter(function(i,r){return!n(i,r)})}function En(e,t,n){return M(e,function(i,r){n=t(n,i,r)}),n}function Rr(e,t){return!!En(e,function(n,i,r){return n&&t(i,r)},!0)}function Vi(e,t){return!!st(e,t)}function rn(e,t){let n=[];return M(e,function(i,r){n.push(t(i,r))}),n}function Ka(e){return e&&Object.keys(e)||[]}function Ux(e){return Ka(e).length}function Zr(e){return rn(e,t=>t)}function Qr(e,t,n={}){return t=Su(t),M(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function Gf(e,...t){e=Su(e);let n={};return M(t,r=>Qr(r,e,n)),rn(n,function(r,o){return r[0]})}const Yx=Gf;function oi(e,t){t=Su(t);let n=[];return M(e,function(i,r){let o=t(i,r),a={d:o,v:i};for(var c=0;c<n.length;c++){let{d:s}=n[c];if(o<s){n.splice(c,0,a);return}}n.push(a)}),rn(n,i=>i.v)}function Jr(e){return function(t){return Rr(e,function(n,i){return t[i]===n})}}function Su(e){return Wt(e)?e:t=>t[e]}function Xa(e){return Wt(e)?e:t=>t===e}function qx(e){return e}function Kx(e){return Number(e)}function Ru(e,t){let n,i,r,o;function a(p){let f=Date.now(),d=p?0:o+t-f;if(d>0)return c(d);e.apply(r,i),s()}function c(p){n=setTimeout(a,p)}function s(){n&&clearTimeout(n),n=o=i=r=void 0}function u(){n&&a(!0),s()}function l(...p){o=Date.now(),i=p,r=this,n||c(t)}return l.flush=u,l.cancel=s,l}function vn(e,t){return e.bind(t)}function O(e,...t){return Object.assign(e,...t)}function Xx(e,t,n){let i=e;return M(t,function(r,o){if(typeof r!="number"&&typeof r!="string")throw new Error("illegal key type: "+typeof r+". Key should be of type number or string.");if(r==="constructor")throw new Error("illegal key: constructor");if(r==="__proto__")throw new Error("illegal key: __proto__");let a=t[o+1],c=i[r];$t(a)&&Xr(c)&&(c=i[r]=isNaN(+a)?{}:[]),Sr(a)?Sr(n)?delete i[r]:i[r]=n:i=c}),e}function ni(e,t){let n={},i=Object(e);return M(t,function(r){r in i&&(n[r]=e[r])}),n}function ai(e,t){let n={},i=Object(e);return M(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function Cu(){}Cu.prototype.get=function(e){return this.$model.properties.get(this,e)},Cu.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function Wf(e,t){this.model=e,this.properties=t}Wf.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Cu.prototype);M(e.properties,function(a){!a.isMany&&a.default!==void 0&&(i[a.name]=a.default)}),n.defineModel(i,t),n.defineDescriptor(i,e);var r=e.ns.name;function o(a){n.define(this,"$type",{value:r,enumerable:!0}),n.define(this,"$attrs",{value:{}}),n.define(this,"$parent",{writable:!0}),M(a,vn(function(c,s){this.set(s,c)},this))}return o.prototype=i,o.hasType=i.$instanceOf=this.model.hasType,n.defineModel(o,t),n.defineDescriptor(o,e),o};var Zx=O(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),Uf=O(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 Pu(e,t){var n=Uf[e];return n?n(t):t}function Au(e){return!!Zx[e]}function Yf(e){return!!Uf[e]}function on(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 Nn(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}Nn.prototype.build=function(){return ni(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},Nn.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)},Nn.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 c=r.indexOf(e);if(c===-1)throw new Error("property <"+i.name+"> not found in property list");r.splice(c,1),this.addProperty(t,n?void 0:c,a),o[i.name]=o[i.localName]=t},Nn.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=on(r[0],i),a=on(r[1],o.prefix).name,c=this.propertiesByName[a];if(c)this.replaceProperty(c,e,n);else throw new Error("refined property <"+a+"> not found");delete e.redefines},Nn.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},Nn.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},Nn.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},Nn.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},Nn.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},Nn.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")},Nn.prototype.hasProperty=function(e){return this.propertiesByName[e]},Nn.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(M(e.properties,vn(function(o){o=O({},o,{name:o.ns.localName,inherited:t}),Object.defineProperty(o,"definedBy",{value:e});var a=o.replaces,c=o.redefines;a||c?this.redefineProperty(o,a||c,a):(o.isBody&&this.setBodyProperty(o),o.isId&&this.setIdProperty(o),this.addProperty(o))},this)),i.push(e),n[r]=e)};function Gi(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,M(e,vn(this.registerPackage,this))}Gi.prototype.getPackage=function(e){return this.packageMap[e]},Gi.prototype.getPackages=function(){return this.packages},Gi.prototype.registerPackage=function(e){e=O({},e);var t=this.packageMap;qf(t,e,"prefix"),qf(t,e,"uri"),M(e.types,vn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Gi.prototype.registerType=function(e,t){e=O({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:O({},e.meta||{})});var n=on(e.name,t.prefix),i=n.name,r=Object.create(null);M(e.properties,vn(function(o){var a=on(o.name,n.prefix),c=a.name;Au(o.type)||(o.type=on(o.type,a.prefix).name),O(o,{ns:a,name:c}),r[c]=o},this)),O(e,{ns:n,name:i,propertiesByName:r}),M(e.extends,vn(function(o){var a=on(o,n.prefix),c=this.typeMap[a.name];c.traits=c.traits||[],c.traits.push(i)},this)),this.definePackage(e,t),this.typeMap[i]=e},Gi.prototype.mapTypes=function(e,t,n){var i=Au(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(s,u){var l=on(s,Au(s)?"":e.prefix);r.mapTypes(l,t,u)}function a(s){return o(s,!0)}function c(s){return o(s,!1)}if(!i)throw new Error("unknown type <"+e.name+">");M(i.superClass,n?a:c),t(i,!n),M(i.traits,a)},Gi.prototype.getEffectiveDescriptor=function(e){var t=on(e),n=new Nn(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},Gi.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function qf(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(!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;Qx(n)?i?delete e[r]:delete e.$attrs[Tu(t)]:i?r in e?e[r]=n:Kf(e,i,n):e.$attrs[Tu(t)]=n},Cr.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[Tu(t)];var i=n.name;return!e[i]&&n.isMany&&Kf(e,n,[]),e[i]},Cr.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=O({},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 Qx(e){return typeof e>"u"}function Kf(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Tu(e){return e.replace(/^:/,"")}function Hn(e,t={}){this.properties=new Cr(this),this.factory=new Wf(this,this.properties),this.registry=new Gi(e,this.properties),this.typeCache=Object.create(null),this.config=t}Hn.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},Hn.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},Hn.prototype.createAny=function(e,t,n){var i=on(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,c){Xx(this,[a],c)}},o={name:e,isGeneric:!0,ns:{prefix:i.prefix,localName:i.localName,uri:t}};return this.properties.defineDescriptor(r,o),this.properties.defineModel(r,this),this.properties.define(r,"get",{enumerable:!1,writable:!0}),this.properties.define(r,"set",{enumerable:!1,writable:!0}),this.properties.define(r,"$parent",{enumerable:!1,writable:!0}),this.properties.define(r,"$instanceOf",{enumerable:!1,writable:!0}),M(n,function(a,c){Gt(a)&&a.value!==void 0?r[a.name]=a.value:r[c]=a}),r},Hn.prototype.getPackage=function(e){return this.registry.getPackage(e)},Hn.prototype.getPackages=function(){return this.registry.getPackages()},Hn.prototype.getElementDescriptor=function(e){return e.$descriptor},Hn.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},Hn.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},Hn.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var Xf=String.fromCharCode,Jx=Object.prototype.hasOwnProperty,e0=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,Fo={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(Fo).forEach(function(e){Fo[e.toUpperCase()]=Fo[e]});function t0(e,t,n,i){return i?Jx.call(Fo,i)?Fo[i]:"&"+i+";":Xf(t||parseInt(n,16))}function Pr(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(e0,t0):e}var Zf="non-whitespace outside of root node";function Wi(e){return new Error(e)}function n0(e){return"missing namespace for prefix <"+e+">"}function Za(e){return{get:e,enumerable:!0}}function i0(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var Qf=Symbol("nameCache");function Mu(e){return e+"$uri"}function r0(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[Mu(i)]=n;return t}function Qa(){return{line:0,column:0}}function o0(e){throw e}function Jf(e){if(!this)return new Jf(e);var t=e&&e.proxy,n,i,r,o,a=o0,c,s,u,l,p=Qa,f=!1,d=!1,h="",m=!1,g=!1,R=null,w=!1,x,b,E,T;function L(N){N instanceof Error||(N=Wi(N)),R=N,a(N,p)}function A(N){c&&(N instanceof Error||(N=Wi(N)),c(N,p))}this.on=function(N,V){if(typeof V!="function")throw Wi("required args <name, cb>");switch(N){case"openTag":i=V;break;case"text":n=V;break;case"closeTag":r=V;break;case"error":a=V;break;case"warn":c=V;break;case"cdata":o=V;break;case"attention":l=V;break;case"question":u=V;break;case"comment":s=V;break;default:throw Wi("unsupported event: "+N)}return this},this.ns=function(N){if(typeof N>"u"&&(N={}),typeof N!="object")throw Wi("required args <nsMap={}>");var V=Object.create(null),fe;for(fe in N)V[fe]=N[fe];return g=!0,T=V,this};function F(){x=g?[]:null,b=g?r0(T):null,E=[],p=Qa,w=!1,R=null,d=!1,h=""}this.parse=function(N){if(typeof N!="string")throw Wi("required args <xml=string>");if(f)throw Wi("parse during stream; call end() first");return F(),H(N),p=Qa,w=!1,R},this.write=function(N){if(typeof N!="string")throw Wi("required args <xml=string>");return f||(F(),f=!0),R||(h=H(h+N,!0)||""),this},this.end=function(){return f||F(),f=!1,R||H(h),h="",p=Qa,w=!1,R},this.stop=function(){w=!0};function H(N,V=!1){var fe=null,je=null,lt,q=0,de=!1,he=!1,ce=0,ue=0,ee,j,$,U,ke,Lt,C,_,y,D="",I=0,W;function oe(tt,It){var un=tt.indexOf(":");if(un===-1)return tt;var ln=b[tt.substring(0,un)];return ln?It===ln?tt.substr(un+1):ln+tt.substr(un):(A(n0(tt.substring(0,un))),null)}function Pe(){if(W!==null)return W;var tt,It,un=g&&b.xmlns,ln=g&&m?[]:null,at=I,Nt=D,pn=Nt.length,Bo,fn,On,Ln,Rt,Er={},$o=new Set,In,He,Xe;e:for(;at<pn;at++)if(In=!1,He=Nt.charCodeAt(at),!(He===32||He<14&&He>8)){for((He<65||He>122||He>90&&He<97)&&He!==95&&He!==58&&(A("illegal first char attribute name"),In=!0),Xe=at+1;Xe<pn;Xe++)if(He=Nt.charCodeAt(Xe),!(He>96&&He<123||He>64&&He<91||He>47&&He<59||He===46||He===45||He===95)){if(He===32||He<14&&He>8){A("missing attribute value"),at=Xe;continue e}if(He===61)break;A("illegal attribute name char"),In=!0}if(Rt=Nt.substring(at,Xe),Rt==="xmlns:xmlns"&&(A("illegal declaration of xmlns"),In=!0),He=Nt.charCodeAt(Xe+1),He===34)Xe=Nt.indexOf('"',at=Xe+2),Xe===-1&&(Xe=Nt.indexOf("'",at),Xe!==-1&&(A("attribute value quote missmatch"),In=!0));else if(He===39)Xe=Nt.indexOf("'",at=Xe+2),Xe===-1&&(Xe=Nt.indexOf('"',at),Xe!==-1&&(A("attribute value quote missmatch"),In=!0));else for(A("missing attribute value quotes"),In=!0,Xe=Xe+1;Xe<pn&&(He=Nt.charCodeAt(Xe+1),!(He===32||He<14&&He>8));Xe++);for(Xe===-1&&(A("missing closing quotes"),Xe=pn,In=!0),In||(On=Nt.substring(at,Xe)),at=Xe;Xe+1<pn&&(He=Nt.charCodeAt(Xe+1),!(He===32||He<14&&He>8));Xe++)at===Xe&&(A("illegal character after attribute end"),In=!0);if(at=Xe+1,In)continue e;if($o.has(Rt)){A("attribute <"+Rt+"> already defined");continue}if($o.add(Rt),!g){Er[Rt]=On;continue}if(m){if(fn=Rt==="xmlns"?"xmlns":Rt.charCodeAt(0)===120&&Rt.substr(0,6)==="xmlns:"?Rt.substr(6):null,fn!==null){if(tt=Pr(On),It=Mu(fn),Ln=T[tt],!Ln){if(fn==="xmlns"||It in b&&b[It]!==tt)do Ln="ns"+q++;while(typeof b[Ln]<"u");else Ln=fn;T[tt]=Ln}b[fn]!==Ln&&(Bo||(b=i0(b),Bo=!0),b[fn]=Ln,fn==="xmlns"&&(b[Mu(Ln)]=tt,un=Ln),b[It]=tt),Er[Rt]=On;continue}ln.push(Rt,On);continue}Rt=oe(Rt,un),Rt!==null&&(Er[Rt]=On)}if(m)for(at=0,pn=ln.length;at<pn;at++)Rt=oe(ln[at++],un),On=ln[at],Rt!==null&&(Er[Rt]=On);return W=Er}function Ue(){for(var tt=/(\r\n|\r|\n)/g,It=0,un=0,ln=0,at=ue,Nt,pn;ce>=ln&&(Nt=tt.exec(N),!(!Nt||(at=Nt[0].length+Nt.index,at>ce)));)It+=1,ln=at;return ce==-1?(un=at,pn=N.substring(ue)):ue===0?pn=N.substring(ue,ce):(un=ce-ln,pn=ue==-1?N.substring(ce):N.substring(ce,ue+1)),{data:pn,line:It,column:un}}for(p=Ue,t&&(y=Object.create({},{name:Za(function(){return C}),originalName:Za(function(){return _}),attrs:Za(Pe),ns:Za(function(){return b})}));ue!==-1;){if(N.charCodeAt(ue)===60?ce=ue:ce=N.indexOf("<",ue),ce===-1){if(V)return N.substring(ue);if(E.length)return L("unexpected end of file");if(!d)return L("missing start tag");ue<N.length&&N.substring(ue).trim()&&A(Zf);return}if(d||(d=!0),ue!==ce){if(E.length){if(n&&(n(N.substring(ue,ce),Pr,p),w))return}else if(N.substring(ue,ce).trim()&&(A(Zf),w))return}if(U=N.charCodeAt(ce+1),U===33){if($=N.charCodeAt(ce+2),$===91&&N.substr(ce+3,6)==="CDATA["){if(ue=N.indexOf("]]>",ce),ue===-1)return V?N.substring(ce):L("unclosed cdata");if(o&&(o(N.substring(ce+9,ue),p),w))return;ue+=3;continue}if($===45&&N.charCodeAt(ce+3)===45){if(ue=N.indexOf("-->",ce),ue===-1)return V?N.substring(ce):L("unclosed comment");if(s&&(s(N.substring(ce+4,ue),Pr,p),w))return;ue+=3;continue}}if(U===63){if(ue=N.indexOf("?>",ce),ue===-1)return V?N.substring(ce):L("unclosed question");if(u&&(u(N.substring(ce,ue+2),p),w))return;ue+=2;continue}for(ee=ce+1;;ee++){if(ke=N.charCodeAt(ee),isNaN(ke))return V?N.substring(ce):(ue=-1,L("unclosed tag"));if(ke===34)$=N.indexOf('"',ee+1),ee=$!==-1?$:ee;else if(ke===39)$=N.indexOf("'",ee+1),ee=$!==-1?$:ee;else if(ke===62){ue=ee;break}}if(U===33){if(l&&(l(N.substring(ce,ue+1),Pr,p),w))return;ue+=1;continue}if(W={},U===47){if(de=!1,he=!0,!E.length)return L("missing open tag");if(ee=C=E.pop(),$=ce+2+ee.length,N.substring(ce+2,$)!==ee)return L("closing tag mismatch");for(;$<ue;$++)if(U=N.charCodeAt($),!(U===32||U>8&&U<14))return L("close tag")}else{if(N.charCodeAt(ue-1)===47?(ee=C=N.substring(ce+1,ue-1),de=!0,he=!0):(ee=C=N.substring(ce+1,ue),de=!0,he=!1),!(U>96&&U<123||U>64&&U<91||U===95||U===58))return L("illegal first char nodeName");for($=1,j=ee.length;$<j;$++)if(U=ee.charCodeAt($),!(U>96&&U<123||U>64&&U<91||U>47&&U<59||U===45||U===95||U==46)){if(U===32||U<14&&U>8){C=ee.substring(0,$),W=null;break}return L("invalid nodeName")}he||E.push(C)}if(g){lt=b,de&&(he||x.push(lt),W===null&&(m=ee.indexOf("xmlns",$)!==-1)&&(I=$,D=ee,Pe(),m=!1)),_=C,je!==b&&(fe=b[Qf],fe===void 0&&(fe=b[Qf]=Object.create(null)),je=b);var ft=fe[C];if(ft!==void 0)C=ft;else{if(U=C.indexOf(":"),U!==-1){if(Lt=b[C.substring(0,U)],!Lt)return L("missing namespace on <"+_+">");C=C.substr(U+1)}else Lt=b.xmlns;Lt&&(C=Lt+":"+C),fe[_]=C}}if(de&&(I=$,D=ee,i&&(t?i(y,Pr,he,p):i(C,Pe,Pr,he,p),w)))return;if(he){if(r&&(r(t?y:C,Pr,de,p),w))return;g&&(de?b=lt:b=x.pop())}ue+=1}}}function ed(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var ku={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},td="property";function nd(e){return e.xml&&e.xml.serialize}function a0(e){const t=nd(e);return t!==td&&(t||null)}function s0(e){return e.charAt(0).toUpperCase()+e.slice(1)}function id(e,t){return ed(t)?e.prefix+":"+s0(e.localName):e.name}function c0(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 u0(e,t,n){const i=on(e,t.xmlns),r=`${t[i.prefix]||i.prefix}:${i.localName}`,o=on(r);var a=n.getPackage(o.prefix);return c0(o,a)}function Ui(e){return new Error(e)}function Ei(e){return e.$descriptor}function l0(e){O(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw Ui("expected element");var n=this.elementsById,i=Ei(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 Ui("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function Ho(){}Ho.prototype.handleEnd=function(){},Ho.prototype.handleText=function(){},Ho.prototype.handleNode=function(){};function Du(){}Du.prototype=Object.create(Ho.prototype),Du.prototype.handleNode=function(){return this};function eo(){}eo.prototype=Object.create(Ho.prototype),eo.prototype.handleText=function(e){this.body=(this.body||"")+e};function zo(e,t){this.property=e,this.context=t}zo.prototype=Object.create(eo.prototype),zo.prototype.handleNode=function(e){if(this.element)throw Ui("expected no sub nodes");return this.element=this.createReference(e),this},zo.prototype.handleEnd=function(){this.element.id=this.body},zo.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function Ou(e,t){this.element=t,this.propertyDesc=e}Ou.prototype=Object.create(eo.prototype),Ou.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Pu(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function Ja(){}Ja.prototype=Object.create(eo.prototype),Ja.prototype.handleNode=function(e){var t=this,n=this.element;return n?t=this.handleChild(e):(n=this.element=this.createElement(e),this.context.addElement(n)),t};function dn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}dn.prototype=Object.create(Ja.prototype),dn.prototype.addReference=function(e){this.context.addReference(e)},dn.prototype.handleText=function(e){var t=this.element,n=Ei(t),i=n.bodyProperty;if(!i)throw Ui("unexpected body text <"+e+">");eo.prototype.handleText.call(this,e)},dn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Ei(t),i=n.bodyProperty;i&&e!==void 0&&(e=Pu(i.type,e),t.set(i.name,e))},dn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=Ei(n),r=this.context,o=new n({}),a=this.model,c;return M(t,function(s,u){var l=i.propertiesByName[u],p;l&&l.isReference?l.isMany?(p=s.split(" "),M(p,function(f){r.addReference({element:o,property:l.ns.name,id:f})})):r.addReference({element:o,property:l.ns.name,id:s}):(l?s=Pu(l.type,s):u==="xmlns"?u=":"+u:(c=on(u,i.ns.prefix),a.getPackage(c.prefix)&&r.addWarning({message:"unknown attribute <"+u+">",element:o,property:u,value:s})),o.set(u,s))}),o},dn.prototype.getPropertyForNode=function(e){var t=e.name,n=on(t),i=this.type,r=this.model,o=Ei(i),a=n.name,c=o.propertiesByName[a];if(c&&!c.isAttr){const u=a0(c);if(u){const l=e.attributes[u];if(l){const p=u0(l,e.ns,r),f=r.getType(p);return O({},c,{effectiveType:Ei(f).name})}}return c}var s=r.getPackage(n.prefix);if(s){const u=id(n,s),l=r.getType(u);if(c=st(o.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&l.hasType(p.type)}),c)return O({},c,{effectiveType:Ei(l).name})}else if(c=st(o.properties,function(u){return!u.isReference&&!u.isAttribute&&u.type==="Element"}),c)return c;throw Ui("unrecognized element <"+n.name+">")},dn.prototype.toString=function(){return"ElementDescriptor["+Ei(this.type).name+"]"},dn.prototype.valueHandler=function(e,t){return new Ou(e,t)},dn.prototype.referenceHandler=function(e){return new zo(e,this.context)},dn.prototype.handler=function(e){return e==="Element"?new to(this.model,e,this.context):new dn(this.model,e,this.context)},dn.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,Yf(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?(O(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function Lu(e,t,n){dn.call(this,e,t,n)}Lu.prototype=Object.create(dn.prototype),Lu.prototype.createElement=function(e){var t=e.name,n=on(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&id(n,o)||t;if(!r.hasType(a))throw Ui("unexpected element <"+e.originalName+">");return dn.prototype.createElement.call(this,e)};function to(e,t,n){this.model=e,this.context=n}to.prototype=Object.create(Ja.prototype),to.prototype.createElement=function(e){var t=e.name,n=on(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},to.prototype.handleChild=function(e){var t=new to(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},to.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function Iu(e){e instanceof Hn&&(e={model:e}),O(this,{lax:!1},e)}Iu.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof dn?(i=t,t={}):typeof t=="string"?(i=this.handler(t),t={}):typeof i=="string"&&(i=this.handler(i));var r=this.model,o=this.lax,a=new l0(O({},t,{rootHandler:i})),c=new Jf({proxy:!0}),s=p0();i.context=a,s.push(i);function u(E,T,L){var A=T(),F=A.line,H=A.column,N=A.data;N.charAt(0)==="<"&&N.indexOf(" ")!==-1&&(N=N.slice(0,N.indexOf(" "))+">");var V="unparsable content "+(N?N+" ":"")+`detected
2
- line: `+F+`
1
+ (function(Q,Ct){typeof exports=="object"&&typeof module<"u"?Ct(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],Ct):(Q=typeof globalThis<"u"?globalThis:Q||self,Ct(Q.BpmnModeler={},Q.Vue))})(this,(function(Q,Ct){"use strict";var ZD=Object.defineProperty;var QD=(Q,Ct,wi)=>Ct in Q?ZD(Q,Ct,{enumerable:!0,configurable:!0,writable:!0,value:wi}):Q[Ct]=wi;var Kr=(Q,Ct,wi)=>QD(Q,typeof Ct!="symbol"?Ct+"":Ct,wi);const wi=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway"];function $f(e){return wi.includes(e)}const jf="http://g1project.net/spec/bpmn/bwl/1.0",bu="bwl",xu=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],Ff={name:"bwl-hints",uri:jf,prefix:bu,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"}]}]},wu="bwl.undoEpisode",Hf=new WeakSet;function Tx(e){Hf.has(e)||(e.register(wu,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),Hf.add(e))}function zf(e,t){Tx(e);const n={run:t};if(e.execute(wu,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const Vf=["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"],Mx={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},kx={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},Dx={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},Ox={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다.",properties:{id:{type:"string"},type:{type:"string",enum:[...wi]},name:{type:"string"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},Lx={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},Ix={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},Nx={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"}},required:["id","source","target"],additionalProperties:!1},Bx={type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},$x={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},jx={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},Fx={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},Hx={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},zx={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...xu]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function nn(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const Vx={"participant.add":nn("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":nn("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":nn("node.add",{description:'플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 갈래 1, 2…) — 위/아래가 아니라 "주 흐름에서 몇 번째 갈래"다. 행 배치(어느 갈래가 위/아래인지)는 호스트가 정한다(대칭·메시지 방향). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.',properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["node"]}),"node.update":nn("node.update",{description:"노드 이름/레인/타입 갱신. lane = 레인 재배정(이동), type = 태스크·이벤트 타입 전환.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lane:{type:"string"},type:{type:"string",enum:[...wi]}},required:["id"]}),"sequenceFlow.add":nn("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":nn("sequenceFlow.update",{description:"시퀀스 플로우 이름/조건/끝점 갱신. condition: null = 조건 제거. source/target = 끝점 재배선 — 중간 삽입은 기존 플로우를 지우지 말고 이것으로 한쪽 끝을 옮긴 뒤 새 플로우를 추가한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},condition:{description:"생략 = 보존, null = 제거.",anyOf:[{$ref:"#/$defs/irFlowCondition"},{type:"null"}]},source:{description:"새 출발 노드 id(생략 = 보존). 같은 배치에서 추가한 노드도 지목할 수 있다.",type:"string"},target:{description:"새 도착 노드 id(생략 = 보존). 같은 배치에서 추가한 노드도 지목할 수 있다.",type:"string"}},required:["id"]}),"messageFlow.add":nn("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":nn("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataStore.add":nn("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":nn("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataAssociation.add":nn("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":nn("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":nn("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":nn("annotation.update",{description:"주석 본문/방위 힌트 갱신. placement: null = 힌트 제거(휴리스틱 복귀). 주석 삭제는 element.remove.",properties:{id:{type:"string"},text:{type:"string"},placement:{description:"생략 = 보존, null = 힌트 제거.",anyOf:[{$ref:"#/$defs/bwlPlacement"},{type:"null"}]}},required:["id"]}),"group.add":nn("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":nn("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"element.remove":nn("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},Gf={anyOf:Vf.map(e=>Vx[e])},Gx={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:kx,irParticipant:Dx,irNode:Ox,irFlowCondition:Lx,irSequenceFlow:Ix,irMessageFlow:Nx,irDataStore:Bx,irDataAssociation:$x,irTextAnnotation:jx,irAssociation:Fx,irGroup:Hx,bwlPlacement:zx,nullableString:Mx,symbolicOp:Gf}};function Eu(e){return Array.prototype.concat.apply([],e)}const Ho=Object.prototype.toString,Wx=Object.prototype.hasOwnProperty;function Sr(e){return e===void 0}function $t(e){return e!==void 0}function Xr(e){return e==null}function _e(e){return Ho.call(e)==="[object Array]"}function Gt(e){return Ho.call(e)==="[object Object]"}function we(e){return Ho.call(e)==="[object Number]"}function Wt(e){const t=Ho.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function wn(e){return Ho.call(e)==="[object String]"}function Ux(e){if(!_e(e))throw new Error("must supply array")}function En(e,t){return!Xr(e)&&Wx.call(e,t)}function st(e,t){const n=Za(t);let i;return M(e,function(r,o){if(n(r,o))return i=r,!1}),i}function Wf(e,t){const n=Za(t);let i=_e(e)?-1:void 0;return M(e,function(r,o){if(n(r,o))return i=o,!1}),i}function Oe(e,t){const n=Za(t);let i=[];return M(e,function(r,o){n(r,o)&&i.push(r)}),i}function M(e,t){let n,i;if(Sr(e))return;const r=_e(e)?Zx:Xx;for(let o in e)if(En(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function Yx(e,t){if(Sr(e))return[];Ux(e);const n=Za(t);return e.filter(function(i,r){return!n(i,r)})}function Sn(e,t,n){return M(e,function(i,r){n=t(n,i,r)}),n}function Rr(e,t){return!!Sn(e,function(n,i,r){return n&&t(i,r)},!0)}function Vi(e,t){return!!st(e,t)}function rn(e,t){let n=[];return M(e,function(i,r){n.push(t(i,r))}),n}function Xa(e){return e&&Object.keys(e)||[]}function qx(e){return Xa(e).length}function Zr(e){return rn(e,t=>t)}function Qr(e,t,n={}){return t=Su(t),M(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function Uf(e,...t){e=Su(e);let n={};return M(t,r=>Qr(r,e,n)),rn(n,function(r,o){return r[0]})}const Kx=Uf;function oi(e,t){t=Su(t);let n=[];return M(e,function(i,r){let o=t(i,r),a={d:o,v:i};for(var s=0;s<n.length;s++){let{d:c}=n[s];if(o<c){n.splice(s,0,a);return}}n.push(a)}),rn(n,i=>i.v)}function Jr(e){return function(t){return Rr(e,function(n,i){return t[i]===n})}}function Su(e){return Wt(e)?e:t=>t[e]}function Za(e){return Wt(e)?e:t=>t===e}function Xx(e){return e}function Zx(e){return Number(e)}function Ru(e,t){let n,i,r,o;function a(p){let f=Date.now(),d=p?0:o+t-f;if(d>0)return s(d);e.apply(r,i),c()}function s(p){n=setTimeout(a,p)}function c(){n&&clearTimeout(n),n=o=i=r=void 0}function u(){n&&a(!0),c()}function l(...p){o=Date.now(),i=p,r=this,n||s(t)}return l.flush=u,l.cancel=c,l}function vn(e,t){return e.bind(t)}function O(e,...t){return Object.assign(e,...t)}function Qx(e,t,n){let i=e;return M(t,function(r,o){if(typeof r!="number"&&typeof r!="string")throw new Error("illegal key type: "+typeof r+". Key should be of type number or string.");if(r==="constructor")throw new Error("illegal key: constructor");if(r==="__proto__")throw new Error("illegal key: __proto__");let a=t[o+1],s=i[r];$t(a)&&Xr(s)&&(s=i[r]=isNaN(+a)?{}:[]),Sr(a)?Sr(n)?delete i[r]:i[r]=n:i=s}),e}function ni(e,t){let n={},i=Object(e);return M(t,function(r){r in i&&(n[r]=e[r])}),n}function ai(e,t){let n={},i=Object(e);return M(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function Cu(){}Cu.prototype.get=function(e){return this.$model.properties.get(this,e)},Cu.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function Yf(e,t){this.model=e,this.properties=t}Yf.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Cu.prototype);M(e.properties,function(a){!a.isMany&&a.default!==void 0&&(i[a.name]=a.default)}),n.defineModel(i,t),n.defineDescriptor(i,e);var r=e.ns.name;function o(a){n.define(this,"$type",{value:r,enumerable:!0}),n.define(this,"$attrs",{value:{}}),n.define(this,"$parent",{writable:!0}),M(a,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 Jx=O(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),qf=O(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 Pu(e,t){var n=qf[e];return n?n(t):t}function Au(e){return!!Jx[e]}function Kf(e){return!!qf[e]}function on(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 Nn(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}Nn.prototype.build=function(){return ni(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},Nn.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)},Nn.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},Nn.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=on(r[0],i),a=on(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},Nn.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},Nn.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},Nn.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},Nn.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},Nn.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},Nn.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")},Nn.prototype.hasProperty=function(e){return this.propertiesByName[e]},Nn.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(M(e.properties,vn(function(o){o=O({},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 Gi(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,M(e,vn(this.registerPackage,this))}Gi.prototype.getPackage=function(e){return this.packageMap[e]},Gi.prototype.getPackages=function(){return this.packages},Gi.prototype.registerPackage=function(e){e=O({},e);var t=this.packageMap;Xf(t,e,"prefix"),Xf(t,e,"uri"),M(e.types,vn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Gi.prototype.registerType=function(e,t){e=O({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:O({},e.meta||{})});var n=on(e.name,t.prefix),i=n.name,r=Object.create(null);M(e.properties,vn(function(o){var a=on(o.name,n.prefix),s=a.name;Au(o.type)||(o.type=on(o.type,a.prefix).name),O(o,{ns:a,name:s}),r[s]=o},this)),O(e,{ns:n,name:i,propertiesByName:r}),M(e.extends,vn(function(o){var a=on(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},Gi.prototype.mapTypes=function(e,t,n){var i=Au(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,u){var l=on(c,Au(c)?"":e.prefix);r.mapTypes(l,t,u)}function a(c){return o(c,!0)}function s(c){return o(c,!1)}if(!i)throw new Error("unknown type <"+e.name+">");M(i.superClass,n?a:s),t(i,!n),M(i.traits,a)},Gi.prototype.getEffectiveDescriptor=function(e){var t=on(e),n=new Nn(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},Gi.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function Xf(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(!wn(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;e0(n)?i?delete e[r]:delete e.$attrs[Tu(t)]:i?r in e?e[r]=n:Zf(e,i,n):e.$attrs[Tu(t)]=n},Cr.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[Tu(t)];var i=n.name;return!e[i]&&n.isMany&&Zf(e,n,[]),e[i]},Cr.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=O({},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 e0(e){return typeof e>"u"}function Zf(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Tu(e){return e.replace(/^:/,"")}function Hn(e,t={}){this.properties=new Cr(this),this.factory=new Yf(this,this.properties),this.registry=new Gi(e,this.properties),this.typeCache=Object.create(null),this.config=t}Hn.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},Hn.prototype.getType=function(e){var t=this.typeCache,n=wn(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},Hn.prototype.createAny=function(e,t,n){var i=on(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){Qx(this,[a],s)}},o={name:e,isGeneric:!0,ns:{prefix:i.prefix,localName:i.localName,uri:t}};return this.properties.defineDescriptor(r,o),this.properties.defineModel(r,this),this.properties.define(r,"get",{enumerable:!1,writable:!0}),this.properties.define(r,"set",{enumerable:!1,writable:!0}),this.properties.define(r,"$parent",{enumerable:!1,writable:!0}),this.properties.define(r,"$instanceOf",{enumerable:!1,writable:!0}),M(n,function(a,s){Gt(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},Hn.prototype.getPackage=function(e){return this.registry.getPackage(e)},Hn.prototype.getPackages=function(){return this.registry.getPackages()},Hn.prototype.getElementDescriptor=function(e){return e.$descriptor},Hn.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},Hn.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},Hn.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var Qf=String.fromCharCode,t0=Object.prototype.hasOwnProperty,n0=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,zo={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(zo).forEach(function(e){zo[e.toUpperCase()]=zo[e]});function i0(e,t,n,i){return i?t0.call(zo,i)?zo[i]:"&"+i+";":Qf(t||parseInt(n,16))}function Pr(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(n0,i0):e}var Jf="non-whitespace outside of root node";function Wi(e){return new Error(e)}function r0(e){return"missing namespace for prefix <"+e+">"}function Qa(e){return{get:e,enumerable:!0}}function o0(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var ed=Symbol("nameCache");function Mu(e){return e+"$uri"}function a0(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[Mu(i)]=n;return t}function Ja(){return{line:0,column:0}}function s0(e){throw e}function td(e){if(!this)return new td(e);var t=e&&e.proxy,n,i,r,o,a=s0,s,c,u,l,p=Ja,f=!1,d=!1,h="",m=!1,g=!1,R=null,w=!1,b,x,E,T;function L(N){N instanceof Error||(N=Wi(N)),R=N,a(N,p)}function A(N){s&&(N instanceof Error||(N=Wi(N)),s(N,p))}this.on=function(N,G){if(typeof G!="function")throw Wi("required args <name, cb>");switch(N){case"openTag":i=G;break;case"text":n=G;break;case"closeTag":r=G;break;case"error":a=G;break;case"warn":s=G;break;case"cdata":o=G;break;case"attention":l=G;break;case"question":u=G;break;case"comment":c=G;break;default:throw Wi("unsupported event: "+N)}return this},this.ns=function(N){if(typeof N>"u"&&(N={}),typeof N!="object")throw Wi("required args <nsMap={}>");var G=Object.create(null),fe;for(fe in N)G[fe]=N[fe];return g=!0,T=G,this};function j(){b=g?[]:null,x=g?a0(T):null,E=[],p=Ja,w=!1,R=null,d=!1,h=""}this.parse=function(N){if(typeof N!="string")throw Wi("required args <xml=string>");if(f)throw Wi("parse during stream; call end() first");return j(),H(N),p=Ja,w=!1,R},this.write=function(N){if(typeof N!="string")throw Wi("required args <xml=string>");return f||(j(),f=!0),R||(h=H(h+N,!0)||""),this},this.end=function(){return f||j(),f=!1,R||H(h),h="",p=Ja,w=!1,R},this.stop=function(){w=!0};function H(N,G=!1){var fe=null,Fe=null,lt,Y=0,de=!1,he=!1,se=0,ce=0,ee,F,$,U,ke,Lt,C,_,y,D="",I=0,W;function oe(tt,It){var un=tt.indexOf(":");if(un===-1)return tt;var ln=x[tt.substring(0,un)];return ln?It===ln?tt.substr(un+1):ln+tt.substr(un):(A(r0(tt.substring(0,un))),null)}function Pe(){if(W!==null)return W;var tt,It,un=g&&x.xmlns,ln=g&&m?[]:null,at=I,Nt=D,pn=Nt.length,jo,fn,Ln,In,Rt,Er={},Fo=new Set,xn,He,Xe;e:for(;at<pn;at++)if(xn=!1,He=Nt.charCodeAt(at),!(He===32||He<14&&He>8)){for((He<65||He>122||He>90&&He<97)&&He!==95&&He!==58&&(A("illegal first char attribute name"),xn=!0),Xe=at+1;Xe<pn;Xe++)if(He=Nt.charCodeAt(Xe),!(He>96&&He<123||He>64&&He<91||He>47&&He<59||He===46||He===45||He===95)){if(He===32||He<14&&He>8){A("missing attribute value"),at=Xe;continue e}if(He===61)break;A("illegal attribute name char"),xn=!0}if(Rt=Nt.substring(at,Xe),Rt==="xmlns:xmlns"&&(A("illegal declaration of xmlns"),xn=!0),He=Nt.charCodeAt(Xe+1),He===34)Xe=Nt.indexOf('"',at=Xe+2),Xe===-1&&(Xe=Nt.indexOf("'",at),Xe!==-1&&(A("attribute value quote missmatch"),xn=!0));else if(He===39)Xe=Nt.indexOf("'",at=Xe+2),Xe===-1&&(Xe=Nt.indexOf('"',at),Xe!==-1&&(A("attribute value quote missmatch"),xn=!0));else for(A("missing attribute value quotes"),xn=!0,Xe=Xe+1;Xe<pn&&(He=Nt.charCodeAt(Xe+1),!(He===32||He<14&&He>8));Xe++);for(Xe===-1&&(A("missing closing quotes"),Xe=pn,xn=!0),xn||(Ln=Nt.substring(at,Xe)),at=Xe;Xe+1<pn&&(He=Nt.charCodeAt(Xe+1),!(He===32||He<14&&He>8));Xe++)at===Xe&&(A("illegal character after attribute end"),xn=!0);if(at=Xe+1,xn)continue e;if(Fo.has(Rt)){A("attribute <"+Rt+"> already defined");continue}if(Fo.add(Rt),!g){Er[Rt]=Ln;continue}if(m){if(fn=Rt==="xmlns"?"xmlns":Rt.charCodeAt(0)===120&&Rt.substr(0,6)==="xmlns:"?Rt.substr(6):null,fn!==null){if(tt=Pr(Ln),It=Mu(fn),In=T[tt],!In){if(fn==="xmlns"||It in x&&x[It]!==tt)do In="ns"+Y++;while(typeof x[In]<"u");else In=fn;T[tt]=In}x[fn]!==In&&(jo||(x=o0(x),jo=!0),x[fn]=In,fn==="xmlns"&&(x[Mu(In)]=tt,un=In),x[It]=tt),Er[Rt]=Ln;continue}ln.push(Rt,Ln);continue}Rt=oe(Rt,un),Rt!==null&&(Er[Rt]=Ln)}if(m)for(at=0,pn=ln.length;at<pn;at++)Rt=oe(ln[at++],un),Ln=ln[at],Rt!==null&&(Er[Rt]=Ln);return W=Er}function Ue(){for(var tt=/(\r\n|\r|\n)/g,It=0,un=0,ln=0,at=ce,Nt,pn;se>=ln&&(Nt=tt.exec(N),!(!Nt||(at=Nt[0].length+Nt.index,at>se)));)It+=1,ln=at;return se==-1?(un=at,pn=N.substring(ce)):ce===0?pn=N.substring(ce,se):(un=se-ln,pn=ce==-1?N.substring(se):N.substring(se,ce+1)),{data:pn,line:It,column:un}}for(p=Ue,t&&(y=Object.create({},{name:Qa(function(){return C}),originalName:Qa(function(){return _}),attrs:Qa(Pe),ns:Qa(function(){return x})}));ce!==-1;){if(N.charCodeAt(ce)===60?se=ce:se=N.indexOf("<",ce),se===-1){if(G)return N.substring(ce);if(E.length)return L("unexpected end of file");if(!d)return L("missing start tag");ce<N.length&&N.substring(ce).trim()&&A(Jf);return}if(d||(d=!0),ce!==se){if(E.length){if(n&&(n(N.substring(ce,se),Pr,p),w))return}else if(N.substring(ce,se).trim()&&(A(Jf),w))return}if(U=N.charCodeAt(se+1),U===33){if($=N.charCodeAt(se+2),$===91&&N.substr(se+3,6)==="CDATA["){if(ce=N.indexOf("]]>",se),ce===-1)return G?N.substring(se):L("unclosed cdata");if(o&&(o(N.substring(se+9,ce),p),w))return;ce+=3;continue}if($===45&&N.charCodeAt(se+3)===45){if(ce=N.indexOf("-->",se),ce===-1)return G?N.substring(se):L("unclosed comment");if(c&&(c(N.substring(se+4,ce),Pr,p),w))return;ce+=3;continue}}if(U===63){if(ce=N.indexOf("?>",se),ce===-1)return G?N.substring(se):L("unclosed question");if(u&&(u(N.substring(se,ce+2),p),w))return;ce+=2;continue}for(ee=se+1;;ee++){if(ke=N.charCodeAt(ee),isNaN(ke))return G?N.substring(se):(ce=-1,L("unclosed tag"));if(ke===34)$=N.indexOf('"',ee+1),ee=$!==-1?$:ee;else if(ke===39)$=N.indexOf("'",ee+1),ee=$!==-1?$:ee;else if(ke===62){ce=ee;break}}if(U===33){if(l&&(l(N.substring(se,ce+1),Pr,p),w))return;ce+=1;continue}if(W={},U===47){if(de=!1,he=!0,!E.length)return L("missing open tag");if(ee=C=E.pop(),$=se+2+ee.length,N.substring(se+2,$)!==ee)return L("closing tag mismatch");for(;$<ce;$++)if(U=N.charCodeAt($),!(U===32||U>8&&U<14))return L("close tag")}else{if(N.charCodeAt(ce-1)===47?(ee=C=N.substring(se+1,ce-1),de=!0,he=!0):(ee=C=N.substring(se+1,ce),de=!0,he=!1),!(U>96&&U<123||U>64&&U<91||U===95||U===58))return L("illegal first char nodeName");for($=1,F=ee.length;$<F;$++)if(U=ee.charCodeAt($),!(U>96&&U<123||U>64&&U<91||U>47&&U<59||U===45||U===95||U==46)){if(U===32||U<14&&U>8){C=ee.substring(0,$),W=null;break}return L("invalid nodeName")}he||E.push(C)}if(g){lt=x,de&&(he||b.push(lt),W===null&&(m=ee.indexOf("xmlns",$)!==-1)&&(I=$,D=ee,Pe(),m=!1)),_=C,Fe!==x&&(fe=x[ed],fe===void 0&&(fe=x[ed]=Object.create(null)),Fe=x);var ft=fe[C];if(ft!==void 0)C=ft;else{if(U=C.indexOf(":"),U!==-1){if(Lt=x[C.substring(0,U)],!Lt)return L("missing namespace on <"+_+">");C=C.substr(U+1)}else Lt=x.xmlns;Lt&&(C=Lt+":"+C),fe[_]=C}}if(de&&(I=$,D=ee,i&&(t?i(y,Pr,he,p):i(C,Pe,Pr,he,p),w)))return;if(he){if(r&&(r(t?y:C,Pr,de,p),w))return;g&&(de?x=lt:x=b.pop())}ce+=1}}}function nd(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var ku={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},id="property";function rd(e){return e.xml&&e.xml.serialize}function c0(e){const t=rd(e);return t!==id&&(t||null)}function u0(e){return e.charAt(0).toUpperCase()+e.slice(1)}function od(e,t){return nd(t)?e.prefix+":"+u0(e.localName):e.name}function l0(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 p0(e,t,n){const i=on(e,t.xmlns),r=`${t[i.prefix]||i.prefix}:${i.localName}`,o=on(r);var a=n.getPackage(o.prefix);return l0(o,a)}function Ui(e){return new Error(e)}function Ei(e){return e.$descriptor}function f0(e){O(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw Ui("expected element");var n=this.elementsById,i=Ei(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 Ui("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function Vo(){}Vo.prototype.handleEnd=function(){},Vo.prototype.handleText=function(){},Vo.prototype.handleNode=function(){};function Du(){}Du.prototype=Object.create(Vo.prototype),Du.prototype.handleNode=function(){return this};function eo(){}eo.prototype=Object.create(Vo.prototype),eo.prototype.handleText=function(e){this.body=(this.body||"")+e};function Go(e,t){this.property=e,this.context=t}Go.prototype=Object.create(eo.prototype),Go.prototype.handleNode=function(e){if(this.element)throw Ui("expected no sub nodes");return this.element=this.createReference(e),this},Go.prototype.handleEnd=function(){this.element.id=this.body},Go.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function Ou(e,t){this.element=t,this.propertyDesc=e}Ou.prototype=Object.create(eo.prototype),Ou.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Pu(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function es(){}es.prototype=Object.create(eo.prototype),es.prototype.handleNode=function(e){var t=this,n=this.element;return n?t=this.handleChild(e):(n=this.element=this.createElement(e),this.context.addElement(n)),t};function dn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}dn.prototype=Object.create(es.prototype),dn.prototype.addReference=function(e){this.context.addReference(e)},dn.prototype.handleText=function(e){var t=this.element,n=Ei(t),i=n.bodyProperty;if(!i)throw Ui("unexpected body text <"+e+">");eo.prototype.handleText.call(this,e)},dn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Ei(t),i=n.bodyProperty;i&&e!==void 0&&(e=Pu(i.type,e),t.set(i.name,e))},dn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=Ei(n),r=this.context,o=new n({}),a=this.model,s;return M(t,function(c,u){var l=i.propertiesByName[u],p;l&&l.isReference?l.isMany?(p=c.split(" "),M(p,function(f){r.addReference({element:o,property:l.ns.name,id:f})})):r.addReference({element:o,property:l.ns.name,id:c}):(l?c=Pu(l.type,c):u==="xmlns"?u=":"+u:(s=on(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},dn.prototype.getPropertyForNode=function(e){var t=e.name,n=on(t),i=this.type,r=this.model,o=Ei(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const u=c0(s);if(u){const l=e.attributes[u];if(l){const p=p0(l,e.ns,r),f=r.getType(p);return O({},s,{effectiveType:Ei(f).name})}}return s}var c=r.getPackage(n.prefix);if(c){const u=od(n,c),l=r.getType(u);if(s=st(o.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&l.hasType(p.type)}),s)return O({},s,{effectiveType:Ei(l).name})}else if(s=st(o.properties,function(u){return!u.isReference&&!u.isAttribute&&u.type==="Element"}),s)return s;throw Ui("unrecognized element <"+n.name+">")},dn.prototype.toString=function(){return"ElementDescriptor["+Ei(this.type).name+"]"},dn.prototype.valueHandler=function(e,t){return new Ou(e,t)},dn.prototype.referenceHandler=function(e){return new Go(e,this.context)},dn.prototype.handler=function(e){return e==="Element"?new to(this.model,e,this.context):new dn(this.model,e,this.context)},dn.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,Kf(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?(O(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function Lu(e,t,n){dn.call(this,e,t,n)}Lu.prototype=Object.create(dn.prototype),Lu.prototype.createElement=function(e){var t=e.name,n=on(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&od(n,o)||t;if(!r.hasType(a))throw Ui("unexpected element <"+e.originalName+">");return dn.prototype.createElement.call(this,e)};function to(e,t,n){this.model=e,this.context=n}to.prototype=Object.create(es.prototype),to.prototype.createElement=function(e){var t=e.name,n=on(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},to.prototype.handleChild=function(e){var t=new to(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},to.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function Iu(e){e instanceof Hn&&(e={model:e}),O(this,{lax:!1},e)}Iu.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof dn?(i=t,t={}):typeof t=="string"?(i=this.handler(t),t={}):typeof i=="string"&&(i=this.handler(i));var r=this.model,o=this.lax,a=new f0(O({},t,{rootHandler:i})),s=new td({proxy:!0}),c=d0();i.context=a,c.push(i);function u(E,T,L){var A=T(),j=A.line,H=A.column,N=A.data;N.charAt(0)==="<"&&N.indexOf(" ")!==-1&&(N=N.slice(0,N.indexOf(" "))+">");var G="unparsable content "+(N?N+" ":"")+`detected
2
+ line: `+j+`
3
3
  column: `+H+`
4
- nested error: `+E.message;if(L)return a.addWarning({message:V,error:E}),!0;throw Ui(V)}function l(E,T){return u(E,T,!0)}function p(){var E=a.elementsById,T=a.references,L,A;for(L=0;A=T[L];L++){var F=A.element,H=E[A.id],N=Ei(F).propertiesByName[A.property];if(H||a.addWarning({message:"unresolved reference <"+A.id+">",element:A.element,property:A.property,value:A.id}),N.isMany){var V=F.get(N.name),fe=V.indexOf(A);fe===-1&&(fe=V.length),H?V[fe]=H:V.splice(fe,1)}else F.set(N.name,H)}}function f(){s.pop().handleEnd()}var d=/^<\?xml /i,h=/ encoding="([^"]+)"/i,m=/^utf-8$/i;function g(E){if(d.test(E)){var T=h.exec(E),L=T&&T[1];!L||m.test(L)||a.addWarning({message:"unsupported document encoding <"+L+">, falling back to UTF-8"})}}function R(E,T){var L=s.peek();try{s.push(L.handleNode(E))}catch(A){u(A,T,o)&&s.push(new Du)}}function w(E,T){try{s.peek().handleText(E)}catch(L){l(L,T)}}function x(E,T){E.trim()&&w(E,T)}var b=r.getPackages().reduce(function(E,T){return E[T.uri]=T.prefix,E},Object.entries(ku).reduce(function(E,[T,L]){return E[L]=T,E},r.config&&r.config.nsMap||{}));return c.ns(b).on("openTag",function(E,T,L,A){var F=E.attrs||{},H=Object.keys(F).reduce(function(V,fe){var je=T(F[fe]);return V[fe]=je,V},{}),N={name:E.name,originalName:E.originalName,attributes:H,ns:E.ns};R(N,A)}).on("question",g).on("closeTag",f).on("cdata",w).on("text",function(E,T,L){x(T(E),L)}).on("error",u).on("warn",l),new Promise(function(E,T){var L;try{c.parse(e),p()}catch(V){L=V}var A=i.element;!L&&!A&&(L=Ui("failed to parse document as <"+i.type.$descriptor.name+">"));var F=a.warnings,H=a.references,N=a.elementsById;return L?(L.warnings=F,T(L)):E({rootElement:A,elementsById:N,references:H,warnings:F})})},Iu.prototype.handler=function(e){return new Lu(this.model,e)};function p0(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var f0=`<?xml version="1.0" encoding="UTF-8"?>
5
- `,d0=/<|>|'|"|&|\n\r|\n/g,rd=/<|>|&/g;function si(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}si.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},si.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},si.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},si.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)},si.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},si.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},si.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},si.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},si.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 h0(e){return e.charAt(0).toLowerCase()+e.slice(1)}function m0(e,t){return ed(t)?h0(e):e}function od(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function ad(e){return xn(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function g0(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 y0(e,t){return t.isGeneric?O({localName:t.ns.localName},e):O({localName:m0(t.ns.localName,t.$pkg)},e)}function v0(e,t){return O({localName:t.ns.localName},e)}function _0(e){var t=e.$descriptor;return Oe(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 b0={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},x0={"<":"lt",">":"gt","&":"amp"};function sd(e,t,n){return e=xn(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function w0(e){return sd(e,d0,b0)}function E0(e){return sd(e,rd,x0)}function S0(e){return Oe(e,function(t){return t.isAttr})}function R0(e){return Oe(e,function(t){return!t.isAttr})}function Nu(e){this.tagName=e}Nu.prototype.build=function(e){return this.element=e,this},Nu.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?E0(this.value):this.value)},Ar.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(rd)!==-1&&(this.escape=!0),this};function Bu(e){this.tagName=e}od(Bu,Ar),Bu.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function dt(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}dt.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=_0(e),this.parseAttributes(S0(r)),this.parseContainments(R0(r))),this.parseGenericAttributes(e,i),this},dt.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return y0(t,e)},dt.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return v0(t,e)},dt.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},dt.prototype.nsAttributeName=function(e){var t;if(xn(e)?t=on(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}:O({localName:t.localName},n)},dt.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}))},dt.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new Ar().build({type:"String"},t));var n=e.$children;n&&M(n,i=>{this.body.push(new dt(this).build(i))})},dt.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,r=on(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)}},dt.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return M(n,function(r,o){var a=t.parseNsAttribute(e,o,r);a&&i.push(a)}),i},dt.prototype.parseGenericAttributes=function(e,t){var n=this;M(t,function(i){try{n.addAttribute(n.nsAttributeName(i.name),i.value)}catch(r){typeof console<"u"&&console.warn(`missing namespace information for <${i.name}=${i.value}> on`,e,r)}})},dt.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;M(e,function(r){var o=i.get(r.name),a=r.isReference,c=r.isMany;if(c||(o=[o]),r.isBody)n.push(new Ar().build(r,o[0]));else if(Yf(r.type))M(o,function(u){n.push(new Bu(t.addTagName(t.nsPropertyTagName(r))).build(r,u))});else if(a)M(o,function(u){n.push(new Nu(t.addTagName(t.nsPropertyTagName(r))).build(u))});else{var s=nd(r);M(o,function(u){var l;s?s===td?l=new dt(t,r):l=new es(t,r,s):l=new dt(t),n.push(l.build(u))})}})},dt.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new si(i):t=i),t},dt.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},dt.prototype.logNamespaceUsed=function(e,t){var n=this.getNamespaces(t),i=e.prefix,r=e.uri,o,a,c;if(!i&&!r)return{localName:e.localName};if(c=n.defaultUriByPrefix(i),r=r||c||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},c===r,!0)),!e){for(o=i,a=1;n.uriByPrefix(o);)o=i+"_"+a++;e=this.logNamespace({prefix:o,uri:r},c===r)}return i&&n.mapPrefix(i,r),e},dt.prototype.parseAttributes=function(e){var t=this,n=this.element;M(e,function(i){var r=n.get(i.name);if(i.isReference)if(!i.isMany)r=r.id;else{var o=[];M(r,function(a){o.push(a.id)}),r=o.join(" ")}t.addAttribute(t.nsAttributeName(i),r)})},dt.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),ad(e)},dt.prototype.addAttribute=function(e,t){var n=this.attrs;xn(t)&&(t=w0(t));var i=Vf(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)},dt.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=g0(n).concat(t)),M(t,function(i){e.append(" ").append(ad(i.name)).append('="').append(i.value).append('"')})},dt.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(),M(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function es(e,t,n){dt.call(this,e,t),this.serialization=n}od(es,dt),es.prototype.parseNsAttributes=function(e){var t=dt.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},es.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function C0(){this.value="",this.write=function(e){this.value+=e}}function P0(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 A0(e){e=O({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new C0,o=new P0(r,e.format);e.preamble&&o.append(f0);var a=new dt,c=n.$model;if(a.getNamespaces().mapDefaultPrefixes(T0(c)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function T0(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in ku)n[i]=ku[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 ts(e,t){Hn.call(this,e,t)}ts.prototype=Object.create(Hn.prototype),ts.prototype.fromXML=function(e,t,n){xn(t)||(n=t,t="bpmn:Definitions");var i=new Iu(O({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},ts.prototype.toXML=function(e,t){var n=new A0(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var M0="BPMN20",k0="http://www.omg.org/spec/BPMN/20100524/MODEL",D0="bpmn",O0=[],L0=[{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"}]}],I0=[{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"}]}],N0={tagAlias:"lowerCase",typePrefix:"t"},B0={name:M0,uri:k0,prefix:D0,associations:O0,types:L0,enumerations:I0,xml:N0},$0="BPMNDI",j0="http://www.omg.org/spec/BPMN/20100524/DI",F0="bpmndi",H0=[{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"]}],z0=[{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"}]}],V0=[],G0={name:$0,uri:j0,prefix:F0,types:H0,enumerations:z0,associations:V0},W0="DC",U0="http://www.omg.org/spec/DD/20100524/DC",Y0="dc",q0=[{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}]}],K0=[],X0={name:W0,uri:U0,prefix:Y0,types:q0,associations:K0},Z0="DI",Q0="http://www.omg.org/spec/DD/20100524/DI",J0="di",ew=[{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"}]}],tw=[],nw={tagAlias:"lowerCase"},iw={name:Z0,uri:Q0,prefix:J0,types:ew,associations:tw,xml:nw},rw="bpmn.io colors for BPMN",ow="http://bpmn.io/schema/bpmn/biocolor/1.0",aw="bioc",sw=[{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"}]}],cw=[],uw=[],lw={name:rw,uri:ow,prefix:aw,types:sw,enumerations:cw,associations:uw},pw="BPMN in Color",fw="http://www.omg.org/spec/BPMN/non-normative/color/1.0",dw="color",hw=[{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"}]}],mw=[],gw=[],yw={name:pw,uri:fw,prefix:dw,types:hw,enumerations:mw,associations:gw};const vw={bpmn:B0,bpmndi:G0,dc:X0,di:iw,bioc:lw,color:yw};function cd(e,t){const n=O({},vw,e);return new ts(n,t)}const _w={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"}},bw="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",ud="i18n",ns={[ud]:_w,[bu]:$f};function ld(){return cd(ns)}const pd=ld();async function $u(e){const{rootElement:t,warnings:n}=await pd.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function xw(e){const{xml:t}=await pd.toXML(e,{format:!0});return t}function ju(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const is=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),ww=1,Ew=2;function Yi(e){switch(e.kind){case"label-over-line":return`L|${e.edge}|${e.line}`;case"edge-crosses-shape":return`x|${e.edge}|${e.shape}`;case"shape-overlap":return`o|${e.shapes[0]}|${e.shapes[1]}`;case"shape-outside-container":return`c|${e.shape}|${e.container}`;case"edge-overlap-opposite":return`p|${e.edges[0]}|${e.edges[1]}`;case"edge-overlap-mixed":return`m|${e.edges[0]}|${e.edges[1]}`;case"label-on-shared-segment":return`l|${e.edge}|${e.other}`;case"annotation-over-label":return`a|${e.annotation}|${e.label}`;case"group-overlap-unintended":return`g|${e.groups[0]}|${e.groups[1]}`;case"group-on-container-boundary":return`gb|${e.group}|${e.container}|${e.side}`}}const fd=20,dd=5,Sw=3,hd=1;function hn(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 rs(e,t){let n=null;const i=e.type!==t.type;for(const r of hn(e))for(const o of hn(t)){if(r.axis!==o.axis||Math.abs(r.at-o.at)>hd)continue;const a=r.dir!==o.dir?"opposite":i?"mixed":null;if(!a)continue;const c=Math.min(r.hi,o.hi)-Math.max(r.lo,o.lo);c>=fd&&(!n||c>n.length)&&(n={axis:r.axis,length:c,kind:a})}return n}function md(e,t){const n=rs(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function Rw(e,t){let n=0;for(const i of t)i.id!==e.id&&md(e,i)&&n++;return n}function Tr(e,t){let n=0;for(const i of t)i.id!==e.id&&rs(e,i)&&n++;return n}const gd=15,yd=20;function Cw(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-yd||t.at>n[1]+yd)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 Fu=20;function os(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>hd)continue;const r=Math.max(e.lo,i.lo),o=Math.min(e.hi,i.hi);o-r<fd||n.push([r-Fu,o+Fu])}return n}function as(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of hn(e)){const o=Cw(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[c,s]of os(r,hn(a)))if(Math.min(s,o[1])>Math.max(c,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const Pw=1,Aw=(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 Tw(e,t,n,i){const r=n.x+i,o=n.y+i,a=n.x+n.width-i,c=n.y+n.height-i;if(a<=r||c<=o)return!1;const s=t.x-e.x,u=t.y-e.y;let l=0,p=1;const f=(d,h)=>{if(h===0)return d<=0;const m=d/h;if(h>0){if(m>p)return!1;m>l&&(l=m)}else{if(m<l)return!1;m<p&&(p=m)}return!0};return f(r-e.x,s)&&f(e.x-a,-s)&&f(o-e.y,u)&&f(e.y-c,-u)&&p>l}function vd(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 Mw=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,Vo=1;function Si(e,t){const n=e.x+Vo,i=e.x+e.width-Vo,r=e.y+Vo,o=e.y+e.height-Vo;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 Go(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 _d(e,t){const n=e.label;if(!n)return null;if(hn(e).some(i=>Si(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(hn(i).some(r=>Si(n,r)))return i.id;for(const i of t.shapes.filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(Go(i).some(r=>Si(n,r)))return i.id;return null}function zn(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(Tw(e.waypoints[o],e.waypoints[o+1],r,Ew)){i.push(r);break}}return i}function kw(e,t,n,i){const r=(u,l,p)=>(l.x-u.x)*(p.y-u.y)-(l.y-u.y)*(p.x-u.x),o=r(n,i,e),a=r(n,i,t),c=r(e,t,n),s=r(e,t,i);return o*a<0&&c*s<0}const bd=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function ss(e,t){let n=0;for(const i of t){if(i.id===e.id||bd(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++)kw(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function Ri(e,t){let n=0;for(const i of t)i.id===e.id||bd(e,i)||ss(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function xd(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++)ss(n[i],[n[r]])>0&&(t+=n[i].type===n[r].type?2:1);return t}function Hu(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(ss(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){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 Ed=e=>e?{members:e}:{},Ci=e=>e.shapes.filter(t=>!t.container);function Dw(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 Sd(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(hn(i).some(r=>Si(n,r)))return i.id;for(const i of[...t.shapes].filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(Go(i).some(r=>Si(n,r)))return i.id;return null}function cs(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 qi(e){const t=[],n=e.shapes.filter(s=>!s.container);for(const s of e.edges)for(const u of zn(s,n))t.push({kind:"edge-crosses-shape",edge:s.id,shape:u.id});const i=n.filter(s=>!s.attached);for(let s=0;s<i.length;s++)for(let u=s+1;u<i.length;u++){const l=i[s],p=i[u];if(!vd(l,p,ww))continue;const f=l.id<p.id?[l.id,p.id]:[p.id,l.id];t.push({kind:"shape-overlap",shapes:f,identical:Mw(l,p)})}const r=e.shapes.filter(s=>s.type==="bpmn:Group"&&Array.isArray(s.members)&&s.members.length>0);for(let s=0;s<r.length;s++)for(let u=s+1;u<r.length;u++){const l=r[s],p=r[u],f=Math.min(l.x+l.width,p.x+p.width)-Math.max(l.x,p.x),d=Math.min(l.y+l.height,p.y+p.height)-Math.max(l.y,p.y);if(f<=dd||d<=dd)continue;const h=new Set(p.members);l.members.some(m=>h.has(m))||t.push({kind:"group-overlap-unintended",groups:l.id<p.id?[l.id,p.id]:[p.id,l.id]})}const o=e.shapes.filter(s=>s.container&&s.type!=="bpmn:Group"&&s.type!=="bpmn:Lane");for(const s of e.shapes.filter(u=>u.type==="bpmn:Group"))for(const u of o){const l=s.x<u.x+u.width&&u.x<s.x+s.width,p=s.y<u.y+u.height&&u.y<s.y+s.height,f=[["top",s.y,u.y,l],["bottom",s.y+s.height,u.y+u.height,l],["left",s.x,u.x,p],["right",s.x+s.width,u.x+u.width,p]];for(const[d,h,m,g]of f)g&&Math.abs(h-m)<=Sw&&t.push({kind:"group-on-container-boundary",group:s.id,container:u.id,side:d})}for(let s=0;s<e.edges.length;s++)for(let u=s+1;u<e.edges.length;u++){const l=e.edges[s],p=e.edges[u],f=rs(l,p);if(!f)continue;const d=l.id<p.id?[l.id,p.id]:[p.id,l.id];t.push({kind:f.kind==="opposite"?"edge-overlap-opposite":"edge-overlap-mixed",edges:d,axis:f.axis,length:Math.round(f.length)})}for(const s of e.edges){if(!s.label)continue;const u=as(s,e.edges);u&&t.push({kind:"label-on-shared-segment",edge:s.id,other:u.other,axis:u.axis})}for(const s of e.edges){if(!s.label)continue;const u=_d(s,e);u&&t.push({kind:"label-over-line",edge:s.id,line:u})}for(const s of n){if(!s.label)continue;const u=Sd(s,e);u&&t.push({kind:"label-over-line",edge:s.id,line:u})}const a=cs(e);for(const s of n)if(s.type==="bpmn:TextAnnotation")for(const{owner:u,rect:l}of a)u!==s.id&&vd(s,l,Vo)&&t.push({kind:"annotation-over-label",annotation:s.id,label:u});const c=new Map(e.shapes.map(s=>[s.id,s]));for(const s of n){const u=s.parent??Dw(s,e,c);if(!u)continue;const l=c.get(u);!l||!l.container||Aw(l,s,Pw)||t.push({kind:"shape-outside-container",shape:s.id,container:l.id})}return t.sort((s,u)=>Yi(s).localeCompare(Yi(u)))}const gt=e=>typeof e=="object"&&e!==null?e:void 0,xt=e=>typeof e=="number"?e:0,Mr=e=>{const t=gt(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function Ow(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=Mr(o);a&&n.push(a)}}return n}function Lw(e,t){const n=gt(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const r=Mr(n);return r?t.get(r):void 0}if(is.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return Mr(n)}function Rd(e){var o,a,c,s,u;const t=[],n=[],i=((o=gt(e))==null?void 0:o.diagrams)??[],r=new Map;for(const l of((a=gt(e))==null?void 0:a.rootElements)??[]){const p=gt(l);if((p==null?void 0:p.$type)==="bpmn:Collaboration")for(const f of p.participants??[]){const d=gt(f),h=Mr(d),m=Mr(d==null?void 0:d.processRef);h&&m&&r.set(m,h)}}for(const l of i){const p=gt((c=gt(l))==null?void 0:c.plane),f=(p==null?void 0:p.planeElement)??[];for(const d of f){const h=gt(d);if(!h)continue;const m=gt(h.bpmnElement),g=typeof(m==null?void 0:m.id)=="string"?m.id:void 0;if(!g)continue;const R=typeof(m==null?void 0:m.$type)=="string"?m.$type:"",w=gt(h.bounds);if(w){const b=h.isExpanded===!1,E=gt((s=gt(h.label))==null?void 0:s.bounds);t.push({id:g,type:R,x:xt(w.x),y:xt(w.y),width:xt(w.width),height:xt(w.height),container:is.has(R)&&!b,attached:(m==null?void 0:m.attachedToRef)!==void 0,...m?{parent:Lw(m,r)}:{},...E?{label:{x:xt(E.x),y:xt(E.y),width:xt(E.width),height:xt(E.height)}}:{},...R==="bpmn:Group"?Ed(wd(m)):{}});continue}const x=h.waypoint;if(Array.isArray(x)){const b=gt((u=gt(h.label))==null?void 0:u.bounds);n.push({id:g,type:R,waypoints:x.map(E=>{var T,L;return{x:xt((T=gt(E))==null?void 0:T.x),y:xt((L=gt(E))==null?void 0:L.y)}}),endpoints:Ow(m),...b?{label:{x:xt(b.x),y:xt(b.y),width:xt(b.width),height:xt(b.height)}}:{}})}}}return{shapes:t,edges:n}}function Cd(e){return qi(Rd(e))}async function Iw(e){const{definitions:t,warnings:n}=await $u(e);return{findings:Cd(t),warnings:n}}function Ut(e){const t=[],n=[];for(const i of e.getAll()){const r=i;if(r.type==="label"||r.labelTarget)continue;const o=typeof r.type=="string"?r.type:"";if(o==="bpmn:Definitions"||o.startsWith("bpmndi:"))continue;const a=r.waypoints;if(a){const f=gt(r.label);n.push({id:r.id,type:o,waypoints:a.map(d=>({x:xt(d.x),y:xt(d.y)})),endpoints:[Mr(r.source),Mr(r.target)].filter(d=>!!d),...f&&typeof f.x=="number"?{label:{x:f.x,y:xt(f.y),width:xt(f.width),height:xt(f.height)}}:{}});continue}if(typeof r.x!="number"||typeof r.y!="number")continue;const c=gt(r.businessObject),s=gt(r.label);let u=gt(r.parent);for(;u&&u.type==="bpmn:Lane";)u=gt(u.parent);const l=typeof(u==null?void 0:u.type)=="string"?u.type:"",p=u&&is.has(l)&&l!=="bpmn:Group"&&typeof u.id=="string"?u.id:void 0;t.push({id:r.id,type:o,x:r.x,y:r.y,width:xt(r.width),height:xt(r.height),container:is.has(o)&&r.collapsed!==!0,attached:(c==null?void 0:c.attachedToRef)!==void 0,...p!==void 0?{parent:p}:{},...s&&typeof s.x=="number"?{label:{x:s.x,y:xt(s.y),width:xt(s.width),height:xt(s.height)}}:{},...o==="bpmn:Group"?Ed(wd(c)):{}})}return{shapes:t,edges:n}}const Nw={"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 Bw(e,t){const n=Nw[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function Pd(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function Ad(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 Bw(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&Pd(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?Pd(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 Td=20,$w=4,Pt=(e,t)=>Math.abs(e-t)<.5;function Md(e,t,n,i=Td){if(Pt(e.y,t.y)&&!Pt(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,c=e.x<t.x?n.x+n.width+i:n.x-i,s=u=>[{x:a,y:e.y},{x:a,y:u},{x:c,y:u},{x:c,y:e.y}];return[s(n.y-i),s(n.y+n.height+i)]}if(Pt(e.x,t.x)&&!Pt(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,c=e.y<t.y?n.y+n.height+i:n.y-i,s=u=>[{x:e.x,y:a},{x:u,y:a},{x:u,y:c},{x:e.x,y:c}];return[s(n.x-i),s(n.x+n.width+i)]}return null}function kd(e,t,n=Td){if(e.length!==4)return null;const[i,r,o,a]=e;if(Pt(i.y,r.y)&&Pt(r.x,o.x)&&Pt(o.y,a.y)){const c=s=>[i,{x:s,y:i.y},{x:s,y:a.y},a];return[c(t.x-n),c(t.x+t.width+n)]}if(Pt(i.x,r.x)&&Pt(r.y,o.y)&&Pt(o.x,a.x)){const c=s=>[i,{x:i.x,y:s},{x:a.x,y:s},a];return[c(t.y-n),c(t.y+t.height+n)]}return null}function zu(e,t){if(e.endpoints.length!==2)return[];const n=t.find(p=>p.id===e.endpoints[0]),i=t.find(p=>p.id===e.endpoints[1]);if(!n||!i)return[];if(i.x<=n.x+n.width)return[];const r=n.y+n.height/2,o=i.y+i.height/2;if(r>=i.y&&r<=i.y+i.height)return[];const a=i.x+i.width/2,c=n.x+n.width/2,s=r>o,u=[{x:n.x+n.width,y:r},{x:a,y:r},{x:a,y:s?i.y+i.height:i.y}],l=[{x:c,y:s?n.y:n.y+n.height},{x:c,y:o},{x:i.x,y:o}];return[u,l]}const Dd=30,jw=[0,-25,25,-40,40];function Fw(e,t){if(e.type!=="bpmn:MessageFlow"||e.endpoints.length!==2)return[];const n=t.find(f=>f.id===e.endpoints[0]),i=t.find(f=>f.id===e.endpoints[1]);if(!n||!i)return[];const r=n.y+n.height/2,o=i.y+i.height/2;if(i.y<n.y+n.height&&i.y+i.height>n.y)return[];const a=o<r,c=a?n.y+n.height:n.y,s=a?c+Dd:c-Dd,u=a?i.y+i.height:i.y,l=n.x+n.width/2,p=i.x+i.width/2;return jw.map(f=>[{x:l,y:c},{x:l,y:s},{x:p+f,y:s},{x:p+f,y:u}])}const Hw=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],us=(e,t,n)=>zn({...e,waypoints:t},n).length;function Od(e,t,n,i){let r=[...e.waypoints],o=us(e,r,t);if(o===0)return null;let a=!1;for(const p of zu(e,t))if(us(e,p,t)===0)return p;const c=(i??[]).filter(p=>p.id!==e.id).flatMap(hn),s=p=>hn({...e,waypoints:p}).some(f=>os(f,c).length>0),u=Fw(e,t).filter(p=>us(e,p,t)===0);if(u.length)return u.find(p=>!s(p))??u[0];const l=p=>!n||p.every(f=>f.x>=n.x&&f.x<=n.x+n.width&&f.y>=n.y&&f.y<=n.y+n.height);for(let p=0;p<$w&&o>0;p++){let f=!1;for(let d=0;d+1<r.length&&!f;d++){const h=r[d],m=r[d+1];for(const g of t){if(e.endpoints.includes(g.id)||zn({...e,waypoints:[h,m]},[g]).length===0)continue;const R=Md(h,m,g),w=R?R.map(b=>Hw(r,d,b)):kd(r,g)??[];if(!w.length)continue;const x=[...w].sort((b,E)=>Number(l(E))-Number(l(b)));for(const b of x){const E=us(e,b,t);if(E<o){r=b,o=E,f=!0,a=!0;break}}if(f)break}}if(!f)break}return a&&o===0?r:null}function Ld(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Ut(n),o=Ci(r),a=qi(r).filter(s=>s.kind==="edge-crosses-shape"&&!t.has(Yi(s)));if(!a.length)return;const c=new Map;for(const s of a){if(s.kind!=="edge-crosses-shape"||c.has(s.edge))continue;const u=r.edges.find(l=>l.id===s.edge);u&&c.set(s.edge,u)}for(const[s,u]of c){const l=n.get(s);if(!l)continue;const p=l.parent,f=p&&typeof p.x=="number"&&typeof p.width=="number"?{x:p.x,y:p.y,width:p.width,height:p.height}:void 0,d=Od(u,o,f,r.edges);d&&i.updateWaypoints(l,d)}}const zw=10;function Id(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 Nd(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(V=>V.type==="bpmn:Participant"&&V.container),i=t.shapes.find(V=>V.id===e.endpoints[0]),r=t.shapes.find(V=>V.id===e.endpoints[1]);if(!i||!r)return null;const o=Id(i,n),a=Id(r,n);if(!o||!a||o.id===a.id)return null;const c=a.y>o.y,s=c?o:a,u=c?a:o,l=n.filter(V=>V.id!==o.id&&V.id!==a.id&&V.y>=s.y+s.height&&V.y+V.height<=u.y).sort((V,fe)=>V.y-fe.y);if(!l.length)return null;const p=l[0],f=l[l.length-1],d=(s.y+s.height+p.y)/2,h=(f.y+f.height+u.y)/2,m=c?d:h,g=c?h:d,R=e.waypoints[0],w=e.waypoints[e.waypoints.length-1],x=Ci(t),b=t.edges.filter(V=>V.id!==e.id),E=Ri(e,b),T=zn(e,x).length;if(E===0&&T===0)return null;const L=Math.min(...l.map(V=>V.x)),A=Math.max(...l.map(V=>V.x+V.width)),F=(R.x+w.x)/2,H=V=>V.filter((fe,je)=>je===0||!(Pt(fe.x,V[je-1].x)&&Pt(fe.y,V[je-1].y)));let N;for(let V=L;V<=A;V+=zw){const fe=H([R,{x:R.x,y:m},{x:V,y:m},{x:V,y:g},{x:w.x,y:g},w]),je={...e,waypoints:fe};if(zn(je,x).length>0)continue;const lt=Ri(je,b),q=Math.abs(V-F);(!N||lt<N.cross||lt===N.cross&&q<N.detour)&&(N={pts:fe,cross:lt,detour:q})}return N&&(T>0?N.cross<=E:N.cross<E)?N.pts:null}function Bd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Ut(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=Ut(n),c=a.edges.find(l=>l.id===o.id);if(!c)continue;const s=Nd(c,a);if(!s)continue;const u=n.get(o.id);u&&i.updateWaypoints(u,s)}}const no=[25,-25,40,-40],ls=35;function $d(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,c=r<i.y,s=c?i.y:i.y+i.height,u=c?n.y:n.y+n.height,l=c?n.y-ls:n.y+n.height+ls,p=[];for(const w of[0,...no]){if(Math.abs(w)>=i.width/2-5)continue;const x=o+w;p.push({pts:[{x:n.x,y:r},{x,y:r},{x,y:s}],cost:Math.abs(w)});for(const b of[0,...no]){if(Math.abs(b)>=n.width/2-5)continue;const E=a+b;p.push({pts:[{x:E,y:u},{x:E,y:l},{x,y:l},{x,y:s}],cost:Math.abs(w)+Math.abs(b)})}}const f=50,d=i.y+i.height/2,h=c?n.y+n.height:n.y;for(const w of[0,...no]){if(Math.abs(w)>=n.width/2-5)continue;const x=a+w;p.push({pts:[{x,y:h},{x,y:d},{x:i.x+i.width,y:d}],cost:f+Math.abs(w)})}const m=60,g=c?i.y+i.height:i.y,R=c?i.y+i.height+ls:i.y-ls;for(const w of[0,...no]){if(Math.abs(w)>=i.width/2-5)continue;const x=o+w;for(const b of[0,...no]){if(Math.abs(b)>=n.width/2-5)continue;const E=a+b;p.push({pts:[{x:E,y:h},{x:E,y:R},{x,y:R},{x,y:g}],cost:m+Math.abs(w)+Math.abs(b)})}}return p}const ps=30;function jd(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],r=e[n+1],o=Pt(i.y,r.y)&&!Pt(i.x,r.x),a=Pt(i.x,r.x)&&!Pt(i.y,r.y);if(!(!o&&!a))for(const c of t)if(o){const s=Math.min(i.x,r.x);if(Math.max(i.x,r.x)<=c.x||s>=c.x+c.width)continue;if(Math.abs(i.y-c.y)<ps||Math.abs(i.y-(c.y+c.height))<ps)return!0}else{const s=Math.min(i.y,r.y);if(Math.max(i.y,r.y)<=c.y||s>=c.y+c.height)continue;if(Math.abs(i.x-c.x)<ps||Math.abs(i.x-(c.x+c.width))<ps)return!0}}return!1}const fs=40;function Vw(e,t,n){let i=0;for(const r of t){if(r.container||n.includes(r.id))continue;const o=r.x-fs,a=r.x+r.width+fs,c=r.y-fs,s=r.y+r.height+fs;for(let u=1;u<e.length-2;u++){const l=e[u],p=e[u+1],f={x:Math.min(l.x,p.x),y:Math.min(l.y,p.y)},d={x:Math.max(l.x,p.x),y:Math.max(l.y,p.y)};if(f.x<a&&d.x>o&&f.y<s&&d.y>c){i++;break}}}return i}function Fd(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(w=>w.container),i=new Map(t.shapes.map(w=>[w.id,w])),r=Ci(t),o=t.edges.filter(w=>w.id!==e.id),a=Tr(e,o),c=Ri(e,o),s=w=>Vw(w,t.shapes,e.endpoints)+(jd(w,n)?1:0),u=s(e.waypoints),l=w=>{if(!w)return;const x=w.x+w.width/2,b=w.y+w.height/2;return n.find(E=>E.type==="bpmn:Lane"&&x>=E.x&&x<=E.x+E.width&&b>=E.y&&b<=E.y+E.height)},p=l(i.get(e.endpoints[0]??"")),f=l(i.get(e.endpoints[1]??"")),d=!!p&&!!f&&p.id!==f.id,h=w=>{if(!d||!f)return!1;for(let x=1;x<w.length-2;x++){const b=w[x],E=w[x+1];if(Pt(b.y,E.y)&&!Pt(b.x,E.x)&&b.y>f.y&&b.y<f.y+f.height)return!0}return!1},m=h(e.waypoints);if(!jd(e.waypoints,n)&&!(d&&!m))return null;const g=w=>w.reduce((x,b,E)=>E?x+Math.abs(b.x-w[E-1].x)+Math.abs(b.y-w[E-1].y):0,0);let R;for(const{pts:w,cost:x}of $d(e,i)){const b={...e,waypoints:w};if(zn(b,r).length>0||Tr(b,o)>a||Ri(b,o)>c)continue;const E=s(w),T=h(w);if(!(T&&!m)&&E>=u)continue;const A=T?0:1,F=g(w);(!R||A<R.lane||A===R.lane&&(E<R.sc||E===R.sc&&(x<R.cost||x===R.cost&&F<R.len)))&&(R={pts:w,sc:E,lane:A,cost:x,len:F})}return(R==null?void 0:R.pts)??null}function Gw(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Ut(n).edges.filter(o=>!t.has(o.id)&&o.waypoints.length>=4).map(o=>o.id).sort();for(const o of r){const a=Ut(n),c=a.edges.find(d=>d.id===o);if(!c||c.waypoints.length<4)continue;const s=Ci(a),u=a.edges.filter(d=>d.id!==o),l=zn(c,s).length,p=Tr(c,u),f=Ri(c,u);for(const d of zu(c,a.shapes)){if(d.length>=c.waypoints.length)continue;const h={...c,waypoints:d};if(zn(h,s).length>l||Tr(h,u)>p||Ri(h,u)>f)continue;const m=n.get(o);m&&i.updateWaypoints(m,d);break}}}function Hd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Ut(n).edges.filter(o=>o.type==="bpmn:SequenceFlow"&&!t.has(o.id)).map(o=>o.id).sort();for(const o of r){const a=Ut(n),c=a.edges.find(l=>l.id===o);if(!c)continue;const s=Fd(c,a);if(!s)continue;const u=n.get(o);u&&i.updateWaypoints(u,s)}}function Ww(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=Pt(n[0].x,n[1].x)&&!Pt(n[0].y,n[1].y),c=Pt(n[n.length-1].x,n[n.length-2].x)&&!Pt(n[n.length-1].y,n[n.length-2].y);for(const s of no){if(a&&r&&Math.abs(s)<r.width/2-5){const u=n.map(l=>({...l}));u[0].x+=s,u[1].x+=s,i.push({pts:u,cost:Math.abs(s)})}if(c&&o&&Math.abs(s)<o.width/2-5){const u=n.map(l=>({...l}));u[u.length-1].x+=s,u[u.length-2].x+=s,i.push({pts:u,cost:Math.abs(s)})}}return i}function zd(e,t){const n=new Map(t.shapes.map(l=>[l.id,l])),i=Ci(t),r=t.edges.filter(l=>l.id!==e.id),o=Tr(e,r);if(o===0)return null;const a=Ri(e,r);let c;const s=l=>l.reduce((p,f,d)=>d?p+Math.abs(f.x-l[d-1].x)+Math.abs(f.y-l[d-1].y):0,0),u=[...$d(e,n),...Ww(e,n)];for(const{pts:l,cost:p}of u){const f={...e,waypoints:l};if(zn(f,i).length>0)continue;const d=Tr(f,r),h=Ri(f,r);if(d>=o||h-a>o-d)continue;const m=s(l);(!c||d<c.opposite||d===c.opposite&&(h<c.cross||h===c.cross&&(p<c.cost||p===c.cost&&m<c.len)))&&(c={pts:l,opposite:d,cross:h,cost:p,len:m})}return(c==null?void 0:c.pts)??null}function Vd(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Ut(i),a=qi(o).filter(l=>(l.kind==="edge-overlap-opposite"||l.kind==="edge-overlap-mixed")&&!t.has(Yi(l)));if(!a.length)return;const c=new Set;for(const l of a)if(!(l.kind!=="edge-overlap-opposite"&&l.kind!=="edge-overlap-mixed"))for(const p of l.edges)n.has(p)||c.add(p);const s=l=>{var p;return((p=o.edges.find(f=>f.id===l))==null?void 0:p.type)??""},u=[...c].sort((l,p)=>{const f=s(l)==="bpmn:SequenceFlow"?0:1,d=s(p)==="bpmn:SequenceFlow"?0:1;return f!==d?f-d:l.localeCompare(p)});for(const l of u){const p=Ut(i),f=p.edges.find(m=>m.id===l);if(!f)continue;const d=zd(f,p);if(!d)continue;const h=i.get(l);h&&r.updateWaypoints(h,d)}}const Uw=10,Yw=(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 Gd(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!as(e,i))return null;const r=Ci(t),o=i.flatMap(hn);for(const a of hn(e)){let c=[[a.lo,a.hi]];for(const[d,h]of os(a,o))c=c.flatMap(([m,g])=>{const R=[];return d>m&&R.push([m,Math.min(g,d)]),h<g&&R.push([Math.max(m,h),g]),R.filter(([w,x])=>x>w)});const s=a.axis==="h"?n.width:n.height,u=c.find(([d,h])=>h-d>=s+Uw*2);if(!u)continue;const l=(u[0]+u[1])/2,p=a.axis==="h"?{x:l,y:a.at-gd}:{x:a.at+Sn+n.width/2,y:l},f={x:p.x-n.width/2,y:p.y-n.height/2,width:n.width,height:n.height};if(!as({...e,label:f},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&Yw(f,d)))return f}return null}const Sn=8;function Wd(e,t){const n=e.label;if(!n)return null;const i=hn(e);if(!i.length)return null;const r=n.x+n.width/2,o=n.y+n.height/2,a=f=>{const d=f.axis==="h"?r:o,h=f.axis==="h"?o-f.at:r-f.at,m=d<f.lo?f.lo-d:d>f.hi?d-f.hi:0;return Math.hypot(h,m)},c=i.reduce((f,d)=>a(d)<a(f)?d:f,i[0]),s=[...i,...t.edges.filter(f=>f.id!==e.id).flatMap(hn),...t.shapes.filter(f=>f.container).flatMap(Go)],u=f=>!s.some(d=>Si(f,d));if(u(n))return null;const l=(c.axis==="v"?n.height:n.width)+Sn,p=[0,-l,l,-2*l,2*l];if(c.axis==="v")for(const f of[c.at+Sn,c.at-Sn-n.width])for(const d of p){const h=n.y+d;if(h<c.lo||h+n.height>c.hi)continue;const m={...n,x:f,y:h};if(u(m))return m}else for(const f of[c.at-Sn-n.height,c.at+Sn])for(const d of p){const h=n.x+d;if(h<c.lo||h+n.width>c.hi)continue;const m={...n,x:h,y:f};if(u(m))return m}return null}function Ud(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Ut(n);for(const o of r.edges){if(!o.label||t.has(o.id))continue;const a=Wd(o,r);if(!a)continue;const c=n.get(o.id),s=c==null?void 0:c.label;s&&i.moveElements([s],{x:a.x-s.x,y:a.y-s.y})}}function Yd(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Ut(i),a=qi(o).filter(c=>c.kind==="label-on-shared-segment"&&!t.has(Yi(c)));for(const c of a){if(c.kind!=="label-on-shared-segment"||n.has(c.edge))continue;const s=o.edges.find(f=>f.id===c.edge);if(!s)continue;const u=Gd(s,o);if(!u)continue;const l=i.get(c.edge),p=l==null?void 0:l.label;p&&r.moveElements([p],{x:u.x-p.x,y:u.y-p.y})}}function qd(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(hn),...t.shapes.filter(f=>f.container).flatMap(Go)],r=i.filter(f=>Si(n,f));if(!r.length)return null;const o=t.shapes.filter(f=>!f.container&&f.id!==e.id),a=cs(t).filter(f=>f.owner!==e.id).map(f=>f.rect),c=(f,d)=>f.x<d.x+d.width&&d.x<f.x+f.width&&f.y<d.y+d.height&&d.y<f.y+f.height,s=f=>!i.some(d=>Si(f,d))&&!o.some(d=>c(f,d))&&!a.some(d=>c(f,d)),u=[];for(const f of r)f.axis==="h"?u.push({...n,y:f.at-Sn-n.height},{...n,y:f.at+Sn}):u.push({...n,x:f.at-Sn-n.width},{...n,x:f.at+Sn});const l=e.x+e.width/2,p=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:p-n.height/2},{...n,x:e.x-Sn-n.width,y:p-n.height/2}),u.find(s)??null}function Kd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Ut(n);for(const o of r.shapes){if(o.container||!o.label||t.has(o.id))continue;const a=qd(o,Ut(n));if(!a)continue;const c=n.get(o.id),s=c==null?void 0:c.label;s&&i.moveElements([s],{x:a.x-s.x,y:a.y-s.y})}}const qw=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,Xd=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),Zd={"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}]},ds=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Vu=e=>typeof e=="string"&&e!=="";function Kw(e){const t=[];function n(i,r,o,a){if(a===null){Vu(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!ds(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const c of a)Vu(o[c])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${c}`})}return e.forEach((i,r)=>{if(!ds(i)||!Vu(i.kind)||!(i.kind in Zd)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const o of Zd[i.kind]){const a=o.path.endsWith("[]"),c=a?o.path.slice(0,-2):o.path,s=c.split(".");let u=i;for(const p of s.slice(0,-1)){if(!ds(u))break;u=u[p]}if(!ds(u))continue;const l=u[s[s.length-1]];if(!(l===void 0&&o.optional)&&!(l===null&&o.optional)){if(!a){n(r,o.path,l,o.shape);continue}if(!Array.isArray(l)){t.push({kind:"payload-invalid",opIndex:r,field:o.path});continue}l.forEach((p,f)=>n(r,`${c}[${f}]`,p,o.shape))}}if(i.kind==="node.add"){const o=i.band;o!==void 0&&(!Number.isInteger(o)||o<0)&&t.push({kind:"payload-invalid",opIndex:r,field:"band"})}}),t}function Qd(e,t){const n=Kw(e);if(n.length>0)return n;const i=[],r=new Map,o=new Map;function a(f,d,h){if(!qw.test(d)){i.push({kind:"id-invalid",opIndex:f,id:d});return}if(t.categoryOf(d)!==void 0||r.has(d)){i.push({kind:"id-duplicate",opIndex:f,id:d});return}r.set(d,{...h,opIndex:f})}e.forEach((f,d)=>{var h;switch(f.kind){case"participant.add":a(d,f.participant.id,{category:"participant",lanes:(f.participant.lanes??[]).map(m=>m.id)});for(const m of f.participant.lanes??[])a(d,m.id,{category:"lane"});break;case"node.add":a(d,f.node.id,{category:"flowNode",participant:f.node.participant});break;case"sequenceFlow.add":a(d,f.flow.id,{category:"sequenceFlow"});break;case"messageFlow.add":a(d,f.flow.id,{category:"messageFlow"});break;case"dataStore.add":a(d,f.dataStore.id,{category:"dataStore"});for(const m of f.associations??[])m.id&&a(d,m.id,{category:"dataAssociation"});break;case"dataAssociation.add":f.association.id&&a(d,f.association.id,{category:"dataAssociation"});break;case"association.add":f.association.id&&a(d,f.association.id,{category:"association"});break;case"annotation.add":a(d,f.annotation.id,{category:"annotation"}),(h=f.association)!=null&&h.id&&a(d,f.association.id,{category:"association"});break;case"group.add":a(d,f.group.id,{category:"group"});break;case"participant.update":if(f.lanes){o.set(f.id,f.lanes.map(m=>m.id));for(const m of f.lanes)t.categoryOf(m.id)===void 0&&a(d,m.id,{category:"lane"})}break}});const c=f=>{var d;return((d=r.get(f))==null?void 0:d.category)??t.categoryOf(f)},s=f=>{const d=r.get(f);return d?d.category==="participant"?f:d.participant:t.categoryOf(f)==="participant"?f:t.participantOf(f)};function u(f,d,h,m){const g=c(d);if(g===void 0){i.push({kind:"ref-missing",opIndex:f,ref:d,role:h});return}if(m&&!m.includes(g)){i.push({kind:"ref-category",opIndex:f,ref:d,role:h,expected:m.join("|"),actual:g});return}return g}const l=t.isCollaboration()||e.some(f=>f.kind==="participant.add");return e.forEach((f,d)=>{var h;switch(f.kind){case"participant.add":break;case"node.add":{const{participant:m,lane:g}=f.node;if(m===void 0){(l||g!==void 0)&&i.push({kind:"participant-required",opIndex:d,id:f.node.id});break}if(u(d,m,"participant",["participant"])===void 0)break;g!==void 0&&((((h=r.get(m))==null?void 0:h.lanes)??o.get(m)??t.lanesOf(m)).includes(g)||i.push({kind:"lane-unknown",opIndex:d,lane:g,participant:m}));break}case"sequenceFlow.add":{const{id:m,source:g,target:R,name:w,condition:x}=f.flow,b=u(d,g,"source",["flowNode"]),E=u(d,R,"target",["flowNode"]);b&&E&&s(g)!==s(R)&&i.push({kind:"flow-cross-pool",opIndex:d,id:m}),w!==void 0&&x!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:m});break}case"messageFlow.add":{const{id:m,source:g,target:R}=f.flow,w=u(d,g,"source",["flowNode","participant"]),x=u(d,R,"target",["flowNode","participant"]);if(w&&x){const b=s(g),E=s(R);b!==void 0&&b===E&&i.push({kind:"message-flow-same-pool",opIndex:d,id:m})}break}case"dataStore.add":{for(const m of f.associations??[]){if([m.source,m.target].filter(w=>w===f.dataStore.id).length!==1){i.push({kind:"data-association-ends",opIndex:d,source:m.source,target:m.target});continue}const R=m.source===f.dataStore.id?m.target:m.source;u(d,R,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:m,target:g}=f.association,R=u(d,m,"source"),w=u(d,g,"target");if(R&&w){const x=new Set([R,w]);x.has("dataStore")&&x.has("flowNode")||i.push({kind:"data-association-ends",opIndex:d,source:m,target:g})}break}case"association.add":{const{id:m,source:g,target:R}=f.association,w=u(d,g,"source"),x=u(d,R,"target");w&&x&&w!=="annotation"&&x!=="annotation"&&i.push({kind:"association-detached",opIndex:d,annotation:m??`${g}->${R}`});break}case"annotation.add":{if(f.association){const{source:m,target:g}=f.association;if(m!==f.annotation.id&&g!==f.annotation.id)i.push({kind:"association-detached",opIndex:d,annotation:f.annotation.id});else{const R=m===f.annotation.id?g:m;u(d,R,"association")}}f.placement&&u(d,f.placement.anchor,"anchor");break}case"group.add":{for(const m of f.group.members??[]){const g=u(d,m,"member");g&&Xd.has(g)&&i.push({kind:"ref-category",opIndex:d,ref:m,role:"member",expected:"shape",actual:g})}break}case"participant.update":{if(p(d,f.id,"participant")===void 0)break;if(f.lanes){const m=t.lanesOf(f.id),g=f.lanes.map(w=>w.id);for(const w of m)g.includes(w)||i.push({kind:"lane-shrink-unsupported",opIndex:d,participant:f.id,lane:w});for(const w of g)t.categoryOf(w)!==void 0&&!m.includes(w)&&i.push({kind:"id-duplicate",opIndex:d,id:w});const R=g.filter(w=>m.includes(w));R.length===m.length&&R.some((w,x)=>w!==m[x])&&i.push({kind:"lane-reorder-unsupported",opIndex:d,participant:f.id})}break}case"node.update":{if(p(d,f.id,"flowNode")===void 0)break;if(f.lane!==void 0){const m=t.participantOf(f.id);(m?o.get(m)??t.lanesOf(m):[]).includes(f.lane)||i.push({kind:"lane-unknown",opIndex:d,lane:f.lane,participant:m??""})}break}case"sequenceFlow.update":{if(p(d,f.id,"sequenceFlow")===void 0)break;if(f.name!==void 0&&f.condition!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:f.id}),f.source!==void 0||f.target!==void 0){const m=f.source===void 0||u(d,f.source,"source",["flowNode"])!==void 0,g=f.target===void 0||u(d,f.target,"target",["flowNode"])!==void 0,R=t.endpointsOf(f.id),w=f.source??(R==null?void 0:R.source),x=f.target??(R==null?void 0:R.target);m&&g&&w!==void 0&&x!==void 0&&new Set([s(w),s(x),s(f.id)]).size>1&&i.push({kind:"flow-cross-pool",opIndex:d,id:f.id})}break}case"messageFlow.update":p(d,f.id,"messageFlow");break;case"dataStore.update":p(d,f.id,"dataStore");break;case"annotation.update":{if(p(d,f.id,"annotation")===void 0)break;f.placement&&u(d,f.placement.anchor,"anchor");break}case"group.update":{if(p(d,f.id,"group")===void 0)break;for(const m of f.members??[]){const g=u(d,m,"member");g&&Xd.has(g)&&i.push({kind:"ref-category",opIndex:d,ref:m,role:"member",expected:"shape",actual:g})}break}case"element.remove":{p(d,f.id)==="lane"&&i.push({kind:"ref-category",opIndex:d,ref:f.id,role:"target",expected:"removable",actual:"lane"});break}}}),i;function p(f,d,h){if(r.has(d)){i.push({kind:"target-added-in-batch",opIndex:f,id:d});return}const m=t.categoryOf(d);if(m===void 0){i.push({kind:"ref-missing",opIndex:f,ref:d,role:"target"});return}if(h&&m!==h){i.push({kind:"ref-category",opIndex:f,ref:d,role:"target",expected:h,actual:m});return}return m}}const io={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},Xw=/[ᄀ-ᇿ -〿぀-ヿ㐀-鿿가-힯＀-⦆]/;function Zw(e){const t=io;return Xw.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 Wo(e,t){let n=0;for(const i of e)n+=t*Zw(i);return n}function Jd(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&Qw(e),Jw(e),eE(e),tE(e)}function Qw(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:Wo(r,o),fontBoundingBoxAscent:o*io.ascentEm,fontBoundingBoxDescent:o*io.descentEm,actualBoundingBoxAscent:o*io.ascentEm,actualBoundingBoxDescent:o*io.descentEm}}};t.getContext=()=>n}function Jw(e){if(e.SVGMatrix)return;class t{constructor(){Kr(this,"a",1);Kr(this,"b",0);Kr(this,"c",0);Kr(this,"d",1);Kr(this,"e",0);Kr(this,"f",0)}static of(i,r,o,a,c,s){return Object.assign(new t,{a:i,b:r,c:o,d:a,e:c,f:s})}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 eE(e){var o;const t=()=>{const a=new e.SVGMatrix;return{type:0,matrix:a,setTranslate(c,s){a.e=c,a.f=s},setScale(c,s){a.a=c,a.d=s},setRotate(c,s=0,u=0){const l=c*Math.PI/180,p=Math.cos(l),f=Math.sin(l);a.a=p,a.b=f,a.c=-f,a.d=p,a.e=s-p*s+f*u,a.f=u-f*s-p*u},setMatrix(c){Object.assign(a,c)}}},n=a=>{const c=t();return Object.assign(c.matrix,a),c},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:c=>(a.push(c),c),getItem:c=>a[c],createSVGTransformFromMatrix:n,consolidate:()=>a[a.length-1]??null}}}return this.__headlessTransformList}})}function tE(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:Wo(n,12),height:14}})}function eh(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 hs(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const Gu={"top-left":[-1,-1],top:[0,-1],"top-right":[1,-1],right:[1,0],"bottom-right":[1,1],bottom:[0,1],"bottom-left":[-1,1],left:[-1,0]};function Xt(e,t){return e.filter(n=>n.kind===t)}function th(e,t){var bx,xx,wx,Ex,Sx,Rx;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:c,bpmnReplace:s}=t,u=()=>a.getRootElement(),l=S=>o.get(S),p=S=>{const P=l(S);if(!P)throw new Error(`하강 참조 해소 실패: ${S}`);return P},f=S=>{let P=S.parent;for(;P;){if(P.type==="bpmn:Participant")return P;P=P.parent}},d=Xt(e,"participant.add"),h=Xt(e,"node.add"),m=Xt(e,"sequenceFlow.add"),g=Xt(e,"messageFlow.add"),R=Xt(e,"dataStore.add"),w=Xt(e,"dataAssociation.add"),x=Xt(e,"annotation.add"),b=Xt(e,"group.add"),E=new Map(h.map(S=>[S.node.id,S])),T=(S,P,k)=>{var ae;const z=S.businessObject,G=(((ae=z.extensionElements)==null?void 0:ae.values)??[]).filter(Q=>Q.$type!==P),B=k?[...G,i.create(P,k)]:G;if(!B.length){z.extensionElements&&n.updateProperties(S,{extensionElements:void 0});return}const Y=i.create("bpmn:ExtensionElements",{values:B});B.forEach(Q=>{Q.$parent=Y}),n.updateProperties(S,{extensionElements:Y})},L=S=>({anchor:S.anchor,side:S.side,...S.offset!==void 0?{offset:S.offset}:{}});for(const S of Xt(e,"element.remove")){const P=l(S.id);P&&n.removeElements([P])}const A=S=>o.filter(P=>{var k;return P.type==="bpmn:Lane"&&((k=f(P))==null?void 0:k.id)===S}).sort((P,k)=>P.y-k.y);for(const S of Xt(e,"participant.update")){const P=p(S.id);if(S.name!==void 0&&n.updateProperties(P,{name:S.name??void 0}),!S.lanes)continue;const k=A(S.id);if(!k.length){n.splitLane(P,S.lanes.length),A(S.id).forEach((G,B)=>{const Y=S.lanes[B];Y&&n.updateProperties(G,{id:Y.id,name:Y.name})});continue}const z=new Set(k.map(G=>G.id));S.lanes.forEach((G,B)=>{if(z.has(G.id)){n.updateProperties(p(G.id),{name:G.name});return}const Y=B===0?n.addLane(A(S.id)[0],"top"):n.addLane(p(S.lanes[B-1].id),"bottom");n.updateProperties(Y,{id:G.id,name:G.name})})}const F=150,H=130,N=80,V=90,fe=180,je=new Set;for(const S of d){je.add(`pool:${S.participant.id}`);for(const P of S.participant.lanes??[])je.add(P.id)}const lt=new Map;for(const S of h){const P=S.node.lane??`pool:${S.node.participant??""}`;let k=lt.get(P);k||lt.set(P,k=new Set([0])),S.band!==void 0&&k.add(S.band)}const q=new Map;for(const[S,P]of lt){if(!je.has(S))continue;const k=[...P].sort((B,Y)=>B-Y),z=k.map((B,Y)=>Y===0?0:Y%2===1?Math.ceil(Y/2):-(Y/2)),G=Math.min(...z);q.set(S,new Map(k.map((B,Y)=>[B,z[Y]-G])))}{const S=new Map;for(const P of d)(P.participant.lanes??[]).forEach((k,z)=>S.set(k.id,z));for(const[P,k]of q){if(!S.has(P)||k.size<2)continue;const z=S.get(P),G=k.get(0)??0,B=new Set;for(const Ne of h){if(Ne.node.lane!==P||(Ne.band??0)!==0||!Ne.node.type.endsWith("Gateway"))continue;const Te={in:new Set,out:new Set,cross:new Set};for(const ve of m){const nt=ve.flow.source===Ne.node.id;if(!nt&&ve.flow.target!==Ne.node.id)continue;const Bt=E.get(nt?ve.flow.target:ve.flow.source);if(!Bt||Bt.node.participant!==Ne.node.participant||!Bt.node.lane)continue;let Et,pt=!1;if(Bt.node.lane!==P){const Fn=S.get(Bt.node.lane);if(Fn===void 0)continue;Et=Fn>z?"down":"up",pt=!0}else{const Fn=k.get(Bt.band??0)??G;Et=Fn>G?"down":Fn<G?"up":void 0}Et&&(Te[nt?"out":"in"].add(Et),pt&&Te.cross.add(Et))}for(const ve of["up","down"])Te.in.has(ve)&&Te.out.has(ve)&&Te.cross.has(ve)&&B.add(ve)}if(B.size!==1)continue;const[Y]=B,ae=Math.max(...k.values()),Q=Y==="down"?ae:0;if(G===Q)continue;const le=[...k.entries()].filter(([Ne])=>Ne!==0).sort((Ne,Te)=>Ne[1]-Te[1]),Ye=[...Array(ae+1).keys()].filter(Ne=>Ne!==Q),ct=new Map([[0,Q]]);le.forEach(([Ne],Te)=>ct.set(Ne,Ye[Te])),q.set(P,ct)}}const de=S=>{var P;return(((P=lt.get(S))==null?void 0:P.size)??0)>1},he=S=>S.band??(S.node.lane||!de(`pool:${S.node.participant??""}`)?void 0:0),ce=new Map,ue=S=>ce.get(S.node.id)??he(S),ee=new Set,j=new Set;{const S=new Map;for(const z of m)S.set(z.flow.target,(S.get(z.flow.target)??0)+1);const P=z=>{const G=[],B=new Set([z]),Y=[z];for(;Y.length;){const ae=Y.shift();G.push(ae);for(const Q of m)Q.flow.source!==ae||B.has(Q.flow.target)||(S.get(Q.flow.target)??0)!==1||(B.add(Q.flow.target),Y.push(Q.flow.target))}return G},k=(z,G)=>{var B;return((B=q.get(z))==null?void 0:B.get(G))??G};for(const z of h){if(!z.node.type.endsWith("Gateway"))continue;const G=z.node.lane??`pool:${z.node.participant??""}`,B=q.get(G);if(!B||B.size<2)continue;const Y=ue(z);if(Y===void 0||k(G,Y)!==k(G,0))continue;const ae=k(G,Y),Q=m.filter(ve=>ve.flow.source===z.node.id).map(ve=>E.get(ve.flow.target)).filter(ve=>!!ve&&(ve.node.lane??`pool:${ve.node.participant??""}`)===G),le=Q.filter(ve=>{const nt=ue(ve);return nt!==void 0&&k(G,nt)===ae&&(S.get(ve.node.id)??0)===1}),Ye=Q.some(ve=>{const nt=ue(ve);return nt!==void 0&&k(G,nt)>ae});if(le.length!==1||!Ye)continue;const ct=new Set(Q.flatMap(ve=>P(ve.node.id)));if(!m.some(ve=>ve.flow.target===z.node.id&&ct.has(ve.flow.source)))continue;const Te=new Map;for(const[ve,nt]of B)Te.set(ve,nt+1);Te.set(-1,0),q.set(G,Te);for(const ve of P(le[0].node.id))E.has(ve)&&(ce.set(ve,-1),j.add(ve));ee.add(z.node.id)}}const $=(S,P)=>{var k;return((k=q.get(S))==null?void 0:k.get(P))??P},U=new Map;for(const[S,P]of lt){let k=0;for(const z of P)k=Math.max(k,$(S,z));U.set(S,k)}const ke=S=>fe+F*S,Lt=d.map((S,P)=>({op:S,declared:P}));Lt.sort((S,P)=>{const k=S.op.order??Number.POSITIVE_INFINITY,z=P.op.order??Number.POSITIVE_INFINITY;return k!==z?k-z:S.declared-P.declared});let C=80;for(const S of o.getAll())S.parent===u()&&"height"in S&&typeof S.y=="number"&&(C=Math.max(C,S.y+S.height+60));for(const{op:S}of Lt){const P=S.participant,k=h.filter(Ne=>Ne.node.participant===P.id).length,z=((bx=P.lanes)==null?void 0:bx.length)??0,G=Math.max(1200,k*160+300),B=(P.lanes??[]).map(Ne=>ke(U.get(Ne.id)??0)),Y=B.reduce((Ne,Te)=>Ne+Te,0);z&&Y<300&&(B[z-1]+=300-Y);const ae=Math.max(300,F*((U.get(`pool:${P.id}`)??0)+1)),Q=P.blackBox||k+z===0?120:z?Math.max(300,Y):ae,le=r.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:P.id,name:P.name,...S.order!==void 0?{"bwl:poolOrder":S.order}:{},...P.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:G,height:Q,isExpanded:!0}),Ye=n.createShape(le,{x:100+G/2,y:C+Q/2},u()),ct=P.lanes??[];if(ct.length&&n.splitLane(Ye,ct.length),ct.length){const Ne=o.filter(Te=>{var ve;return Te.type==="bpmn:Lane"&&((ve=f(Te))==null?void 0:ve.id)===P.id}).sort((Te,ve)=>Te.y-ve.y);if(Ne.forEach((Te,ve)=>{const nt=ct[ve];nt&&n.updateProperties(Te,{id:nt.id,name:nt.name})}),B.some(Te=>Te!==Ye.height/z)){let Te=Ye.y;Ne.forEach((ve,nt)=>{const Bt=B[nt];n.resizeShape(ve,{x:ve.x,y:Te,width:ve.width,height:Bt}),Te+=Bt})}}C=Ye.y+Ye.height+60}const _=S=>{var z;const P=E.get(S);if(P)return P.node.participant??"";const k=l(S);return k?k.type==="bpmn:Participant"?k.id:((z=f(k))==null?void 0:z.id)??"":""},y=new Map,D=S=>{let P=y.get(S);return P||y.set(S,P={nodes:[],flows:[]}),P};for(const S of h)D(S.node.participant??"").nodes.push(S);for(const S of m)D(_(S.flow.source)).flows.push(S);const I=S=>{var P;return i.create("bpmn:SequenceFlow",{id:S.id,name:S.name??((P=S.condition)==null?void 0:P.label)})},W=(S,P)=>r.createShape({type:hs(S.type),businessObject:i.create(hs(S.type),{id:S.id,name:S.name,...P!==void 0?{"bwl:band":P}:{}})}),oe=[...Lt.map(({op:S})=>S.participant.id).filter(S=>y.has(S)),...[...y.keys()].filter(S=>!d.some(P=>P.participant.id===S))],Pe=S=>S.endsWith("Gateway");for(const S of oe){const P=y.get(S),k=S?p(S):void 0,z=k?k.x+150:250;let G=k?k.y+80:120;const B=(ne,ge,pe)=>{const Ze=u().children.filter(qe=>!("waypoints"in qe&&qe.waypoints)&&qe.id!==ge&&typeof qe.y=="number"&&qe.y>=ne);Ze.length&&n.moveElements(Ze,{x:0,y:pe})},Y=(ne,ge)=>{if(ne){const Ae=p(ne),Ke=ke(ge);if(Ae.height>=Ke)return;const Vt=Ke-Ae.height,se=f(Ae),We=se?se.y+se.height:Ae.y+Ae.height;n.resizeLane(Ae,{x:Ae.x,y:Ae.y,width:Ae.width,height:Ke},!1),B(We,se==null?void 0:se.id,Vt);return}if(!k)return;const pe=F*(ge+1);if(k.height>=pe)return;const Ze=pe-k.height,qe=k.y+k.height;n.resizeShape(k,{x:k.x,y:k.y,width:k.width,height:pe}),B(qe,k.id,Ze)},ae=(ne,ge,pe)=>{if(ne){const Ze=p(ne);return Ze.y+Math.min(Ze.height/2,V)+$(ne,ge??0)*F}return ge!==void 0&&k?k.y+N+$(`pool:${S}`,ge)*F:pe},Q=(ne,ge,pe)=>{if(ne){const Ze=p(ne);return Ze.y+Math.min(Ze.height/2,V)+ge*F}return k?k.y+N+ge*F:pe},le=ne=>ne.participant?p(ne.participant):u(),Ye=30,ct=(ne,ge,pe,Ze)=>{const qe=pe-ge.width/2,Ae=Ze-ge.height/2;return(ne.children??[]).find(Ke=>!("waypoints"in Ke&&Ke.waypoints)&&Ke.type!=="bpmn:Lane"&&Ke.type!=="label"&&typeof Ke.x=="number"&&qe<Ke.x+Ke.width+Ye&&qe+ge.width+Ye>Ke.x&&Ae<Ke.y+Ke.height&&Ae+ge.height>Ke.y)},Ne=(ne,ge,pe,Ze,qe,Ae)=>{const Ke=pe!==void 0||Ze!==void 0,Vt=$(pe??`pool:${S}`,Ze??0);if(Ke)for(let Le=0;Le<4;Le++){const Be=Q(pe,Vt+Le,Ae);if(!ct(ne,ge,qe,Be))return Y(pe,Vt+Le),{x:qe,y:Be}}const se=ae(pe,Ze,Ae);Ke&&Y(pe,Vt);let We=qe;for(let Le=0;Le<64;Le++){const Be=ct(ne,ge,We,se);if(!Be)break;We=Be.x+Be.width+H+ge.width/2}return{x:We,y:se}},Te=new Set(P.flows.map(ne=>ne.flow.target)),ve=new Map;for(const ne of P.nodes){if(Te.has(ne.node.id))continue;const ge=W(ne.node,ne.band),pe=he(ne),Ze=ne.node.lane?`${ne.node.lane}|${pe??""}`:pe!==void 0?`band:${pe}`:"",qe=le(ne.node),Ae=Ne(qe,ge,ne.node.lane,pe,ve.get(Ze)??z,G);n.createShape(ge,Ae,qe),ve.set(Ze,Ae.x+ge.width+H),!ne.node.lane&&pe===void 0&&(G+=160)}const nt=new Set,Bt=new Map,Et=new Map,pt=new Map;if(S&&je.has(`pool:${S}`)){const ne=new Map;for(const se of P.flows)ne.set(se.flow.target,(ne.get(se.flow.target)??0)+1);const ge=se=>ae(se.node.lane,ue(se),Number.NaN),pe=new Set,Ze=se=>{var Be;const We=(Be=E.get(se))==null?void 0:Be.node.participant;if(We)return l(We);const Le=l(se);if(Le)return Le.type==="bpmn:Participant"?Le:f(Le)},qe=se=>{const We=[],Le=new Set([se]),Be=[se];for(;Be.length;){const mt=Be.shift(),Qe=E.get(mt);Qe&&We.push(Qe);for(const Ee of P.flows)Ee.flow.source!==mt||Le.has(Ee.flow.target)||(ne.get(Ee.flow.target)??0)!==1||(Le.add(Ee.flow.target),Be.push(Ee.flow.target))}return We},Ae=se=>{if(!k)return;const We=new Set(se.map(mt=>mt.node.id));let Le=!1,Be=!1;for(const mt of g){if(!We.has(mt.flow.source))continue;const Qe=Ze(mt.flow.target);!Qe||Qe.id===k.id||(Qe.y<k.y?Le=!0:Be=!0)}return Le&&!Be?"up":Be&&!Le?"down":void 0};for(const se of P.nodes){if(!Pe(se.node.type))continue;const We=ae(se.node.lane,he(se),Number.NaN);if(Number.isNaN(We))continue;const Le=[];for(const Ee of P.flows){if(Ee.flow.source!==se.node.id)continue;const ze=E.get(Ee.flow.target);if(!ze||ze.node.lane!==se.node.lane||(ne.get(ze.node.id)??0)!==1)continue;const Je=he(ze);if(Je===void 0)continue;const yn=ae(ze.node.lane,Je,Number.NaN);if(Number.isNaN(yn))continue;const qr=qe(ze.node.id),Kt=Ae(qr);Kt&&Le.push({subtree:qr,band:Je,row:yn,dir:Kt})}if(!Le.some(Ee=>Ee.dir==="up")||!Le.some(Ee=>Ee.dir==="down")||!Le.some(Ee=>Ee.dir==="up"&&Le.some(ze=>ze.dir==="down"&&ze.row<Ee.row)))continue;const mt=[...Le].sort((Ee,ze)=>Ee.row-ze.row);[...Le.filter(Ee=>Ee.dir==="up"),...Le.filter(Ee=>Ee.dir==="down")].sort((Ee,ze)=>Ee.dir===ze.dir?Ee.row-ze.row:Ee.dir==="up"?-1:1).forEach((Ee,ze)=>{const Je=mt[ze].band;if(Je!==Ee.band){pe.add(se.node.id);for(const yn of Ee.subtree)he(yn)===Ee.band&&ce.set(yn.node.id,Je)}})}const Ke=se=>{if(!k)return;const We=new Set(se.map(mt=>mt.node.id));let Le=!1,Be=!1;for(const mt of g){if(!We.has(mt.flow.target))continue;const Qe=Ze(mt.flow.source);!Qe||Qe.id===k.id||(Qe.y<k.y?Le=!0:Be=!0)}return Le&&!Be?"up":Be&&!Le?"down":void 0};for(const se of P.nodes){if(!Pe(se.node.type))continue;const We=se.node.lane??`pool:${S}`,Le=q.get(We);if(!Le||Le.size<2)continue;const Be=Le.get(0);if(Be===void 0)continue;const mt=Math.max(...Le.values()),Qe=Be===mt&&Be!==0?"down":void 0;if(!Qe)continue;const Ee=[];for(const Kt of P.flows){if(Kt.flow.source!==se.node.id)continue;const ti=E.get(Kt.flow.target);if(!ti||ti.node.lane!==se.node.lane||(ne.get(ti.node.id)??0)!==1)continue;const Cx=ue(ti);Cx!==void 0&&Ee.push({t:ti,subtree:qe(ti.node.id),band:Cx})}const ze=Ee.find(Kt=>(Le.get(Kt.band)??Kt.band)===Be);if(!ze||Ke(ze.subtree)===Qe||Ae(ze.subtree)===Qe)continue;const Je=Ee.find(Kt=>Kt!==ze&&Ke(Kt.subtree)===Qe);if(!Je)continue;const yn=ze.band,qr=Je.band;for(const Kt of ze.subtree)ue(Kt)===yn&&ce.set(Kt.node.id,qr);for(const Kt of Je.subtree)ue(Kt)===qr&&ce.set(Kt.node.id,yn);pe.add(se.node.id)}for(const se of P.nodes){if(!Pe(se.node.type))continue;const We=ge(se);if(Number.isNaN(We)||x.some(Ee=>{var ze,Je;return(((ze=Ee.placement)==null?void 0:ze.anchor)??(Ee.association?Ee.association.source===Ee.annotation.id?Ee.association.target:Ee.association.source:void 0))===se.node.id&&((Je=Ee.placement)==null?void 0:Je.side.startsWith("bottom"))}))continue;let Be,mt=!1,Qe;for(const Ee of P.flows){if(Ee.flow.source!==se.node.id)continue;const ze=E.get(Ee.flow.target);if(!ze||!ze.node.lane&&he(ze)===void 0)continue;const Je=ge(ze);Number.isNaN(Je)||(Math.abs(Je-We)<.5&&(mt=!0),Je>We?!Be||Je>Be.row?Be={id:ze.node.id,row:Je,count:1}:Je===Be.row&&Be.count++:Je<We&&ze.node.lane===se.node.lane&&(!Qe||Je>Qe.row?Qe={op:ze,row:Je,count:1}:Je===Qe.row&&Qe.count++))}Be&&Be.count===1&&(ne.get(Be.id)??0)===1&&!pe.has(se.node.id)&&nt.add(Be.id),!mt&&Qe&&Qe.count===1&&(ne.get(Qe.op.node.id)??0)===1&&!ee.has(se.node.id)&&Bt.set(Qe.op.node.id,{lane:se.node.lane,band:ue(se)})}const Vt=new Map;for(const se of g)Vt.set(se.flow.target,[...Vt.get(se.flow.target)??[],se]);for(const se of P.nodes){const We=Vt.get(se.node.id);if(!We||We.length!==1||!ne.get(se.node.id)||!se.node.lane&&he(se)===void 0||j.has(se.node.id))continue;const Le=(xx=E.get(We[0].flow.source))==null?void 0:xx.node.participant,Be=Le?l(Le):void 0;if(!Be||!k||Be.id===k.id)continue;const mt=se.node.lane??`pool:${S}`,Qe=q.get(mt);if(!Qe)continue;const Ee=Qe.get(0)??0,ze=(Qe.get(ue(se)??0)??Ee)-Ee;if(ze===0)continue;const Je=Be.y<k.y;if(Je&&ze<0||!Je&&ze>0)continue;let yn;for(const[qr,Kt]of Qe){const ti=Kt-Ee;(Je&&ti<0&&(!yn||ti<yn.row)||!Je&&ti>0&&(!yn||ti>yn.row))&&(yn={band:qr,row:ti})}yn&&Et.set(se.node.id,{lane:se.node.lane,band:yn.band})}}const Fn=new Set;let _u=0;for(;_u++<P.nodes.length+2;){for(let pe=0;pe<P.nodes.length+P.flows.length+2;pe++){let Ze=!1;for(const qe of P.flows){const Ae=qe.flow;if(Fn.has(Ae.id))continue;const Ke=l(Ae.source);if(!Ke)continue;const Vt=l(Ae.target),se=E.get(Ae.target);if(!Vt&&se){const We=W(se.node,se.band),Le=ue(se);if(se.node.lane||Le!==void 0){const Be=le(se.node),mt=Ke,Qe=mt.x+(pt.get(Ae.source)??0)+mt.width+H,Ee=Bt.get(Ae.target)??Et.get(Ae.target),ze=Ne(Be,We,Ee?Ee.lane:se.node.lane,Ee?Ee.band:Le,nt.has(Ae.target)?mt.x+mt.width/2:Qe,Number.NaN),Je=n.createShape(We,ze,Be);nt.has(Ae.target)&&pt.set(Ae.target,Qe-(Je.x+Je.width/2)),n.connect(Ke,Je,{type:"bpmn:SequenceFlow",businessObject:I(Ae)})}else c.append(Ke,We,{connection:{type:"bpmn:SequenceFlow",businessObject:I(Ae)}})}else if(Vt)n.connect(Ke,Vt,{type:"bpmn:SequenceFlow",businessObject:I(Ae)});else continue;Fn.add(Ae.id),Ze=!0}if(!Ze)break}const ne=P.nodes.filter(pe=>!l(pe.node.id));if(!ne.length)break;const ge=ne[0];{const pe=W(ge.node,ge.band),Ze=le(ge.node),qe=he(ge);n.createShape(pe,Ne(Ze,pe,ge.node.lane,qe,z,G),Ze),!ge.node.lane&&qe===void 0&&(G+=160)}}}const Ue=40,ft=(S,P=()=>!0)=>{const k=l(S);if(!k)return[];const z=[k],G=new Set([S]);for(let B=0;B<z.length;B++){const Y=z[B].id;for(const ae of m){const Q=ae.flow.target;if(ae.flow.source!==Y||G.has(Q)||!E.has(Q))continue;G.add(Q);const le=l(Q);le&&P(le)&&z.push(le)}}return z},tt=(S,P=()=>!0)=>{const k=l(S);if(!k)return[];const z=[k],G=new Set([S]);for(let B=0;B<z.length;B++){const Y=z[B].id;for(const ae of m){const Q=ae.flow.source;if(ae.flow.target!==Y||G.has(Q)||!E.has(Q))continue;G.add(Q);const le=l(Q);le&&P(le)&&z.push(le)}}return z};for(const S of Xt(e,"sequenceFlow.update")){if(S.target===void 0)continue;const P=E.get(S.target);if(!P)continue;const k=l(S.target),z=l(S.id);if(!k||!z)continue;const G=S.source!==void 0?l(S.source):z.source,B=z.target;if(!G||!B||B.id===k.id)continue;const Y=ft(S.target),ae=new Set(Y.map(Te=>Te.id)),Q=Math.min(...Y.map(Te=>Te.x)),le=Math.max(...Y.map(Te=>Te.x+Te.width)),Ye=G.x+G.width,ct=le-Q+Ue*2-(B.x-Ye);if(ct>0){const Te=f(k),ve=(Te==null?void 0:Te.children)??[],nt=pt=>pt.type==="bpmn:Lane",Bt=ve.filter(pt=>!("waypoints"in pt&&pt.waypoints)&&!nt(pt)&&!ae.has(pt.id)&&pt.x>=B.x),Et=Te?[Te,...ve.filter(pt=>nt(pt))]:[];Bt.length&&n.createSpace(Bt,Et,{x:ct,y:0},"e",B.x-1)}const Ne=P.node.lane||P.band!==void 0?k.y+k.height/2:G.y+G.height/2;n.moveElements(Y,{x:Ye+Ue-Q,y:Ne-(k.y+k.height/2)})}const It=(S,P)=>{const k=P.target===S,z=p(P.source),G=p(P.target),B=k?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(z,G,P.id?{type:B,businessObject:i.create(B,{id:P.id})}:{type:B})},un=100,ln=S=>{for(const P of d){if(!P.participant.blackBox)continue;const k=l(P.participant.id);if(!k)continue;const z=[];for(const B of g){const Y=B.flow.source===P.participant.id?B.flow.target:B.flow.target===P.participant.id?B.flow.source:void 0,ae=Y?l(Y):void 0;ae&&typeof ae.x=="number"&&ae.type!=="bpmn:Participant"&&z.push(ae)}if(!z.length)continue;const G=Math.max(...z.map(B=>B.x+B.width/2))+un;if(G>k.x+k.width&&n.resizeShape(k,{x:k.x,y:k.y,width:G-k.x,height:k.height}),!!S)for(const B of g){const Y=l(B.flow.id),ae=B.flow.source===P.participant.id?B.flow.target:B.flow.target===P.participant.id?B.flow.source:void 0,Q=ae?l(ae):void 0;if(!Y||!Q||Q.type==="bpmn:Participant")continue;const le=Q.x+Q.width/2;if(le<k.x+10||le>k.x+k.width-10)continue;const Ye=k.y>Q.y,ct=Ye?Q.y+Q.height:Q.y,Ne=Ye?k.y:k.y+k.height,Te=B.flow.source===P.participant.id?[{x:le,y:Ne},{x:le,y:ct}]:[{x:le,y:ct},{x:le,y:Ne}],ve=Ut(o),nt={...ve.edges.find(Bt=>Bt.id===B.flow.id),waypoints:Te};zn(nt,Ci(ve)).length||n.updateWaypoints(Y,Te)}}};ln(!1);for(const S of g){const P=S.flow;n.connect(p(P.source),p(P.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:P.id,name:P.name})})}const at=100,Nt=30,pn=4,Bo=S=>!("waypoints"in S&&S.waypoints)&&S.type!=="bpmn:Lane"&&S.type!=="label"&&typeof S.x=="number",fn=()=>{const S=Ut(o);return{bad:qi(S).filter(P=>P.kind==="edge-crosses-shape"||P.kind==="edge-overlap-opposite"||P.kind==="edge-overlap-mixed").length,crossings:xd(S),straight:S.edges.filter(P=>P.type==="bpmn:MessageFlow"&&P.waypoints.length===2).length}},On=S=>{const P=Ut(o),k=P.edges.find(z=>z.id===S);return k?zn(k,Ci(P)).length:0},Ln=S=>On(S)>0,Rt=(S,P,k)=>{const z=new Set(S.map(le=>le.id)),G=(P.children??[]).filter(Bo).filter(le=>!z.has(le.id));if(S.some(le=>G.some(Ye=>le.x+k<Ye.x+Ye.width+Nt&&le.x+k+le.width+Nt>Ye.x&&le.y<Ye.y+Ye.height&&le.y+le.height>Ye.y)))return null;const Y=P.width;n.moveElements(S,{x:k,y:0});const Q=Math.max(...S.map(le=>le.x+le.width))+150-(P.x+P.width);return Q>0&&n.resizeShape(P,{x:P.x,y:P.y,width:P.width+Q,height:P.height}),()=>{n.moveElements(S,{x:-k,y:0}),Q>0&&n.resizeShape(P,{x:P.x,y:P.y,width:Y,height:P.height})}},Er=(S,P)=>P.bad>S.bad||P.crossings>S.crossings&&P.straight<=S.straight&&P.bad>=S.bad,$o=(S,P,k,z=()=>!0)=>{const G=fn(),B=Rt(S,P,k);if(!B)return!1;const Y=fn();return Er(G,Y)||!z()?(B(),!1):!0},In=S=>{var k;const P=(k=E.get(S))==null?void 0:k.node.participant;return!!P&&je.has(`pool:${P}`)},He=new Map;for(const S of g){if(!In(S.flow.target))continue;const P=He.get(S.flow.target)??[];P.push(S),He.set(S.flow.target,P)}const Xe=[...He.keys()],px=new Set(m.map(S=>S.flow.target)),fx=S=>Lt.findIndex(({op:P})=>P.participant.id===S);Xe.sort((S,P)=>{var G,B;const k=px.has(S)?1:0,z=px.has(P)?1:0;return k!==z?k-z:fx((G=E.get(S))==null?void 0:G.node.participant)-fx((B=E.get(P))==null?void 0:B.node.participant)});const Ya=S=>S.x+S.width/2,dx=S=>{let P;for(const k of He.get(S)??[]){const z=l(k.flow.source);if(!z)continue;const G=Ya(z);(!P||G>P.cx)&&(P={op:k,cx:G})}return P==null?void 0:P.op},zD=S=>{const P=dx(S),k=l(S),z=P?l(P.flow.source):void 0;return k&&z?Ya(z)-Ya(k):void 0},VD=S=>{const P=zD(S);return P!==void 0&&Math.abs(P)<at},If=S=>{const P=dx(S);if(!P)return null;const k=l(S),z=l(P.flow.source);if(!k||!z)return null;const G=Ya(z)-Ya(k);if(G>=at){const B=p(E.get(S).node.participant);return{subtree:ft(S,Y=>Y.x>=k.x),pool:B,dx:G}}if(-G>=at&&In(P.flow.source)){const B=p(E.get(P.flow.source).node.participant);return{subtree:ft(P.flow.source,Y=>Y.x>=z.x&&!VD(Y.id)),pool:B,dx:-G}}return null},hx=()=>Xe.map(S=>({id:S,plan:If(S)})).filter(S=>!!S.plan).sort((S,P)=>Math.min(...S.plan.subtree.map(k=>k.x))-Math.min(...P.plan.subtree.map(k=>k.x))).map(S=>S.id);for(let S=0;S<3;S++){const P=fn(),k=[];for(const G of hx()){const B=If(G);if(!B)continue;const Y=Rt(B.subtree,B.pool,B.dx);Y&&k.push(Y)}if(!k.length)break;if(!Er(P,fn()))continue;for(const G of k.reverse())G();let z=!1;for(const G of hx()){const B=If(G);B&&$o(B.subtree,B.pool,B.dx)&&(z=!0)}if(!z)break}for(const S of Xe.flatMap(P=>He.get(P)??[])){if(!Ln(S.flow.id))continue;const P=l(S.flow.target);if(!P)continue;const k=p(E.get(S.flow.target).node.participant),z=ft(S.flow.target,Y=>Y.x>=P.x),G=P.width+H,B=On(S.flow.id);for(let Y=1;Y<=pn&&!$o(z,k,G*Y,()=>On(S.flow.id)<B);Y++);}for(const S of g){if(!Ln(S.flow.id))continue;const P=l(S.flow.source),k=l(S.flow.target);if(!P||!k||P.type==="bpmn:Participant"||k.type==="bpmn:Participant")continue;const z=P.x+P.width/2;if(Math.abs(z-(k.x+k.width/2))>15)continue;const[G,B]=P.y<k.y?[P.y+P.height,k.y]:[k.y+k.height,P.y],Y=[...E.values()].map(ae=>l(ae.node.id)).filter(ae=>!!ae&&ae.id!==P.id&&ae.id!==k.id).filter(ae=>ae.x<=z&&z<=ae.x+ae.width&&ae.y+ae.height>G&&ae.y<B).sort((ae,Q)=>ae.x-Q.x);for(const ae of Y){const Q=(wx=E.get(ae.id))==null?void 0:wx.node.participant,le=Q?l(Q):void 0;if(!le)continue;const Ye=[...E.values()].filter(Et=>Et.node.participant===Q).map(Et=>Et.node.id),ct=Et=>Et.map(pt=>l(pt)).filter(pt=>!!pt),Te=[tt(ae.id,Et=>{var pt;return((pt=E.get(Et.id))==null?void 0:pt.node.participant)===Q}),ct(Ye)].filter(Et=>Et.length),ve=ae.width+H,nt=On(S.flow.id);let Bt=!1;for(const Et of Te){for(let pt=1;pt<=pn;pt++)if($o(Et,le,ve*pt,()=>On(S.flow.id)<nt)){Bt=!0;break}if(Bt)break}if(!Ln(S.flow.id))break}}{const S=k=>k.y+k.height/2,P=[];for(const[k,z]of E){const G=z.node.participant;if(!G||!je.has(`pool:${G}`))continue;const B=m.filter(Q=>Q.flow.target===k);if(B.length!==1)continue;const Y=l(B[0].flow.source),ae=l(k);!Y||!ae||!E.has(Y.id)||Math.abs(S(Y)-S(ae))>1||ae.x-(Y.x+Y.width)<=H+1||P.push({id:k,pred:Y,node:ae})}P.sort((k,z)=>k.node.x-z.node.x);for(const{id:k}of P){const z=E.get(k),G=l(k),B=l(m.find(Ne=>Ne.flow.target===k).flow.source);if(!G||!B)continue;const Y=G.x-(B.x+B.width);if(Y<=H+1)continue;const ae=p(z.node.participant),Q=ft(k,Ne=>Ne.x>=G.x),le=fn(),Ye=Rt(Q,ae,-(Y-H));if(!Ye)continue;const ct=fn();(ct.bad>le.bad||ct.crossings>=le.crossings)&&Ye()}}ln(!0);for(const S of R){const P=S.associations??[],k=P.map(B=>B.source===S.dataStore.id?B.target:B.source).map(l).find(Boolean),z=k?f(k)??u():u(),G=k?{x:k.x+k.width/2,y:k.y+k.height+110}:{x:200,y:C+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:S.dataStore.id,name:S.dataStore.name})},G,z);for(const B of P)It(S.dataStore.id,B)}for(const S of w){const k=p(S.association.target).type==="bpmn:DataStoreReference"?S.association.target:S.association.source;It(k,S.association)}let mx=0;const GD=10,gx=(S,P)=>{for(const k of P.map(z=>f(z)).filter(z=>!!z)){const z=GD,G=k.y,B=k.y+k.height,Y=k.x,ae=k.x+k.width;if(Math.abs(S.y-G)<z){const Q=G+z-S.y;S.y+=Q,S.height-=Q}if(Math.abs(S.y+S.height-B)<z&&(S.height=B-z-S.y),Math.abs(S.x-Y)<z){const Q=Y+z-S.x;S.x+=Q,S.width-=Q}Math.abs(S.x+S.width-ae)<z&&(S.width=ae-z-S.x)}};for(const S of b){const P=(S.group.members??[]).map(l).filter(B=>!!B),k=40;let z;if(P.length){const B=Math.min(...P.map(le=>le.x))-k,Y=Math.min(...P.map(le=>le.y))-k,ae=Math.max(...P.map(le=>le.x+le.width))+k,Q=Math.max(...P.map(le=>le.y+le.height))+k;z={x:B,y:Y,width:ae-B,height:Q-Y},gx(z,P)}else z={x:300+mx*350,y:40,width:300,height:200},mx++;const G=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:S.group.id}),width:z.width,height:z.height},{x:z.x+z.width/2,y:z.y+z.height/2},u());S.group.name&&n.updateLabel(G,S.group.name),(Ex=S.group.members)!=null&&Ex.length&&T(G,"bwl:Members",{refs:S.group.members.join(" ")})}const yx=S=>{const P=S.waypoints;if(P!=null&&P.length){const z=P[Math.floor((P.length-1)/2)];return{x:z.x,y:z.y,width:0,height:0}}const k=S;return{x:k.x,y:k.y,width:k.width,height:k.height}};let qa=0;const vx=12,_x=14,WD=15,UD=300,YD=S=>{const P=S.split(`
7
- `),k=Math.max(...P.map(B=>Wo(B,vx))),z=Math.max(100,Math.min(UD,Math.ceil(k)+_x)),G=P.reduce((B,Y)=>B+Math.max(1,Math.ceil((Wo(Y,vx)+_x)/z)),0);return{width:z,height:Math.max(30,G*WD+10)}},tn=10;for(const S of x){const P=S.association,k=((Sx=S.placement)==null?void 0:Sx.anchor)??(P?P.source===S.annotation.id?P.target:P.source:void 0),z=k?l(k):void 0,G=z?yx(z):void 0,B=YD(S.annotation.text??"");let Y;if(G&&S.placement){const[Ye,ct]=Gu[S.placement.side],Ne=S.placement.offset??50;Y={x:G.x+G.width/2+Ye*(G.width/2+B.width/2+Ne),y:G.y+G.height/2+ct*(G.height/2+B.height/2+Ne)}}else G?(Y={x:G.x+G.width/2+180+qa%3*260,y:G.y-110-qa%2*95},qa++):(Y={x:300+qa*260,y:60},qa++);const ae=z?f(z)??u():u(),Q=ae;if(G&&typeof Q.x=="number"&&typeof Q.width=="number"&&Q.type==="bpmn:Participant"){const Ye=(ne,ge)=>{const[pe,Ze]=Gu[ne];let qe={x:G.x+G.width/2+pe*(G.width/2+B.width/2+ge),y:G.y+G.height/2+Ze*(G.height/2+B.height/2+ge)};const Ae=Q.x+tn+B.width/2,Ke=Q.x+Q.width-tn-B.width/2,Vt=Q.y+tn+B.height/2,se=Q.y+Q.height-tn-B.height/2,We={x:Math.min(Ke,Math.max(Ae,qe.x)),y:Math.min(se,Math.max(Vt,qe.y))};return(We.x!==qe.x||We.y!==qe.y)&&(qe=Math.abs(We.x-(G.x+G.width/2))<(G.width+B.width)/2+tn&&Math.abs(We.y-(G.y+G.height/2))<(G.height+B.height)/2+tn?{x:G.x+G.width+tn+B.width/2,y:We.y}:We),qe},ct=(Q.children??[]).filter(ne=>!("waypoints"in ne&&ne.waypoints)&&ne.type!=="bpmn:Lane"&&ne.type!=="label"&&typeof ne.x=="number"),Ne=Ut(o),Te=Ne.edges.flatMap(hn),ve=cs(Ne).map(ne=>ne.rect),nt=ne=>({x0:ne.x-B.width/2-tn,x1:ne.x+B.width/2+tn,y0:ne.y-B.height/2-tn,y1:ne.y+B.height/2+tn}),Bt=ne=>{const ge=nt(ne);return ct.some(pe=>ge.x0<pe.x+pe.width&&ge.x1>pe.x&&ge.y0<pe.y+pe.height&&ge.y1>pe.y)},Et=ne=>{const ge=nt(ne);return Te.some(pe=>pe.axis==="h"?pe.at>ge.y0&&pe.at<ge.y1&&pe.lo<ge.x1&&pe.hi>ge.x0:pe.at>ge.x0&&pe.at<ge.x1&&pe.lo<ge.y1&&pe.hi>ge.y0)},pt=ne=>{const ge=nt(ne);return ve.some(pe=>ge.x0<pe.x+pe.width&&ge.x1>pe.x&&ge.y0<pe.y+pe.height&&ge.y1>pe.y)},Fn=ne=>Bt(ne)||Et(ne)||pt(ne),_u=ne=>ne.x-B.width/2>=Q.x&&ne.x+B.width/2<=Q.x+Q.width&&ne.y-B.height/2>=Q.y&&ne.y+B.height/2<=Q.y+Q.height;if(S.placement){const ne=Ae=>Ae.startsWith("top")?Ae.replace(/^top/,"bottom"):Ae.replace(/^bottom/,"top"),ge=Ae=>Ae.endsWith("left")?Ae.replace(/left$/,"right"):Ae.replace(/right$/,"left"),pe=S.placement.side,Ze=[pe,ne(pe),ge(pe),ne(ge(pe)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],qe=S.placement.offset??50;if(Y=Ye(pe,qe),Fn(Y)){const Ae=new Set;for(const Ke of Ze){if(Ae.has(Ke))continue;Ae.add(Ke);const Vt=Ye(Ke,qe);if(_u(Vt)&&!Fn(Vt)){Y=Vt;break}}}}else{const ne=Q.x+tn+B.width/2,ge=Q.x+Q.width-tn-B.width/2,pe=Q.y+tn+B.height/2,Ze=Q.y+Q.height-tn-B.height/2;if(Y={x:Math.min(ge,Math.max(ne,Y.x)),y:Math.min(Ze,Math.max(pe,Y.y))},Fn(Y)){const qe=(G.width+B.width)/2+tn,Ke=[{x:Y.x+qe,y:Y.y},{x:Y.x-qe,y:Y.y},{x:Y.x,y:Y.y-B.height-tn},{x:Y.x,y:Y.y+B.height+tn}].filter(_u).find(Vt=>!Fn(Vt));Ke&&(Y=Ke)}}}const le=n.createShape({type:"bpmn:TextAnnotation",width:B.width,height:B.height,businessObject:i.create("bpmn:TextAnnotation",{id:S.annotation.id,text:S.annotation.text})},Y,ae);if(P){const Ye=ct=>ct===S.annotation.id?le:p(ct);n.connect(Ye(P.source),Ye(P.target),P.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:P.id})}:{type:"bpmn:Association"})}S.placement&&T(le,"bwl:Placement",L(S.placement))}for(const S of Xt(e,"association.add")){const P=S.association;n.connect(p(P.source),p(P.target),P.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:P.id})}:{type:"bpmn:Association"})}for(const S of Xt(e,"node.update")){let P=p(S.id);if(S.type&&hs(S.type)!==P.type&&(P=s.replaceElement(P,{type:hs(S.type)})),S.name!==void 0&&n.updateProperties(P,{name:S.name??void 0}),S.lane){const k=p(S.lane),z=k.y+k.height/2-(P.y+P.height/2);z!==0&&n.moveElements([P],{x:0,y:z})}}for(const S of Xt(e,"sequenceFlow.update")){const P=p(S.id);if(S.source!==void 0||S.target!==void 0){const k=P,z=S.source!==void 0?p(S.source):k.source,G=S.target!==void 0?p(S.target):k.target,B=Y=>({x:Y.x+Y.width/2,y:Y.y+Y.height/2});n.reconnect(k,z,G,[B(z),B(G)])}S.name!==void 0&&n.updateProperties(P,{name:S.name??void 0}),S.condition!==void 0&&n.updateProperties(P,{name:((Rx=S.condition)==null?void 0:Rx.label)??void 0})}for(const S of Xt(e,"messageFlow.update"))S.name!==void 0&&n.updateProperties(p(S.id),{name:S.name??void 0});for(const S of Xt(e,"dataStore.update"))S.name!==void 0&&n.updateProperties(p(S.id),{name:S.name??void 0});for(const S of Xt(e,"annotation.update")){const P=p(S.id);if(S.text!==void 0&&n.updateProperties(P,{text:S.text}),S.placement===null)T(P,"bwl:Placement",null);else if(S.placement){const k=yx(p(S.placement.anchor)),[z,G]=Gu[S.placement.side],B=S.placement.offset??50,Y=k.x+k.width/2+z*(k.width/2+P.width/2+B),ae=k.y+k.height/2+G*(k.height/2+P.height/2+B);n.moveElements([P],{x:Y-(P.x+P.width/2),y:ae-(P.y+P.height/2)}),T(P,"bwl:Placement",L(S.placement))}}for(const S of Xt(e,"group.update")){const P=p(S.id);if(S.name!==void 0&&n.updateLabel(P,S.name??""),S.members){const k=S.members.map(l).filter(z=>!!z);if(k.length){const G=Math.min(...k.map(le=>le.x))-40,B=Math.min(...k.map(le=>le.y))-40,Y=Math.max(...k.map(le=>le.x+le.width))+40,ae=Math.max(...k.map(le=>le.y+le.height))+40,Q={x:G,y:B,width:Y-G,height:ae-B};gx(Q,k),n.resizeShape(P,Q)}T(P,"bwl:Members",{refs:S.members.join(" ")})}}}function nh(e,t,n=th){const i=eh(e),r=Qd(t,Ad(i.elementRegistry)),o={edgeCrossings:{before:0,after:0,pairs:[]}};if(r.length)return{ok:!1,issues:r,findings:[],stats:o};const a=Ut(i.elementRegistry),c=new Set(qi(a).map(Yi)),s=new Set(a.edges.map(m=>m.id)),u=new Set(a.shapes.map(m=>m.id)),l=Hu(a).length,p=e.get("commandStack");try{Ff(p,()=>{n(t,i),Bd(i,s),Ld(i,c),Vd(i,c,s),Hd(i,s),Gw(i,s),Yd(i,c,s),Ud(i,s),Kd(i,u)})}catch(m){return{ok:!1,issues:[{kind:"lower-failed",message:m instanceof Error?m.message:String(m)}],findings:[],stats:o}}const f=Ut(i.elementRegistry),d=qi(f).filter(m=>!c.has(Yi(m))),h=Hu(f);return{ok:!0,issues:[],findings:d,stats:{edgeCrossings:{before:l,after:h.length,pairs:h}}}}function nE(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function iE(e,t){return typeof e.get=="function"?e.get(t):e[t]}function ih(e,t){const n=iE(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function rh(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function rE(e){return typeof e=="string"&&xu.includes(e)}function ci(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function oh(e){const t=e.rootElements??[],n=t.find(q=>q.$type==="bpmn:Collaboration"),i=new Map(t.filter(q=>q.$type==="bpmn:Process").map(q=>[q.id,q])),r=[],o=[],a=[],c=[],s=[],u=[],l={poolOrders:{},bands:{},placements:{}},p=[],f=[],d=[],h=[],m=[],g=[],R=new Set,w=new Set,x=q=>{q&&R.add(q)},b=q=>{R.add(q),w.add(q)},E=q=>{const de=rh(q,"bwl:Placement");if(!de)return;const he=typeof de.anchor=="string"?de.anchor:void 0;if(!he||!rE(de.side))return;const ce=typeof de.offset=="number"?de.offset:void 0;m.push({owner:q.id,anchor:he,side:de.side,...ce!==void 0?{offset:ce}:{}})},T=q=>{const de=rh(q,"bwl:Members"),he=typeof(de==null?void 0:de.refs)=="string"?de.refs.split(/\s+/).filter(Boolean):[];he.length&&g.push({owner:q.id,refs:he})},L=q=>{var de;for(const he of q)switch(x(he.id),he.$type){case"bpmn:TextAnnotation":b(he.id),c.push({id:he.id,text:typeof he.text=="string"?he.text:""}),E(he);break;case"bpmn:Association":d.push({id:he.id,type:he.$type,source:ci(he.sourceRef),target:ci(he.targetRef)});break;case"bpmn:Group":{b(he.id);const ce=(de=he.categoryValueRef)==null?void 0:de.value;s.push({id:he.id,...typeof ce=="string"&&ce?{name:ce}:{}}),T(he);break}default:u.push({id:he.id,type:he.$type,reason:"type-outside-mvp"})}},A=(q,de)=>{const he=q.flowElements??[],ce=(q.laneSets??[]).flatMap(ee=>ee.lanes??[]),ue=new Map;for(const ee of ce){x(ee.id);for(const j of ee.flowNodeRef??[]){const $=ci(j);$&&ue.set($,ee.id)}}for(const ee of he){if(x(ee.id),ee.$type==="bpmn:SequenceFlow"){p.push({id:ee.id,source:ci(ee.sourceRef),target:ci(ee.targetRef),...typeof ee.name=="string"&&ee.name?{name:ee.name}:{}});continue}if(ee.$type==="bpmn:DataStoreReference"){b(ee.id),a.push({id:ee.id,...ee.name?{name:ee.name}:{}});continue}const j=nE(ee.$type);if(!Nf(j)){u.push({id:ee.id,type:ee.$type,reason:"type-outside-mvp"});continue}b(ee.id),o.push({id:ee.id,type:j,...ee.name?{name:ee.name}:{},...de?{participant:de}:{},...ue.has(ee.id)?{lane:ue.get(ee.id)}:{}});const $=ih(ee,"bwl:band");$!==void 0&&(l.bands[ee.id]=$);for(const U of ee.dataOutputAssociations??[])x(U.id),h.push({id:U.id,type:U.$type,source:ee.id,target:ci(U.targetRef)});for(const U of ee.dataInputAssociations??[])x(U.id),h.push({id:U.id,type:U.$type,source:ci((U.sourceRef??[])[0]),target:ee.id})}L(q.artifacts??[])};if(n){const q=new Set;for(const de of n.participants??[]){b(de.id);const he=ci(de.processRef);he&&q.add(he);const ce=he?i.get(he):void 0,ue=((ce==null?void 0:ce.laneSets)??[]).flatMap(U=>U.lanes??[]),ee=ue.map(U=>({id:U.id,...U.name?{name:U.name}:{}}));for(const U of ee)b(U.id);const j=!ce||(ce.flowElements??[]).length===0&&ue.length===0&&(ce.artifacts??[]).length===0;r.push({id:de.id,...de.name?{name:de.name}:{},...j?{blackBox:!0}:{},...ee.length?{lanes:ee}:{}});const $=ih(de,"bwl:poolOrder");$!==void 0&&(l.poolOrders[de.id]=$),ce&&A(ce,de.id)}for(const de of n.messageFlows??[])x(de.id),f.push({id:de.id,source:ci(de.sourceRef),target:ci(de.targetRef),...typeof de.name=="string"&&de.name?{name:de.name}:{}});L(n.artifacts??[]);for(const[de,he]of i)!q.has(de)&&(he.flowElements??[]).length>0&&u.push({id:de,type:he.$type,reason:"unreachable-process"})}else for(const q of i.values())A(q);const F=[],H=[],N=[],V=[],fe=(q,de)=>!!q&&!!de&&w.has(q)&&w.has(de);for(const q of p){if(!fe(q.source,q.target)){u.push({id:q.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}F.push({id:q.id,source:q.source,target:q.target,...q.name?{name:q.name}:{}}),w.add(q.id)}for(const q of f){if(!fe(q.source,q.target)){u.push({id:q.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}H.push({id:q.id,source:q.source,target:q.target,...q.name?{name:q.name}:{}}),w.add(q.id)}for(const q of h){if(!fe(q.source,q.target)){u.push({id:q.id??"",type:q.type,reason:"endpoint-outside-mvp"});continue}V.push({...q.id?{id:q.id}:{},source:q.source,target:q.target}),q.id&&w.add(q.id)}for(const q of d){if(!fe(q.source,q.target)){u.push({id:q.id??"",type:q.type,reason:"endpoint-outside-mvp"});continue}N.push({...q.id?{id:q.id}:{},source:q.source,target:q.target})}const je=new Map(s.map(q=>[q.id,q]));for(const{owner:q,refs:de}of g){const he=de.filter(ue=>R.has(ue)),ce=je.get(q);ce&&he.length&&(ce.members=he)}for(const q of m)R.has(q.anchor)&&(l.placements[q.owner]={anchor:q.anchor,side:q.side,...q.offset!==void 0?{offset:q.offset}:{}});return{definition:{...r.length?{participants:r}:{},nodes:o,sequenceFlows:F,...H.length?{messageFlows:H}:{},...a.length?{dataStores:a}:{},...V.length?{dataAssociations:V}:{},...c.length?{annotations:c}:{},...N.length?{associations:N}:{},...s.length?{groups:s}:{}},hints:l,omitted:u}}async function oE(e){const{definitions:t,warnings:n}=await $u(e);return{...oh(t),warnings:n}}function aE(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function ah(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=nh(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 sE=Symbol("bpmn-editor");function cE(){const e=Ct.ref(!1),t=Ct.ref(!0),n=Ct.ref(!1);let i,r;const o=()=>{e.value=!0};function a(u,l){u.get("canvas").getContainer().style.pointerEvents=l?"":"none";const p=u.get("keyboard");l?(r&&p.bind(r),r=void 0):r||(r=p.getBinding(),p.unbind())}function c(){if(!i)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return i}function s(){return i==null?void 0:i.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,attach(u){i&&this.detach(),i=u,i.get("eventBus").on("commandStack.changed",o),t.value||a(i,!1)},detach(){i==null||i.get("eventBus").off("commandStack.changed",o),i&&!t.value&&a(i,!0),r=void 0,i=void 0},setEditable(u){t.value=u,i&&a(i,u)},async applyAgentBatch(u,l){const p=c();n.value=!0;try{const f=await ah(p,u,{currentVersion:l});return f.status==="applied"&&(e.value=!1),f}finally{n.value=!1}},async importXml(u){const{warnings:l}=await c().importXML(u);return e.value=!1,{warnings:ju(l)}},async saveXml(){const{xml:u}=await c().saveXML({format:!0});return e.value=!1,u??""},undo:()=>{var u;return(u=s())==null?void 0:u.undo()},redo:()=>{var u;return(u=s())==null?void 0:u.redo()},canUndo:()=>{var u;return((u=s())==null?void 0:u.canUndo())??!1},canRedo:()=>{var u;return((u=s())==null?void 0:u.canRedo())??!1}}}function ie(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function uE(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Wu={exports:{}},sh;function lE(){if(sh)return Wu.exports;sh=1;var e=Wu.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 c=Math.floor(Math.random()*n).toString(n);a=c+a}if(o){var s=Math.pow(n,o),c=Math.floor(Math.random()*s).toString(n);a=c+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 c=0;do{if(c++>10)if(i)t+=i;else throw new Error("too many ID collisions, use more bits");var s=e(t,n)}while(Object.hasOwnProperty.call(o,s));return o[s]=a,s},o=r.hats={};return r.get=function(a){return r.hats[a]},r.set=function(a,c){return r.hats[a]=c,r},r.bits=t||128,r.base=n||16,r},Wu.exports}var pE=lE(),fE=uE(pE);function ui(e){if(!(this instanceof ui))return new ui(e);e=e||[128,36,1],this._seed=e.length?fE.rack(e[0],e[1],e[2]):e}ui.prototype.next=function(e){return this._seed(e||!0)},ui.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},ui.prototype.claim=function(e,t){this._seed.set(e,t||!0)},ui.prototype.assigned=function(e){return this._seed.get(e)||!1},ui.prototype.unclaim=function(e){delete this._seed.hats[e]},ui.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const 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 ut(e,t=globalThis.document){var u;if(typeof e!="string")throw new TypeError("String expected");const n=/^<!--(.*?)-->$/s.exec(e);if(n)return t.createComment(n[1]);const i=(u=/<([\w:]+)/.exec(e))==null?void 0:u[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const l=t.createElement("html");l.innerHTML=e;const{lastChild:p}=l;return p.remove(),p}let[r,o,a]=Object.hasOwn(jt,i)?jt[i]:jt._default,c=t.createElement("div");for(c.innerHTML=o+e+a;r--;)c=c.lastChild;if(c.firstChild===c.lastChild){const{firstChild:l}=c;return l.remove(),l}const s=t.createDocumentFragment();return s.append(...c.childNodes),s}function dE(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 M(t,function(i){i&&M(i,function(r,o){n[o]=r})}),e}function an(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const hE=Object.prototype.toString;function ht(e){return new Ki(e)}function Ki(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Ki.prototype.add=function(e){return this.list.add(e),this},Ki.prototype.remove=function(e){return hE.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Ki.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},Ki.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Ki.prototype.array=function(){return Array.from(this.list)},Ki.prototype.has=Ki.prototype.contains=function(e){return this.list.contains(e)};function ms(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 mE(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var gs={},ch;function gE(){if(ch)return gs;ch=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return gs.bind=function(r,o,a,c){return e||i(),r[e](n+o,a,c||!1),a},gs.unbind=function(r,o,a,c){return t||i(),r[t](n+o,a,c||!1),a},gs}var uh=gE(),yE=mE(uh),Se=dE({__proto__:null,default:yE},[uh]),lh=["focus","blur"];function vE(e,t,n,i,r){return lh.indexOf(n)!==-1&&(r=!0),Se.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 _E(e,t,n,i){return lh.indexOf(t)!==-1&&(i=!0),Se.unbind(e,t,n,i)}var Rn={bind:vE,unbind:_E};function Uu(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function et(e,t){return t=t||document,t.querySelector(e)}function ys(e,t){return t=t||document,t.querySelectorAll(e)}function li(e){e.parentNode&&e.parentNode.removeChild(e)}function bE(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function xE(e,t){return t.appendChild(bE(e,t))}function Re(e,t){return xE(t,e),e}var Yu=2,ph={"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":Yu,"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":Yu,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function wE(e,t){return ph[t]?e.style[t]:e.getAttributeNS(null,t)}function fh(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=ph[i];r?(r===Yu&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function EE(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)fh(e,r,t[r])}function re(e,t,n){if(typeof t=="string")if(n!==void 0)fh(e,t,n);else return wE(e,t);else EE(e,t);return e}const SE=Object.prototype.toString;function Fe(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 SE.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 vs(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function dh(e){return e.cloneNode(!0)}var qu={svg:"http://www.w3.org/2000/svg"},hh='<svg xmlns="'+qu.svg+'"';function RE(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(qu.svg)===-1&&(e=hh+e.substring(4)):(e=hh+">"+e+"</svg>",t=!0);var n=CE(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function CE(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function me(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=RE(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(qu.svg,e),t&&re(n,t),n}var Ku=null;function mh(){return Ku===null&&(Ku=me("svg")),Ku}function gh(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function PE(e,t,n,i,r,o){var a=mh().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return gh(a,e);case 6:return gh(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function Uo(e){return mh().createSVGTransform()}var yh=/([&<>]{1})/g,AE=/([&<>\n\r"]{1})/g,TE={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function Xu(e,t){function n(i,r){return TE[r]||r}return e.replace(t,n)}function vh(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(Xu(e.textContent,yh));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,'="',Xu(o.value,AE),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)vh(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",Xu(e.nodeValue,yh),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function ME(e){for(var t=e.firstChild,n=[];t;)vh(t,n),t=t.nextSibling;return n.join("")}function _h(e,t){return ME(e)}function Ft(e){var t=e.parentNode;return t&&t.removeChild(e),e}function kE(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function DE(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(kE(e,i))}function Yo(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),DE(n,t)),n.consolidate()}const OE=/^class[ {]/;function LE(e){return OE.test(e.toString())}function Zu(e){return Array.isArray(e)}function Qu(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function _s(...e){e.length===1&&Zu(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const IE=/constructor\s*[^(]*\(\s*([^)]*)\)/m,NE=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,BE=/\/\*([^*]*)\*\//m;function $E(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(LE(e)?IE:NE);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(BE);return(r&&r[1]||i).trim()})||[]}function bh(e,t){const n=t||{get:function(x,b){if(i.push(x),b===!1)return null;throw c(`No provider for "${x}"!`)}},i=[],r=this._providers=Object.create(n._providers||null),o=this._instances=Object.create(null),a=o.injector=this,c=function(x){const b=i.join(" -> ");return i.length=0,new Error(b?`${x} (Resolving: ${b})`:x)};function s(x,b){if(!r[x]&&x.includes(".")){const E=x.split(".");let T=s(E.shift());for(;E.length;)T=T[E.shift()];return T}if(Qu(o,x))return o[x];if(Qu(r,x)){if(i.indexOf(x)!==-1)throw i.push(x),c("Cannot resolve circular dependency!");return i.push(x),o[x]=r[x][0](r[x][1]),i.pop(),o[x]}return n.get(x,b)}function u(x,b){if(typeof b>"u"&&(b={}),typeof x!="function")if(Zu(x))x=_s(x.slice());else throw c(`Cannot invoke "${x}". Expected a function!`);const T=(x.$inject||$E(x)).map(L=>Qu(b,L)?b[L]:s(L));return{fn:x,dependencies:T}}function l(x){const{fn:b,dependencies:E}=u(x),T=Function.prototype.bind.call(b,null,...E);return new T}function p(x,b,E){const{fn:T,dependencies:L}=u(x,E);return T.apply(b,L)}function f(x){return _s(b=>x.get(b))}function d(x,b){if(b&&b.length){const E=Object.create(null),T=Object.create(null),L=[],A=[],F=[];let H,N,V,fe;for(let je in r)H=r[je],b.indexOf(je)!==-1&&(H[2]==="private"?(N=L.indexOf(H[3]),N===-1?(V=H[3].createChild([],b),fe=f(V),L.push(H[3]),A.push(V),F.push(fe),E[je]=[fe,je,"private",V]):E[je]=[F[N],je,"private",A[N]]):E[je]=[H[2],H[1]],T[je]=!0),(H[2]==="factory"||H[2]==="type")&&H[1].$scope&&b.forEach(lt=>{H[1].$scope.indexOf(lt)!==-1&&(E[je]=[H[2],H[1]],T[lt]=!0)});b.forEach(je=>{if(!T[je])throw new Error('No provider for "'+je+'". Cannot use provider from the parent!')}),x.unshift(E)}return new bh(x,a)}const h={factory:p,type:l,value:function(x){return x}};function m(x,b){const E=x.__init__||[];return function(){E.forEach(T=>{typeof T=="string"?b.get(T):b.invoke(T)})}}function g(x){const b=x.__exports__;if(b){const E=x.__modules__,T=Object.keys(x).reduce((N,V)=>(V!=="__exports__"&&V!=="__modules__"&&V!=="__init__"&&V!=="__depends__"&&(N[V]=x[V]),N),Object.create(null)),L=(E||[]).concat(T),A=d(L),F=_s(function(N){return A.get(N)});b.forEach(function(N){r[N]=[F,N,"private",A]});const H=(x.__init__||[]).slice();return H.unshift(function(){A.init()}),x=Object.assign({},x,{__init__:H}),m(x,A)}return Object.keys(x).forEach(function(E){if(E==="__init__"||E==="__depends__")return;const T=x[E];if(T[2]==="private"){r[E]=T;return}const L=T[0],A=T[1];r[E]=[h[L],jE(L,A),L]}),m(x,a)}function R(x,b){return x.indexOf(b)!==-1||(x=(b.__depends__||[]).reduce(R,x),x.indexOf(b)!==-1)?x:x.concat(b)}function w(x){const b=x.reduce(R,[]).map(g);let E=!1;return function(){E||(E=!0,b.forEach(T=>T()))}}this.get=s,this.invoke=p,this.instantiate=l,this.createChild=d,this.init=w(e)}function jE(e,t){return e!=="value"&&Zu(t)&&(t=_s(t.slice())),t}var FE=1e3;function Pi(e,t){var n=this;t=t||FE,e.on(["render.shape","render.connection"],t,function(i,r){var o=i.type,a=r.element,c=r.gfx,s=r.attrs;if(n.canRender(a))return o==="render.shape"?n.drawShape(c,a,s):n.drawConnection(c,a,s)}),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)})}Pi.prototype.canRender=function(e){},Pi.prototype.drawShape=function(e,t){},Pi.prototype.drawConnection=function(e,t){},Pi.prototype.getShapePath=function(e){},Pi.prototype.getConnectionPath=function(e){};function Dr(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function HE(e){return["M",e.x,e.y]}function Ju(e){return["L",e.x,e.y]}function zE(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function VE(e,t){const n=e.length,i=[HE(e[0])];for(let r=1;r<n;r++){const o=e[r-1],a=e[r],c=e[r+1];if(!c||!t){i.push(Ju(a));continue}const s=Math.min(t,el(a.x-o.x,a.y-o.y),el(c.x-a.x,c.y-a.y));if(!s){i.push(Ju(a));continue}const u=bs(a,o,s),l=bs(a,o,s*.5),p=bs(a,c,s),f=bs(a,c,s*.5);i.push(Ju(u)),i.push(zE(l,f,p))}return i}function bs(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=el(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function el(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function qo(e,t,n){we(t)&&(n=t,t=null),t||(t={});const i=me("path",t);return we(n)&&(i.dataset.cornerRadius=String(n)),tl(i,e)}function tl(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return re(e,{d:Dr(VE(t,n))}),e}function xs(e){var t=new Set(e);return Oe(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function Or(e,t,n){n=n||0,_e(e)||(e=[e]),M(e,function(i,r){var o=t(i,r,n);_e(o)&&o.length&&Or(o,t,n+1)})}function nl(e,t,n){var i=new Set,r=new Set;return Or(e,function(o,a,c){i.add(o);var s=o.children;if(s&&!r.has(s))return r.add(s),s}),Array.from(i)}function Ko(e,t){return nl(e)}function GE(e,t,n){Sr(t)&&(t=!0),Gt(t)&&(n=t,t=!0),n=n||{};var i=Xo(n.allShapes),r=Xo(n.allConnections),o=Xo(n.enclosedElements),a=Xo(n.enclosedConnections),c=Xo(n.topLevel,t&&Qr(e,function(l){return l.id}));function s(l){c[l.source.id]&&c[l.target.id]&&(c[l.id]=[l]),i[l.source.id]&&i[l.target.id]&&(a[l.id]=o[l.id]=l),r[l.id]=l}function u(l){if(o[l.id]=l,l.waypoints)a[l.id]=r[l.id]=l;else return i[l.id]=l,M(l.incoming,s),M(l.outgoing,s),l.children}return Or(e,u),{allShapes:i,allConnections:r,topLevel:c,enclosedConnections:a,enclosedElements:o}}function At(e,t){t=!!t,_e(e)||(e=[e]);var n,i,r,o;return M(e,function(a){var c=a;a.waypoints&&!t&&(c=At(a.waypoints,!0));var s=c.x,u=c.y,l=c.height||0,p=c.width||0;(s<n||n===void 0)&&(n=s),(u<i||i===void 0)&&(i=u),(s+p>r||r===void 0)&&(r=s+p),(u+l>o||o===void 0)&&(o=u+l)}),{x:n,y:i,height:o-i,width:r-n}}function ro(e,t){var n={};return M(e,function(i){var r=i;r.waypoints&&(r=At(r)),!we(t.y)&&r.x>t.x&&(n[i.id]=i),!we(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(we(t.width)&&we(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!we(t.width)||!we(t.height))&&(n[i.id]=i)}),n}function xh(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function wh(e){return!!(e&&e.isFrame)}function Xo(e,t){return O({},e||{},t||{})}var WE=1;function Zi(e,t){Pi.call(this,e,WE),this.CONNECTION_STYLE=t.style(["no-fill"],{strokeWidth:5,stroke:"fuchsia"}),this.SHAPE_STYLE=t.style({fill:"white",stroke:"fuchsia",strokeWidth:2}),this.FRAME_STYLE=t.style(["no-fill"],{stroke:"fuchsia",strokeDasharray:4,strokeWidth:2})}ie(Zi,Pi),Zi.prototype.canRender=function(){return!0},Zi.prototype.drawShape=function(t,n,i){var r=me("rect");return re(r,{x:0,y:0,width:n.width||0,height:n.height||0}),wh(n)?re(r,O({},this.FRAME_STYLE,i||{})):re(r,O({},this.SHAPE_STYLE,i||{})),Re(t,r),r},Zi.prototype.drawConnection=function(t,n,i){var r=qo(n.waypoints,O({},this.CONNECTION_STYLE,i||{}));return Re(t,r),r},Zi.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 Dr(a)},Zi.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 Dr(o)},Zi.$inject=["eventBus","styles"];function UE(){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 O(o,{class:n})},this.style=function(n,i){!_e(n)&&!i&&(i=n,n=[]);var r=En(n,function(o,a){return O(o,e[a]||{})},{});return i?O(r,i):r},this.computeStyle=function(n,i,r){return _e(i)||(r=i,i=[]),t.style(i||[],O({},r,n||{}))}}const YE={__init__:["defaultRenderer"],defaultRenderer:["type",Zi],styles:["type",UE]};function wt(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function St(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 il(e,t){return!e||!t?-1:e.indexOf(t)}function Zo(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function rl(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=Zo(e,t);return Math.abs(r/o)<=i}var qE=2;function Ai(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(KE(r,n))return o;return!1}function KE(e,t){const n=t[0];return Rr(t,function(i){return Math.abs(n[e]-i[e])<=qE})}function Eh(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 ol(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var XE=/,?([a-z]),?/gi,Sh=parseFloat,Tt=Math,Qi=Tt.PI,pi=Tt.min,fi=Tt.max,Rh=Tt.pow,Ji=Tt.abs,ZE=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,QE=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,Ch=Array.isArray||function(e){return e instanceof Array};function JE(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function e1(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 t1(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 JE(r,i)?(e1(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function n1(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(ZE,function(i,r,o){var a=[],c=r.toLowerCase();for(o.replace(QE,function(s,u){u&&a.push(+u)}),c=="m"&&a.length>2&&(n.push([r,...a.splice(0,2)]),c="l",r=r=="m"?"l":"L");a.length>=t[c]&&(n.push([r,...a.splice(0,t[c])]),!!t[c]););}),n.toString=sl,n}function i1(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 r1(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 al(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 sl(){return this.join(",").replace(XE,"$1")}function o1(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,c=r.length;a<c;a++)o[a]=r[a];return t.toString=sl,t}function Ph(e,t,n,i,r,o,a,c,s){var u=1-s,l=Rh(u,3),p=Rh(u,2),f=s*s,d=f*s,h=l*e+p*3*s*n+u*3*s*s*r+d*a,m=l*t+p*3*s*i+u*3*s*s*o+d*c;return{x:ws(h),y:ws(m)}}function Ah(e){var t=p1(...e);return al(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function er(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function a1(e,t){return e=al(e),t=al(t),er(t,e.x,e.y)||er(t,e.x2,e.y)||er(t,e.x,e.y2)||er(t,e.x2,e.y2)||er(e,t.x,t.y)||er(e,t.x2,t.y)||er(e,t.x,t.y2)||er(e,t.x2,t.y2)||(e.x<t.x2&&e.x>t.x||t.x<e.x2&&t.x>e.x)&&(e.y<t.y2&&e.y>t.y||t.y<e.y2&&t.y>e.y)}function Th(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 Mh(e,t,n,i,r,o,a,c,s){s==null&&(s=1),s=s>1?1:s<0?0:s;for(var u=s/2,l=12,p=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],f=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,h=0;h<l;h++){var m=u*p[h]+u,g=Th(m,e,n,r,a),R=Th(m,t,i,o,c),w=g*g+R*R;d+=f[h]*Tt.sqrt(w)}return u*d}function s1(e,t,n,i,r,o,a,c){if(!(fi(e,n)<pi(r,a)||pi(e,n)>fi(r,a)||fi(t,i)<pi(o,c)||pi(t,i)>fi(o,c))){var s=(e*i-t*n)*(r-a)-(e-n)*(r*c-o*a),u=(e*i-t*n)*(o-c)-(t-i)*(r*c-o*a),l=(e-n)*(o-c)-(t-i)*(r-a);if(l){var p=ws(s/l),f=ws(u/l),d=+p.toFixed(2),h=+f.toFixed(2);if(!(d<+pi(e,n).toFixed(2)||d>+fi(e,n).toFixed(2)||d<+pi(r,a).toFixed(2)||d>+fi(r,a).toFixed(2)||h<+pi(t,i).toFixed(2)||h>+fi(t,i).toFixed(2)||h<+pi(o,c).toFixed(2)||h>+fi(o,c).toFixed(2)))return{x:p,y:f}}}}function ws(e){return Math.round(e*1e11)/1e11}function c1(e,t,n){var i=Ah(e),r=Ah(t);if(!a1(i,r))return[];var o=Mh(...e),a=Mh(...t),c=Dh(e)?1:~~(o/5)||1,s=Dh(t)?1:~~(a/5)||1,u=new Array(c+1),l=new Array(s+1),p={},f=[],d,h;for(d=0;d<c+1;d++){var m=Ph(...e,d/c);u[d]={x:m.x,y:m.y,t:d/c}}for(d=0;d<s+1;d++)m=Ph(...t,d/s),l[d]={x:m.x,y:m.y,t:d/s};for(d=0;d<c;d++)for(h=0;h<s;h++){var g=u[d],R=u[d+1],w=l[h],x=l[h+1],b=Ji(R.x-g.x)<.01?"y":"x",E=Ji(x.x-w.x)<.01?"y":"x",T=s1(g.x,g.y,R.x,R.y,w.x,w.y,x.x,x.y),L;if(T){if(L=T.x.toFixed(9)+"#"+T.y.toFixed(9),p[L])continue;p[L]=!0;var A=g.t+Ji((T[b]-g[b])/(R[b]-g[b]))*(R.t-g.t),F=w.t+Ji((T[E]-w[E])/(x[E]-w[E]))*(x.t-w.t);A>=0&&A<=1&&F>=0&&F<=1&&f.push({x:T.x,y:T.y,t1:A,t2:F})}}return f}function kh(e,t,n){e=Ih(e),t=Ih(t);for(var i,r,o,a,c,s,u,l,p,f,d=n?0:[],h=0,m=e.length;h<m;h++){var g=e[h];if(g[0]=="M")i=c=g[1],r=s=g[2];else{g[0]=="C"?(p=[i,r,...g.slice(1)],i=p[6],r=p[7]):(p=[i,r,i,r,c,s,c,s],i=c,r=s);for(var R=0,w=t.length;R<w;R++){var x=t[R];if(x[0]=="M")o=u=x[1],a=l=x[2];else{x[0]=="C"?(f=[o,a,...x.slice(1)],o=f[6],a=f[7]):(f=[o,a,o,a,u,l,u,l],o=u,a=l);var b=c1(p,f);{for(var E=0,T=b.length;E<T;E++)b[E].segment1=h,b[E].segment2=R,b[E].bez1=p,b[E].bez2=f;d=d.concat(b)}}}}}return d}function u1(e){return Ch(e)&&Ch(e[0])}function l1(e){if(i1(e))return e;var t=new Array(e.length),n=0,i=0,r=0,o=0,a=0,c;e[0][0]=="M"&&(n=+e[0][1],i=+e[0][2],r=n,o=i,a++,t[0]=["M",n,i]);for(var s,u,l=a,p=e.length;l<p;l++){if(u=e[l],c=u[0],t[l]=s=new Array(u.length),c!=c.toUpperCase())switch(s[0]=c.toUpperCase(),s[0]){case"A":s[1]=u[1],s[2]=u[2],s[3]=u[3],s[4]=u[4],s[5]=u[5],s[6]=+u[6]+n,s[7]=+u[7]+i;break;case"V":s[1]=+u[1]+i;break;case"H":s[1]=+u[1]+n;break;case"M":r=+u[1]+n,o=+u[2]+i;default:for(var f=1,d=u.length;f<d;f++)s[f]=+u[f]+(f%2?n:i)}else for(var h=0,m=u.length;h<m;h++)s[h]=u[h];switch(c=c.toUpperCase(),s[0]){case"Z":n=+r,i=+o;break;case"H":n=s[1];break;case"V":i=s[1];break;case"M":r=s[s.length-2],o=s[s.length-1];default:n=s[s.length-2],i=s[s.length-1]}}return t.toString=sl,t}function Dh(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Es(e,t,n,i){return[e,t,n,i,n,i]}function Oh(e,t,n,i,r,o){var a=.3333333333333333,c=2/3;return[a*e+c*n,a*t+c*i,a*r+c*n,a*o+c*i,r,o]}function Lh(e,t,n,i,r,o,a,c,s,u){var l=Qi*120/180,p=Qi/180*(+r||0),f=[],d,h=t1(function(C,_,y){var D=C*Tt.cos(y)-_*Tt.sin(y),I=C*Tt.sin(y)+_*Tt.cos(y);return{x:D,y:I}});if(u)L=u[0],A=u[1],E=u[2],T=u[3];else{d=h(e,t,-p),e=d.x,t=d.y,d=h(c,s,-p),c=d.x,s=d.y;var m=(e-c)/2,g=(t-s)/2,R=m*m/(n*n)+g*g/(i*i);R>1&&(R=Tt.sqrt(R),n=R*n,i=R*i);var w=n*n,x=i*i,b=(o==a?-1:1)*Tt.sqrt(Ji((w*x-w*g*g-x*m*m)/(w*g*g+x*m*m))),E=b*n*g/i+(e+c)/2,T=b*-i*m/n+(t+s)/2,L=Tt.asin(((t-T)/i).toFixed(9)),A=Tt.asin(((s-T)/i).toFixed(9));L=e<E?Qi-L:L,A=c<E?Qi-A:A,L<0&&(L=Qi*2+L),A<0&&(A=Qi*2+A),a&&L>A&&(L=L-Qi*2),!a&&A>L&&(A=A-Qi*2)}var F=A-L;if(Ji(F)>l){var H=A,N=c,V=s;A=L+l*(a&&A>L?1:-1),c=E+n*Tt.cos(A),s=T+i*Tt.sin(A),f=Lh(c,s,n,i,r,0,a,N,V,[A,H,E,T])}F=A-L;var fe=Tt.cos(L),je=Tt.sin(L),lt=Tt.cos(A),q=Tt.sin(A),de=Tt.tan(F/4),he=4/3*n*de,ce=4/3*i*de,ue=[e,t],ee=[e+he*je,t-ce*fe],j=[c+he*q,s-ce*lt],$=[c,s];if(ee[0]=2*ue[0]-ee[0],ee[1]=2*ue[1]-ee[1],u)return[ee,j,$].concat(f);f=[ee,j,$].concat(f).join().split(",");for(var U=[],ke=0,Lt=f.length;ke<Lt;ke++)U[ke]=ke%2?h(f[ke-1],f[ke],p).y:h(f[ke],f[ke+1],p).x;return U}function p1(e,t,n,i,r,o,a,c){for(var s=[],u=[[],[]],l,p,f,d,h,m,g,R,w=0;w<2;++w){if(w==0?(p=6*e-12*n+6*r,l=-3*e+9*n-9*r+3*a,f=3*n-3*e):(p=6*t-12*i+6*o,l=-3*t+9*i-9*o+3*c,f=3*i-3*t),Ji(l)<1e-12){if(Ji(p)<1e-12)continue;d=-f/p,0<d&&d<1&&s.push(d);continue}g=p*p-4*f*l,R=Tt.sqrt(g),!(g<0)&&(h=(-p+R)/(2*l),0<h&&h<1&&s.push(h),m=(-p-R)/(2*l),0<m&&m<1&&s.push(m))}for(var x=s.length,b=x,E;x--;)d=s[x],E=1-d,u[0][x]=E*E*E*e+3*E*E*d*n+3*E*d*d*r+d*d*d*a,u[1][x]=E*E*E*t+3*E*E*d*i+3*E*d*d*o+d*d*d*c;return u[0][b]=e,u[1][b]=t,u[0][b+1]=a,u[1][b+1]=c,u[0].length=u[1].length=b+2,{x0:pi(...u[0]),y0:pi(...u[1]),x1:fi(...u[0]),y1:fi(...u[1])}}function Ih(e){if(u1(e)||(e=n1(e)),r1(e))return e;for(var t=o1(l1(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(f,d,h){var m,g;if(!f)return["C",d.x,d.y,d.x,d.y,d.x,d.y];switch(!(f[0]in{T:1,Q:1})&&(d.qx=d.qy=null),f[0]){case"M":d.X=f[1],d.Y=f[2];break;case"A":f=["C",...Lh(d.x,d.y,...f.slice(1))];break;case"S":h=="C"||h=="S"?(m=d.x*2-d.bx,g=d.y*2-d.by):(m=d.x,g=d.y),f=["C",m,g,...f.slice(1)];break;case"T":h=="Q"||h=="T"?(d.qx=d.x*2-d.qx,d.qy=d.y*2-d.qy):(d.qx=d.x,d.qy=d.y),f=["C",...Oh(d.x,d.y,d.qx,d.qy,f[1],f[2])];break;case"Q":d.qx=f[1],d.qy=f[2],f=["C",...Oh(d.x,d.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...Es(d.x,d.y,f[1],f[2])];break;case"H":f=["C",...Es(d.x,d.y,f[1],d.y)];break;case"V":f=["C",...Es(d.x,d.y,d.x,f[1])];break;case"Z":f=["C",...Es(d.x,d.y,d.X,d.Y)];break}return f},r=function(f,d){if(f[d].length>7){f[d].shift();for(var h=f[d];h.length;)o[d]="A",f.splice(d++,0,["C",...h.splice(0,6)]);f.splice(d,1),u=t.length}},o=[],a="",c="",s=0,u=t.length;s<u;s++){t[s]&&(a=t[s][0]),a!="C"&&(o[s]=a,s&&(c=o[s-1])),t[s]=i(t[s],n,c),o[s]!="A"&&a=="C"&&(o[s]="C"),r(t,s);var l=t[s],p=l.length;n.x=l[p-2],n.y=l[p-1],n.bx=Sh(l[p-4])||n.x,n.by=Sh(l[p-3])||n.y}return t}function it(e){return Gt(e)&&wn(e,"waypoints")}function Me(e){return Gt(e)&&wn(e,"labelTarget")}function f1(e){return Gt(e)&&Xr(e.parent)}function Nh(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function Ti(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function ye(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Ss(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function d1(e){return Ti({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function h1(e){for(var t=e.waypoints,n=t.reduce(function(u,l,p){var f=t[p-1];if(f){var d=u[u.length-1],h=d&&d.endLength||0,m=y1(f,l);u.push({start:f,end:l,startLength:h,endLength:h+m,length:m})}return u},[]),i=n.reduce(function(u,l){return u+l.length},0),r=i/2,o=0,a=n[o];a.endLength<r;)a=n[++o];var c=(r-a.startLength)/a.length,s={x:a.start.x+(a.end.x-a.start.x)*c,y:a.start.y+(a.end.y-a.start.y)*c};return s}function be(e){return it(e)?h1(e):d1(e)}function Zt(e,t,n){n=n||0,Gt(n)||(n={x:n,y:n});var i=ye(e),r=ye(t),o=i.bottom+n.y<=r.top,a=i.left-n.x>=r.right,c=i.top-n.y>=r.bottom,s=i.right+n.x<=r.left,u=o?"top":c?"bottom":null,l=s?"left":a?"right":null;return l&&u?u+"-"+l:l||u||"intersect"}function Qo(e,t,n){var i=m1(e,t);return i.length===1||i.length===2&&Zo(i[0],i[1])<1?Ti(i[0]):i.length>1?(i=oi(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),Ti(i[n?0:i.length-1])):null}function m1(e,t){return kh(e,t)}function g1(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],Zo(n,r)===0||rl(i,r,n)?e.splice(t,1):t++;return e}function y1(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Rs(e,t){return Math.round(e*t)/t}function Bh(e){return we(e)?e+"px":e}function v1(e){for(;e.parent;)e=e.parent;return e}function _1(e){e=O({},{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:Bh(e.width),height:Bh(e.height)}),t.appendChild(n),n}function $h(e,t,n){const i=me("g");Fe(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const b1="base",jh=0,x1=1,w1={shape:["x","y","width","height"],connection:["waypoints"]};function xe(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||{})}xe.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],xe.prototype._init=function(e){const t=this._eventBus,n=this._container=_1(e),i=this._svg=me("svg");re(i,{width:"100%",height:"100%"}),an(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")}),Re(n,i);const r=this._viewport=$h(i,"viewport");e.deferUpdate&&(this._viewboxChanged=Ru(this._viewboxChanged,300)),this._restoreFocus=Ru(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)},xe.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},xe.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},xe.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},xe.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},xe.prototype.restoreFocus=function(){this._restoreFocus()},xe.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},xe.prototype.isFocused=function(){return this._focused},xe.prototype.getDefaultLayer=function(){return this.getLayer(b1,jh)},xe.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},xe.prototype._getChildIndex=function(e){return En(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},xe.prototype._createLayer=function(e,t){typeof t>"u"&&(t=x1);const n=this._getChildIndex(t);return{group:$h(this._viewport,"layer-"+e,n),index:t,visible:!0}},xe.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},xe.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},xe.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],Ft(t.group))},xe.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},xe.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(v1(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},xe.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},xe.prototype._findPlaneForRoot=function(e){return st(this._planes,function(t){return t.rootElement===e})},xe.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},xe.prototype._resolveElements=function(e){return _e(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},xe.prototype.getContainer=function(){return this._container},xe.prototype._updateMarker=function(e,t,n){let i;e=this._resolveElement(e),e.markers=e.markers||new Set,i=this._elementRegistry._elements[e.id],i&&(M([i.gfx,i.secondaryGfx],function(r){r&&(n?(e.markers.add(t),Fe(r).add(t)):(e.markers.delete(t),Fe(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},xe.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},xe.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},xe.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},xe.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},xe.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},xe.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,jh);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},xe.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},xe.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},xe.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)},xe.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})},xe.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})},xe.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=w1[e];if(!Rr(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},xe.prototype._setParent=function(e,t,n){St(t.children,e,n),e.parent=t},xe.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},xe.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},xe.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},xe.prototype._removeElement=function(e,t){const n=this._elementRegistry,i=this._graphicsFactory,r=this._eventBus;if(e=n.get(e.id||e),!!e)return r.fire(t+".remove",{element:e}),i.remove(e),wt(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},xe.prototype.removeShape=function(e){return this._removeElement(e,"shape")},xe.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},xe.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},xe.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},xe.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},xe.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,c,s,u;if(e)this._changeViewbox(function(){c=Math.min(n.width/e.width,n.height/e.height);const l=this._svg.createSVGMatrix().scale(c).translate(-e.x,-e.y);Yo(t,l)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=Yo(t),r=a?a.matrix:PE(),c=Rs(r.a,1e3),s=Rs(-r.e||0,1e3),u=Rs(-r.f||0,1e3),e=this._cachedViewbox={x:s?s/c:0,y:u?u/c:0,width:n.width/c,height:n.height/c,scale:c,inner:{width:i.width||0,height:i.height||0,x:i.x||0,y:i.y||0},outer:n},e;return e},xe.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=O({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Fh(t,n)}),{x:n.e,y:n.f}},xe.prototype.scrollToElement=function(e,t){let n=100;const i=this._resolveElements(e);if(!i.length)return;const r=this.findRoot(i);if(!r)return;r!==this.getRootElement()&&this.setRootElement(r);const o=i.filter(h=>h!=r);if(!o.length)return;t||(t={}),typeof t=="number"&&(n=t),t={top:t.top||n,right:t.right||n,bottom:t.bottom||n,left:t.left||n};const a=At(o),c=ye(a),s=this.viewbox(),u=this.zoom();let l,p;s.y+=t.top/u,s.x+=t.left/u,s.width-=(t.right+t.left)/u,s.height-=(t.bottom+t.top)/u;const f=ye(s);if(!(a.width<s.width&&a.height<s.height))l=a.x-s.x,p=a.y-s.y;else{const h=Math.max(0,c.right-f.right),m=Math.min(0,c.left-f.left),g=Math.max(0,c.bottom-f.bottom),R=Math.min(0,c.top-f.top);l=h||m,p=g||R}this.scroll({dx:-l*u,dy:-p*u})},xe.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)}),Rs(i.a,1e3)};function Fh(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}xe.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},xe.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,r=n.createSVGMatrix(),o=n.createSVGPoint();let a,c,s,u,l;s=i.getCTM();const p=s.a;return t?(a=O(o,t),c=a.matrixTransform(s.inverse()),u=r.translate(c.x,c.y).scale(1/p*e).translate(-c.x,-c.y),l=s.multiply(u)):l=r.scale(e),Fh(this._viewport,l),l},xe.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},xe.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}},xe.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var oo="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),re(t,oo,i),n&&re(n,oo,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&&(re(i.gfx,oo,""),i.secondaryGfx&&re(i.secondaryGfx,oo,""),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&&re(t,oo,i),t},Bn.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&re(e,oo);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,c=o.gfx;if(e(a,c))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 E1(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 c=this.indexOf(o);if(typeof a>"u"){if(c!==-1)return;a=this.length}c!==-1&&this.splice(c,1),this.splice(a,0,o),c===-1&&t.set(o,r,i)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e}function S1(e){return e.__refs_collection===!0}function R1(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function Hh(e,t,n){var i=E1(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 C1(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 Vn(e,t){if(!(this instanceof Vn))return new Vn(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Vn.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?Hh(this,t,e):C1(this,t,e)},Vn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return S1(n)||Hh(this,t,e),n},Vn.prototype.ensureBound=function(e,t){R1(e,t)||this.bind(e,t)},Vn.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Vn.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 Vn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),zh=new Vn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Vh=new Vn({name:"attachers",collection:!0},{name:"host"}),Gh=new Vn({name:"outgoing",collection:!0},{name:"source"}),Wh=new Vn({name:"incoming",collection:!0},{name:"target"});function ao(){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"),zh.bind(this,"labels"),Gh.bind(this,"outgoing"),Wh.bind(this,"incoming")}function Jo(){ao.call(this),cl.bind(this,"children"),Vh.bind(this,"host"),Vh.bind(this,"attachers")}ie(Jo,ao);function Uh(){ao.call(this),cl.bind(this,"children")}ie(Uh,Jo);function Yh(){Jo.call(this),zh.bind(this,"labelTarget")}ie(Yh,Jo);function qh(){ao.call(this),Gh.bind(this,"source"),Wh.bind(this,"target")}ie(qh,ao);var P1={connection:qh,shape:Jo,label:Yh,root:Uh};function A1(e,t){var n=P1[e];if(!n)throw new Error("unknown type: <"+e+">");return O(new n,t)}function T1(e){return e instanceof ao}function Mi(){this._uid=12}Mi.prototype.createRoot=function(e){return this.create("root",e)},Mi.prototype.createLabel=function(e){return this.create("label",e)},Mi.prototype.createShape=function(e){return this.create("shape",e)},Mi.prototype.createConnection=function(e){return this.create("connection",e)},Mi.prototype.create=function(e,t){return t=O({},t||{}),t.id||(t.id=e+"_"+this._uid++),A1(e,t)};var Cs="__fn",Kh=1e3,M1=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=_e(e)?e:[e],Wt(t)&&(i=n,n=t,t=Kh),!we(t))throw new Error("priority must be a number");var r=n;i&&(r=vn(n,i),r[Cs]=n[Cs]||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(Wt(t)&&(i=n,n=t,t=Kh),!we(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[Cs]=n,this.on(e,t,o)},Cn.prototype.off=function(e,t){e=_e(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},Cn.prototype.createEvent=function(e){var t=new ea;return t.init(e),t},Cn.prototype.fire=function(e,t){var n,i,r,o;if(o=M1.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 ea?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=k1(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[Cs]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function ea(){}ea.prototype.stopPropagation=function(){this.cancelBubble=!0},ea.prototype.preventDefault=function(){this.defaultPrevented=!0},ea.prototype.init=function(e){O(this,e||{})};function k1(e,t){return e.apply(null,t)}function Lr(e){return e.childNodes[0]}function D1(e){return e.parentNode.childNodes[1]}function Ps(e,t,n,i,r){var o=Uo();o.setTranslate(t,n);var a=Uo();a.setRotate(i||0,0,0);var c=Uo();c.setScale(1,1),Yo(e,[o,a,c])}function Qt(e,t,n){var i=Uo();i.setTranslate(t,n),Yo(e,i)}function Xh(e,t){var n=Uo();n.setRotate(t,0,0),Yo(e,n)}function $n(e,t){this._eventBus=e,this._elementRegistry=t}$n.$inject=["eventBus","elementRegistry"],$n.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=D1(t),n||(n=me("g"),Fe(n).add("djs-children"),Re(t.parentNode,n))):n=t,n},$n.prototype._clear=function(e){var t=Lr(e);return ms(t),t},$n.prototype._createContainer=function(e,t,n,i){var r=me("g");Fe(r).add("djs-group"),typeof n<"u"?O1(r,t,t.childNodes[n]):Re(t,r);var o=me("g");Fe(o).add("djs-element"),Fe(o).add("djs-"+e),i&&Fe(o).add("djs-frame"),Re(r,o);var a=me("g");return Fe(a).add("djs-visual"),Re(o,a),o},$n.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,wh(t))},$n.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},{}),M(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r),c=a.firstChild;M(o,function(s){var u=n.getGraphics(s).parentNode;u===c?c=c.nextSibling:a.insertBefore(u,c)})}})},$n.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},$n.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},$n.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},$n.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},$n.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),Qt(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?re(n,"display","none"):re(n,"display","block")}},$n.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);Ft(t.parentNode)};function O1(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const L1={__depends__:[YE],__init__:["canvas"],canvas:["type",xe],elementRegistry:["type",Bn],elementFactory:["type",Mi],eventBus:["type",Cn],graphicsFactory:["type",$n]};function I1(e){var t=new bh(e);return t.init(),t}function N1(e){e=e||{};var t={config:["value",e]},n=[t,L1].concat(e.modules||[]);return I1(n)}function tr(e,t){this._injector=t||N1(e),this.get("eventBus").fire("diagram.init")}tr.prototype.get=function(e,t){return this._injector.get(e,t)},tr.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},tr.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},tr.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function sn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function _n(e,t){return e.$instanceOf(t)}function B1(e){return st(e.rootElements,function(t){return _n(t,"bpmn:Process")||_n(t,"bpmn:Collaboration")})}function $1(e){var t={},n=[],i={};function r(j,$){return function(U){j(U,$)}}function o(j){t[j.id]=j}function a(j){return t[j.id]}function c(j,$){var U=j.gfx;if(U)throw new Error(`already rendered ${sn(j)}`);return e.element(j,i[j.id],$)}function s(j,$){return e.root(j,i[j.id],$)}function u(j,$){try{var U=i[j.id]&&c(j,$);return o(j),U}catch(ke){l(ke.message,{element:j,error:ke}),console.error(`failed to import ${sn(j)}`,ke)}}function l(j,$){e.error(j,$)}var p=this.registerDi=function($){var U=$.bpmnElement;U?i[U.id]?l(`multiple DI elements defined for ${sn(U)}`,{element:U}):i[U.id]=$:l(`no bpmnElement referenced in ${sn($)}`,{element:$})};function f(j){d(j.plane)}function d(j){p(j),M(j.planeElement,h)}function h(j){p(j)}this.handleDefinitions=function($,U){var ke=$.diagrams;if(U&&ke.indexOf(U)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!U&&ke&&ke.length&&(U=ke[0]),!U)throw new Error("no diagram to display");i={},f(U);var Lt=U.plane;if(!Lt)throw new Error(`no plane for ${sn(U)}`);var C=Lt.bpmnElement;if(!C)if(C=B1($),C)l(`correcting missing bpmnElement on ${sn(Lt)} to ${sn(C)}`),Lt.bpmnElement=C,p(Lt);else throw new Error("no process or collaboration to display");var _=s(C,Lt);if(_n(C,"bpmn:Process")||_n(C,"bpmn:SubProcess"))g(C,_);else if(_n(C,"bpmn:Collaboration"))ue(C,_),R($.rootElements,_);else throw new Error(`unsupported bpmnElement for ${sn(Lt)}: ${sn(C)}`);m(n)};var m=this.handleDeferred=function(){for(var $;n.length;)$=n.shift(),$()};function g(j,$){de(j,$),F(j.ioSpecification,$),A(j.artifacts,$),o(j)}function R(j,$){var U=Oe(j,function(ke){return!a(ke)&&_n(ke,"bpmn:Process")&&ke.laneSets});U.forEach(r(g,$))}function w(j,$){u(j,$)}function x(j,$){M(j,r(w,$))}function b(j,$){u(j,$)}function E(j,$){u(j,$)}function T(j,$){u(j,$)}function L(j,$){u(j,$)}function A(j,$){M(j,function(U){_n(U,"bpmn:Association")?n.push(function(){L(U,$)}):L(U,$)})}function F(j,$){j&&(M(j.dataInputs,r(E,$)),M(j.dataOutputs,r(T,$)))}var H=this.handleSubProcess=function($,U){de($,U),A($.artifacts,U)};function N(j,$){var U=u(j,$);_n(j,"bpmn:SubProcess")&&H(j,U||$),_n(j,"bpmn:Activity")&&F(j.ioSpecification,$),n.push(function(){M(j.dataInputAssociations,r(b,$)),M(j.dataOutputAssociations,r(b,$))})}function V(j,$){u(j,$)}function fe(j,$){u(j,$)}function je(j,$){n.push(function(){var U=u(j,$);j.childLaneSet&&lt(j.childLaneSet,U||$),ee(j)})}function lt(j,$){M(j.lanes,r(je,$))}function q(j,$){M(j,r(lt,$))}function de(j,$){he(j.flowElements,$),j.laneSets&&q(j.laneSets,$)}function he(j,$){M(j,function(U){_n(U,"bpmn:SequenceFlow")?n.push(function(){V(U,$)}):_n(U,"bpmn:BoundaryEvent")?n.unshift(function(){N(U,$)}):_n(U,"bpmn:FlowNode")?N(U,$):_n(U,"bpmn:DataObject")||(_n(U,"bpmn:DataStoreReference")||_n(U,"bpmn:DataObjectReference")?fe(U,$):l(`unrecognized flowElement ${sn(U)} in context ${sn($&&$.businessObject)}`,{element:U,context:$}))})}function ce(j,$){var U=u(j,$),ke=j.processRef;ke&&g(ke,U||$)}function ue(j,$){M(j.participants,r(ce,$)),n.push(function(){x(j.messageFlows,$)}),A(j.artifacts,$)}function ee(j){M(j.flowNodeRef,function($){var U=$.get("lanes");U&&U.push(j)})}}function v(e,t){var n=Z(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function De(e,t){return Vi(t,function(n){return v(e,n)})}function Z(e){return e&&e.businessObject||e}function Ve(e){return e&&e.di}function j1(e,t,n){var i,r,o,a,c=[];function s(u,l){var p={root:function(m,g){return i.add(m,g)},element:function(m,g,R){return i.add(m,g,R)},error:function(m,g){c.push({message:m,context:g})}},f=new $1(p);l=l||u.diagrams&&u.diagrams[0];var d=F1(u,l);if(!d)throw new Error("no diagram to display");M(d,function(m){f.handleDefinitions(u,m)});var h=l.plane.bpmnElement.id;o.setRootElement(o.findRoot(h+"_plane")||o.findRoot(h))}return new Promise(function(u,l){try{return i=e.get("bpmnImporter"),r=e.get("eventBus"),o=e.get("canvas"),r.fire("import.render.start",{definitions:t}),s(t,n),r.fire("import.render.complete",{error:a,warnings:c}),u({warnings:c})}catch(p){return p.warnings=c,l(p)}})}function F1(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!v(n,"bpmn:Process")&&!v(n,"bpmn:Collaboration")&&(i=H1(n));var r;v(i,"bpmn:Collaboration")?r=i:r=st(e.rootElements,function(u){if(v(u,"bpmn:Collaboration"))return st(u.participants,function(l){return l.processRef===i})});var o=[i];r&&(o=rn(r.participants,function(u){return u.processRef}),o.push(r));var a=Zh(o),c=[t],s=[n];return M(e.diagrams,function(u){if(u.plane){var l=u.plane.bpmnElement;a.indexOf(l)!==-1&&s.indexOf(l)===-1&&(c.push(u),s.push(l))}}),c}}function Zh(e){var t=[];return M(e,function(n){n&&(t.push(n),t=t.concat(Zh(n.flowElements)))}),t}function H1(e){for(var t=e;t;){if(v(t,"bpmn:Process"))return t;t=t.$parent}}var z1='<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>',Qh=z1,Jh={verticalAlign:"middle"},em={color:"#404040"},V1={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},G1={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},W1={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"},U1='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+Qh+'</a><span>Web-based tooling for BPMN, DMN and forms powered by <a href="https://bpmn.io" target="_blank" rel="noopener">bpmn.io</a>.</span></div></div>',di;function Y1(){di=ut(U1),mn(di,V1),mn(et("svg",di),Jh),mn(et(".backdrop",di),G1),mn(et(".notice",di),W1),mn(et(".link",di),em,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function q1(){di||(Y1(),Rn.bind(di,".backdrop","click",function(e){document.body.removeChild(di)})),document.body.appendChild(di)}const As=5,tm="djs-outline-hidden";function yt(e){e=O({},X1,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),Q1(this._container)}ie(yt,tr),yt.prototype.importXML=async function(t,n){const i=this;function r(a){return i.get("eventBus").createEvent(a)}let o=[];try{t=this._emit("import.parse.start",{xml:t})||t;let a;try{a=await this._moddle.fromXML(t,"bpmn:Definitions")}catch(f){throw this._emit("import.parse.complete",{error:f}),f}let c=a.rootElement;const s=a.references,u=a.warnings,l=a.elementsById;o=o.concat(u),c=this._emit("import.parse.complete",r({error:null,definitions:c,elementsById:l,references:s,warnings:o}))||c;const p=await this.importDefinitions(c,n);return o=o.concat(p.warnings),this._emit("import.done",{error:null,warnings:o}),{warnings:o}}catch(a){let c=a;throw o=o.concat(c.warnings||[]),Ts(c,o),c=K1(c),this._emit("import.done",{error:c,warnings:c.warnings}),c}},yt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},yt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw Ts(o,[]),o}if(typeof t=="string"&&(i=Z1(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw Ts(o,[]),o}try{this.clear()}catch(o){throw Ts(o,[]),o}const{warnings:r}=await j1(this,n,i);return{warnings:r}},yt.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},yt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=et(":scope > defs",i._svg),a=_h(r),c=o?"<defs>"+_h(o)+"</defs>":"",s=i.getContainer();ht(s).add(tm);let u;try{u=r.getBBox()}finally{ht(s).remove(tm)}const l=u.x-As,p=u.y-As,f=u.width+As*2,d=u.height+As*2;t=`<?xml version="1.0" encoding="utf-8"?>
4
+ nested error: `+E.message;if(L)return a.addWarning({message:G,error:E}),!0;throw Ui(G)}function l(E,T){return u(E,T,!0)}function p(){var E=a.elementsById,T=a.references,L,A;for(L=0;A=T[L];L++){var j=A.element,H=E[A.id],N=Ei(j).propertiesByName[A.property];if(H||a.addWarning({message:"unresolved reference <"+A.id+">",element:A.element,property:A.property,value:A.id}),N.isMany){var G=j.get(N.name),fe=G.indexOf(A);fe===-1&&(fe=G.length),H?G[fe]=H:G.splice(fe,1)}else j.set(N.name,H)}}function f(){c.pop().handleEnd()}var d=/^<\?xml /i,h=/ encoding="([^"]+)"/i,m=/^utf-8$/i;function g(E){if(d.test(E)){var T=h.exec(E),L=T&&T[1];!L||m.test(L)||a.addWarning({message:"unsupported document encoding <"+L+">, falling back to UTF-8"})}}function R(E,T){var L=c.peek();try{c.push(L.handleNode(E))}catch(A){u(A,T,o)&&c.push(new Du)}}function w(E,T){try{c.peek().handleText(E)}catch(L){l(L,T)}}function b(E,T){E.trim()&&w(E,T)}var x=r.getPackages().reduce(function(E,T){return E[T.uri]=T.prefix,E},Object.entries(ku).reduce(function(E,[T,L]){return E[L]=T,E},r.config&&r.config.nsMap||{}));return s.ns(x).on("openTag",function(E,T,L,A){var j=E.attrs||{},H=Object.keys(j).reduce(function(G,fe){var Fe=T(j[fe]);return G[fe]=Fe,G},{}),N={name:E.name,originalName:E.originalName,attributes:H,ns:E.ns};R(N,A)}).on("question",g).on("closeTag",f).on("cdata",w).on("text",function(E,T,L){b(T(E),L)}).on("error",u).on("warn",l),new Promise(function(E,T){var L;try{s.parse(e),p()}catch(G){L=G}var A=i.element;!L&&!A&&(L=Ui("failed to parse document as <"+i.type.$descriptor.name+">"));var j=a.warnings,H=a.references,N=a.elementsById;return L?(L.warnings=j,T(L)):E({rootElement:A,elementsById:N,references:H,warnings:j})})},Iu.prototype.handler=function(e){return new Lu(this.model,e)};function d0(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var h0=`<?xml version="1.0" encoding="UTF-8"?>
5
+ `,m0=/<|>|'|"|&|\n\r|\n/g,ad=/<|>|&/g;function si(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}si.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},si.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},si.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},si.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)},si.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},si.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},si.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},si.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},si.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 g0(e){return e.charAt(0).toLowerCase()+e.slice(1)}function y0(e,t){return nd(t)?g0(e):e}function sd(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function cd(e){return wn(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function v0(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 _0(e,t){return t.isGeneric?O({localName:t.ns.localName},e):O({localName:y0(t.ns.localName,t.$pkg)},e)}function b0(e,t){return O({localName:t.ns.localName},e)}function x0(e){var t=e.$descriptor;return Oe(t.properties,function(n){var i=n.name;if(n.isVirtual||!En(e,i))return!1;var r=e[i];return r===n.default||r===null?!1:n.isMany?r.length:!0})}var w0={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},E0={"<":"lt",">":"gt","&":"amp"};function ud(e,t,n){return e=wn(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function S0(e){return ud(e,m0,w0)}function R0(e){return ud(e,ad,E0)}function C0(e){return Oe(e,function(t){return t.isAttr})}function P0(e){return Oe(e,function(t){return!t.isAttr})}function Nu(e){this.tagName=e}Nu.prototype.build=function(e){return this.element=e,this},Nu.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?R0(this.value):this.value)},Ar.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(ad)!==-1&&(this.escape=!0),this};function Bu(e){this.tagName=e}sd(Bu,Ar),Bu.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function dt(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}dt.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=x0(e),this.parseAttributes(C0(r)),this.parseContainments(P0(r))),this.parseGenericAttributes(e,i),this},dt.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return _0(t,e)},dt.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return b0(t,e)},dt.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},dt.prototype.nsAttributeName=function(e){var t;if(wn(e)?t=on(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}:O({localName:t.localName},n)},dt.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}))},dt.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new Ar().build({type:"String"},t));var n=e.$children;n&&M(n,i=>{this.body.push(new dt(this).build(i))})},dt.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,r=on(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)}},dt.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return M(n,function(r,o){var a=t.parseNsAttribute(e,o,r);a&&i.push(a)}),i},dt.prototype.parseGenericAttributes=function(e,t){var n=this;M(t,function(i){try{n.addAttribute(n.nsAttributeName(i.name),i.value)}catch(r){typeof console<"u"&&console.warn(`missing namespace information for <${i.name}=${i.value}> on`,e,r)}})},dt.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;M(e,function(r){var o=i.get(r.name),a=r.isReference,s=r.isMany;if(s||(o=[o]),r.isBody)n.push(new Ar().build(r,o[0]));else if(Kf(r.type))M(o,function(u){n.push(new Bu(t.addTagName(t.nsPropertyTagName(r))).build(r,u))});else if(a)M(o,function(u){n.push(new Nu(t.addTagName(t.nsPropertyTagName(r))).build(u))});else{var c=rd(r);M(o,function(u){var l;c?c===id?l=new dt(t,r):l=new ts(t,r,c):l=new dt(t),n.push(l.build(u))})}})},dt.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new si(i):t=i),t},dt.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},dt.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},dt.prototype.parseAttributes=function(e){var t=this,n=this.element;M(e,function(i){var r=n.get(i.name);if(i.isReference)if(!i.isMany)r=r.id;else{var o=[];M(r,function(a){o.push(a.id)}),r=o.join(" ")}t.addAttribute(t.nsAttributeName(i),r)})},dt.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),cd(e)},dt.prototype.addAttribute=function(e,t){var n=this.attrs;wn(t)&&(t=S0(t));var i=Wf(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)},dt.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=v0(n).concat(t)),M(t,function(i){e.append(" ").append(cd(i.name)).append('="').append(i.value).append('"')})},dt.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(),M(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function ts(e,t,n){dt.call(this,e,t),this.serialization=n}sd(ts,dt),ts.prototype.parseNsAttributes=function(e){var t=dt.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},ts.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function A0(){this.value="",this.write=function(e){this.value+=e}}function T0(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 M0(e){e=O({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new A0,o=new T0(r,e.format);e.preamble&&o.append(h0);var a=new dt,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(k0(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function k0(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in ku)n[i]=ku[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 ns(e,t){Hn.call(this,e,t)}ns.prototype=Object.create(Hn.prototype),ns.prototype.fromXML=function(e,t,n){wn(t)||(n=t,t="bpmn:Definitions");var i=new Iu(O({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},ns.prototype.toXML=function(e,t){var n=new M0(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var D0="BPMN20",O0="http://www.omg.org/spec/BPMN/20100524/MODEL",L0="bpmn",I0=[],N0=[{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"}]}],B0=[{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"}]}],$0={tagAlias:"lowerCase",typePrefix:"t"},j0={name:D0,uri:O0,prefix:L0,associations:I0,types:N0,enumerations:B0,xml:$0},F0="BPMNDI",H0="http://www.omg.org/spec/BPMN/20100524/DI",z0="bpmndi",V0=[{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"]}],G0=[{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"}]}],W0=[],U0={name:F0,uri:H0,prefix:z0,types:V0,enumerations:G0,associations:W0},Y0="DC",q0="http://www.omg.org/spec/DD/20100524/DC",K0="dc",X0=[{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}]}],Z0=[],Q0={name:Y0,uri:q0,prefix:K0,types:X0,associations:Z0},J0="DI",ew="http://www.omg.org/spec/DD/20100524/DI",tw="di",nw=[{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"}]}],iw=[],rw={tagAlias:"lowerCase"},ow={name:J0,uri:ew,prefix:tw,types:nw,associations:iw,xml:rw},aw="bpmn.io colors for BPMN",sw="http://bpmn.io/schema/bpmn/biocolor/1.0",cw="bioc",uw=[{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"}]}],lw=[],pw=[],fw={name:aw,uri:sw,prefix:cw,types:uw,enumerations:lw,associations:pw},dw="BPMN in Color",hw="http://www.omg.org/spec/BPMN/non-normative/color/1.0",mw="color",gw=[{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"}]}],yw=[],vw=[],_w={name:dw,uri:hw,prefix:mw,types:gw,enumerations:yw,associations:vw};const bw={bpmn:j0,bpmndi:U0,dc:Q0,di:ow,bioc:fw,color:_w};function ld(e,t){const n=O({},bw,e);return new ns(n,t)}const xw={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"}},ww="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",pd="i18n",is={[pd]:xw,[bu]:Ff};function fd(){return ld(is)}const dd=fd();async function $u(e){const{rootElement:t,warnings:n}=await dd.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function Ew(e){const{xml:t}=await dd.toXML(e,{format:!0});return t}function ju(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const no={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},Sw=/[ᄀ-ᇿ -〿぀-ヿ㐀-鿿가-힯＀-⦆]/;function Rw(e){const t=no;return Sw.test(e)?t.cjkEm:e===" "?t.spaceEm:e>="0"&&e<="9"?t.digitEm:e>="A"&&e<="Z"?t.upperEm:e>="a"&&e<="z"?t.lowerEm:t.otherEm}function io(e,t){let n=0;for(const i of e)n+=t*Rw(i);return n}function hd(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&Cw(e),Pw(e),Aw(e),Tw(e)}function Cw(e){var i;const t=(i=e.HTMLCanvasElement)==null?void 0:i.prototype;if(!t||t.__headlessTextMeasurement)return;t.__headlessTextMeasurement=!0;const n={font:"12px sans-serif",letterSpacing:"0px",measureText(r){var a;const o=Number.parseFloat(((a=String(n.font).match(/(\d+(?:\.\d+)?)px/))==null?void 0:a[1])??"12");return{width:io(r,o),fontBoundingBoxAscent:o*no.ascentEm,fontBoundingBoxDescent:o*no.descentEm,actualBoundingBoxAscent:o*no.ascentEm,actualBoundingBoxDescent:o*no.descentEm}}};t.getContext=()=>n}function Pw(e){if(e.SVGMatrix)return;class t{constructor(){Kr(this,"a",1);Kr(this,"b",0);Kr(this,"c",0);Kr(this,"d",1);Kr(this,"e",0);Kr(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 Aw(e){var o;const t=()=>{const a=new e.SVGMatrix;return{type:0,matrix:a,setTranslate(s,c){a.e=s,a.f=c},setScale(s,c){a.a=s,a.d=c},setRotate(s,c=0,u=0){const l=s*Math.PI/180,p=Math.cos(l),f=Math.sin(l);a.a=p,a.b=f,a.c=-f,a.d=p,a.e=c-p*c+f*u,a.f=u-f*c-p*u},setMatrix(s){Object.assign(a,s)}}},n=a=>{const s=t();return Object.assign(s.matrix,a),s},i=(o=e.SVGSVGElement)==null?void 0:o.prototype;i&&!i.createSVGTransform&&(i.createSVGTransform=t,i.createSVGTransformFromMatrix=n,i.createSVGMatrix=()=>new e.SVGMatrix,i.createSVGPoint=()=>({x:0,y:0,matrixTransform:()=>({x:0,y:0})}));const r=e.SVGElement.prototype;Object.getOwnPropertyDescriptor(r,"transform")||Object.defineProperty(r,"transform",{configurable:!0,get(){if(!this.__headlessTransformList){const a=[];this.__headlessTransformList={baseVal:{get numberOfItems(){return a.length},clear:()=>{a.length=0},appendItem:s=>(a.push(s),s),getItem:s=>a[s],createSVGTransformFromMatrix:n,consolidate:()=>a[a.length-1]??null}}}return this.__headlessTransformList}})}function Tw(e){const t=e.SVGElement.prototype;if(!t.getCTM){const n=()=>new e.SVGMatrix;t.getCTM=n,t.getScreenCTM=n}t.getBBox||(t.getBBox=function(){const n=String(this.textContent??"");return{x:0,y:0,width:io(n,12),height:14}})}const rs=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),Mw=1,kw=2;function Yi(e){switch(e.kind){case"label-over-line":return`L|${e.edge}|${e.line}`;case"edge-crosses-shape":return`x|${e.edge}|${e.shape}`;case"shape-overlap":return`o|${e.shapes[0]}|${e.shapes[1]}`;case"shape-outside-container":return`c|${e.shape}|${e.container}`;case"edge-overlap-opposite":return`p|${e.edges[0]}|${e.edges[1]}`;case"edge-overlap-mixed":return`m|${e.edges[0]}|${e.edges[1]}`;case"label-on-shared-segment":return`l|${e.edge}|${e.other}`;case"annotation-over-label":return`a|${e.annotation}|${e.label}`;case"group-overlap-unintended":return`g|${e.groups[0]}|${e.groups[1]}`;case"group-on-container-boundary":return`gb|${e.group}|${e.container}|${e.side}`;case"pool-name-over-label":return`pn|${e.pool}|${e.label}`}}const md=20,gd=5,Dw=3,yd=12,Ow=yd*1.2;function Fu(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(o=>io(o,yd))),r=n.length*Ow;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-r/2,width:i,height:r}}const vd=1;function hn(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 os(e,t){let n=null;const i=e.type!==t.type;for(const r of hn(e))for(const o of hn(t)){if(r.axis!==o.axis||Math.abs(r.at-o.at)>vd)continue;const a=r.dir!==o.dir?"opposite":i?"mixed":null;if(!a)continue;const s=Math.min(r.hi,o.hi)-Math.max(r.lo,o.lo);s>=md&&(!n||s>n.length)&&(n={axis:r.axis,length:s,kind:a})}return n}function _d(e,t){const n=os(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function Lw(e,t){let n=0;for(const i of t)i.id!==e.id&&_d(e,i)&&n++;return n}function Tr(e,t){let n=0;for(const i of t)i.id!==e.id&&os(e,i)&&n++;return n}const bd=15,xd=20;function Iw(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-xd||t.at>n[1]+xd)return null;const i=t.axis==="v"?[e.y,e.y+e.height]:[e.x,e.x+e.width],r=Math.max(i[0],t.lo),o=Math.min(i[1],t.hi);return o>r?[r,o]:null}const Hu=20;function as(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>vd)continue;const r=Math.max(e.lo,i.lo),o=Math.min(e.hi,i.hi);o-r<md||n.push([r-Hu,o+Hu])}return n}function ss(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of hn(e)){const o=Iw(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of as(r,hn(a)))if(Math.min(c,o[1])>Math.max(s,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const Nw=1,Bw=(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 $w(e,t,n,i){const r=n.x+i,o=n.y+i,a=n.x+n.width-i,s=n.y+n.height-i;if(a<=r||s<=o)return!1;const c=t.x-e.x,u=t.y-e.y;let l=0,p=1;const f=(d,h)=>{if(h===0)return d<=0;const m=d/h;if(h>0){if(m>p)return!1;m>l&&(l=m)}else{if(m<l)return!1;m<p&&(p=m)}return!0};return f(r-e.x,c)&&f(e.x-a,-c)&&f(o-e.y,u)&&f(e.y-s,-u)&&p>l}function zu(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 jw=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,ro=1;function Si(e,t){const n=e.x+ro,i=e.x+e.width-ro,r=e.y+ro,o=e.y+e.height-ro;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 Wo(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 wd(e,t){const n=e.label;if(!n)return null;if(hn(e).some(i=>Si(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(hn(i).some(r=>Si(n,r)))return i.id;for(const i of t.shapes.filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(Wo(i).some(r=>Si(n,r)))return i.id;return null}function zn(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($w(e.waypoints[o],e.waypoints[o+1],r,kw)){i.push(r);break}}return i}function Fw(e,t,n,i){const r=(u,l,p)=>(l.x-u.x)*(p.y-u.y)-(l.y-u.y)*(p.x-u.x),o=r(n,i,e),a=r(n,i,t),s=r(e,t,n),c=r(e,t,i);return o*a<0&&s*c<0}const Ed=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function cs(e,t){let n=0;for(const i of t){if(i.id===e.id||Ed(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++)Fw(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function Ri(e,t){let n=0;for(const i of t)i.id===e.id||Ed(e,i)||cs(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function Sd(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++)cs(n[i],[n[r]])>0&&(t+=n[i].type===n[r].type?2:1);return t}function Vu(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(cs(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 Rd(e){var n;const t=(n=ht(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const r=ht(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 Cd=e=>e?{members:e}:{},Ci=e=>e.shapes.filter(t=>!t.container);function Hw(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 Pd(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(hn(i).some(r=>Si(n,r)))return i.id;for(const i of[...t.shapes].filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(Wo(i).some(r=>Si(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 qi(e){const t=[],n=e.shapes.filter(p=>!p.container);for(const p of e.edges)for(const f of zn(p,n))t.push({kind:"edge-crosses-shape",edge:p.id,shape:f.id});const i=n.filter(p=>!p.attached);for(let p=0;p<i.length;p++)for(let f=p+1;f<i.length;f++){const d=i[p],h=i[f];if(!zu(d,h,Mw))continue;const m=d.id<h.id?[d.id,h.id]:[h.id,d.id];t.push({kind:"shape-overlap",shapes:m,identical:jw(d,h)})}const r=e.shapes.filter(p=>p.type==="bpmn:Group"&&Array.isArray(p.members)&&p.members.length>0);for(let p=0;p<r.length;p++)for(let f=p+1;f<r.length;f++){const d=r[p],h=r[f],m=Math.min(d.x+d.width,h.x+h.width)-Math.max(d.x,h.x),g=Math.min(d.y+d.height,h.y+h.height)-Math.max(d.y,h.y);if(m<=gd||g<=gd)continue;const R=new Set(h.members);d.members.some(w=>R.has(w))||t.push({kind:"group-overlap-unintended",groups:d.id<h.id?[d.id,h.id]:[h.id,d.id]})}const o=e.shapes.filter(p=>p.container&&p.type!=="bpmn:Group"&&p.type!=="bpmn:Lane");for(const p of e.shapes.filter(f=>f.type==="bpmn:Group"))for(const f of o){const d=p.x<f.x+f.width&&f.x<p.x+p.width,h=p.y<f.y+f.height&&f.y<p.y+p.height,m=[["top",p.y,f.y,d],["bottom",p.y+p.height,f.y+f.height,d],["left",p.x,f.x,h],["right",p.x+p.width,f.x+f.width,h]];for(const[g,R,w,b]of m)b&&Math.abs(R-w)<=Dw&&t.push({kind:"group-on-container-boundary",group:p.id,container:f.id,side:g})}for(let p=0;p<e.edges.length;p++)for(let f=p+1;f<e.edges.length;f++){const d=e.edges[p],h=e.edges[f],m=os(d,h);if(!m)continue;const g=d.id<h.id?[d.id,h.id]:[h.id,d.id];t.push({kind:m.kind==="opposite"?"edge-overlap-opposite":"edge-overlap-mixed",edges:g,axis:m.axis,length:Math.round(m.length)})}for(const p of e.edges){if(!p.label)continue;const f=ss(p,e.edges);f&&t.push({kind:"label-on-shared-segment",edge:p.id,other:f.other,axis:f.axis})}for(const p of e.edges){if(!p.label)continue;const f=wd(p,e);f&&t.push({kind:"label-over-line",edge:p.id,line:f})}const a=new Set(n.map(p=>p.id)),s=e.shapes.filter(p=>p.type==="bpmn:Participant"&&p.label);for(const p of[...n,...s.filter(f=>!a.has(f.id))]){if(!p.label)continue;const f=Pd(p,e);f&&t.push({kind:"label-over-line",edge:p.id,line:f})}const c=new Set(e.shapes.filter(p=>p.type==="bpmn:TextAnnotation").map(p=>p.id));for(const p of s)for(const{owner:f,rect:d}of Uo(e))f===p.id||c.has(f)||zu(p.label,d,ro)&&t.push({kind:"pool-name-over-label",pool:p.id,label:f});const u=Uo(e);for(const p of n)if(p.type==="bpmn:TextAnnotation")for(const{owner:f,rect:d}of u)f!==p.id&&zu(p,d,ro)&&t.push({kind:"annotation-over-label",annotation:p.id,label:f});const l=new Map(e.shapes.map(p=>[p.id,p]));for(const p of n){const f=p.parent??Hw(p,e,l);if(!f)continue;const d=l.get(f);!d||!d.container||Bw(d,p,Nw)||t.push({kind:"shape-outside-container",shape:p.id,container:d.id})}return t.sort((p,f)=>Yi(p).localeCompare(Yi(f)))}const ht=e=>typeof e=="object"&&e!==null?e:void 0,xt=e=>typeof e=="number"?e:0,Mr=e=>{const t=ht(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function zw(e){const t=ht(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=Mr(o);a&&n.push(a)}}return n}function Vw(e,t){const n=ht(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const r=Mr(n);return r?t.get(r):void 0}if(rs.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return Mr(n)}function Ad(e){var a,s,c,u,l;const t=[],n=[],i=((a=ht(e))==null?void 0:a.diagrams)??[],r=new Map,o=new Set;for(const p of((s=ht(e))==null?void 0:s.rootElements)??[]){const f=ht(p);if((f==null?void 0:f.$type)==="bpmn:Collaboration")for(const d of f.participants??[]){const h=ht(d),m=Mr(h),g=Mr(h==null?void 0:h.processRef);m&&g?r.set(g,m):m&&o.add(m)}}for(const p of i){const f=ht((c=ht(p))==null?void 0:c.plane),d=(f==null?void 0:f.planeElement)??[];for(const h of d){const m=ht(h);if(!m)continue;const g=ht(m.bpmnElement),R=typeof(g==null?void 0:g.id)=="string"?g.id:void 0;if(!R)continue;const w=typeof(g==null?void 0:g.$type)=="string"?g.$type:"",b=ht(m.bounds);if(b){const E=m.isExpanded===!1&&w!=="bpmn:Participant",T=ht((u=ht(m.label))==null?void 0:u.bounds),L={id:R,type:w,x:xt(b.x),y:xt(b.y),width:xt(b.width),height:xt(b.height),container:rs.has(w)&&!E,attached:(g==null?void 0:g.attachedToRef)!==void 0,...g?{parent:Vw(g,r)}:{},...T?{label:{x:xt(T.x),y:xt(T.y),width:xt(T.width),height:xt(T.height)}}:{},...w==="bpmn:Group"?Cd(Rd(g)):{}},A=m.isHorizontal!==!1,j=typeof(g==null?void 0:g.name)=="string"?g.name:"";o.has(R)&&A&&j&&(L.label=Fu(L,j)),t.push(L);continue}const x=m.waypoint;if(Array.isArray(x)){const E=ht((l=ht(m.label))==null?void 0:l.bounds);n.push({id:R,type:w,waypoints:x.map(T=>{var L,A;return{x:xt((L=ht(T))==null?void 0:L.x),y:xt((A=ht(T))==null?void 0:A.y)}}),endpoints:zw(g),...E?{label:{x:xt(E.x),y:xt(E.y),width:xt(E.width),height:xt(E.height)}}:{}})}}}return{shapes:t,edges:n}}function Td(e){return qi(Ad(e))}async function Gw(e){const{definitions:t,warnings:n}=await $u(e);return{findings:Td(t),warnings:n}}function Ut(e){var i;const t=[],n=[];for(const r of e.getAll()){const o=r;if(o.type==="label"||o.labelTarget)continue;const a=typeof o.type=="string"?o.type:"";if(a==="bpmn:Definitions"||a.startsWith("bpmndi:"))continue;const s=o.waypoints;if(s){const m=ht(o.label);n.push({id:o.id,type:a,waypoints:s.map(g=>({x:xt(g.x),y:xt(g.y)})),endpoints:[Mr(o.source),Mr(o.target)].filter(g=>!!g),...m&&typeof m.x=="number"?{label:{x:m.x,y:xt(m.y),width:xt(m.width),height:xt(m.height)}}:{}});continue}if(typeof o.x!="number"||typeof o.y!="number")continue;const c=ht(o.businessObject),u=ht(o.label);let l=ht(o.parent);for(;l&&l.type==="bpmn:Lane";)l=ht(l.parent);const p=typeof(l==null?void 0:l.type)=="string"?l.type:"",f=l&&rs.has(p)&&p!=="bpmn:Group"&&typeof l.id=="string"?l.id:void 0,d={id:o.id,type:a,x:o.x,y:o.y,width:xt(o.width),height:xt(o.height),container:rs.has(a)&&(a==="bpmn:Participant"||o.collapsed!==!0),attached:(c==null?void 0:c.attachedToRef)!==void 0,...f!==void 0?{parent:f}:{},...u&&typeof u.x=="number"?{label:{x:u.x,y:xt(u.y),width:xt(u.width),height:xt(u.height)}}:{},...a==="bpmn:Group"?Cd(Rd(c)):{}},h=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&h&&((i=ht(o.di))==null?void 0:i.isHorizontal)!==!1&&(d.label=Fu(d,h)),t.push(d)}return{shapes:t,edges:n}}const Ww={"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 Uw(e,t){const n=Ww[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function Md(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function kd(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 Uw(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&Md(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?Md(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 Dd=20,Yw=4,Pt=(e,t)=>Math.abs(e-t)<.5;function Od(e,t,n,i=Dd){if(Pt(e.y,t.y)&&!Pt(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(Pt(e.x,t.x)&&!Pt(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 Ld(e,t,n=Dd){if(e.length!==4)return null;const[i,r,o,a]=e;if(Pt(i.y,r.y)&&Pt(r.x,o.x)&&Pt(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(Pt(i.x,r.x)&&Pt(r.y,o.y)&&Pt(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 Gu(e,t){if(e.endpoints.length!==2)return[];const n=t.find(p=>p.id===e.endpoints[0]),i=t.find(p=>p.id===e.endpoints[1]);if(!n||!i)return[];if(i.x<=n.x+n.width)return[];const r=n.y+n.height/2,o=i.y+i.height/2;if(r>=i.y&&r<=i.y+i.height)return[];const a=i.x+i.width/2,s=n.x+n.width/2,c=r>o,u=[{x:n.x+n.width,y:r},{x:a,y:r},{x:a,y:c?i.y+i.height:i.y}],l=[{x:s,y:c?n.y:n.y+n.height},{x:s,y:o},{x:i.x,y:o}];return[u,l]}const Id=30,qw=[0,-25,25,-40,40];function Kw(e,t){if(e.type!=="bpmn:MessageFlow"||e.endpoints.length!==2)return[];const n=t.find(f=>f.id===e.endpoints[0]),i=t.find(f=>f.id===e.endpoints[1]);if(!n||!i)return[];const r=n.y+n.height/2,o=i.y+i.height/2;if(i.y<n.y+n.height&&i.y+i.height>n.y)return[];const a=o<r,s=a?n.y+n.height:n.y,c=a?s+Id:s-Id,u=a?i.y+i.height:i.y,l=n.x+n.width/2,p=i.x+i.width/2;return qw.map(f=>[{x:l,y:s},{x:l,y:c},{x:p+f,y:c},{x:p+f,y:u}])}const Xw=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],us=(e,t,n)=>zn({...e,waypoints:t},n).length;function Nd(e,t,n,i){let r=[...e.waypoints],o=us(e,r,t);if(o===0)return null;let a=!1;for(const p of Gu(e,t))if(us(e,p,t)===0)return p;const s=(i??[]).filter(p=>p.id!==e.id).flatMap(hn),c=p=>hn({...e,waypoints:p}).some(f=>as(f,s).length>0),u=Kw(e,t).filter(p=>us(e,p,t)===0);if(u.length)return u.find(p=>!c(p))??u[0];const l=p=>!n||p.every(f=>f.x>=n.x&&f.x<=n.x+n.width&&f.y>=n.y&&f.y<=n.y+n.height);for(let p=0;p<Yw&&o>0;p++){let f=!1;for(let d=0;d+1<r.length&&!f;d++){const h=r[d],m=r[d+1];for(const g of t){if(e.endpoints.includes(g.id)||zn({...e,waypoints:[h,m]},[g]).length===0)continue;const R=Od(h,m,g),w=R?R.map(x=>Xw(r,d,x)):Ld(r,g)??[];if(!w.length)continue;const b=[...w].sort((x,E)=>Number(l(E))-Number(l(x)));for(const x of b){const E=us(e,x,t);if(E<o){r=x,o=E,f=!0,a=!0;break}}if(f)break}}if(!f)break}return a&&o===0?r:null}function Bd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Ut(n),o=Ci(r),a=qi(r).filter(c=>c.kind==="edge-crosses-shape"&&!t.has(Yi(c)));if(!a.length)return;const s=new Map;for(const c of a){if(c.kind!=="edge-crosses-shape"||s.has(c.edge))continue;const u=r.edges.find(l=>l.id===c.edge);u&&s.set(c.edge,u)}for(const[c,u]of s){const l=n.get(c);if(!l)continue;const p=l.parent,f=p&&typeof p.x=="number"&&typeof p.width=="number"?{x:p.x,y:p.y,width:p.width,height:p.height}:void 0,d=Nd(u,o,f,r.edges);d&&i.updateWaypoints(l,d)}}const Zw=10;function $d(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 jd(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(G=>G.type==="bpmn:Participant"&&G.container),i=t.shapes.find(G=>G.id===e.endpoints[0]),r=t.shapes.find(G=>G.id===e.endpoints[1]);if(!i||!r)return null;const o=$d(i,n),a=$d(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(G=>G.id!==o.id&&G.id!==a.id&&G.y>=c.y+c.height&&G.y+G.height<=u.y).sort((G,fe)=>G.y-fe.y);if(!l.length)return null;const p=l[0],f=l[l.length-1],d=(c.y+c.height+p.y)/2,h=(f.y+f.height+u.y)/2,m=s?d:h,g=s?h:d,R=e.waypoints[0],w=e.waypoints[e.waypoints.length-1],b=Ci(t),x=t.edges.filter(G=>G.id!==e.id),E=Ri(e,x),T=zn(e,b).length;if(E===0&&T===0)return null;const L=Math.min(...l.map(G=>G.x)),A=Math.max(...l.map(G=>G.x+G.width)),j=(R.x+w.x)/2,H=G=>G.filter((fe,Fe)=>Fe===0||!(Pt(fe.x,G[Fe-1].x)&&Pt(fe.y,G[Fe-1].y)));let N;for(let G=L;G<=A;G+=Zw){const fe=H([R,{x:R.x,y:m},{x:G,y:m},{x:G,y:g},{x:w.x,y:g},w]),Fe={...e,waypoints:fe};if(zn(Fe,b).length>0)continue;const lt=Ri(Fe,x),Y=Math.abs(G-j);(!N||lt<N.cross||lt===N.cross&&Y<N.detour)&&(N={pts:fe,cross:lt,detour:Y})}return N&&(T>0?N.cross<=E:N.cross<E)?N.pts:null}function Fd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Ut(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=Ut(n),s=a.edges.find(l=>l.id===o.id);if(!s)continue;const c=jd(s,a);if(!c)continue;const u=n.get(o.id);u&&i.updateWaypoints(u,c)}}const oo=[25,-25,40,-40],ls=35;function Hd(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];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-ls:n.y+n.height+ls,p=[];for(const w of[0,...oo]){if(Math.abs(w)>=i.width/2-5)continue;const b=o+w;p.push({pts:[{x:n.x,y:r},{x:b,y:r},{x:b,y:c}],cost:Math.abs(w)});for(const x of[0,...oo]){if(Math.abs(x)>=n.width/2-5)continue;const E=a+x;p.push({pts:[{x:E,y:u},{x:E,y:l},{x:b,y:l},{x:b,y:c}],cost:Math.abs(w)+Math.abs(x)})}}const f=50,d=i.y+i.height/2,h=s?n.y+n.height:n.y;for(const w of[0,...oo]){if(Math.abs(w)>=n.width/2-5)continue;const b=a+w;p.push({pts:[{x:b,y:h},{x:b,y:d},{x:i.x+i.width,y:d}],cost:f+Math.abs(w)})}const m=60,g=s?i.y+i.height:i.y,R=s?i.y+i.height+ls:i.y-ls;for(const w of[0,...oo]){if(Math.abs(w)>=i.width/2-5)continue;const b=o+w;for(const x of[0,...oo]){if(Math.abs(x)>=n.width/2-5)continue;const E=a+x;p.push({pts:[{x:E,y:h},{x:E,y:R},{x:b,y:R},{x:b,y:g}],cost:m+Math.abs(w)+Math.abs(x)})}}return p}const ps=30;function zd(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],r=e[n+1],o=Pt(i.y,r.y)&&!Pt(i.x,r.x),a=Pt(i.x,r.x)&&!Pt(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)<ps||Math.abs(i.y-(s.y+s.height))<ps)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)<ps||Math.abs(i.x-(s.x+s.width))<ps)return!0}}return!1}const fs=40;function Qw(e,t,n){let i=0;for(const r of t){if(r.container||n.includes(r.id))continue;const o=r.x-fs,a=r.x+r.width+fs,s=r.y-fs,c=r.y+r.height+fs;for(let u=1;u<e.length-2;u++){const l=e[u],p=e[u+1],f={x:Math.min(l.x,p.x),y:Math.min(l.y,p.y)},d={x:Math.max(l.x,p.x),y:Math.max(l.y,p.y)};if(f.x<a&&d.x>o&&f.y<c&&d.y>s){i++;break}}}return i}function Vd(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(w=>w.container),i=new Map(t.shapes.map(w=>[w.id,w])),r=Ci(t),o=t.edges.filter(w=>w.id!==e.id),a=Tr(e,o),s=Ri(e,o),c=w=>Qw(w,t.shapes,e.endpoints)+(zd(w,n)?1:0),u=c(e.waypoints),l=w=>{if(!w)return;const b=w.x+w.width/2,x=w.y+w.height/2;return n.find(E=>E.type==="bpmn:Lane"&&b>=E.x&&b<=E.x+E.width&&x>=E.y&&x<=E.y+E.height)},p=l(i.get(e.endpoints[0]??"")),f=l(i.get(e.endpoints[1]??"")),d=!!p&&!!f&&p.id!==f.id,h=w=>{if(!d||!f)return!1;for(let b=1;b<w.length-2;b++){const x=w[b],E=w[b+1];if(Pt(x.y,E.y)&&!Pt(x.x,E.x)&&x.y>f.y&&x.y<f.y+f.height)return!0}return!1},m=h(e.waypoints);if(!zd(e.waypoints,n)&&!(d&&!m))return null;const g=w=>w.reduce((b,x,E)=>E?b+Math.abs(x.x-w[E-1].x)+Math.abs(x.y-w[E-1].y):0,0);let R;for(const{pts:w,cost:b}of Hd(e,i)){const x={...e,waypoints:w};if(zn(x,r).length>0||Tr(x,o)>a||Ri(x,o)>s)continue;const E=c(w),T=h(w);if(!(T&&!m)&&E>=u)continue;const A=T?0:1,j=g(w);(!R||A<R.lane||A===R.lane&&(E<R.sc||E===R.sc&&(b<R.cost||b===R.cost&&j<R.len)))&&(R={pts:w,sc:E,lane:A,cost:b,len:j})}return(R==null?void 0:R.pts)??null}function Jw(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Ut(n).edges.filter(o=>!t.has(o.id)&&o.waypoints.length>=4).map(o=>o.id).sort();for(const o of r){const a=Ut(n),s=a.edges.find(d=>d.id===o);if(!s||s.waypoints.length<4)continue;const c=Ci(a),u=a.edges.filter(d=>d.id!==o),l=zn(s,c).length,p=Tr(s,u),f=Ri(s,u);for(const d of Gu(s,a.shapes)){if(d.length>=s.waypoints.length)continue;const h={...s,waypoints:d};if(zn(h,c).length>l||Tr(h,u)>p||Ri(h,u)>f)continue;const m=n.get(o);m&&i.updateWaypoints(m,d);break}}}function Gd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Ut(n).edges.filter(o=>o.type==="bpmn:SequenceFlow"&&!t.has(o.id)).map(o=>o.id).sort();for(const o of r){const a=Ut(n),s=a.edges.find(l=>l.id===o);if(!s)continue;const c=Vd(s,a);if(!c)continue;const u=n.get(o);u&&i.updateWaypoints(u,c)}}function eE(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=Pt(n[0].x,n[1].x)&&!Pt(n[0].y,n[1].y),s=Pt(n[n.length-1].x,n[n.length-2].x)&&!Pt(n[n.length-1].y,n[n.length-2].y);for(const c of oo){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 Wd(e,t){const n=new Map(t.shapes.map(l=>[l.id,l])),i=Ci(t),r=t.edges.filter(l=>l.id!==e.id),o=Tr(e,r);if(o===0)return null;const a=Ri(e,r);let s;const c=l=>l.reduce((p,f,d)=>d?p+Math.abs(f.x-l[d-1].x)+Math.abs(f.y-l[d-1].y):0,0),u=[...Hd(e,n),...eE(e,n)];for(const{pts:l,cost:p}of u){const f={...e,waypoints:l};if(zn(f,i).length>0)continue;const d=Tr(f,r),h=Ri(f,r);if(d>=o||h-a>o-d)continue;const m=c(l);(!s||d<s.opposite||d===s.opposite&&(h<s.cross||h===s.cross&&(p<s.cost||p===s.cost&&m<s.len)))&&(s={pts:l,opposite:d,cross:h,cost:p,len:m})}return(s==null?void 0:s.pts)??null}function Ud(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Ut(i),a=qi(o).filter(l=>(l.kind==="edge-overlap-opposite"||l.kind==="edge-overlap-mixed")&&!t.has(Yi(l)));if(!a.length)return;const s=new Set;for(const l of a)if(!(l.kind!=="edge-overlap-opposite"&&l.kind!=="edge-overlap-mixed"))for(const p of l.edges)n.has(p)||s.add(p);const c=l=>{var p;return((p=o.edges.find(f=>f.id===l))==null?void 0:p.type)??""},u=[...s].sort((l,p)=>{const f=c(l)==="bpmn:SequenceFlow"?0:1,d=c(p)==="bpmn:SequenceFlow"?0:1;return f!==d?f-d:l.localeCompare(p)});for(const l of u){const p=Ut(i),f=p.edges.find(m=>m.id===l);if(!f)continue;const d=Wd(f,p);if(!d)continue;const h=i.get(l);h&&r.updateWaypoints(h,d)}}const tE=10,nE=(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 Yd(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!ss(e,i))return null;const r=Ci(t),o=i.flatMap(hn);for(const a of hn(e)){let s=[[a.lo,a.hi]];for(const[d,h]of as(a,o))s=s.flatMap(([m,g])=>{const R=[];return d>m&&R.push([m,Math.min(g,d)]),h<g&&R.push([Math.max(m,h),g]),R.filter(([w,b])=>b>w)});const c=a.axis==="h"?n.width:n.height,u=s.find(([d,h])=>h-d>=c+tE*2);if(!u)continue;const l=(u[0]+u[1])/2,p=a.axis==="h"?{x:l,y:a.at-bd}:{x:a.at+Rn+n.width/2,y:l},f={x:p.x-n.width/2,y:p.y-n.height/2,width:n.width,height:n.height};if(!ss({...e,label:f},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&nE(f,d)))return f}return null}const Rn=8;function qd(e,t){const n=e.label;if(!n)return null;const i=hn(e);if(!i.length)return null;const r=n.x+n.width/2,o=n.y+n.height/2,a=f=>{const d=f.axis==="h"?r:o,h=f.axis==="h"?o-f.at:r-f.at,m=d<f.lo?f.lo-d:d>f.hi?d-f.hi:0;return Math.hypot(h,m)},s=i.reduce((f,d)=>a(d)<a(f)?d:f,i[0]),c=[...i,...t.edges.filter(f=>f.id!==e.id).flatMap(hn),...t.shapes.filter(f=>f.container).flatMap(Wo)],u=f=>!c.some(d=>Si(f,d));if(u(n))return null;const l=(s.axis==="v"?n.height:n.width)+Rn,p=[0,-l,l,-2*l,2*l];if(s.axis==="v")for(const f of[s.at+Rn,s.at-Rn-n.width])for(const d of p){const h=n.y+d;if(h<s.lo||h+n.height>s.hi)continue;const m={...n,x:f,y:h};if(u(m))return m}else for(const f of[s.at-Rn-n.height,s.at+Rn])for(const d of p){const h=n.x+d;if(h<s.lo||h+n.width>s.hi)continue;const m={...n,x:h,y:f};if(u(m))return m}return null}function Kd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Ut(n);for(const o of r.edges){if(!o.label||t.has(o.id))continue;const a=qd(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 Xd(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Ut(i),a=qi(o).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(Yi(s)));for(const s of a){if(s.kind!=="label-on-shared-segment"||n.has(s.edge))continue;const c=o.edges.find(f=>f.id===s.edge);if(!c)continue;const u=Yd(c,o);if(!u)continue;const l=i.get(s.edge),p=l==null?void 0:l.label;p&&r.moveElements([p],{x:u.x-p.x,y:u.y-p.y})}}function Zd(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(hn),...t.shapes.filter(f=>f.container).flatMap(Wo)],r=i.filter(f=>Si(n,f));if(!r.length)return null;const o=t.shapes.filter(f=>!f.container&&f.id!==e.id),a=Uo(t).filter(f=>f.owner!==e.id).map(f=>f.rect),s=(f,d)=>f.x<d.x+d.width&&d.x<f.x+f.width&&f.y<d.y+d.height&&d.y<f.y+f.height,c=f=>!i.some(d=>Si(f,d))&&!o.some(d=>s(f,d))&&!a.some(d=>s(f,d)),u=[];for(const f of r)f.axis==="h"?u.push({...n,y:f.at-Rn-n.height},{...n,y:f.at+Rn}):u.push({...n,x:f.at-Rn-n.width},{...n,x:f.at+Rn});const l=e.x+e.width/2,p=e.y+e.height/2;return u.push({...n,x:l-n.width/2,y:e.y+e.height+Rn},{...n,x:l-n.width/2,y:e.y-Rn-n.height},{...n,x:e.x+e.width+Rn,y:p-n.height/2},{...n,x:e.x-Rn-n.width,y:p-n.height/2}),u.find(c)??null}function Qd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Ut(n);for(const o of r.shapes){if(o.container||!o.label||t.has(o.id))continue;const a=Zd(o,Ut(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 iE=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,Jd=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),eh={"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}]},ds=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Wu=e=>typeof e=="string"&&e!=="";function rE(e){const t=[];function n(i,r,o,a){if(a===null){Wu(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!ds(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)Wu(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{if(!ds(i)||!Wu(i.kind)||!(i.kind in eh)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const o of eh[i.kind]){const a=o.path.endsWith("[]"),s=a?o.path.slice(0,-2):o.path,c=s.split(".");let u=i;for(const p of c.slice(0,-1)){if(!ds(u))break;u=u[p]}if(!ds(u))continue;const l=u[c[c.length-1]];if(!(l===void 0&&o.optional)&&!(l===null&&o.optional)){if(!a){n(r,o.path,l,o.shape);continue}if(!Array.isArray(l)){t.push({kind:"payload-invalid",opIndex:r,field:o.path});continue}l.forEach((p,f)=>n(r,`${s}[${f}]`,p,o.shape))}}if(i.kind==="node.add"){const o=i.band;o!==void 0&&(!Number.isInteger(o)||o<0)&&t.push({kind:"payload-invalid",opIndex:r,field:"band"})}}),t}function th(e,t){const n=rE(e);if(n.length>0)return n;const i=[],r=new Map,o=new Map;function a(f,d,h){if(!iE.test(d)){i.push({kind:"id-invalid",opIndex:f,id:d});return}if(t.categoryOf(d)!==void 0||r.has(d)){i.push({kind:"id-duplicate",opIndex:f,id:d});return}r.set(d,{...h,opIndex:f})}e.forEach((f,d)=>{var h;switch(f.kind){case"participant.add":a(d,f.participant.id,{category:"participant",lanes:(f.participant.lanes??[]).map(m=>m.id)});for(const m of f.participant.lanes??[])a(d,m.id,{category:"lane"});break;case"node.add":a(d,f.node.id,{category:"flowNode",participant:f.node.participant});break;case"sequenceFlow.add":a(d,f.flow.id,{category:"sequenceFlow"});break;case"messageFlow.add":a(d,f.flow.id,{category:"messageFlow"});break;case"dataStore.add":a(d,f.dataStore.id,{category:"dataStore"});for(const m of f.associations??[])m.id&&a(d,m.id,{category:"dataAssociation"});break;case"dataAssociation.add":f.association.id&&a(d,f.association.id,{category:"dataAssociation"});break;case"association.add":f.association.id&&a(d,f.association.id,{category:"association"});break;case"annotation.add":a(d,f.annotation.id,{category:"annotation"}),(h=f.association)!=null&&h.id&&a(d,f.association.id,{category:"association"});break;case"group.add":a(d,f.group.id,{category:"group"});break;case"participant.update":if(f.lanes){o.set(f.id,f.lanes.map(m=>m.id));for(const m of f.lanes)t.categoryOf(m.id)===void 0&&a(d,m.id,{category:"lane"})}break}});const s=f=>{var d;return((d=r.get(f))==null?void 0:d.category)??t.categoryOf(f)},c=f=>{const d=r.get(f);return d?d.category==="participant"?f:d.participant:t.categoryOf(f)==="participant"?f:t.participantOf(f)};function u(f,d,h,m){const g=s(d);if(g===void 0){i.push({kind:"ref-missing",opIndex:f,ref:d,role:h});return}if(m&&!m.includes(g)){i.push({kind:"ref-category",opIndex:f,ref:d,role:h,expected:m.join("|"),actual:g});return}return g}const l=t.isCollaboration()||e.some(f=>f.kind==="participant.add");return e.forEach((f,d)=>{var h;switch(f.kind){case"participant.add":break;case"node.add":{const{participant:m,lane:g}=f.node;if(m===void 0){(l||g!==void 0)&&i.push({kind:"participant-required",opIndex:d,id:f.node.id});break}if(u(d,m,"participant",["participant"])===void 0)break;g!==void 0&&((((h=r.get(m))==null?void 0:h.lanes)??o.get(m)??t.lanesOf(m)).includes(g)||i.push({kind:"lane-unknown",opIndex:d,lane:g,participant:m}));break}case"sequenceFlow.add":{const{id:m,source:g,target:R,name:w,condition:b}=f.flow,x=u(d,g,"source",["flowNode"]),E=u(d,R,"target",["flowNode"]);x&&E&&c(g)!==c(R)&&i.push({kind:"flow-cross-pool",opIndex:d,id:m}),w!==void 0&&b!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:m});break}case"messageFlow.add":{const{id:m,source:g,target:R}=f.flow,w=u(d,g,"source",["flowNode","participant"]),b=u(d,R,"target",["flowNode","participant"]);if(w&&b){const x=c(g),E=c(R);x!==void 0&&x===E&&i.push({kind:"message-flow-same-pool",opIndex:d,id:m})}break}case"dataStore.add":{for(const m of f.associations??[]){if([m.source,m.target].filter(w=>w===f.dataStore.id).length!==1){i.push({kind:"data-association-ends",opIndex:d,source:m.source,target:m.target});continue}const R=m.source===f.dataStore.id?m.target:m.source;u(d,R,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:m,target:g}=f.association,R=u(d,m,"source"),w=u(d,g,"target");if(R&&w){const b=new Set([R,w]);b.has("dataStore")&&b.has("flowNode")||i.push({kind:"data-association-ends",opIndex:d,source:m,target:g})}break}case"association.add":{const{id:m,source:g,target:R}=f.association,w=u(d,g,"source"),b=u(d,R,"target");w&&b&&w!=="annotation"&&b!=="annotation"&&i.push({kind:"association-detached",opIndex:d,annotation:m??`${g}->${R}`});break}case"annotation.add":{if(f.association){const{source:m,target:g}=f.association;if(m!==f.annotation.id&&g!==f.annotation.id)i.push({kind:"association-detached",opIndex:d,annotation:f.annotation.id});else{const R=m===f.annotation.id?g:m;u(d,R,"association")}}f.placement&&u(d,f.placement.anchor,"anchor");break}case"group.add":{for(const m of f.group.members??[]){const g=u(d,m,"member");g&&Jd.has(g)&&i.push({kind:"ref-category",opIndex:d,ref:m,role:"member",expected:"shape",actual:g})}break}case"participant.update":{if(p(d,f.id,"participant")===void 0)break;if(f.lanes){const m=t.lanesOf(f.id),g=f.lanes.map(w=>w.id);for(const w of m)g.includes(w)||i.push({kind:"lane-shrink-unsupported",opIndex:d,participant:f.id,lane:w});for(const w of g)t.categoryOf(w)!==void 0&&!m.includes(w)&&i.push({kind:"id-duplicate",opIndex:d,id:w});const R=g.filter(w=>m.includes(w));R.length===m.length&&R.some((w,b)=>w!==m[b])&&i.push({kind:"lane-reorder-unsupported",opIndex:d,participant:f.id})}break}case"node.update":{if(p(d,f.id,"flowNode")===void 0)break;if(f.lane!==void 0){const m=t.participantOf(f.id);(m?o.get(m)??t.lanesOf(m):[]).includes(f.lane)||i.push({kind:"lane-unknown",opIndex:d,lane:f.lane,participant:m??""})}break}case"sequenceFlow.update":{if(p(d,f.id,"sequenceFlow")===void 0)break;if(f.name!==void 0&&f.condition!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:f.id}),f.source!==void 0||f.target!==void 0){const m=f.source===void 0||u(d,f.source,"source",["flowNode"])!==void 0,g=f.target===void 0||u(d,f.target,"target",["flowNode"])!==void 0,R=t.endpointsOf(f.id),w=f.source??(R==null?void 0:R.source),b=f.target??(R==null?void 0:R.target);m&&g&&w!==void 0&&b!==void 0&&new Set([c(w),c(b),c(f.id)]).size>1&&i.push({kind:"flow-cross-pool",opIndex:d,id:f.id})}break}case"messageFlow.update":p(d,f.id,"messageFlow");break;case"dataStore.update":p(d,f.id,"dataStore");break;case"annotation.update":{if(p(d,f.id,"annotation")===void 0)break;f.placement&&u(d,f.placement.anchor,"anchor");break}case"group.update":{if(p(d,f.id,"group")===void 0)break;for(const m of f.members??[]){const g=u(d,m,"member");g&&Jd.has(g)&&i.push({kind:"ref-category",opIndex:d,ref:m,role:"member",expected:"shape",actual:g})}break}case"element.remove":{p(d,f.id)==="lane"&&i.push({kind:"ref-category",opIndex:d,ref:f.id,role:"target",expected:"removable",actual:"lane"});break}}}),i;function p(f,d,h){if(r.has(d)){i.push({kind:"target-added-in-batch",opIndex:f,id:d});return}const m=t.categoryOf(d);if(m===void 0){i.push({kind:"ref-missing",opIndex:f,ref:d,role:"target"});return}if(h&&m!==h){i.push({kind:"ref-category",opIndex:f,ref:d,role:"target",expected:h,actual:m});return}return m}}function nh(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 hs(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const Uu={"top-left":[-1,-1],top:[0,-1],"top-right":[1,-1],right:[1,0],"bottom-right":[1,1],bottom:[0,1],"bottom-left":[-1,1],left:[-1,0]};function Xt(e,t){return e.filter(n=>n.kind===t)}function ih(e,t){var wx,Ex,Sx,Rx,Cx,Px;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:s,bpmnReplace:c}=t,u=()=>a.getRootElement(),l=S=>o.get(S),p=S=>{const P=l(S);if(!P)throw new Error(`하강 참조 해소 실패: ${S}`);return P},f=S=>{let P=S.parent;for(;P;){if(P.type==="bpmn:Participant")return P;P=P.parent}},d=Xt(e,"participant.add"),h=Xt(e,"node.add"),m=Xt(e,"sequenceFlow.add"),g=Xt(e,"messageFlow.add"),R=Xt(e,"dataStore.add"),w=Xt(e,"dataAssociation.add"),b=Xt(e,"annotation.add"),x=Xt(e,"group.add"),E=new Map(h.map(S=>[S.node.id,S])),T=(S,P,k)=>{var pe;const z=S.businessObject,V=(((pe=z.extensionElements)==null?void 0:pe.values)??[]).filter(J=>J.$type!==P),B=k?[...V,i.create(P,k)]:V;if(!B.length){z.extensionElements&&n.updateProperties(S,{extensionElements:void 0});return}const K=i.create("bpmn:ExtensionElements",{values:B});B.forEach(J=>{J.$parent=K}),n.updateProperties(S,{extensionElements:K})},L=S=>({anchor:S.anchor,side:S.side,...S.offset!==void 0?{offset:S.offset}:{}});for(const S of Xt(e,"element.remove")){const P=l(S.id);P&&n.removeElements([P])}const A=S=>o.filter(P=>{var k;return P.type==="bpmn:Lane"&&((k=f(P))==null?void 0:k.id)===S}).sort((P,k)=>P.y-k.y);for(const S of Xt(e,"participant.update")){const P=p(S.id);if(S.name!==void 0&&n.updateProperties(P,{name:S.name??void 0}),!S.lanes)continue;const k=A(S.id);if(!k.length){n.splitLane(P,S.lanes.length),A(S.id).forEach((V,B)=>{const K=S.lanes[B];K&&n.updateProperties(V,{id:K.id,name:K.name})});continue}const z=new Set(k.map(V=>V.id));S.lanes.forEach((V,B)=>{if(z.has(V.id)){n.updateProperties(p(V.id),{name:V.name});return}const K=B===0?n.addLane(A(S.id)[0],"top"):n.addLane(p(S.lanes[B-1].id),"bottom");n.updateProperties(K,{id:V.id,name:V.name})})}const j=150,H=130,N=80,G=90,fe=180,Fe=new Set;for(const S of d){Fe.add(`pool:${S.participant.id}`);for(const P of S.participant.lanes??[])Fe.add(P.id)}const lt=new Map;for(const S of h){const P=S.node.lane??`pool:${S.node.participant??""}`;let k=lt.get(P);k||lt.set(P,k=new Set([0])),S.band!==void 0&&k.add(S.band)}const Y=new Map;for(const[S,P]of lt){if(!Fe.has(S))continue;const k=[...P].sort((B,K)=>B-K),z=k.map((B,K)=>K===0?0:K%2===1?Math.ceil(K/2):-(K/2)),V=Math.min(...z);Y.set(S,new Map(k.map((B,K)=>[B,z[K]-V])))}{const S=new Map;for(const P of d)(P.participant.lanes??[]).forEach((k,z)=>S.set(k.id,z));for(const[P,k]of Y){if(!S.has(P)||k.size<2)continue;const z=S.get(P),V=k.get(0)??0,B=new Set;for(const Ne of h){if(Ne.node.lane!==P||(Ne.band??0)!==0||!Ne.node.type.endsWith("Gateway"))continue;const Te={in:new Set,out:new Set,cross:new Set};for(const ve of m){const nt=ve.flow.source===Ne.node.id;if(!nt&&ve.flow.target!==Ne.node.id)continue;const Bt=E.get(nt?ve.flow.target:ve.flow.source);if(!Bt||Bt.node.participant!==Ne.node.participant||!Bt.node.lane)continue;let Et,pt=!1;if(Bt.node.lane!==P){const Fn=S.get(Bt.node.lane);if(Fn===void 0)continue;Et=Fn>z?"down":"up",pt=!0}else{const Fn=k.get(Bt.band??0)??V;Et=Fn>V?"down":Fn<V?"up":void 0}Et&&(Te[nt?"out":"in"].add(Et),pt&&Te.cross.add(Et))}for(const ve of["up","down"])Te.in.has(ve)&&Te.out.has(ve)&&Te.cross.has(ve)&&B.add(ve)}if(B.size!==1)continue;const[K]=B,pe=Math.max(...k.values()),J=K==="down"?pe:0;if(V===J)continue;const ue=[...k.entries()].filter(([Ne])=>Ne!==0).sort((Ne,Te)=>Ne[1]-Te[1]),Ye=[...Array(pe+1).keys()].filter(Ne=>Ne!==J),ct=new Map([[0,J]]);ue.forEach(([Ne],Te)=>ct.set(Ne,Ye[Te])),Y.set(P,ct)}}const de=S=>{var P;return(((P=lt.get(S))==null?void 0:P.size)??0)>1},he=S=>S.band??(S.node.lane||!de(`pool:${S.node.participant??""}`)?void 0:0),se=new Map,ce=S=>se.get(S.node.id)??he(S),ee=new Set,F=new Set;{const S=new Map;for(const z of m)S.set(z.flow.target,(S.get(z.flow.target)??0)+1);const P=z=>{const V=[],B=new Set([z]),K=[z];for(;K.length;){const pe=K.shift();V.push(pe);for(const J of m)J.flow.source!==pe||B.has(J.flow.target)||(S.get(J.flow.target)??0)!==1||(B.add(J.flow.target),K.push(J.flow.target))}return V},k=(z,V)=>{var B;return((B=Y.get(z))==null?void 0:B.get(V))??V};for(const z of h){if(!z.node.type.endsWith("Gateway"))continue;const V=z.node.lane??`pool:${z.node.participant??""}`,B=Y.get(V);if(!B||B.size<2)continue;const K=ce(z);if(K===void 0||k(V,K)!==k(V,0))continue;const pe=k(V,K),J=m.filter(ve=>ve.flow.source===z.node.id).map(ve=>E.get(ve.flow.target)).filter(ve=>!!ve&&(ve.node.lane??`pool:${ve.node.participant??""}`)===V),ue=J.filter(ve=>{const nt=ce(ve);return nt!==void 0&&k(V,nt)===pe&&(S.get(ve.node.id)??0)===1}),Ye=J.some(ve=>{const nt=ce(ve);return nt!==void 0&&k(V,nt)>pe});if(ue.length!==1||!Ye)continue;const ct=new Set(J.flatMap(ve=>P(ve.node.id)));if(!m.some(ve=>ve.flow.target===z.node.id&&ct.has(ve.flow.source)))continue;const Te=new Map;for(const[ve,nt]of B)Te.set(ve,nt+1);Te.set(-1,0),Y.set(V,Te);for(const ve of P(ue[0].node.id))E.has(ve)&&(se.set(ve,-1),F.add(ve));ee.add(z.node.id)}}const $=(S,P)=>{var k;return((k=Y.get(S))==null?void 0:k.get(P))??P},U=new Map;for(const[S,P]of lt){let k=0;for(const z of P)k=Math.max(k,$(S,z));U.set(S,k)}const ke=S=>fe+j*S,Lt=d.map((S,P)=>({op:S,declared:P}));Lt.sort((S,P)=>{const k=S.op.order??Number.POSITIVE_INFINITY,z=P.op.order??Number.POSITIVE_INFINITY;return k!==z?k-z:S.declared-P.declared});let C=80;for(const S of o.getAll())S.parent===u()&&"height"in S&&typeof S.y=="number"&&(C=Math.max(C,S.y+S.height+60));for(const{op:S}of Lt){const P=S.participant,k=h.filter(Ne=>Ne.node.participant===P.id).length,z=((wx=P.lanes)==null?void 0:wx.length)??0,V=Math.max(1200,k*160+300),B=(P.lanes??[]).map(Ne=>ke(U.get(Ne.id)??0)),K=B.reduce((Ne,Te)=>Ne+Te,0);z&&K<300&&(B[z-1]+=300-K);const pe=Math.max(300,j*((U.get(`pool:${P.id}`)??0)+1)),J=P.blackBox||k+z===0?120:z?Math.max(300,K):pe,ue=r.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:P.id,name:P.name,...S.order!==void 0?{"bwl:poolOrder":S.order}:{},...P.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:V,height:J,isExpanded:!0}),Ye=n.createShape(ue,{x:100+V/2,y:C+J/2},u()),ct=P.lanes??[];if(ct.length&&n.splitLane(Ye,ct.length),ct.length){const Ne=o.filter(Te=>{var ve;return Te.type==="bpmn:Lane"&&((ve=f(Te))==null?void 0:ve.id)===P.id}).sort((Te,ve)=>Te.y-ve.y);if(Ne.forEach((Te,ve)=>{const nt=ct[ve];nt&&n.updateProperties(Te,{id:nt.id,name:nt.name})}),B.some(Te=>Te!==Ye.height/z)){let Te=Ye.y;Ne.forEach((ve,nt)=>{const Bt=B[nt];n.resizeShape(ve,{x:ve.x,y:Te,width:ve.width,height:Bt}),Te+=Bt})}}C=Ye.y+Ye.height+60}const _=S=>{var z;const P=E.get(S);if(P)return P.node.participant??"";const k=l(S);return k?k.type==="bpmn:Participant"?k.id:((z=f(k))==null?void 0:z.id)??"":""},y=new Map,D=S=>{let P=y.get(S);return P||y.set(S,P={nodes:[],flows:[]}),P};for(const S of h)D(S.node.participant??"").nodes.push(S);for(const S of m)D(_(S.flow.source)).flows.push(S);const I=S=>{var P;return i.create("bpmn:SequenceFlow",{id:S.id,name:S.name??((P=S.condition)==null?void 0:P.label)})},W=(S,P)=>r.createShape({type:hs(S.type),businessObject:i.create(hs(S.type),{id:S.id,name:S.name,...P!==void 0?{"bwl:band":P}:{}})}),oe=[...Lt.map(({op:S})=>S.participant.id).filter(S=>y.has(S)),...[...y.keys()].filter(S=>!d.some(P=>P.participant.id===S))],Pe=S=>S.endsWith("Gateway");for(const S of oe){const P=y.get(S),k=S?p(S):void 0,z=k?k.x+150:250;let V=k?k.y+80:120;const B=(ne,ge,le)=>{const Ze=u().children.filter(qe=>!("waypoints"in qe&&qe.waypoints)&&qe.id!==ge&&typeof qe.y=="number"&&qe.y>=ne);Ze.length&&n.moveElements(Ze,{x:0,y:le})},K=(ne,ge)=>{if(ne){const Ae=p(ne),Ke=ke(ge);if(Ae.height>=Ke)return;const Vt=Ke-Ae.height,ae=f(Ae),We=ae?ae.y+ae.height:Ae.y+Ae.height;n.resizeLane(Ae,{x:Ae.x,y:Ae.y,width:Ae.width,height:Ke},!1),B(We,ae==null?void 0:ae.id,Vt);return}if(!k)return;const le=j*(ge+1);if(k.height>=le)return;const Ze=le-k.height,qe=k.y+k.height;n.resizeShape(k,{x:k.x,y:k.y,width:k.width,height:le}),B(qe,k.id,Ze)},pe=(ne,ge,le)=>{if(ne){const Ze=p(ne);return Ze.y+Math.min(Ze.height/2,G)+$(ne,ge??0)*j}return ge!==void 0&&k?k.y+N+$(`pool:${S}`,ge)*j:le},J=(ne,ge,le)=>{if(ne){const Ze=p(ne);return Ze.y+Math.min(Ze.height/2,G)+ge*j}return k?k.y+N+ge*j:le},ue=ne=>ne.participant?p(ne.participant):u(),Ye=30,ct=(ne,ge,le,Ze)=>{const qe=le-ge.width/2,Ae=Ze-ge.height/2;return(ne.children??[]).find(Ke=>!("waypoints"in Ke&&Ke.waypoints)&&Ke.type!=="bpmn:Lane"&&Ke.type!=="label"&&typeof Ke.x=="number"&&qe<Ke.x+Ke.width+Ye&&qe+ge.width+Ye>Ke.x&&Ae<Ke.y+Ke.height&&Ae+ge.height>Ke.y)},Ne=(ne,ge,le,Ze,qe,Ae)=>{const Ke=le!==void 0||Ze!==void 0,Vt=$(le??`pool:${S}`,Ze??0);if(Ke)for(let Le=0;Le<4;Le++){const Be=J(le,Vt+Le,Ae);if(!ct(ne,ge,qe,Be))return K(le,Vt+Le),{x:qe,y:Be}}const ae=pe(le,Ze,Ae);Ke&&K(le,Vt);let We=qe;for(let Le=0;Le<64;Le++){const Be=ct(ne,ge,We,ae);if(!Be)break;We=Be.x+Be.width+H+ge.width/2}return{x:We,y:ae}},Te=new Set(P.flows.map(ne=>ne.flow.target)),ve=new Map;for(const ne of P.nodes){if(Te.has(ne.node.id))continue;const ge=W(ne.node,ne.band),le=he(ne),Ze=ne.node.lane?`${ne.node.lane}|${le??""}`:le!==void 0?`band:${le}`:"",qe=ue(ne.node),Ae=Ne(qe,ge,ne.node.lane,le,ve.get(Ze)??z,V);n.createShape(ge,Ae,qe),ve.set(Ze,Ae.x+ge.width+H),!ne.node.lane&&le===void 0&&(V+=160)}const nt=new Set,Bt=new Map,Et=new Map,pt=new Map;if(S&&Fe.has(`pool:${S}`)){const ne=new Map;for(const ae of P.flows)ne.set(ae.flow.target,(ne.get(ae.flow.target)??0)+1);const ge=ae=>pe(ae.node.lane,ce(ae),Number.NaN),le=new Set,Ze=ae=>{var Be;const We=(Be=E.get(ae))==null?void 0:Be.node.participant;if(We)return l(We);const Le=l(ae);if(Le)return Le.type==="bpmn:Participant"?Le:f(Le)},qe=ae=>{const We=[],Le=new Set([ae]),Be=[ae];for(;Be.length;){const gt=Be.shift(),Qe=E.get(gt);Qe&&We.push(Qe);for(const Ee of P.flows)Ee.flow.source!==gt||Le.has(Ee.flow.target)||(ne.get(Ee.flow.target)??0)!==1||(Le.add(Ee.flow.target),Be.push(Ee.flow.target))}return We},Ae=ae=>{if(!k)return;const We=new Set(ae.map(gt=>gt.node.id));let Le=!1,Be=!1;for(const gt of g){if(!We.has(gt.flow.source))continue;const Qe=Ze(gt.flow.target);!Qe||Qe.id===k.id||(Qe.y<k.y?Le=!0:Be=!0)}return Le&&!Be?"up":Be&&!Le?"down":void 0};for(const ae of P.nodes){if(!Pe(ae.node.type))continue;const We=pe(ae.node.lane,he(ae),Number.NaN);if(Number.isNaN(We))continue;const Le=[];for(const Ee of P.flows){if(Ee.flow.source!==ae.node.id)continue;const ze=E.get(Ee.flow.target);if(!ze||ze.node.lane!==ae.node.lane||(ne.get(ze.node.id)??0)!==1)continue;const Je=he(ze);if(Je===void 0)continue;const yn=pe(ze.node.lane,Je,Number.NaN);if(Number.isNaN(yn))continue;const qr=qe(ze.node.id),Kt=Ae(qr);Kt&&Le.push({subtree:qr,band:Je,row:yn,dir:Kt})}if(!Le.some(Ee=>Ee.dir==="up")||!Le.some(Ee=>Ee.dir==="down")||!Le.some(Ee=>Ee.dir==="up"&&Le.some(ze=>ze.dir==="down"&&ze.row<Ee.row)))continue;const gt=[...Le].sort((Ee,ze)=>Ee.row-ze.row);[...Le.filter(Ee=>Ee.dir==="up"),...Le.filter(Ee=>Ee.dir==="down")].sort((Ee,ze)=>Ee.dir===ze.dir?Ee.row-ze.row:Ee.dir==="up"?-1:1).forEach((Ee,ze)=>{const Je=gt[ze].band;if(Je!==Ee.band){le.add(ae.node.id);for(const yn of Ee.subtree)he(yn)===Ee.band&&se.set(yn.node.id,Je)}})}const Ke=ae=>{if(!k)return;const We=new Set(ae.map(gt=>gt.node.id));let Le=!1,Be=!1;for(const gt of g){if(!We.has(gt.flow.target))continue;const Qe=Ze(gt.flow.source);!Qe||Qe.id===k.id||(Qe.y<k.y?Le=!0:Be=!0)}return Le&&!Be?"up":Be&&!Le?"down":void 0};for(const ae of P.nodes){if(!Pe(ae.node.type))continue;const We=ae.node.lane??`pool:${S}`,Le=Y.get(We);if(!Le||Le.size<2)continue;const Be=Le.get(0);if(Be===void 0)continue;const gt=Math.max(...Le.values()),Qe=Be===gt&&Be!==0?"down":void 0;if(!Qe)continue;const Ee=[];for(const Kt of P.flows){if(Kt.flow.source!==ae.node.id)continue;const ti=E.get(Kt.flow.target);if(!ti||ti.node.lane!==ae.node.lane||(ne.get(ti.node.id)??0)!==1)continue;const Ax=ce(ti);Ax!==void 0&&Ee.push({t:ti,subtree:qe(ti.node.id),band:Ax})}const ze=Ee.find(Kt=>(Le.get(Kt.band)??Kt.band)===Be);if(!ze||Ke(ze.subtree)===Qe||Ae(ze.subtree)===Qe)continue;const Je=Ee.find(Kt=>Kt!==ze&&Ke(Kt.subtree)===Qe);if(!Je)continue;const yn=ze.band,qr=Je.band;for(const Kt of ze.subtree)ce(Kt)===yn&&se.set(Kt.node.id,qr);for(const Kt of Je.subtree)ce(Kt)===qr&&se.set(Kt.node.id,yn);le.add(ae.node.id)}for(const ae of P.nodes){if(!Pe(ae.node.type))continue;const We=ge(ae);if(Number.isNaN(We)||b.some(Ee=>{var ze,Je;return(((ze=Ee.placement)==null?void 0:ze.anchor)??(Ee.association?Ee.association.source===Ee.annotation.id?Ee.association.target:Ee.association.source:void 0))===ae.node.id&&((Je=Ee.placement)==null?void 0:Je.side.startsWith("bottom"))}))continue;let Be,gt=!1,Qe;for(const Ee of P.flows){if(Ee.flow.source!==ae.node.id)continue;const ze=E.get(Ee.flow.target);if(!ze||!ze.node.lane&&he(ze)===void 0)continue;const Je=ge(ze);Number.isNaN(Je)||(Math.abs(Je-We)<.5&&(gt=!0),Je>We?!Be||Je>Be.row?Be={id:ze.node.id,row:Je,count:1}:Je===Be.row&&Be.count++:Je<We&&ze.node.lane===ae.node.lane&&(!Qe||Je>Qe.row?Qe={op:ze,row:Je,count:1}:Je===Qe.row&&Qe.count++))}Be&&Be.count===1&&(ne.get(Be.id)??0)===1&&!le.has(ae.node.id)&&nt.add(Be.id),!gt&&Qe&&Qe.count===1&&(ne.get(Qe.op.node.id)??0)===1&&!ee.has(ae.node.id)&&Bt.set(Qe.op.node.id,{lane:ae.node.lane,band:ce(ae)})}const Vt=new Map;for(const ae of g)Vt.set(ae.flow.target,[...Vt.get(ae.flow.target)??[],ae]);for(const ae of P.nodes){const We=Vt.get(ae.node.id);if(!We||We.length!==1||!ne.get(ae.node.id)||!ae.node.lane&&he(ae)===void 0||F.has(ae.node.id))continue;const Le=(Ex=E.get(We[0].flow.source))==null?void 0:Ex.node.participant,Be=Le?l(Le):void 0;if(!Be||!k||Be.id===k.id)continue;const gt=ae.node.lane??`pool:${S}`,Qe=Y.get(gt);if(!Qe)continue;const Ee=Qe.get(0)??0,ze=(Qe.get(ce(ae)??0)??Ee)-Ee;if(ze===0)continue;const Je=Be.y<k.y;if(Je&&ze<0||!Je&&ze>0)continue;let yn;for(const[qr,Kt]of Qe){const ti=Kt-Ee;(Je&&ti<0&&(!yn||ti<yn.row)||!Je&&ti>0&&(!yn||ti>yn.row))&&(yn={band:qr,row:ti})}yn&&Et.set(ae.node.id,{lane:ae.node.lane,band:yn.band})}}const Fn=new Set;let _u=0;for(;_u++<P.nodes.length+2;){for(let le=0;le<P.nodes.length+P.flows.length+2;le++){let Ze=!1;for(const qe of P.flows){const Ae=qe.flow;if(Fn.has(Ae.id))continue;const Ke=l(Ae.source);if(!Ke)continue;const Vt=l(Ae.target),ae=E.get(Ae.target);if(!Vt&&ae){const We=W(ae.node,ae.band),Le=ce(ae);if(ae.node.lane||Le!==void 0){const Be=ue(ae.node),gt=Ke,Qe=gt.x+(pt.get(Ae.source)??0)+gt.width+H,Ee=Bt.get(Ae.target)??Et.get(Ae.target),ze=Ne(Be,We,Ee?Ee.lane:ae.node.lane,Ee?Ee.band:Le,nt.has(Ae.target)?gt.x+gt.width/2:Qe,Number.NaN),Je=n.createShape(We,ze,Be);nt.has(Ae.target)&&pt.set(Ae.target,Qe-(Je.x+Je.width/2)),n.connect(Ke,Je,{type:"bpmn:SequenceFlow",businessObject:I(Ae)})}else s.append(Ke,We,{connection:{type:"bpmn:SequenceFlow",businessObject:I(Ae)}})}else if(Vt)n.connect(Ke,Vt,{type:"bpmn:SequenceFlow",businessObject:I(Ae)});else continue;Fn.add(Ae.id),Ze=!0}if(!Ze)break}const ne=P.nodes.filter(le=>!l(le.node.id));if(!ne.length)break;const ge=ne[0];{const le=W(ge.node,ge.band),Ze=ue(ge.node),qe=he(ge);n.createShape(le,Ne(Ze,le,ge.node.lane,qe,z,V),Ze),!ge.node.lane&&qe===void 0&&(V+=160)}}}const Ue=40,ft=(S,P=()=>!0)=>{const k=l(S);if(!k)return[];const z=[k],V=new Set([S]);for(let B=0;B<z.length;B++){const K=z[B].id;for(const pe of m){const J=pe.flow.target;if(pe.flow.source!==K||V.has(J)||!E.has(J))continue;V.add(J);const ue=l(J);ue&&P(ue)&&z.push(ue)}}return z},tt=(S,P=()=>!0)=>{const k=l(S);if(!k)return[];const z=[k],V=new Set([S]);for(let B=0;B<z.length;B++){const K=z[B].id;for(const pe of m){const J=pe.flow.source;if(pe.flow.target!==K||V.has(J)||!E.has(J))continue;V.add(J);const ue=l(J);ue&&P(ue)&&z.push(ue)}}return z};for(const S of Xt(e,"sequenceFlow.update")){if(S.target===void 0)continue;const P=E.get(S.target);if(!P)continue;const k=l(S.target),z=l(S.id);if(!k||!z)continue;const V=S.source!==void 0?l(S.source):z.source,B=z.target;if(!V||!B||B.id===k.id)continue;const K=ft(S.target),pe=new Set(K.map(Te=>Te.id)),J=Math.min(...K.map(Te=>Te.x)),ue=Math.max(...K.map(Te=>Te.x+Te.width)),Ye=V.x+V.width,ct=ue-J+Ue*2-(B.x-Ye);if(ct>0){const Te=f(k),ve=(Te==null?void 0:Te.children)??[],nt=pt=>pt.type==="bpmn:Lane",Bt=ve.filter(pt=>!("waypoints"in pt&&pt.waypoints)&&!nt(pt)&&!pe.has(pt.id)&&pt.x>=B.x),Et=Te?[Te,...ve.filter(pt=>nt(pt))]:[];Bt.length&&n.createSpace(Bt,Et,{x:ct,y:0},"e",B.x-1)}const Ne=P.node.lane||P.band!==void 0?k.y+k.height/2:V.y+V.height/2;n.moveElements(K,{x:Ye+Ue-J,y:Ne-(k.y+k.height/2)})}const It=(S,P)=>{const k=P.target===S,z=p(P.source),V=p(P.target),B=k?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(z,V,P.id?{type:B,businessObject:i.create(B,{id:P.id})}:{type:B})},un=100,ln=S=>{for(const P of d){if(!P.participant.blackBox)continue;const k=l(P.participant.id);if(!k)continue;const z=[];for(const B of g){const K=B.flow.source===P.participant.id?B.flow.target:B.flow.target===P.participant.id?B.flow.source:void 0,pe=K?l(K):void 0;pe&&typeof pe.x=="number"&&pe.type!=="bpmn:Participant"&&z.push(pe)}if(!z.length)continue;const V=Math.max(...z.map(B=>B.x+B.width/2))+un;if(V>k.x+k.width&&n.resizeShape(k,{x:k.x,y:k.y,width:V-k.x,height:k.height}),!!S)for(const B of g){const K=l(B.flow.id),pe=B.flow.source===P.participant.id?B.flow.target:B.flow.target===P.participant.id?B.flow.source:void 0,J=pe?l(pe):void 0;if(!K||!J||J.type==="bpmn:Participant")continue;const ue=J.x+J.width/2;if(ue<k.x+10||ue>k.x+k.width-10)continue;const Ye=k.y>J.y,ct=Ye?J.y+J.height:J.y,Ne=Ye?k.y:k.y+k.height,Te=B.flow.source===P.participant.id?[{x:ue,y:Ne},{x:ue,y:ct}]:[{x:ue,y:ct},{x:ue,y:Ne}],ve=Ut(o),nt={...ve.edges.find(Bt=>Bt.id===B.flow.id),waypoints:Te};zn(nt,Ci(ve)).length||n.updateWaypoints(K,Te)}}};ln(!1);for(const S of g){const P=S.flow;n.connect(p(P.source),p(P.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:P.id,name:P.name})})}const at=100,Nt=30,pn=4,jo=S=>!("waypoints"in S&&S.waypoints)&&S.type!=="bpmn:Lane"&&S.type!=="label"&&typeof S.x=="number",fn=()=>{const S=Ut(o);return{bad:qi(S).filter(P=>P.kind==="edge-crosses-shape"||P.kind==="edge-overlap-opposite"||P.kind==="edge-overlap-mixed").length,crossings:Sd(S),straight:S.edges.filter(P=>P.type==="bpmn:MessageFlow"&&P.waypoints.length===2).length}},Ln=S=>{const P=Ut(o),k=P.edges.find(z=>z.id===S);return k?zn(k,Ci(P)).length:0},In=S=>Ln(S)>0,Rt=(S,P,k)=>{const z=new Set(S.map(ue=>ue.id)),V=(P.children??[]).filter(jo).filter(ue=>!z.has(ue.id));if(S.some(ue=>V.some(Ye=>ue.x+k<Ye.x+Ye.width+Nt&&ue.x+k+ue.width+Nt>Ye.x&&ue.y<Ye.y+Ye.height&&ue.y+ue.height>Ye.y)))return null;const K=P.width;n.moveElements(S,{x:k,y:0});const J=Math.max(...S.map(ue=>ue.x+ue.width))+150-(P.x+P.width);return J>0&&n.resizeShape(P,{x:P.x,y:P.y,width:P.width+J,height:P.height}),()=>{n.moveElements(S,{x:-k,y:0}),J>0&&n.resizeShape(P,{x:P.x,y:P.y,width:K,height:P.height})}},Er=(S,P)=>P.bad>S.bad||P.crossings>S.crossings&&P.straight<=S.straight&&P.bad>=S.bad,Fo=(S,P,k,z=()=>!0)=>{const V=fn(),B=Rt(S,P,k);if(!B)return!1;const K=fn();return Er(V,K)||!z()?(B(),!1):!0},xn=S=>{var P;return!!((P=E.get(S))!=null&&P.node.participant)},He=new Map;for(const S of g){if(!xn(S.flow.target))continue;const P=He.get(S.flow.target)??[];P.push(S),He.set(S.flow.target,P)}const Xe=[...He.keys()],dx=new Set(m.map(S=>S.flow.target)),hx=S=>Lt.findIndex(({op:P})=>P.participant.id===S);Xe.sort((S,P)=>{var V,B;const k=dx.has(S)?1:0,z=dx.has(P)?1:0;return k!==z?k-z:hx((V=E.get(S))==null?void 0:V.node.participant)-hx((B=E.get(P))==null?void 0:B.node.participant)});const qa=S=>S.x+S.width/2,mx=S=>{let P;for(const k of He.get(S)??[]){const z=l(k.flow.source);if(!z)continue;const V=qa(z);(!P||V>P.cx)&&(P={op:k,cx:V})}return P==null?void 0:P.op},WD=S=>{const P=mx(S),k=l(S),z=P?l(P.flow.source):void 0;return k&&z?qa(z)-qa(k):void 0},UD=S=>{const P=WD(S);return P!==void 0&&Math.abs(P)<at},Bf=S=>{const P=mx(S);if(!P)return null;const k=l(S),z=l(P.flow.source);if(!k||!z)return null;const V=qa(z)-qa(k);if(V>=at){const B=p(E.get(S).node.participant);return{subtree:ft(S,K=>K.x>=k.x),pool:B,dx:V}}if(-V>=at&&xn(P.flow.source)){const B=p(E.get(P.flow.source).node.participant);return{subtree:ft(P.flow.source,K=>K.x>=z.x&&!UD(K.id)),pool:B,dx:-V}}return null},gx=()=>Xe.map(S=>({id:S,plan:Bf(S)})).filter(S=>!!S.plan).sort((S,P)=>Math.min(...S.plan.subtree.map(k=>k.x))-Math.min(...P.plan.subtree.map(k=>k.x))).map(S=>S.id);for(let S=0;S<3;S++){const P=fn(),k=[];for(const V of gx()){const B=Bf(V);if(!B)continue;const K=Rt(B.subtree,B.pool,B.dx);K&&k.push(K)}if(!k.length)break;if(!Er(P,fn()))continue;for(const V of k.reverse())V();let z=!1;for(const V of gx()){const B=Bf(V);B&&Fo(B.subtree,B.pool,B.dx)&&(z=!0)}if(!z)break}for(const S of Xe.flatMap(P=>He.get(P)??[])){if(!In(S.flow.id))continue;const P=l(S.flow.target);if(!P)continue;const k=p(E.get(S.flow.target).node.participant),z=ft(S.flow.target,K=>K.x>=P.x),V=P.width+H,B=Ln(S.flow.id);for(let K=1;K<=pn&&!Fo(z,k,V*K,()=>Ln(S.flow.id)<B);K++);}for(const S of g){if(!In(S.flow.id))continue;const P=l(S.flow.source),k=l(S.flow.target);if(!P||!k||P.type==="bpmn:Participant"||k.type==="bpmn:Participant")continue;const z=P.x+P.width/2;if(Math.abs(z-(k.x+k.width/2))>15)continue;const[V,B]=P.y<k.y?[P.y+P.height,k.y]:[k.y+k.height,P.y],K=[...E.values()].map(pe=>l(pe.node.id)).filter(pe=>!!pe&&pe.id!==P.id&&pe.id!==k.id).filter(pe=>pe.x<=z&&z<=pe.x+pe.width&&pe.y+pe.height>V&&pe.y<B).sort((pe,J)=>pe.x-J.x);for(const pe of K){const J=(Sx=E.get(pe.id))==null?void 0:Sx.node.participant,ue=J?l(J):void 0;if(!ue)continue;const Ye=[...E.values()].filter(Et=>Et.node.participant===J).map(Et=>Et.node.id),ct=Et=>Et.map(pt=>l(pt)).filter(pt=>!!pt),Te=[tt(pe.id,Et=>{var pt;return((pt=E.get(Et.id))==null?void 0:pt.node.participant)===J}),ct(Ye)].filter(Et=>Et.length),ve=pe.width+H,nt=Ln(S.flow.id);let Bt=!1;for(const Et of Te){for(let pt=1;pt<=pn;pt++)if(Fo(Et,ue,ve*pt,()=>Ln(S.flow.id)<nt)){Bt=!0;break}if(Bt)break}if(!In(S.flow.id))break}}{const S=k=>k.y+k.height/2,P=[];for(const k of E.keys()){if(!xn(k))continue;const z=m.filter(K=>K.flow.target===k);if(z.length!==1)continue;const V=l(z[0].flow.source),B=l(k);!V||!B||!E.has(V.id)||Math.abs(S(V)-S(B))>1||B.x-(V.x+V.width)<=H+1||P.push({id:k,pred:V,node:B})}P.sort((k,z)=>k.node.x-z.node.x);for(const{id:k}of P){const z=E.get(k),V=l(k),B=l(m.find(Ne=>Ne.flow.target===k).flow.source);if(!V||!B)continue;const K=V.x-(B.x+B.width);if(K<=H+1)continue;const pe=p(z.node.participant),J=ft(k,Ne=>Ne.x>=V.x),ue=fn(),Ye=Rt(J,pe,-(K-H));if(!Ye)continue;const ct=fn();(ct.bad>ue.bad||ct.crossings>=ue.crossings)&&Ye()}}ln(!0);for(const S of R){const P=S.associations??[],k=P.map(B=>B.source===S.dataStore.id?B.target:B.source).map(l).find(Boolean),z=k?f(k)??u():u(),V=k?{x:k.x+k.width/2,y:k.y+k.height+110}:{x:200,y:C+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:S.dataStore.id,name:S.dataStore.name})},V,z);for(const B of P)It(S.dataStore.id,B)}for(const S of w){const k=p(S.association.target).type==="bpmn:DataStoreReference"?S.association.target:S.association.source;It(k,S.association)}let yx=0;const YD=10,vx=(S,P)=>{for(const k of P.map(z=>f(z)).filter(z=>!!z)){const z=YD,V=k.y,B=k.y+k.height,K=k.x,pe=k.x+k.width;if(Math.abs(S.y-V)<z){const J=V+z-S.y;S.y+=J,S.height-=J}if(Math.abs(S.y+S.height-B)<z&&(S.height=B-z-S.y),Math.abs(S.x-K)<z){const J=K+z-S.x;S.x+=J,S.width-=J}Math.abs(S.x+S.width-pe)<z&&(S.width=pe-z-S.x)}};for(const S of x){const P=(S.group.members??[]).map(l).filter(B=>!!B),k=40;let z;if(P.length){const B=Math.min(...P.map(ue=>ue.x))-k,K=Math.min(...P.map(ue=>ue.y))-k,pe=Math.max(...P.map(ue=>ue.x+ue.width))+k,J=Math.max(...P.map(ue=>ue.y+ue.height))+k;z={x:B,y:K,width:pe-B,height:J-K},vx(z,P)}else z={x:300+yx*350,y:40,width:300,height:200},yx++;const V=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:S.group.id}),width:z.width,height:z.height},{x:z.x+z.width/2,y:z.y+z.height/2},u());S.group.name&&n.updateLabel(V,S.group.name),(Rx=S.group.members)!=null&&Rx.length&&T(V,"bwl:Members",{refs:S.group.members.join(" ")})}const _x=S=>{const P=S.waypoints;if(P!=null&&P.length){const z=P[Math.floor((P.length-1)/2)];return{x:z.x,y:z.y,width:0,height:0}}const k=S;return{x:k.x,y:k.y,width:k.width,height:k.height}};let Ka=0;const bx=12,xx=14,qD=15,KD=300,XD=S=>{const P=S.split(`
7
+ `),k=Math.max(...P.map(B=>io(B,bx))),z=Math.max(100,Math.min(KD,Math.ceil(k)+xx)),V=P.reduce((B,K)=>B+Math.max(1,Math.ceil((io(K,bx)+xx)/z)),0);return{width:z,height:Math.max(30,V*qD+10)}},tn=10;for(const S of b){const P=S.association,k=((Cx=S.placement)==null?void 0:Cx.anchor)??(P?P.source===S.annotation.id?P.target:P.source:void 0),z=k?l(k):void 0,V=z?_x(z):void 0,B=XD(S.annotation.text??"");let K;if(V&&S.placement){const[Ye,ct]=Uu[S.placement.side],Ne=S.placement.offset??50;K={x:V.x+V.width/2+Ye*(V.width/2+B.width/2+Ne),y:V.y+V.height/2+ct*(V.height/2+B.height/2+Ne)}}else V?(K={x:V.x+V.width/2+180+Ka%3*260,y:V.y-110-Ka%2*95},Ka++):(K={x:300+Ka*260,y:60},Ka++);const pe=z?f(z)??u():u(),J=pe;if(V&&typeof J.x=="number"&&typeof J.width=="number"&&J.type==="bpmn:Participant"){const Ye=(ne,ge)=>{const[le,Ze]=Uu[ne];let qe={x:V.x+V.width/2+le*(V.width/2+B.width/2+ge),y:V.y+V.height/2+Ze*(V.height/2+B.height/2+ge)};const Ae=J.x+tn+B.width/2,Ke=J.x+J.width-tn-B.width/2,Vt=J.y+tn+B.height/2,ae=J.y+J.height-tn-B.height/2,We={x:Math.min(Ke,Math.max(Ae,qe.x)),y:Math.min(ae,Math.max(Vt,qe.y))};return(We.x!==qe.x||We.y!==qe.y)&&(qe=Math.abs(We.x-(V.x+V.width/2))<(V.width+B.width)/2+tn&&Math.abs(We.y-(V.y+V.height/2))<(V.height+B.height)/2+tn?{x:V.x+V.width+tn+B.width/2,y:We.y}:We),qe},ct=(J.children??[]).filter(ne=>!("waypoints"in ne&&ne.waypoints)&&ne.type!=="bpmn:Lane"&&ne.type!=="label"&&typeof ne.x=="number"),Ne=Ut(o),Te=Ne.edges.flatMap(hn),ve=Uo(Ne).map(ne=>ne.rect),nt=ne=>({x0:ne.x-B.width/2-tn,x1:ne.x+B.width/2+tn,y0:ne.y-B.height/2-tn,y1:ne.y+B.height/2+tn}),Bt=ne=>{const ge=nt(ne);return ct.some(le=>ge.x0<le.x+le.width&&ge.x1>le.x&&ge.y0<le.y+le.height&&ge.y1>le.y)},Et=ne=>{const ge=nt(ne);return Te.some(le=>le.axis==="h"?le.at>ge.y0&&le.at<ge.y1&&le.lo<ge.x1&&le.hi>ge.x0:le.at>ge.x0&&le.at<ge.x1&&le.lo<ge.y1&&le.hi>ge.y0)},pt=ne=>{const ge=nt(ne);return ve.some(le=>ge.x0<le.x+le.width&&ge.x1>le.x&&ge.y0<le.y+le.height&&ge.y1>le.y)},Fn=ne=>Bt(ne)||Et(ne)||pt(ne),_u=ne=>ne.x-B.width/2>=J.x&&ne.x+B.width/2<=J.x+J.width&&ne.y-B.height/2>=J.y&&ne.y+B.height/2<=J.y+J.height;if(S.placement){const ne=Ae=>Ae.startsWith("top")?Ae.replace(/^top/,"bottom"):Ae.replace(/^bottom/,"top"),ge=Ae=>Ae.endsWith("left")?Ae.replace(/left$/,"right"):Ae.replace(/right$/,"left"),le=S.placement.side,Ze=[le,ne(le),ge(le),ne(ge(le)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],qe=S.placement.offset??50;if(K=Ye(le,qe),Fn(K)){const Ae=new Set;for(const Ke of Ze){if(Ae.has(Ke))continue;Ae.add(Ke);const Vt=Ye(Ke,qe);if(_u(Vt)&&!Fn(Vt)){K=Vt;break}}}}else{const ne=J.x+tn+B.width/2,ge=J.x+J.width-tn-B.width/2,le=J.y+tn+B.height/2,Ze=J.y+J.height-tn-B.height/2;if(K={x:Math.min(ge,Math.max(ne,K.x)),y:Math.min(Ze,Math.max(le,K.y))},Fn(K)){const qe=(V.width+B.width)/2+tn,Ke=[{x:K.x+qe,y:K.y},{x:K.x-qe,y:K.y},{x:K.x,y:K.y-B.height-tn},{x:K.x,y:K.y+B.height+tn}].filter(_u).find(Vt=>!Fn(Vt));Ke&&(K=Ke)}}}const ue=n.createShape({type:"bpmn:TextAnnotation",width:B.width,height:B.height,businessObject:i.create("bpmn:TextAnnotation",{id:S.annotation.id,text:S.annotation.text})},K,pe);if(P){const Ye=ct=>ct===S.annotation.id?ue:p(ct);n.connect(Ye(P.source),Ye(P.target),P.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:P.id})}:{type:"bpmn:Association"})}S.placement&&T(ue,"bwl:Placement",L(S.placement))}for(const S of Xt(e,"association.add")){const P=S.association;n.connect(p(P.source),p(P.target),P.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:P.id})}:{type:"bpmn:Association"})}for(const S of Xt(e,"node.update")){let P=p(S.id);if(S.type&&hs(S.type)!==P.type&&(P=c.replaceElement(P,{type:hs(S.type)})),S.name!==void 0&&n.updateProperties(P,{name:S.name??void 0}),S.lane){const k=p(S.lane),z=k.y+k.height/2-(P.y+P.height/2);z!==0&&n.moveElements([P],{x:0,y:z})}}for(const S of Xt(e,"sequenceFlow.update")){const P=p(S.id);if(S.source!==void 0||S.target!==void 0){const k=P,z=S.source!==void 0?p(S.source):k.source,V=S.target!==void 0?p(S.target):k.target,B=K=>({x:K.x+K.width/2,y:K.y+K.height/2});n.reconnect(k,z,V,[B(z),B(V)])}S.name!==void 0&&n.updateProperties(P,{name:S.name??void 0}),S.condition!==void 0&&n.updateProperties(P,{name:((Px=S.condition)==null?void 0:Px.label)??void 0})}for(const S of Xt(e,"messageFlow.update"))S.name!==void 0&&n.updateProperties(p(S.id),{name:S.name??void 0});for(const S of Xt(e,"dataStore.update"))S.name!==void 0&&n.updateProperties(p(S.id),{name:S.name??void 0});for(const S of Xt(e,"annotation.update")){const P=p(S.id);if(S.text!==void 0&&n.updateProperties(P,{text:S.text}),S.placement===null)T(P,"bwl:Placement",null);else if(S.placement){const k=_x(p(S.placement.anchor)),[z,V]=Uu[S.placement.side],B=S.placement.offset??50,K=k.x+k.width/2+z*(k.width/2+P.width/2+B),pe=k.y+k.height/2+V*(k.height/2+P.height/2+B);n.moveElements([P],{x:K-(P.x+P.width/2),y:pe-(P.y+P.height/2)}),T(P,"bwl:Placement",L(S.placement))}}for(const S of Xt(e,"group.update")){const P=p(S.id);if(S.name!==void 0&&n.updateLabel(P,S.name??""),S.members){const k=S.members.map(l).filter(z=>!!z);if(k.length){const V=Math.min(...k.map(ue=>ue.x))-40,B=Math.min(...k.map(ue=>ue.y))-40,K=Math.max(...k.map(ue=>ue.x+ue.width))+40,pe=Math.max(...k.map(ue=>ue.y+ue.height))+40,J={x:V,y:B,width:K-V,height:pe-B};vx(J,k),n.resizeShape(P,J)}T(P,"bwl:Members",{refs:S.members.join(" ")})}}}function rh(e,t,n=ih){const i=nh(e),r=th(t,kd(i.elementRegistry)),o={edgeCrossings:{before:0,after:0,pairs:[]}};if(r.length)return{ok:!1,issues:r,findings:[],stats:o};const a=Ut(i.elementRegistry),s=new Set(qi(a).map(Yi)),c=new Set(a.edges.map(m=>m.id)),u=new Set(a.shapes.map(m=>m.id)),l=Vu(a).length,p=e.get("commandStack");try{zf(p,()=>{n(t,i),Fd(i,c),Bd(i,s),Ud(i,s,c),Gd(i,c),Jw(i,c),Xd(i,s,c),Kd(i,c),Qd(i,u)})}catch(m){return{ok:!1,issues:[{kind:"lower-failed",message:m instanceof Error?m.message:String(m)}],findings:[],stats:o}}const f=Ut(i.elementRegistry),d=qi(f).filter(m=>!s.has(Yi(m))),h=Vu(f);return{ok:!0,issues:[],findings:d,stats:{edgeCrossings:{before:l,after:h.length,pairs:h}}}}function oE(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function aE(e,t){return typeof e.get=="function"?e.get(t):e[t]}function oh(e,t){const n=aE(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function ah(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function sE(e){return typeof e=="string"&&xu.includes(e)}function ci(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function sh(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:{}},p=[],f=[],d=[],h=[],m=[],g=[],R=new Set,w=new Set,b=Y=>{Y&&R.add(Y)},x=Y=>{R.add(Y),w.add(Y)},E=Y=>{const de=ah(Y,"bwl:Placement");if(!de)return;const he=typeof de.anchor=="string"?de.anchor:void 0;if(!he||!sE(de.side))return;const se=typeof de.offset=="number"?de.offset:void 0;m.push({owner:Y.id,anchor:he,side:de.side,...se!==void 0?{offset:se}:{}})},T=Y=>{const de=ah(Y,"bwl:Members"),he=typeof(de==null?void 0:de.refs)=="string"?de.refs.split(/\s+/).filter(Boolean):[];he.length&&g.push({owner:Y.id,refs:he})},L=Y=>{var de;for(const he of Y)switch(b(he.id),he.$type){case"bpmn:TextAnnotation":x(he.id),s.push({id:he.id,text:typeof he.text=="string"?he.text:""}),E(he);break;case"bpmn:Association":d.push({id:he.id,type:he.$type,source:ci(he.sourceRef),target:ci(he.targetRef)});break;case"bpmn:Group":{x(he.id);const se=(de=he.categoryValueRef)==null?void 0:de.value;c.push({id:he.id,...typeof se=="string"&&se?{name:se}:{}}),T(he);break}default:u.push({id:he.id,type:he.$type,reason:"type-outside-mvp"})}},A=(Y,de)=>{const he=Y.flowElements??[],se=(Y.laneSets??[]).flatMap(ee=>ee.lanes??[]),ce=new Map;for(const ee of se){b(ee.id);for(const F of ee.flowNodeRef??[]){const $=ci(F);$&&ce.set($,ee.id)}}for(const ee of he){if(b(ee.id),ee.$type==="bpmn:SequenceFlow"){p.push({id:ee.id,source:ci(ee.sourceRef),target:ci(ee.targetRef),...typeof ee.name=="string"&&ee.name?{name:ee.name}:{}});continue}if(ee.$type==="bpmn:DataStoreReference"){x(ee.id),a.push({id:ee.id,...ee.name?{name:ee.name}:{}});continue}const F=oE(ee.$type);if(!$f(F)){u.push({id:ee.id,type:ee.$type,reason:"type-outside-mvp"});continue}x(ee.id),o.push({id:ee.id,type:F,...ee.name?{name:ee.name}:{},...de?{participant:de}:{},...ce.has(ee.id)?{lane:ce.get(ee.id)}:{}});const $=oh(ee,"bwl:band");$!==void 0&&(l.bands[ee.id]=$);for(const U of ee.dataOutputAssociations??[])b(U.id),h.push({id:U.id,type:U.$type,source:ee.id,target:ci(U.targetRef)});for(const U of ee.dataInputAssociations??[])b(U.id),h.push({id:U.id,type:U.$type,source:ci((U.sourceRef??[])[0]),target:ee.id})}L(Y.artifacts??[])};if(n){const Y=new Set;for(const de of n.participants??[]){x(de.id);const he=ci(de.processRef);he&&Y.add(he);const se=he?i.get(he):void 0,ce=((se==null?void 0:se.laneSets)??[]).flatMap(U=>U.lanes??[]),ee=ce.map(U=>({id:U.id,...U.name?{name:U.name}:{}}));for(const U of ee)x(U.id);const F=!se||(se.flowElements??[]).length===0&&ce.length===0&&(se.artifacts??[]).length===0;r.push({id:de.id,...de.name?{name:de.name}:{},...F?{blackBox:!0}:{},...ee.length?{lanes:ee}:{}});const $=oh(de,"bwl:poolOrder");$!==void 0&&(l.poolOrders[de.id]=$),se&&A(se,de.id)}for(const de of n.messageFlows??[])b(de.id),f.push({id:de.id,source:ci(de.sourceRef),target:ci(de.targetRef),...typeof de.name=="string"&&de.name?{name:de.name}:{}});L(n.artifacts??[]);for(const[de,he]of i)!Y.has(de)&&(he.flowElements??[]).length>0&&u.push({id:de,type:he.$type,reason:"unreachable-process"})}else for(const Y of i.values())A(Y);const j=[],H=[],N=[],G=[],fe=(Y,de)=>!!Y&&!!de&&w.has(Y)&&w.has(de);for(const Y of p){if(!fe(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}:{}}),w.add(Y.id)}for(const Y of f){if(!fe(Y.source,Y.target)){u.push({id:Y.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}H.push({id:Y.id,source:Y.source,target:Y.target,...Y.name?{name:Y.name}:{}}),w.add(Y.id)}for(const Y of h){if(!fe(Y.source,Y.target)){u.push({id:Y.id??"",type:Y.type,reason:"endpoint-outside-mvp"});continue}G.push({...Y.id?{id:Y.id}:{},source:Y.source,target:Y.target}),Y.id&&w.add(Y.id)}for(const Y of d){if(!fe(Y.source,Y.target)){u.push({id:Y.id??"",type:Y.type,reason:"endpoint-outside-mvp"});continue}N.push({...Y.id?{id:Y.id}:{},source:Y.source,target:Y.target})}const Fe=new Map(c.map(Y=>[Y.id,Y]));for(const{owner:Y,refs:de}of g){const he=de.filter(ce=>R.has(ce)),se=Fe.get(Y);se&&he.length&&(se.members=he)}for(const Y of m)R.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,...H.length?{messageFlows:H}:{},...a.length?{dataStores:a}:{},...G.length?{dataAssociations:G}:{},...s.length?{annotations:s}:{},...N.length?{associations:N}:{},...c.length?{groups:c}:{}},hints:l,omitted:u}}async function cE(e){const{definitions:t,warnings:n}=await $u(e);return{...sh(t),warnings:n}}function uE(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function ch(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=rh(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 lE=Symbol("bpmn-editor");function pE(){const e=Ct.ref(!1),t=Ct.ref(!0),n=Ct.ref(!1);let i,r;const o=()=>{e.value=!0};function a(u,l){u.get("canvas").getContainer().style.pointerEvents=l?"":"none";const p=u.get("keyboard");l?(r&&p.bind(r),r=void 0):r||(r=p.getBinding(),p.unbind())}function s(){if(!i)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return i}function c(){return i==null?void 0:i.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,attach(u){i&&this.detach(),i=u,i.get("eventBus").on("commandStack.changed",o),t.value||a(i,!1)},detach(){i==null||i.get("eventBus").off("commandStack.changed",o),i&&!t.value&&a(i,!0),r=void 0,i=void 0},setEditable(u){t.value=u,i&&a(i,u)},async applyAgentBatch(u,l){const p=s();n.value=!0;try{const f=await ch(p,u,{currentVersion:l});return f.status==="applied"&&(e.value=!1),f}finally{n.value=!1}},async importXml(u){const{warnings:l}=await s().importXML(u);return e.value=!1,{warnings:ju(l)}},async saveXml(){const{xml:u}=await s().saveXML({format:!0});return e.value=!1,u??""},undo:()=>{var u;return(u=c())==null?void 0:u.undo()},redo:()=>{var u;return(u=c())==null?void 0:u.redo()},canUndo:()=>{var u;return((u=c())==null?void 0:u.canUndo())??!1},canRedo:()=>{var u;return((u=c())==null?void 0:u.canRedo())??!1}}}function ie(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function fE(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Yu={exports:{}},uh;function dE(){if(uh)return Yu.exports;uh=1;var e=Yu.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},Yu.exports}var hE=dE(),mE=fE(hE);function ui(e){if(!(this instanceof ui))return new ui(e);e=e||[128,36,1],this._seed=e.length?mE.rack(e[0],e[1],e[2]):e}ui.prototype.next=function(e){return this._seed(e||!0)},ui.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},ui.prototype.claim=function(e,t){this._seed.set(e,t||!0)},ui.prototype.assigned=function(e){return this._seed.get(e)||!1},ui.prototype.unclaim=function(e){delete this._seed.hats[e]},ui.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const 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 ut(e,t=globalThis.document){var u;if(typeof e!="string")throw new TypeError("String expected");const n=/^<!--(.*?)-->$/s.exec(e);if(n)return t.createComment(n[1]);const i=(u=/<([\w:]+)/.exec(e))==null?void 0:u[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const l=t.createElement("html");l.innerHTML=e;const{lastChild:p}=l;return p.remove(),p}let[r,o,a]=Object.hasOwn(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 gE(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 M(t,function(i){i&&M(i,function(r,o){n[o]=r})}),e}function an(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const yE=Object.prototype.toString;function mt(e){return new Ki(e)}function Ki(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Ki.prototype.add=function(e){return this.list.add(e),this},Ki.prototype.remove=function(e){return yE.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Ki.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},Ki.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Ki.prototype.array=function(){return Array.from(this.list)},Ki.prototype.has=Ki.prototype.contains=function(e){return this.list.contains(e)};function ms(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 vE(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var gs={},lh;function _E(){if(lh)return gs;lh=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return gs.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},gs.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},gs}var ph=_E(),bE=vE(ph),Se=gE({__proto__:null,default:bE},[ph]),fh=["focus","blur"];function xE(e,t,n,i,r){return fh.indexOf(n)!==-1&&(r=!0),Se.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 wE(e,t,n,i){return fh.indexOf(t)!==-1&&(i=!0),Se.unbind(e,t,n,i)}var Cn={bind:xE,unbind:wE};function qu(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function et(e,t){return t=t||document,t.querySelector(e)}function ys(e,t){return t=t||document,t.querySelectorAll(e)}function li(e){e.parentNode&&e.parentNode.removeChild(e)}function EE(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function SE(e,t){return t.appendChild(EE(e,t))}function Re(e,t){return SE(t,e),e}var Ku=2,dh={"alignment-baseline":1,"baseline-shift":1,clip:1,"clip-path":1,"clip-rule":1,color:1,"color-interpolation":1,"color-interpolation-filters":1,"color-profile":1,"color-rendering":1,cursor:1,direction:1,display:1,"dominant-baseline":1,"enable-background":1,fill:1,"fill-opacity":1,"fill-rule":1,filter:1,"flood-color":1,"flood-opacity":1,font:1,"font-family":1,"font-size":Ku,"font-size-adjust":1,"font-stretch":1,"font-style":1,"font-variant":1,"font-weight":1,"glyph-orientation-horizontal":1,"glyph-orientation-vertical":1,"image-rendering":1,kerning:1,"letter-spacing":1,"lighting-color":1,marker:1,"marker-end":1,"marker-mid":1,"marker-start":1,mask:1,opacity:1,overflow:1,"pointer-events":1,"shape-rendering":1,"stop-color":1,"stop-opacity":1,stroke:1,"stroke-dasharray":1,"stroke-dashoffset":1,"stroke-linecap":1,"stroke-linejoin":1,"stroke-miterlimit":1,"stroke-opacity":1,"stroke-width":Ku,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function RE(e,t){return dh[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=dh[i];r?(r===Ku&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function CE(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)hh(e,r,t[r])}function re(e,t,n){if(typeof t=="string")if(n!==void 0)hh(e,t,n);else return RE(e,t);else CE(e,t);return e}const PE=Object.prototype.toString;function je(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 PE.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 vs(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function mh(e){return e.cloneNode(!0)}var Xu={svg:"http://www.w3.org/2000/svg"},gh='<svg xmlns="'+Xu.svg+'"';function AE(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(Xu.svg)===-1&&(e=gh+e.substring(4)):(e=gh+">"+e+"</svg>",t=!0);var n=TE(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function TE(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function me(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=AE(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(Xu.svg,e),t&&re(n,t),n}var Zu=null;function yh(){return Zu===null&&(Zu=me("svg")),Zu}function vh(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function ME(e,t,n,i,r,o){var a=yh().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return vh(a,e);case 6:return vh(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function Yo(e){return yh().createSVGTransform()}var _h=/([&<>]{1})/g,kE=/([&<>\n\r"]{1})/g,DE={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function Qu(e,t){function n(i,r){return DE[r]||r}return e.replace(t,n)}function bh(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(Qu(e.textContent,_h));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,'="',Qu(o.value,kE),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)bh(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",Qu(e.nodeValue,_h),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function OE(e){for(var t=e.firstChild,n=[];t;)bh(t,n),t=t.nextSibling;return n.join("")}function xh(e,t){return OE(e)}function Ft(e){var t=e.parentNode;return t&&t.removeChild(e),e}function LE(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function IE(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(LE(e,i))}function qo(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),IE(n,t)),n.consolidate()}const NE=/^class[ {]/;function BE(e){return NE.test(e.toString())}function Ju(e){return Array.isArray(e)}function el(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function _s(...e){e.length===1&&Ju(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const $E=/constructor\s*[^(]*\(\s*([^)]*)\)/m,jE=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,FE=/\/\*([^*]*)\*\//m;function HE(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(BE(e)?$E:jE);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(FE);return(r&&r[1]||i).trim()})||[]}function wh(e,t){const n=t||{get:function(b,x){if(i.push(b),x===!1)return null;throw s(`No provider for "${b}"!`)}},i=[],r=this._providers=Object.create(n._providers||null),o=this._instances=Object.create(null),a=o.injector=this,s=function(b){const x=i.join(" -> ");return i.length=0,new Error(x?`${b} (Resolving: ${x})`:b)};function c(b,x){if(!r[b]&&b.includes(".")){const E=b.split(".");let T=c(E.shift());for(;E.length;)T=T[E.shift()];return T}if(el(o,b))return o[b];if(el(r,b)){if(i.indexOf(b)!==-1)throw i.push(b),s("Cannot resolve circular dependency!");return i.push(b),o[b]=r[b][0](r[b][1]),i.pop(),o[b]}return n.get(b,x)}function u(b,x){if(typeof x>"u"&&(x={}),typeof b!="function")if(Ju(b))b=_s(b.slice());else throw s(`Cannot invoke "${b}". Expected a function!`);const T=(b.$inject||HE(b)).map(L=>el(x,L)?x[L]:c(L));return{fn:b,dependencies:T}}function l(b){const{fn:x,dependencies:E}=u(b),T=Function.prototype.bind.call(x,null,...E);return new T}function p(b,x,E){const{fn:T,dependencies:L}=u(b,E);return T.apply(x,L)}function f(b){return _s(x=>b.get(x))}function d(b,x){if(x&&x.length){const E=Object.create(null),T=Object.create(null),L=[],A=[],j=[];let H,N,G,fe;for(let Fe in r)H=r[Fe],x.indexOf(Fe)!==-1&&(H[2]==="private"?(N=L.indexOf(H[3]),N===-1?(G=H[3].createChild([],x),fe=f(G),L.push(H[3]),A.push(G),j.push(fe),E[Fe]=[fe,Fe,"private",G]):E[Fe]=[j[N],Fe,"private",A[N]]):E[Fe]=[H[2],H[1]],T[Fe]=!0),(H[2]==="factory"||H[2]==="type")&&H[1].$scope&&x.forEach(lt=>{H[1].$scope.indexOf(lt)!==-1&&(E[Fe]=[H[2],H[1]],T[lt]=!0)});x.forEach(Fe=>{if(!T[Fe])throw new Error('No provider for "'+Fe+'". Cannot use provider from the parent!')}),b.unshift(E)}return new wh(b,a)}const h={factory:p,type:l,value:function(b){return b}};function m(b,x){const E=b.__init__||[];return function(){E.forEach(T=>{typeof T=="string"?x.get(T):x.invoke(T)})}}function g(b){const x=b.__exports__;if(x){const E=b.__modules__,T=Object.keys(b).reduce((N,G)=>(G!=="__exports__"&&G!=="__modules__"&&G!=="__init__"&&G!=="__depends__"&&(N[G]=b[G]),N),Object.create(null)),L=(E||[]).concat(T),A=d(L),j=_s(function(N){return A.get(N)});x.forEach(function(N){r[N]=[j,N,"private",A]});const H=(b.__init__||[]).slice();return H.unshift(function(){A.init()}),b=Object.assign({},b,{__init__:H}),m(b,A)}return Object.keys(b).forEach(function(E){if(E==="__init__"||E==="__depends__")return;const T=b[E];if(T[2]==="private"){r[E]=T;return}const L=T[0],A=T[1];r[E]=[h[L],zE(L,A),L]}),m(b,a)}function R(b,x){return b.indexOf(x)!==-1||(b=(x.__depends__||[]).reduce(R,b),b.indexOf(x)!==-1)?b:b.concat(x)}function w(b){const x=b.reduce(R,[]).map(g);let E=!1;return function(){E||(E=!0,x.forEach(T=>T()))}}this.get=c,this.invoke=p,this.instantiate=l,this.createChild=d,this.init=w(e)}function zE(e,t){return e!=="value"&&Ju(t)&&(t=_s(t.slice())),t}var VE=1e3;function Pi(e,t){var n=this;t=t||VE,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)})}Pi.prototype.canRender=function(e){},Pi.prototype.drawShape=function(e,t){},Pi.prototype.drawConnection=function(e,t){},Pi.prototype.getShapePath=function(e){},Pi.prototype.getConnectionPath=function(e){};function Dr(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function GE(e){return["M",e.x,e.y]}function tl(e){return["L",e.x,e.y]}function WE(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function UE(e,t){const n=e.length,i=[GE(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(tl(a));continue}const c=Math.min(t,nl(a.x-o.x,a.y-o.y),nl(s.x-a.x,s.y-a.y));if(!c){i.push(tl(a));continue}const u=bs(a,o,c),l=bs(a,o,c*.5),p=bs(a,s,c),f=bs(a,s,c*.5);i.push(tl(u)),i.push(WE(l,f,p))}return i}function bs(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=nl(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function nl(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Ko(e,t,n){we(t)&&(n=t,t=null),t||(t={});const i=me("path",t);return we(n)&&(i.dataset.cornerRadius=String(n)),il(i,e)}function il(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return re(e,{d:Dr(UE(t,n))}),e}function xs(e){var t=new Set(e);return Oe(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function Or(e,t,n){n=n||0,_e(e)||(e=[e]),M(e,function(i,r){var o=t(i,r,n);_e(o)&&o.length&&Or(o,t,n+1)})}function rl(e,t,n){var i=new Set,r=new Set;return Or(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 Xo(e,t){return rl(e)}function YE(e,t,n){Sr(t)&&(t=!0),Gt(t)&&(n=t,t=!0),n=n||{};var i=Zo(n.allShapes),r=Zo(n.allConnections),o=Zo(n.enclosedElements),a=Zo(n.enclosedConnections),s=Zo(n.topLevel,t&&Qr(e,function(l){return l.id}));function c(l){s[l.source.id]&&s[l.target.id]&&(s[l.id]=[l]),i[l.source.id]&&i[l.target.id]&&(a[l.id]=o[l.id]=l),r[l.id]=l}function u(l){if(o[l.id]=l,l.waypoints)a[l.id]=r[l.id]=l;else return i[l.id]=l,M(l.incoming,c),M(l.outgoing,c),l.children}return Or(e,u),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function At(e,t){t=!!t,_e(e)||(e=[e]);var n,i,r,o;return M(e,function(a){var s=a;a.waypoints&&!t&&(s=At(a.waypoints,!0));var c=s.x,u=s.y,l=s.height||0,p=s.width||0;(c<n||n===void 0)&&(n=c),(u<i||i===void 0)&&(i=u),(c+p>r||r===void 0)&&(r=c+p),(u+l>o||o===void 0)&&(o=u+l)}),{x:n,y:i,height:o-i,width:r-n}}function ao(e,t){var n={};return M(e,function(i){var r=i;r.waypoints&&(r=At(r)),!we(t.y)&&r.x>t.x&&(n[i.id]=i),!we(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(we(t.width)&&we(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!we(t.width)||!we(t.height))&&(n[i.id]=i)}),n}function Eh(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function Sh(e){return!!(e&&e.isFrame)}function Zo(e,t){return O({},e||{},t||{})}var qE=1;function Zi(e,t){Pi.call(this,e,qE),this.CONNECTION_STYLE=t.style(["no-fill"],{strokeWidth:5,stroke:"fuchsia"}),this.SHAPE_STYLE=t.style({fill:"white",stroke:"fuchsia",strokeWidth:2}),this.FRAME_STYLE=t.style(["no-fill"],{stroke:"fuchsia",strokeDasharray:4,strokeWidth:2})}ie(Zi,Pi),Zi.prototype.canRender=function(){return!0},Zi.prototype.drawShape=function(t,n,i){var r=me("rect");return re(r,{x:0,y:0,width:n.width||0,height:n.height||0}),Sh(n)?re(r,O({},this.FRAME_STYLE,i||{})):re(r,O({},this.SHAPE_STYLE,i||{})),Re(t,r),r},Zi.prototype.drawConnection=function(t,n,i){var r=Ko(n.waypoints,O({},this.CONNECTION_STYLE,i||{}));return Re(t,r),r},Zi.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 Dr(a)},Zi.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 Dr(o)},Zi.$inject=["eventBus","styles"];function KE(){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 O(o,{class:n})},this.style=function(n,i){!_e(n)&&!i&&(i=n,n=[]);var r=Sn(n,function(o,a){return O(o,e[a]||{})},{});return i?O(r,i):r},this.computeStyle=function(n,i,r){return _e(i)||(r=i,i=[]),t.style(i||[],O({},r,n||{}))}}const XE={__init__:["defaultRenderer"],defaultRenderer:["type",Zi],styles:["type",KE]};function wt(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function St(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 ol(e,t){return!e||!t?-1:e.indexOf(t)}function Qo(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function al(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=Qo(e,t);return Math.abs(r/o)<=i}var ZE=2;function Ai(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(QE(r,n))return o;return!1}function QE(e,t){const n=t[0];return Rr(t,function(i){return Math.abs(n[e]-i[e])<=ZE})}function Rh(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 JE=/,?([a-z]),?/gi,Ch=parseFloat,Tt=Math,Qi=Tt.PI,pi=Tt.min,fi=Tt.max,Ph=Tt.pow,Ji=Tt.abs,e1=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,t1=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,Ah=Array.isArray||function(e){return e instanceof Array};function n1(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function i1(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 r1(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 n1(r,i)?(i1(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function o1(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(e1,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(t1,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=ul,n}function a1(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 s1(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 cl(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 ul(){return this.join(",").replace(JE,"$1")}function c1(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=ul,t}function Th(e,t,n,i,r,o,a,s,c){var u=1-c,l=Ph(u,3),p=Ph(u,2),f=c*c,d=f*c,h=l*e+p*3*c*n+u*3*c*c*r+d*a,m=l*t+p*3*c*i+u*3*c*c*o+d*s;return{x:ws(h),y:ws(m)}}function Mh(e){var t=h1(...e);return cl(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function er(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function u1(e,t){return e=cl(e),t=cl(t),er(t,e.x,e.y)||er(t,e.x2,e.y)||er(t,e.x,e.y2)||er(t,e.x2,e.y2)||er(e,t.x,t.y)||er(e,t.x2,t.y)||er(e,t.x,t.y2)||er(e,t.x2,t.y2)||(e.x<t.x2&&e.x>t.x||t.x<e.x2&&t.x>e.x)&&(e.y<t.y2&&e.y>t.y||t.y<e.y2&&t.y>e.y)}function kh(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 Dh(e,t,n,i,r,o,a,s,c){c==null&&(c=1),c=c>1?1:c<0?0:c;for(var u=c/2,l=12,p=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],f=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,h=0;h<l;h++){var m=u*p[h]+u,g=kh(m,e,n,r,a),R=kh(m,t,i,o,s),w=g*g+R*R;d+=f[h]*Tt.sqrt(w)}return u*d}function l1(e,t,n,i,r,o,a,s){if(!(fi(e,n)<pi(r,a)||pi(e,n)>fi(r,a)||fi(t,i)<pi(o,s)||pi(t,i)>fi(o,s))){var c=(e*i-t*n)*(r-a)-(e-n)*(r*s-o*a),u=(e*i-t*n)*(o-s)-(t-i)*(r*s-o*a),l=(e-n)*(o-s)-(t-i)*(r-a);if(l){var p=ws(c/l),f=ws(u/l),d=+p.toFixed(2),h=+f.toFixed(2);if(!(d<+pi(e,n).toFixed(2)||d>+fi(e,n).toFixed(2)||d<+pi(r,a).toFixed(2)||d>+fi(r,a).toFixed(2)||h<+pi(t,i).toFixed(2)||h>+fi(t,i).toFixed(2)||h<+pi(o,s).toFixed(2)||h>+fi(o,s).toFixed(2)))return{x:p,y:f}}}}function ws(e){return Math.round(e*1e11)/1e11}function p1(e,t,n){var i=Mh(e),r=Mh(t);if(!u1(i,r))return[];var o=Dh(...e),a=Dh(...t),s=Lh(e)?1:~~(o/5)||1,c=Lh(t)?1:~~(a/5)||1,u=new Array(s+1),l=new Array(c+1),p={},f=[],d,h;for(d=0;d<s+1;d++){var m=Th(...e,d/s);u[d]={x:m.x,y:m.y,t:d/s}}for(d=0;d<c+1;d++)m=Th(...t,d/c),l[d]={x:m.x,y:m.y,t:d/c};for(d=0;d<s;d++)for(h=0;h<c;h++){var g=u[d],R=u[d+1],w=l[h],b=l[h+1],x=Ji(R.x-g.x)<.01?"y":"x",E=Ji(b.x-w.x)<.01?"y":"x",T=l1(g.x,g.y,R.x,R.y,w.x,w.y,b.x,b.y),L;if(T){if(L=T.x.toFixed(9)+"#"+T.y.toFixed(9),p[L])continue;p[L]=!0;var A=g.t+Ji((T[x]-g[x])/(R[x]-g[x]))*(R.t-g.t),j=w.t+Ji((T[E]-w[E])/(b[E]-w[E]))*(b.t-w.t);A>=0&&A<=1&&j>=0&&j<=1&&f.push({x:T.x,y:T.y,t1:A,t2:j})}}return f}function Oh(e,t,n){e=Bh(e),t=Bh(t);for(var i,r,o,a,s,c,u,l,p,f,d=n?0:[],h=0,m=e.length;h<m;h++){var g=e[h];if(g[0]=="M")i=s=g[1],r=c=g[2];else{g[0]=="C"?(p=[i,r,...g.slice(1)],i=p[6],r=p[7]):(p=[i,r,i,r,s,c,s,c],i=s,r=c);for(var R=0,w=t.length;R<w;R++){var b=t[R];if(b[0]=="M")o=u=b[1],a=l=b[2];else{b[0]=="C"?(f=[o,a,...b.slice(1)],o=f[6],a=f[7]):(f=[o,a,o,a,u,l,u,l],o=u,a=l);var x=p1(p,f);{for(var E=0,T=x.length;E<T;E++)x[E].segment1=h,x[E].segment2=R,x[E].bez1=p,x[E].bez2=f;d=d.concat(x)}}}}}return d}function f1(e){return Ah(e)&&Ah(e[0])}function d1(e){if(a1(e))return e;var t=new Array(e.length),n=0,i=0,r=0,o=0,a=0,s;e[0][0]=="M"&&(n=+e[0][1],i=+e[0][2],r=n,o=i,a++,t[0]=["M",n,i]);for(var c,u,l=a,p=e.length;l<p;l++){if(u=e[l],s=u[0],t[l]=c=new Array(u.length),s!=s.toUpperCase())switch(c[0]=s.toUpperCase(),c[0]){case"A":c[1]=u[1],c[2]=u[2],c[3]=u[3],c[4]=u[4],c[5]=u[5],c[6]=+u[6]+n,c[7]=+u[7]+i;break;case"V":c[1]=+u[1]+i;break;case"H":c[1]=+u[1]+n;break;case"M":r=+u[1]+n,o=+u[2]+i;default:for(var f=1,d=u.length;f<d;f++)c[f]=+u[f]+(f%2?n:i)}else for(var h=0,m=u.length;h<m;h++)c[h]=u[h];switch(s=s.toUpperCase(),c[0]){case"Z":n=+r,i=+o;break;case"H":n=c[1];break;case"V":i=c[1];break;case"M":r=c[c.length-2],o=c[c.length-1];default:n=c[c.length-2],i=c[c.length-1]}}return t.toString=ul,t}function Lh(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Es(e,t,n,i){return[e,t,n,i,n,i]}function Ih(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 Nh(e,t,n,i,r,o,a,s,c,u){var l=Qi*120/180,p=Qi/180*(+r||0),f=[],d,h=r1(function(C,_,y){var D=C*Tt.cos(y)-_*Tt.sin(y),I=C*Tt.sin(y)+_*Tt.cos(y);return{x:D,y:I}});if(u)L=u[0],A=u[1],E=u[2],T=u[3];else{d=h(e,t,-p),e=d.x,t=d.y,d=h(s,c,-p),s=d.x,c=d.y;var m=(e-s)/2,g=(t-c)/2,R=m*m/(n*n)+g*g/(i*i);R>1&&(R=Tt.sqrt(R),n=R*n,i=R*i);var w=n*n,b=i*i,x=(o==a?-1:1)*Tt.sqrt(Ji((w*b-w*g*g-b*m*m)/(w*g*g+b*m*m))),E=x*n*g/i+(e+s)/2,T=x*-i*m/n+(t+c)/2,L=Tt.asin(((t-T)/i).toFixed(9)),A=Tt.asin(((c-T)/i).toFixed(9));L=e<E?Qi-L:L,A=s<E?Qi-A:A,L<0&&(L=Qi*2+L),A<0&&(A=Qi*2+A),a&&L>A&&(L=L-Qi*2),!a&&A>L&&(A=A-Qi*2)}var j=A-L;if(Ji(j)>l){var H=A,N=s,G=c;A=L+l*(a&&A>L?1:-1),s=E+n*Tt.cos(A),c=T+i*Tt.sin(A),f=Nh(s,c,n,i,r,0,a,N,G,[A,H,E,T])}j=A-L;var fe=Tt.cos(L),Fe=Tt.sin(L),lt=Tt.cos(A),Y=Tt.sin(A),de=Tt.tan(j/4),he=4/3*n*de,se=4/3*i*de,ce=[e,t],ee=[e+he*Fe,t-se*fe],F=[s+he*Y,c-se*lt],$=[s,c];if(ee[0]=2*ce[0]-ee[0],ee[1]=2*ce[1]-ee[1],u)return[ee,F,$].concat(f);f=[ee,F,$].concat(f).join().split(",");for(var U=[],ke=0,Lt=f.length;ke<Lt;ke++)U[ke]=ke%2?h(f[ke-1],f[ke],p).y:h(f[ke],f[ke+1],p).x;return U}function h1(e,t,n,i,r,o,a,s){for(var c=[],u=[[],[]],l,p,f,d,h,m,g,R,w=0;w<2;++w){if(w==0?(p=6*e-12*n+6*r,l=-3*e+9*n-9*r+3*a,f=3*n-3*e):(p=6*t-12*i+6*o,l=-3*t+9*i-9*o+3*s,f=3*i-3*t),Ji(l)<1e-12){if(Ji(p)<1e-12)continue;d=-f/p,0<d&&d<1&&c.push(d);continue}g=p*p-4*f*l,R=Tt.sqrt(g),!(g<0)&&(h=(-p+R)/(2*l),0<h&&h<1&&c.push(h),m=(-p-R)/(2*l),0<m&&m<1&&c.push(m))}for(var b=c.length,x=b,E;b--;)d=c[b],E=1-d,u[0][b]=E*E*E*e+3*E*E*d*n+3*E*d*d*r+d*d*d*a,u[1][b]=E*E*E*t+3*E*E*d*i+3*E*d*d*o+d*d*d*s;return u[0][x]=e,u[1][x]=t,u[0][x+1]=a,u[1][x+1]=s,u[0].length=u[1].length=x+2,{x0:pi(...u[0]),y0:pi(...u[1]),x1:fi(...u[0]),y1:fi(...u[1])}}function Bh(e){if(f1(e)||(e=o1(e)),s1(e))return e;for(var t=c1(d1(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(f,d,h){var m,g;if(!f)return["C",d.x,d.y,d.x,d.y,d.x,d.y];switch(!(f[0]in{T:1,Q:1})&&(d.qx=d.qy=null),f[0]){case"M":d.X=f[1],d.Y=f[2];break;case"A":f=["C",...Nh(d.x,d.y,...f.slice(1))];break;case"S":h=="C"||h=="S"?(m=d.x*2-d.bx,g=d.y*2-d.by):(m=d.x,g=d.y),f=["C",m,g,...f.slice(1)];break;case"T":h=="Q"||h=="T"?(d.qx=d.x*2-d.qx,d.qy=d.y*2-d.qy):(d.qx=d.x,d.qy=d.y),f=["C",...Ih(d.x,d.y,d.qx,d.qy,f[1],f[2])];break;case"Q":d.qx=f[1],d.qy=f[2],f=["C",...Ih(d.x,d.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...Es(d.x,d.y,f[1],f[2])];break;case"H":f=["C",...Es(d.x,d.y,f[1],d.y)];break;case"V":f=["C",...Es(d.x,d.y,d.x,f[1])];break;case"Z":f=["C",...Es(d.x,d.y,d.X,d.Y)];break}return f},r=function(f,d){if(f[d].length>7){f[d].shift();for(var h=f[d];h.length;)o[d]="A",f.splice(d++,0,["C",...h.splice(0,6)]);f.splice(d,1),u=t.length}},o=[],a="",s="",c=0,u=t.length;c<u;c++){t[c]&&(a=t[c][0]),a!="C"&&(o[c]=a,c&&(s=o[c-1])),t[c]=i(t[c],n,s),o[c]!="A"&&a=="C"&&(o[c]="C"),r(t,c);var l=t[c],p=l.length;n.x=l[p-2],n.y=l[p-1],n.bx=Ch(l[p-4])||n.x,n.by=Ch(l[p-3])||n.y}return t}function it(e){return Gt(e)&&En(e,"waypoints")}function Me(e){return Gt(e)&&En(e,"labelTarget")}function m1(e){return Gt(e)&&Xr(e.parent)}function $h(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function Ti(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function ye(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Ss(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function g1(e){return Ti({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function y1(e){for(var t=e.waypoints,n=t.reduce(function(u,l,p){var f=t[p-1];if(f){var d=u[u.length-1],h=d&&d.endLength||0,m=b1(f,l);u.push({start:f,end:l,startLength:h,endLength:h+m,length:m})}return u},[]),i=n.reduce(function(u,l){return u+l.length},0),r=i/2,o=0,a=n[o];a.endLength<r;)a=n[++o];var s=(r-a.startLength)/a.length,c={x:a.start.x+(a.end.x-a.start.x)*s,y:a.start.y+(a.end.y-a.start.y)*s};return c}function be(e){return it(e)?y1(e):g1(e)}function Zt(e,t,n){n=n||0,Gt(n)||(n={x:n,y:n});var i=ye(e),r=ye(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 Jo(e,t,n){var i=v1(e,t);return i.length===1||i.length===2&&Qo(i[0],i[1])<1?Ti(i[0]):i.length>1?(i=oi(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),Ti(i[n?0:i.length-1])):null}function v1(e,t){return Oh(e,t)}function _1(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],Qo(n,r)===0||al(i,r,n)?e.splice(t,1):t++;return e}function b1(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Rs(e,t){return Math.round(e*t)/t}function jh(e){return we(e)?e+"px":e}function x1(e){for(;e.parent;)e=e.parent;return e}function w1(e){e=O({},{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:jh(e.width),height:jh(e.height)}),t.appendChild(n),n}function Fh(e,t,n){const i=me("g");je(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const E1="base",Hh=0,S1=1,R1={shape:["x","y","width","height"],connection:["waypoints"]};function xe(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||{})}xe.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],xe.prototype._init=function(e){const t=this._eventBus,n=this._container=w1(e),i=this._svg=me("svg");re(i,{width:"100%",height:"100%"}),an(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")}),Re(n,i);const r=this._viewport=Fh(i,"viewport");e.deferUpdate&&(this._viewboxChanged=Ru(this._viewboxChanged,300)),this._restoreFocus=Ru(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)},xe.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},xe.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},xe.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=Eh(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},xe.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},xe.prototype.restoreFocus=function(){this._restoreFocus()},xe.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},xe.prototype.isFocused=function(){return this._focused},xe.prototype.getDefaultLayer=function(){return this.getLayer(E1,Hh)},xe.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},xe.prototype._getChildIndex=function(e){return Sn(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},xe.prototype._createLayer=function(e,t){typeof t>"u"&&(t=S1);const n=this._getChildIndex(t);return{group:Fh(this._viewport,"layer-"+e,n),index:t,visible:!0}},xe.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},xe.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},xe.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],Ft(t.group))},xe.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},xe.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(x1(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},xe.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},xe.prototype._findPlaneForRoot=function(e){return st(this._planes,function(t){return t.rootElement===e})},xe.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},xe.prototype._resolveElements=function(e){return _e(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},xe.prototype.getContainer=function(){return this._container},xe.prototype._updateMarker=function(e,t,n){let i;e=this._resolveElement(e),e.markers=e.markers||new Set,i=this._elementRegistry._elements[e.id],i&&(M([i.gfx,i.secondaryGfx],function(r){r&&(n?(e.markers.add(t),je(r).add(t)):(e.markers.delete(t),je(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},xe.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},xe.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},xe.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},xe.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},xe.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},xe.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,Hh);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},xe.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},xe.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},xe.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)},xe.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})},xe.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})},xe.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=R1[e];if(!Rr(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},xe.prototype._setParent=function(e,t,n){St(t.children,e,n),e.parent=t},xe.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},xe.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},xe.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},xe.prototype._removeElement=function(e,t){const n=this._elementRegistry,i=this._graphicsFactory,r=this._eventBus;if(e=n.get(e.id||e),!!e)return r.fire(t+".remove",{element:e}),i.remove(e),wt(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},xe.prototype.removeShape=function(e){return this._removeElement(e,"shape")},xe.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},xe.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},xe.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},xe.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},xe.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);qo(t,l)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=qo(t),r=a?a.matrix:ME(),s=Rs(r.a,1e3),c=Rs(-r.e||0,1e3),u=Rs(-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},xe.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=O({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),zh(t,n)}),{x:n.e,y:n.f}},xe.prototype.scrollToElement=function(e,t){let n=100;const i=this._resolveElements(e);if(!i.length)return;const r=this.findRoot(i);if(!r)return;r!==this.getRootElement()&&this.setRootElement(r);const o=i.filter(h=>h!=r);if(!o.length)return;t||(t={}),typeof t=="number"&&(n=t),t={top:t.top||n,right:t.right||n,bottom:t.bottom||n,left:t.left||n};const a=At(o),s=ye(a),c=this.viewbox(),u=this.zoom();let l,p;c.y+=t.top/u,c.x+=t.left/u,c.width-=(t.right+t.left)/u,c.height-=(t.bottom+t.top)/u;const f=ye(c);if(!(a.width<c.width&&a.height<c.height))l=a.x-c.x,p=a.y-c.y;else{const h=Math.max(0,s.right-f.right),m=Math.min(0,s.left-f.left),g=Math.max(0,s.bottom-f.bottom),R=Math.min(0,s.top-f.top);l=h||m,p=g||R}this.scroll({dx:-l*u,dy:-p*u})},xe.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)}),Rs(i.a,1e3)};function zh(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}xe.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},xe.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,r=n.createSVGMatrix(),o=n.createSVGPoint();let a,s,c,u,l;c=i.getCTM();const p=c.a;return t?(a=O(o,t),s=a.matrixTransform(c.inverse()),u=r.translate(s.x,s.y).scale(1/p*e).translate(-s.x,-s.y),l=c.multiply(u)):l=r.scale(e),zh(this._viewport,l),l},xe.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},xe.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}},xe.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var so="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),re(t,so,i),n&&re(n,so,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&&(re(i.gfx,so,""),i.secondaryGfx&&re(i.secondaryGfx,so,""),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&&re(t,so,i),t},Bn.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&re(e,so);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 C1(e,t,n,i){var r=n.inverse;return Object.defineProperty(e,"remove",{value:function(o){var a=this.indexOf(o);return a!==-1&&(this.splice(a,1),t.unset(o,r,i)),o}}),Object.defineProperty(e,"contains",{value:function(o){return this.indexOf(o)!==-1}}),Object.defineProperty(e,"add",{value:function(o,a){var s=this.indexOf(o);if(typeof a>"u"){if(s!==-1)return;a=this.length}s!==-1&&this.splice(s,1),this.splice(a,0,o),s===-1&&t.set(o,r,i)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e}function P1(e){return e.__refs_collection===!0}function A1(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function Vh(e,t,n){var i=C1(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 T1(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 Vn(e,t){if(!(this instanceof Vn))return new Vn(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Vn.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?Vh(this,t,e):T1(this,t,e)},Vn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return P1(n)||Vh(this,t,e),n},Vn.prototype.ensureBound=function(e,t){A1(e,t)||this.bind(e,t)},Vn.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Vn.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var ll=new Vn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Gh=new Vn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Wh=new Vn({name:"attachers",collection:!0},{name:"host"}),Uh=new Vn({name:"outgoing",collection:!0},{name:"source"}),Yh=new Vn({name:"incoming",collection:!0},{name:"target"});function co(){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)}}),ll.bind(this,"parent"),Gh.bind(this,"labels"),Uh.bind(this,"outgoing"),Yh.bind(this,"incoming")}function ea(){co.call(this),ll.bind(this,"children"),Wh.bind(this,"host"),Wh.bind(this,"attachers")}ie(ea,co);function qh(){co.call(this),ll.bind(this,"children")}ie(qh,ea);function Kh(){ea.call(this),Gh.bind(this,"labelTarget")}ie(Kh,ea);function Xh(){co.call(this),Uh.bind(this,"source"),Yh.bind(this,"target")}ie(Xh,co);var M1={connection:Xh,shape:ea,label:Kh,root:qh};function k1(e,t){var n=M1[e];if(!n)throw new Error("unknown type: <"+e+">");return O(new n,t)}function D1(e){return e instanceof co}function Mi(){this._uid=12}Mi.prototype.createRoot=function(e){return this.create("root",e)},Mi.prototype.createLabel=function(e){return this.create("label",e)},Mi.prototype.createShape=function(e){return this.create("shape",e)},Mi.prototype.createConnection=function(e){return this.create("connection",e)},Mi.prototype.create=function(e,t){return t=O({},t||{}),t.id||(t.id=e+"_"+this._uid++),k1(e,t)};var Cs="__fn",Zh=1e3,O1=Array.prototype.slice;function Pn(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}Pn.prototype.on=function(e,t,n,i){if(e=_e(e)?e:[e],Wt(t)&&(i=n,n=t,t=Zh),!we(t))throw new Error("priority must be a number");var r=n;i&&(r=vn(n,i),r[Cs]=n[Cs]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},Pn.prototype.once=function(e,t,n,i){var r=this;if(Wt(t)&&(i=n,n=t,t=Zh),!we(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[Cs]=n,this.on(e,t,o)},Pn.prototype.off=function(e,t){e=_e(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},Pn.prototype.createEvent=function(e){var t=new ta;return t.init(e),t},Pn.prototype.fire=function(e,t){var n,i,r,o;if(o=O1.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 ta?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}},Pn.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},Pn.prototype._destroy=function(){this._listeners={}},Pn.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},Pn.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=L1(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},Pn.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},Pn.prototype._getListeners=function(e){return this._listeners[e]},Pn.prototype._setListeners=function(e,t){this._listeners[e]=t},Pn.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[Cs]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function ta(){}ta.prototype.stopPropagation=function(){this.cancelBubble=!0},ta.prototype.preventDefault=function(){this.defaultPrevented=!0},ta.prototype.init=function(e){O(this,e||{})};function L1(e,t){return e.apply(null,t)}function Lr(e){return e.childNodes[0]}function I1(e){return e.parentNode.childNodes[1]}function Ps(e,t,n,i,r){var o=Yo();o.setTranslate(t,n);var a=Yo();a.setRotate(i||0,0,0);var s=Yo();s.setScale(1,1),qo(e,[o,a,s])}function Qt(e,t,n){var i=Yo();i.setTranslate(t,n),qo(e,i)}function Qh(e,t){var n=Yo();n.setRotate(t,0,0),qo(e,n)}function $n(e,t){this._eventBus=e,this._elementRegistry=t}$n.$inject=["eventBus","elementRegistry"],$n.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=I1(t),n||(n=me("g"),je(n).add("djs-children"),Re(t.parentNode,n))):n=t,n},$n.prototype._clear=function(e){var t=Lr(e);return ms(t),t},$n.prototype._createContainer=function(e,t,n,i){var r=me("g");je(r).add("djs-group"),typeof n<"u"?N1(r,t,t.childNodes[n]):Re(t,r);var o=me("g");je(o).add("djs-element"),je(o).add("djs-"+e),i&&je(o).add("djs-frame"),Re(r,o);var a=me("g");return je(a).add("djs-visual"),Re(o,a),o},$n.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,Sh(t))},$n.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=Sn(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),M(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r),s=a.firstChild;M(o,function(c){var u=n.getGraphics(c).parentNode;u===s?s=s.nextSibling:a.insertBefore(u,s)})}})},$n.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},$n.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},$n.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},$n.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},$n.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),Qt(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?re(n,"display","none"):re(n,"display","block")}},$n.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);Ft(t.parentNode)};function N1(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const B1={__depends__:[XE],__init__:["canvas"],canvas:["type",xe],elementRegistry:["type",Bn],elementFactory:["type",Mi],eventBus:["type",Pn],graphicsFactory:["type",$n]};function $1(e){var t=new wh(e);return t.init(),t}function j1(e){e=e||{};var t={config:["value",e]},n=[t,B1].concat(e.modules||[]);return $1(n)}function tr(e,t){this._injector=t||j1(e),this.get("eventBus").fire("diagram.init")}tr.prototype.get=function(e,t){return this._injector.get(e,t)},tr.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},tr.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},tr.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function sn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function _n(e,t){return e.$instanceOf(t)}function F1(e){return st(e.rootElements,function(t){return _n(t,"bpmn:Process")||_n(t,"bpmn:Collaboration")})}function H1(e){var t={},n=[],i={};function r(F,$){return function(U){F(U,$)}}function o(F){t[F.id]=F}function a(F){return t[F.id]}function s(F,$){var U=F.gfx;if(U)throw new Error(`already rendered ${sn(F)}`);return e.element(F,i[F.id],$)}function c(F,$){return e.root(F,i[F.id],$)}function u(F,$){try{var U=i[F.id]&&s(F,$);return o(F),U}catch(ke){l(ke.message,{element:F,error:ke}),console.error(`failed to import ${sn(F)}`,ke)}}function l(F,$){e.error(F,$)}var p=this.registerDi=function($){var U=$.bpmnElement;U?i[U.id]?l(`multiple DI elements defined for ${sn(U)}`,{element:U}):i[U.id]=$:l(`no bpmnElement referenced in ${sn($)}`,{element:$})};function f(F){d(F.plane)}function d(F){p(F),M(F.planeElement,h)}function h(F){p(F)}this.handleDefinitions=function($,U){var ke=$.diagrams;if(U&&ke.indexOf(U)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!U&&ke&&ke.length&&(U=ke[0]),!U)throw new Error("no diagram to display");i={},f(U);var Lt=U.plane;if(!Lt)throw new Error(`no plane for ${sn(U)}`);var C=Lt.bpmnElement;if(!C)if(C=F1($),C)l(`correcting missing bpmnElement on ${sn(Lt)} to ${sn(C)}`),Lt.bpmnElement=C,p(Lt);else throw new Error("no process or collaboration to display");var _=c(C,Lt);if(_n(C,"bpmn:Process")||_n(C,"bpmn:SubProcess"))g(C,_);else if(_n(C,"bpmn:Collaboration"))ce(C,_),R($.rootElements,_);else throw new Error(`unsupported bpmnElement for ${sn(Lt)}: ${sn(C)}`);m(n)};var m=this.handleDeferred=function(){for(var $;n.length;)$=n.shift(),$()};function g(F,$){de(F,$),j(F.ioSpecification,$),A(F.artifacts,$),o(F)}function R(F,$){var U=Oe(F,function(ke){return!a(ke)&&_n(ke,"bpmn:Process")&&ke.laneSets});U.forEach(r(g,$))}function w(F,$){u(F,$)}function b(F,$){M(F,r(w,$))}function x(F,$){u(F,$)}function E(F,$){u(F,$)}function T(F,$){u(F,$)}function L(F,$){u(F,$)}function A(F,$){M(F,function(U){_n(U,"bpmn:Association")?n.push(function(){L(U,$)}):L(U,$)})}function j(F,$){F&&(M(F.dataInputs,r(E,$)),M(F.dataOutputs,r(T,$)))}var H=this.handleSubProcess=function($,U){de($,U),A($.artifacts,U)};function N(F,$){var U=u(F,$);_n(F,"bpmn:SubProcess")&&H(F,U||$),_n(F,"bpmn:Activity")&&j(F.ioSpecification,$),n.push(function(){M(F.dataInputAssociations,r(x,$)),M(F.dataOutputAssociations,r(x,$))})}function G(F,$){u(F,$)}function fe(F,$){u(F,$)}function Fe(F,$){n.push(function(){var U=u(F,$);F.childLaneSet&&lt(F.childLaneSet,U||$),ee(F)})}function lt(F,$){M(F.lanes,r(Fe,$))}function Y(F,$){M(F,r(lt,$))}function de(F,$){he(F.flowElements,$),F.laneSets&&Y(F.laneSets,$)}function he(F,$){M(F,function(U){_n(U,"bpmn:SequenceFlow")?n.push(function(){G(U,$)}):_n(U,"bpmn:BoundaryEvent")?n.unshift(function(){N(U,$)}):_n(U,"bpmn:FlowNode")?N(U,$):_n(U,"bpmn:DataObject")||(_n(U,"bpmn:DataStoreReference")||_n(U,"bpmn:DataObjectReference")?fe(U,$):l(`unrecognized flowElement ${sn(U)} in context ${sn($&&$.businessObject)}`,{element:U,context:$}))})}function se(F,$){var U=u(F,$),ke=F.processRef;ke&&g(ke,U||$)}function ce(F,$){M(F.participants,r(se,$)),n.push(function(){b(F.messageFlows,$)}),A(F.artifacts,$)}function ee(F){M(F.flowNodeRef,function($){var U=$.get("lanes");U&&U.push(F)})}}function v(e,t){var n=Z(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function De(e,t){return Vi(t,function(n){return v(e,n)})}function Z(e){return e&&e.businessObject||e}function Ve(e){return e&&e.di}function z1(e,t,n){var i,r,o,a,s=[];function c(u,l){var p={root:function(m,g){return i.add(m,g)},element:function(m,g,R){return i.add(m,g,R)},error:function(m,g){s.push({message:m,context:g})}},f=new H1(p);l=l||u.diagrams&&u.diagrams[0];var d=V1(u,l);if(!d)throw new Error("no diagram to display");M(d,function(m){f.handleDefinitions(u,m)});var h=l.plane.bpmnElement.id;o.setRootElement(o.findRoot(h+"_plane")||o.findRoot(h))}return new Promise(function(u,l){try{return i=e.get("bpmnImporter"),r=e.get("eventBus"),o=e.get("canvas"),r.fire("import.render.start",{definitions:t}),c(t,n),r.fire("import.render.complete",{error:a,warnings:s}),u({warnings:s})}catch(p){return p.warnings=s,l(p)}})}function V1(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!v(n,"bpmn:Process")&&!v(n,"bpmn:Collaboration")&&(i=G1(n));var r;v(i,"bpmn:Collaboration")?r=i:r=st(e.rootElements,function(u){if(v(u,"bpmn:Collaboration"))return st(u.participants,function(l){return l.processRef===i})});var o=[i];r&&(o=rn(r.participants,function(u){return u.processRef}),o.push(r));var a=Jh(o),s=[t],c=[n];return M(e.diagrams,function(u){if(u.plane){var l=u.plane.bpmnElement;a.indexOf(l)!==-1&&c.indexOf(l)===-1&&(s.push(u),c.push(l))}}),s}}function Jh(e){var t=[];return M(e,function(n){n&&(t.push(n),t=t.concat(Jh(n.flowElements)))}),t}function G1(e){for(var t=e;t;){if(v(t,"bpmn:Process"))return t;t=t.$parent}}var W1='<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>',em=W1,tm={verticalAlign:"middle"},nm={color:"#404040"},U1={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},Y1={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},q1={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"},K1='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+em+'</a><span>Web-based tooling for BPMN, DMN and forms powered by <a href="https://bpmn.io" target="_blank" rel="noopener">bpmn.io</a>.</span></div></div>',di;function X1(){di=ut(K1),mn(di,U1),mn(et("svg",di),tm),mn(et(".backdrop",di),Y1),mn(et(".notice",di),q1),mn(et(".link",di),nm,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function Z1(){di||(X1(),Cn.bind(di,".backdrop","click",function(e){document.body.removeChild(di)})),document.body.appendChild(di)}const As=5,im="djs-outline-hidden";function yt(e){e=O({},J1,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),tS(this._container)}ie(yt,tr),yt.prototype.importXML=async function(t,n){const i=this;function r(a){return i.get("eventBus").createEvent(a)}let o=[];try{t=this._emit("import.parse.start",{xml:t})||t;let a;try{a=await this._moddle.fromXML(t,"bpmn:Definitions")}catch(f){throw this._emit("import.parse.complete",{error:f}),f}let s=a.rootElement;const c=a.references,u=a.warnings,l=a.elementsById;o=o.concat(u),s=this._emit("import.parse.complete",r({error:null,definitions:s,elementsById:l,references:c,warnings:o}))||s;const p=await this.importDefinitions(s,n);return o=o.concat(p.warnings),this._emit("import.done",{error:null,warnings:o}),{warnings:o}}catch(a){let s=a;throw o=o.concat(s.warnings||[]),Ts(s,o),s=Q1(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},yt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},yt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw Ts(o,[]),o}if(typeof t=="string"&&(i=eS(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw Ts(o,[]),o}try{this.clear()}catch(o){throw Ts(o,[]),o}const{warnings:r}=await z1(this,n,i);return{warnings:r}},yt.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},yt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=et(":scope > defs",i._svg),a=xh(r),s=o?"<defs>"+xh(o)+"</defs>":"",c=i.getContainer();mt(c).add(im);let u;try{u=r.getBBox()}finally{mt(c).remove(im)}const l=u.x-As,p=u.y-As,f=u.width+As*2,d=u.height+As*2;t=`<?xml version="1.0" encoding="utf-8"?>
8
8
  <!-- created with bpmn-js / http://bpmn.io -->
9
9
  <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
10
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="`+f+'" height="'+d+'" viewBox="'+l+" "+p+" "+f+" "+d+'" version="1.1">'+c+a+"</svg>"}catch(i){n=i}if(this._emit("saveSVG.done",{error:n,svg:t}),n)throw n;return{svg:t}},yt.prototype._setDefinitions=function(e){this._definitions=e},yt.prototype.getModules=function(){return this._modules},yt.prototype.clear=function(){this.getDefinitions()&&tr.prototype.clear.call(this)},yt.prototype.destroy=function(){tr.prototype.destroy.call(this),li(this._container)},yt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},yt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},yt.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),typeof e=="string"&&(e=et(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},yt.prototype.getDefinitions=function(){return this._definitions},yt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},yt.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),c=O(ai(n,["additionalModules"]),{canvas:O({},n.canvas,{container:e}),modules:a});tr.call(this,c),n&&n.container&&this.attachTo(n.container)},yt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},yt.prototype._createContainer=function(e){const t=ut('<div class="bjs-container"></div>');return mn(t,{width:nm(e.width),height:nm(e.height),position:e.position}),t},yt.prototype._createModdle=function(e){const t=O({},this._moddleExtensions,e.moddleExtensions);return new cd(t)},yt.prototype._modules=[];function Ts(e,t){return e.warnings=t,e}function K1(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 X1={width:"100%",height:"100%",position:"relative"};function nm(e){return e+(we(e)?"px":"")}function Z1(e,t){return t&&st(e.diagrams,function(n){return n.id===t})||null}function Q1(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Qh+"</a>",i=ut(n);mn(et("svg",i),Jh),mn(i,em,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),Se.bind(i,"click",function(r){q1(),r.preventDefault()})}function so(e){yt.call(this,e),this.on("import.parse.complete",function(t){t.error||this._collectIds(t.definitions,t.elementsById)},this),this.on("diagram.destroy",function(){this.get("moddle").ids.clear()},this)}ie(so,yt),so.prototype._createModdle=function(e){var t=yt.prototype._createModdle.call(this,e);return t.ids=new ui([32,36,1]),t},so.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 $e(e,t){return v(e,"bpmn:CallActivity")?!1:v(e,"bpmn:SubProcess")?(t=t||Ve(e),t&&v(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):v(e,"bpmn:Participant")?!!Z(e).processRef:!0}function Yt(e){if(!(!v(e,"bpmn:Participant")&&!v(e,"bpmn:Lane"))){var t=Ve(e).isHorizontal;return t===void 0?!0:t}}function J1(e){return e&&Z(e).isInterrupting!==!1}function cn(e){return e&&!!Z(e).triggeredByEvent}function co(e,t){var n=Z(e).eventDefinitions;return Vi(n,function(i){return v(i,t)})}function eS(e){return co(e,"bpmn:ErrorEventDefinition")}function tS(e){return co(e,"bpmn:EscalationEventDefinition")}function nS(e){return co(e,"bpmn:CompensateEventDefinition")}var Ir={width:90,height:20},im=15;function nr(e){return v(e,"bpmn:Event")||v(e,"bpmn:Gateway")||v(e,"bpmn:DataStoreReference")||v(e,"bpmn:DataObjectReference")||v(e,"bpmn:DataInput")||v(e,"bpmn:DataOutput")||v(e,"bpmn:SequenceFlow")||v(e,"bpmn:MessageFlow")||v(e,"bpmn:Group")}function Ms(e){return Me(e.label)}function iS(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=rS(e),o=Math.atan((i.y-n.y)/(i.x-n.x)),a=r.x,c=r.y;return Math.abs(o)<Math.PI/2?c-=im:a+=im,{x:a,y:c}}function rS(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 ul(e){return e.waypoints?iS(e.waypoints):v(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 oS(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=ul(t),i=Ir),O({x:n.x-i.width/2,y:n.y-i.height/2},i)}function rm(e){if(v(e,"bpmn:FlowElement")||v(e,"bpmn:Participant")||v(e,"bpmn:Lane")||v(e,"bpmn:SequenceFlow")||v(e,"bpmn:MessageFlow")||v(e,"bpmn:DataInput")||v(e,"bpmn:DataOutput"))return"name";if(v(e,"bpmn:TextAnnotation"))return"text";if(v(e,"bpmn:Group"))return"categoryValueRef"}function aS(e){var t=e.categoryValueRef;return t&&t.value||""}function jn(e){var t=e.businessObject,n=rm(t);if(n)return n==="categoryValueRef"?aS(t):t[n]||""}function sS(e,t){var n=e.businessObject,i=rm(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function cS(e){return Me(e)&&nr(e.labelTarget)}var uo=7;function om(e){let t=[];return M(e.incoming,n=>{v(n,"bpmn:Association")&&v(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),M(e.outgoing,n=>{v(n,"bpmn:Association")&&v(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function ta(e){const t=new Map;return M(nl(e),n=>{M(om(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 ll="hsl(225, 10%, 15%)",uS="white";function hi(e,t){return Vi(e.eventDefinitions,function(n){return n.$type===t})}function lS(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function pS(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function Ie(e,t,n){var i=Ve(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||uS}function te(e,t,n){var i=Ve(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||ll}function na(e,t,n,i){var r=Ve(e),o=r.get("label");return i||o&&o.get("color:color")||t||te(e,n)}function am(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 Dr(r)}function pl(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 Dr(a)}function fS(e){var t=e.width,n=e.height,i=e.x,r=e.y,o=t/2,a=n/2,c=[["M",i+o,r],["l",o,a],["l",-o,a],["l",-o,-a],["z"]];return Dr(c)}function dS(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 Dr(o)}function ia(e,t={}){return{width:Gn(e,t),height:Pn(e,t)}}function Gn(e,t={}){return wn(t,"width")?t.width:e.width}function Pn(e,t={}){return wn(t,"height")?t.height:e.height}var hS=new ui,mS=10,ks=3,gS=1.5,Ds=10,yS=4,lo=.95,vS=1,_S=.25;function Nr(e,t,n,i,r,o,a){Pi.call(this,t,a);var c=e&&e.defaultFillColor,s=e&&e.defaultStrokeColor,u=e&&e.defaultLabelColor;function l(C){return n.computeStyle(C,{strokeLinecap:"round",strokeLinejoin:"round",stroke:ll,strokeWidth:2,fill:"white"})}function p(C){return n.computeStyle(C,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:ll,strokeWidth:2})}function f(C,_){var{ref:y={x:0,y:0},scale:D=1,element:I,parentGfx:W=r._svg}=_,oe=me("marker",{id:C,viewBox:"0 0 20 20",refX:y.x,refY:y.y,markerWidth:20*D,markerHeight:20*D,orient:"auto"});Re(oe,I);var Pe=et(":scope > defs",W);Pe||(Pe=me("defs"),Re(W,Pe)),Re(Pe,oe)}function d(C,_,y,D){var I=hS.nextPrefixed("marker-");return h(C,I,_,y,D),"url(#"+I+")"}function h(C,_,y,D,I){if(y==="sequenceflow-end"){var W=me("path",{d:"M 1 5 L 11 10 L 1 15 Z",...l({fill:I,stroke:I,strokeWidth:1})});f(_,{element:W,ref:{x:11,y:10},scale:.5,parentGfx:C})}if(y==="messageflow-start"){var oe=me("circle",{cx:6,cy:6,r:3.5,...l({fill:D,stroke:I,strokeWidth:1,strokeDasharray:[1e4,1]})});f(_,{element:oe,ref:{x:6,y:6},parentGfx:C})}if(y==="messageflow-end"){var Pe=me("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...l({fill:D,stroke:I,strokeWidth:1,strokeDasharray:[1e4,1]})});f(_,{element:Pe,ref:{x:8.5,y:5},parentGfx:C})}if(y==="association-start"){var Ue=me("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:I,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(_,{element:Ue,ref:{x:1,y:10},scale:.5,parentGfx:C})}if(y==="association-end"){var ft=me("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:I,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(_,{element:ft,ref:{x:11,y:10},scale:.5,parentGfx:C})}if(y==="conditional-flow-marker"){var tt=me("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...l({fill:D,stroke:I})});f(_,{element:tt,ref:{x:-1,y:10},scale:.5,parentGfx:C})}if(y==="conditional-default-flow-marker"){var It=me("path",{d:"M 6 4 L 10 16",...l({stroke:I,fill:"none"})});f(_,{element:It,ref:{x:0,y:10},scale:.5,parentGfx:C})}}function m(C,_,y,D,I={}){Gt(D)&&(I=D,D=0),D=D||0,I=l(I);var W=_/2,oe=y/2,Pe=me("circle",{cx:W,cy:oe,r:Math.round((_+y)/4-D),...I});return Re(C,Pe),Pe}function g(C,_,y,D,I,W){Gt(I)&&(W=I,I=0),I=I||0,W=l(W);var oe=me("rect",{x:I,y:I,width:_-I*2,height:y-I*2,rx:D,ry:D,...W});return Re(C,oe),oe}function R(C,_,y,D){var I=_/2,W=y/2,oe=[{x:I,y:0},{x:_,y:W},{x:I,y},{x:0,y:W}],Pe=oe.map(function(ft){return ft.x+","+ft.y}).join(" ");D=l(D);var Ue=me("polygon",{...D,points:Pe});return Re(C,Ue),Ue}function w(C,_,y,D){y=p(y);var I=qo(_,y,D);return Re(C,I),I}function x(C,_,y){return w(C,_,y,5)}function b(C,_,y){y=p(y);var D=me("path",{...y,d:_});return Re(C,D),D}function E(C,_,y,D){return b(_,y,O({"data-marker":C},D))}function T(C){return Lt[C]}function L(C){return function(_,y,D){return T(C)(_,y,D)}}var A={"bpmn:MessageEventDefinition":function(C,_,y={},D){var I=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.235,my:.315}}),W=D?te(_,s,y.stroke):Ie(_,c,y.fill),oe=D?Ie(_,c,y.fill):te(_,s,y.stroke),Pe=b(C,I,{fill:W,stroke:oe,strokeWidth:1});return Pe},"bpmn:TimerEventDefinition":function(C,_,y={}){var D=y.width||_.width,I=y.height||_.height,W=y.width?1:2,oe=m(C,D,I,.2*I,{fill:Ie(_,c,y.fill),stroke:te(_,s,y.stroke),strokeWidth:W}),Pe=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:D,containerHeight:I,position:{mx:.5,my:.5}});b(C,Pe,{stroke:te(_,s,y.stroke),strokeWidth:W});for(var Ue=0;Ue<12;Ue++){var ft=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:D,containerHeight:I,position:{mx:.5,my:.5}}),tt=D/2,It=I/2;b(C,ft,{strokeWidth:1,stroke:te(_,s,y.stroke),transform:"rotate("+Ue*30+","+It+","+tt+")"})}return oe},"bpmn:EscalationEventDefinition":function(C,_,y={},D){var I=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.5,my:.2}}),W=D?te(_,s,y.stroke):Ie(_,c,y.fill);return b(C,I,{fill:W,stroke:te(_,s,y.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(C,_,y={}){var D=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.5,my:.222}});return b(C,D,{fill:Ie(_,c,y.fill),stroke:te(_,s,y.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(C,_,y={},D){var I=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.57,my:.263}}),W=D?te(_,s,y.stroke):Ie(_,c,y.fill);return b(C,I,{fill:W,stroke:te(_,s,y.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(C,_,y={},D){var I=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.2,my:.722}}),W=D?te(_,s,y.stroke):Ie(_,c,y.fill);return b(C,I,{fill:W,stroke:te(_,s,y.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(C,_,y={},D){var I=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.638,my:-.055}}),W=D?te(_,s,y.stroke):"none",oe=b(C,I,{fill:W,stroke:te(_,s,y.stroke),strokeWidth:1});return Xh(oe,45),oe},"bpmn:CompensateEventDefinition":function(C,_,y={},D){var I=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.22,my:.5}}),W=D?te(_,s,y.stroke):Ie(_,c,y.fill);return b(C,I,{fill:W,stroke:te(_,s,y.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(C,_,y={},D){var I=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.5,my:.2}}),W=D?te(_,s,y.stroke):Ie(_,c,y.fill);return b(C,I,{strokeWidth:1,fill:W,stroke:te(_,s,y.stroke)})},"bpmn:MultipleEventDefinition":function(C,_,y={},D){var I=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.211,my:.36}}),W=D?te(_,s,y.stroke):Ie(_,c,y.fill);return b(C,I,{fill:W,stroke:te(_,s,y.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(C,_,y={}){var D=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.458,my:.194}});return b(C,D,{fill:Ie(_,c,y.fill),stroke:te(_,s,y.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(C,_,y={}){var D=m(C,_.width,_.height,8,{fill:te(_,s,y.stroke),stroke:te(_,s,y.stroke),strokeWidth:4});return D}};function F(C,_,y={},D){var I=Z(C),W=lS(I),oe=D||C;return I.get("eventDefinitions")&&I.get("eventDefinitions").length>1?I.get("parallelMultiple")?A["bpmn:ParallelMultipleEventDefinition"](_,oe,y,W):A["bpmn:MultipleEventDefinition"](_,oe,y,W):hi(I,"bpmn:MessageEventDefinition")?A["bpmn:MessageEventDefinition"](_,oe,y,W):hi(I,"bpmn:TimerEventDefinition")?A["bpmn:TimerEventDefinition"](_,oe,y,W):hi(I,"bpmn:ConditionalEventDefinition")?A["bpmn:ConditionalEventDefinition"](_,oe,y,W):hi(I,"bpmn:SignalEventDefinition")?A["bpmn:SignalEventDefinition"](_,oe,y,W):hi(I,"bpmn:EscalationEventDefinition")?A["bpmn:EscalationEventDefinition"](_,oe,y,W):hi(I,"bpmn:LinkEventDefinition")?A["bpmn:LinkEventDefinition"](_,oe,y,W):hi(I,"bpmn:ErrorEventDefinition")?A["bpmn:ErrorEventDefinition"](_,oe,y,W):hi(I,"bpmn:CancelEventDefinition")?A["bpmn:CancelEventDefinition"](_,oe,y,W):hi(I,"bpmn:CompensateEventDefinition")?A["bpmn:CompensateEventDefinition"](_,oe,y,W):hi(I,"bpmn:TerminateEventDefinition")?A["bpmn:TerminateEventDefinition"](_,oe,y,W):null}var H={ParticipantMultiplicityMarker:function(C,_,y={}){var D=Gn(_,y),I=Pn(_,y),W=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:I,position:{mx:(D/2-6)/D,my:(I-15)/I}});E("participant-multiplicity",C,W,{strokeWidth:2,fill:Ie(_,c,y.fill),stroke:te(_,s,y.stroke)})},SubProcessMarker:function(C,_,y={}){var D=g(C,14,14,0,{strokeWidth:1,fill:Ie(_,c,y.fill),stroke:te(_,s,y.stroke)});Qt(D,_.width/2-7.5,_.height-20);var I=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2-7.5)/_.width,my:(_.height-20)/_.height}});E("sub-process",C,I,{fill:Ie(_,c,y.fill),stroke:te(_,s,y.stroke)})},ParallelMarker:function(C,_,y){var D=Gn(_,y),I=Pn(_,y),W=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:I,position:{mx:(D/2+y.parallel)/D,my:(I-20)/I}});E("parallel",C,W,{fill:Ie(_,c,y.fill),stroke:te(_,s,y.stroke)})},SequentialMarker:function(C,_,y){var D=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2+y.seq)/_.width,my:(_.height-19)/_.height}});E("sequential",C,D,{fill:Ie(_,c,y.fill),stroke:te(_,s,y.stroke)})},CompensationMarker:function(C,_,y){var D=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2+y.compensation)/_.width,my:(_.height-13)/_.height}});E("compensation",C,D,{strokeWidth:1,fill:Ie(_,c,y.fill),stroke:te(_,s,y.stroke)})},LoopMarker:function(C,_,y){var D=Gn(_,y),I=Pn(_,y),W=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:I,position:{mx:(D/2+y.loop)/D,my:(I-7)/I}});E("loop",C,W,{strokeWidth:1.5,fill:"none",stroke:te(_,s,y.stroke),strokeMiterlimit:.5})},AdhocMarker:function(C,_,y){var D=Gn(_,y),I=Pn(_,y),W=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:I,position:{mx:(D/2+y.adhoc)/D,my:(I-15)/I}});E("adhoc",C,W,{strokeWidth:1,fill:te(_,s,y.stroke),stroke:te(_,s,y.stroke)})}};function N(C,_,y,D){H[C](_,y,D)}function V(C,_,y=[],D={}){D={fill:D.fill,stroke:D.stroke,width:Gn(_,D),height:Pn(_,D)};var I=Z(_),W=y.includes("SubProcessMarker");W?D={...D,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:D={...D,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},I.get("isForCompensation")&&y.push("CompensationMarker"),v(I,"bpmn:AdHocSubProcess")&&(y.push("AdhocMarker"),W||O(D,{compensation:D.compensation-18}));var oe=I.get("loopCharacteristics"),Pe=oe&&oe.get("isSequential");oe&&(O(D,{compensation:D.compensation-18}),y.includes("AdhocMarker")&&O(D,{seq:-23,loop:-18,parallel:-24}),Pe===void 0&&y.push("LoopMarker"),Pe===!1&&y.push("ParallelMarker"),Pe===!0&&y.push("SequentialMarker")),y.includes("CompensationMarker")&&y.length===1&&O(D,{compensation:-8}),M(y,function(Ue){N(Ue,C,_,D)})}function fe(C,_,y={}){y=O({size:{width:100}},y);var D=o.createText(_||"",y);return Fe(D).add("djs-label"),Re(C,D),D}function je(C,_,y,D={}){var I=Z(_),W=ia({x:_.x,y:_.y,width:_.width,height:_.height},D);return fe(C,I.name,{align:y,box:W,padding:7,style:{fill:na(_,u,s,D.stroke)}})}function lt(C,_,y={}){var D={width:_.width,height:_.height,x:_.width/2+_.x,y:_.height/2+_.y};return fe(C,jn(_),{box:D,style:O({},o.getExternalStyle(),{fill:na(_,u,s,y.stroke)})})}function q(C,_,y,D={}){var I=Yt(y),W=fe(C,_,{box:{height:30,width:I?Pn(y,D):Gn(y,D)},align:"center-middle",style:{fill:na(y,u,s,D.stroke)}});if(I){var oe=-1*Pn(y,D);Ps(W,0,-oe,270)}}function de(C,_,y={}){var{width:D,height:I}=ia(_,y);return g(C,D,I,Ds,{...y,fill:Ie(_,c,y.fill),fillOpacity:lo,stroke:te(_,s,y.stroke)})}function he(C,_,y={}){var D=Z(_),I=Ie(_,c,y.fill),W=te(_,s,y.stroke);return(D.get("associationDirection")==="One"||D.get("associationDirection")==="Both")&&(y.markerEnd=d(C,"association-end",I,W)),D.get("associationDirection")==="Both"&&(y.markerStart=d(C,"association-start",I,W)),y=Ge(y,["markerStart","markerEnd"]),x(C,_.waypoints,{...y,stroke:W,strokeDasharray:"0, 5"})}function ce(C,_,y={}){var D=Ie(_,c,y.fill),I=te(_,s,y.stroke),W=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}}),oe=b(C,W,{fill:D,fillOpacity:lo,stroke:I}),Pe=Z(_);if(pS(Pe)){var Ue=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.33,my:(_.height-18)/_.height}});b(C,Ue,{strokeWidth:2,fill:D,stroke:I})}return oe}function ue(C,_,y={}){return m(C,_.width,_.height,{fillOpacity:lo,...y,fill:Ie(_,c,y.fill),stroke:te(_,s,y.stroke)})}function ee(C,_,y={}){return R(C,_.width,_.height,{fill:Ie(_,c,y.fill),fillOpacity:lo,stroke:te(_,s,y.stroke)})}function j(C,_,y={}){var D=g(C,Gn(_,y),Pn(_,y),0,{fill:Ie(_,c,y.fill),fillOpacity:y.fillOpacity||lo,stroke:te(_,s,y.stroke),strokeWidth:1.5}),I=Z(_);if(v(I,"bpmn:Lane")){var W=I.get("name");q(C,W,_,y)}return D}function $(C,_,y={}){var D=de(C,_,y),I=$e(_);if(cn(_)&&(re(D,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!I)){var W=Z(_).flowElements||[],oe=W.filter(Pe=>v(Pe,"bpmn:StartEvent"));oe.length===1&&U(oe[0],C,y,_)}return je(C,_,I?"center-top":"center-middle",y),I?V(C,_,void 0,y):V(C,_,["SubProcessMarker"],y),D}function U(C,_,y,D){var I=22,W={fill:Ie(D,c,y.fill),stroke:te(D,s,y.stroke),width:I,height:I},oe=Z(C).isInterrupting,Pe=oe?0:3,Ue=oe?1:1.2,ft=20,tt=(I-ft)/2,It="translate("+tt+","+tt+")";m(_,ft,ft,{fill:W.fill,stroke:W.stroke,strokeWidth:Ue,strokeDasharray:Pe,transform:It}),F(C,_,W,D)}function ke(C,_,y={}){var D=de(C,_,y);return je(C,_,"center-middle",y),V(C,_,void 0,y),D}var Lt=this.handlers={"bpmn:AdHocSubProcess":function(C,_,y={}){return $e(_)?y=Ge(y,["fill","stroke","width","height"]):y=Ge(y,["fill","stroke"]),$(C,_,y)},"bpmn:Association":function(C,_,y={}){return y=Ge(y,["fill","stroke"]),he(C,_,y)},"bpmn:BoundaryEvent":function(C,_,y={}){var{renderIcon:D=!0}=y;y=Ge(y,["fill","stroke"]);var I=Z(_),W=I.get("cancelActivity");y={strokeWidth:1.5,fill:Ie(_,c,y.fill),fillOpacity:vS,stroke:te(_,s,y.stroke)},W||(y.strokeDasharray="6");var oe=ue(C,_,y);return m(C,_.width,_.height,ks,{...y,fill:"none"}),D&&F(_,C,y),oe},"bpmn:BusinessRuleTask":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=ke(C,_,y),I=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),W=b(C,I);re(W,{fill:Ie(_,c,y.fill),stroke:te(_,s,y.stroke),strokeWidth:1});var oe=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),Pe=b(C,oe);return re(Pe,{fill:te(_,s,y.stroke),stroke:te(_,s,y.stroke),strokeWidth:1}),D},"bpmn:CallActivity":function(C,_,y={}){return y=Ge(y,["fill","stroke"]),$(C,_,{strokeWidth:5,...y})},"bpmn:ComplexGateway":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=ee(C,_,y),I=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:_.width,containerHeight:_.height,position:{mx:.46,my:.26}});return b(C,I,{fill:te(_,s,y.stroke),stroke:te(_,s,y.stroke),strokeWidth:1}),D},"bpmn:DataInput":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=i.getRawPath("DATA_ARROW"),I=ce(C,_,y);return b(C,D,{fill:"none",stroke:te(_,s,y.stroke),strokeWidth:1}),I},"bpmn:DataInputAssociation":function(C,_,y={}){return y=Ge(y,["fill","stroke"]),he(C,_,{...y,markerEnd:d(C,"association-end",Ie(_,c,y.fill),te(_,s,y.stroke))})},"bpmn:DataObject":function(C,_,y={}){return y=Ge(y,["fill","stroke"]),ce(C,_,y)},"bpmn:DataObjectReference":L("bpmn:DataObject"),"bpmn:DataOutput":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=i.getRawPath("DATA_ARROW"),I=ce(C,_,y);return b(C,D,{strokeWidth:1,fill:te(_,s,y.stroke),stroke:te(_,s,y.stroke)}),I},"bpmn:DataOutputAssociation":function(C,_,y={}){return y=Ge(y,["fill","stroke"]),he(C,_,{...y,markerEnd:d(C,"association-end",Ie(_,c,y.fill),te(_,s,y.stroke))})},"bpmn:DataStoreReference":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:0,my:.133}});return b(C,D,{fill:Ie(_,c,y.fill),fillOpacity:lo,stroke:te(_,s,y.stroke),strokeWidth:2})},"bpmn:EndEvent":function(C,_,y={}){var{renderIcon:D=!0}=y;y=Ge(y,["fill","stroke"]);var I=ue(C,_,{...y,strokeWidth:4});return D&&F(_,C,y),I},"bpmn:EventBasedGateway":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=Z(_),I=ee(C,_,y);m(C,_.width,_.height,_.height*.2,{fill:Ie(_,"none",y.fill),stroke:te(_,s,y.stroke),strokeWidth:1});var W=D.get("eventGatewayType"),oe=!!D.get("instantiate");function Pe(){var ft=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:_.width,containerHeight:_.height,position:{mx:.36,my:.44}});b(C,ft,{fill:"none",stroke:te(_,s,y.stroke),strokeWidth:2})}if(W==="Parallel"){var Ue=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}});b(C,Ue,{fill:"none",stroke:te(_,s,y.stroke),strokeWidth:1})}else W==="Exclusive"&&(oe||m(C,_.width,_.height,_.height*.26,{fill:"none",stroke:te(_,s,y.stroke),strokeWidth:1}),Pe());return I},"bpmn:ExclusiveGateway":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=ee(C,_,y),I=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:_.width,containerHeight:_.height,position:{mx:.32,my:.3}}),W=Ve(_);return W.get("isMarkerVisible")&&b(C,I,{fill:te(_,s,y.stroke),stroke:te(_,s,y.stroke),strokeWidth:1}),D},"bpmn:Gateway":function(C,_,y={}){return y=Ge(y,["fill","stroke"]),ee(C,_,y)},"bpmn:Group":function(C,_,y={}){return y=Ge(y,["fill","stroke","width","height"]),g(C,_.width,_.height,Ds,{stroke:te(_,s,y.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:Gn(_,y),height:Pn(_,y)})},"bpmn:InclusiveGateway":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=ee(C,_,y);return m(C,_.width,_.height,_.height*.24,{fill:Ie(_,c,y.fill),stroke:te(_,s,y.stroke),strokeWidth:2.5}),D},"bpmn:IntermediateEvent":function(C,_,y={}){var{renderIcon:D=!0}=y;y=Ge(y,["fill","stroke"]);var I=ue(C,_,{...y,strokeWidth:1.5});return m(C,_.width,_.height,ks,{fill:"none",stroke:te(_,s,y.stroke),strokeWidth:1.5}),D&&F(_,C,y),I},"bpmn:IntermediateCatchEvent":L("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":L("bpmn:IntermediateEvent"),"bpmn:Lane":function(C,_,y={}){return y=Ge(y,["fill","stroke","width","height"]),j(C,_,{...y,fillOpacity:_S})},"bpmn:ManualTask":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=ke(C,_,y),I=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return b(C,I,{fill:Ie(_,c,y.fill),stroke:te(_,s,y.stroke),strokeWidth:.5}),D},"bpmn:MessageFlow":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=Z(_),I=Ve(_),W=Ie(_,c,y.fill),oe=te(_,s,y.stroke),Pe=x(C,_.waypoints,{markerEnd:d(C,"messageflow-end",W,oe),markerStart:d(C,"messageflow-start",W,oe),stroke:oe,strokeDasharray:"10, 11",strokeWidth:1.5});if(D.get("messageRef")){var Ue=Pe.getPointAtLength(Pe.getTotalLength()/2),ft=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:Ue.x,y:Ue.y}}),tt={strokeWidth:1};I.get("messageVisibleKind")==="initiating"?(tt.fill=W,tt.stroke=oe):(tt.fill=oe,tt.stroke=W);var It=b(C,ft,tt),un=D.get("messageRef"),ln=un.get("name"),at=fe(C,ln,{align:"center-top",fitBox:!0,style:{fill:oe}}),Nt=It.getBBox(),pn=at.getBBox(),Bo=Ue.x-pn.width/2,fn=Ue.y+Nt.height/2+mS;Ps(at,Bo,fn,0)}return Pe},"bpmn:ParallelGateway":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=ee(C,_,y),I=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:_.width,containerHeight:_.height,position:{mx:.46,my:.2}});return b(C,I,{fill:te(_,s,y.stroke),stroke:te(_,s,y.stroke),strokeWidth:1}),D},"bpmn:Participant":function(C,_,y={}){y=Ge(y,["fill","stroke","width","height"]);var D=j(C,_,y),I=$e(_),W=Yt(_),oe=Z(_),Pe=oe.get("name");if(I){var Ue=W?[{x:30,y:0},{x:30,y:Pn(_,y)}]:[{x:0,y:30},{x:Gn(_,y),y:30}];w(C,Ue,{stroke:te(_,s,y.stroke),strokeWidth:gS}),q(C,Pe,_,y)}else{var ft=ia(_,y);W||(ft.height=Gn(_,y),ft.width=Pn(_,y));var tt=fe(C,Pe,{box:ft,align:"center-middle",style:{fill:na(_,u,s,y.stroke)}});if(!W){var It=-1*Pn(_,y);Ps(tt,0,-It,270)}}return oe.get("participantMultiplicity")&&N("ParticipantMultiplicityMarker",C,_,y),D},"bpmn:ReceiveTask":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=Z(_),I=ke(C,_,y),W;return D.get("instantiate")?(m(C,28,28,20*.22,{fill:Ie(_,c,y.fill),stroke:te(_,s,y.stroke),strokeWidth:1}),W=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):W=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),b(C,W,{fill:Ie(_,c,y.fill),stroke:te(_,s,y.stroke),strokeWidth:1}),I},"bpmn:ScriptTask":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=ke(C,_,y),I=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return b(C,I,{fill:Ie(_,c,y.fill),stroke:te(_,s,y.stroke),strokeWidth:1}),D},"bpmn:SendTask":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=ke(C,_,y),I=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return b(C,I,{fill:te(_,s,y.stroke),stroke:Ie(_,c,y.fill),strokeWidth:1}),D},"bpmn:SequenceFlow":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=Ie(_,c,y.fill),I=te(_,s,y.stroke),W=x(C,_.waypoints,{markerEnd:d(C,"sequenceflow-end",D,I),stroke:I}),oe=Z(_),{source:Pe}=_;if(Pe){var Ue=Z(Pe);oe.get("conditionExpression")&&v(Ue,"bpmn:Activity")&&re(W,{markerStart:d(C,"conditional-flow-marker",D,I)}),Ue.get("default")&&(v(Ue,"bpmn:Gateway")||v(Ue,"bpmn:Activity"))&&Ue.get("default")===oe&&re(W,{markerStart:d(C,"conditional-default-flow-marker",D,I)})}return W},"bpmn:ServiceTask":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=ke(C,_,y);m(C,10,10,{fill:Ie(_,c,y.fill),stroke:"none",transform:"translate(6, 6)"});var I=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});b(C,I,{fill:Ie(_,c,y.fill),stroke:te(_,s,y.stroke),strokeWidth:1}),m(C,10,10,{fill:Ie(_,c,y.fill),stroke:"none",transform:"translate(11, 10)"});var W=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return b(C,W,{fill:Ie(_,c,y.fill),stroke:te(_,s,y.stroke),strokeWidth:1}),D},"bpmn:StartEvent":function(C,_,y={}){var{renderIcon:D=!0}=y;y=Ge(y,["fill","stroke"]);var I=Z(_);I.get("isInterrupting")||(y={...y,strokeDasharray:"6"});var W=ue(C,_,y);return D&&F(_,C,y),W},"bpmn:SubProcess":function(C,_,y={}){return $e(_)?y=Ge(y,["fill","stroke","width","height"]):y=Ge(y,["fill","stroke"]),$(C,_,y)},"bpmn:Task":function(C,_,y={}){return y=Ge(y,["fill","stroke"]),ke(C,_,y)},"bpmn:TextAnnotation":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var{width:D,height:I}=ia(_,y),W=g(C,D,I,0,0,{fill:"none",stroke:"none"}),oe=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:I,position:{mx:0,my:0}});b(C,oe,{stroke:te(_,s,y.stroke)});var Pe=Z(_),Ue=Pe.get("text")||"";return fe(C,Ue,{align:"left-top",box:ia(_,y),padding:uo,style:{fill:na(_,u,s,y.stroke)}}),W},"bpmn:Transaction":function(C,_,y={}){$e(_)?y=Ge(y,["fill","stroke","width","height"]):y=Ge(y,["fill","stroke"]);var D=$(C,_,{strokeWidth:1.5,...y}),I=n.style(["no-fill","no-events"],{stroke:te(_,s,y.stroke),strokeWidth:1.5}),W=$e(_);return W||(y={}),g(C,Gn(_,y),Pn(_,y),Ds-ks,ks,I),D},"bpmn:UserTask":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=ke(C,_,y),I=15,W=12,oe=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:I,y:W}});b(C,oe,{fill:Ie(_,c,y.fill),stroke:te(_,s,y.stroke),strokeWidth:.5});var Pe=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:I,y:W}});b(C,Pe,{fill:Ie(_,c,y.fill),stroke:te(_,s,y.stroke),strokeWidth:.5});var Ue=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:I,y:W}});return b(C,Ue,{fill:te(_,s,y.stroke),stroke:te(_,s,y.stroke),strokeWidth:.5}),D},label:function(C,_,y={}){return lt(C,_,y)}};this._drawPath=b,this._renderer=T}ie(Nr,Pi),Nr.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Nr.prototype.canRender=function(e){return v(e,"bpmn:BaseElement")},Nr.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Nr.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Nr.prototype.getShapePath=function(e){return Me(e)?pl(e,yS):v(e,"bpmn:Event")?am(e):v(e,"bpmn:Activity")?pl(e,Ds):v(e,"bpmn:Gateway")?fS(e):dS(e)};function Ge(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var bS=0,xS={width:150,height:50};function wS(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function ES(e){return Gt(e)?O({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var fl=null;function SS(){return fl||(fl=document.createElement("canvas").getContext("2d")),fl}function RS(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(sm(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function sm(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function CS(e,t){var n=SS();if(!n)return{width:0,height:0};n.font=RS(t),"letterSpacing"in n&&(n.letterSpacing=sm(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 PS(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=CS(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return AS(e,r,i,o);r=MS(r,o.width,t)}}function AS(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 cm="­";function TS(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===cm)&&r.pop();break}var a=r[r.length-1];return a&&a===cm&&(r[r.length-1]="-"),r.join("")}function MS(e,t,n){var i=Math.max(e.length*(n/t),1),r=TS(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function Os(e){this._config=O({},{size:xS,padding:bS,style:{},align:"center-top"},e||{})}Os.prototype.createText=function(e,t){return this.layoutText(e,t).element},Os.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Os.prototype.layoutText=function(e,t){for(var n=O({},this._config.size,t.box),i=O({},this._config.style,t.style),r=wS(t.align||this._config.align),o=ES(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,c=kS(i),s=e.split(/\u00AD?\r?\n/),u=[],l=n.width-o.left-o.right;s.length;)u.push(PS(s,l,i));r.vertical==="middle"&&(o.top=o.bottom=0);var p=En(u,function(g,R,w){return g+(c||R.height)},0)+o.top+o.bottom,f=En(u,function(g,R,w){return R.width>g?R.width:g},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-p)/2),d-=(c||u[0].height)/4;var h=me("text");re(h,i),M(u,function(g){var R;switch(d+=c||g.height,r.horizontal){case"left":R=o.left;break;case"right":R=(a?f:l)-o.right-g.width;break;default:R=Math.max(((a?f:l)-g.width)/2+o.left,0)}var w=me("tspan");re(w,{x:R,y:d}),w.textContent=g.text,Re(h,w)});var m={width:f,height:p};return{dimensions:m,element:h}};function kS(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var DS=12,OS=1.2,LS=40;function um(e){var t=O({fontFamily:"Arial, sans-serif",fontSize:DS,fontWeight:"normal",lineHeight:OS},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=O({},t,{fontSize:n},e&&e.externalStyle||{}),r=new Os({style:t});this.getExternalLabelBounds=function(a,c){var s={width:Math.max(a.width,Ir.width),height:30},u=o(c,s,{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,c){var s=o(c,a,{style:t,align:"left-top",padding:uo});return{x:a.x,y:a.y,width:a.width,height:Math.max(LS,Math.round(s.height))}},this.getDimensions=function(a,c){return r.getDimensions(a,c||{})};function o(a,c,s){return r.getDimensions(a,O({box:c},s))}this.createText=function(a,c){return r.createText(a,c||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}um.$inject=["config.textRenderer"];function IS(){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 c=n.containerHeight/i.height*n.yScaleFactor,s=n.containerWidth/i.width*n.xScaleFactor,u=0;u<i.heightElements.length;u++)a["y"+u]=i.heightElements[u]*c;for(var l=0;l<i.widthElements.length;l++)a["x"+l]=i.widthElements[l]*s}var p=jS(i.d,{mx:r,my:o,e:a});return p}}var NS=/\{([^{}]+)\}/g,BS=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function $S(e,t,n){var i=n;return t.replace(BS,function(r,o,a,c,s){o=o||c,i&&(o in i&&(i=i[o]),typeof i=="function"&&s&&(i=i()))}),i=(i==null||i==n?e:i)+"",i}function jS(e,t){return String(e).replace(NS,function(n,i){return $S(n,i,t)})}const FS={__init__:["bpmnRenderer"],bpmnRenderer:["type",Nr],textRenderer:["type",um],pathMap:["type",IS]};function HS(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const ra={translate:["value",HS]};function Ls(e,t,n){return O({id:e.id,type:e.$type,businessObject:e,di:t},n)}function zS(e,t,n){var i=e.waypoint;return!i||i.length<2?[be(t),be(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function lm(e,t,n){return new Error(`element ${sn(t)} referenced by ${sn(e)}#${n} not yet drawn`)}function ki(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}ki.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],ki.prototype.add=function(e,t,n){var i,r,o;if(v(t,"bpmndi:BPMNPlane")){var a=v(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(Ls(e,t,a)),this._canvas.addRootElement(i)}else if(v(t,"bpmndi:BPMNShape")){var c=!$e(e,t),s=GS(e);r=n&&(n.hidden||n.collapsed);var u=t.bounds;i=this._elementFactory.createShape(Ls(e,t,{collapsed:c,hidden:r,x:Math.round(u.x),y:Math.round(u.y),width:Math.round(u.width),height:Math.round(u.height),isFrame:s})),v(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),v(e,"bpmn:Lane")&&(o=0),v(e,"bpmn:DataStoreReference")&&(VS(n,be(u))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else if(v(t,"bpmndi:BPMNEdge")){var l=this._getSource(e),p=this._getTarget(e);r=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(Ls(e,t,{hidden:r,source:l,target:p,waypoints:zS(t,l,p)})),v(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${sn(t)} for element ${sn(e)}`);return nr(e)&&jn(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},ki.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${sn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw lm(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},ki.prototype.addLabel=function(e,t,n){var i,r,o;return i=oS(t,n),r=jn(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(Ls(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!jn(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)},ki.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?lm(e,i,t+"Ref"):new Error(`${sn(e)}#${t} Ref not specified`)},ki.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},ki.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},ki.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function VS(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 GS(e){return v(e,"bpmn:Group")}const pm={__depends__:[FS,{__depends__:[ra],bpmnImporter:["type",ki]}]};function oa(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function ii(e,t){return{x:e.x-t.x,y:e.y-t.y}}function dl(e){return Math.log(e)/Math.log(10)}var WS=1e3;function X(e){this._eventBus=e}X.$inject=["eventBus"];function US(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}X.prototype.on=function(e,t,n,i,r,o){if((Wt(t)||we(t))&&(o=r,r=i,i=n,n=t,t=null),Wt(n)&&(o=r,r=i,i=n,n=WS),Gt(r)&&(o=r,r=!1),!Wt(i))throw new Error("handlerFn must be a function");_e(e)||(e=[e]);var a=this._eventBus;M(e,function(c){var s=["commandStack",c,t].filter(function(u){return u}).join(".");a.on(s,n,r?US(i,o):i,o)})},X.prototype.canExecute=Di("canExecute"),X.prototype.preExecute=Di("preExecute"),X.prototype.preExecuted=Di("preExecuted"),X.prototype.execute=Di("execute"),X.prototype.executed=Di("executed"),X.prototype.postExecute=Di("postExecute"),X.prototype.postExecuted=Di("postExecuted"),X.prototype.revert=Di("revert"),X.prototype.reverted=Di("reverted");function Di(e){return function(n,i,r,o,a){(Wt(n)||we(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var hl=["top","bottom","left","right"],Is=10;function ml(e,t){X.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],function(r){var o=r.context,a=o.connection,c=a.source,s=a.target,u=o.hints||{};u.createElementsBehavior!==!1&&(n(c),n(s))}),this.postExecuted(["label.create"],function(r){var o=r.context,a=o.shape,c=o.hints||{};c.createElementsBehavior!==!1&&n(a.labelTarget)}),this.postExecuted(["elements.create"],function(r){var o=r.context,a=o.elements,c=o.hints||{};c.createElementsBehavior!==!1&&a.forEach(function(s){n(s)})});function n(r){if(Ms(r)&&!it(r)){var o=KS(r);o&&i(r,o)}}function i(r,o){var a=be(r),c=r.label,s=be(c);if(c.parent){var u=ye(r),l;switch(o){case"top":l={x:a.x,y:u.top-Is-c.height/2};break;case"left":l={x:u.left-Is-c.width/2,y:a.y};break;case"bottom":l={x:a.x,y:u.bottom+Is+c.height/2};break;case"right":l={x:u.right+Is+c.width/2,y:a.y};break}var p=ii(l,s);t.moveShape(c,p)}}}ie(ml,X),ml.$inject=["eventBus","modeling"];function YS(e){var t=e.host,n=be(e),i=Zt(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=hl.filter(function(a){return r.indexOf(a)===-1});return o}function qS(e){var t=be(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 fm(t,i)});return n}function KS(e){var t=be(e.label),n=be(e),i=fm(n,t);if(XS(i)){var r=qS(e);if(e.host){var o=YS(e);r=r.concat(o)}var a=hl.filter(function(c){return r.indexOf(c)===-1});return a.indexOf(i)!==-1?Zt(e.label,e)!=="intersect"?void 0:i:a[0]}}function fm(e,t){return Zt(t,e,5)}function XS(e){return hl.indexOf(e)!==-1}function gl(e){X.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(v(i,"bpmn:TextAnnotation")?t.position={x:n.x+n.width/2+75,y:n.y-50-i.height/2}:t.position={x:n.x+n.width+80+i.width/2,y:n.y+n.height/2})},!0)}ie(gl,X),gl.$inject=["eventBus"];var ZS=1500;function yl(e,t,n){e.invoke(X,this),this.preExecute("elements.delete",ZS,function(r){var o=r.context,a=o.elements,c=i(a);c.length&&(o.elements=a.concat(c))}),t.on("shape.move.start",function(r){var o=r.context.shapes,a=i(o);a.length&&(r.context.shapes=o.concat(a))});function i(r){var o=Oe(r,u=>v(u,"bpmn:Participant")||v(u,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),c=new Set(a.children.filter(u=>v(u,"bpmn:Artifact"))),s=new Set;return M(o,u=>{const l=new Set(Zr(ro(Array.from(c),At(u))));s=s.union(l),c=c.difference(l)}),Array.from(s)}}ie(yl,X),yl.$inject=["injector","eventBus","canvas"];function vl(e,t){e.invoke(X,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=Oe(r.incoming.concat(r.outgoing),function(a){return v(a,"bpmn:Association")});M(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}ie(vl,X),vl.$inject=["injector","modeling"];function po(e,t){for(xn(t)&&(t=[t]);e=e.parent;)if(De(e,t))return e;return null}function dm(e,t){var n=po(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=po(e,i),n)return Yt(n);if(De(e,i))return Yt(e);var r;for(r=Z(e);r&&!v(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find(function(a){var c=Z(a);return c&&c.get("processRef")===r});return o?Yt(o):!0}var hm=500;function Ns(e,t){t.invoke(X,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",hm,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return mm(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",hm,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];mm(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}Ns.$inject=["bpmnReplace","injector"],ie(Ns,X),Ns.prototype._replaceShape=function(e,t){var n=QS(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function QS(e){var t=Z(e),n=t.eventDefinitions;return n&&n[0]}function mm(e,t){return!Me(e)&&De(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function _l(e,t){X.call(this,e);function n(i){return Oe(i.attachers,function(r){return v(r,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var r=i.context.source,o=i.context.target,a=n(o);v(r,"bpmn:EventBasedGateway")&&v(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var r=i.context.oldSource,o=i.context.newSource;v(r,"bpmn:Gateway")&&v(o,"bpmn:EventBasedGateway")&&M(o.outgoing,function(a){var c=a.target,s=n(c);v(c,"bpmn:ReceiveTask")&&s.length>0&&t.removeElements(s)})})}_l.$inject=["eventBus","modeling"],ie(_l,X);function gm(e){return e.create("bpmn:Category")}function JS(e){return e.create("bpmn:CategoryValue")}function ym(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=JS(e)),n.$parent||(n.$parent=gm(e)),n}function eR(e,t,n){return St(t.get("categoryValue"),e),e.$parent=t,St(n.get("rootElements"),t),t.$parent=n,e}function tR(e){var t=e.$parent;return t&&(wt(t.get("categoryValue"),e),e.$parent=null),e}function nR(e){var t=e.$parent;return t&&(wt(t.get("rootElements"),e),e.$parent=null),e}var iR=500;function bl(e,t,n){n.invoke(X,this);function i(s){return t.filter(function(u){return v(u,"bpmn:Group")&&!u.labelTarget}).map(Z).filter(function(u){return u!==s})}function r(s,u){return i(u).some(function(l){return l.get("categoryValueRef")===s})}function o(s,u){return i(u).some(function(l){var p=l.get("categoryValueRef");return p&&p.$parent===s})}function a(s,u){s&&u&&eR(s,u,e.getDefinitions())}function c(s,u,l){u&&!o(u,l)&&nR(u),s&&!r(s,l)&&tR(s)}this.executed(["shape.create","label.create"],function(s){var u=s.labelTarget||s.shape;!v(u,"bpmn:Group")||u.labelTarget||a(s.categoryValue,s.category)},!0),this.reverted(["shape.create","label.create"],function(s){var u=s.labelTarget||s.shape;!v(u,"bpmn:Group")||u.labelTarget||c(s.categoryValue,s.category,Z(u))},!0),this.executed(["shape.move","shape.resize"],iR,function(s){a(s.categoryValue,s.category)},!0),this.reverted(["shape.move","shape.resize"],function(s){var u=s.shape;s.categoryValue&&c(s.categoryValue,s.category,Z(u))},!0),this.executed("group.updateRefs",function(s){vm(s).forEach(function(u){a(u.categoryValue,u.category)})},!0),this.reverted("group.updateRefs",function(s){vm(s).forEach(function(u){c(u.categoryValue,u.category,Z(u.groupShape))})},!0),this.executed("shape.delete",function(s){var u=s.shape;!v(u,"bpmn:Group")||u.labelTarget||c(s.categoryValue,s.category,Z(u))},!0),this.reverted("shape.delete",function(s){var u=s.shape;!v(u,"bpmn:Group")||u.labelTarget||a(s.categoryValue,s.category)},!0)}bl.$inject=["bpmnjs","elementRegistry","injector"],ie(bl,X);function vm(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function xl(e,t,n){X.call(this,e),this.preExecute("shape.replace",c,!0),this.postExecuted("shape.replace",s,!0),this.preExecute("connection.create",r,!0),this.postExecuted("connection.delete",i,!0),this.postExecuted("connection.reconnect",o,!0),this.postExecuted("element.updateProperties",a,!0);function i(g){const R=g.source,w=g.target;fo(R)&&aa(w)&&l(w)}function r(g){const R=g.connection,w=g.source,x=g.target;fo(w)&&Bs(x)&&(u(x),f(w,[R]))}function o(g){const R=g.newTarget,w=g.oldSource,x=g.oldTarget;if(x!==R){const b=w;aa(x)&&l(x),fo(b)&&Bs(R)&&u(R)}}function a(g){const{element:R}=g;aa(R)?(p(R),d(R)):Bs(R)&&h(R)}function c(g){const{newData:R,oldShape:w}=g;if(fo(g.oldShape)&&R.eventDefinitionType!=="bpmn:CompensateEventDefinition"||R.type!=="bpmn:BoundaryEvent"){const x=w.outgoing.find(({target:b})=>aa(b));x&&x.target&&(g._connectionTarget=x.target)}else if(!fo(g.oldShape)&&R.eventDefinitionType==="bpmn:CompensateEventDefinition"&&R.type==="bpmn:BoundaryEvent"){const x=w.outgoing.find(({target:b})=>Bs(b));x&&x.target&&(g._connectionTarget=x.target),m(w)}}function s(g){const{_connectionTarget:R,newShape:w}=g;R&&t.connect(w,R)}function u(g){t.updateProperties(g,{isForCompensation:!0})}function l(g){t.updateProperties(g,{isForCompensation:void 0})}function p(g){for(const R of g.incoming)n.canConnect(R.source,g)||t.removeConnection(R);for(const R of g.outgoing)n.canConnect(g,R.target)||t.removeConnection(R)}function f(g,R){g.outgoing.filter(b=>v(b,"bpmn:Association")).filter(b=>aa(b.target)&&!R.includes(b)).forEach(b=>t.removeConnection(b))}function d(g){const R=g.attachers.slice();R.length&&t.removeElements(R)}function h(g){const R=g.incoming.filter(w=>fo(w.source));t.removeElements(R)}function m(g){const R=g.outgoing.filter(w=>v(w,"bpmn:SequenceFlow"));t.removeElements(R)}}ie(xl,X),xl.$inject=["eventBus","modeling","bpmnRules"];function aa(e){const t=Z(e);return t&&t.get("isForCompensation")}function fo(e){return e&&v(e,"bpmn:BoundaryEvent")&&co(e,"bpmn:CompensateEventDefinition")}function Bs(e){return e&&v(e,"bpmn:Activity")&&!cn(e)}function wl(e){e.invoke(X,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,r=n.shape;v(i,"bpmn:Lane")&&!v(r,"bpmn:Lane")&&(n.parent=po(i,"bpmn:Participant"))})}wl.$inject=["injector"],ie(wl,X);function El(e,t){X.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,r=i.shape;if(v(r,"bpmn:DataObjectReference")&&r.type!=="label"){var o=t.create("bpmn:DataObject");o.isCollection=((a=r.businessObject.dataObjectRef)==null?void 0:a.isCollection)||!1,r.businessObject.dataObjectRef=o}})}El.$inject=["eventBus","bpmnFactory"],ie(El,X);var Sl=20,Rl=20,_m=30,$s=2e3;function Cl(e,t,n){X.call(this,t),t.on(["create.start","shape.move.start"],$s,function(r){var o=r.context,a=o.shape,c=e.getRootElement();if(!(!v(a,"bpmn:Participant")||!v(c,"bpmn:Process")||!c.children.length)){var s=c.children.filter(function(p){return!v(p,"bpmn:Group")&&!Me(p)&&!it(p)});if(s.length){var u=At(s),l=rR(a,u);O(a,l),o.createConstraints=oR(a,u)}}}),t.on("create.start",$s,function(r){var o=r.context,a=o.shape,c=e.getRootElement(),s=e.getGraphics(c);function u(l){l.element=c,l.gfx=s}v(a,"bpmn:Participant")&&v(c,"bpmn:Process")&&(t.on("element.hover",$s,u),t.once("create.cleanup",function(){t.off("element.hover",u)}))});function i(){var r=e.getRootElement();return v(r,"bpmn:Collaboration")?r:n.makeCollaboration()}this.preExecute("elements.create",$s,function(r){var o=r.elements,a=r.parent,c=aR(o),s;c&&v(a,"bpmn:Process")&&(r.parent=i(),s=r.hints=r.hints||{},s.participant=c,s.process=a,s.processRef=Z(c).get("processRef"))},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;v(a,"bpmn:Participant")&&v(o,"bpmn:Process")&&(r.parent=i(),r.process=o,r.processRef=Z(a).get("processRef"))},!0),this.execute("shape.create",function(r){var o=r.hints||{},a=r.process||o.process,c=r.shape,s=o.participant;a&&(!s||c===s)&&Z(c).set("processRef",Z(a))},!0),this.revert("shape.create",function(r){var o=r.hints||{},a=r.process||o.process,c=r.processRef||o.processRef,s=r.shape,u=o.participant;a&&(!u||s===u)&&Z(s).set("processRef",c)},!0),this.postExecute("shape.create",function(r){var o=r.hints||{},a=r.process||r.hints.process,c=r.shape,s=o.participant;if(a){var u=a.children.slice();s?c===s&&n.moveElements(u,{x:0,y:0},s):n.moveElements(u,{x:0,y:0},c)}},!0)}Cl.$inject=["canvas","eventBus","modeling"],ie(Cl,X);function rR(e,t){t={width:t.width+Sl*2+_m,height:t.height+Rl*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 oR(e,t){return t=ye(t),{bottom:t.top+e.height/2-Rl,left:t.right-e.width/2+Sl,top:t.bottom-e.height/2+Rl,right:t.left+e.width/2-Sl-_m}}function aR(e){return st(e,function(t){return v(t,"bpmn:Participant")})}var bm="__targetRef_placeholder";function Pl(e,t){X.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,c,s){var u=a.get("dataInputAssociations");return st(u,function(l){return l!==s&&l.targetRef===c})}function i(a,c){var s=a.get("properties"),u=st(s,function(l){return l.name===bm});return!u&&c&&(u=t.create("bpmn:Property",{name:bm}),St(s,u)),u}function r(a,c){var s=i(a);s&&(n(a,s,c)||wt(a.get("properties"),s))}function o(a){var c=a.context,s=c.connection,u=s.businessObject,l=s.target,p=l&&l.businessObject,f=c.newTarget,d=f&&f.businessObject,h=c.oldTarget||c.target,m=h&&h.businessObject,g=s.businessObject,R;m&&m!==p&&r(m,u),d&&d!==p&&r(d,u),p?(R=i(p,!0),g.targetRef=R):g.targetRef=null}}Pl.$inject=["eventBus","bpmnFactory"],ie(Pl,X);function xm(e){return function(t){var n=t.context,i=n.connection;if(v(i,"bpmn:DataInputAssociation"))return e(t)}}function js(e){this._bpmnUpdater=e}js.$inject=["bpmnUpdater"],js.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),[]},js.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 Al(e,t,n,i){X.call(this,i),t.registerHandler("dataStore.updateContainment",js);function r(){return n.filter(function(c){return v(c,"bpmn:Participant")&&Z(c).processRef})[0]}function o(c){return c.children.filter(function(s){return v(s,"bpmn:DataStoreReference")&&!s.labelTarget})}function a(c,s){var u=c.businessObject||c;if(s=s||r(),s){var l=s.businessObject||s;t.execute("dataStore.updateContainment",{dataStoreBo:u,dataStoreDi:Ve(c),newSemanticParent:l.processRef||l,newDiParent:Ve(s)})}}this.preExecute("shape.create",function(c){var s=c.context,u=s.shape;v(u,"bpmn:DataStoreReference")&&u.type!=="label"&&(s.hints||(s.hints={}),s.hints.autoResize=!1)}),this.preExecute("elements.move",function(c){var s=c.context,u=s.shapes,l=u.filter(function(p){return v(p,"bpmn:DataStoreReference")});l.length&&(s.hints||(s.hints={}),s.hints.autoResize=u.filter(function(p){return!v(p,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(c){var s=c.context,u=s.shape,l=u.parent;v(u,"bpmn:DataStoreReference")&&u.type!=="label"&&v(l,"bpmn:Collaboration")&&a(u)}),this.postExecute("shape.move",function(c){var s=c.context,u=s.shape,l=s.oldParent,p=u.parent;if(!v(l,"bpmn:Collaboration")&&v(u,"bpmn:DataStoreReference")&&u.type!=="label"&&v(p,"bpmn:Collaboration")){var f=v(l,"bpmn:Participant")?l:cR(l,"bpmn:Participant");a(u,f)}}),this.postExecute("shape.delete",function(c){var s=c.context,u=s.shape,l=e.getRootElement();De(u,["bpmn:Participant","bpmn:SubProcess"])&&v(l,"bpmn:Collaboration")&&o(l).filter(function(p){return sR(p,u)}).forEach(function(p){a(p)})}),this.postExecute("canvas.updateRoot",function(c){var s=c.context,u=s.oldRoot,l=s.newRoot,p=o(u);p.forEach(function(f){v(l,"bpmn:Process")&&a(f,l)})})}Al.$inject=["canvas","commandStack","elementRegistry","eventBus"],ie(Al,X);function sR(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 cR(e,t){for(;e.parent;){if(v(e.parent,t))return e.parent;e=e.parent}}var Fs=Math.max,Hs=Math.min,uR=20;function wm(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function lR(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 pR(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 zs(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return we(r)&&(i=(/top|left/.test(e)?Hs:Fs)(i,r)),we(o)&&(i=(/top|left/.test(e)?Fs:Hs)(i,o)),i}function fR(e,t){if(!t)return e;var n=ye(e);return Ss({top:zs("top",n,t),right:zs("right",n,t),bottom:zs("bottom",n,t),left:zs("left",n,t)})}function dR(e,t,n,i){var r=ye(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?ye(i):o,c={top:Hs(o.top,a.top),left:Hs(o.left,a.left),bottom:Fs(o.bottom,a.bottom),right:Fs(o.right,a.right)};return Ss(c)}function sa(e,t){return typeof e<"u"?e:uR}function hR(e,t){var n,i,r,o;return typeof t=="object"?(n=sa(t.left),i=sa(t.right),r=sa(t.top),o=sa(t.bottom)):n=i=r=o=sa(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function mR(e){return!(e.waypoints||e.type==="label")}function Em(e,t){var n;if(e.length===void 0?n=Oe(e.children,mR):n=e,n.length)return hR(At(n),t)}var ir=Math.abs;function gR(e,t){return wm(ye(t),ye(e))}var yR=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Wn=30;function Vs(e,t){return t=t||[],e.children.filter(function(n){v(n,"bpmn:Lane")&&(Vs(n,t),t.push(n))}),t}function rr(e){return e.children.filter(function(t){return v(t,"bpmn:Lane")})}function Un(e){return po(e,yR)||e}function vR(e,t){var n=Un(e),i=v(n,"bpmn:Process")?[]:[n],r=Vs(n,i),o=ye(e),a=ye(t),c=gR(e,t),s=[],u=Yt(e);return r.forEach(function(l){if(l!==e){var p=u?0:c.top,f=u?c.right:0,d=u?0:c.bottom,h=u?c.left:0,m=ye(l);c.top&&(ir(m.bottom-o.top)<10&&(d=a.top-m.bottom),ir(m.top-o.top)<5&&(p=a.top-m.top)),c.left&&(ir(m.right-o.left)<10&&(f=a.left-m.right),ir(m.left-o.left)<5&&(h=a.left-m.left)),c.bottom&&(ir(m.top-o.bottom)<10&&(p=a.bottom-m.top),ir(m.bottom-o.bottom)<5&&(d=a.bottom-m.bottom)),c.right&&(ir(m.left-o.right)<10&&(h=a.right-m.left),ir(m.right-o.right)<5&&(f=a.right-m.right)),(p||f||d||h)&&s.push({shape:l,newBounds:pR(l,{top:p,right:f,bottom:d,left:h})})}}),s}var _R=500;function Tl(e,t){X.call(this,e);function n(i,r){var o=Yt(i),a=rr(r),c=[],s=[],u=[],l=[];if(Or(a,function(g){return o?g.y>i.y?s.push(g):c.push(g):g.x>i.x?l.push(g):u.push(g),g.children}),!!a.length){var p;o?s.length&&c.length?p=i.height/2:p=i.height:l.length&&u.length?p=i.width/2:p=i.width;var f,d,h,m;c.length&&(f=t.calculateAdjustments(c,"y",p,i.y-10),t.makeSpace(f.movingShapes,f.resizingShapes,{x:0,y:p},"s")),s.length&&(d=t.calculateAdjustments(s,"y",-p,i.y+i.height+10),t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:-p},"n")),u.length&&(h=t.calculateAdjustments(u,"x",p,i.x-10),t.makeSpace(h.movingShapes,h.resizingShapes,{x:p,y:0},"e")),l.length&&(m=t.calculateAdjustments(l,"x",-p,i.x+i.width+10),t.makeSpace(m.movingShapes,m.resizingShapes,{x:-p,y:0},"w"))}}this.postExecuted("shape.delete",_R,function(i){var r=i.context,o=r.hints,a=r.shape,c=r.oldParent;v(a,"bpmn:Lane")&&(o&&o.nested||n(a,c))})}Tl.$inject=["eventBus","spaceTool"],ie(Tl,X);var Sm=500;function Gs(e,t){t.invoke(X,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Sm,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return Rm(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",Sm,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,c){var s=a.host;Rm(a,xR(r,s)?s:o)&&(r[c]=n._replaceShape(a))})},!0)}Gs.$inject=["bpmnReplace","injector"],ie(Gs,X),Gs.prototype._replaceShape=function(e){var t=bR(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function bR(e){var t=Z(e),n=t.eventDefinitions;return n&&n[0]}function Rm(e,t){return!Me(e)&&v(e,"bpmn:BoundaryEvent")&&!t}function xR(e,t){return e.indexOf(t)!==-1}var Ws=Math.round,wR=Math.max;function ER(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 SR(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var Cm=10;function RR(e,t){var n,i;for(n=0;i=e[n];n++)if(Zo(i,t)<=Cm)return{point:e[n],bendpoint:!0,index:n};return null}function CR(e,t){var n=kh(ER(t,Cm),SR(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=wR(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:Ws(i.x+r.x)/2,y:Ws(i.y+r.y)/2},index:i.segment2}:{point:{x:Ws(i.x),y:Ws(i.y)},index:i.segment2}:null}function Ml(e,t){return RR(e,t)||CR(e,t)}function kl(e,t,n){X.call(this,e);function i(r,o,a){var c=o.waypoints,s,u,l,p,f,d,h,m=r.outgoing.slice(),g=r.incoming.slice(),R;we(a.width)?R=be(a):R=a;var w=Ml(c,R);if(w){if(s=c.slice(0,w.index),u=c.slice(w.index+(w.bendpoint?1:0)),!s.length||!u.length)return;l=w.bendpoint?c[w.index]:R,(s.length===1||!Pm(r,s[s.length-1]))&&s.push(Am(l)),(u.length===1||!Pm(r,u[0]))&&u.unshift(Am(l))}p=o.source,f=o.target,t.canConnect(p,r,o)&&(n.reconnectEnd(o,r,s||R),d=o),t.canConnect(r,f,o)&&(d?h=n.connect(r,f,{type:o.type,waypoints:u}):(n.reconnectStart(o,r,u||R),h=o));var x=[].concat(d&&Oe(g,function(b){return b.source===d.source})||[],h&&Oe(m,function(b){return b.target===h.target})||[]);x.length&&n.removeElements(x)}this.preExecute("elements.move",function(r){var o=r.newParent,a=r.shapes,c=r.delta,s=a[0];if(!(!s||!o)){o&&o.waypoints&&(r.newParent=o=o.parent);var u=be(s),l={x:u.x+c.x,y:u.y+c.y},p=st(o.children,function(f){var d=t.canInsert(a,f);return d&&Ml(f.waypoints,l)});p&&(r.targetFlow=p,r.position=l)}},!0),this.postExecuted("elements.move",function(r){var o=r.shapes,a=r.targetFlow,c=r.position;a&&i(o[0],a,c)},!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,c=r.position;a&&i(o,a,c)},!0)}ie(kl,X),kl.$inject=["eventBus","bpmnRules","modeling"];function Pm(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 Am(e){return O({},e)}function Dl(e,t){X.call(this,e),this.preExecuted("connection.create",function(n){var i=n.context,r=i.connection,o=i.source,a=i.target,c=i.hints;if(!(c&&c.createElementsBehavior===!1)&&ho(r)){var s=[];v(o,"bpmn:EventBasedGateway")?s=a.incoming.filter(u=>u!==r&&ho(u)):s=a.incoming.filter(u=>u!==r&&ho(u)&&v(u.source,"bpmn:EventBasedGateway")),s.forEach(function(u){t.removeConnection(u)})}}),this.preExecuted("shape.replace",function(n){var i=n.context,r=i.newShape;if(v(r,"bpmn:EventBasedGateway")){var o=r.outgoing.filter(ho).reduce(function(a,c){return a.includes(c.target)?a:a.concat(c.target)},[]);o.forEach(function(a){a.incoming.filter(ho).forEach(function(c){const s=a.incoming.filter(ho).filter(function(u){return u.source===r});(c.source!==r||s.length>1)&&t.removeConnection(c)})})}})}Dl.$inject=["eventBus","modeling"],ie(Dl,X);function ho(e){return v(e,"bpmn:SequenceFlow")}var Us=1500,Tm=2e3;function Mm(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"],Us,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;v(a,"bpmn:Lane")&&!De(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Un(a),i.hoverGfx=e.getGraphics(i.hover));var c=n.getRootElement();a&&a!==c&&(o.labelTarget||De(o,["bpmn:Group","bpmn:TextAnnotation"]))&&(i.hover=c,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"],Us,function(i){var r=i.hover;v(r,"bpmn:Lane")&&(i.hover=Un(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Us,function(i){var r=i.context,o=i.hover,a=r.type;v(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Un(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Us,function(i){var r=i.context,o=r.start;v(o,"bpmn:Lane")&&(r.start=Un(o)||o)}),t.on("shape.move.start",Tm,function(i){var r=i.shape;v(r,"bpmn:Lane")&&(i.shape=Un(r)||r)}),t.on("spaceTool.move",Tm,function(i){var r=i.hover;r&&v(r,"bpmn:Lane")&&(i.hover=Un(r))})}Mm.$inject=["elementRegistry","eventBus","canvas"];var km=770;function Ol(e,t,n,i){n.invoke(X,this);function r(c,s){var u=Z(c),l=s.categoryValue||u.categoryValueRef;l||(l=ym(e,u));var p=s.category||l.$parent||gm(e);u.categoryValueRef=l,l.$parent=p,s.categoryValue=l,s.category=p}function o(c,s){var u=Z(c),l=s.categoryValue||u.categoryValueRef,p=s.category||l&&l.$parent;l&&(s.categoryValue=l,s.category=p,u.categoryValueRef=null)}this.execute("label.create",function(c){var s=c.context,u=s.labelTarget;v(u,"bpmn:Group")&&r(u,s)}),this.revert("label.create",function(c){var s=c.context,u=s.labelTarget;v(u,"bpmn:Group")&&o(u,s)}),this.execute("shape.delete",function(c){var s=c.context,u=s.shape,l=Z(u);if(!(!v(u,"bpmn:Group")||u.labelTarget)){var p=s.categoryValue=l.categoryValueRef;p&&(s.category=p.$parent,l.categoryValueRef=null)}}),this.reverted("shape.delete",function(c){var s=c.context,u=s.shape;if(!(!v(u,"bpmn:Group")||u.labelTarget)){var l=s.category,p=s.categoryValue,f=Z(u);p&&(f.categoryValueRef=p,p.$parent=l)}}),this.execute("shape.create",function(c){var s=c.context,u=s.shape,l=s.hints||{};!v(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!Z(u).categoryValueRef&&!s.categoryValue||r(u,s)}),this.reverted("shape.create",function(c){var s=c.context,u=s.shape,l=s.hints||{};!v(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!Z(u).categoryValueRef&&!s.categoryValue||o(u,s)}),this.executed(["shape.move","shape.resize"],function(c){var s=c.context,u=s.shape;!v(u,"bpmn:Group")||u.labelTarget||Z(u).categoryValueRef||r(u,s)}),this.reverted(["shape.move","shape.resize"],function(c){var s=c.context,u=s.shape;!v(u,"bpmn:Group")||u.labelTarget||!s.categoryValue||o(u,s)});function a(c,s){var u=e.create(c.$type);return i.copyElement(c,u,null,s)}t.on("copyPaste.copyElement",km,function(c){var s=c.descriptor,u=c.element;if(!(!v(u,"bpmn:Group")||u.labelTarget)){var l=Z(u);if(l.categoryValueRef){var p=l.categoryValueRef;s.categoryValue=a(p,!0),p.$parent&&(s.category=a(p.$parent,!0))}}}),t.on("copyPaste.pasteElement",km,function(c){var s=c.descriptor,u=s.businessObject,l=s.categoryValue,p=s.category;l&&(l=u.categoryValueRef=a(l)),p&&(l.$parent=a(p)),delete s.category,delete s.categoryValue})}Ol.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],ie(Ol,X);function Ll(e,t,n,i){var r,o,a,c,s;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,s=(i.x-n.x)*o-(i.y-n.y)*a,c=s/r,{x:Math.round(e.x+c*(t.x-e.x)),y:Math.round(e.y+c*(t.y-e.y))})}function Dm(e){function t(i,r,o){var a={x:o.x,y:o.y-50},c={x:o.x-50,y:o.y},s=Ll(i,r,o,a),u=Ll(i,r,o,c),l;s&&u?Om(s,o)>Om(u,o)?l=u:l=s:l=s||u,i.original=l}function n(i){var r=i.waypoints;t(r[0],r[1],be(i.source)),t(r[r.length-1],r[r.length-2],be(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}Dm.$inject=["eventBus"];function Om(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Il(e){X.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=Z(i),o=Ve(i);if(De(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}Il.$inject=["eventBus"],ie(Il,X);function Lm(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Im(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function PR(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 AR(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 Nl(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=AR([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 Nm(e,t){var n=Nl(e,t),i={x:n.x-e.x,y:n.y-e.y};return Lm(i)}function ca(e,t){return Lm({x:e.x-t.x,y:e.y-t.y})}var Bm=Math.sqrt,$m=Math.min,TR=Math.max,jm=Math.abs;function Fm(e){return Math.pow(e,2)}function ua(e,t){return Bm(Fm(e.x-t.x)+Fm(e.y-t.y))}function MR(e,t){var n=0,i,r,o,a,c,s,u,l,p,f,d;for(n=0;n<t.length-1;n++){if(i=t[n],r=t[n+1],zm(i,r)?u=[i]:(o=ua(e,i),a=ua(e,r),s=$m(o,a),u=kR(i,r,e,s)),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:zm(i,u[0])?n:n+1}),u.length===2&&(c=OR(u[0],u[1]),l={type:"segment",position:c,segmentIndex:n,relativeLocation:ua(i,c)/ua(i,r)}),p=ua(l.position,e),(!d||f>p)&&(d=l,f=p)}return d}function kR(e,t,n,i){var r=t.x-e.x,o=t.y-e.y,a=n.x-e.x,c=n.y-e.y,s=r*r+o*o,u=r*a+o*c,l=a*a+c*c-i*i,p=u/s,f=l/s,d=p*p-f;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var h=Bm(d),m=-p+h,g=-p-h,R={x:e.x-r*m,y:e.y-o*m};if(d===0)return[R];var w={x:e.x-r*g,y:e.y-o*g};return[R,w].filter(function(x){return DR(x,e,t)})}function DR(e,t,n){return Hm(e.x,t.x,n.x)&&Hm(e.y,t.y,n.y)}function Hm(e,t,n){return e>=$m(t,n)-Ys&&e<=TR(t,n)+Ys}function OR(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Ys=.1;function zm(e,t){return jm(e.x-t.x)<=Ys&&jm(e.y-t.y)<=Ys}function LR(e,t,n,i){var r=n.segmentIndex,o=t.length-e.length;if(i.segmentMove){var a=i.segmentMove.segmentStartIndex,c=i.segmentMove.newSegmentStartIndex;return r===a?c:r>=c?r+o<c?c:r+o:r}if(i.bendpointMove){var s=i.bendpointMove.insert,u=i.bendpointMove.bendpointIndex,l;if(o===0)return r;if(r>=u&&(l=s?r+1:r-1),r<u&&(l=r,s&&n.type!=="bendpoint"&&u-1===r)){var p=Gm(t,u);p<n.relativeLocation&&l++}return l}return o===0?r:i.connectionStart&&r===0?0:i.connectionEnd&&r===e.length-2?t.length-2:Math.floor((t.length-2)/2)}function Vm(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},c=MR(e,n),s=c.segmentIndex,u=LR(n,t,c,i);if(u<0||u>t.length-2||u===null)return a;var l=Wm(n,s),p=Wm(t,u),f=c.position,d=NR(l,f),h=IR(l,p);if(c.type==="bendpoint"){var m=t.length-n.length,g=c.bendpointIndex,R=n[g];if(t.indexOf(R)!==-1)return a;if(m===0){var w=t[g];return r=w.x-c.position.x,o=w.y-c.position.y,{delta:{x:r,y:o},point:{x:e.x+r,y:e.y+o}}}m<0&&g!==0&&g<n.length-1&&(d=Gm(n,g))}var x={x:(p[1].x-p[0].x)*d+p[0].x,y:(p[1].y-p[0].y)*d+p[0].y},b=PR({x:e.x-f.x,y:e.y-f.y},h);return r=x.x+b.x-e.x,o=x.y+b.y-e.y,{point:Ti(x),delta:Ti({x:r,y:o})}}function Gm(e,t){var n=ca(e[t-1],e[t]),i=ca(e[t],e[t+1]),r=n/(n+i);return r}function IR(e,t){var n=Im(e),i=Im(t);return i-n}function Wm(e,t){return[e[t],e[t+1]]}function NR(e,t){var n=ca(e[0],e[1]),i=ca(e[0],t);return n===0?0:i/n}function BR(e,t,n,i){var r=be(e);return Vm(r,t,n,i).delta}function la(e,t,n){var i=oa(t),r=oa(n),o=ii(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return Ti({x:r.x+a.x,y:r.y+a.y})}function Um(e,t,n){var i=oa(e),r=oa(t),o=oa(n),a=ii(e,i),c=ii(i,r),s=$R(i,t,n);if(s)return s;var u={x:c.x*(n.width/t.width),y:c.y*(n.height/t.height)},l={x:o.x+u.x,y:o.y+u.y};return Ti({x:l.x+a.x-e.x,y:l.y+a.y-e.y})}function $R(e,t,n){var i=ye(t),r=ye(n);if(jR(i,r))return null;var o=Zt(t,e),a,c,s;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 c={x:e.x+a.x,y:e.y+a.y},s=Zt(n,c),s!==o?null:a}function jR(e,t){return FR(e,t)||HR(e,t)}function FR(e,t){return e.right!==t.right&&e.left!==t.left}function HR(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var Ym="name",qm="text";function Bl(e,t,n,i){X.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{Z(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var c=a.context,s=c.element,u=c.properties;if(Ym in u&&t.updateLabel(s,u[Ym]),qm in u&&v(s,"bpmn:TextAnnotation")){var l=i.getTextAnnotationBounds({x:s.x,y:s.y,width:s.width,height:s.height},u[qm]||"");t.updateLabel(s,u.text,l)}}this.postExecute(["shape.create","connection.create"],function(a){var c=a.context,s=c.hints||{};if(s.createElementsBehavior!==!1){var u=c.shape||c.connection;Me(u)||!nr(u)||jn(u)&&t.updateLabel(u,jn(u))}}),this.postExecute("shape.delete",function(a){var c=a.context,s=c.labelTarget,u=c.hints||{};s&&u.unsetLabel!==!1&&t.updateLabel(s,null,null,{removeShape:!1})});function o(a){var c=a.context,s=c.connection,u=s.label,l=O({},c.hints),p=c.newWaypoints||s.waypoints,f=c.oldWaypoints;return typeof l.startChanged>"u"&&(l.startChanged=!!l.connectionStart),typeof l.endChanged>"u"&&(l.endChanged=!!l.connectionEnd),BR(u,p,f,l)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(a){var c=a.context,s=c.hints||{};if(s.labelBehavior!==!1){var u=c.connection,l=u.label,p;!l||!l.parent||(p=o(a),t.moveShape(l,p))}}),this.postExecute(["shape.replace"],function(a){var c=a.context,s=c.newShape,u=c.oldShape,l=Z(s);l&&nr(l)&&u.label&&s.label&&(s.label.x=u.label.x,s.label.y=u.label.y)}),this.preExecute("shape.resize",function(a){var c=a.context,s=c.shape,u=c.hints||{};if(!(!Me(s)||u.autoResize)){var l=c.newBounds,p=i.getDimensions(jn(s)||"",{box:l,style:i.getExternalStyle()}),f=Math.ceil(p.height),d=l.y!==s.y,h=s.y+s.height;c.newBounds={width:l.width,height:f,x:l.x,y:d?h-f:l.y}}}),this.postExecute("shape.resize",function(a){var c=a.context,s=c.shape,u=c.newBounds,l=c.oldBounds;if(Ms(s)){var p=s.label,f=be(p),d=GR(l),h=VR(f,d),m=zR(h,l,u);t.moveShape(p,m)}})}ie(Bl,X),Bl.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function zR(e,t,n){var i=la(e,t,n);return Ti(ii(i,e))}function VR(e,t){if(t.length){var n=WR(e,t);return Nl(e,n)}}function GR(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 WR(e,t){var n=t.map(function(r){return{line:r,distance:Nm(e,r)}}),i=oi(n,"distance");return i[0].line}function UR(e,t,n,i){return Vm(e,t,n,i).point}function $l(e,t){X.call(this,e);function n(i,r){var o=i.context,a=o.connection,c=O({},o.hints),s=o.newWaypoints||a.waypoints,u=o.oldWaypoints;return typeof c.startChanged>"u"&&(c.startChanged=!!c.connectionStart),typeof c.endChanged>"u"&&(c.endChanged=!!c.connectionEnd),UR(r,s,u,c)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(i){var r=i.context,o=r.connection,a=o.outgoing,c=o.incoming;c.forEach(function(s){var u=s.waypoints[s.waypoints.length-1],l=n(i,u),p=[].concat(s.waypoints.slice(0,-1),[l]);t.updateWaypoints(s,p)}),a.forEach(function(s){var u=s.waypoints[0],l=n(i,u),p=[].concat([l],s.waypoints.slice(1));t.updateWaypoints(s,p)})}),this.postExecute(["connection.move"],function(i){var r=i.context,o=r.connection,a=o.outgoing,c=o.incoming,s=r.delta;c.forEach(function(u){var l=u.waypoints[u.waypoints.length-1],p={x:l.x+s.x,y:l.y+s.y},f=[].concat(u.waypoints.slice(0,-1),[p]);t.updateWaypoints(u,f)}),a.forEach(function(u){var l=u.waypoints[0],p={x:l.x+s.x,y:l.y+s.y},f=[].concat([p],u.waypoints.slice(1));t.updateWaypoints(u,f)})})}ie($l,X),$l.$inject=["eventBus","modeling"];function qs(e,t,n){var i=Xs(e),r=Xm(i,t),o=i[0];return r.length?r[r.length-1]:la(o.original||o,n,t)}function Ks(e,t,n){var i=Xs(e),r=Xm(i,t),o=i[i.length-1];return r.length?r[0]:la(o.original||o,n,t)}function jl(e,t,n){var i=Xs(e),r=Km(t,n),o=i[0];return la(o.original||o,r,t)}function Fl(e,t,n){var i=Xs(e),r=Km(t,n),o=i[i.length-1];return la(o.original||o,r,t)}function Km(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Xs(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Xm(e,t){var n=rn(e,qR);return Oe(n,function(i){return YR(i,t)})}function YR(e,t){return Zt(t,e,1)==="intersect"}function qR(e){return e.original||e}function Hl(e,t){X.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(KR(i,r)){var o=XR(i);o.incoming.forEach(function(a){var c=Ks(a,r,i);t.reconnectEnd(a,r,c)}),o.outgoing.forEach(function(a){var c=qs(a,r,i);t.reconnectStart(a,r,c)})}},!0)}Hl.$inject=["eventBus","modeling"],ie(Hl,X);function KR(e,t){return v(e,"bpmn:Participant")&&$e(e)&&v(t,"bpmn:Participant")&&!$e(t)}function XR(e){var t=Ko([e]),n=[],i=[];return t.forEach(function(r){r!==e&&(r.incoming.forEach(function(o){v(o,"bpmn:MessageFlow")&&n.push(o)}),r.outgoing.forEach(function(o){v(o,"bpmn:MessageFlow")&&i.push(o)}))},[]),{incoming:n,outgoing:i}}const ZR=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Zm(e){const t=Z(e);if(!v(t,"bpmn:BoundaryEvent")&&!(v(t,"bpmn:StartEvent")&&cn(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:ZR.some(i=>v(n[0],i))}function Qm(e){return v(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function zl(e,t){e.invoke(X,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!Zm(r))return;const a=Qm(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const s=Z(i).get(a),u=Z(r).get(a);s!==u&&t.updateProperties(r,{[a]:s})})}zl.$inject=["injector","modeling"],ie(zl,X);function Vl(e,t){X.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=Ve(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}ie(Vl,X),Vl.$inject=["eventBus","modeling"];function Gl(e,t,n){X.call(this,e),this.preExecute("shape.delete",function(i){var r=i.context.shape;if(!(r.incoming.length!==1||r.outgoing.length!==1)){var o=r.incoming[0],a=r.outgoing[0];if(!(!v(o,"bpmn:SequenceFlow")||!v(a,"bpmn:SequenceFlow"))&&t.canConnect(o.source,a.target,o)){var c=QR(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,c)}}})}ie(Gl,X),Gl.$inject=["eventBus","bpmnRules","modeling"];function mo(e){return e.original||e}function QR(e,t){var n=Ll(mo(e[e.length-2]),mo(e[e.length-1]),mo(t[1]),mo(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[mo(e[0]),mo(t[t.length-1])]}function Wl(e,t){X.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,r=i.parent;v(i,"bpmn:Participant")&&(n.collaborationRoot=r)},!0),this.postExecute("shape.delete",function(n){var i=n.collaborationRoot;if(i&&!i.businessObject.participants.length){var r=t.makeProcess(),o=i.children.slice();t.moveElements(o,{x:0,y:0},r)}},!0)}Wl.$inject=["eventBus","modeling"],ie(Wl,X);function Ul(e,t,n,i){X.call(this,e);var r=i.get("dragging",!1);function o(s){var u=s.source,l=s.target,p=s.parent;if(p){var f,d;v(s,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(u,l)||(d=!0),n.canConnectMessageFlow(u,l)&&(f="bpmn:MessageFlow")),v(s,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(u,l)||(d=!0),n.canConnectSequenceFlow(u,l)&&(f="bpmn:SequenceFlow")),d&&t.removeConnection(s),f&&t.connect(u,l,{type:f,waypoints:s.waypoints.slice()})}}function a(s){var u=s.context,l=u.connection,p=u.newSource||l.source,f=u.newTarget||l.target,d,h;d=n.canConnect(p,f),!(!d||d.type===l.type)&&(h=t.connect(p,f,{type:d.type,associationDirection:d.associationDirection,waypoints:l.waypoints.slice()}),l.parent&&t.removeConnection(l),u.connection=h,r&&c(l,h))}function c(s,u){var l=r.context(),p=l&&l.payload.previousSelection,f;!p||!p.length||(f=p.indexOf(s),f!==-1&&p.splice(f,1,u))}this.postExecuted("elements.move",function(s){var u=s.closure,l=u.allConnections;M(l,o)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(s){var u=s.context,l=u.properties,p=u.element,f=p.businessObject,d;l.default&&(d=st(p.outgoing,Jr({id:p.businessObject.default.id})),d&&t.updateProperties(d,{conditionExpression:void 0})),l.conditionExpression&&f.sourceRef.default===f&&t.updateProperties(p.source,{default:void 0})})}ie(Ul,X),Ul.$inject=["eventBus","modeling","bpmnRules","injector"];function Zs(e,t,n,i,r,o){i.invoke(X,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,function(a){var c=a.context,s=c.parent,u=c.elements,l=En(u,function(p,f){var d=t.canReplace([f],f.host||f.parent||s);return d?p.concat(d.replacements):p},[]);l.length&&this._replaceElements(u,l)},this),this.postExecuted(["elements.move"],500,function(a){var c=a.context,s=c.newParent,u=c.newHost,l=[];M(c.closure.topLevel,function(f){cn(f)?l=l.concat(f.children):l=l.concat(f)}),l.length===1&&u&&(s=u);var p=t.canReplace(l,s);p&&this._replaceElements(l,p.replacements,u)},this),this.postExecute(["shape.replace"],1500,function(a){var c=a.context,s=c.oldShape,u=c.newShape,l=s.attachers,p;l&&l.length&&(p=t.canReplace(l,u),this._replaceElements(l,p.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var c=a.context,s=c.oldShape,u=c.newShape;r.unclaimId(s.businessObject.id,s.businessObject),r.updateProperties(u,{id:s.id})})}ie(Zs,X),Zs.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;M(t,function(o){var a={type:o.newElementType},c=n.get(o.oldElementId),s=e.indexOf(c);e[s]=i.replaceElement(c,a,{select:!1})}),t&&r.select(e)},Zs.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var JR=1500,eC={width:140,height:120},Yl={width:300,height:60},ql={width:60,height:300},Qs={width:300,height:150},Js={width:150,height:300},Jm={width:140,height:120},eg={width:100,height:40};function tg(e){e.on("resize.start",JR,function(t){var n=t.context,i=n.shape,r=n.direction,o=n.balanced;(v(i,"bpmn:Lane")||v(i,"bpmn:Participant"))&&(n.resizeConstraints=oC(i,r,o)),v(i,"bpmn:SubProcess")&&$e(i)&&(n.minDimensions=Jm),v(i,"bpmn:TextAnnotation")&&(n.minDimensions=eg)})}tg.$inject=["eventBus"];var or=Math.abs,tC=Math.min,nC=Math.max;function ng(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function go(e,t,n){return ng(e,t,n,tC)}function yo(e,t,n){return ng(e,t,n,nC)}var iC={top:20,left:50,right:20,bottom:20},rC={top:50,left:20,right:20,bottom:20};function oC(e,t,n){var i=Un(e),r=!0,o=!0,a=Vs(i,[i]),c=ye(e),s={},u={},l=Yt(e),p=l?Yl:ql;/n/.test(t)?u.top=c.bottom-p.height:/e/.test(t)?u.right=c.left+p.width:/s/.test(t)?u.bottom=c.top+p.height:/w/.test(t)&&(u.left=c.right-p.width),a.forEach(function(h){var m=ye(h);l?(m.top<c.top-10&&(r=!1),m.bottom>c.bottom+10&&(o=!1)):(m.left<c.left-10&&(r=!1),m.right>c.right+10&&(o=!1)),/n/.test(t)&&(n&&or(c.top-m.bottom)<10&&yo(s,"top",m.top+p.height),or(c.top-m.top)<5&&go(u,"top",m.bottom-p.height)),/e/.test(t)&&(n&&or(c.right-m.left)<10&&go(s,"right",m.right-p.width),or(c.right-m.right)<5&&yo(u,"right",m.left+p.width)),/s/.test(t)&&(n&&or(c.bottom-m.top)<10&&go(s,"bottom",m.bottom-p.height),or(c.bottom-m.bottom)<5&&yo(u,"bottom",m.top+p.height)),/w/.test(t)&&(n&&or(c.left-m.right)<10&&yo(s,"left",m.left+p.width),or(c.left-m.left)<5&&go(u,"left",m.right-p.width))});var f=i.children.filter(function(h){return!h.hidden&&!h.waypoints&&(v(h,"bpmn:FlowElement")||v(h,"bpmn:Artifact"))}),d=l?iC:rC;return f.forEach(function(h){var m=ye(h);/n/.test(t)&&(!l||r)&&go(u,"top",m.top-d.top),/e/.test(t)&&(l||o)&&yo(u,"right",m.right+d.right),/s/.test(t)&&(!l||o)&&yo(u,"bottom",m.bottom+d.bottom),/w/.test(t)&&(l||r)&&go(u,"left",m.left-d.left)}),{min:u,max:s}}function ig(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function vo(e){return e.originalEvent||e.srcEvent}function Kl(e){ig(e),ig(vo(e))}function Br(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 rg(){return/mac/i.test(navigator.platform)}function og(e,t){return(vo(e)||e).button===t}function ar(e){return og(e,0)}function aC(e){return og(e,1)}function pa(e){var t=vo(e)||e;return ar(e)?rg()?t.metaKey:t.ctrlKey:!1}function ec(e){var t=vo(e)||e;return ar(e)&&t.shiftKey}var ag=1001;function sg(e,t){e.on("resize.start",ag+500,function(n){var i=n.context,r=i.shape;(v(r,"bpmn:Lane")||v(r,"bpmn:Participant"))&&(i.balanced=!pa(n))}),e.on("resize.end",ag,function(n){var i=n.context,r=i.shape,o=i.canExecute,a=i.newBounds;if(v(r,"bpmn:Lane")||v(r,"bpmn:Participant"))return o&&(a=Nh(a),t.resizeLane(r,a,i.balanced)),!1})}sg.$inject=["eventBus","modeling"];var sC=500;function Xl(e,t,n,i,r){n.invoke(X,this);function o(l){return De(l,["bpmn:ReceiveTask","bpmn:SendTask"])||cC(l,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(l){var p=e.getDefinitions(),f=p.get("rootElements");return!!st(f,Jr({id:l.id}))}function c(l){if(v(l,"bpmn:ErrorEventDefinition"))return"errorRef";if(v(l,"bpmn:EscalationEventDefinition"))return"escalationRef";if(v(l,"bpmn:MessageEventDefinition"))return"messageRef";if(v(l,"bpmn:SignalEventDefinition"))return"signalRef"}function s(l){if(De(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.get("messageRef");var p=l.get("eventDefinitions"),f=p[0];return f.get(c(f))}function u(l,p){if(De(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.set("messageRef",p);var f=l.get("eventDefinitions"),d=f[0];return d.set(c(d),p)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var p=l.shape||l.element;if(o(p)){var f=Z(p),d=s(f),h;d&&!a(d)&&(h=e.getDefinitions().get("rootElements"),St(h,d),l.addedRootElement=d)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var p=l.addedRootElement;if(p){var f=e.getDefinitions().get("rootElements");wt(f,p)}},!0),t.on("copyPaste.copyElement",function(l){var p=l.descriptor,f=l.element;if(!(f.labelTarget||!o(f))){var d=Z(f),h=s(d);h&&(p.referencedRootElement=h)}}),t.on("copyPaste.pasteElement",sC,function(l){var p=l.descriptor,f=p.businessObject,d=p.referencedRootElement;d&&(a(d)||(d=i.copyElement(d,r.create(d.$type))),u(f,d),delete p.referencedRootElement)})}Xl.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],ie(Xl,X);function cC(e,t){return _e(t)||(t=[t]),Vi(t,function(n){return co(e,n)})}var cg=Math.max;function ug(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return M(n,function(a){var c=a.id;v(a,"bpmn:Participant")&&(o[c]=lC(a,i,r)),v(a,"bpmn:Lane")&&(o[c]=Yt(a)?Yl:ql),v(a,"bpmn:SubProcess")&&$e(a)&&(o[c]=Jm),v(a,"bpmn:TextAnnotation")&&(o[c]=eg),v(a,"bpmn:Group")&&(o[c]=eC)}),o})}ug.$inject=["eventBus"];function uC(e){return e==="x"}function lC(e,t,n){var i=Yt(e);if(!dC(e))return i?Qs:Js;var r=uC(t),o={};return r?i?o=Qs:o={width:fC(e,n,r),height:Js.height}:i?o={width:Qs.width,height:pC(e,n,r)}:o=Js,o}function pC(e,t,n){var i;return i=hC(e,t,n),cg(Qs.height,i)}function fC(e,t,n){var i;return i=mC(e,t,n),cg(Js.width,i)}function dC(e){return!!rr(e).length}function hC(e,t,n){var i=rr(e),r;return r=Zl(i,t,n),e.height-r.height+Yl.height}function mC(e,t,n){var i=rr(e),r;return r=Zl(i,t,n),e.width-r.width+ql.width}function Zl(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=rr(r),o.length?Zl(o,t,n):r}var lg="_plane";function pg(e){var t=e.id;return gC(t)}function mi(e){var t=e.id;return v(e,"bpmn:SubProcess")?fg(t):t}function $r(e){return fg(e)}function tc(e){var t=Ve(e);return v(t,"bpmndi:BPMNPlane")}function fg(e){return e+lg}function gC(e){return e.replace(new RegExp(lg+"$"),"")}var dg=400,yC=600,hg={x:180,y:160};function Oi(e,t,n,i,r,o,a){X.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 c=this;function s(p){return v(p,"bpmn:SubProcess")&&!$e(p)}function u(p){var f=p.shape,d=p.newRootElement,h=Z(f);d=c._addDiagram(d||h),p.newRootElement=e.addRootElement(d)}function l(p){var f=p.shape,d=Z(f);c._removeDiagram(d);var h=p.newRootElement=a.get(mi(d));e.removeRootElement(h)}this.executed("shape.create",function(p){var f=p.shape;s(f)&&u(p)},!0),this.postExecuted("elements.create",function(p){var f=p.elements;M(f,function(d){if(s(d)){var h=a.get(mi(d));if(!(!h||!d.children||!d.children.length)){var m=mg(d);c._showRecursively(m),c._moveChildrenToShape(m,h)}}})},!0),this.reverted("shape.create",function(p){var f=p.shape;s(f)&&l(p)},!0),this.preExecute("shape.delete",function(p){var f=p.shape;!v(f,"bpmn:SubProcess")||!$e(f)||M(ta([f]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(p){var f=p.shape;if(s(f)){var d=a.get(mi(f));d&&n.removeElements(d.children.slice())}},!0),this.executed("shape.delete",function(p){var f=p.shape;s(f)&&l(p)},!0),this.reverted("shape.delete",function(p){var f=p.shape;s(f)&&u(p)},!0),this.preExecuted("shape.replace",function(p){var f=p.oldShape,d=p.newShape;!s(f)||!s(d)||(p.oldRoot=e.removeRootElement(mi(f)))},!0),this.postExecuted("shape.replace",function(p){var f=p.newShape,d=p.oldRoot,h=e.findRoot(mi(f));if(!(!d||!h)){var m=d.children;n.moveElements(m,{x:0,y:0},h)}},!0),this.executed("element.updateProperties",function(p){var f=p.element;if(v(f,"bpmn:SubProcess")){var d=p.properties,h=p.oldProperties,m=h.id,g=d.id;if(m!==g){if(tc(f)){a.updateId(f,$r(g)),a.updateId(m,g);return}var R=a.get($r(m));R&&a.updateId($r(m),$r(g))}}},!0),this.reverted("element.updateProperties",function(p){var f=p.element;if(v(f,"bpmn:SubProcess")){var d=p.properties,h=p.oldProperties,m=h.id,g=d.id;if(m!==g){if(tc(f)){a.updateId(f,$r(m)),a.updateId(g,m);return}var R=a.get($r(g));R&&a.updateId(R,$r(m))}}},!0),t.on("element.changed",function(p){var f=p.element;if(tc(f)){var d=f,h=a.get(pg(d));!h||h===d||t.fire("element.changed",{element:h})}}),this.executed("shape.toggleCollapse",dg,function(p){var f=p.shape;v(f,"bpmn:SubProcess")&&($e(f)?l(p):(u(p),c._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",dg,function(p){var f=p.shape;v(f,"bpmn:SubProcess")&&($e(f)?l(p):(u(p),c._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",yC,function(p){var f=p.shape;if(v(f,"bpmn:SubProcess")){var d=p.newRootElement;if(d)if($e(f))c._moveChildrenToShape(d.children.slice(),f),M(ta(f.children),m=>{n.moveShape(m.annotation,{x:0,y:0},f.parent),M(m.associations,g=>{n.moveConnection(g,{x:0,y:0},f.parent)})});else{c._disconnectSharedAnnotations(f);var h=mg(f);c._moveChildrenToShape(h,d)}}},!0),t.on("copyPaste.createTree",function(p){var f=p.element,d=p.children;if(s(f)){var h=mi(f),m=a.get(h);m&&d.push.apply(d,m.children)}}),t.on("copyPaste.copyElement",function(p){var f=p.descriptor,d=p.element,h=p.elements,m=d.parent,g=v(Ve(m),"bpmndi:BPMNPlane");if(g){var R=pg(m),w=st(h,function(x){return x.id===R});w&&(f.parent=w.id)}}),t.on("copyPaste.pasteElement",function(p){var f=p.descriptor;f.parent&&(s(f.parent)||f.parent.hidden)&&(f.hidden=!0)})}ie(Oi,X),Oi.prototype._moveChildrenToShape=function(e,t){var n=this._modeling;if(e.length){var i=e.filter(function(s){return!s.hidden});if(!i.length){n.moveElements(e,{x:0,y:0},t,{autoResize:!1});return}var r=At(i),o;if(!t.x)o={x:hg.x-r.x,y:hg.y-r.y};else{var a=be(t),c=be(r);o={x:a.x-c.x,y:a.y-c.y}}n.moveElements(e,o,t,{autoResize:!1})}},Oi.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(om(e).map(i=>i.annotation));n.size&&M(ta(e.children),i=>{n.has(i.annotation)&&M(i.associations,r=>{t.removeConnection(r)})})},Oi.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},Oi.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},Oi.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,i=t.create("bpmndi:BPMNPlane",{bpmnElement:e}),r=t.create("bpmndi:BPMNDiagram",{plane:i});i.$parent=r;var o=n.createRoot({id:mi(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},Oi.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=st(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},Oi.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function vC(e){var t=[];return M(ta(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function mg(e){return e.children.slice().concat(vC(e.children)).concat(_C(e))}function _C(e){return nl(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function Ql(e,t){e.invoke(X,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,r=n.context.newShape;if(!(!v(r,"bpmn:SubProcess")||v(r,"bpmn:AdHocSubProcess")||!(v(i,"bpmn:Task")||v(i,"bpmn:CallActivity"))||!$e(r))){var o=bC(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}Ql.$inject=["injector","modeling"],ie(Ql,X);function bC(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function Jl(e,t){X.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;v(i,"bpmn:TextAnnotation")&&(n.parent=i.parent)},!0),this.preExecute(["shape.create","shape.resize","elements.move"],function(n){const i=n.shapes||[n.shape];i.length===1&&v(i[0],"bpmn:TextAnnotation")&&(n.hints=n.hints||{},n.hints.autoResize=!1)},!0),this.preExecute("shape.resize",function(n){var i=n.context,r=i.shape,o=i.hints||{};if(!(!v(r,"bpmn:TextAnnotation")||o.autoResize)){var a=i.newBounds,c=t.getTextAnnotationBounds(a,jn(r)||""),s=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:c.height,x:a.x,y:s?u-c.height:a.y}}})}ie(Jl,X),Jl.$inject=["eventBus","textRenderer"];function ep(e,t){X.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if($e(i))return;var r=Ko(i);r.forEach(function(a){var c=a.incoming.slice(),s=a.outgoing.slice();M(c,function(u){o(u,!0)}),M(s,function(u){o(u,!1)})});function o(a,c){r.indexOf(a.source)!==-1&&r.indexOf(a.target)!==-1||v(a,"bpmn:Association")&&(v(a.source,"bpmn:TextAnnotation")||v(a.target,"bpmn:TextAnnotation"))||(c?t.reconnectEnd(a,i,be(i)):t.reconnectStart(a,i,be(i)))}},!0)}ie(ep,X),ep.$inject=["eventBus","modeling"];var tp=500;function np(e,t,n){X.call(this,e);function i(a){a.length&&a.forEach(function(c){c.type==="label"&&!c.businessObject.name&&(c.hidden=!0)})}function r(a,c){var s=a.children,u=c,l,p;return l=xC(s).concat([a]),p=Em(l),p?(u.width=Math.max(p.width,u.width),u.height=Math.max(p.height,u.height),u.x=p.x+(p.width-u.width)/2,u.y=p.y+(p.height-u.height)/2):(u.x=a.x+(a.width-u.width)/2,u.y=a.y+(a.height-u.height)/2),u}function o(a,c){return{x:a.x+(a.width-c.width)/2,y:a.y+(a.height-c.height)/2,width:c.width,height:c.height}}this.executed(["shape.toggleCollapse"],tp,function(a){var c=a.context,s=c.shape;v(s,"bpmn:SubProcess")&&(s.collapsed?Ve(s).isExpanded=!1:(i(s.children),Ve(s).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],tp,function(a){var c=a.context,s=c.shape;s.collapsed?Ve(s).isExpanded=!1:Ve(s).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],tp,function(a){var c=a.context.shape,s=t.getDefaultSize(c),u;c.collapsed?u=o(c,s):u=r(c,s),n.resizeShape(c,u,null,{autoResize:c.collapsed?!1:"nwse"})})}ie(np,X),np.$inject=["eventBus","elementFactory","modeling"];function xC(e){return e.filter(function(t){return!t.hidden})}function ip(e,t,n,i){t.invoke(X,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,c=a.businessObject;Me(a)||(v(a,"bpmn:Participant")&&$e(a)&&n.ids.unclaim(c.processRef.id),i.unclaimId(c.id,c))}),this.preExecute("connection.delete",function(r){var o=r.context,a=o.connection,c=a.businessObject;i.unclaimId(c.id,c)}),this.preExecute("canvas.updateRoot",function(){var r=e.getRootElement(),o=r.businessObject;v(r,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}ie(ip,X),ip.$inject=["canvas","injector","moddle","modeling"];function rp(e,t){X.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;wC(r,o)&&t.updateProperties(o,{default:null})})}ie(rp,X),rp.$inject=["eventBus","modeling"];function wC(e,t){if(!v(e,"bpmn:SequenceFlow"))return!1;var n=Z(t),i=Z(e);return n.get("default")===i}var EC=500,SC=5e3,gg=["shape.create","shape.delete","shape.move","shape.resize"],yg=[...gg,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function op(e,t){X.call(this,e);var n;function i(){return n=n||new RC,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(yg,SC,function(){i()}),this.postExecuted(yg,EC,function(){o()}),this.preExecute(gg,function(a){var c=a.context,s=c.shape,u=r();!s||s.labelTarget||(v(s,"bpmn:Lane")&&u.addLane(s),v(s,"bpmn:FlowNode")&&u.addFlowNode(s))})}op.$inject=["eventBus","modeling"],ie(op,X);function RC(){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 CC=500,PC=5e3,vg=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],_g=[...vg,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function ap(e,t){X.call(this,e);var n;function i(){return n=n||new AC,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(_g,PC,function(){i()}),this.postExecuted(_g,CC,function(){o()}),this.preExecute(vg,function(a){var c=a.context.connection||a.context.shape,s=r();!c||c.labelTarget||(v(c,"bpmn:FlowElement")&&s.addFlowElement(c),v(c,"bpmn:Group")&&s.addGroup(c))}),this.preExecute("label.create",function(a){var c=a.context.labelTarget;v(c,"bpmn:Group")&&r().addGroup(c)})}ap.$inject=["eventBus","modeling"],ie(ap,X);function AC(){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 sp(e,t){X.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)TC(o)&&!kC(o)&&t.updateProperties(o,{isForCompensation:void 0})})}ie(sp,X),sp.$inject=["eventBus","modeling"];function TC(e){const t=Z(e);return t&&t.isForCompensation}function MC(e){return e&&v(e,"bpmn:BoundaryEvent")&&co(e,"bpmn:CompensateEventDefinition")}function kC(e){return e.incoming.filter(n=>MC(n.source)).length>0}const DC={__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",ml],appendBehavior:["type",gl],associationBehavior:["type",vl],attachEventBehavior:["type",Ns],artifactBehavior:["type",yl],boundaryEventBehavior:["type",_l],categoryRootElementReferenceBehavior:["type",bl],compensateBoundaryEventBehaviour:["type",xl],createBehavior:["type",wl],createDataObjectBehavior:["type",El],createParticipantBehavior:["type",Cl],dataInputAssociationBehavior:["type",Pl],dataStoreBehavior:["type",Al],deleteLaneBehavior:["type",Tl],detachEventBehavior:["type",Gs],dropOnFlowBehavior:["type",kl],eventBasedGatewayBehavior:["type",Dl],fixHoverBehavior:["type",Mm],groupBehavior:["type",Ol],importDockingFix:["type",Dm],isHorizontalFix:["type",Il],labelBehavior:["type",Bl],layoutConnectionBehavior:["type",$l],messageFlowBehavior:["type",Hl],nonInterruptingBehavior:["type",zl],removeElementBehavior:["type",Gl],removeEmbeddedLabelBoundsBehavior:["type",Vl],removeParticipantBehavior:["type",Wl],replaceConnectionBehavior:["type",Ul],replaceElementBehaviour:["type",Zs],resizeBehavior:["type",tg],resizeLaneBehavior:["type",sg],rootElementReferenceBehavior:["type",Xl],spaceToolBehavior:["type",ug],subProcessPlaneBehavior:["type",Oi],subProcessStartEventBehavior:["type",Ql],textAnnotationBehavior:["type",Jl],toggleCollapseConnectionBehaviour:["type",ep],toggleElementCollapseBehaviour:["type",np],unclaimIdBehavior:["type",ip],unsetDefaultFlowBehavior:["type",rp],updateFlowNodeRefsBehavior:["type",op],updateCategoryValueRefsBehavior:["type",ap],setCompensationActivityAfterPasteBehavior:["type",sp]};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 gi={__init__:["rules"],rules:["type",cp]};function Yn(e){X.call(this,e),this.init()}Yn.$inject=["eventBus"],ie(Yn,X),Yn.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,c){return n(o)},!0)})},Yn.prototype.init=function(){};function bg(e,t){var n=Zt(e,t,-15);return n!=="intersect"?n:null}function Jt(e){Yn.call(this,e)}ie(Jt,Yn),Jt.$inject=["eventBus"],Jt.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return OC(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 ic(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return ic(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 Og(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return it(i)&&!rc(t,i)?!1:Rr(t,function(r){return it(r)?ic(r.source,r.target,r):r.host?fa(r,r.host,null,n):fp(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 Pg(a)&&!n.includes(a.host)})?!1:fa(n,t,null,i)||kg(n,t,i)||Dg(n,t)||rc(n,t)}),this.addRule("shape.create",function(e){return fp(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return fa(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return $g(n,t)})},Jt.prototype.canConnectMessageFlow=Ng,Jt.prototype.canConnectSequenceFlow=Bg,Jt.prototype.canConnectDataAssociation=dp,Jt.prototype.canConnectAssociation=Lg,Jt.prototype.canConnectCompensationAssociation=Ig,Jt.prototype.canMove=Dg,Jt.prototype.canAttach=fa,Jt.prototype.canReplace=kg,Jt.prototype.canDrop=_o,Jt.prototype.canInsert=rc,Jt.prototype.canCreate=fp,Jt.prototype.canConnect=ic,Jt.prototype.canResize=Og,Jt.prototype.canCopy=$g;function OC(e){return up(e)?null:De(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function up(e){return!e||Me(e)}function xg(e){do{if(v(e,"bpmn:Process"))return Z(e);if(v(e,"bpmn:Participant"))return Z(e).processRef||Z(e)}while(e=e.parent)}function lp(e){return v(e,"bpmn:TextAnnotation")}function pp(e){return v(e,"bpmn:Group")&&!e.labelTarget}function wg(e){return v(e,"bpmn:BoundaryEvent")&&yi(e,"bpmn:CompensateEventDefinition")}function nc(e){return Z(e).isForCompensation}function LC(e,t){var n=xg(e),i=xg(t);return n===i}function IC(e){return v(e,"bpmn:InteractionNode")&&!v(e,"bpmn:BoundaryEvent")&&(!v(e,"bpmn:Event")||v(e,"bpmn:ThrowEvent")&&Rg(e,"bpmn:MessageEventDefinition"))}function NC(e){return v(e,"bpmn:InteractionNode")&&!nc(e)&&(!v(e,"bpmn:Event")||v(e,"bpmn:CatchEvent")&&Rg(e,"bpmn:MessageEventDefinition"))&&!(v(e,"bpmn:BoundaryEvent")&&!yi(e,"bpmn:MessageEventDefinition"))}function Eg(e){for(var t=e;t=t.parent;){if(v(t,"bpmn:FlowElementsContainer"))return Z(t);if(v(t,"bpmn:Participant"))return Z(t).processRef}return null}function Sg(e,t){var n=Eg(e),i=Eg(t);return n===i}function yi(e,t){var n=Z(e);return!!st(n.eventDefinitions||[],function(i){return v(i,t)})}function Rg(e,t){var n=Z(e);return(n.eventDefinitions||[]).every(function(i){return v(i,t)})}function BC(e){return v(e,"bpmn:FlowNode")&&!v(e,"bpmn:EndEvent")&&!cn(e)&&!(v(e,"bpmn:IntermediateThrowEvent")&&yi(e,"bpmn:LinkEventDefinition"))&&!wg(e)&&!nc(e)}function $C(e){return v(e,"bpmn:FlowNode")&&!v(e,"bpmn:StartEvent")&&!v(e,"bpmn:BoundaryEvent")&&!cn(e)&&!(v(e,"bpmn:IntermediateCatchEvent")&&yi(e,"bpmn:LinkEventDefinition"))&&!nc(e)}function jC(e){return v(e,"bpmn:ReceiveTask")||v(e,"bpmn:IntermediateCatchEvent")&&(yi(e,"bpmn:MessageEventDefinition")||yi(e,"bpmn:TimerEventDefinition")||yi(e,"bpmn:ConditionalEventDefinition")||yi(e,"bpmn:SignalEventDefinition"))}function FC(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function Cg(e,t){var n=FC(t);return n.indexOf(e)!==-1}function ic(e,t,n){if(up(e)||up(t))return null;if(!v(n,"bpmn:DataAssociation")){if(Ng(e,t))return{type:"bpmn:MessageFlow"};if(Bg(e,t))return{type:"bpmn:SequenceFlow"}}var i=dp(e,t);return i||(Ig(e,t)?{type:"bpmn:Association",associationDirection:"One"}:Lg(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function _o(e,t){return Me(e)||pp(e)?!0:v(t,"bpmn:Participant")&&!$e(t)?!1:v(e,"bpmn:Participant")?v(t,"bpmn:Process")||v(t,"bpmn:Collaboration"):De(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:v(e,"bpmn:Lane")?v(t,"bpmn:Participant")||v(t,"bpmn:Lane"):v(e,"bpmn:BoundaryEvent")&&!HC(e)?!1:v(e,"bpmn:FlowElement")&&!v(e,"bpmn:DataStoreReference")?v(t,"bpmn:FlowElementsContainer")?$e(t):De(t,["bpmn:Participant","bpmn:Lane"]):v(e,"bpmn:DataStoreReference")&&v(t,"bpmn:Collaboration")?Vi(Z(t).get("participants"),function(n){return!!n.get("processRef")}):De(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?De(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):v(e,"bpmn:MessageFlow")?v(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function HC(e){return Z(e).cancelActivity&&(Ag(e)||Tg(e))}function Pg(e){return!Me(e)&&v(e,"bpmn:BoundaryEvent")}function zC(e){return v(e,"bpmn:Lane")}function VC(e){return Pg(e)||v(e,"bpmn:IntermediateThrowEvent")&&Ag(e)?!0:v(e,"bpmn:IntermediateCatchEvent")&&Tg(e)}function Ag(e){var t=Z(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Tg(e){return Mg(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Mg(e,t){return t.some(function(n){return yi(e,n)})}function GC(e){return v(e,"bpmn:ReceiveTask")&&st(e.incoming,function(t){return v(t.source,"bpmn:EventBasedGateway")})}function fa(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return Me(r)||!VC(r)||cn(t)||!v(t,"bpmn:Activity")||nc(t)||i&&!bg(i,t)||GC(t)?!1:"attach"}function kg(e,t,n){if(!t)return!1;var i={replacements:[]};return M(e,function(r){cn(t)||v(r,"bpmn:StartEvent")&&r.type!=="label"&&_o(r,t)&&(J1(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(eS(r)||tS(r)||nS(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),Mg(r,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&v(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"})),v(t,"bpmn:Transaction")||yi(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(v(r,"bpmn:EndEvent")&&_o(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),v(r,"bpmn:BoundaryEvent")&&fa(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function Dg(e,t){return Vi(e,zC)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return _o(n,t)})}function fp(e,t,n,i){return t?Me(e)||pp(e)?!0:_o(e,t)||rc(e,t):!1}function Og(e,t,n){return v(e,"bpmn:SubProcess")?$e(e)&&(!t||t.width>=100&&t.height>=80):v(e,"bpmn:Lane")||v(e,"bpmn:Participant")?!0:lp(e)?n?n==="e"||n==="w":!0:pp(e)?!0:Me(e)?n?n==="e"||n==="w":!0:!1}function WC(e,t){var n=lp(e),i=lp(t);return(n||i)&&n!==i}function Lg(e,t){return Cg(t,e)||Cg(e,t)?!1:WC(e,t)?!0:!!dp(e,t)}function Ig(e,t){return Sg(e,t)&&wg(e)&&v(t,"bpmn:Activity")&&!YC(t,e)&&!cn(t)}function Ng(e,t){return Fg(e)&&!Fg(t)?!1:IC(e)&&NC(t)&&!LC(e,t)}function Bg(e,t){return BC(e)&&$C(t)&&Sg(e,t)&&!(v(e,"bpmn:EventBasedGateway")&&!jC(t))}function dp(e,t){return De(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&De(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:De(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&De(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function rc(e,t,n){if(!t)return!1;if(Array.isArray(e)){if(e.length!==1)return!1;e=e[0]}return t.source===e||t.target===e?!1:De(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!Me(t)&&v(e,"bpmn:FlowNode")&&!v(e,"bpmn:BoundaryEvent")&&_o(e,t.parent)}function hp(e,t){return e&&t&&e.indexOf(t)!==-1}function $g(e,t){return Me(t)?!0:!(v(t,"bpmn:Lane")&&!hp(e,t.parent)||v(t,"bpmn:MessageFlow")&&!UC(e,t))}function UC(e,t){var n=jg(t.source),i=jg(t.target);return hp(e,n)&&hp(e,i)}function jg(e){for(;e;e=e.parent)if(v(e,"bpmn:Participant"))return e;return null}function Fg(e){return po(e,"bpmn:Process")||po(e,"bpmn:Collaboration")}function YC(e,t){return e.attachers.includes(t)}const qC={__depends__:[gi],__init__:["bpmnRules"],bpmnRules:["type",Jt]};var KC=2e3;function Hg(e,t){e.on("saveXML.start",KC,n);function n(){var i=t.getRootElements();M(i,function(r){var o=Ve(r),a,c;a=Ko([r]),a=Oe(a,function(s){return s!==r&&!s.labelTarget}),c=rn(a,Ve),o.set("planeElement",c)})}}Hg.$inject=["eventBus","canvas"];const XC={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Hg]};function oc(e){X.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)})}oc.prototype.getOrdering=function(e,t){return null},ie(oc,X);function mp(e,t){oc.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 c=st(n,function(s){return De(a,[s.type])});return c&&c.order||{level:1}}function r(a){var c=a.order;if(c||(a.order=c=i(a)),!c)throw new Error(`no order for <${a.id}>`);return c}function o(a,c,s){for(var u=c;u&&!De(u,s);)u=u.parent;if(!u)throw new Error(`no parent for <${a.id}> in <${c&&c.id}>`);return u}this.getOrdering=function(a,c){if(a.labelTarget||v(a,"bpmn:TextAnnotation"))return{parent:t.findRoot(c)||t.getRootElement(),index:-1};var s=r(a);s.containers&&(c=o(a,c,s.containers));var u=c.children.indexOf(a),l=Vf(c.children,function(p){return!a.labelTarget&&p.labelTarget?!1:s.level<r(p).level});return l!==-1&&u!==-1&&u<l&&(l-=1),{index:l,parent:c}}}mp.$inject=["eventBus","canvas"],ie(mp,oc);const ZC={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",mp]};function da(){}da.prototype.get=function(){return this._data},da.prototype.set=function(e){this._data=e},da.prototype.clear=function(){var e=this._data;return delete this._data,e},da.prototype.isEmpty=function(){return!this._data};const QC={clipboard:["type",da]};var zg=1500;function Vg(e,t,n){var i=this,r=n.get("dragging",!1);function o(a){if(!a.hover){var c=a.originalEvent,s=i._findTargetGfx(c),u=s&&e.get(s);s&&u&&(a.stopPropagation(),r.hover({element:u,gfx:s}),r.move(c))}}r&&t.on("drag.start",function(a){t.once("drag.move",zg,function(c){o(c)})}),(function(){var a,c;t.on("element.hover",function(s){a=s.gfx,c=s.element}),t.on("element.hover",zg,function(s){c&&t.fire("element.out",{element:c,gfx:a})}),t.on("element.out",function(){a=null,c=null})})(),this._findTargetGfx=function(a){var c,s;if(a instanceof MouseEvent)return c=Br(a),s=document.elementFromPoint(c.x,c.y),JC(s)}}Vg.$inject=["elementRegistry","eventBus","injector"];function JC(e){return kr(e,"svg, .djs-element",!0)}const eP={__init__:["hoverFix"],hoverFix:["type",Vg]};function tP(e){return!0}function ac(e){return ar(e)||aC(e)}var Gg=500;function Wg(e,t,n){var i=this;function r(A,F,H){if(!c(A,F)){var N,V,fe;H?V=t.getGraphics(H):(N=F.delegateTarget||F.target,N&&(V=N,H=t.get(V))),!(!V||!H)&&(fe=e.fire(A,{element:H,gfx:V,originalEvent:F}),fe===!1&&(F.stopPropagation(),F.preventDefault()))}}var o={};function a(A){return o[A]}function c(A,F){var H=u[A]||ar;return!H(F)}var s={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":tP,"element.mousedown":ac,"element.mouseup":ac,"element.click":ac,"element.dblclick":ac};function l(A,F,H){var N=s[A];if(!N)throw new Error("unmapped DOM event name <"+A+">");return r(N,F,H)}var p="svg, .djs-element";function f(A,F,H,N){var V=o[H]=function(fe){r(H,fe)};N&&(u[H]=N),V.$delegate=Rn.bind(A,p,F,V)}function d(A,F,H){var N=a(H);N&&Rn.unbind(A,F,N.$delegate)}function h(A){M(s,function(F,H){f(A,H,F)})}function m(A){M(s,function(F,H){d(A,H,F)})}e.on("canvas.destroy",function(A){m(A.svg)}),e.on("canvas.init",function(A){h(A.svg)}),e.on(["shape.added","connection.added"],function(A){var F=A.element,H=A.gfx;e.fire("interactionEvents.createHit",{element:F,gfx:H})}),e.on(["shape.changed","connection.changed"],Gg,function(A){var F=A.element,H=A.gfx;e.fire("interactionEvents.updateHit",{element:F,gfx:H})}),e.on("interactionEvents.createHit",Gg,function(A){var F=A.element,H=A.gfx;i.createDefaultHit(F,H)}),e.on("interactionEvents.updateHit",function(A){var F=A.element,H=A.gfx;i.updateDefaultHit(F,H)});var g=E("djs-hit djs-hit-stroke"),R=E("djs-hit djs-hit-click-stroke"),w=E("djs-hit djs-hit-all"),x=E("djs-hit djs-hit-no-move"),b={all:w,"click-stroke":R,stroke:g,"no-move":x};function E(A,F){return F=O({stroke:"white",strokeWidth:15},F||{}),n.cls(A,["no-fill","no-border"],F)}function T(A,F){var H=b[F];if(!H)throw new Error("invalid hit type <"+F+">");return re(A,H),A}function L(A,F){Re(A,F)}this.removeHits=function(A){var F=ys(".djs-hit",A);M(F,Ft)},this.createDefaultHit=function(A,F){var H=A.waypoints,N=A.isFrame,V;return H?this.createWaypointsHit(F,H):(V=N?"stroke":"all",this.createBoxHit(F,V,{width:A.width,height:A.height}))},this.createWaypointsHit=function(A,F){var H=qo(F);return T(H,"stroke"),L(A,H),H},this.createBoxHit=function(A,F,H){H=O({x:0,y:0},H);var N=me("rect");return T(N,F),re(N,H),L(A,N),N},this.updateDefaultHit=function(A,F){var H=et(".djs-hit",F);if(H)return A.waypoints?tl(H,A.waypoints):re(H,{width:A.width,height:A.height}),H},this.fire=r,this.triggerMouseEvent=l,this.mouseHandler=a,this.registerEvent=f,this.unregisterEvent=d}Wg.$inject=["eventBus","elementRegistry","styles"];const sc={__init__:["interactionEvents"],interactionEvents:["type",Wg]};function bo(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)})}bo.$inject=["eventBus","canvas"],bo.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()})}},bo.prototype.get=function(){return Array.from(this._selectedElements)},bo.prototype.isSelected=function(e){return this._selectedElements.has(e)},bo.prototype.select=function(e,t){var n=this.get();_e(e)||(e=e?[e]:[]);var i=this._canvas,r=i.getRootElement();e=e.filter(function(o){var a=i.findRoot(o);return r===a}),t?M(e,o=>{this._selectedElements.add(o)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var Ug="hover",Yg="selected";function qg(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,Ug)}),t.on("element.out",function(r){i(r.element,Ug)}),t.on("selection.changed",function(r){function o(u){i(u,Yg)}function a(u){n(u,Yg)}var c=new Set(r.oldSelection),s=new Set(r.newSelection);for(let u of c)s.has(u)||o(u);for(let u of s)c.has(u)||a(u)})}qg.$inject=["canvas","eventBus"];function Kg(e,t,n,i){e.on("create.end",500,function(r){var o=r.context,a=o.canExecute,c=o.elements,s=o.hints||{},u=s.autoSelect;if(a){if(u===!1)return;_e(u)?t.select(u):t.select(c.filter(nP))}}),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),c=st(o,function(s){return a.id===s.id});c||t.select(a)}),e.on("element.click",function(r){if(ar(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),c=t.get().length>1,s=ec(r);if(a&&c)return s?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,s)}})}Kg.$inject=["eventBus","selection","canvas","elementRegistry"];function nP(e){return!e.hidden}const qn={__init__:["selectionVisuals","selectionBehavior"],__depends__:[sc],selection:["type",bo],selectionVisuals:["type",qg],selectionBehavior:["type",Kg]};var iP=/^djs-cursor-.*$/;function cc(e){var t=ht(document.body);t.removeMatching(iP),e&&t.add("djs-cursor-"+e)}function Xg(){cc(null)}var rP=5e3;function Zg(e,t){t=t||"element.click";function n(){return!1}return e.once(t,rP,n),function(){e.off(t,n)}}var oP=["c","C"],aP=["v","V"],sP=["d","D"],cP=["x","X"],uP=["y","Y"],Qg=["z","Z"];function lP(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function An(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function Ht(e,t){return e=_e(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function gp(e){return e.shiftKey}function pP(e){return An(e)&&Ht(oP,e)}function fP(e){return An(e)&&Ht(aP,e)}function dP(e){return An(e)&&Ht(sP,e)}function hP(e){return An(e)&&Ht(cP,e)}function mP(e){return An(e)&&!gp(e)&&Ht(Qg,e)}function gP(e){return An(e)&&(Ht(uP,e)||Ht(Qg,e)&&gp(e))}var xo=Math.round,Jg="djs-drag-active";function jr(e){e.preventDefault()}function yP(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function vP(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function ey(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(x){var b=t.viewbox(),E=t._container.getBoundingClientRect();return{x:b.x+(x.x-E.left)/b.scale,y:b.y+(x.y-E.top)/b.scale}}function c(x,b){b=b||o;var E=e.createEvent(O({},b.payload,b.data,{isTouch:b.isTouch}));return e.fire("drag."+x,E)===!1?!1:e.fire(b.prefix+"."+x,E)}function s(x){var b=x.filter(function(E){return i.get(E.id)});b.length&&n.select(b)}function u(x,b){var E=o.payload,T=o.displacement,L=o.globalStart,A=Br(x),F=ii(A,L),H=o.localStart,N=a(A),V=ii(N,H);if(!o.active&&(b||vP(F)>o.threshold)){if(O(E,{x:xo(H.x+T.x),y:xo(H.y+T.y),dx:0,dy:0},{originalEvent:x}),c("start")===!1)return g();o.active=!0,o.keepSelection||(E.previousSelection=n.get(),n.select(null)),o.cursor&&cc(o.cursor),t.addMarker(t.getRootElement(),Jg)}Kl(x),o.active&&(O(E,{x:xo(N.x+T.x),y:xo(N.y+T.y),dx:xo(V.x),dy:xo(V.y)},{originalEvent:x}),c("move"))}function l(x){var b,E=!0;o.active&&(x&&(o.payload.originalEvent=x,Kl(x)),E=c("end")),E===!1&&c("rejected"),b=R(E!==!0),c("ended",b)}function p(x){Ht("Escape",x)&&(jr(x),g())}function f(x){var b;o.active&&(b=Zg(e),setTimeout(b,400),jr(x)),l(x)}function d(x){u(x)}function h(x){var b=o.payload;b.hoverGfx=x.gfx,b.hover=x.element,c("hover")}function m(x){c("out");var b=o.payload;b.hoverGfx=null,b.hover=null}function g(x){var b;if(o){var E=o.active;E&&c("cancel"),b=R(x),E&&c("canceled",b)}}function R(x){var b,E;c("cleanup"),Xg(),o.trapClick?E=f:E=l,Se.unbind(document,"mousemove",u),Se.unbind(document,"dragstart",jr),Se.unbind(document,"selectstart",jr),Se.unbind(document,"mousedown",E,!0),Se.unbind(document,"mouseup",E,!0),Se.unbind(document,"keyup",p),Se.unbind(document,"touchstart",d,!0),Se.unbind(document,"touchcancel",g,!0),Se.unbind(document,"touchmove",u,!0),Se.unbind(document,"touchend",l,!0),e.off("element.hover",h),e.off("element.out",m),t.removeMarker(t.getRootElement(),Jg);var T=o.payload.previousSelection;return x!==!1&&T&&!n.get().length&&s(T),b=o,o=null,b}function w(x,b,E,T){o&&g(!1),typeof b=="string"&&(T=E,E=b,b=null),T=O({},r,T||{});var L=T.data||{},A,F,H,N,V;if(T.trapClick?N=f:N=l,x?(A=vo(x)||x,F=Br(x),Kl(x),A.type==="dragstart"&&jr(A)):(A=null,F={x:0,y:0}),H=a(F),b||(b=H),V=yP(A),o=O({prefix:E,data:L,payload:{},globalStart:F,displacement:ii(b,H),localStart:H,isTouch:V},T),T.manual||(V?(Se.bind(document,"touchstart",d,!0),Se.bind(document,"touchcancel",g,!0),Se.bind(document,"touchmove",u,!0),Se.bind(document,"touchend",l,!0)):(Se.bind(document,"mousemove",u),Se.bind(document,"dragstart",jr),Se.bind(document,"selectstart",jr),Se.bind(document,"mousedown",N,!0),Se.bind(document,"mouseup",N,!0)),Se.bind(document,"keyup",p),e.on("element.hover",h),e.on("element.out",m)),c("init")===!1)return g(),!1;T.autoActivate&&u(x,!0)}e.on("diagram.destroy",g),this.init=w,this.move=u,this.hover=h,this.out=m,this.end=l,this.cancel=g,this.context=function(){return o},this.setOptions=function(x){O(r,x)}}ey.$inject=["eventBus","canvas","selection","elementRegistry"];const Li={__depends__:[eP,qn],dragging:["type",ey]};function wo(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}wo.prototype.next=function(){return this._prefix+ ++this._counter};const _P=new wo("ps");var bP=["marker-start","marker-mid","marker-end"],xP=["circle","ellipse","line","path","polygon","polyline","path","rect"];function sr(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}sr.$inject=["elementRegistry","eventBus","canvas","styles"],sr.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")},sr.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},sr.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=dh(n);return this._cloneMarkers(Lr(r),i),re(r,this._styles.cls(i,[])),Re(t,r),re(r,"data-preview-support-element-id",e.id),r},sr.prototype.addFrame=function(e,t){var n=me("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return Re(t,n),re(n,"data-preview-support-element-id",e.id),n},sr.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),RP(e)&&bP.forEach(function(r){if(re(e,r)){var o=wP(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},sr.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,_P.next()].join("-"),a=et("marker#"+n.id,e);e=e||this._canvas._svg;var c=a||dh(n);c.id=o,Fe(c).add(r);var s=et(":scope > defs",e);s||(s=me("defs"),Re(e,s)),Re(s,c);var u=SP(c.id);re(t,i,u)};function wP(e,t,n){var i=EP(re(e,t));return et("marker#"+i,n||document)}function EP(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function SP(e){return"url(#"+e+")"}function RP(e){return xP.indexOf(e.nodeName)!==-1}const Eo={__init__:["previewSupport"],previewSupport:["type",sr]};var CP="drop-ok",ty="drop-not-ok",ny="attach-ok",iy="new-parent",ry="create",PP=2e3;function oy(e,t,n,i,r){function o(s,u,l,p,f){if(!u)return!1;s=Oe(s,function(w){var x=w.labelTarget;return!w.parent&&!(Me(w)&&s.indexOf(x)!==-1)});var d=st(s,function(w){return!it(w)}),h=!1,m=!1,g=!1;sy(s)&&(h=r.allowed("shape.attach",{position:l,shape:d,target:u})),h||(sy(s)?g=r.allowed("shape.create",{position:l,shape:d,source:p,target:u}):g=r.allowed("elements.create",{elements:s,position:l,target:u}));var R=f.connectionTarget;return g||h?(d&&p&&(m=r.allowed("connection.create",{source:R===p?d:p,target:R===p?p:d,hints:{targetParent:u,targetAttach:h}})),{attach:h,connect:m}):g===null||h===null?null:!1}function a(s,u){[ny,CP,ty,iy].forEach(function(l){l===u?e.addMarker(s,l):e.removeMarker(s,l)})}n.on(["create.move","create.hover"],function(s){var u=s.context,l=u.elements,p=s.hover,f=u.source,d=u.hints||{};if(!p){u.canExecute=!1,u.target=null;return}ay(s);var h={x:s.x,y:s.y},m=u.canExecute=p&&o(l,p,h,f,d);p&&m!==null&&(u.target=p,m&&m.attach?a(p,ny):a(p,m?iy:ty))}),n.on(["create.end","create.out","create.cleanup"],function(s){var u=s.hover;u&&a(u,null)}),n.on("create.end",function(s){var u=s.context,l=u.source,p=u.shape,f=u.elements,d=u.target,h=u.canExecute,m=h&&h.attach,g=h&&h.connect,R=u.hints||{};if(h===!1||!d)return!1;ay(s);var w={x:s.x,y:s.y};g?p=i.appendShape(l,p,w,d,{attach:m,connection:g===!0?{}:g,connectionTarget:R.connectionTarget}):(f=i.createElements(f,w,d,O({},R,{attach:m})),p=st(f,function(x){return!it(x)})),O(u,{elements:f,shape:p}),O(s,{elements:f,shape:p})});function c(){var s=t.context();s&&s.prefix===ry&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",c),n.once(["create.cancel","create.end"],PP,function(){n.off("elements.changed",c)})}),this.start=function(s,u,l){_e(u)||(u=[u]);var p=st(u,function(h){return!it(h)});if(p){l=O({elements:u,hints:{},shape:p},l||{}),M(u,function(h){we(h.x)||(h.x=0),we(h.y)||(h.y=0)});var f=Oe(u,function(h){return!h.hidden}),d=At(f);M(u,function(h){it(h)&&(h.waypoints=rn(h.waypoints,function(m){return{x:m.x-d.x-d.width/2,y:m.y-d.y-d.height/2}})),O(h,{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2})}),t.init(s,ry,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:u,context:l}})}}}oy.$inject=["canvas","dragging","eventBus","modeling","rules"];function ay(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 sy(e){return e&&e.length===1&&!it(e[0])}var AP=750;function cy(e,t,n,i,r){function o(a){var c=me("g");re(c,r.cls("djs-drag-group",["no-events"]));var s=me("g");return a.forEach(function(u){var l;u.hidden||(u.waypoints?(l=n._createContainer("connection",s),n.drawConnection(Lr(l),u)):(l=n._createContainer("shape",s),n.drawShape(Lr(l),u),Qt(l,u.x,u.y)),i.addDragger(u,c,l))}),c}t.on("create.move",AP,function(a){var c=a.hover,s=a.context,u=s.elements,l=s.dragGroup;l||(l=s.dragGroup=o(u));var p;c?(l.parentNode||(p=e.getActiveLayer(),Re(p,l)),Qt(l,a.x,a.y)):Ft(l)}),t.on("create.cleanup",function(a){var c=a.context,s=c.dragGroup;s&&Ft(s)})}cy.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const uc={__depends__:[Li,Eo,gi,qn],__init__:["create","createPreview"],create:["type",oy],createPreview:["type",cy]};function yp(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)})}yp.$inject=["eventBus"],yp.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||TP(0,0)};function TP(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 ha={__init__:["mouse"],mouse:["type",yp]};var uy=2e3;function Tn(e,t,n,i,r,o,a,c){this._canvas=e,this._create=t,this._elementFactory=i,this._eventBus=r,this._modeling=o,this._mouse=a,this._rules=c,r.on("copyPaste.copyElement",function(s){var u=s.descriptor,l=s.element,p=s.elementsSet;u.priority=1,u.id=l.id,p.has(l.parent)&&(u.parent=l.parent.id),MP(l)&&(u.priority=2,u.host=l.host.id),it(l)&&(u.priority=3,u.source=l.source.id,u.target=l.target.id,u.waypoints=kP(l)),Me(l)&&(u.priority=4,u.labelTarget=l.labelTarget.id),M(["x","y","width","height"],function(f){we(l[f])&&(u[f]=l[f])}),u.hidden=l.hidden,u.collapsed=l.collapsed}),r.on("copyPaste.elementsCopied",uy,function(s){var u;((u=s.hints)==null?void 0:u.clip)!==!1&&n.set(s.tree)}),r.on("copyPaste.pasteElements",uy,function(s){s.tree||(s.tree=n.get())}),r.on("copyPaste.pasteElements",function(s){var u=s.hints;O(u,{createElementsBehavior:!1})})}Tn.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],Tn.prototype.copy=function(e,t={}){var n,i;return _e(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(_e(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},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 M(e,function(n){M(n,function(i){i.id&&(t[i.id]=!0)})}),t},Tn.prototype._paste=function(e,t,n,i){M(e,function(o){we(o.x)||(o.x=0),we(o.y)||(o.y=0)});var r=At(e);return M(e,function(o){it(o)&&(o.waypoints=rn(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),O(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,O({},i))},Tn.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return M(e,function(o,a){o=oi(o,"priority"),M(o,function(c){var s=O({},ai(c,["priority"]));i[c.parent]?s.parent=i[c.parent]:delete s.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:s});var u;if(it(s)){s.source=i[c.source],s.target=i[c.target],u=i[c.id]=t.createConnection(s),r.push(u);return}if(Me(s)){s.labelTarget=i[s.labelTarget],u=i[c.id]=t.createLabel(s),r.push(u);return}s.host&&(s.host=i[s.host]),u=i[c.id]=t.createShape(s),r.push(u)})}),r},Tn.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(ai(e,["id"]));return t},Tn.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(ai(e,["id"]));return t},Tn.prototype.createShape=function(e){var t=this._elementFactory.createShape(ai(e,["id"]));return t},Tn.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(it(e)&&(!n.has(e.source)||!n.has(e.target))||Me(e)&&!n.has(e.labelTarget))},Tn.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=xs(e);function c(p,f){return t.allowed("element.copy",{element:p,elements:f})}function s(p,f){var d=o.get(p);if(!d){var h={element:p,depth:f};r.push(h),o.set(p,h);return}if(d.depth<f){r=u(d,r);var m={element:d.element,depth:f};r.push(m),o.set(p,m)}}function u(p,f){var d=f.indexOf(p);return d!==-1&&f.splice(d,1),f}Or(a,function(p,f,d){if(Me(p))return;M(p.labels,function(g){s(g,d)});function h(g){g&&g.length&&M(g,function(R){M(R.labels,function(w){s(w,d)}),s(R,d)})}M([p.attachers,p.incoming,p.outgoing],h),s(p,d);var m=[];return p.children&&(m=p.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:p,children:m}),m}),e=rn(r,function(p){return p.element});var l=new Set(e);return r=rn(r,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:l}),p}),r=oi(r,function(p){return p.descriptor.priority}),e=rn(r,function(p){return p.element}),M(r,function(p){var f=p.depth;if(!n.hasRelations(p.element,e,l)){py(p.element,e),l.delete(p.element);return}if(!c(p.element,e)){py(p.element,e),l.delete(p.element);return}i[f]||(i[f]=[]),i[f].push(p.descriptor)}),i};function MP(e){return!!e.host}function kP(e){return rn(e.waypoints,function(t){return t=ly(t),t.original&&(t.original=ly(t.original)),t})}function ly(e){return O({},e)}function py(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const DP={__depends__:[QC,uc,ha,gi],__init__:["copyPaste"],copyPaste:["type",Tn]};function vp(e,t,n){_e(n)||(n=[n]),M(n,function(i){Sr(e[i])||(t[i]=e[i])})}var _p=750;function fy(e,t,n){function i(s,u){var l=e.create(s.$type);return n.copyElement(s,l,null,u)}t.on("copyPaste.copyElement",_p,function(s){var u=s.descriptor,l=s.element,p=Z(l);if(Me(l))return u;var f=u.businessObject=i(p,!0),d=u.di=i(Ve(l),!0);d.bpmnElement=f,vp(f,u,"name"),vp(d,u,"isExpanded"),p.default&&(u.default=p.default.id)});var r="-bpmn-js-refs";function o(s){return s[r]=s[r]||{}}function a(s,u){s[r]=u}function c(s,u,l){var p=Z(s);return s.default&&(l[s.default]={element:p,property:"default"}),s.host&&(Z(s).attachedToRef=Z(u[s.host])),ai(l,En(l,function(f,d,h){var m=d.element,g=d.property;return h===s.id&&(m.set(g,p),f.push(s.id)),f},[]))}t.on("copyPaste.pasteElement",function(s){var u=s.cache,l=s.descriptor,p=l.businessObject,f=l.di;if(Me(l)){l.businessObject=Z(u[l.labelTarget]),l.di=Ve(u[l.labelTarget]);return}p=l.businessObject=i(p),f=l.di=i(f),f.bpmnElement=p,vp(l,p,["isExpanded","name"]),l.type=p.$type}),t.on("copyPaste.copyElement",_p,function(s){var u=s.descriptor,l=s.element;if(v(l,"bpmn:Participant")){var p=Z(l);p.processRef&&(u.processRef=i(p.processRef,!0))}}),t.on("copyPaste.pasteElement",function(s){var u=s.descriptor,l=u.processRef;l&&(u.processRef=i(l))}),t.on("copyPaste.createTree",function(s){var u=s.element,l=s.children;v(u,"bpmn:SubProcess")&&M(ta(l),p=>{l.push(p.annotation)})}),t.on("copyPaste.pasteElement",_p,function(s){var u=s.cache,l=s.descriptor;a(u,c(l,u,o(u)))})}fy.$inject=["bpmnFactory","eventBus","moddleCopy"];const OP=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],LP=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function ma(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",i=>{const{propertyNames:r}=i;if(!(!r||!r.length))return oi(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,c=Gt(r)&&r.$descriptor;if(a&&LP.includes(a))return o;if(a&&OP.includes(a)||a&&c&&!st(c.properties,Jr({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:r}=i;if(v(r,"bpmn:ExtensionElements")&&(!r.values||!r.values.length))return!1})}ma.$inject=["eventBus","bpmnFactory","moddle"],ma.prototype.copyElement=function(e,t,n,i=!1){n&&!_e(n)&&(n=[n]),n=n||bp(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(_e(r)&&(n=r),M(n,o=>{let a;wn(e,o)&&(a=e.get(o));const c=this.copyProperty(a,t,o,i);!$t(c)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:c,propertyName:o})===!1||t.set(o,c)})),t},ma.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 Gt(r)&&r.$type&&!r.$parent&&(r.$parent=t),r;const o=this._moddle.getPropertyDescriptor(t,n);if(!o.isReference)return o.isId?e&&this._copyId(e,t,i):_e(e)?En(e,(a,c)=>{const s=this.copyProperty(c,t,n,i);return s?a.concat(s):a},[]):Gt(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},ma.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 bp(e,t){return En(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const dy={__depends__:[DP],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",fy],moddleCopy:["type",ma]};var hy=Math.round;function xp(e,t){this._modeling=e,this._eventBus=t}xp.$inject=["modeling","eventBus"],xp.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,c=t.x||e.x,s=t.y||e.y,u=hy(c+o/2),l=hy(s+a/2),p=i.replaceShape(e,O({},t,{x:u,y:l,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:p,hints:n}),p};function my(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}my.$inject=["selection","eventBus"];const IP={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",my],replace:["type",xp]};function NP(e,t,n){_e(n)||(n=[n]),M(n,function(i){Sr(e[i])||(t[i]=e[i])})}var BP=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function $P(e,t){var n=e&&wn(e,"collapsed")?e.collapsed:!$e(e),i;return t&&(wn(t,"collapsed")||wn(t,"isExpanded"))?i=wn(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function gy(e,t,n,i,r,o){function a(c,s,u){u=u||{};var l=s.type,p=c.businessObject;if(lc(p)&&(l==="bpmn:SubProcess"||l==="bpmn:AdHocSubProcess")&&$P(c,s))return i.toggleCollapse(c),c;var f=e.create(l),d={type:l,businessObject:f};d.di={},l==="bpmn:ExclusiveGateway"&&(d.di.isMarkerVisible=!0),NP(c.di,d.di,["fill","stroke","background-color","border-color","color"]);var h=bp(p.$descriptor),m=bp(f.$descriptor,!0),g=jP(h,m);O(f,ni(s,BP));var R=Oe(g,function(b){return b==="eventDefinitions"?yy(c,s.eventDefinitionType):b==="loopCharacteristics"?!cn(f):wn(f,b)||b==="processRef"&&s.isExpanded===!1||b==="triggeredByEvent"?!1:b==="isForCompensation"?!cn(f):!0});if(f=n.copyElement(p,f,R),s.eventDefinitionType&&(yy(f,s.eventDefinitionType)||(d.eventDefinitionType=s.eventDefinitionType,d.eventDefinitionAttrs=s.eventDefinitionAttrs)),v(p,"bpmn:Activity")){if(lc(p))d.isExpanded=$e(c);else if(s&&wn(s,"isExpanded")){d.isExpanded=s.isExpanded;var w=t.getDefaultSize(f,{isExpanded:d.isExpanded});d.width=w.width,d.height=w.height,d.x=c.x-(d.width-c.width)/2,d.y=c.y-(d.height-c.height)/2}$e(c)&&!v(p,"bpmn:Task")&&d.isExpanded&&(d.width=c.width,d.height=c.height)}if(lc(p)&&!lc(f)&&(u.moveChildren=!1),v(p,"bpmn:Participant")){s.isExpanded===!0?f.processRef=e.create("bpmn:Process"):u.moveChildren=!1;var x=Yt(c);Ve(c).isHorizontal||(Ve(d).isHorizontal=x),d.width=x?c.width:t.getDefaultSize(d).width,d.height=x?t.getDefaultSize(d).height:c.height}return o.allowed("shape.resize",{shape:f})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),f.name=p.name,De(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&De(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(f.default=p.default),s.host&&!v(p,"bpmn:BoundaryEvent")&&v(f,"bpmn:BoundaryEvent")&&(d.host=s.host),(d.type==="bpmn:DataStoreReference"||d.type==="bpmn:DataObjectReference")&&(d.x=c.x+(c.width-d.width)/2),r.replaceElement(c,d,{...u,targetElement:s})}this.replaceElement=a}gy.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function lc(e){return v(e,"bpmn:SubProcess")}function yy(e,t){var n=Z(e);return t&&n.get("eventDefinitions").some(function(i){return v(i,t)})}function jP(e,t){return e.filter(function(n){return t.includes(n)})}const vy={__depends__:[dy,IP,qn],bpmnReplace:["type",gy]};var FP=250;function Fr(e){this._eventBus=e,this._tools=[],this._active=null}Fr.$inject=["eventBus"],Fr.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)},Fr.prototype.isActive=function(e){return e&&this._active===e},Fr.prototype.length=function(e){return this._tools.length},Fr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Fr.prototype.bindEvents=function(e,t){var n=this._eventBus,i=[];n.on(t.tool+".init",function(r){var o=r.context;if(!o.reactivate&&this.isActive(e)){this.setActive(null);return}this.setActive(e)},this),M(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,FP,function(r){this._active&&(HP(r)||this.setActive(null))},this)};function HP(e){var t=e.originalEvent&&e.originalEvent.target;return t&&kr(t,'.group[data-group="tools"]')}const pc={__depends__:[Li],__init__:["toolManager"],toolManager:["type",Fr]};function zP(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 VP(e,t){var n=[],i=new Set(e);M(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,c=o.outgoing;M(a.concat(c),function(s){var u=s.source,l=s.target;(i.has(u)||i.has(l))&&(r.has(s)||(r.add(s),n.push(s)))})}),n}function GP(e,t,n){var i=e.x,r=e.y,o=e.width,a=e.height,c=n.x,s=n.y;switch(t){case"n":return{x:i,y:r+s,width:o,height:a-s};case"s":return{x:i,y:r,width:o,height:a+s};case"w":return{x:i+c,y:r,width:o-c,height:a};case"e":return{x:i,y:r,width:o+c,height:a};default:throw new Error("unknown direction: "+t)}}var wp=Math.abs,WP=Math.round,Ii={x:"width",y:"height"},_y="crosshair",cr={n:"top",w:"left",s:"bottom",e:"right"},UP=1500,fc={n:"s",w:"e",s:"n",e:"w"},dc=20;function Kn(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 c=this;o.registerTool("space",{tool:"spaceTool.selection",dragging:"spaceTool"}),n.on("spaceTool.selection.end",function(s){n.once("spaceTool.selection.ended",function(){c.activateMakeSpace(s.originalEvent)})}),n.on("spaceTool.move",UP,function(s){var u=s.context,l=u.initialized;l||(l=u.initialized=c.init(s,u)),l&&xy(s)}),n.on("spaceTool.end",function(s){var u=s.context,l=u.axis,p=u.direction,f=u.movingShapes,d=u.resizingShapes,h=u.start;if(u.initialized){xy(s);var m={x:0,y:0};m[l]=WP(s["d"+l]),c.makeSpace(f,d,m,p,h),n.once("spaceTool.ended",function(g){c.activateSelection(g.originalEvent,!0,!0)})}})}Kn.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Kn.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:_y,data:{context:{reactivate:n}},trapClick:!1})},Kn.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:_y,data:{context:{}}})},Kn.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},Kn.prototype.init=function(e,t){var n=wp(e.dx)>wp(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(wp(i)<5)return!1;i<0&&(i*=-1),pa(e)&&(i*=-1);var o=zP(n,i),a=this._canvas.getRootElement();!ec(e)&&e.hover&&(a=e.hover);var c=[...Ko(a),...a.attachers||[]],s=this.calculateAdjustments(c,n,i,r),u=this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:s.resizingShapes,start:r}),l=YP(s,n,o,r,u);return O(t,s,{axis:n,direction:o,spaceToolConstraints:l,start:r}),cc("resize-"+(n==="x"?"ew":"ns")),!0},Kn.prototype.calculateAdjustments=function(e,t,n,i){var r=this._rules,o=[],a=[],c=new Set,s=new Set,u=[],l=[];function p(d){c.has(d)||(c.add(d),o.push(d));var h=d.label;h&&!c.has(h)&&(c.add(h),o.push(h))}function f(d){s.has(d)||(s.add(d),a.push(d))}return M(e,function(d){if(!(!d.parent||Me(d))){if(it(d)){l.push(d);return}var h=d[t],m=h+d[Ii[t]];if(qP(d)&&(n>0&&be(d)[t]>i||n<0&&be(d)[t]<i)){u.push(d);return}if(n>0&&h>i||n<0&&m<i){p(d);return}if(h<i&&m>i&&r.allowed("shape.resize",{shape:d})){f(d);return}}}),M(o,function(d){var h=d.attachers;h&&M(h,function(m){p(m)})}),M(u,function(d){var h=d.host;(c.has(h)||s.has(h))&&p(d)}),M(l,function(d){var h=d.source,m=d.target,g=d.label;(c.has(h)||s.has(h))&&(c.has(m)||s.has(m))&&g&&p(g)}),{movingShapes:o,resizingShapes:a}},Kn.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Kn.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function by(e){return{top:e.top-dc,right:e.right+dc,bottom:e.bottom+dc,left:e.left-dc}}function xy(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;we(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),we(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),we(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),we(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function YP(e,t,n,i,r){var o=e.movingShapes,a=e.resizingShapes;if(a.length){var c={},s,u,l=new Set(o),p=new Set(a);return M(a,function(f){var d=f.attachers,h=f.children,m=ye(f),g=Oe(h,function(V){return!it(V)&&!Me(V)&&!l.has(V)&&!p.has(V)}),R=Oe(h,function(V){return!it(V)&&!Me(V)&&l.has(V)}),w,x,b,E=[],T=[],L,A,F,H;g.length&&(x=by(ye(At(g))),w=i-m[cr[n]]+x[cr[n]],n==="n"?c.bottom=u=we(u)?Math.min(u,w):w:n==="w"?c.right=u=we(u)?Math.min(u,w):w:n==="s"?c.top=s=we(s)?Math.max(s,w):w:n==="e"&&(c.left=s=we(s)?Math.max(s,w):w)),R.length&&(b=by(ye(At(R))),w=i-b[cr[fc[n]]]+m[cr[fc[n]]],n==="n"?c.bottom=u=we(u)?Math.min(u,w):w:n==="w"?c.right=u=we(u)?Math.min(u,w):w:n==="s"?c.top=s=we(s)?Math.max(s,w):w:n==="e"&&(c.left=s=we(s)?Math.max(s,w):w)),d&&d.length&&(d.forEach(function(V){l.has(V)?E.push(V):T.push(V)}),E.length&&(L=ye(At(E.map(be))),A=m[cr[fc[n]]]-(L[cr[fc[n]]]-i)),T.length&&(F=ye(At(T.map(be))),H=F[cr[n]]-(m[cr[n]]-i)),n==="n"?(w=Math.min(A||1/0,H||1/0),c.bottom=u=we(u)?Math.min(u,w):w):n==="w"?(w=Math.min(A||1/0,H||1/0),c.right=u=we(u)?Math.min(u,w):w):n==="s"?(w=Math.max(A||-1/0,H||-1/0),c.top=s=we(s)?Math.max(s,w):w):n==="e"&&(w=Math.max(A||-1/0,H||-1/0),c.left=s=we(s)?Math.max(s,w):w));var N=r&&r[f.id];N&&(n==="n"?(w=i+f[Ii[t]]-N[Ii[t]],c.bottom=u=we(u)?Math.min(u,w):w):n==="w"?(w=i+f[Ii[t]]-N[Ii[t]],c.right=u=we(u)?Math.min(u,w):w):n==="s"?(w=i-f[Ii[t]]+N[Ii[t]],c.top=s=we(s)?Math.max(s,w):w):n==="e"&&(w=i-f[Ii[t]]+N[Ii[t]],c.left=s=we(s)?Math.max(s,w):w))}),c}}function qP(e){return!!e.host}var Ep="djs-dragging",wy="djs-resizing",KP=250,hc=Math.max;function Ey(e,t,n,i,r){function o(a,c){M(a,function(s){r.addDragger(s,c),n.addMarker(s,Ep)})}e.on("spaceTool.selection.start",function(a){var c=n.getLayer("space"),s=a.context,u={x:"M 0,-10000 L 0,10000",y:"M -10000,0 L 10000,0"},l=me("g");re(l,i.cls("djs-crosshair-group",["no-events"])),Re(c,l);var p=me("path");re(p,"d",u.x),Fe(p).add("djs-crosshair"),Re(l,p);var f=me("path");re(f,"d",u.y),Fe(f).add("djs-crosshair"),Re(l,f),s.crosshairGroup=l}),e.on("spaceTool.selection.move",function(a){var c=a.context.crosshairGroup;Qt(c,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var c=a.context,s=c.crosshairGroup;s&&Ft(s)}),e.on("spaceTool.move",KP,function(a){var c=a.context,s=c.line,u=c.axis,l=c.movingShapes,p=c.resizingShapes;if(c.initialized){if(!c.dragGroup){var f=n.getLayer("space");s=me("path"),re(s,"d","M0,0 L0,0"),Fe(s).add("djs-crosshair"),Re(f,s),c.line=s;var d=me("g");re(d,i.cls("djs-drag-group",["no-events"])),Re(n.getActiveLayer(),d),o(l,d);var h=new Set(l);M(p,function(T){h.add(T)});var m=new Set,g=c.movingConnections=[];h.forEach(function(T){M(T.outgoing,function(L){m.has(L)||!it(L)||!h.has(L.target)||(m.add(L),g.push(L))})}),o(g,d),c.dragGroup=d}if(!c.frameGroup){var R=me("g");re(R,i.cls("djs-frame-group",["no-events"])),Re(n.getActiveLayer(),R);var w=[];M(p,function(T){var L=r.addFrame(T,R),A=L.getBBox();w.push({element:L,initialBounds:A}),n.addMarker(T,wy)}),c.frameGroup=R,c.frames=w}var x={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};re(s,{d:x[u]});var b={x:"y",y:"x"},E={x:a.dx,y:a.dy};E[b[c.axis]]=0,Qt(c.dragGroup,E.x,E.y),M(c.frames,function(T){var L=T.element,A=T.initialBounds,F,H;c.direction==="e"?re(L,{width:hc(A.width+E.x,5)}):(F=hc(A.width-E.x,5),re(L,{width:F,x:A.x+A.width-F})),c.direction==="s"?re(L,{height:hc(A.height+E.y,5)}):(H=hc(A.height-E.y,5),re(L,{height:H,y:A.y+A.height-H}))})}}),e.on("spaceTool.cleanup",function(a){var c=a.context,s=c.movingShapes,u=c.movingConnections,l=c.resizingShapes,p=c.line,f=c.dragGroup,d=c.frameGroup;M(s,function(h){n.removeMarker(h,Ep)}),M(u,function(h){n.removeMarker(h,Ep)}),f&&(Ft(p),Ft(f)),M(l,function(h){n.removeMarker(h,wy)}),d&&Ft(d)})}Ey.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const XP={__init__:["spaceToolPreview"],__depends__:[Li,gi,pc,Eo,ha],spaceTool:["type",Kn],spaceToolPreview:["type",Ey]};function mc(e,t){e.invoke(Kn,this),this._canvas=t}mc.$inject=["injector","canvas"],ie(mc,Kn),mc.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=Zr(ro(r.children.filter(u=>v(u,"bpmn:Artifact")),At(o))));const c=[...e,...a];var s=Kn.prototype.calculateAdjustments.call(this,c,t,n,i);return s.resizingShapes=s.resizingShapes.filter(function(u){return!(v(u,"bpmn:TextAnnotation")||ZP(u)&&(t==="y"&&Yt(u)||t==="x"&&!Yt(u)))}),s};function ZP(e){return v(e,"bpmn:Participant")&&!Z(e).processRef}const Sy={__depends__:[XP],spaceTool:["type",mc]};function vt(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)}vt.$inject=["eventBus","injector"],vt.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()},vt.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},vt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},vt.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()}},vt.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()}},vt.prototype.register=function(e,t){this._setHandler(e,t)},vt.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)},vt.prototype.canUndo=function(){return!!this._getUndoAction()},vt.prototype.canRedo=function(){return!!this._getRedoAction()},vt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},vt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},vt.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)})},vt.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},vt.prototype._createId=function(){return this._uid++},vt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},vt.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()},vt.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)},vt.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:Gf("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},vt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=_e(e)?e:[e],t.dirty=t.dirty.concat(e))},vt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},vt.prototype._revertedAction=function(e){this._stackIdx--},vt.prototype._getHandler=function(e){return this._handlerMap[e]},vt.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 QP={commandStack:["type",vt]};function ur(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 JP=250,Ry=1400;function Sp(e,t,n){X.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",Ry,function(r){var o=r.context,a=o.shapes,c=o.validatedShapes;o.shapes=Cy(a),o.validatedShapes=Cy(c)}),i&&t.on("shape.move.start",JP,function(r){var o=r.context,a=new Set(o.shapes),c=new Set;for(const s of a)for(const u of s.labels)!u.hidden&&!a.has(u)&&c.add(u),s.labelTarget&&c.add(s);for(const s of c)i.makeDraggable(o,s,!0)}),this.preExecuted("elements.move",Ry,function(r){var o=r.context,a=o.closure,c=a.enclosedElements,s=[];M(c,function(u){M(u.labels,function(l){c[l.id]||s.push(l)})}),a.addAll(s)}),this.preExecute(["connection.delete","shape.delete"],function(r){var o=r.context,a=o.connection||o.shape;ur(a.labels,function(c){n.removeShape(c,{nested:!0})})}),this.execute("shape.delete",function(r){var o=r.context,a=o.shape,c=a.labelTarget;c&&(o.labelTargetIndex=il(c.labels,a),o.labelTarget=c,a.labelTarget=null)}),this.revert("shape.delete",function(r){var o=r.context,a=o.shape,c=o.labelTarget,s=o.labelTargetIndex;c&&(St(c.labels,a,s),a.labelTarget=c)})}ie(Sp,X),Sp.$inject=["injector","eventBus","modeling"];function Cy(e){var t=new Set(e);return Oe(e,function(n){return!t.has(n.labelTarget)})}const eA={__init__:["labelSupport"],labelSupport:["type",Sp]};var tA=251,Py=1401,Ay="attach-ok";function Rp(e,t,n,i,r){X.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",Py,function(a){var c=a.context,s=c.shapes,u=c.validatedShapes;c.shapes=nA(s),c.validatedShapes=iA(u)}),o&&t.on("shape.move.start",tA,function(a){var c=a.context,s=c.shapes,u=Cp(s);M(u,function(l){o.makeDraggable(c,l,!0),M(l.labels,function(p){o.makeDraggable(c,p,!0)})})}),o&&t.on("shape.move.start",function(a){var c=a.context,s=c.shapes;if(s.length===1){var u=s[0],l=u.host;l&&(n.addMarker(l,Ay),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(l,Ay)}))}}),this.preExecuted("elements.move",Py,function(a){var c=a.context,s=c.closure,u=c.shapes,l=Cp(u);M(l,function(p){s.add(p,s.topLevel[p.host.id])})}),this.postExecuted("elements.move",function(a){var c=a.context,s=c.shapes,u=c.newHost,l;u&&s.length!==1||(u?l=s:l=Oe(s,function(p){var f=p.host;return rA(p)&&!oA(s,f)}),M(l,function(p){r.updateAttachment(p,u)}))}),this.postExecuted("elements.move",function(a){var c=a.context.shapes;M(c,function(s){M(s.attachers,function(u){M(u.outgoing.slice(),function(l){var p=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});p||r.removeConnection(l)}),M(u.incoming.slice(),function(l){var p=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});p||r.removeConnection(l)})})})}),this.postExecute("shape.create",function(a){var c=a.context,s=c.shape,u=c.host;u&&r.updateAttachment(s,u)}),this.postExecute("shape.replace",function(a){var c=a.context,s=c.oldShape,u=c.newShape;ur(s.attachers,function(l){var p=i.allowed("elements.move",{target:u,shapes:[l]});p==="attach"?r.updateAttachment(l,u):r.removeShape(l)}),u.attachers.length&&M(u.attachers,function(l){var p=Um(l,s,u);r.moveShape(l,p,l.parent)})}),this.postExecute("shape.resize",function(a){var c=a.context,s=c.shape,u=c.oldBounds,l=c.newBounds,p=s.attachers,f=c.hints||{};f.attachSupport!==!1&&M(p,function(d){var h=Um(d,u,l);r.moveShape(d,h,d.parent),M(d.labels,function(m){r.moveShape(m,h,m.parent)})})}),this.preExecute("shape.delete",function(a){var c=a.context.shape;ur(c.attachers,function(s){r.removeShape(s)}),c.host&&r.updateAttachment(c,null)})}ie(Rp,X),Rp.$inject=["injector","eventBus","canvas","rules","modeling"];function Cp(e){return Eu(rn(e,function(t){return t.attachers||[]}))}function nA(e){var t=Cp(e);return Yx("id",e,t)}function iA(e){var t=Qr(e,"id");return Oe(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function rA(e){return!!e.host}function oA(e,t){return e.indexOf(t)!==-1}const aA={__depends__:[gi],__init__:["attachSupport"],attachSupport:["type",Rp]};function Ty(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)})}Ty.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const Pp={__init__:["changeSupport"],changeSupport:["type",Ty]};function Xn(e){this._model=e}Xn.$inject=["moddle"],Xn.prototype._needsId=function(e){return De(e,["bpmn:RootElement","bpmn:FlowElement","bpmn:MessageFlow","bpmn:DataAssociation","bpmn:Artifact","bpmn:Participant","bpmn:Lane","bpmn:LaneSet","bpmn:Process","bpmn:Collaboration","bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane","bpmn:Property","bpmn:CategoryValue"])},Xn.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;v(e,"bpmn:Activity")?t="Activity":v(e,"bpmn:Event")?t="Event":v(e,"bpmn:Gateway")?t="Gateway":De(e,["bpmn:SequenceFlow","bpmn:MessageFlow"])?t="Flow":t=(e.$type||"").replace(/^[^:]*:/g,""),t+="_",!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e))},Xn.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Xn.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Xn.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",O({bpmnElement:e,bounds:this.createDiBounds()},t))},Xn.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Xn.prototype.createDiWaypoints=function(e){var t=this;return rn(e,function(n){return t.createDiWaypoint(n)})},Xn.prototype.createDiWaypoint=function(e){return this.create("dc:Point",ni(e,["x","y"]))},Xn.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",O({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Xn.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",O({bpmnElement:e},t))};function Mn(e,t,n){X.call(this,e),this._bpmnFactory=t;var i=this;function r(d){var h=d.context,m=h.hints||{},g;!h.cropped&&m.createElementsBehavior!==!1&&(g=h.connection,g.waypoints=n.getCroppedWaypoints(g),h.cropped=!0)}this.executed(["connection.layout","connection.create"],r),this.reverted(["connection.layout"],function(d){delete d.context.cropped});function o(d){var h=d.context;i.updateParent(h.shape||h.connection,h.oldParent)}function a(d){var h=d.context,m=h.shape||h.connection,g=h.parent||h.newParent;i.updateParent(m,g)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],kn(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],kn(a));function c(d){var h=d.context,m=h.oldRoot,g=m.children;M(g,function(R){v(R,"bpmn:BaseElement")&&i.updateParent(R)})}this.executed(["canvas.updateRoot"],c),this.reverted(["canvas.updateRoot"],c);function s(d){var h=d.context.shape;v(h,"bpmn:BaseElement")&&i.updateBounds(h)}this.executed(["shape.move","shape.create","shape.resize"],kn(function(d){d.context.shape.type!=="label"&&s(d)})),this.reverted(["shape.move","shape.create","shape.resize"],kn(function(d){d.context.shape.type!=="label"&&s(d)})),e.on("shape.changed",function(d){d.element.type==="label"&&s({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 h=d.context,m=h.connection,g=h.oldSource,R=h.newSource,w=Z(m),x=Z(g),b=Z(R);w.conditionExpression&&!De(b,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(h.oldConditionExpression=w.conditionExpression,delete w.conditionExpression),g!==R&&x.default===w&&(h.oldDefault=x.default,delete x.default)})),this.reverted("connection.reconnect",kn(function(d){var h=d.context,m=h.connection,g=h.oldSource,R=h.newSource,w=Z(m),x=Z(g),b=Z(R);h.oldConditionExpression&&(w.conditionExpression=h.oldConditionExpression),h.oldDefault&&(x.default=h.oldDefault,delete b.default)}));function p(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],kn(p)),this.reverted(["element.updateAttachment"],kn(p)),this.executed("element.updateLabel",kn(f)),this.reverted("element.updateLabel",kn(f));function f(d){const{element:h}=d.context,m=jn(h),g=Ve(h),R=g&&g.get("label");nr(h)||tc(h)||(m&&!R?g.set("label",t.create("bpmndi:BPMNLabel")):!m&&R&&g.set("label",void 0))}}ie(Mn,X),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(!Me(e)&&!(v(e,"bpmn:DataStoreReference")&&e.parent&&v(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=Ve(e),o=n&&n.businessObject,a=Ve(n);v(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),v(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),v(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(i,o),v(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},Mn.prototype.updateBounds=function(e){var t=Ve(e),n=cA(e);if(n){var i=ii(n,t.get("bounds"));O(n,{x:e.x+i.x,y:e.y+i.y})}var r=Me(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),O(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;v(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),wt(i,e)),v(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),St(r,e))}},Mn.prototype.updateDiConnection=function(e,t,n){var i=Ve(e),r=Ve(t),o=Ve(n);i.sourceElement&&i.sourceElement.bpmnElement!==Z(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==Z(n)&&(i.targetElement=n&&o)},Mn.prototype.updateDiParent=function(e,t){if(t&&!v(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(wt(n,e),e.$parent=null)}};function sA(e){for(;e&&!v(e,"bpmn:Definitions");)e=e.$parent;return e}Mn.prototype.getLaneSet=function(e){var t,n;return v(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(v(e,"bpmn:Participant")&&(e=e.processRef),n=e.get("laneSets"),t=n[0],t||(t=this._bpmnFactory.create("bpmn:LaneSet"),t.$parent=e,n.push(t)),t)},Mn.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((v(e,"bpmn:DataInput")||v(e,"bpmn:DataOutput"))&&(v(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(v(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(v(e,"bpmn:FlowElement")){if(t){if(v(t,"bpmn:Participant"))t=t.processRef;else if(v(t,"bpmn:Lane"))do t=t.$parent.$parent;while(v(t,"bpmn:Lane"))}i="flowElements"}else if(v(e,"bpmn:Artifact")){for(;t&&!v(t,"bpmn:Process")&&!v(t,"bpmn:SubProcess")&&!v(t,"bpmn:Collaboration");)if(v(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(v(e,"bpmn:MessageFlow"))i="messageFlows";else if(v(e,"bpmn:Participant")){i="participants";var r=e.processRef,o;r&&(o=sA(e.$parent||t),e.$parent&&(wt(o.get("rootElements"),r),r.$parent=null),t&&(St(o.get("rootElements"),r),r.$parent=o))}else v(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":v(e,"bpmn:DataInputAssociation")&&(i="dataInputAssociations");if(!i)throw new Error(`no parent for <${e.id}> in <${t.id}>`);var a;if(e.$parent&&(a=e.$parent.get(i),wt(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var c=n.get(i);wt(a,e),t&&(c||(c=[],t.set(i,c)),c.push(e))}}},Mn.prototype.updateConnectionWaypoints=function(e){var t=Ve(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},Mn.prototype.updateConnection=function(e){var t=e.connection,n=Z(t),i=t.source,r=Z(i),o=t.target,a=Z(t.target),c;if(v(n,"bpmn:DataAssociation"))v(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=r,c=e.parent||e.newParent||a,this.updateSemanticParent(n,a,c)):v(n,"bpmn:DataOutputAssociation")&&(c=e.parent||e.newParent||r,this.updateSemanticParent(n,r,c),n.targetRef=a);else{var s=v(n,"bpmn:SequenceFlow");n.sourceRef!==r&&(s&&(wt(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(s&&(wt(n.targetRef&&n.targetRef.get("incoming"),n),a&&a.get("incoming")&&a.get("incoming").push(n)),n.targetRef=a)}this.updateConnectionWaypoints(t),this.updateDiConnection(t,i,o)},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;v(i,"bpmn:BaseElement")&&e(t)}}function cA(e){if(v(e,"bpmn:Activity")){var t=Ve(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function lr(e,t){Mi.call(this),this._bpmnFactory=e,this._moddle=t}ie(lr,Mi),lr.$inject=["bpmnFactory","moddle"],lr.prototype._baseCreate=Mi.prototype.create,lr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,O({type:"label",di:n},Ir,t))}return this.createElement(e,t)},lr.prototype.createElement=function(e,t){t=O({},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(!lA(r)){var o=O({},r||{},{id:i.id+"_di"});e==="root"?r=this._bpmnFactory.createDiPlane(i,o):e==="connection"?r=this._bpmnFactory.createDiEdge(i,o):r=this._bpmnFactory.createDiShape(i,o)}v(i,"bpmn:Group")&&(t=O({isFrame:!0},t)),t=uA(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Ap(r,t,"isExpanded")),De(i,["bpmn:Lane","bpmn:Participant"])&&(t=Ap(r,t,"isHorizontal")),v(i,"bpmn:SubProcess")&&(t.collapsed=!$e(i,r)),v(i,"bpmn:ExclusiveGateway")&&(wn(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),$t(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),$t(t.cancelActivity)&&(i.cancelActivity=t.cancelActivity,delete t.cancelActivity);var a,c;return t.eventDefinitionType&&(a=i.get("eventDefinitions")||[],c=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),t.eventDefinitionType==="bpmn:ConditionalEventDefinition"&&(c.condition=this._bpmnFactory.create("bpmn:FormalExpression")),a.push(c),c.$parent=i,i.eventDefinitions=a,delete t.eventDefinitionType),n=this.getDefaultSize(i,r),t=O({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},lr.prototype.getDefaultSize=function(e,t){var n=Z(e);if(t=t||Ve(e),v(n,"bpmn:SubProcess"))return $e(n,t)?{width:350,height:200}:{width:100,height:80};if(v(n,"bpmn:Task"))return{width:100,height:80};if(v(n,"bpmn:Gateway"))return{width:50,height:50};if(v(n,"bpmn:Event"))return{width:36,height:36};if(v(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return $e(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return v(n,"bpmn:Lane")?{width:400,height:100}:v(n,"bpmn:DataObjectReference")?{width:36,height:50}:v(n,"bpmn:DataStoreReference")?{width:50,height:50}:v(n,"bpmn:TextAnnotation")?{width:100,height:40}:v(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},lr.prototype.createParticipantShape=function(e){return Gt(e)||(e={isExpanded:e}),e=O({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function uA(e,t,n){return M(n,function(i){t=Ap(e,t,i)}),t}function Ap(e,t,n){return t[n]===void 0?t:(e[n]=t[n],ai(t,[n]))}function lA(e){return De(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function gc(e,t){this._modeling=e,this._canvas=t}gc.$inject=["modeling","canvas"],gc.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;M(n,function(r){var o={x:0,y:0};$t(i.left)?o.x=i.left-r.x:$t(i.right)?o.x=i.right-r.width-r.x:$t(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:$t(i.top)?o.y=i.top-r.y:$t(i.bottom)?o.y=i.bottom-r.height-r.y:$t(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},gc.prototype.postExecute=function(e){};function yc(e){this._modeling=e}yc.$inject=["modeling"],yc.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},yc.prototype.postExecute=function(e){var t=e.hints||{};pA(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 pA(e,t){return Vi(e.outgoing,function(n){return n.target===t})}function vc(e,t){this._canvas=e,this._layouter=t}vc.$inject=["canvas","layouter"],vc.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},vc.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var _c=Math.round;function Tp(e){this._modeling=e}Tp.$inject=["modeling"],Tp.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;M(t,function(p){we(p.x)||(p.x=0),we(p.y)||(p.y=0)});var c=Oe(t,function(p){return!p.hidden}),s=At(c);M(t,function(p){it(p)&&(p.waypoints=rn(p.waypoints,function(f){return{x:_c(f.x-s.x-s.width/2+r.x),y:_c(f.y-s.y-s.height/2+r.y)}})),O(p,{x:_c(p.x-s.x-s.width/2+r.x),y:_c(p.y-s.y-s.height/2+r.y)})});var u=new Set(xs(t)),l={};M(t,function(p){if(it(p)){l[p.id]=we(i)?a.createConnection(l[p.source.id],l[p.target.id],i,p,p.parent||n,o):a.createConnection(l[p.source.id],l[p.target.id],p,p.parent||n,o);return}var f=O({},o);u.has(p)||(f.autoResize=!1),Me(p)&&(f=ai(f,["attach"])),l[p.id]=we(i)?a.createShape(p,ni(p,["x","y","width","height"]),p.parent||n,i,f):a.createShape(p,ni(p,["x","y","width","height"]),p.parent||n,f)}),e.elements=Zr(l)};var My=Math.round;function pr(e){this._canvas=e}pr.$inject=["canvas"],pr.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?O(t,n):O(t,{x:n.x-My(t.width/2),y:n.y-My(t.height/2)}),this._canvas.addShape(t,i,r),t},pr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function ga(e){pr.call(this,e)}ie(ga,pr),ga.$inject=["canvas"];var fA=pr.prototype.execute;ga.prototype.execute=function(e){var t=e.shape;return hA(t),t.labelTarget=e.labelTarget,fA.call(this,e)};var dA=pr.prototype.revert;ga.prototype.revert=function(e){return e.shape.labelTarget=null,dA.call(this,e)};function hA(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function ya(e,t){this._canvas=e,this._modeling=t}ya.$inject=["canvas","modeling"],ya.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;ur(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),ur(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},ya.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=il(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},ya.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,St(n.children,t,i),this._canvas.addConnection(t,n),t};function Mp(e,t){this._modeling=e,this._elementRegistry=t}Mp.$inject=["modeling","elementRegistry"],Mp.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;M(i,function(r){n.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};function va(e,t){this._canvas=e,this._modeling=t}va.$inject=["canvas","modeling"],va.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;ur(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),ur(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),ur(n.children,function(i){it(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},va.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=il(i.children,n),t.removeShape(n),n},va.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return St(i.children,n,r),t.addShape(n,i),n};function bc(e){this._modeling=e}bc.$inject=["modeling"];var ky={x:"y",y:"x"};bc.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(g,R){g.range.min=Math.min(R[i],g.range.min),g.range.max=Math.max(R[i]+R[r],g.range.max)}function a(g){return g[i]+g[r]/2}function c(g){return g.length-1}function s(g){return g.max-g.min}function u(g,R){var w={y:0};w[i]=g-a(R),w[i]&&(w[ky[i]]=0,t.moveElements([R],w,R.parent))}var l=n[0],p=c(n),f=n[p],d,h,m=0;M(n,function(g,R){var w,x,b;if(g.elements.length<2){R&&R!==n.length-1&&(o(g,g.elements[0]),m+=s(g.range));return}w=oi(g.elements,i),x=w[0],R===p&&(x=w[c(w)]),b=a(x),g.range=null,M(w,function(E){if(u(b,E),g.range===null){g.range={min:E[i],max:E[i]+E[r]};return}o(g,E)}),R&&R!==n.length-1&&(m+=s(g.range))}),h=Math.abs(f.range.min-l.range.max),d=Math.round((h-m)/(n.length-1)),!(d<n.length-1)&&M(n,function(g,R){var w={},x;g===l||g===f||(x=n[R-1],g.range.max=0,M(g.elements,function(b,E){w[ky[i]]=0,w[i]=x.range.max-b[i]+d,g.range.min!==b[i]&&(w[i]+=b[i]-g.range.min),w[i]&&t.moveElements([b],w,b.parent),g.range.max=Math.max(b[i]+b[r],E?g.range.max:0)}))})},bc.prototype.postExecute=function(e){};function xc(e,t){this._layouter=e,this._canvas=t}xc.$inject=["layouter","canvas"],xc.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return O(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},xc.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=wt(o.children,t),St(i.children,t,r),t.parent=i,M(t.waypoints,function(a){a.x+=n.x,a.y+=n.y,a.original&&(a.original.x+=n.x,a.original.y+=n.y)}),t},kp.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return wt(n.children,t),St(i.children,t,r),t.parent=i,M(t.waypoints,function(a){a.x-=o.x,a.y-=o.y,a.original&&(a.original.x-=o.x,a.original.y-=o.y)}),t};function Dp(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Dp.prototype.add=function(e,t){return this.addAll([e],t)},Dp.prototype.addAll=function(e,t){var n=GE(e,!!t,this);return O(this,n),this};function _a(e){this._modeling=e}_a.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},_a.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,a=e.allShapes,c=e.allConnections,s=e.enclosedConnections,u=e.topLevel,l=!1;r&&r.parent===n&&(l=!0),M(a,function(p){o.moveShape(p,t,u[p.id]&&!l&&n,{recurse:!1,layout:!1})}),M(c,function(p){var f=!!a[p.source.id],d=!!a[p.target.id];s[p.id]&&f&&d?o.moveConnection(p,t,u[p.id]&&!l&&n):o.layoutConnection(p,{connectionStart:f&&jl(p,p.source,t),connectionEnd:d&&Fl(p,p.target,t)})})},_a.prototype.getClosure=function(e){return new Dp().addAll(e,!0)};function wc(e){this._helper=new _a(e)}wc.$inject=["modeling"],wc.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},wc.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 _a(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=ni(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=wt(o.children,t),St(i.children,t,r),O(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&&(M(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:Fl(o,t,n)})}),M(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:jl(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 St(n.children,t,i),O(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 ba(e){this._modeling=e}ba.$inject=["modeling"],ba.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,i=e.connection,r=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return _e(r)&&(e.oldWaypoints=i.waypoints,i.waypoints=r),t&&(e.oldSource=i.source,i.source=t),n&&(e.oldTarget=i.target,i.target=n),i},ba.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||Dy(_e(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||Dy(_e(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},ba.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 Dy(e){return e.original||e}function Ni(e,t){this._modeling=e,this._rules=t}Ni.$inject=["modeling","rules"],Ni.prototype.preExecute=function(e){var t=this,n=this._modeling,i=this._rules,r=e.oldShape,o=e.newData,a=e.hints||{},c;function s(h,m,g){return i.allowed("connection.reconnect",{connection:g,source:h,target:m})}var u={x:o.x,y:o.y},l={x:r.x,y:r.y,width:r.width,height:r.height};c=e.newShape=e.newShape||t.createShape(o,u,r.parent,a),r.host&&n.updateAttachment(c,r.host);var p;a.moveChildren!==!1&&(p=r.children.slice(),n.moveElements(p,{x:0,y:0},c,a));var f=r.incoming.slice(),d=r.outgoing.slice();M(f,function(h){var m=h.source,g=s(m,c,h);g&&t.reconnectEnd(h,c,Ks(h,c,l),a)}),M(d,function(h){var m=h.target,g=s(c,m,h);g&&t.reconnectStart(h,c,qs(h,c,l),a)})},Ni.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Ni.prototype.execute=function(e){},Ni.prototype.revert=function(e){},Ni.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},Ni.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},Ni.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function xa(e){this._modeling=e}xa.$inject=["modeling"],xa.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},O(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},xa.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(M(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:Ks(o,n,i)})}),M(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:qs(o,n,i)})}))},xa.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return O(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function fr(e){this._modeling=e}fr.$inject=["modeling"],fr.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,r=e.resizingShapes,o=e.start,a={};this.moveShapes(i,t),M(r,function(c){a[c.id]=gA(c)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(VP(i,r),t,n,o,i,r,a)},fr.prototype.execute=function(){},fr.prototype.revert=function(){},fr.prototype.moveShapes=function(e,t){var n=this;M(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},fr.prototype.resizeShapes=function(e,t,n){var i=this;M(e,function(r){var o=GP(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},fr.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var c=this,s=new Set(r),u=new Set(o);M(e,function(l){var p=l.source,f=l.target,d=mA(l),h=Ly(n),m={},g=s.has(p)||u.has(p),R=s.has(f)||u.has(f);g&&R?(d=rn(d,function(w){return Iy(w,i,n)&&(w[h]=w[h]+t[h]),w.original&&Iy(w.original,i,n)&&(w.original[h]=w.original[h]+t[h]),w}),c._modeling.updateWaypoints(l,d,{labelBehavior:!1})):(g||R)&&(s.has(p)?m.connectionStart=jl(l,p,t):s.has(f)?m.connectionEnd=Fl(l,f,t):u.has(p)?m.connectionStart=qs(l,p,a[p.id]):u.has(f)&&(m.connectionEnd=Ks(l,f,a[f.id])),c._modeling.layoutConnection(l,m))})};function Oy(e){return O({},e)}function mA(e){return rn(e.waypoints,function(t){return t=Oy(t),t.original&&(t.original=Oy(t.original)),t})}function Ly(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function Iy(e,t,n){var i=Ly(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function gA(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Ec(e){this._modeling=e}Ec.$inject=["modeling"],Ec.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=Ny(n),t.collapsed=!t.collapsed;var i=By(n,t.collapsed);return[t].concat(i)},Ec.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=$y(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function Ny(e){var t={};return M(e,function(n){t[n.id]=n.hidden,n.children&&(t=O({},t,Ny(n.children)))}),t}function By(e,t){var n=[];return M(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(By(i.children,i.collapsed||t)))}),n}function $y(e,t){var n=[];return M(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat($y(i.children,t)))}),n}function Sc(e){this._modeling=e}Sc.$inject=["modeling"],Sc.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=jy(i,t),Fy(n,t),t.host=n,t},Sc.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,jy(n,t),Fy(i,t,r),t};function jy(e,t){return wt(e&&e.attachers,t)}function Fy(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),St(i,t,n)}}function Op(){}Op.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},Op.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function rt(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}rt.$inject=["eventBus","elementFactory","commandStack"],rt.prototype.getHandlers=function(){return{"shape.append":yc,"shape.create":pr,"shape.delete":va,"shape.move":Hr,"shape.resize":xa,"shape.replace":Ni,"shape.toggleCollapse":Ec,spaceTool:fr,"label.create":ga,"connection.create":vc,"connection.delete":ya,"connection.move":kp,"connection.layout":xc,"connection.updateWaypoints":Op,"connection.reconnect":ba,"elements.create":Tp,"elements.move":wc,"elements.delete":Mp,"elements.distribute":bc,"elements.align":gc,"element.updateAttachment":Sc}},rt.prototype.registerHandlers=function(e){M(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},rt.prototype.moveShape=function(e,t,n,i,r){typeof i=="object"&&(r=i,i=null);var o={shape:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("shape.move",o)},rt.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},rt.prototype.moveElements=function(e,t,n,i){i=i||{};var r=i.attach,o=n,a;r===!0?(a=n,o=n.parent):r===!1&&(a=null);var c={shapes:e,delta:t,newParent:o,newHost:a,hints:i};this._commandStack.execute("elements.move",c)},rt.prototype.moveConnection=function(e,t,n,i,r){typeof i=="object"&&(r=i,i=void 0);var o={connection:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("connection.move",o)},rt.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},rt.prototype.createConnection=function(e,t,n,i,r,o){typeof n=="object"&&(o=r,r=i,i=n,n=void 0),i=this._create("connection",i);var a={source:e,target:t,parent:r,parentIndex:n,connection:i,hints:o};return this._commandStack.execute("connection.create",a),a.connection},rt.prototype.createShape=function(e,t,n,i,r){typeof i!="number"&&(r=i,i=void 0),r=r||{};var o=r.attach,a,c;e=this._create("shape",e),o?(a=n.parent,c=n):a=n;var s={position:t,shape:e,parent:a,parentIndex:i,host:c,hints:r};return this._commandStack.execute("shape.create",s),s.shape},rt.prototype.createElements=function(e,t,n,i,r){_e(e)||(e=[e]),typeof i!="number"&&(r=i,i=void 0),r=r||{};var o={position:t,elements:e,parent:n,parentIndex:i,hints:r};return this._commandStack.execute("elements.create",o),o.elements},rt.prototype.createLabel=function(e,t,n,i){n=this._create("label",n);var r={labelTarget:e,position:t,parent:i||e.parent,shape:n};return this._commandStack.execute("label.create",r),r.shape},rt.prototype.appendShape=function(e,t,n,i,r){r=r||{},t=this._create("shape",t);var o={source:e,position:n,target:i,shape:t,connection:r.connection,connectionParent:r.connectionParent,hints:r};return this._commandStack.execute("shape.append",o),o.shape},rt.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},rt.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},rt.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},rt.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},rt.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},rt.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},rt.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},rt.prototype.createSpace=function(e,t,n,i,r){var o={delta:n,direction:i,movingShapes:e,resizingShapes:t,start:r};this._commandStack.execute("spaceTool",o)},rt.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},rt.prototype.reconnect=function(e,t,n,i,r){var o={connection:e,newSource:t,newTarget:n,dockingOrPoints:i,hints:r||{}};this._commandStack.execute("connection.reconnect",o)},rt.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,O(i,{docking:"source"}))},rt.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,O(i,{docking:"target"}))},rt.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},rt.prototype._create=function(e,t){return T1(t)?t:this._elementFactory.create(e,t)},rt.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function wa(e){this._elementRegistry=e}wa.$inject=["elementRegistry"],wa.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||yA(n,Ka(i));return Hy(n,i),e.oldProperties=o,e.changed=r,r},wa.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return Hy(n,t),i},wa.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return v(e,"bpmn:DataObject")?vA(e,t):[]};function yA(e,t){return En(t,function(n,i){return n[i]=e.get(i),n},{})}function Hy(e,t){M(t,function(n,i){e.set(i,n)})}function vA(e,t){return t.filter(function(n){return v(n,"bpmn:DataObjectReference")&&Z(n).dataObjectRef===e})}var Ea="default",Bi="id",zy="di",_A={width:0,height:0};function Sa(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}Sa.$inject=["elementRegistry","moddle","modeling","textRenderer"],Sa.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=SA(e.properties),c=e.oldProperties||bA(t,a);return Vy(a,o)&&(r.unclaim(o[Bi]),i.updateId(t,a[Bi]),r.claim(a[Bi],o)),Ea in a&&(a[Ea]&&n.push(i.get(a[Ea].id)),o[Ea]&&n.push(i.get(o[Ea].id))),Gy(t,a),e.oldProperties=c,e.changed=n,n},Sa.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&Z(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,_A)}},Sa.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 Gy(t,i),Vy(n,r)&&(a.unclaim(n[Bi]),o.updateId(t,i[Bi]),a.claim(i[Bi],r)),e.changed};function Vy(e,t){return Bi in e&&e[Bi]!==t[Bi]}function bA(e,t){var n=Ka(t),i=e.businessObject,r=Ve(e);return En(n,function(o,a){return a!==zy?o[a]=i.get(a):o[a]=xA(r,Ka(t.di)),o},{})}function xA(e,t){return En(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function Gy(e,t){var n=e.businessObject,i=Ve(e);M(t,function(r,o){o!==zy?n.set(o,r):i&&wA(i,r)})}function wA(e,t){M(t,function(n,i){e.set(i,n)})}var EA=["default"];function SA(e){var t=O({},e);return EA.forEach(function(n){n in e&&(t[n]=Z(t[n]))}),t}function Rc(e,t){this._canvas=e,this._modeling=t}Rc.$inject=["canvas","modeling"],Rc.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,c=Ve(r);return t.setRootElement(n),t.removeRootElement(r),St(a.rootElements,i),i.$parent=a,wt(a.rootElements,o),o.$parent=null,r.di=null,c.bpmnElement=i,n.di=c,e.oldRoot=r,[]},Rc.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,c=Ve(n);return t.setRootElement(r),t.removeRootElement(n),wt(a.rootElements,i),i.$parent=null,St(a.rootElements,o),o.$parent=a,n.di=null,c.bpmnElement=o,r.di=c,[]};function Lp(e,t){this._modeling=e,this._spaceTool=t}Lp.$inject=["modeling","spaceTool"],Lp.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=Un(i),a=o===i,c=a?i:i.parent,s=rr(c),u=Yt(i);if(u?r==="left"?r="top":r==="right"&&(r="bottom"):r==="top"?r="left":r==="bottom"&&(r="right"),!s.length){var l=u?{x:i.x+Wn,y:i.y,width:i.width-Wn,height:i.height}:{x:i.x,y:i.y+Wn,width:i.width,height:i.height-Wn};n.createShape({type:"bpmn:Lane",isHorizontal:u},l,c)}var p=[];Or(o,function(b){return p.push(b),b.label&&p.push(b.label),b===i?[]:Oe(b.children,function(E){return E!==i})});var f,d,h,m,g;r==="top"?(f=-120,d=i.y,h=d+10,m="n",g="y"):r==="left"?(f=-120,d=i.x,h=d+10,m="w",g="x"):r==="bottom"?(f=120,d=i.y+i.height,h=d-10,m="s",g="y"):r==="right"&&(f=120,d=i.x+i.width,h=d-10,m="e",g="x");var R=t.calculateAdjustments(p,g,f,h),w=u?{x:0,y:f}:{x:f,y:0};t.makeSpace(R.movingShapes,R.resizingShapes,w,m,h);var x=u?{x:i.x+(a?Wn:0),y:d-(r==="top"?120:0),width:i.width-(a?Wn:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?Wn:0),width:120,height:i.height-(a?Wn:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:u},x,c)};function Ip(e){this._modeling=e}Ip.$inject=["modeling"],Ip.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=rr(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=Yt(n),c=a?n.height:n.width,s=Math.round(c/i),u,l,p,f;for(f=0;f<i;f++)f===i-1?u=c-s*f:u=s,l=a?{x:n.x+Wn,y:n.y+f*s,width:n.width-Wn,height:u}:{x:n.x+f*s,y:n.y+Wn,width:u,height:n.height-Wn},f<o?t.resizeShape(r[f],l):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,l,n))};function Ra(e,t){this._modeling=e,this._spaceTool=t}Ra.$inject=["modeling","spaceTool"],Ra.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Ra.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=vR(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},Ra.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=ye(e),r=ye(t),o=wm(r,i),a=Un(e),c=[],s=[];Or(a,function(h){return c.push(h),(v(h,"bpmn:Lane")||v(h,"bpmn:Participant"))&&s.push(h),h.children});var u,l,p,f,d;(o.bottom||o.top)&&(u=o.bottom||o.top,l=e.y+(o.bottom?e.height:0)+(o.bottom?-10:10),p=o.bottom?"s":"n",f=o.top>0||o.bottom<0?-u:u,d=n.calculateAdjustments(c,"y",f,l),n.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:u},p)),(o.left||o.right)&&(u=o.right||o.left,l=e.x+(o.right?e.width:0)+(o.right?-10:100),p=o.right?"e":"w",f=o.left>0||o.right<0?-u:u,d=n.calculateAdjustments(s,"x",f,l),n.makeSpace(d.movingShapes,d.resizingShapes,{x:u,y:0},p))};var Ca="flowNodeRef",Np="lanes";function Cc(){}Cc.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(l,p){var f=ye(p),d={x:l.x+l.width/2,y:l.y+l.height/2};return d.x>f.left&&d.x<f.right&&d.y>f.top&&d.y<f.bottom}function c(l){n.indexOf(l)===-1&&(o.push(l),n.push(l))}function s(l){var p=Un(l);return r[p.id]||(r[p.id]=Vs(p)),r[p.id]}function u(l){if(!l.parent)return[];var p=s(l);return p.filter(function(f){return a(l,f)}).map(function(f){return f.businessObject})}return t.forEach(function(l){var p=Un(l);if(!(!p||n.indexOf(p)!==-1)){var f=p.children.filter(function(d){return v(d,"bpmn:FlowNode")});f.forEach(c),n.push(p)}}),e.forEach(c),o.forEach(function(l){var p=l.businessObject,f=p.get(Np),d=f.slice(),h=u(l);i.push({flowNode:p,remove:d,add:h})}),t.forEach(function(l){var p=l.businessObject;l.parent||p.get(Ca).forEach(function(f){i.push({flowNode:f,remove:[p],add:[]})})}),i},Cc.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(Np);n.remove.forEach(function(o){wt(r,o),wt(o.get(Ca),i)}),n.add.forEach(function(o){St(r,o),St(o.get(Ca),i)})}),[]},Cc.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(Np);n.add.forEach(function(o){wt(r,o),wt(o.get(Ca),i)}),n.remove.forEach(function(o){St(r,o),St(o.get(Ca),i)})}),[]};var Bp="categoryValueRef";function Pa(e,t){this._bpmnFactory=e,this._elementRegistry=t}Pa.$inject=["bpmnFactory","elementRegistry"],Pa.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,r=new Map,o=[],a=new Map;function c(w,x,b){if(x){var E=a.get(w);E||(E={},a.set(w,E)),!(b&&E.present)&&(!b&&E.past||(b?E.present={categoryValue:x,root:$p(w)}:E.past={categoryValue:x}))}}function s(w){r.set(w,Z(w))}function u(){n.filter(function(w){return v(w,"bpmn:FlowElement")&&!Me(w)&&w.parent}).forEach(s)}function l(w){var x=Z(w),b=x.get("categoryValueRef");return b||(b=ym(i,x),o.push(RA(w,b))),b}function p(w){return w.reduce(function(x,b){var E=$p(b),T=x.get(E);return T||(T=[],x.set(E,T)),T.push(b),x},new Map)}e=Array.from(e||[]);var f=p(e);t.length&&u(),e.forEach(s),n.filter(function(w){return v(w,"bpmn:Group")&&!Me(w)&&w.parent}).forEach(function(w){var x=Z(w).get("categoryValueRef");if(!x){var b=$p(w),E=f.get(b)||[],T=ro(E,w),L=Object.keys(T).length>0;L&&(x=l(w))}c(w,x,!0)}),t.forEach(function(w){c(w.groupShape,w.categoryValue,!1)}),o.length&&u();var d=Array.from(r.keys()),h=Array.from(a.values()).reduce(function(w,x){return x.present&&w.add(x.present.categoryValue),x.past&&w.add(x.past.categoryValue),w},new Set),m=new Map,g=p(d);a.forEach(function(w,x){var b=w.present;if(b){var E=g.get(b.root)||[],T=ro(E,x);E.forEach(function(L){if(T[L.id]){var A=m.get(L);A||(A=new Set,m.set(L,A)),A.add(b.categoryValue)}})}});var R=d.reduce(function(w,x){var b=r.get(x),E=b.get(Bp),T=new Set(E),L=m.get(x)||new Set,A=Array.from(L).filter(function(H){return!T.has(H)}),F=E.filter(function(H){return h.has(H)&&!L.has(H)});return(A.length||F.length)&&w.push({businessObject:b,categoryValuesToAdd:A,categoryValuesToRemove:F}),w},[]);return{flowElements:R,groups:o}},Pa.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),CA(t.groups),AA(t.flowElements),[]},Pa.prototype.revert=function(e){var t=e.updates;return TA(t.flowElements),PA(t.groups),[]};function RA(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function CA(e){e.forEach(function(t){Z(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function PA(e){e.forEach(function(t){Z(t.groupShape).categoryValueRef=null})}function AA(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Bp);t.categoryValuesToRemove.forEach(function(r){wt(i,r)}),t.categoryValuesToAdd.forEach(function(r){St(i,r,!0)})})}function TA(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Bp);t.categoryValuesToAdd.forEach(function(r){wt(i,r)}),t.categoryValuesToRemove.forEach(function(r){St(i,r,!0)})})}function $p(e){for(;e.parent;)e=e.parent;return e}function Pc(e){this._moddle=e}Pc.$inject=["moddle"],Pc.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),[]},Pc.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 MA={fill:void 0,stroke:void 0};function jp(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(xn(t)){var n=kA(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}jp.$inject=["commandStack"],jp.prototype.postExecute=function(e){var t=e.elements,n=e.colors||MA,i=this,r={};"fill"in n&&O(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&O(r,{"border-color":this._normalizeColor(n.stroke)}),M(t,function(o){var a=it(o)?ni(r,["border-color"]):r,c=Ve(o);if(DA(a),Me(o)){if(!c||!v(c.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:c.label,properties:{color:r["border-color"]}})}else{if(!De(c,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function kA(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 DA(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var OA={width:0,height:0};function Wy(e,t,n){function i(s,u){var l=s.label||s,p=s.labelTarget||s;return sS(l,u),[l,p]}function r(s){var u=s.element,l=u.businessObject,p=s.newLabel;if(!Me(u)&&nr(u)&&!Ms(u)&&!Uy(p)){var f=7,d=ul(u);d={x:d.x,y:d.y+f},e.createLabel(u,d,{id:l.id+"_label",businessObject:l,di:u.di})}}function o(s){return s.oldLabel=jn(s.element),i(s.element,s.newLabel)}function a(s){return i(s.element,s.oldLabel)}function c(s){var u=s.element,l=u.label||u,p=s.newLabel,f=s.newBounds,d=s.hints||{};if(!(!Me(l)&&!v(l,"bpmn:TextAnnotation"))){if(Me(l)&&Uy(p)){d.removeShape!==!1&&e.removeShape(l,{unsetLabel:!1});return}var h=jn(u);typeof f>"u"&&(f=t.getExternalLabelBounds(l,h)),f&&e.resizeShape(l,f,OA)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=c}Wy.$inject=["modeling","textRenderer","bpmnFactory"];function Uy(e){return!e||!e.trim()}function en(e,t,n,i){rt.call(this,e,t,n),this._bpmnRules=i}ie(en,rt),en.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],en.prototype.getHandlers=function(){var e=rt.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=wa,e["element.updateProperties"]=Sa,e["canvas.updateRoot"]=Rc,e["lane.add"]=Lp,e["lane.resize"]=Ra,e["lane.split"]=Ip,e["lane.updateRefs"]=Cc,e["group.updateRefs"]=Pa,e["id.updateClaim"]=Pc,e["element.setColor"]=jp,e["element.updateLabel"]=Wy,e},en.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},en.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)},en.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},en.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},en.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},en.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},en.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},en.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},en.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},en.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},en.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},en.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},en.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},en.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function Yy(){}Yy.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||be(t.source||e.source),t.connectionEnd||be(t.target||e.target)]};var Ac=20,LA=5,Tc=Math.round,qy=20,IA={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function NA(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function BA(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function Ky(e,t,n){var i=Zt(t,e,LA),r=n.split(":")[0],o=Tc((t.x-e.x)/2+e.x),a=Tc((t.y-e.y)/2+e.y),c,s,u=BA(r,i),l=/h|r|l/.test(r),p=!1,f=!1;return u?(c=l?{x:o,y:e.y}:{x:e.x,y:a},s=l?"h:h":"v:v"):(p=NA(i,r),s=l?"h:v":"v:h",p?l?(f=a===e.y,c={x:e.x+Ac*(/l/.test(r)?-1:1),y:f?a+Ac:a}):(f=o===e.x,c={x:f?o+Ac:o,y:e.y+Ac*(/t/.test(r)?-1:1)}):c={x:o,y:a}),{waypoints:Fp(e,c,s).concat(c),directions:s,turnNextDirections:f}}function $A(e,t,n){return Ky(e,t,n)}function jA(e,t,n){var i=Ky(t,e,Xy(n));return{waypoints:i.waypoints.slice().reverse(),directions:Xy(i.directions),turnNextDirections:i.turnNextDirections}}function FA(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=Fp(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function Xy(e){return e.split(":").reverse().join(":")}function HA(e,t,n){var i=Tc((t.x-e.x)/2+e.x),r=Tc((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 Fp(e,t,n){if(n=n||"h:h",!XA(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Qy(n)){var i=$A(e,t,n),r=jA(e,t,n),o=FA(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return HA(e,t,n)}function zA(e,t,n){var i=Fp(e,t,n);return i.unshift(e),i.push(t),ev(i)}function VA(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=Wx(o,"straight")[0]||"h:h",c=IA[a]||0,s=Zt(e,t,c),u=KA(s,a);n=n||be(e),i=i||be(t);var l=u.split(":"),p=Jy(n,e,l[0],ZA(s)),f=Jy(i,t,l[1],s);return zA(p,f,u)}function GA(e,t,n,i,r,o){_e(n)&&(r=n,o=i,n=be(e),i=be(t)),o=O({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,c=a.indexOf("straight")!==-1,s;return s=c&&UA(e,t,n,i,o),s||(s=o.connectionEnd&&qA(t,e,i,r),s)||(s=o.connectionStart&&YA(e,t,n,r),s)?s:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:VA(e,t,n,i,o)}function WA(e,t,n){return e>=t&&e<=n}function Zy(e,t,n){var i={x:"width",y:"height"};return WA(t[e],n[e],n[e]+n[i[e]])}function UA(e,t,n,i,r){var o={},a,c;return c=Zt(e,t),/^(top|bottom|left|right)$/.test(c)?(/top|bottom/.test(c)&&(a="x"),/left|right/.test(c)&&(a="y"),r.preserveDocking==="target"?Zy(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:Zy(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 YA(e,t,n,i){return Hp(e,t,n,i)}function qA(e,t,n,i){var r=i.slice().reverse();return r=Hp(e,t,n,r),r?r.reverse():null}function Hp(e,t,n,i){function r(l){return l.length<3?!0:l.length>4?!1:!!st(l,function(p,f){var d=l[f-1];return d&&Zo(p,d)<3})}function o(l,p,f){var d=Ai(p,l);switch(d){case"v":return{x:f.x,y:l.y};case"h":return{x:l.x,y:f.y}}return{x:l.x,y:l.y}}function a(l,p,f){var d;for(d=l.length-2;d!==0;d--)if(Eh(l[d],p,qy)||Eh(l[d],f,qy))return l.slice(d);return l}if(r(i))return null;var c=i[0],s=i.slice(),u;return s[0]=n,s[1]=o(s[1],c,n),u=a(s,e,t),u!==s&&(s=Hp(e,t,n,u)),s&&Ai(s)?null:s}function KA(e,t){if(Qy(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 XA(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Qy(e){return e&&/t|r|b|l/.test(e)}function ZA(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 Jy(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 ev(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return rl(r,o,n,0)||t.push(n),t},[])}var QA=-10,JA=40,eT={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},tT={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},zp={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Aa={top:"t",right:"r",bottom:"b",left:"l"};function Mc(e){this._elementRegistry=e}ie(Mc,Yy),Mc.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,c=this._elementRegistry,s,u;if(o||(o=tv(r&&r[0],n)),a||(a=tv(r&&r[r.length-1],i)),(v(e,"bpmn:Association")||v(e,"bpmn:DataAssociation"))&&r&&!nv(n,i))return[].concat([o],r.slice(1,-1),[a]);var l=dm(n,c)?eT:tT;return v(e,"bpmn:MessageFlow")?s=iT(n,i,l):(v(e,"bpmn:SequenceFlow")||nv(n,i))&&(n===i?s={preferredLayouts:uT(n,e,l)}:v(n,"bpmn:BoundaryEvent")?s={preferredLayouts:lT(n,i,a,l)}:Ta(n)||Ta(i)?s={preferredLayouts:l.subProcess,preserveDocking:oT(n)}:v(n,"bpmn:Gateway")?s={preferredLayouts:l.fromGateway}:v(i,"bpmn:Gateway")?s={preferredLayouts:l.toGateway}:s={preferredLayouts:l.default}),s&&(s=O(s,t),u=ev(GA(n,i,o,a,r,s))),u||[o,a]};function nT(e){var t=e.host;return Zt(be(e),t,QA)}function iT(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:rT(e,t)}}function rT(e,t){return v(t,"bpmn:Participant")?"source":v(e,"bpmn:Participant")?"target":Ta(t)?"source":Ta(e)||v(t,"bpmn:Event")?"target":v(e,"bpmn:Event")?"source":null}function oT(e){return Ta(e)?"target":"source"}function tv(e,t){return e?e.original||e:be(t)}function nv(e,t){return v(t,"bpmn:Activity")&&v(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Ta(e){return v(e,"bpmn:SubProcess")&&$e(e)}function zr(e,t){return e===t}function aT(e,t){return t.indexOf(e)!==-1}function So(e){var t=/right|left/.exec(e);return t&&t[0]}function Ro(e){var t=/top|bottom/.exec(e);return t&&t[0]}function iv(e,t){return zp[e]===t}function sT(e,t){var n=So(e),i=zp[n];return t.indexOf(i)!==-1}function cT(e,t){var n=Ro(e),i=zp[n];return t.indexOf(i)!==-1}function rv(e){return e==="right"||e==="left"}function uT(e,t,n){var i=t.waypoints,r=i&&i.length&&Zt(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function lT(e,t,n,i){var r=be(e),o=be(t),a=nT(e),c,s,u=zr(e.host,t),l=aT(a,["top","right","bottom","left"]),p=Zt(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?pT(a,l,e,t,n,i):(c=fT(a,p,l,i.isHorizontal),s=dT(a,p,l,i.isHorizontal),[c+":"+s])}function pT(e,t,n,i,r,o){var a=t?e:o.isHorizontal?Ro(e):So(e),c=Aa[a],s;return t?rv(e)?s=ov("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:s=ov("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:s=o.boundaryLoop.default,[c+":"+s]}function ov(e,t,n,i){var r=JA;return!(Vp(e,i,n,r)||Vp(e,i,{x:n.x+n.width,y:n.y+n.height},r)||Vp(e,i,be(t),r))}function Vp(e,t,n,i){return Math.abs(t[e]-n[e])<i}function fT(e,t,n,i){if(n)return Aa[e];var r=Ro(e),o=So(e),a=Ro(t),c=So(t);if(i){if(zr(r,a)||iv(o,c))return Aa[r]}else if(zr(o,c)||iv(r,a))return Aa[o];return Aa[i?o:r]}function dT(e,t,n,i){if(n)return rv(e)?sT(e,t)||zr(e,t)?"h":"v":cT(e,t)||zr(e,t)?"v":"h";var r=Ro(e),o=So(e),a=Ro(t),c=So(t);return a&&!c?"v":c&&!a?"h":i?zr(r,a)?"h":"v":zr(o,c)?"v":"h"}Mc.$inject=["elementRegistry"];function av(e){return O({original:e.point.original||e.point},e.actual)}function dr(e,t){this._elementRegistry=e,this._graphicsFactory=t}dr.$inject=["elementRegistry","graphicsFactory"],dr.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(av(i)),o.push(av(r)),o},dr.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}},dr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return Qo(i,r,n)},dr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},dr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},dr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const Gp={__init__:["modeling","bpmnUpdater"],__depends__:[DC,qC,XC,ZC,vy,QP,eA,aA,qn,Pp,Sy],bpmnFactory:["type",Xn],bpmnUpdater:["type",Mn],elementFactory:["type",lr],modeling:["type",en],layouter:["type",Mc],connectionDocking:["type",dr]};var hT=10,sv=50,mT=250;function Wp(e,t,n,i){for(var r;r=gT(e,n,t);)n=i(t,n,r);return n}function Up(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 c=o==="x"?"width":"height",s=a.margin,u=a.minDistance;s<0?r[o]=Math.min(i[o]+s-t[c]/2,n[o]-u+s):r[o]=Math.max(i[o]+i[c]+s+t[c]/2,n[o]+u+s)}}),r}}function gT(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=vT(e);return st(r,function(o){if(o===n)return!1;var a=Zt(o,i,hT);return a==="intersect"})}function yT(e,t){t||(t={});function n(h){return h.source===e?1:-1}var i=t.defaultDistance||sv,r=t.direction||"e",o=t.filter,a=t.getWeight||n,c=t.maxDistance||mT,s=t.reference||"start";o||(o=xT);function u(h,m){return r==="n"?s==="start"?ye(h).top-ye(m).bottom:s==="center"?ye(h).top-be(m).y:ye(h).top-ye(m).top:r==="w"?s==="start"?ye(h).left-ye(m).right:s==="center"?ye(h).left-be(m).x:ye(h).left-ye(m).left:r==="s"?s==="start"?ye(m).top-ye(h).bottom:s==="center"?be(m).y-ye(h).bottom:ye(m).bottom-ye(h).bottom:s==="start"?ye(m).left-ye(h).right:s==="center"?be(m).x-ye(h).right:ye(m).right-ye(h).right}var l=e.incoming.filter(o).map(function(h){var m=a(h),g=m<0?u(h.source,e):u(e,h.source);return{id:h.source.id,distance:g,weight:m}}),p=e.outgoing.filter(o).map(function(h){var m=a(h),g=m>0?u(e,h.target):u(h.target,e);return{id:h.target.id,distance:g,weight:m}}),f=l.concat(p).reduce(function(h,m){return h[m.id+"__weight_"+m.weight]=m,h},{}),d=En(f,function(h,m){var g=m.distance,R=m.weight;return g<0||g>c||(h[String(g)]||(h[String(g)]=0),h[String(g)]+=1*R,(!h.distance||h[h.distance]<h[String(g)])&&(h.distance=g)),h},{});return d.distance||i}function vT(e){var t=Yp(e);return e.host&&(t=t.concat(Yp(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(Yp(i))},[]))),t}function Yp(e){return bT(e).concat(_T(e))}function _T(e){return e.incoming.map(function(t){return t.source})}function bT(e){return e.outgoing.map(function(t){return t.target})}function xT(){return!0}var wT=100;function cv(e,t,n){e.on("autoPlace",wT,function(i){var r=i.shape,o=i.source;return ET(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}),c=t.appendShape(i,r,a,i.parent,o);return e.fire("autoPlace.end",{source:i,shape:c}),c}}cv.$inject=["eventBus","modeling","canvas"];function ET(e,t,n){n||(n={});var i=n.defaultDistance||sv,r=be(e),o=ye(e);return{x:o.right+i+t.width/2,y:r.y}}function uv(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}uv.$inject=["eventBus","selection"];const ST={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",cv],autoPlaceSelectionBehavior:["type",uv]};function lv(e,t,n){var i=dm(e,n);if(v(t,"bpmn:TextAnnotation"))return CT(e,t,i);if(De(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return PT(e,t,i);if(v(t,"bpmn:FlowNode"))return RT(e,t,i)}function RT(e,t,n){var i=ye(e),r=be(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=yT(e,{filter:function(d){return v(d,"bpmn:SequenceFlow")},direction:o.directionHint}),c=30,s=o.minDistance,u=o.baseOrientation;v(e,"bpmn:BoundaryEvent")&&(u=Zt(e,e.host,-25),u.indexOf(o.boundaryOrientation)!==-1&&(c*=-1));var l=n?{x:i.right+a+t.width/2,y:r.y+pv(u,s,o)}:{x:r.x+pv(u,s,o),y:i.bottom+a+t.height/2},p={margin:c,minDistance:s},f=n?{y:p}:{x:p};return Wp(e,t,l,Up(f))}function pv(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function CT(e,t,n){var i=ye(e),r=n?{x:i.right+t.width/2,y:i.top-50-t.height/2}:{x:i.right+50+t.width/2,y:i.bottom+t.height/2};it(e)&&(r=be(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 Wp(e,t,r,Up(a))}function PT(e,t,n){var i=ye(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 Wp(e,t,r,Up(a))}function fv(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return lv(r,i,t)})}fv.$inject=["eventBus","elementRegistry"];const kc={__depends__:[ST],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",fv]},dv=[pm,ra,Gp,kc];function AT(e={}){Jd(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new so({container:t,moddleExtensions:e.moddleExtensions??ns,additionalModules:[...dv,...e.additionalModules??[]]})}var TT=new wo("ov"),MT=500;function qt(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=TT,this._overlayDefaults=O({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=kT(n.getContainer()),this._init()}qt.$inject=["config.overlays","eventBus","canvas","elementRegistry"],qt.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?Oe(t.overlays,Jr({type:e.type})):t.overlays.slice():[]}else return e.type?Oe(this._overlays,Jr({type:e.type})):e.id?this._overlays[e.id]:null},qt.prototype.add=function(e,t,n){if(Gt(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=O({},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)||[];_e(t)||(t=[t]);var n=this;M(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(li(i.html),li(i.htmlContainer),delete i.htmlContainer,delete i.element,delete n._overlays[i.id]),r){var o=r.overlays.indexOf(i);o!==-1&&r.overlays.splice(o,1)}})},qt.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},qt.prototype.show=function(){Dc(this._overlayRoot)},qt.prototype.hide=function(){Dc(this._overlayRoot,!1)},qt.prototype.clear=function(){this._overlays={},this._overlayContainers=[],ms(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=At(t);i=o.x,r=o.y}hv(n,i,r),an(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=At(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var c;i.waypoints?c=At(i).height:c=i.height,o=t.bottom*-1+c}hv(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},qt.prototype._createOverlayContainer=function(e){var t=ut('<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(",")+")";mv(this._overlayRoot,n)},qt.prototype._getOverlayContainer=function(e,t){var n=st(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)),xn(i)&&(i=ut(i)),o=this._getOverlayContainer(n),r=ut('<div class="djs-overlay" data-overlay-id="'+t+'">'),mn(r,{position:"absolute"}),r.appendChild(i),e.type&&ht(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),c=this._canvas.getRootElement();Dc(r,a===c),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,c=this._canvas.getRootElement(),s=!0;(i!==c||n&&($t(r)&&r>t.scale||$t(o)&&o<t.scale))&&(s=!1),Dc(a,s),this._updateOverlayScale(e,t)},qt.prototype._updateOverlayScale=function(e,t){var n=e.scale,i,r,o=e.htmlContainer,a,c="";n!==!0&&(n===!1?(i=1,r=1):(i=n.min,r=n.max),$t(i)&&t.scale<i&&(a=(1/t.scale||1)*i),$t(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),$t(a)&&(c="scale("+a+","+a+")"),mv(o,c)},qt.prototype._updateOverlaysVisibilty=function(e){var t=this;M(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});M(o,function(s){t.remove(s.id)});var a=t._getOverlayContainer(r);if(a){li(a.html);var c=t._overlayContainers.indexOf(a);c!==-1&&t._overlayContainers.splice(c,1)}}),e.on("element.changed",MT,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&(M(o.overlays,function(a){t._updateOverlay(a)}),t._updateOverlayContainer(o))}),e.on("element.marker.update",function(i){var r=t._getOverlayContainer(i.element,!0);r&&ht(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 kT(e){var t=ut('<div class="djs-overlay-container" />');return mn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function hv(e,t,n){mn(e,{left:t+"px",top:n+"px"})}function Dc(e,t){e.style.display=t===!1?"none":""}function mv(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Oc={__init__:["overlays"],overlays:["type",qt]};function qp(e,t){t.invoke(X,this),this.executed(function(n){var i=n.context;i.rootElement?e.setRootElement(i.rootElement):i.rootElement=e.getRootElement()}),this.revert(function(n){var i=n.context;i.rootElement&&e.setRootElement(i.rootElement)})}ie(qp,X),qp.$inject=["canvas","injector"];const DT={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",qp]};function Ma(e){return CSS.escape(e)}var OT={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function gv(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return OT[t]})}var LT="bjs-breadcrumbs-shown";function yv(e,t,n){var i=ut('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=ht(r);r.appendChild(i);var a=[];e.on("element.changed",function(s){var u=s.element,l=Z(u),p=st(a,function(f){return f===l});p&&c()});function c(s){s&&(a=IT(s));var u=a.flatMap(function(p){var f=n.findRoot(mi(p))||n.findRoot(p.id);if(!f&&v(p,"bpmn:Process")){var d=t.find(function(g){var R=Z(g);return R&&R.get("processRef")===p});f=d&&n.findRoot(d.id)}if(!f)return[];var h=gv(p.name||p.id),m=ut('<li><span class="bjs-crumb"><a title="'+h+'">'+h+"</a></span></li>");return m.addEventListener("click",function(){n.setRootElement(f)}),m});i.innerHTML="";var l=u.length>1;o.toggle(LT,l),u.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(s){c(s.element)})}yv.$inject=["eventBus","elementRegistry","canvas"];function IT(e){for(var t=Z(e),n=[],i=t;i;i=i.$parent)(v(i,"bpmn:SubProcess")||v(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function vv(e,t){var n=null,i=new NT;e.on("root.set",function(r){var o=r.element,a=t.viewbox(),c=i.get(o);if(i.set(n,{x:a.x,y:a.y,zoom:a.scale}),n=o,!(!v(o,"bpmn:SubProcess")&&!c)){c=c||{x:0,y:0,zoom:1};var s=(a.x-c.x)*a.scale,u=(a.y-c.y)*a.scale;(s!==0||u!==0)&&t.scroll({dx:s,dy:u}),c.zoom!==a.scale&&t.zoom(c.zoom,{x:0,y:0})}}),e.on("diagram.clear",function(){i.clear(),n=null})}vv.$inject=["eventBus","canvas"];function NT(){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 _v={x:180,y:160};function Vr(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}Vr.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)})}},Vr.prototype._createNewDiagrams=function(e){var t=this,n=[],i=[];e.get("planeElement").forEach(function(o){var a=o.bpmnElement;if(a){var c=a.$parent;v(a,"bpmn:SubProcess")&&!o.isExpanded&&n.push(a),$T(a,e)&&i.push({diElement:o,parent:c})}});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,c=o.parent;c&&n.indexOf(c)===-1;)c=c.$parent;if(c){var s=t._processToDiagramMap[c.id];t._moveToDiPlane(a,s.plane)}}),r},Vr.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=BT(e),i={x:n.x-_v.x,y:n.y-_v.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)})},Vr.prototype._moveToDiPlane=function(e,t){var n=bv(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},Vr.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},Vr.$inject=["eventBus","moddle"];function bv(e){return v(e,"bpmndi:BPMNDiagram")?e:bv(e.$parent)}function BT(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=ye(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),Ss(t)}function $T(e,t){var n=e.$parent;return!(!v(n,"bpmn:SubProcess")||n===t.bpmnElement||De(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var Lc=250,jT='<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>',FT="bjs-drilldown-empty";function hr(e,t,n,i,r){X.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",Lc,function(a){var c=a.shape;o._canDrillDown(c)?o._addOverlay(c):o._removeOverlay(c)},!0),this.reverted("shape.toggleCollapse",Lc,function(a){var c=a.shape;o._canDrillDown(c)?o._addOverlay(c):o._removeOverlay(c)},!0),this.executed(["shape.create","shape.move","shape.delete"],Lc,function(a){var c=a.oldParent,s=a.newParent||a.parent,u=a.shape;o._canDrillDown(u)&&o._addOverlay(u),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(u)},!0),this.reverted(["shape.create","shape.move","shape.delete"],Lc,function(a){var c=a.oldParent,s=a.newParent||a.parent,u=a.shape;o._canDrillDown(u)&&o._addOverlay(u),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(u)},!0),t.on("import.render.complete",function(){n.filter(function(a){return o._canDrillDown(a)}).map(function(a){o._addOverlay(a)})})}ie(hr,X),hr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},hr.prototype._canDrillDown=function(e){var t=this._canvas;return v(e,"bpmn:SubProcess")&&t.findRoot(mi(e))},hr.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=Z(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;ht(i.html).toggle(FT,!r)}},hr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=Z(e),r=n.get({element:e,type:"drilldown"});r.length&&this._removeOverlay(e);var o=ut('<button type="button" class="bjs-drilldown">'+jT+"</button>"),a=i.get("name")||i.get("id"),c=this._translate("Open {element}",{element:a});o.setAttribute("title",c),o.addEventListener("click",function(){t.setRootElement(t.findRoot(mi(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},hr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},hr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const HT={__depends__:[Oc,Pp,DT],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",yv],drilldownCentering:["type",vv],drilldownOverlayBehavior:["type",hr],subprocessCompatibility:["type",Vr]};function mr(e){yt.call(this,e)}ie(mr,yt),mr.prototype._modules=[pm,HT,Oc,qn,ra],mr.prototype._moddleExtensions={};var Ic="keyboard.keydown",zT="keyboard.keyup",VT=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,Ic)},gn.prototype._keyupHandler=function(e){this._keyHandler(e,zT)},gn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Ic,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,Se.bind(e,"keydown",this._keydownHandler),Se.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"),Se.unbind(e,"keydown",this._keydownHandler),Se.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){Wt(e)&&(n=t,t=e,e=VT),this._eventBus.on(n||Ic,e,t)},gn.prototype.removeListener=function(e,t){this._eventBus.off(t||Ic,e)},gn.prototype.hasModifier=lP,gn.prototype.isCmd=An,gn.prototype.isShift=gp,gn.prototype.isKey=Ht;var GT=500;function Co(e,t){var n=this;e.on("editorActions.init",GT,function(i){var r=i.editorActions;n.registerBindings(t,r)})}Co.$inject=["eventBus","keyboard"],Co.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(mP(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(gP(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(pP(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(fP(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(dP(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(hP(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Ht(["+","Add","="],r)&&An(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Ht(["-","Subtract"],r)&&An(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(Ht("0",r)&&An(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(Ht(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const Kp={__init__:["keyboard","keyboardBindings"],keyboard:["type",gn],keyboardBindings:["type",Co]};var WT={moveSpeed:50,moveSpeedAccelerated:200};function wv(e,t,n){var i=this;this._config=O({},WT,e||{}),t.addListener(r);function r(o){var a=o.keyEvent,c=i._config;if(t.isCmd(a)&&t.isKey(["ArrowLeft","Left","ArrowUp","Up","ArrowDown","Down","ArrowRight","Right"],a)){var s=t.isShift(a)?c.moveSpeedAccelerated:c.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:s,direction:u}),!0}}this.moveCanvas=function(o){var a=0,c=0,s=o.speed,u=s/Math.min(Math.sqrt(n.viewbox().scale),1);switch(o.direction){case"left":a=u;break;case"up":c=u;break;case"right":a=-u;break;case"down":c=-u;break}n.scroll({dx:a,dy:c})}}wv.$inject=["config.keyboardMove","keyboard","canvas"];const Ev={__depends__:[Kp],__init__:["keyboardMove"],keyboardMove:["type",wv]};var UT=15;function Sv(e,t){var n;function i(c){return a(c.originalEvent)}e.on("canvas.focus.changed",function(c){c.focused?e.on("element.mousedown",500,i):e.off("element.mousedown",i)});function r(c){var s=n.start,u=n.button,l=Br(c),p=ii(l,s);if(!n.dragging&&YT(p)>UT&&(n.dragging=!0,u===0&&Zg(e),cc("grab")),n.dragging){var f=n.last||n.start;p=ii(l,f),t.scroll({dx:p.x,dy:p.y}),n.last=l}c.preventDefault()}function o(c){Se.unbind(document,"mousemove",r),Se.unbind(document,"mouseup",o),n=null,Xg()}function a(c){if(!kr(c.target,".djs-draggable")){var s=c.button;if(!(s>=2||c.ctrlKey||c.shiftKey||c.altKey))return n={button:s,start:Br(c)},Se.bind(document,"mousemove",r),Se.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}Sv.$inject=["eventBus","canvas"];function YT(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const Rv={__init__:["moveCanvas"],moveCanvas:["type",Sv]};function Cv(e,t){var n=dl(e.min),i=dl(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function qT(e,t){return Math.max(e.min,Math.min(e.max,t))}var KT=Math.sign||function(e){return e>=0?1:-1},Xp={min:.2,max:4},Pv=10,XT=.1,ZT=.75;function vi(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||ZT;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}vi.$inject=["config.zoomScroll","eventBus","canvas"],vi.prototype.scroll=function(t){this._canvas.scroll(t)},vi.prototype.reset=function(){this._canvas.zoom("fit-viewport")},vi.prototype.zoom=function(t,n){var i=Cv(Xp,Pv*2);this._totalDelta+=t,Math.abs(this._totalDelta)>XT&&(this._zoom(t,n,i),this._totalDelta=0)},vi.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||rg()&&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 c=n.getBoundingClientRect(),s={x:t.clientX-c.left,y:t.clientY-c.top};a=Math.sqrt(Math.pow(t.deltaY,2)+Math.pow(t.deltaX,2))*KT(t.deltaY)*o,this.zoom(a,s)}else r?a={dx:o*t.deltaY,dy:0}:a={dx:o*t.deltaX,dy:o*t.deltaY},this.scroll(a)}},vi.prototype.stepZoom=function(t,n){var i=Cv(Xp,Pv);this._zoom(t,n,i)},vi.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=dl(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var c=Math.pow(10,a);i.zoom(qT(Xp,c),t)},vi.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&Se[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},vi.prototype._init=function(e){this.toggle(e)};const Av={__init__:["zoomScroll"],zoomScroll:["type",vi]};function ka(e){mr.call(this,e)}ie(ka,mr),ka.prototype._navigationModules=[Ev,Rv,Av],ka.prototype._modules=[].concat(mr.prototype._modules,ka.prototype._navigationModules);function Zp(e){return e&&e[e.length-1]}function Tv(e){return e.y}function Mv(e){return e.x}var QT={left:Mv,center:Mv,right:function(e){return e.x+e.width},top:Tv,middle:Tv,bottom:function(e){return e.y+e.height}};function Po(e,t){this._modeling=e,this._rules=t}Po.$inject=["modeling","rules"],Po.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}},Po.prototype._isType=function(e,t){return t.indexOf(e)!==-1},Po.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),i=n.axis,r=n.dimension,o={},a={},c=!1,s,u,l;function p(f,d){return Math.round((f[i]+d[i]+d[r])/2)}if(this._isType(e,["left","top"]))o[e]=t[0][i];else if(this._isType(e,["right","bottom"]))l=Zp(t),o[e]=l[i]+l[r];else if(this._isType(e,["center","middle"])){if(M(t,function(f){var d=f[i]+Math.round(f[r]/2);a[d]?a[d].elements.push(f):a[d]={elements:[f],center:d}}),s=oi(a,function(f){return f.elements.length>1&&(c=!0),f.elements.length}),c)return o[e]=Zp(s).center,o;u=t[0],t=oi(t,function(f){return f[i]+f[r]}),l=Zp(t),o[e]=p(u,l)}return o},Po.prototype.trigger=function(e,t){var n=this._modeling,i,r=Oe(e,function(s){return!(s.waypoints||s.host||s.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),_e(i)&&(r=i),!(r.length<2||!i)){var o=QT[t],a=oi(r,o),c=this._alignmentPosition(t,a);n.alignElements(a,c)}};const JT={__init__:["alignElements"],alignElements:["type",Po]},eM=new wo;function Ao(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Ao.$inject=["eventBus"],Ao.prototype.schedule=function(e,t=eM.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},Ao.prototype._schedule=function(e,t){const n=tM();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}},Ao.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Ao.prototype._cancel=function(e){clearTimeout(e.executionId)};function tM(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const nM={scheduler:["type",Ao]};var iM="djs-element-hidden",Nc=".entry",rM=1e3,kv=8,oM=300;function Mt(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}Mt.$inject=["canvas","elementRegistry","eventBus","scheduler"],Mt.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",function(t){var n=t.newSelection,i=n.length?n.length===1?n[0]:n:null;i?e.open(i,!0):e.close()}),this._eventBus.on("elements.changed",function(t){var n=t.elements,i=e._current;if(i){var r=i.target,o=_e(r)?r:[r],a=o.filter(function(s){return n.includes(s)});if(a.length){e.close();var c=o.filter(function(s){return e._elementRegistry.get(s.id)});c.length&&e._updateAndOpen(c.length>1?c:c[0])}}}),this._eventBus.on("canvas.viewbox.changed",function(){e._updatePosition()}),this._eventBus.on("element.marker.update",function(t){if(e.isOpen()){var n=t.element,i=e._current,r=_e(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},Mt.prototype._createContainer=function(){var e=ut('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},Mt.prototype.registerProvider=function(e,t){t||(t=e,e=rM),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},Mt.prototype.getEntries=function(e){var t=this._getProviders(),n=_e(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return M(t,function(r){if(Wt(r[n])){var o=r[n](e);Wt(o)?i=o(i):M(o,function(a,c){i[c]=a})}}),i},Mt.prototype.trigger=function(e,t,n){var i=this,r,o,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(r=an(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},oM);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,o,n)},Mt.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 c=a.action;if(this._eventBus.fire("contextPad.trigger",{entry:a,event:n})!==!1){if(Wt(c)){if(t==="click")return c(n,r,i)}else if(c[t])return c[t](n,r,i);n.preventDefault()}}}},Mt.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))}},Mt.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Mt.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;M(t,function(r,o){var a=r.group||"default",c=ut(r.html||'<div class="entry" draggable="true"></div>'),s;an(c,"data-action",o),s=et("[data-group="+Ma(a)+"]",n),s||(s=ut('<div class="group"></div>'),an(s,"data-group",a),n.appendChild(s)),s.appendChild(c),r.className&&aM(c,r.className),r.title&&an(c,"title",r.title),r.imageUrl&&(i=ut("<img>"),an(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",c.appendChild(i))}),ht(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},Mt.prototype._createHtml=function(e){var t=this,n=ut('<div class="djs-context-pad"></div>');return Rn.bind(n,Nc,"click",function(i){t.trigger("click",i)}),Rn.bind(n,Nc,"dragstart",function(i){t.trigger("dragstart",i)}),Rn.bind(n,Nc,"mouseover",function(i){t.trigger("mouseover",i)}),Rn.bind(n,Nc,"mouseout",function(i){t.trigger("mouseout",i)}),Se.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},Mt.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()&&cM(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},Mt.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},Mt.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return _e(e)!==_e(n)?!1:_e(e)?e.length===n.length&&Rr(e,function(i){return n.includes(i)}):n===e},Mt.prototype.isShown=function(){return this.isOpen()&&ht(this._current.html).has("open")},Mt.prototype.show=function(){this.isOpen()&&(ht(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},Mt.prototype.hide=function(){this.isOpen()&&(ht(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},Mt.prototype._getPosition=function(e){if(!_e(e)&&it(e)){var t=this._canvas.viewbox(),n=sM(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+kv*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),c=this._getTargetBounds(e);return{left:c.right-a.left+kv*this._canvas.zoom(),top:c.top-a.top}},Mt.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")},Mt.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=_e(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,iM)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},Mt.prototype._getTargetBounds=function(e){var t=this,n=_e(e)?e:[e],i=n.map(function(r){return t._canvas.getGraphics(r)});return i.reduce(function(r,o){const a=o.getBoundingClientRect();return r.top=Math.min(r.top,a.top),r.right=Math.max(r.right,a.right),r.bottom=Math.max(r.bottom,a.bottom),r.left=Math.min(r.left,a.left),r.x=r.left,r.y=r.top,r.width=r.right-r.left,r.height=r.bottom-r.top,r},{top:1/0,right:-1/0,bottom:-1/0,left:1/0})};function aM(e,t){var n=ht(e);t=_e(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function sM(e){return e.waypoints[e.waypoints.length-1]}function cM(e,t){return e=_e(e)?e:[e],t=_e(t)?t:[t],e.length===t.length&&Rr(e,function(n){return t.includes(n)})}const Dv={__depends__:[sc,nM,Oc],contextPad:["type",Mt]};var Bc,_t,Ov,gr,Lv,Iv,Nv,Qp,$c,Da,Bv,Jp,ef,tf,jc={},Fc=[],uM=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Hc=Array.isArray;function $i(e,t){for(var n in t)e[n]=t[n];return e}function nf(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function $v(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?Bc.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 zc(e,a,i,r,null)}function zc(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??++Ov,__i:-1,__u:0};return r==null&&_t.vnode!=null&&_t.vnode(o),o}function Vc(e){return e.children}function Gc(e,t){this.props=e,this.context=t}function Gr(e,t){if(t==null)return e.__?Gr(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"?Gr(e):null}function lM(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=$i({},t);o.__v=t.__v+1,_t.vnode&&_t.vnode(o),rf(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??Gr(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,Uv(i,o,r),t.__e=t.__=null,o.__e!=n&&jv(o)}}function jv(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}),jv(e)}function Fv(e){(!e.__d&&(e.__d=!0)&&gr.push(e)&&!Wc.__r++||Lv!=_t.debounceRendering)&&((Lv=_t.debounceRendering)||Iv)(Wc)}function Wc(){try{for(var e,t=1;gr.length;)gr.length>t&&gr.sort(Nv),e=gr.shift(),t=gr.length,lM(e)}finally{gr.length=Wc.__r=0}}function Hv(e,t,n,i,r,o,a,c,s,u,l){var p,f,d,h,m,g,R=i&&i.__k||Fc,w=t.length;for(s=pM(n,t,R,s,w),p=0;p<w;p++)(d=n.__k[p])!=null&&(f=d.__i!=-1&&R[d.__i]||jc,d.__i=p,g=rf(e,d,f,r,o,a,c,s,u,l),h=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&of(f.ref,null,d),l.push(d.ref,d.__c||h,d)),m==null&&h!=null&&(m=h),4&d.__u?(s=zv(d,s,e),f.__e&&(f.__e=null)):typeof d.type=="function"&&g!==void 0?s=g:h&&(s=h.nextSibling),d.__u&=-7);return n.__e=m,s}function pM(e,t,n,i,r){var o,a,c,s,u,l=n.length,p=l,f=0;for(e.__k=new Array(r),o=0;o<r;o++)(a=t[o])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[o]=zc(null,a,null,null,null):Hc(a)?a=e.__k[o]=zc(Vc,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=zc(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[o]=a,s=o+f,a.__=e,a.__b=e.__b+1,c=null,(u=a.__i=fM(a,n,s,p))!=-1&&(p--,(c=n[u])&&(c.__u|=2)),c==null||c.__v==null?(u==-1&&(r>l?f--:r<l&&f++),typeof a.type!="function"&&(a.__u|=4)):u!=s&&(u==s-1?f--:u==s+1?f++:(u>s?f--:f++,a.__u|=4))):e.__k[o]=null;if(p)for(o=0;o<l;o++)(c=n[o])!=null&&(2&c.__u)==0&&(c.__e==i&&(i=Gr(c)),qv(c,c));return i}function zv(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=zv(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Gr(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function fM(e,t,n,i){var r,o,a,c=e.key,s=e.type,u=t[n],l=u!=null&&(2&u.__u)==0;if(u===null&&c==null||l&&c==u.key&&s==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&&c==u.key&&s==u.type)return a}return-1}function Vv(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||uM.test(t)?n:n+"px"}function Uc(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||Vv(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||Vv(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(Bv,"$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[Da]=i[Da]:(n[Da]=Jp,e.addEventListener(t,o?tf:ef,o)):e.removeEventListener(t,o?tf:ef,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 Gv(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[$c]==null)t[$c]=Jp++;else if(t[$c]<n[Da])return;return n(_t.event?_t.event(t):t)}}}function rf(e,t,n,i,r,o,a,c,s,u){var l,p,f,d,h,m,g,R,w,x,b,E,T,L,A,F,H=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(s=!!(32&n.__u),o=[c=t.__e=n.__e]),(l=_t.__b)&&l(t);e:if(typeof H=="function"){p=a.length;try{if(w=t.props,x=H.prototype&&H.prototype.render,b=(l=H.contextType)&&i[l.__c],E=l?b?b.props.value:l.__:i,n.__c?R=(f=t.__c=n.__c).__=f.__E:(x?t.__c=f=new H(w,E):(t.__c=f=new Gc(w,E),f.constructor=H,f.render=hM),b&&b.sub(f),f.state||(f.state={}),f.__n=i,d=f.__d=!0,f.__h=[],f._sb=[]),x&&f.__s==null&&(f.__s=f.state),x&&H.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=$i({},f.__s)),$i(f.__s,H.getDerivedStateFromProps(w,f.__s))),h=f.props,m=f.state,f.__v=t,d)x&&H.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),x&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(x&&H.getDerivedStateFromProps==null&&w!==h&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(w,E),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(w,f.__s,E)===!1){t.__v!=n.__v&&(f.props=w,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(N){N&&(N.__=t)}),Fc.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&a.push(f),c=Gr(n);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(w,f.__s,E),x&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(h,m,g)})}if(f.context=E,f.props=w,f.__P=e,f.__e=!1,T=_t.__r,L=0,x)f.state=f.__s,f.__d=!1,T&&T(t),l=f.render(f.props,f.state,f.context),Fc.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,T&&T(t),l=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++L<25);f.state=f.__s,f.getChildContext!=null&&(i=$i($i({},i),f.getChildContext())),x&&!d&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(h,m)),A=l!=null&&l.type===Vc&&l.key==null?Yv(l.props.children):l,c=Hv(e,Hc(A)?A:[A],t,n,i,r,o,a,c,s,u),f.base=t.__e,t.__u&=-161,f.__h.length&&a.push(f),R&&(f.__E=f.__=null)}catch(N){if(a.length=p,t.__v=null,s||o!=null){if(N.then){for(t.__u|=s?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;o!=null&&(o[o.indexOf(c)]=null),t.__e=c}else if(o!=null)for(F=o.length;F--;)nf(o[F])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),N.then||Wv(t),_t.__e(N,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):c=t.__e=dM(n.__e,t,n,i,r,o,a,s,u);return(l=_t.diffed)&&l(t),128&t.__u?void 0:c}function Wv(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Wv))}function Uv(e,t,n){for(var i=0;i<n.length;i++)of(n[i],n[++i],n[++i]);_t.__c&&_t.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){_t.__e(o,r.__v)}})}function Yv(e){return typeof e!="object"||e==null||e.__b>0?e:Hc(e)?e.map(Yv):e.constructor!==void 0?null:$i({},e)}function dM(e,t,n,i,r,o,a,c,s){var u,l,p,f,d,h,m,g=n.props||jc,R=t.props,w=t.type;if(w=="svg"?r="http://www.w3.org/2000/svg":w=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),o!=null){for(u=0;u<o.length;u++)if((d=o[u])&&"setAttribute"in d==!!w&&(w?d.localName==w:d.nodeType==3)){e=d,o[u]=null;break}}if(e==null){if(w==null)return document.createTextNode(R);e=document.createElementNS(r,w,R.is&&R),c&&(_t.__m&&_t.__m(t,o),c=!1),o=null}if(w==null)g===R||c&&e.data==R||(e.data=R);else{if(o=w=="textarea"&&R.defaultValue!=null?null:o&&Bc.call(e.childNodes),!c&&o!=null)for(g={},u=0;u<e.attributes.length;u++)g[(d=e.attributes[u]).name]=d.value;for(u in g)d=g[u],u=="dangerouslySetInnerHTML"?p=d:u=="children"||u in R||u=="value"&&"defaultValue"in R||u=="checked"&&"defaultChecked"in R||Uc(e,u,null,d,r);for(u in R)d=R[u],u=="children"?f=d:u=="dangerouslySetInnerHTML"?l=d:u=="value"?h=d:u=="checked"?m=d:c&&typeof d!="function"||g[u]===d||Uc(e,u,d,g[u],r);if(l)c||p&&(l.__html==p.__html||l.__html==e.innerHTML)||(e.innerHTML=l.__html),t.__k=[];else if(p&&(e.innerHTML=""),Hv(t.type=="template"?e.content:e,Hc(f)?f:[f],t,n,i,w=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&Gr(n,0),c,s),o!=null)for(u=o.length;u--;)nf(o[u]);c&&w!="textarea"||(u="value",w=="progress"&&h==null?e.removeAttribute("value"):h!=null&&(h!==e[u]||w=="progress"&&!h||w=="option"&&h!=g[u])&&Uc(e,u,h,g[u],r),u="checked",m!=null&&m!=e[u]&&Uc(e,u,m,g[u],r))}return e}function of(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){_t.__e(r,n)}}function qv(e,t,n){var i,r;if(_t.unmount&&_t.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||of(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){_t.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&qv(i[r],t,n||typeof e.type!="function");n||nf(e.__e),e.__c=e.__=e.__e=void 0}function hM(e,t,n){return this.constructor(e,n)}function Kv(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),_t.__&&_t.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],rf(t,e=t.__k=$v(Vc,null,[e]),r||jc,jc,t.namespaceURI,r?null:t.firstChild?Bc.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),Uv(o,e,a),e.props.children=null}Bc=Fc.slice,_t={__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(c){e=c}throw e}},Ov=0,Gc.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=$i({},this.state),typeof e=="function"&&(e=e($i({},n),this.props)),e&&$i(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Fv(this))},Gc.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Fv(this))},Gc.prototype.render=Vc,gr=[],Iv=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Nv=function(e,t){return e.__v.__b-t.__v.__b},Wc.__r=0,Qp=Math.random().toString(8),$c="__d"+Qp,Da="__a"+Qp,Bv=/(PointerCapture)$|Capture$/i,Jp=0,ef=Gv(!1),tf=Gv(!0);var Xv=function(e,t,n,i){var r;t[0]=0;for(var o=1;o<t.length;o++){var a=t[o++],c=t[o]?(t[0]|=a?1:2,n[t[o++]]):t[++o];a===3?i[0]=c:a===4?i[1]=Object.assign(i[1]||{},c):a===5?(i[1]=i[1]||{})[t[++o]]=c:a===6?i[1][t[++o]]+=c+"":a?(r=e.apply(c,Xv(e,c,n,["",null])),i.push(r),c[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(c)}return i},Zv=new Map;function mM(e){var t=Zv.get(this);return t||(t=new Map,Zv.set(this,t)),(t=Xv(this,t.get(e)||(t.set(e,t=(function(n){for(var i,r,o=1,a="",c="",s=[0],u=function(f){o===1&&(f||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?s.push(0,f,a):o===3&&(f||a)?(s.push(3,f,a),o=2):o===2&&a==="..."&&f?s.push(4,f,0):o===2&&a&&!f?s.push(5,0,!0,a):o>=5&&((a||!f&&o===5)&&(s.push(o,0,a,r),o=6),f&&(s.push(o,f,0,r),o=6)),a=""},l=0;l<n.length;l++){l&&(o===1&&u(),u(l));for(var p=0;p<n[l].length;p++)i=n[l][p],o===1?i==="<"?(u(),s=[s],o=3):a+=i:o===4?a==="--"&&i===">"?(o=1,a=""):a=i+a[0]:c?i===c?c="":a+=i:i==='"'||i==="'"?c=i:i===">"?(u(),o=1):o&&(i==="="?(o=5,r=a,a=""):i==="/"&&(o<5||n[l][p+1]===">")?(u(),o===3&&(s=s[0]),o=s,(s=s[0]).push(2,0,o),o=0):i===" "||i===" "||i===`
11
- `||i==="\r"?(u(),o=2):a+=i),o===3&&a==="!--"&&(o=4,s=s[0])}return u(),s})(e)),t),arguments,[])).length>1?t:t[0]}var ot=mM.bind($v),To,kt,af,Qv,Oa=0,Jv=[],zt=_t,e_=zt.__b,t_=zt.__r,n_=zt.diffed,i_=zt.__c,r_=zt.unmount,o_=zt.__;function Yc(e,t){zt.__h&&zt.__h(kt,e,Oa||t),Oa=0;var n=kt.__H||(kt.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function sf(e){return Oa=1,gM(s_,e)}function gM(e,t,n){var i=Yc(To++,2);if(i.t=e,!i.__c&&(i.__=[s_(void 0,t),function(c){var s=i.__N?i.__N[0]:i.__[0],u=i.t(s,c);s!==u&&(i.__N=[u,i.__[1]],i.__c.setState({}))}],i.__c=kt,!kt.__f)){var r=function(c,s,u){if(!i.__c.__H)return!0;var l=!1,p=i.__c.props!==c;if(i.__c.__H.__.some(function(d){if(d.__N){l=!0;var h=d.__[0];d.__=d.__N,d.__N=void 0,h!==d.__[0]&&(p=!0)}}),o){var f=o.call(this,c,s,u);return l?f||p:f}return!l||p};kt.__f=!0;var o=kt.shouldComponentUpdate,a=kt.componentWillUpdate;kt.componentWillUpdate=function(c,s,u){if(this.__e){var l=o;o=void 0,r(c,s,u),o=l}a&&a.call(this,c,s,u)},kt.shouldComponentUpdate=r}return i.__N||i.__}function qc(e,t){var n=Yc(To++,3);!zt.__s&&lf(n.__H,t)&&(n.__=e,n.u=t,kt.__H.__h.push(n))}function cf(e,t){var n=Yc(To++,4);!zt.__s&&lf(n.__H,t)&&(n.__=e,n.u=t,kt.__h.push(n))}function Kc(e){return Oa=5,ji(function(){return{current:e}},[])}function ji(e,t){var n=Yc(To++,7);return lf(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function La(e,t){return Oa=8,ji(function(){return e},t)}function yM(){for(var e;e=Jv.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Xc),t.__h.some(uf),t.__h=[]}catch(n){t.__h=[],zt.__e(n,e.__v)}}}zt.__b=function(e){kt=null,e_&&e_(e)},zt.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),o_&&o_(e,t)},zt.__r=function(e){t_&&t_(e),To=0;var t=(kt=e.__c).__H;t&&(af===kt?(t.__h=[],kt.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(Xc),t.__h.some(uf),t.__h=[],To=0)),af=kt},zt.diffed=function(e){n_&&n_(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Jv.push(t)!==1&&Qv===zt.requestAnimationFrame||((Qv=zt.requestAnimationFrame)||vM)(yM)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),af=kt=null},zt.__c=function(e,t){t.some(function(n){try{n.__h.some(Xc),n.__h=n.__h.filter(function(i){return!i.__||uf(i)})}catch(i){t.some(function(r){r.__h&&(r.__h=[])}),t=[],zt.__e(i,n.__v)}}),i_&&i_(e,t)},zt.unmount=function(e){r_&&r_(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{Xc(i)}catch(r){t=r}}),n.__H=void 0,t&&zt.__e(t,n.__v))};var a_=typeof requestAnimationFrame=="function";function vM(e){var t,n=function(){clearTimeout(i),a_&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);a_&&(t=requestAnimationFrame(n))}function Xc(e){var t=kt,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),kt=t}function uf(e){var t=kt;e.__c=e.__(),kt=t}function lf(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function s_(e,t){return typeof t=="function"?t(e):t}function _M(e){const{navigationStack:t,setNavigationStack:n}=e,i=ji(()=>t.length<=1?[]:t.slice(0,-1).map((a,c)=>({label:a.label,onClick:()=>n(s=>s.slice(0,c+1))})),[t,n]),r=t.length>0?()=>n([]):null,o=t.length>0?t[t.length-1].label:null;return ot`
10
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="`+f+'" height="'+d+'" viewBox="'+l+" "+p+" "+f+" "+d+'" version="1.1">'+s+a+"</svg>"}catch(i){n=i}if(this._emit("saveSVG.done",{error:n,svg:t}),n)throw n;return{svg:t}},yt.prototype._setDefinitions=function(e){this._definitions=e},yt.prototype.getModules=function(){return this._modules},yt.prototype.clear=function(){this.getDefinitions()&&tr.prototype.clear.call(this)},yt.prototype.destroy=function(){tr.prototype.destroy.call(this),li(this._container)},yt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},yt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},yt.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),typeof e=="string"&&(e=et(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},yt.prototype.getDefinitions=function(){return this._definitions},yt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},yt.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=O(ai(n,["additionalModules"]),{canvas:O({},n.canvas,{container:e}),modules:a});tr.call(this,s),n&&n.container&&this.attachTo(n.container)},yt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},yt.prototype._createContainer=function(e){const t=ut('<div class="bjs-container"></div>');return mn(t,{width:rm(e.width),height:rm(e.height),position:e.position}),t},yt.prototype._createModdle=function(e){const t=O({},this._moddleExtensions,e.moddleExtensions);return new ld(t)},yt.prototype._modules=[];function Ts(e,t){return e.warnings=t,e}function Q1(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 J1={width:"100%",height:"100%",position:"relative"};function rm(e){return e+(we(e)?"px":"")}function eS(e,t){return t&&st(e.diagrams,function(n){return n.id===t})||null}function tS(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+em+"</a>",i=ut(n);mn(et("svg",i),tm),mn(i,nm,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),Se.bind(i,"click",function(r){Z1(),r.preventDefault()})}function uo(e){yt.call(this,e),this.on("import.parse.complete",function(t){t.error||this._collectIds(t.definitions,t.elementsById)},this),this.on("diagram.destroy",function(){this.get("moddle").ids.clear()},this)}ie(uo,yt),uo.prototype._createModdle=function(e){var t=yt.prototype._createModdle.call(this,e);return t.ids=new ui([32,36,1]),t},uo.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 $e(e,t){return v(e,"bpmn:CallActivity")?!1:v(e,"bpmn:SubProcess")?(t=t||Ve(e),t&&v(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):v(e,"bpmn:Participant")?!!Z(e).processRef:!0}function Yt(e){if(!(!v(e,"bpmn:Participant")&&!v(e,"bpmn:Lane"))){var t=Ve(e).isHorizontal;return t===void 0?!0:t}}function nS(e){return e&&Z(e).isInterrupting!==!1}function cn(e){return e&&!!Z(e).triggeredByEvent}function lo(e,t){var n=Z(e).eventDefinitions;return Vi(n,function(i){return v(i,t)})}function iS(e){return lo(e,"bpmn:ErrorEventDefinition")}function rS(e){return lo(e,"bpmn:EscalationEventDefinition")}function oS(e){return lo(e,"bpmn:CompensateEventDefinition")}var Ir={width:90,height:20},om=15;function nr(e){return v(e,"bpmn:Event")||v(e,"bpmn:Gateway")||v(e,"bpmn:DataStoreReference")||v(e,"bpmn:DataObjectReference")||v(e,"bpmn:DataInput")||v(e,"bpmn:DataOutput")||v(e,"bpmn:SequenceFlow")||v(e,"bpmn:MessageFlow")||v(e,"bpmn:Group")}function Ms(e){return Me(e.label)}function aS(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=sS(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 sS(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?aS(e.waypoints):v(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 cS(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=pl(t),i=Ir),O({x:n.x-i.width/2,y:n.y-i.height/2},i)}function am(e){if(v(e,"bpmn:FlowElement")||v(e,"bpmn:Participant")||v(e,"bpmn:Lane")||v(e,"bpmn:SequenceFlow")||v(e,"bpmn:MessageFlow")||v(e,"bpmn:DataInput")||v(e,"bpmn:DataOutput"))return"name";if(v(e,"bpmn:TextAnnotation"))return"text";if(v(e,"bpmn:Group"))return"categoryValueRef"}function uS(e){var t=e.categoryValueRef;return t&&t.value||""}function jn(e){var t=e.businessObject,n=am(t);if(n)return n==="categoryValueRef"?uS(t):t[n]||""}function lS(e,t){var n=e.businessObject,i=am(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function pS(e){return Me(e)&&nr(e.labelTarget)}var po=7;function sm(e){let t=[];return M(e.incoming,n=>{v(n,"bpmn:Association")&&v(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),M(e.outgoing,n=>{v(n,"bpmn:Association")&&v(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function na(e){const t=new Map;return M(rl(e),n=>{M(sm(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 fl="hsl(225, 10%, 15%)",fS="white";function hi(e,t){return Vi(e.eventDefinitions,function(n){return n.$type===t})}function dS(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function hS(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function Ie(e,t,n){var i=Ve(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||fS}function te(e,t,n){var i=Ve(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||fl}function ia(e,t,n,i){var r=Ve(e),o=r.get("label");return i||o&&o.get("color:color")||t||te(e,n)}function cm(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 Dr(r)}function dl(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 Dr(a)}function mS(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 Dr(s)}function gS(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 Dr(o)}function ra(e,t={}){return{width:Gn(e,t),height:An(e,t)}}function Gn(e,t={}){return En(t,"width")?t.width:e.width}function An(e,t={}){return En(t,"height")?t.height:e.height}var yS=new ui,vS=10,ks=3,_S=1.5,Ds=10,bS=4,fo=.95,xS=1,wS=.25;function Nr(e,t,n,i,r,o,a){Pi.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,u=e&&e.defaultLabelColor;function l(C){return n.computeStyle(C,{strokeLinecap:"round",strokeLinejoin:"round",stroke:fl,strokeWidth:2,fill:"white"})}function p(C){return n.computeStyle(C,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:fl,strokeWidth:2})}function f(C,_){var{ref:y={x:0,y:0},scale:D=1,element:I,parentGfx:W=r._svg}=_,oe=me("marker",{id:C,viewBox:"0 0 20 20",refX:y.x,refY:y.y,markerWidth:20*D,markerHeight:20*D,orient:"auto"});Re(oe,I);var Pe=et(":scope > defs",W);Pe||(Pe=me("defs"),Re(W,Pe)),Re(Pe,oe)}function d(C,_,y,D){var I=yS.nextPrefixed("marker-");return h(C,I,_,y,D),"url(#"+I+")"}function h(C,_,y,D,I){if(y==="sequenceflow-end"){var W=me("path",{d:"M 1 5 L 11 10 L 1 15 Z",...l({fill:I,stroke:I,strokeWidth:1})});f(_,{element:W,ref:{x:11,y:10},scale:.5,parentGfx:C})}if(y==="messageflow-start"){var oe=me("circle",{cx:6,cy:6,r:3.5,...l({fill:D,stroke:I,strokeWidth:1,strokeDasharray:[1e4,1]})});f(_,{element:oe,ref:{x:6,y:6},parentGfx:C})}if(y==="messageflow-end"){var Pe=me("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...l({fill:D,stroke:I,strokeWidth:1,strokeDasharray:[1e4,1]})});f(_,{element:Pe,ref:{x:8.5,y:5},parentGfx:C})}if(y==="association-start"){var Ue=me("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:I,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(_,{element:Ue,ref:{x:1,y:10},scale:.5,parentGfx:C})}if(y==="association-end"){var ft=me("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:I,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(_,{element:ft,ref:{x:11,y:10},scale:.5,parentGfx:C})}if(y==="conditional-flow-marker"){var tt=me("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...l({fill:D,stroke:I})});f(_,{element:tt,ref:{x:-1,y:10},scale:.5,parentGfx:C})}if(y==="conditional-default-flow-marker"){var It=me("path",{d:"M 6 4 L 10 16",...l({stroke:I,fill:"none"})});f(_,{element:It,ref:{x:0,y:10},scale:.5,parentGfx:C})}}function m(C,_,y,D,I={}){Gt(D)&&(I=D,D=0),D=D||0,I=l(I);var W=_/2,oe=y/2,Pe=me("circle",{cx:W,cy:oe,r:Math.round((_+y)/4-D),...I});return Re(C,Pe),Pe}function g(C,_,y,D,I,W){Gt(I)&&(W=I,I=0),I=I||0,W=l(W);var oe=me("rect",{x:I,y:I,width:_-I*2,height:y-I*2,rx:D,ry:D,...W});return Re(C,oe),oe}function R(C,_,y,D){var I=_/2,W=y/2,oe=[{x:I,y:0},{x:_,y:W},{x:I,y},{x:0,y:W}],Pe=oe.map(function(ft){return ft.x+","+ft.y}).join(" ");D=l(D);var Ue=me("polygon",{...D,points:Pe});return Re(C,Ue),Ue}function w(C,_,y,D){y=p(y);var I=Ko(_,y,D);return Re(C,I),I}function b(C,_,y){return w(C,_,y,5)}function x(C,_,y){y=p(y);var D=me("path",{...y,d:_});return Re(C,D),D}function E(C,_,y,D){return x(_,y,O({"data-marker":C},D))}function T(C){return Lt[C]}function L(C){return function(_,y,D){return T(C)(_,y,D)}}var A={"bpmn:MessageEventDefinition":function(C,_,y={},D){var I=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.235,my:.315}}),W=D?te(_,c,y.stroke):Ie(_,s,y.fill),oe=D?Ie(_,s,y.fill):te(_,c,y.stroke),Pe=x(C,I,{fill:W,stroke:oe,strokeWidth:1});return Pe},"bpmn:TimerEventDefinition":function(C,_,y={}){var D=y.width||_.width,I=y.height||_.height,W=y.width?1:2,oe=m(C,D,I,.2*I,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:W}),Pe=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:D,containerHeight:I,position:{mx:.5,my:.5}});x(C,Pe,{stroke:te(_,c,y.stroke),strokeWidth:W});for(var Ue=0;Ue<12;Ue++){var ft=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:D,containerHeight:I,position:{mx:.5,my:.5}}),tt=D/2,It=I/2;x(C,ft,{strokeWidth:1,stroke:te(_,c,y.stroke),transform:"rotate("+Ue*30+","+It+","+tt+")"})}return oe},"bpmn:EscalationEventDefinition":function(C,_,y={},D){var I=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.5,my:.2}}),W=D?te(_,c,y.stroke):Ie(_,s,y.fill);return x(C,I,{fill:W,stroke:te(_,c,y.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(C,_,y={}){var D=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.5,my:.222}});return x(C,D,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(C,_,y={},D){var I=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.57,my:.263}}),W=D?te(_,c,y.stroke):Ie(_,s,y.fill);return x(C,I,{fill:W,stroke:te(_,c,y.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(C,_,y={},D){var I=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.2,my:.722}}),W=D?te(_,c,y.stroke):Ie(_,s,y.fill);return x(C,I,{fill:W,stroke:te(_,c,y.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(C,_,y={},D){var I=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.638,my:-.055}}),W=D?te(_,c,y.stroke):"none",oe=x(C,I,{fill:W,stroke:te(_,c,y.stroke),strokeWidth:1});return Qh(oe,45),oe},"bpmn:CompensateEventDefinition":function(C,_,y={},D){var I=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.22,my:.5}}),W=D?te(_,c,y.stroke):Ie(_,s,y.fill);return x(C,I,{fill:W,stroke:te(_,c,y.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(C,_,y={},D){var I=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.5,my:.2}}),W=D?te(_,c,y.stroke):Ie(_,s,y.fill);return x(C,I,{strokeWidth:1,fill:W,stroke:te(_,c,y.stroke)})},"bpmn:MultipleEventDefinition":function(C,_,y={},D){var I=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.211,my:.36}}),W=D?te(_,c,y.stroke):Ie(_,s,y.fill);return x(C,I,{fill:W,stroke:te(_,c,y.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(C,_,y={}){var D=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.458,my:.194}});return x(C,D,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(C,_,y={}){var D=m(C,_.width,_.height,8,{fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke),strokeWidth:4});return D}};function j(C,_,y={},D){var I=Z(C),W=dS(I),oe=D||C;return I.get("eventDefinitions")&&I.get("eventDefinitions").length>1?I.get("parallelMultiple")?A["bpmn:ParallelMultipleEventDefinition"](_,oe,y,W):A["bpmn:MultipleEventDefinition"](_,oe,y,W):hi(I,"bpmn:MessageEventDefinition")?A["bpmn:MessageEventDefinition"](_,oe,y,W):hi(I,"bpmn:TimerEventDefinition")?A["bpmn:TimerEventDefinition"](_,oe,y,W):hi(I,"bpmn:ConditionalEventDefinition")?A["bpmn:ConditionalEventDefinition"](_,oe,y,W):hi(I,"bpmn:SignalEventDefinition")?A["bpmn:SignalEventDefinition"](_,oe,y,W):hi(I,"bpmn:EscalationEventDefinition")?A["bpmn:EscalationEventDefinition"](_,oe,y,W):hi(I,"bpmn:LinkEventDefinition")?A["bpmn:LinkEventDefinition"](_,oe,y,W):hi(I,"bpmn:ErrorEventDefinition")?A["bpmn:ErrorEventDefinition"](_,oe,y,W):hi(I,"bpmn:CancelEventDefinition")?A["bpmn:CancelEventDefinition"](_,oe,y,W):hi(I,"bpmn:CompensateEventDefinition")?A["bpmn:CompensateEventDefinition"](_,oe,y,W):hi(I,"bpmn:TerminateEventDefinition")?A["bpmn:TerminateEventDefinition"](_,oe,y,W):null}var H={ParticipantMultiplicityMarker:function(C,_,y={}){var D=Gn(_,y),I=An(_,y),W=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:I,position:{mx:(D/2-6)/D,my:(I-15)/I}});E("participant-multiplicity",C,W,{strokeWidth:2,fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke)})},SubProcessMarker:function(C,_,y={}){var D=g(C,14,14,0,{strokeWidth:1,fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke)});Qt(D,_.width/2-7.5,_.height-20);var I=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2-7.5)/_.width,my:(_.height-20)/_.height}});E("sub-process",C,I,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke)})},ParallelMarker:function(C,_,y){var D=Gn(_,y),I=An(_,y),W=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:I,position:{mx:(D/2+y.parallel)/D,my:(I-20)/I}});E("parallel",C,W,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke)})},SequentialMarker:function(C,_,y){var D=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2+y.seq)/_.width,my:(_.height-19)/_.height}});E("sequential",C,D,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke)})},CompensationMarker:function(C,_,y){var D=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2+y.compensation)/_.width,my:(_.height-13)/_.height}});E("compensation",C,D,{strokeWidth:1,fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke)})},LoopMarker:function(C,_,y){var D=Gn(_,y),I=An(_,y),W=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:I,position:{mx:(D/2+y.loop)/D,my:(I-7)/I}});E("loop",C,W,{strokeWidth:1.5,fill:"none",stroke:te(_,c,y.stroke),strokeMiterlimit:.5})},AdhocMarker:function(C,_,y){var D=Gn(_,y),I=An(_,y),W=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:I,position:{mx:(D/2+y.adhoc)/D,my:(I-15)/I}});E("adhoc",C,W,{strokeWidth:1,fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke)})}};function N(C,_,y,D){H[C](_,y,D)}function G(C,_,y=[],D={}){D={fill:D.fill,stroke:D.stroke,width:Gn(_,D),height:An(_,D)};var I=Z(_),W=y.includes("SubProcessMarker");W?D={...D,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:D={...D,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},I.get("isForCompensation")&&y.push("CompensationMarker"),v(I,"bpmn:AdHocSubProcess")&&(y.push("AdhocMarker"),W||O(D,{compensation:D.compensation-18}));var oe=I.get("loopCharacteristics"),Pe=oe&&oe.get("isSequential");oe&&(O(D,{compensation:D.compensation-18}),y.includes("AdhocMarker")&&O(D,{seq:-23,loop:-18,parallel:-24}),Pe===void 0&&y.push("LoopMarker"),Pe===!1&&y.push("ParallelMarker"),Pe===!0&&y.push("SequentialMarker")),y.includes("CompensationMarker")&&y.length===1&&O(D,{compensation:-8}),M(y,function(Ue){N(Ue,C,_,D)})}function fe(C,_,y={}){y=O({size:{width:100}},y);var D=o.createText(_||"",y);return je(D).add("djs-label"),Re(C,D),D}function Fe(C,_,y,D={}){var I=Z(_),W=ra({x:_.x,y:_.y,width:_.width,height:_.height},D);return fe(C,I.name,{align:y,box:W,padding:7,style:{fill:ia(_,u,c,D.stroke)}})}function lt(C,_,y={}){var D={width:_.width,height:_.height,x:_.width/2+_.x,y:_.height/2+_.y};return fe(C,jn(_),{box:D,style:O({},o.getExternalStyle(),{fill:ia(_,u,c,y.stroke)})})}function Y(C,_,y,D={}){var I=Yt(y),W=fe(C,_,{box:{height:30,width:I?An(y,D):Gn(y,D)},align:"center-middle",style:{fill:ia(y,u,c,D.stroke)}});if(I){var oe=-1*An(y,D);Ps(W,0,-oe,270)}}function de(C,_,y={}){var{width:D,height:I}=ra(_,y);return g(C,D,I,Ds,{...y,fill:Ie(_,s,y.fill),fillOpacity:fo,stroke:te(_,c,y.stroke)})}function he(C,_,y={}){var D=Z(_),I=Ie(_,s,y.fill),W=te(_,c,y.stroke);return(D.get("associationDirection")==="One"||D.get("associationDirection")==="Both")&&(y.markerEnd=d(C,"association-end",I,W)),D.get("associationDirection")==="Both"&&(y.markerStart=d(C,"association-start",I,W)),y=Ge(y,["markerStart","markerEnd"]),b(C,_.waypoints,{...y,stroke:W,strokeDasharray:"0, 5"})}function se(C,_,y={}){var D=Ie(_,s,y.fill),I=te(_,c,y.stroke),W=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}}),oe=x(C,W,{fill:D,fillOpacity:fo,stroke:I}),Pe=Z(_);if(hS(Pe)){var Ue=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.33,my:(_.height-18)/_.height}});x(C,Ue,{strokeWidth:2,fill:D,stroke:I})}return oe}function ce(C,_,y={}){return m(C,_.width,_.height,{fillOpacity:fo,...y,fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke)})}function ee(C,_,y={}){return R(C,_.width,_.height,{fill:Ie(_,s,y.fill),fillOpacity:fo,stroke:te(_,c,y.stroke)})}function F(C,_,y={}){var D=g(C,Gn(_,y),An(_,y),0,{fill:Ie(_,s,y.fill),fillOpacity:y.fillOpacity||fo,stroke:te(_,c,y.stroke),strokeWidth:1.5}),I=Z(_);if(v(I,"bpmn:Lane")){var W=I.get("name");Y(C,W,_,y)}return D}function $(C,_,y={}){var D=de(C,_,y),I=$e(_);if(cn(_)&&(re(D,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!I)){var W=Z(_).flowElements||[],oe=W.filter(Pe=>v(Pe,"bpmn:StartEvent"));oe.length===1&&U(oe[0],C,y,_)}return Fe(C,_,I?"center-top":"center-middle",y),I?G(C,_,void 0,y):G(C,_,["SubProcessMarker"],y),D}function U(C,_,y,D){var I=22,W={fill:Ie(D,s,y.fill),stroke:te(D,c,y.stroke),width:I,height:I},oe=Z(C).isInterrupting,Pe=oe?0:3,Ue=oe?1:1.2,ft=20,tt=(I-ft)/2,It="translate("+tt+","+tt+")";m(_,ft,ft,{fill:W.fill,stroke:W.stroke,strokeWidth:Ue,strokeDasharray:Pe,transform:It}),j(C,_,W,D)}function ke(C,_,y={}){var D=de(C,_,y);return Fe(C,_,"center-middle",y),G(C,_,void 0,y),D}var Lt=this.handlers={"bpmn:AdHocSubProcess":function(C,_,y={}){return $e(_)?y=Ge(y,["fill","stroke","width","height"]):y=Ge(y,["fill","stroke"]),$(C,_,y)},"bpmn:Association":function(C,_,y={}){return y=Ge(y,["fill","stroke"]),he(C,_,y)},"bpmn:BoundaryEvent":function(C,_,y={}){var{renderIcon:D=!0}=y;y=Ge(y,["fill","stroke"]);var I=Z(_),W=I.get("cancelActivity");y={strokeWidth:1.5,fill:Ie(_,s,y.fill),fillOpacity:xS,stroke:te(_,c,y.stroke)},W||(y.strokeDasharray="6");var oe=ce(C,_,y);return m(C,_.width,_.height,ks,{...y,fill:"none"}),D&&j(_,C,y),oe},"bpmn:BusinessRuleTask":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=ke(C,_,y),I=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),W=x(C,I);re(W,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1});var oe=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),Pe=x(C,oe);return re(Pe,{fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke),strokeWidth:1}),D},"bpmn:CallActivity":function(C,_,y={}){return y=Ge(y,["fill","stroke"]),$(C,_,{strokeWidth:5,...y})},"bpmn:ComplexGateway":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=ee(C,_,y),I=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:_.width,containerHeight:_.height,position:{mx:.46,my:.26}});return x(C,I,{fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke),strokeWidth:1}),D},"bpmn:DataInput":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=i.getRawPath("DATA_ARROW"),I=se(C,_,y);return x(C,D,{fill:"none",stroke:te(_,c,y.stroke),strokeWidth:1}),I},"bpmn:DataInputAssociation":function(C,_,y={}){return y=Ge(y,["fill","stroke"]),he(C,_,{...y,markerEnd:d(C,"association-end",Ie(_,s,y.fill),te(_,c,y.stroke))})},"bpmn:DataObject":function(C,_,y={}){return y=Ge(y,["fill","stroke"]),se(C,_,y)},"bpmn:DataObjectReference":L("bpmn:DataObject"),"bpmn:DataOutput":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=i.getRawPath("DATA_ARROW"),I=se(C,_,y);return x(C,D,{strokeWidth:1,fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke)}),I},"bpmn:DataOutputAssociation":function(C,_,y={}){return y=Ge(y,["fill","stroke"]),he(C,_,{...y,markerEnd:d(C,"association-end",Ie(_,s,y.fill),te(_,c,y.stroke))})},"bpmn:DataStoreReference":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:0,my:.133}});return x(C,D,{fill:Ie(_,s,y.fill),fillOpacity:fo,stroke:te(_,c,y.stroke),strokeWidth:2})},"bpmn:EndEvent":function(C,_,y={}){var{renderIcon:D=!0}=y;y=Ge(y,["fill","stroke"]);var I=ce(C,_,{...y,strokeWidth:4});return D&&j(_,C,y),I},"bpmn:EventBasedGateway":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=Z(_),I=ee(C,_,y);m(C,_.width,_.height,_.height*.2,{fill:Ie(_,"none",y.fill),stroke:te(_,c,y.stroke),strokeWidth:1});var W=D.get("eventGatewayType"),oe=!!D.get("instantiate");function Pe(){var ft=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:_.width,containerHeight:_.height,position:{mx:.36,my:.44}});x(C,ft,{fill:"none",stroke:te(_,c,y.stroke),strokeWidth:2})}if(W==="Parallel"){var Ue=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}});x(C,Ue,{fill:"none",stroke:te(_,c,y.stroke),strokeWidth:1})}else W==="Exclusive"&&(oe||m(C,_.width,_.height,_.height*.26,{fill:"none",stroke:te(_,c,y.stroke),strokeWidth:1}),Pe());return I},"bpmn:ExclusiveGateway":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=ee(C,_,y),I=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:_.width,containerHeight:_.height,position:{mx:.32,my:.3}}),W=Ve(_);return W.get("isMarkerVisible")&&x(C,I,{fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke),strokeWidth:1}),D},"bpmn:Gateway":function(C,_,y={}){return y=Ge(y,["fill","stroke"]),ee(C,_,y)},"bpmn:Group":function(C,_,y={}){return y=Ge(y,["fill","stroke","width","height"]),g(C,_.width,_.height,Ds,{stroke:te(_,c,y.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:Gn(_,y),height:An(_,y)})},"bpmn:InclusiveGateway":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=ee(C,_,y);return m(C,_.width,_.height,_.height*.24,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:2.5}),D},"bpmn:IntermediateEvent":function(C,_,y={}){var{renderIcon:D=!0}=y;y=Ge(y,["fill","stroke"]);var I=ce(C,_,{...y,strokeWidth:1.5});return m(C,_.width,_.height,ks,{fill:"none",stroke:te(_,c,y.stroke),strokeWidth:1.5}),D&&j(_,C,y),I},"bpmn:IntermediateCatchEvent":L("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":L("bpmn:IntermediateEvent"),"bpmn:Lane":function(C,_,y={}){return y=Ge(y,["fill","stroke","width","height"]),F(C,_,{...y,fillOpacity:wS})},"bpmn:ManualTask":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=ke(C,_,y),I=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return x(C,I,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:.5}),D},"bpmn:MessageFlow":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=Z(_),I=Ve(_),W=Ie(_,s,y.fill),oe=te(_,c,y.stroke),Pe=b(C,_.waypoints,{markerEnd:d(C,"messageflow-end",W,oe),markerStart:d(C,"messageflow-start",W,oe),stroke:oe,strokeDasharray:"10, 11",strokeWidth:1.5});if(D.get("messageRef")){var Ue=Pe.getPointAtLength(Pe.getTotalLength()/2),ft=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:Ue.x,y:Ue.y}}),tt={strokeWidth:1};I.get("messageVisibleKind")==="initiating"?(tt.fill=W,tt.stroke=oe):(tt.fill=oe,tt.stroke=W);var It=x(C,ft,tt),un=D.get("messageRef"),ln=un.get("name"),at=fe(C,ln,{align:"center-top",fitBox:!0,style:{fill:oe}}),Nt=It.getBBox(),pn=at.getBBox(),jo=Ue.x-pn.width/2,fn=Ue.y+Nt.height/2+vS;Ps(at,jo,fn,0)}return Pe},"bpmn:ParallelGateway":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=ee(C,_,y),I=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:_.width,containerHeight:_.height,position:{mx:.46,my:.2}});return x(C,I,{fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke),strokeWidth:1}),D},"bpmn:Participant":function(C,_,y={}){y=Ge(y,["fill","stroke","width","height"]);var D=F(C,_,y),I=$e(_),W=Yt(_),oe=Z(_),Pe=oe.get("name");if(I){var Ue=W?[{x:30,y:0},{x:30,y:An(_,y)}]:[{x:0,y:30},{x:Gn(_,y),y:30}];w(C,Ue,{stroke:te(_,c,y.stroke),strokeWidth:_S}),Y(C,Pe,_,y)}else{var ft=ra(_,y);W||(ft.height=Gn(_,y),ft.width=An(_,y));var tt=fe(C,Pe,{box:ft,align:"center-middle",style:{fill:ia(_,u,c,y.stroke)}});if(!W){var It=-1*An(_,y);Ps(tt,0,-It,270)}}return oe.get("participantMultiplicity")&&N("ParticipantMultiplicityMarker",C,_,y),D},"bpmn:ReceiveTask":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=Z(_),I=ke(C,_,y),W;return D.get("instantiate")?(m(C,28,28,20*.22,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1}),W=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):W=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),x(C,W,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1}),I},"bpmn:ScriptTask":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=ke(C,_,y),I=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return x(C,I,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1}),D},"bpmn:SendTask":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=ke(C,_,y),I=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return x(C,I,{fill:te(_,c,y.stroke),stroke:Ie(_,s,y.fill),strokeWidth:1}),D},"bpmn:SequenceFlow":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=Ie(_,s,y.fill),I=te(_,c,y.stroke),W=b(C,_.waypoints,{markerEnd:d(C,"sequenceflow-end",D,I),stroke:I}),oe=Z(_),{source:Pe}=_;if(Pe){var Ue=Z(Pe);oe.get("conditionExpression")&&v(Ue,"bpmn:Activity")&&re(W,{markerStart:d(C,"conditional-flow-marker",D,I)}),Ue.get("default")&&(v(Ue,"bpmn:Gateway")||v(Ue,"bpmn:Activity"))&&Ue.get("default")===oe&&re(W,{markerStart:d(C,"conditional-default-flow-marker",D,I)})}return W},"bpmn:ServiceTask":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=ke(C,_,y);m(C,10,10,{fill:Ie(_,s,y.fill),stroke:"none",transform:"translate(6, 6)"});var I=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});x(C,I,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1}),m(C,10,10,{fill:Ie(_,s,y.fill),stroke:"none",transform:"translate(11, 10)"});var W=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return x(C,W,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1}),D},"bpmn:StartEvent":function(C,_,y={}){var{renderIcon:D=!0}=y;y=Ge(y,["fill","stroke"]);var I=Z(_);I.get("isInterrupting")||(y={...y,strokeDasharray:"6"});var W=ce(C,_,y);return D&&j(_,C,y),W},"bpmn:SubProcess":function(C,_,y={}){return $e(_)?y=Ge(y,["fill","stroke","width","height"]):y=Ge(y,["fill","stroke"]),$(C,_,y)},"bpmn:Task":function(C,_,y={}){return y=Ge(y,["fill","stroke"]),ke(C,_,y)},"bpmn:TextAnnotation":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var{width:D,height:I}=ra(_,y),W=g(C,D,I,0,0,{fill:"none",stroke:"none"}),oe=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:I,position:{mx:0,my:0}});x(C,oe,{stroke:te(_,c,y.stroke)});var Pe=Z(_),Ue=Pe.get("text")||"";return fe(C,Ue,{align:"left-top",box:ra(_,y),padding:po,style:{fill:ia(_,u,c,y.stroke)}}),W},"bpmn:Transaction":function(C,_,y={}){$e(_)?y=Ge(y,["fill","stroke","width","height"]):y=Ge(y,["fill","stroke"]);var D=$(C,_,{strokeWidth:1.5,...y}),I=n.style(["no-fill","no-events"],{stroke:te(_,c,y.stroke),strokeWidth:1.5}),W=$e(_);return W||(y={}),g(C,Gn(_,y),An(_,y),Ds-ks,ks,I),D},"bpmn:UserTask":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var D=ke(C,_,y),I=15,W=12,oe=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:I,y:W}});x(C,oe,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:.5});var Pe=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:I,y:W}});x(C,Pe,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:.5});var Ue=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:I,y:W}});return x(C,Ue,{fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke),strokeWidth:.5}),D},label:function(C,_,y={}){return lt(C,_,y)}};this._drawPath=x,this._renderer=T}ie(Nr,Pi),Nr.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Nr.prototype.canRender=function(e){return v(e,"bpmn:BaseElement")},Nr.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Nr.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Nr.prototype.getShapePath=function(e){return Me(e)?dl(e,bS):v(e,"bpmn:Event")?cm(e):v(e,"bpmn:Activity")?dl(e,Ds):v(e,"bpmn:Gateway")?mS(e):gS(e)};function Ge(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var ES=0,SS={width:150,height:50};function RS(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function CS(e){return Gt(e)?O({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var hl=null;function PS(){return hl||(hl=document.createElement("canvas").getContext("2d")),hl}function AS(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(um(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function um(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function TS(e,t){var n=PS();if(!n)return{width:0,height:0};n.font=AS(t),"letterSpacing"in n&&(n.letterSpacing=um(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 MS(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=TS(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return kS(e,r,i,o);r=OS(r,o.width,t)}}function kS(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 lm="­";function DS(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===lm)&&r.pop();break}var a=r[r.length-1];return a&&a===lm&&(r[r.length-1]="-"),r.join("")}function OS(e,t,n){var i=Math.max(e.length*(n/t),1),r=DS(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function Os(e){this._config=O({},{size:SS,padding:ES,style:{},align:"center-top"},e||{})}Os.prototype.createText=function(e,t){return this.layoutText(e,t).element},Os.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Os.prototype.layoutText=function(e,t){for(var n=O({},this._config.size,t.box),i=O({},this._config.style,t.style),r=RS(t.align||this._config.align),o=CS(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=LS(i),c=e.split(/\u00AD?\r?\n/),u=[],l=n.width-o.left-o.right;c.length;)u.push(MS(c,l,i));r.vertical==="middle"&&(o.top=o.bottom=0);var p=Sn(u,function(g,R,w){return g+(s||R.height)},0)+o.top+o.bottom,f=Sn(u,function(g,R,w){return R.width>g?R.width:g},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-p)/2),d-=(s||u[0].height)/4;var h=me("text");re(h,i),M(u,function(g){var R;switch(d+=s||g.height,r.horizontal){case"left":R=o.left;break;case"right":R=(a?f:l)-o.right-g.width;break;default:R=Math.max(((a?f:l)-g.width)/2+o.left,0)}var w=me("tspan");re(w,{x:R,y:d}),w.textContent=g.text,Re(h,w)});var m={width:f,height:p};return{dimensions:m,element:h}};function LS(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var IS=12,NS=1.2,BS=40;function pm(e){var t=O({fontFamily:"Arial, sans-serif",fontSize:IS,fontWeight:"normal",lineHeight:NS},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=O({},t,{fontSize:n},e&&e.externalStyle||{}),r=new Os({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:po});return{x:a.x,y:a.y,width:a.width,height:Math.max(BS,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,O({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}pm.$inject=["config.textRenderer"];function $S(){this.pathMap={EVENT_MESSAGE:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:36,width:36,heightElements:[6,14],widthElements:[10.5,21]},EVENT_SIGNAL:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x1},0 Z",height:36,width:36,heightElements:[18],widthElements:[10,20]},EVENT_ESCALATION:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x0},-{e.y1} l -{e.x0},{e.y1} Z",height:36,width:36,heightElements:[20,7],widthElements:[8]},EVENT_CONDITIONAL:{d:"M {e.x0},{e.y0} l {e.x1},0 l 0,{e.y2} l -{e.x1},0 Z M {e.x2},{e.y3} l {e.x0},0 M {e.x2},{e.y4} l {e.x0},0 M {e.x2},{e.y5} l {e.x0},0 M {e.x2},{e.y6} l {e.x0},0 M {e.x2},{e.y7} l {e.x0},0 M {e.x2},{e.y8} l {e.x0},0 ",height:36,width:36,heightElements:[8.5,14.5,18,11.5,14.5,17.5,20.5,23.5,26.5],widthElements:[10.5,14.5,12.5]},EVENT_LINK:{d:"m {mx},{my} 0,{e.y0} -{e.x1},0 0,{e.y1} {e.x1},0 0,{e.y0} {e.x0},-{e.y2} -{e.x0},-{e.y2} z",height:36,width:36,heightElements:[4.4375,6.75,7.8125],widthElements:[9.84375,13.5]},EVENT_ERROR:{d:"m {mx},{my} {e.x0},-{e.y0} {e.x1},-{e.y1} {e.x2},{e.y2} {e.x3},-{e.y3} -{e.x4},{e.y4} -{e.x5},-{e.y5} z",height:36,width:36,heightElements:[.023,8.737,8.151,16.564,10.591,8.714],widthElements:[.085,6.672,6.97,4.273,5.337,6.636]},EVENT_CANCEL_45:{d:"m {mx},{my} -{e.x1},0 0,{e.x0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:36,width:36,heightElements:[4.75,8.5],widthElements:[4.75,8.5]},EVENT_COMPENSATION:{d:"m {mx},{my} {e.x0},-{e.y0} 0,{e.y1} z m {e.x1},-{e.y2} {e.x2},-{e.y3} 0,{e.y1} -{e.x2},-{e.y3} z",height:36,width:36,heightElements:[6.5,13,.4,6.1],widthElements:[9,9.3,8.7]},EVENT_TIMER_WH:{d:"M {mx},{my} l {e.x0},-{e.y0} m -{e.x0},{e.y0} l {e.x1},{e.y1} ",height:36,width:36,heightElements:[10,2],widthElements:[3,7]},EVENT_TIMER_LINE:{d:"M {mx},{my} m {e.x0},{e.y0} l -{e.x1},{e.y1} ",height:36,width:36,heightElements:[10,3],widthElements:[0,0]},EVENT_MULTIPLE:{d:"m {mx},{my} {e.x1},-{e.y0} {e.x1},{e.y0} -{e.x0},{e.y1} -{e.x2},0 z",height:36,width:36,heightElements:[6.28099,12.56199],widthElements:[3.1405,9.42149,12.56198]},EVENT_PARALLEL_MULTIPLE:{d:"m {mx},{my} {e.x0},0 0,{e.y1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} -{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z",height:36,width:36,heightElements:[2.56228,7.68683],widthElements:[2.56228,7.68683]},GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},GATEWAY_EVENT_BASED:{d:"m {mx},{my} {e.x0},{e.y0} {e.x0},{e.y1} {e.x1},{e.y2} {e.x2},0 z",height:11,width:11,heightElements:[-6,6,12,-12],widthElements:[9,-3,-12]},GATEWAY_COMPLEX:{d:"m {mx},{my} 0,{e.y0} -{e.x0},-{e.y1} -{e.x1},{e.y2} {e.x0},{e.y1} -{e.x2},0 0,{e.y3} {e.x2},0 -{e.x0},{e.y1} l {e.x1},{e.y2} {e.x0},-{e.y1} 0,{e.y0} {e.x3},0 0,-{e.y0} {e.x0},{e.y1} {e.x1},-{e.y2} -{e.x0},-{e.y1} {e.x2},0 0,-{e.y3} -{e.x2},0 {e.x0},-{e.y1} -{e.x1},-{e.y2} -{e.x0},{e.y1} 0,-{e.y0} -{e.x3},0 z",height:17.125,width:17.125,heightElements:[4.875,3.4375,2.125,3],widthElements:[3.4375,2.125,4.875,3]},DATA_OBJECT_PATH:{d:"m 0,0 {e.x1},0 {e.x0},{e.y0} 0,{e.y1} -{e.x2},0 0,-{e.y2} {e.x1},0 0,{e.y0} {e.x0},0",height:61,width:51,heightElements:[10,50,60],widthElements:[10,40,50,60]},DATA_OBJECT_COLLECTION_PATH:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},DATA_ARROW:{d:"m 5,9 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z",height:61,width:51,heightElements:[],widthElements:[]},DATA_STORE:{d:"m {mx},{my} l 0,{e.y2} c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 l 0,-{e.y2} c -{e.x0},-{e.y1} -{e.x1},-{e.y1} -{e.x2},0c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0",height:61,width:61,heightElements:[7,10,45],widthElements:[2,58,60]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_PARALLEL:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},MARKER_SEQUENTIAL:{d:"m{mx},{my} m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_COMPENSATION:{d:"m {mx},{my} 7,-5 0,10 z m 7.1,-0.3 6.9,-4.7 0,10 -6.9,-4.7 z",height:10,width:21,heightElements:[],widthElements:[]},MARKER_LOOP:{d:"m {mx},{my} c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 -6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902",height:13.9,width:13.7,heightElements:[],widthElements:[]},MARKER_ADHOC:{d:"m {mx},{my} m 0.84461,2.64411 c 1.05533,-1.23780996 2.64337,-2.07882 4.29653,-1.97997996 2.05163,0.0805 3.85579,1.15803 5.76082,1.79107 1.06385,0.34139996 2.24454,0.1438 3.18759,-0.43767 0.61743,-0.33642 1.2775,-0.64078 1.7542,-1.17511 0,0.56023 0,1.12046 0,1.6807 -0.98706,0.96237996 -2.29792,1.62393996 -3.6918,1.66181996 -1.24459,0.0927 -2.46671,-0.2491 -3.59505,-0.74812 -1.35789,-0.55965 -2.75133,-1.33436996 -4.27027,-1.18121996 -1.37741,0.14601 -2.41842,1.13685996 -3.44288,1.96782996 z",height:4,width:15,heightElements:[],widthElements:[]},TASK_TYPE_SEND:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:14,width:21,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"},TASK_TYPE_MANUAL:{d:"m {mx},{my} c 0.234,-0.01 5.604,0.008 8.029,0.004 0.808,0 1.271,-0.172 1.417,-0.752 0.227,-0.898 -0.334,-1.314 -1.338,-1.316 -2.467,-0.01 -7.886,-0.004 -8.108,-0.004 -0.014,-0.079 0.016,-0.533 0,-0.61 0.195,-0.042 8.507,0.006 9.616,0.002 0.877,-0.007 1.35,-0.438 1.353,-1.208 0.003,-0.768 -0.479,-1.09 -1.35,-1.091 -2.968,-0.002 -9.619,-0.013 -9.619,-0.013 v -0.591 c 0,0 5.052,-0.016 7.225,-0.016 0.888,-0.002 1.354,-0.416 1.351,-1.193 -0.006,-0.761 -0.492,-1.196 -1.361,-1.196 -3.473,-0.005 -10.86,-0.003 -11.0829995,-0.003 -0.022,-0.047 -0.045,-0.094 -0.069,-0.139 0.3939995,-0.319 2.0409995,-1.626 2.4149995,-2.017 0.469,-0.4870005 0.519,-1.1650005 0.162,-1.6040005 -0.414,-0.511 -0.973,-0.5 -1.48,-0.236 -1.4609995,0.764 -6.5999995,3.6430005 -7.7329995,4.2710005 -0.9,0.499 -1.516,1.253 -1.882,2.19 -0.37000002,0.95 -0.17,2.01 -0.166,2.979 0.004,0.718 -0.27300002,1.345 -0.055,2.063 0.629,2.087 2.425,3.312 4.859,3.318 4.6179995,0.014 9.2379995,-0.139 13.8569995,-0.158 0.755,-0.004 1.171,-0.301 1.182,-1.033 0.012,-0.754 -0.423,-0.969 -1.183,-0.973 -1.778,-0.01 -5.824,-0.004 -6.04,-0.004 10e-4,-0.084 0.003,-0.586 10e-4,-0.67 z"},TASK_TYPE_INSTANTIATING_SEND:{d:"m {mx},{my} l 0,8.4 l 12.6,0 l 0,-8.4 z l 6.3,3.6 l 6.3,-3.6"},TASK_TYPE_SERVICE:{d:"m {mx},{my} v -1.71335 c 0.352326,-0.0705 0.703932,-0.17838 1.047628,-0.32133 0.344416,-0.14465 0.665822,-0.32133 0.966377,-0.52145 l 1.19431,1.18005 1.567487,-1.57688 -1.195028,-1.18014 c 0.403376,-0.61394 0.683079,-1.29908 0.825447,-2.01824 l 1.622133,-0.01 v -2.2196 l -1.636514,0.01 c -0.07333,-0.35153 -0.178319,-0.70024 -0.323564,-1.04372 -0.145244,-0.34406 -0.321407,-0.6644 -0.522735,-0.96217 l 1.131035,-1.13631 -1.583305,-1.56293 -1.129598,1.13589 c -0.614052,-0.40108 -1.302883,-0.68093 -2.022633,-0.82247 l 0.0093,-1.61852 h -2.241173 l 0.0042,1.63124 c -0.353763,0.0736 -0.705369,0.17977 -1.049785,0.32371 -0.344415,0.14437 -0.665102,0.32092 -0.9635006,0.52046 l -1.1698628,-1.15823 -1.5667691,1.5792 1.1684265,1.15669 c -0.4026573,0.61283 -0.68308,1.29797 -0.8247287,2.01713 l -1.6588041,0.003 v 2.22174 l 1.6724648,-0.006 c 0.073327,0.35077 0.1797598,0.70243 0.3242851,1.04472 0.1452428,0.34448 0.3214064,0.6644 0.5227339,0.96066 l -1.1993431,1.19723 1.5840256,1.56011 1.1964668,-1.19348 c 0.6140517,0.40346 1.3028827,0.68232 2.0233517,0.82331 l 7.19e-4,1.69892 h 2.226848 z m 0.221462,-3.9957 c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_SERVICE_FILL:{d:"m {mx},{my} c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_BUSINESS_RULE_HEADER:{d:"m {mx},{my} 0,4 20,0 0,-4 z"},TASK_TYPE_BUSINESS_RULE_MAIN:{d:"m {mx},{my} 0,12 20,0 0,-12 zm 0,8 l 20,0 m -13,-4 l 0,8"},MESSAGE_FLOW_MARKER:{d:"m {mx},{my} m -10.5 ,-7 l 0,14 l 21,0 l 0,-14 z l 10.5,6 l 10.5,-6"}},this.getRawPath=function(t){return this.pathMap[t].d},this.getScaledPath=function(t,n){var i=this.pathMap[t],r,o;n.abspos?(r=n.abspos.x,o=n.abspos.y):(r=n.containerWidth*n.position.mx,o=n.containerHeight*n.position.my);var a={};if(n.position){for(var s=n.containerHeight/i.height*n.yScaleFactor,c=n.containerWidth/i.width*n.xScaleFactor,u=0;u<i.heightElements.length;u++)a["y"+u]=i.heightElements[u]*s;for(var l=0;l<i.widthElements.length;l++)a["x"+l]=i.widthElements[l]*c}var p=zS(i.d,{mx:r,my:o,e:a});return p}}var jS=/\{([^{}]+)\}/g,FS=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function HS(e,t,n){var i=n;return t.replace(FS,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 zS(e,t){return String(e).replace(jS,function(n,i){return HS(n,i,t)})}const VS={__init__:["bpmnRenderer"],bpmnRenderer:["type",Nr],textRenderer:["type",pm],pathMap:["type",$S]};function GS(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const oa={translate:["value",GS]};function Ls(e,t,n){return O({id:e.id,type:e.$type,businessObject:e,di:t},n)}function WS(e,t,n){var i=e.waypoint;return!i||i.length<2?[be(t),be(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function fm(e,t,n){return new Error(`element ${sn(t)} referenced by ${sn(e)}#${n} not yet drawn`)}function ki(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}ki.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],ki.prototype.add=function(e,t,n){var i,r,o;if(v(t,"bpmndi:BPMNPlane")){var a=v(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(Ls(e,t,a)),this._canvas.addRootElement(i)}else if(v(t,"bpmndi:BPMNShape")){var s=!$e(e,t),c=YS(e);r=n&&(n.hidden||n.collapsed);var u=t.bounds;i=this._elementFactory.createShape(Ls(e,t,{collapsed:s,hidden:r,x:Math.round(u.x),y:Math.round(u.y),width:Math.round(u.width),height:Math.round(u.height),isFrame:c})),v(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),v(e,"bpmn:Lane")&&(o=0),v(e,"bpmn:DataStoreReference")&&(US(n,be(u))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else if(v(t,"bpmndi:BPMNEdge")){var l=this._getSource(e),p=this._getTarget(e);r=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(Ls(e,t,{hidden:r,source:l,target:p,waypoints:WS(t,l,p)})),v(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${sn(t)} for element ${sn(e)}`);return nr(e)&&jn(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},ki.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${sn(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)},ki.prototype.addLabel=function(e,t,n){var i,r,o;return i=cS(t,n),r=jn(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(Ls(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!jn(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)},ki.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(`${sn(e)}#${t} Ref not specified`)},ki.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},ki.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},ki.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function US(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 YS(e){return v(e,"bpmn:Group")}const dm={__depends__:[VS,{__depends__:[oa],bpmnImporter:["type",ki]}]};function aa(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function ii(e,t){return{x:e.x-t.x,y:e.y-t.y}}function ml(e){return Math.log(e)/Math.log(10)}var qS=1e3;function X(e){this._eventBus=e}X.$inject=["eventBus"];function KS(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}X.prototype.on=function(e,t,n,i,r,o){if((Wt(t)||we(t))&&(o=r,r=i,i=n,n=t,t=null),Wt(n)&&(o=r,r=i,i=n,n=qS),Gt(r)&&(o=r,r=!1),!Wt(i))throw new Error("handlerFn must be a function");_e(e)||(e=[e]);var a=this._eventBus;M(e,function(s){var c=["commandStack",s,t].filter(function(u){return u}).join(".");a.on(c,n,r?KS(i,o):i,o)})},X.prototype.canExecute=Di("canExecute"),X.prototype.preExecute=Di("preExecute"),X.prototype.preExecuted=Di("preExecuted"),X.prototype.execute=Di("execute"),X.prototype.executed=Di("executed"),X.prototype.postExecute=Di("postExecute"),X.prototype.postExecuted=Di("postExecuted"),X.prototype.revert=Di("revert"),X.prototype.reverted=Di("reverted");function Di(e){return function(n,i,r,o,a){(Wt(n)||we(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var gl=["top","bottom","left","right"],Is=10;function yl(e,t){X.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(Ms(r)&&!it(r)){var o=QS(r);o&&i(r,o)}}function i(r,o){var a=be(r),s=r.label,c=be(s);if(s.parent){var u=ye(r),l;switch(o){case"top":l={x:a.x,y:u.top-Is-s.height/2};break;case"left":l={x:u.left-Is-s.width/2,y:a.y};break;case"bottom":l={x:a.x,y:u.bottom+Is+s.height/2};break;case"right":l={x:u.right+Is+s.width/2,y:a.y};break}var p=ii(l,c);t.moveShape(s,p)}}}ie(yl,X),yl.$inject=["eventBus","modeling"];function XS(e){var t=e.host,n=be(e),i=Zt(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=gl.filter(function(a){return r.indexOf(a)===-1});return o}function ZS(e){var t=be(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 QS(e){var t=be(e.label),n=be(e),i=hm(n,t);if(JS(i)){var r=ZS(e);if(e.host){var o=XS(e);r=r.concat(o)}var a=gl.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?Zt(e.label,e)!=="intersect"?void 0:i:a[0]}}function hm(e,t){return Zt(t,e,5)}function JS(e){return gl.indexOf(e)!==-1}function vl(e){X.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(v(i,"bpmn:TextAnnotation")?t.position={x:n.x+n.width/2+75,y:n.y-50-i.height/2}:t.position={x:n.x+n.width+80+i.width/2,y:n.y+n.height/2})},!0)}ie(vl,X),vl.$inject=["eventBus"];var eR=1500;function _l(e,t,n){e.invoke(X,this),this.preExecute("elements.delete",eR,function(r){var o=r.context,a=o.elements,s=i(a);s.length&&(o.elements=a.concat(s))}),t.on("shape.move.start",function(r){var o=r.context.shapes,a=i(o);a.length&&(r.context.shapes=o.concat(a))});function i(r){var o=Oe(r,u=>v(u,"bpmn:Participant")||v(u,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(u=>v(u,"bpmn:Artifact"))),c=new Set;return M(o,u=>{const l=new Set(Zr(ao(Array.from(s),At(u))));c=c.union(l),s=s.difference(l)}),Array.from(c)}}ie(_l,X),_l.$inject=["injector","eventBus","canvas"];function bl(e,t){e.invoke(X,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=Oe(r.incoming.concat(r.outgoing),function(a){return v(a,"bpmn:Association")});M(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}ie(bl,X),bl.$inject=["injector","modeling"];function ho(e,t){for(wn(t)&&(t=[t]);e=e.parent;)if(De(e,t))return e;return null}function mm(e,t){var n=ho(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=ho(e,i),n)return Yt(n);if(De(e,i))return Yt(e);var r;for(r=Z(e);r&&!v(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find(function(a){var s=Z(a);return s&&s.get("processRef")===r});return o?Yt(o):!0}var gm=500;function Ns(e,t){t.invoke(X,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 ym(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];ym(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}Ns.$inject=["bpmnReplace","injector"],ie(Ns,X),Ns.prototype._replaceShape=function(e,t){var n=tR(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function tR(e){var t=Z(e),n=t.eventDefinitions;return n&&n[0]}function ym(e,t){return!Me(e)&&De(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function xl(e,t){X.call(this,e);function n(i){return Oe(i.attachers,function(r){return v(r,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var r=i.context.source,o=i.context.target,a=n(o);v(r,"bpmn:EventBasedGateway")&&v(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var r=i.context.oldSource,o=i.context.newSource;v(r,"bpmn:Gateway")&&v(o,"bpmn:EventBasedGateway")&&M(o.outgoing,function(a){var s=a.target,c=n(s);v(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}xl.$inject=["eventBus","modeling"],ie(xl,X);function vm(e){return e.create("bpmn:Category")}function nR(e){return e.create("bpmn:CategoryValue")}function _m(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=nR(e)),n.$parent||(n.$parent=vm(e)),n}function iR(e,t,n){return St(t.get("categoryValue"),e),e.$parent=t,St(n.get("rootElements"),t),t.$parent=n,e}function rR(e){var t=e.$parent;return t&&(wt(t.get("categoryValue"),e),e.$parent=null),e}function oR(e){var t=e.$parent;return t&&(wt(t.get("rootElements"),e),e.$parent=null),e}var aR=500;function wl(e,t,n){n.invoke(X,this);function i(c){return t.filter(function(u){return v(u,"bpmn:Group")&&!u.labelTarget}).map(Z).filter(function(u){return u!==c})}function r(c,u){return i(u).some(function(l){return l.get("categoryValueRef")===c})}function o(c,u){return i(u).some(function(l){var p=l.get("categoryValueRef");return p&&p.$parent===c})}function a(c,u){c&&u&&iR(c,u,e.getDefinitions())}function s(c,u,l){u&&!o(u,l)&&oR(u),c&&!r(c,l)&&rR(c)}this.executed(["shape.create","label.create"],function(c){var u=c.labelTarget||c.shape;!v(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0),this.reverted(["shape.create","label.create"],function(c){var u=c.labelTarget||c.shape;!v(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,Z(u))},!0),this.executed(["shape.move","shape.resize"],aR,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,Z(u))},!0),this.executed("group.updateRefs",function(c){bm(c).forEach(function(u){a(u.categoryValue,u.category)})},!0),this.reverted("group.updateRefs",function(c){bm(c).forEach(function(u){s(u.categoryValue,u.category,Z(u.groupShape))})},!0),this.executed("shape.delete",function(c){var u=c.shape;!v(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,Z(u))},!0),this.reverted("shape.delete",function(c){var u=c.shape;!v(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0)}wl.$inject=["bpmnjs","elementRegistry","injector"],ie(wl,X);function bm(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function El(e,t,n){X.call(this,e),this.preExecute("shape.replace",s,!0),this.postExecuted("shape.replace",c,!0),this.preExecute("connection.create",r,!0),this.postExecuted("connection.delete",i,!0),this.postExecuted("connection.reconnect",o,!0),this.postExecuted("element.updateProperties",a,!0);function i(g){const R=g.source,w=g.target;mo(R)&&sa(w)&&l(w)}function r(g){const R=g.connection,w=g.source,b=g.target;mo(w)&&Bs(b)&&(u(b),f(w,[R]))}function o(g){const R=g.newTarget,w=g.oldSource,b=g.oldTarget;if(b!==R){const x=w;sa(b)&&l(b),mo(x)&&Bs(R)&&u(R)}}function a(g){const{element:R}=g;sa(R)?(p(R),d(R)):Bs(R)&&h(R)}function s(g){const{newData:R,oldShape:w}=g;if(mo(g.oldShape)&&R.eventDefinitionType!=="bpmn:CompensateEventDefinition"||R.type!=="bpmn:BoundaryEvent"){const b=w.outgoing.find(({target:x})=>sa(x));b&&b.target&&(g._connectionTarget=b.target)}else if(!mo(g.oldShape)&&R.eventDefinitionType==="bpmn:CompensateEventDefinition"&&R.type==="bpmn:BoundaryEvent"){const b=w.outgoing.find(({target:x})=>Bs(x));b&&b.target&&(g._connectionTarget=b.target),m(w)}}function c(g){const{_connectionTarget:R,newShape:w}=g;R&&t.connect(w,R)}function u(g){t.updateProperties(g,{isForCompensation:!0})}function l(g){t.updateProperties(g,{isForCompensation:void 0})}function p(g){for(const R of g.incoming)n.canConnect(R.source,g)||t.removeConnection(R);for(const R of g.outgoing)n.canConnect(g,R.target)||t.removeConnection(R)}function f(g,R){g.outgoing.filter(x=>v(x,"bpmn:Association")).filter(x=>sa(x.target)&&!R.includes(x)).forEach(x=>t.removeConnection(x))}function d(g){const R=g.attachers.slice();R.length&&t.removeElements(R)}function h(g){const R=g.incoming.filter(w=>mo(w.source));t.removeElements(R)}function m(g){const R=g.outgoing.filter(w=>v(w,"bpmn:SequenceFlow"));t.removeElements(R)}}ie(El,X),El.$inject=["eventBus","modeling","bpmnRules"];function sa(e){const t=Z(e);return t&&t.get("isForCompensation")}function mo(e){return e&&v(e,"bpmn:BoundaryEvent")&&lo(e,"bpmn:CompensateEventDefinition")}function Bs(e){return e&&v(e,"bpmn:Activity")&&!cn(e)}function Sl(e){e.invoke(X,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,r=n.shape;v(i,"bpmn:Lane")&&!v(r,"bpmn:Lane")&&(n.parent=ho(i,"bpmn:Participant"))})}Sl.$inject=["injector"],ie(Sl,X);function Rl(e,t){X.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,r=i.shape;if(v(r,"bpmn:DataObjectReference")&&r.type!=="label"){var o=t.create("bpmn:DataObject");o.isCollection=((a=r.businessObject.dataObjectRef)==null?void 0:a.isCollection)||!1,r.businessObject.dataObjectRef=o}})}Rl.$inject=["eventBus","bpmnFactory"],ie(Rl,X);var Cl=20,Pl=20,xm=30,$s=2e3;function Al(e,t,n){X.call(this,t),t.on(["create.start","shape.move.start"],$s,function(r){var o=r.context,a=o.shape,s=e.getRootElement();if(!(!v(a,"bpmn:Participant")||!v(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(p){return!v(p,"bpmn:Group")&&!Me(p)&&!it(p)});if(c.length){var u=At(c),l=sR(a,u);O(a,l),o.createConstraints=cR(a,u)}}}),t.on("create.start",$s,function(r){var o=r.context,a=o.shape,s=e.getRootElement(),c=e.getGraphics(s);function u(l){l.element=s,l.gfx=c}v(a,"bpmn:Participant")&&v(s,"bpmn:Process")&&(t.on("element.hover",$s,u),t.once("create.cleanup",function(){t.off("element.hover",u)}))});function i(){var r=e.getRootElement();return v(r,"bpmn:Collaboration")?r:n.makeCollaboration()}this.preExecute("elements.create",$s,function(r){var o=r.elements,a=r.parent,s=uR(o),c;s&&v(a,"bpmn:Process")&&(r.parent=i(),c=r.hints=r.hints||{},c.participant=s,c.process=a,c.processRef=Z(s).get("processRef"))},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;v(a,"bpmn:Participant")&&v(o,"bpmn:Process")&&(r.parent=i(),r.process=o,r.processRef=Z(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)&&Z(s).set("processRef",Z(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)&&Z(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)}Al.$inject=["canvas","eventBus","modeling"],ie(Al,X);function sR(e,t){t={width:t.width+Cl*2+xm,height:t.height+Pl*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 cR(e,t){return t=ye(t),{bottom:t.top+e.height/2-Pl,left:t.right-e.width/2+Cl,top:t.bottom-e.height/2+Pl,right:t.left+e.width/2-Cl-xm}}function uR(e){return st(e,function(t){return v(t,"bpmn:Participant")})}var wm="__targetRef_placeholder";function Tl(e,t){X.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],Em(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],Em(o));function n(a,s,c){var u=a.get("dataInputAssociations");return st(u,function(l){return l!==c&&l.targetRef===s})}function i(a,s){var c=a.get("properties"),u=st(c,function(l){return l.name===wm});return!u&&s&&(u=t.create("bpmn:Property",{name:wm}),St(c,u)),u}function r(a,s){var c=i(a);c&&(n(a,c,s)||wt(a.get("properties"),c))}function o(a){var s=a.context,c=s.connection,u=c.businessObject,l=c.target,p=l&&l.businessObject,f=s.newTarget,d=f&&f.businessObject,h=s.oldTarget||s.target,m=h&&h.businessObject,g=c.businessObject,R;m&&m!==p&&r(m,u),d&&d!==p&&r(d,u),p?(R=i(p,!0),g.targetRef=R):g.targetRef=null}}Tl.$inject=["eventBus","bpmnFactory"],ie(Tl,X);function Em(e){return function(t){var n=t.context,i=n.connection;if(v(i,"bpmn:DataInputAssociation"))return e(t)}}function js(e){this._bpmnUpdater=e}js.$inject=["bpmnUpdater"],js.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),[]},js.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 Ml(e,t,n,i){X.call(this,i),t.registerHandler("dataStore.updateContainment",js);function r(){return n.filter(function(s){return v(s,"bpmn:Participant")&&Z(s).processRef})[0]}function o(s){return s.children.filter(function(c){return v(c,"bpmn:DataStoreReference")&&!c.labelTarget})}function a(s,c){var u=s.businessObject||s;if(c=c||r(),c){var l=c.businessObject||c;t.execute("dataStore.updateContainment",{dataStoreBo:u,dataStoreDi:Ve(s),newSemanticParent:l.processRef||l,newDiParent:Ve(c)})}}this.preExecute("shape.create",function(s){var c=s.context,u=c.shape;v(u,"bpmn:DataStoreReference")&&u.type!=="label"&&(c.hints||(c.hints={}),c.hints.autoResize=!1)}),this.preExecute("elements.move",function(s){var c=s.context,u=c.shapes,l=u.filter(function(p){return v(p,"bpmn:DataStoreReference")});l.length&&(c.hints||(c.hints={}),c.hints.autoResize=u.filter(function(p){return!v(p,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,u=c.shape,l=u.parent;v(u,"bpmn:DataStoreReference")&&u.type!=="label"&&v(l,"bpmn:Collaboration")&&a(u)}),this.postExecute("shape.move",function(s){var c=s.context,u=c.shape,l=c.oldParent,p=u.parent;if(!v(l,"bpmn:Collaboration")&&v(u,"bpmn:DataStoreReference")&&u.type!=="label"&&v(p,"bpmn:Collaboration")){var f=v(l,"bpmn:Participant")?l:pR(l,"bpmn:Participant");a(u,f)}}),this.postExecute("shape.delete",function(s){var c=s.context,u=c.shape,l=e.getRootElement();De(u,["bpmn:Participant","bpmn:SubProcess"])&&v(l,"bpmn:Collaboration")&&o(l).filter(function(p){return lR(p,u)}).forEach(function(p){a(p)})}),this.postExecute("canvas.updateRoot",function(s){var c=s.context,u=c.oldRoot,l=c.newRoot,p=o(u);p.forEach(function(f){v(l,"bpmn:Process")&&a(f,l)})})}Ml.$inject=["canvas","commandStack","elementRegistry","eventBus"],ie(Ml,X);function lR(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 pR(e,t){for(;e.parent;){if(v(e.parent,t))return e.parent;e=e.parent}}var Fs=Math.max,Hs=Math.min,fR=20;function Sm(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function dR(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 hR(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 zs(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return we(r)&&(i=(/top|left/.test(e)?Hs:Fs)(i,r)),we(o)&&(i=(/top|left/.test(e)?Fs:Hs)(i,o)),i}function mR(e,t){if(!t)return e;var n=ye(e);return Ss({top:zs("top",n,t),right:zs("right",n,t),bottom:zs("bottom",n,t),left:zs("left",n,t)})}function gR(e,t,n,i){var r=ye(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?ye(i):o,s={top:Hs(o.top,a.top),left:Hs(o.left,a.left),bottom:Fs(o.bottom,a.bottom),right:Fs(o.right,a.right)};return Ss(s)}function ca(e,t){return typeof e<"u"?e:fR}function yR(e,t){var n,i,r,o;return typeof t=="object"?(n=ca(t.left),i=ca(t.right),r=ca(t.top),o=ca(t.bottom)):n=i=r=o=ca(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function vR(e){return!(e.waypoints||e.type==="label")}function Rm(e,t){var n;if(e.length===void 0?n=Oe(e.children,vR):n=e,n.length)return yR(At(n),t)}var ir=Math.abs;function _R(e,t){return Sm(ye(t),ye(e))}var bR=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Wn=30;function Vs(e,t){return t=t||[],e.children.filter(function(n){v(n,"bpmn:Lane")&&(Vs(n,t),t.push(n))}),t}function rr(e){return e.children.filter(function(t){return v(t,"bpmn:Lane")})}function Un(e){return ho(e,bR)||e}function xR(e,t){var n=Un(e),i=v(n,"bpmn:Process")?[]:[n],r=Vs(n,i),o=ye(e),a=ye(t),s=_R(e,t),c=[],u=Yt(e);return r.forEach(function(l){if(l!==e){var p=u?0:s.top,f=u?s.right:0,d=u?0:s.bottom,h=u?s.left:0,m=ye(l);s.top&&(ir(m.bottom-o.top)<10&&(d=a.top-m.bottom),ir(m.top-o.top)<5&&(p=a.top-m.top)),s.left&&(ir(m.right-o.left)<10&&(f=a.left-m.right),ir(m.left-o.left)<5&&(h=a.left-m.left)),s.bottom&&(ir(m.top-o.bottom)<10&&(p=a.bottom-m.top),ir(m.bottom-o.bottom)<5&&(d=a.bottom-m.bottom)),s.right&&(ir(m.left-o.right)<10&&(h=a.right-m.left),ir(m.right-o.right)<5&&(f=a.right-m.right)),(p||f||d||h)&&c.push({shape:l,newBounds:hR(l,{top:p,right:f,bottom:d,left:h})})}}),c}var wR=500;function kl(e,t){X.call(this,e);function n(i,r){var o=Yt(i),a=rr(r),s=[],c=[],u=[],l=[];if(Or(a,function(g){return o?g.y>i.y?c.push(g):s.push(g):g.x>i.x?l.push(g):u.push(g),g.children}),!!a.length){var p;o?c.length&&s.length?p=i.height/2:p=i.height:l.length&&u.length?p=i.width/2:p=i.width;var f,d,h,m;s.length&&(f=t.calculateAdjustments(s,"y",p,i.y-10),t.makeSpace(f.movingShapes,f.resizingShapes,{x:0,y:p},"s")),c.length&&(d=t.calculateAdjustments(c,"y",-p,i.y+i.height+10),t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:-p},"n")),u.length&&(h=t.calculateAdjustments(u,"x",p,i.x-10),t.makeSpace(h.movingShapes,h.resizingShapes,{x:p,y:0},"e")),l.length&&(m=t.calculateAdjustments(l,"x",-p,i.x+i.width+10),t.makeSpace(m.movingShapes,m.resizingShapes,{x:-p,y:0},"w"))}}this.postExecuted("shape.delete",wR,function(i){var r=i.context,o=r.hints,a=r.shape,s=r.oldParent;v(a,"bpmn:Lane")&&(o&&o.nested||n(a,s))})}kl.$inject=["eventBus","spaceTool"],ie(kl,X);var Cm=500;function Gs(e,t){t.invoke(X,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Cm,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return Pm(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",Cm,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;Pm(a,SR(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}Gs.$inject=["bpmnReplace","injector"],ie(Gs,X),Gs.prototype._replaceShape=function(e){var t=ER(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function ER(e){var t=Z(e),n=t.eventDefinitions;return n&&n[0]}function Pm(e,t){return!Me(e)&&v(e,"bpmn:BoundaryEvent")&&!t}function SR(e,t){return e.indexOf(t)!==-1}var Ws=Math.round,RR=Math.max;function CR(e,t){var n=e.x,i=e.y;return[["M",n,i],["m",0,-t],["a",t,t,0,1,1,0,2*t],["a",t,t,0,1,1,0,-2*t],["z"]]}function PR(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var Am=10;function AR(e,t){var n,i;for(n=0;i=e[n];n++)if(Qo(i,t)<=Am)return{point:e[n],bendpoint:!0,index:n};return null}function TR(e,t){var n=Oh(CR(t,Am),PR(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=RR(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:Ws(i.x+r.x)/2,y:Ws(i.y+r.y)/2},index:i.segment2}:{point:{x:Ws(i.x),y:Ws(i.y)},index:i.segment2}:null}function Dl(e,t){return AR(e,t)||TR(e,t)}function Ol(e,t,n){X.call(this,e);function i(r,o,a){var s=o.waypoints,c,u,l,p,f,d,h,m=r.outgoing.slice(),g=r.incoming.slice(),R;we(a.width)?R=be(a):R=a;var w=Dl(s,R);if(w){if(c=s.slice(0,w.index),u=s.slice(w.index+(w.bendpoint?1:0)),!c.length||!u.length)return;l=w.bendpoint?s[w.index]:R,(c.length===1||!Tm(r,c[c.length-1]))&&c.push(Mm(l)),(u.length===1||!Tm(r,u[0]))&&u.unshift(Mm(l))}p=o.source,f=o.target,t.canConnect(p,r,o)&&(n.reconnectEnd(o,r,c||R),d=o),t.canConnect(r,f,o)&&(d?h=n.connect(r,f,{type:o.type,waypoints:u}):(n.reconnectStart(o,r,u||R),h=o));var b=[].concat(d&&Oe(g,function(x){return x.source===d.source})||[],h&&Oe(m,function(x){return x.target===h.target})||[]);b.length&&n.removeElements(b)}this.preExecute("elements.move",function(r){var o=r.newParent,a=r.shapes,s=r.delta,c=a[0];if(!(!c||!o)){o&&o.waypoints&&(r.newParent=o=o.parent);var u=be(c),l={x:u.x+s.x,y:u.y+s.y},p=st(o.children,function(f){var d=t.canInsert(a,f);return d&&Dl(f.waypoints,l)});p&&(r.targetFlow=p,r.position=l)}},!0),this.postExecuted("elements.move",function(r){var o=r.shapes,a=r.targetFlow,s=r.position;a&&i(o[0],a,s)},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;t.canInsert(a,o)&&(r.targetFlow=o,r.parent=o.parent)},!0),this.postExecuted("shape.create",function(r){var o=r.shape,a=r.targetFlow,s=r.position;a&&i(o,a,s)},!0)}ie(Ol,X),Ol.$inject=["eventBus","bpmnRules","modeling"];function Tm(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 Mm(e){return O({},e)}function Ll(e,t){X.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)&&go(r)){var c=[];v(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(u=>u!==r&&go(u)):c=a.incoming.filter(u=>u!==r&&go(u)&&v(u.source,"bpmn:EventBasedGateway")),c.forEach(function(u){t.removeConnection(u)})}}),this.preExecuted("shape.replace",function(n){var i=n.context,r=i.newShape;if(v(r,"bpmn:EventBasedGateway")){var o=r.outgoing.filter(go).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(go).forEach(function(s){const c=a.incoming.filter(go).filter(function(u){return u.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}Ll.$inject=["eventBus","modeling"],ie(Ll,X);function go(e){return v(e,"bpmn:SequenceFlow")}var Us=1500,km=2e3;function Dm(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"],Us,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;v(a,"bpmn:Lane")&&!De(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Un(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||De(o,["bpmn:Group","bpmn:TextAnnotation"]))&&(i.hover=s,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.hover","connect.out","connect.end","connect.cleanup","global-connect.hover","global-connect.out","global-connect.end","global-connect.cleanup"],Us,function(i){var r=i.hover;v(r,"bpmn:Lane")&&(i.hover=Un(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Us,function(i){var r=i.context,o=i.hover,a=r.type;v(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Un(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Us,function(i){var r=i.context,o=r.start;v(o,"bpmn:Lane")&&(r.start=Un(o)||o)}),t.on("shape.move.start",km,function(i){var r=i.shape;v(r,"bpmn:Lane")&&(i.shape=Un(r)||r)}),t.on("spaceTool.move",km,function(i){var r=i.hover;r&&v(r,"bpmn:Lane")&&(i.hover=Un(r))})}Dm.$inject=["elementRegistry","eventBus","canvas"];var Om=770;function Il(e,t,n,i){n.invoke(X,this);function r(s,c){var u=Z(s),l=c.categoryValue||u.categoryValueRef;l||(l=_m(e,u));var p=c.category||l.$parent||vm(e);u.categoryValueRef=l,l.$parent=p,c.categoryValue=l,c.category=p}function o(s,c){var u=Z(s),l=c.categoryValue||u.categoryValueRef,p=c.category||l&&l.$parent;l&&(c.categoryValue=l,c.category=p,u.categoryValueRef=null)}this.execute("label.create",function(s){var c=s.context,u=c.labelTarget;v(u,"bpmn:Group")&&r(u,c)}),this.revert("label.create",function(s){var c=s.context,u=c.labelTarget;v(u,"bpmn:Group")&&o(u,c)}),this.execute("shape.delete",function(s){var c=s.context,u=c.shape,l=Z(u);if(!(!v(u,"bpmn:Group")||u.labelTarget)){var p=c.categoryValue=l.categoryValueRef;p&&(c.category=p.$parent,l.categoryValueRef=null)}}),this.reverted("shape.delete",function(s){var c=s.context,u=c.shape;if(!(!v(u,"bpmn:Group")||u.labelTarget)){var l=c.category,p=c.categoryValue,f=Z(u);p&&(f.categoryValueRef=p,p.$parent=l)}}),this.execute("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!v(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!Z(u).categoryValueRef&&!c.categoryValue||r(u,c)}),this.reverted("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!v(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!Z(u).categoryValueRef&&!c.categoryValue||o(u,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!v(u,"bpmn:Group")||u.labelTarget||Z(u).categoryValueRef||r(u,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!v(u,"bpmn:Group")||u.labelTarget||!c.categoryValue||o(u,c)});function a(s,c){var u=e.create(s.$type);return i.copyElement(s,u,null,c)}t.on("copyPaste.copyElement",Om,function(s){var c=s.descriptor,u=s.element;if(!(!v(u,"bpmn:Group")||u.labelTarget)){var l=Z(u);if(l.categoryValueRef){var p=l.categoryValueRef;c.categoryValue=a(p,!0),p.$parent&&(c.category=a(p.$parent,!0))}}}),t.on("copyPaste.pasteElement",Om,function(s){var c=s.descriptor,u=c.businessObject,l=c.categoryValue,p=c.category;l&&(l=u.categoryValueRef=a(l)),p&&(l.$parent=a(p)),delete c.category,delete c.categoryValue})}Il.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],ie(Il,X);function Nl(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 Lm(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=Nl(i,r,o,a),u=Nl(i,r,o,s),l;c&&u?Im(c,o)>Im(u,o)?l=u:l=c:l=c||u,i.original=l}function n(i){var r=i.waypoints;t(r[0],r[1],be(i.source)),t(r[r.length-1],r[r.length-2],be(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}Lm.$inject=["eventBus"];function Im(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Bl(e){X.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=Z(i),o=Ve(i);if(De(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}Bl.$inject=["eventBus"],ie(Bl,X);function Nm(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Bm(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function MR(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 kR(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 $l(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=kR([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 $m(e,t){var n=$l(e,t),i={x:n.x-e.x,y:n.y-e.y};return Nm(i)}function ua(e,t){return Nm({x:e.x-t.x,y:e.y-t.y})}var jm=Math.sqrt,Fm=Math.min,DR=Math.max,Hm=Math.abs;function zm(e){return Math.pow(e,2)}function la(e,t){return jm(zm(e.x-t.x)+zm(e.y-t.y))}function OR(e,t){var n=0,i,r,o,a,s,c,u,l,p,f,d;for(n=0;n<t.length-1;n++){if(i=t[n],r=t[n+1],Gm(i,r)?u=[i]:(o=la(e,i),a=la(e,r),c=Fm(o,a),u=LR(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:Gm(i,u[0])?n:n+1}),u.length===2&&(s=NR(u[0],u[1]),l={type:"segment",position:s,segmentIndex:n,relativeLocation:la(i,s)/la(i,r)}),p=la(l.position,e),(!d||f>p)&&(d=l,f=p)}return d}function LR(e,t,n,i){var r=t.x-e.x,o=t.y-e.y,a=n.x-e.x,s=n.y-e.y,c=r*r+o*o,u=r*a+o*s,l=a*a+s*s-i*i,p=u/c,f=l/c,d=p*p-f;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var h=jm(d),m=-p+h,g=-p-h,R={x:e.x-r*m,y:e.y-o*m};if(d===0)return[R];var w={x:e.x-r*g,y:e.y-o*g};return[R,w].filter(function(b){return IR(b,e,t)})}function IR(e,t,n){return Vm(e.x,t.x,n.x)&&Vm(e.y,t.y,n.y)}function Vm(e,t,n){return e>=Fm(t,n)-Ys&&e<=DR(t,n)+Ys}function NR(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Ys=.1;function Gm(e,t){return Hm(e.x-t.x)<=Ys&&Hm(e.y-t.y)<=Ys}function BR(e,t,n,i){var r=n.segmentIndex,o=t.length-e.length;if(i.segmentMove){var a=i.segmentMove.segmentStartIndex,s=i.segmentMove.newSegmentStartIndex;return r===a?s:r>=s?r+o<s?s:r+o:r}if(i.bendpointMove){var c=i.bendpointMove.insert,u=i.bendpointMove.bendpointIndex,l;if(o===0)return r;if(r>=u&&(l=c?r+1:r-1),r<u&&(l=r,c&&n.type!=="bendpoint"&&u-1===r)){var p=Um(t,u);p<n.relativeLocation&&l++}return l}return o===0?r:i.connectionStart&&r===0?0:i.connectionEnd&&r===e.length-2?t.length-2:Math.floor((t.length-2)/2)}function Wm(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=OR(e,n),c=s.segmentIndex,u=BR(n,t,s,i);if(u<0||u>t.length-2||u===null)return a;var l=Ym(n,c),p=Ym(t,u),f=s.position,d=jR(l,f),h=$R(l,p);if(s.type==="bendpoint"){var m=t.length-n.length,g=s.bendpointIndex,R=n[g];if(t.indexOf(R)!==-1)return a;if(m===0){var w=t[g];return r=w.x-s.position.x,o=w.y-s.position.y,{delta:{x:r,y:o},point:{x:e.x+r,y:e.y+o}}}m<0&&g!==0&&g<n.length-1&&(d=Um(n,g))}var b={x:(p[1].x-p[0].x)*d+p[0].x,y:(p[1].y-p[0].y)*d+p[0].y},x=MR({x:e.x-f.x,y:e.y-f.y},h);return r=b.x+x.x-e.x,o=b.y+x.y-e.y,{point:Ti(b),delta:Ti({x:r,y:o})}}function Um(e,t){var n=ua(e[t-1],e[t]),i=ua(e[t],e[t+1]),r=n/(n+i);return r}function $R(e,t){var n=Bm(e),i=Bm(t);return i-n}function Ym(e,t){return[e[t],e[t+1]]}function jR(e,t){var n=ua(e[0],e[1]),i=ua(e[0],t);return n===0?0:i/n}function FR(e,t,n,i){var r=be(e);return Wm(r,t,n,i).delta}function pa(e,t,n){var i=aa(t),r=aa(n),o=ii(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return Ti({x:r.x+a.x,y:r.y+a.y})}function qm(e,t,n){var i=aa(e),r=aa(t),o=aa(n),a=ii(e,i),s=ii(i,r),c=HR(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 Ti({x:l.x+a.x-e.x,y:l.y+a.y-e.y})}function HR(e,t,n){var i=ye(t),r=ye(n);if(zR(i,r))return null;var o=Zt(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=Zt(n,s),c!==o?null:a}function zR(e,t){return VR(e,t)||GR(e,t)}function VR(e,t){return e.right!==t.right&&e.left!==t.left}function GR(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var Km="name",Xm="text";function jl(e,t,n,i){X.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{Z(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var s=a.context,c=s.element,u=s.properties;if(Km in u&&t.updateLabel(c,u[Km]),Xm in u&&v(c,"bpmn:TextAnnotation")){var l=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},u[Xm]||"");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;Me(u)||!nr(u)||jn(u)&&t.updateLabel(u,jn(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=O({},s.hints),p=s.newWaypoints||c.waypoints,f=s.oldWaypoints;return typeof l.startChanged>"u"&&(l.startChanged=!!l.connectionStart),typeof l.endChanged>"u"&&(l.endChanged=!!l.connectionEnd),FR(u,p,f,l)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(a){var s=a.context,c=s.hints||{};if(c.labelBehavior!==!1){var u=s.connection,l=u.label,p;!l||!l.parent||(p=o(a),t.moveShape(l,p))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,u=s.oldShape,l=Z(c);l&&nr(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(!(!Me(c)||u.autoResize)){var l=s.newBounds,p=i.getDimensions(jn(c)||"",{box:l,style:i.getExternalStyle()}),f=Math.ceil(p.height),d=l.y!==c.y,h=c.y+c.height;s.newBounds={width:l.width,height:f,x:l.x,y:d?h-f:l.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.newBounds,l=s.oldBounds;if(Ms(c)){var p=c.label,f=be(p),d=YR(l),h=UR(f,d),m=WR(h,l,u);t.moveShape(p,m)}})}ie(jl,X),jl.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function WR(e,t,n){var i=pa(e,t,n);return Ti(ii(i,e))}function UR(e,t){if(t.length){var n=qR(e,t);return $l(e,n)}}function YR(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 qR(e,t){var n=t.map(function(r){return{line:r,distance:$m(e,r)}}),i=oi(n,"distance");return i[0].line}function KR(e,t,n,i){return Wm(e,t,n,i).point}function Fl(e,t){X.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=O({},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),KR(r,c,u,s)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming;s.forEach(function(c){var u=c.waypoints[c.waypoints.length-1],l=n(i,u),p=[].concat(c.waypoints.slice(0,-1),[l]);t.updateWaypoints(c,p)}),a.forEach(function(c){var u=c.waypoints[0],l=n(i,u),p=[].concat([l],c.waypoints.slice(1));t.updateWaypoints(c,p)})}),this.postExecute(["connection.move"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming,c=r.delta;s.forEach(function(u){var l=u.waypoints[u.waypoints.length-1],p={x:l.x+c.x,y:l.y+c.y},f=[].concat(u.waypoints.slice(0,-1),[p]);t.updateWaypoints(u,f)}),a.forEach(function(u){var l=u.waypoints[0],p={x:l.x+c.x,y:l.y+c.y},f=[].concat([p],u.waypoints.slice(1));t.updateWaypoints(u,f)})})}ie(Fl,X),Fl.$inject=["eventBus","modeling"];function qs(e,t,n){var i=Xs(e),r=Qm(i,t),o=i[0];return r.length?r[r.length-1]:pa(o.original||o,n,t)}function Ks(e,t,n){var i=Xs(e),r=Qm(i,t),o=i[i.length-1];return r.length?r[0]:pa(o.original||o,n,t)}function Hl(e,t,n){var i=Xs(e),r=Zm(t,n),o=i[0];return pa(o.original||o,r,t)}function zl(e,t,n){var i=Xs(e),r=Zm(t,n),o=i[i.length-1];return pa(o.original||o,r,t)}function Zm(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Xs(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Qm(e,t){var n=rn(e,ZR);return Oe(n,function(i){return XR(i,t)})}function XR(e,t){return Zt(t,e,1)==="intersect"}function ZR(e){return e.original||e}function Vl(e,t){X.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(QR(i,r)){var o=JR(i);o.incoming.forEach(function(a){var s=Ks(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=qs(a,r,i);t.reconnectStart(a,r,s)})}},!0)}Vl.$inject=["eventBus","modeling"],ie(Vl,X);function QR(e,t){return v(e,"bpmn:Participant")&&$e(e)&&v(t,"bpmn:Participant")&&!$e(t)}function JR(e){var t=Xo([e]),n=[],i=[];return t.forEach(function(r){r!==e&&(r.incoming.forEach(function(o){v(o,"bpmn:MessageFlow")&&n.push(o)}),r.outgoing.forEach(function(o){v(o,"bpmn:MessageFlow")&&i.push(o)}))},[]),{incoming:n,outgoing:i}}const eC=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Jm(e){const t=Z(e);if(!v(t,"bpmn:BoundaryEvent")&&!(v(t,"bpmn:StartEvent")&&cn(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:eC.some(i=>v(n[0],i))}function eg(e){return v(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Gl(e,t){e.invoke(X,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!Jm(r))return;const a=eg(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=Z(i).get(a),u=Z(r).get(a);c!==u&&t.updateProperties(r,{[a]:c})})}Gl.$inject=["injector","modeling"],ie(Gl,X);function Wl(e,t){X.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=Ve(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}ie(Wl,X),Wl.$inject=["eventBus","modeling"];function Ul(e,t,n){X.call(this,e),this.preExecute("shape.delete",function(i){var r=i.context.shape;if(!(r.incoming.length!==1||r.outgoing.length!==1)){var o=r.incoming[0],a=r.outgoing[0];if(!(!v(o,"bpmn:SequenceFlow")||!v(a,"bpmn:SequenceFlow"))&&t.canConnect(o.source,a.target,o)){var s=tC(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}ie(Ul,X),Ul.$inject=["eventBus","bpmnRules","modeling"];function yo(e){return e.original||e}function tC(e,t){var n=Nl(yo(e[e.length-2]),yo(e[e.length-1]),yo(t[1]),yo(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[yo(e[0]),yo(t[t.length-1])]}function Yl(e,t){X.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,r=i.parent;v(i,"bpmn:Participant")&&(n.collaborationRoot=r)},!0),this.postExecute("shape.delete",function(n){var i=n.collaborationRoot;if(i&&!i.businessObject.participants.length){var r=t.makeProcess(),o=i.children.slice();t.moveElements(o,{x:0,y:0},r)}},!0)}Yl.$inject=["eventBus","modeling"],ie(Yl,X);function ql(e,t,n,i){X.call(this,e);var r=i.get("dragging",!1);function o(c){var u=c.source,l=c.target,p=c.parent;if(p){var f,d;v(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(u,l)||(d=!0),n.canConnectMessageFlow(u,l)&&(f="bpmn:MessageFlow")),v(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(u,l)||(d=!0),n.canConnectSequenceFlow(u,l)&&(f="bpmn:SequenceFlow")),d&&t.removeConnection(c),f&&t.connect(u,l,{type:f,waypoints:c.waypoints.slice()})}}function a(c){var u=c.context,l=u.connection,p=u.newSource||l.source,f=u.newTarget||l.target,d,h;d=n.canConnect(p,f),!(!d||d.type===l.type)&&(h=t.connect(p,f,{type:d.type,associationDirection:d.associationDirection,waypoints:l.waypoints.slice()}),l.parent&&t.removeConnection(l),u.connection=h,r&&s(l,h))}function s(c,u){var l=r.context(),p=l&&l.payload.previousSelection,f;!p||!p.length||(f=p.indexOf(c),f!==-1&&p.splice(f,1,u))}this.postExecuted("elements.move",function(c){var u=c.closure,l=u.allConnections;M(l,o)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var u=c.context,l=u.properties,p=u.element,f=p.businessObject,d;l.default&&(d=st(p.outgoing,Jr({id:p.businessObject.default.id})),d&&t.updateProperties(d,{conditionExpression:void 0})),l.conditionExpression&&f.sourceRef.default===f&&t.updateProperties(p.source,{default:void 0})})}ie(ql,X),ql.$inject=["eventBus","modeling","bpmnRules","injector"];function Zs(e,t,n,i,r,o){i.invoke(X,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=Sn(u,function(p,f){var d=t.canReplace([f],f.host||f.parent||c);return d?p.concat(d.replacements):p},[]);l.length&&this._replaceElements(u,l)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,u=s.newHost,l=[];M(s.closure.topLevel,function(f){cn(f)?l=l.concat(f.children):l=l.concat(f)}),l.length===1&&u&&(c=u);var p=t.canReplace(l,c);p&&this._replaceElements(l,p.replacements,u)},this),this.postExecute(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,u=s.newShape,l=c.attachers,p;l&&l.length&&(p=t.canReplace(l,u),this._replaceElements(l,p.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,u=s.newShape;r.unclaimId(c.businessObject.id,c.businessObject),r.updateProperties(u,{id:c.id})})}ie(Zs,X),Zs.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;M(t,function(o){var a={type:o.newElementType},s=n.get(o.oldElementId),c=e.indexOf(s);e[c]=i.replaceElement(s,a,{select:!1})}),t&&r.select(e)},Zs.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var nC=1500,iC={width:140,height:120},Kl={width:300,height:60},Xl={width:60,height:300},Qs={width:300,height:150},Js={width:150,height:300},tg={width:140,height:120},ng={width:100,height:40};function ig(e){e.on("resize.start",nC,function(t){var n=t.context,i=n.shape,r=n.direction,o=n.balanced;(v(i,"bpmn:Lane")||v(i,"bpmn:Participant"))&&(n.resizeConstraints=cC(i,r,o)),v(i,"bpmn:SubProcess")&&$e(i)&&(n.minDimensions=tg),v(i,"bpmn:TextAnnotation")&&(n.minDimensions=ng)})}ig.$inject=["eventBus"];var or=Math.abs,rC=Math.min,oC=Math.max;function rg(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function vo(e,t,n){return rg(e,t,n,rC)}function _o(e,t,n){return rg(e,t,n,oC)}var aC={top:20,left:50,right:20,bottom:20},sC={top:50,left:20,right:20,bottom:20};function cC(e,t,n){var i=Un(e),r=!0,o=!0,a=Vs(i,[i]),s=ye(e),c={},u={},l=Yt(e),p=l?Kl:Xl;/n/.test(t)?u.top=s.bottom-p.height:/e/.test(t)?u.right=s.left+p.width:/s/.test(t)?u.bottom=s.top+p.height:/w/.test(t)&&(u.left=s.right-p.width),a.forEach(function(h){var m=ye(h);l?(m.top<s.top-10&&(r=!1),m.bottom>s.bottom+10&&(o=!1)):(m.left<s.left-10&&(r=!1),m.right>s.right+10&&(o=!1)),/n/.test(t)&&(n&&or(s.top-m.bottom)<10&&_o(c,"top",m.top+p.height),or(s.top-m.top)<5&&vo(u,"top",m.bottom-p.height)),/e/.test(t)&&(n&&or(s.right-m.left)<10&&vo(c,"right",m.right-p.width),or(s.right-m.right)<5&&_o(u,"right",m.left+p.width)),/s/.test(t)&&(n&&or(s.bottom-m.top)<10&&vo(c,"bottom",m.bottom-p.height),or(s.bottom-m.bottom)<5&&_o(u,"bottom",m.top+p.height)),/w/.test(t)&&(n&&or(s.left-m.right)<10&&_o(c,"left",m.left+p.width),or(s.left-m.left)<5&&vo(u,"left",m.right-p.width))});var f=i.children.filter(function(h){return!h.hidden&&!h.waypoints&&(v(h,"bpmn:FlowElement")||v(h,"bpmn:Artifact"))}),d=l?aC:sC;return f.forEach(function(h){var m=ye(h);/n/.test(t)&&(!l||r)&&vo(u,"top",m.top-d.top),/e/.test(t)&&(l||o)&&_o(u,"right",m.right+d.right),/s/.test(t)&&(!l||o)&&_o(u,"bottom",m.bottom+d.bottom),/w/.test(t)&&(l||r)&&vo(u,"left",m.left-d.left)}),{min:u,max:c}}function og(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function bo(e){return e.originalEvent||e.srcEvent}function Zl(e){og(e),og(bo(e))}function Br(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 ag(){return/mac/i.test(navigator.platform)}function sg(e,t){return(bo(e)||e).button===t}function ar(e){return sg(e,0)}function uC(e){return sg(e,1)}function fa(e){var t=bo(e)||e;return ar(e)?ag()?t.metaKey:t.ctrlKey:!1}function ec(e){var t=bo(e)||e;return ar(e)&&t.shiftKey}var cg=1001;function ug(e,t){e.on("resize.start",cg+500,function(n){var i=n.context,r=i.shape;(v(r,"bpmn:Lane")||v(r,"bpmn:Participant"))&&(i.balanced=!fa(n))}),e.on("resize.end",cg,function(n){var i=n.context,r=i.shape,o=i.canExecute,a=i.newBounds;if(v(r,"bpmn:Lane")||v(r,"bpmn:Participant"))return o&&(a=$h(a),t.resizeLane(r,a,i.balanced)),!1})}ug.$inject=["eventBus","modeling"];var lC=500;function Ql(e,t,n,i,r){n.invoke(X,this);function o(l){return De(l,["bpmn:ReceiveTask","bpmn:SendTask"])||pC(l,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(l){var p=e.getDefinitions(),f=p.get("rootElements");return!!st(f,Jr({id:l.id}))}function s(l){if(v(l,"bpmn:ErrorEventDefinition"))return"errorRef";if(v(l,"bpmn:EscalationEventDefinition"))return"escalationRef";if(v(l,"bpmn:MessageEventDefinition"))return"messageRef";if(v(l,"bpmn:SignalEventDefinition"))return"signalRef"}function c(l){if(De(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.get("messageRef");var p=l.get("eventDefinitions"),f=p[0];return f.get(s(f))}function u(l,p){if(De(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.set("messageRef",p);var f=l.get("eventDefinitions"),d=f[0];return d.set(s(d),p)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var p=l.shape||l.element;if(o(p)){var f=Z(p),d=c(f),h;d&&!a(d)&&(h=e.getDefinitions().get("rootElements"),St(h,d),l.addedRootElement=d)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var p=l.addedRootElement;if(p){var f=e.getDefinitions().get("rootElements");wt(f,p)}},!0),t.on("copyPaste.copyElement",function(l){var p=l.descriptor,f=l.element;if(!(f.labelTarget||!o(f))){var d=Z(f),h=c(d);h&&(p.referencedRootElement=h)}}),t.on("copyPaste.pasteElement",lC,function(l){var p=l.descriptor,f=p.businessObject,d=p.referencedRootElement;d&&(a(d)||(d=i.copyElement(d,r.create(d.$type))),u(f,d),delete p.referencedRootElement)})}Ql.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],ie(Ql,X);function pC(e,t){return _e(t)||(t=[t]),Vi(t,function(n){return lo(e,n)})}var lg=Math.max;function pg(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return M(n,function(a){var s=a.id;v(a,"bpmn:Participant")&&(o[s]=dC(a,i,r)),v(a,"bpmn:Lane")&&(o[s]=Yt(a)?Kl:Xl),v(a,"bpmn:SubProcess")&&$e(a)&&(o[s]=tg),v(a,"bpmn:TextAnnotation")&&(o[s]=ng),v(a,"bpmn:Group")&&(o[s]=iC)}),o})}pg.$inject=["eventBus"];function fC(e){return e==="x"}function dC(e,t,n){var i=Yt(e);if(!gC(e))return i?Qs:Js;var r=fC(t),o={};return r?i?o=Qs:o={width:mC(e,n,r),height:Js.height}:i?o={width:Qs.width,height:hC(e,n,r)}:o=Js,o}function hC(e,t,n){var i;return i=yC(e,t,n),lg(Qs.height,i)}function mC(e,t,n){var i;return i=vC(e,t,n),lg(Js.width,i)}function gC(e){return!!rr(e).length}function yC(e,t,n){var i=rr(e),r;return r=Jl(i,t,n),e.height-r.height+Kl.height}function vC(e,t,n){var i=rr(e),r;return r=Jl(i,t,n),e.width-r.width+Xl.width}function Jl(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=rr(r),o.length?Jl(o,t,n):r}var fg="_plane";function dg(e){var t=e.id;return _C(t)}function mi(e){var t=e.id;return v(e,"bpmn:SubProcess")?hg(t):t}function $r(e){return hg(e)}function tc(e){var t=Ve(e);return v(t,"bpmndi:BPMNPlane")}function hg(e){return e+fg}function _C(e){return e.replace(new RegExp(fg+"$"),"")}var mg=400,bC=600,gg={x:180,y:160};function Oi(e,t,n,i,r,o,a){X.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=i,this._bpmnFactory=r,this._bpmnjs=o,this._elementRegistry=a;var s=this;function c(p){return v(p,"bpmn:SubProcess")&&!$e(p)}function u(p){var f=p.shape,d=p.newRootElement,h=Z(f);d=s._addDiagram(d||h),p.newRootElement=e.addRootElement(d)}function l(p){var f=p.shape,d=Z(f);s._removeDiagram(d);var h=p.newRootElement=a.get(mi(d));e.removeRootElement(h)}this.executed("shape.create",function(p){var f=p.shape;c(f)&&u(p)},!0),this.postExecuted("elements.create",function(p){var f=p.elements;M(f,function(d){if(c(d)){var h=a.get(mi(d));if(!(!h||!d.children||!d.children.length)){var m=yg(d);s._showRecursively(m),s._moveChildrenToShape(m,h)}}})},!0),this.reverted("shape.create",function(p){var f=p.shape;c(f)&&l(p)},!0),this.preExecute("shape.delete",function(p){var f=p.shape;!v(f,"bpmn:SubProcess")||!$e(f)||M(na([f]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(p){var f=p.shape;if(c(f)){var d=a.get(mi(f));d&&n.removeElements(d.children.slice())}},!0),this.executed("shape.delete",function(p){var f=p.shape;c(f)&&l(p)},!0),this.reverted("shape.delete",function(p){var f=p.shape;c(f)&&u(p)},!0),this.preExecuted("shape.replace",function(p){var f=p.oldShape,d=p.newShape;!c(f)||!c(d)||(p.oldRoot=e.removeRootElement(mi(f)))},!0),this.postExecuted("shape.replace",function(p){var f=p.newShape,d=p.oldRoot,h=e.findRoot(mi(f));if(!(!d||!h)){var m=d.children;n.moveElements(m,{x:0,y:0},h)}},!0),this.executed("element.updateProperties",function(p){var f=p.element;if(v(f,"bpmn:SubProcess")){var d=p.properties,h=p.oldProperties,m=h.id,g=d.id;if(m!==g){if(tc(f)){a.updateId(f,$r(g)),a.updateId(m,g);return}var R=a.get($r(m));R&&a.updateId($r(m),$r(g))}}},!0),this.reverted("element.updateProperties",function(p){var f=p.element;if(v(f,"bpmn:SubProcess")){var d=p.properties,h=p.oldProperties,m=h.id,g=d.id;if(m!==g){if(tc(f)){a.updateId(f,$r(m)),a.updateId(g,m);return}var R=a.get($r(g));R&&a.updateId(R,$r(m))}}},!0),t.on("element.changed",function(p){var f=p.element;if(tc(f)){var d=f,h=a.get(dg(d));!h||h===d||t.fire("element.changed",{element:h})}}),this.executed("shape.toggleCollapse",mg,function(p){var f=p.shape;v(f,"bpmn:SubProcess")&&($e(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",mg,function(p){var f=p.shape;v(f,"bpmn:SubProcess")&&($e(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",bC,function(p){var f=p.shape;if(v(f,"bpmn:SubProcess")){var d=p.newRootElement;if(d)if($e(f))s._moveChildrenToShape(d.children.slice(),f),M(na(f.children),m=>{n.moveShape(m.annotation,{x:0,y:0},f.parent),M(m.associations,g=>{n.moveConnection(g,{x:0,y:0},f.parent)})});else{s._disconnectSharedAnnotations(f);var h=yg(f);s._moveChildrenToShape(h,d)}}},!0),t.on("copyPaste.createTree",function(p){var f=p.element,d=p.children;if(c(f)){var h=mi(f),m=a.get(h);m&&d.push.apply(d,m.children)}}),t.on("copyPaste.copyElement",function(p){var f=p.descriptor,d=p.element,h=p.elements,m=d.parent,g=v(Ve(m),"bpmndi:BPMNPlane");if(g){var R=dg(m),w=st(h,function(b){return b.id===R});w&&(f.parent=w.id)}}),t.on("copyPaste.pasteElement",function(p){var f=p.descriptor;f.parent&&(c(f.parent)||f.parent.hidden)&&(f.hidden=!0)})}ie(Oi,X),Oi.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=At(i),o;if(!t.x)o={x:gg.x-r.x,y:gg.y-r.y};else{var a=be(t),s=be(r);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}},Oi.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(sm(e).map(i=>i.annotation));n.size&&M(na(e.children),i=>{n.has(i.annotation)&&M(i.associations,r=>{t.removeConnection(r)})})},Oi.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},Oi.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},Oi.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,i=t.create("bpmndi:BPMNPlane",{bpmnElement:e}),r=t.create("bpmndi:BPMNDiagram",{plane:i});i.$parent=r;var o=n.createRoot({id:mi(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},Oi.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=st(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},Oi.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function xC(e){var t=[];return M(na(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function yg(e){return e.children.slice().concat(xC(e.children)).concat(wC(e))}function wC(e){return rl(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function ep(e,t){e.invoke(X,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,r=n.context.newShape;if(!(!v(r,"bpmn:SubProcess")||v(r,"bpmn:AdHocSubProcess")||!(v(i,"bpmn:Task")||v(i,"bpmn:CallActivity"))||!$e(r))){var o=EC(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}ep.$inject=["injector","modeling"],ie(ep,X);function EC(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function tp(e,t){X.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;v(i,"bpmn:TextAnnotation")&&(n.parent=i.parent)},!0),this.preExecute(["shape.create","shape.resize","elements.move"],function(n){const i=n.shapes||[n.shape];i.length===1&&v(i[0],"bpmn:TextAnnotation")&&(n.hints=n.hints||{},n.hints.autoResize=!1)},!0),this.preExecute("shape.resize",function(n){var i=n.context,r=i.shape,o=i.hints||{};if(!(!v(r,"bpmn:TextAnnotation")||o.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,jn(r)||""),c=a.y!==r.y&&Math.abs(a.y+a.height-(r.y+r.height))<=1,u=r.y+r.height;i.newBounds={width:a.width,height:s.height,x:a.x,y:c?u-s.height:a.y}}})}ie(tp,X),tp.$inject=["eventBus","textRenderer"];function np(e,t){X.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if($e(i))return;var r=Xo(i);r.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();M(s,function(u){o(u,!0)}),M(c,function(u){o(u,!1)})});function o(a,s){r.indexOf(a.source)!==-1&&r.indexOf(a.target)!==-1||v(a,"bpmn:Association")&&(v(a.source,"bpmn:TextAnnotation")||v(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,be(i)):t.reconnectStart(a,i,be(i)))}},!0)}ie(np,X),np.$inject=["eventBus","modeling"];var ip=500;function rp(e,t,n){X.call(this,e);function i(a){a.length&&a.forEach(function(s){s.type==="label"&&!s.businessObject.name&&(s.hidden=!0)})}function r(a,s){var c=a.children,u=s,l,p;return l=SC(c).concat([a]),p=Rm(l),p?(u.width=Math.max(p.width,u.width),u.height=Math.max(p.height,u.height),u.x=p.x+(p.width-u.width)/2,u.y=p.y+(p.height-u.height)/2):(u.x=a.x+(a.width-u.width)/2,u.y=a.y+(a.height-u.height)/2),u}function o(a,s){return{x:a.x+(a.width-s.width)/2,y:a.y+(a.height-s.height)/2,width:s.width,height:s.height}}this.executed(["shape.toggleCollapse"],ip,function(a){var s=a.context,c=s.shape;v(c,"bpmn:SubProcess")&&(c.collapsed?Ve(c).isExpanded=!1:(i(c.children),Ve(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],ip,function(a){var s=a.context,c=s.shape;c.collapsed?Ve(c).isExpanded=!1:Ve(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],ip,function(a){var s=a.context.shape,c=t.getDefaultSize(s),u;s.collapsed?u=o(s,c):u=r(s,c),n.resizeShape(s,u,null,{autoResize:s.collapsed?!1:"nwse"})})}ie(rp,X),rp.$inject=["eventBus","elementFactory","modeling"];function SC(e){return e.filter(function(t){return!t.hidden})}function op(e,t,n,i){t.invoke(X,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;Me(a)||(v(a,"bpmn:Participant")&&$e(a)&&n.ids.unclaim(s.processRef.id),i.unclaimId(s.id,s))}),this.preExecute("connection.delete",function(r){var o=r.context,a=o.connection,s=a.businessObject;i.unclaimId(s.id,s)}),this.preExecute("canvas.updateRoot",function(){var r=e.getRootElement(),o=r.businessObject;v(r,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}ie(op,X),op.$inject=["canvas","injector","moddle","modeling"];function ap(e,t){X.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;RC(r,o)&&t.updateProperties(o,{default:null})})}ie(ap,X),ap.$inject=["eventBus","modeling"];function RC(e,t){if(!v(e,"bpmn:SequenceFlow"))return!1;var n=Z(t),i=Z(e);return n.get("default")===i}var CC=500,PC=5e3,vg=["shape.create","shape.delete","shape.move","shape.resize"],_g=[...vg,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function sp(e,t){X.call(this,e);var n;function i(){return n=n||new AC,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(_g,PC,function(){i()}),this.postExecuted(_g,CC,function(){o()}),this.preExecute(vg,function(a){var s=a.context,c=s.shape,u=r();!c||c.labelTarget||(v(c,"bpmn:Lane")&&u.addLane(c),v(c,"bpmn:FlowNode")&&u.addFlowNode(c))})}sp.$inject=["eventBus","modeling"],ie(sp,X);function AC(){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 TC=500,MC=5e3,bg=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],xg=[...bg,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function cp(e,t){X.call(this,e);var n;function i(){return n=n||new kC,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(xg,MC,function(){i()}),this.postExecuted(xg,TC,function(){o()}),this.preExecute(bg,function(a){var s=a.context.connection||a.context.shape,c=r();!s||s.labelTarget||(v(s,"bpmn:FlowElement")&&c.addFlowElement(s),v(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;v(s,"bpmn:Group")&&r().addGroup(s)})}cp.$inject=["eventBus","modeling"],ie(cp,X);function kC(){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 up(e,t){X.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)DC(o)&&!LC(o)&&t.updateProperties(o,{isForCompensation:void 0})})}ie(up,X),up.$inject=["eventBus","modeling"];function DC(e){const t=Z(e);return t&&t.isForCompensation}function OC(e){return e&&v(e,"bpmn:BoundaryEvent")&&lo(e,"bpmn:CompensateEventDefinition")}function LC(e){return e.incoming.filter(n=>OC(n.source)).length>0}const IC={__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",yl],appendBehavior:["type",vl],associationBehavior:["type",bl],attachEventBehavior:["type",Ns],artifactBehavior:["type",_l],boundaryEventBehavior:["type",xl],categoryRootElementReferenceBehavior:["type",wl],compensateBoundaryEventBehaviour:["type",El],createBehavior:["type",Sl],createDataObjectBehavior:["type",Rl],createParticipantBehavior:["type",Al],dataInputAssociationBehavior:["type",Tl],dataStoreBehavior:["type",Ml],deleteLaneBehavior:["type",kl],detachEventBehavior:["type",Gs],dropOnFlowBehavior:["type",Ol],eventBasedGatewayBehavior:["type",Ll],fixHoverBehavior:["type",Dm],groupBehavior:["type",Il],importDockingFix:["type",Lm],isHorizontalFix:["type",Bl],labelBehavior:["type",jl],layoutConnectionBehavior:["type",Fl],messageFlowBehavior:["type",Vl],nonInterruptingBehavior:["type",Gl],removeElementBehavior:["type",Ul],removeEmbeddedLabelBoundsBehavior:["type",Wl],removeParticipantBehavior:["type",Yl],replaceConnectionBehavior:["type",ql],replaceElementBehaviour:["type",Zs],resizeBehavior:["type",ig],resizeLaneBehavior:["type",ug],rootElementReferenceBehavior:["type",Ql],spaceToolBehavior:["type",pg],subProcessPlaneBehavior:["type",Oi],subProcessStartEventBehavior:["type",ep],textAnnotationBehavior:["type",tp],toggleCollapseConnectionBehaviour:["type",np],toggleElementCollapseBehaviour:["type",rp],unclaimIdBehavior:["type",op],unsetDefaultFlowBehavior:["type",ap],updateFlowNodeRefsBehavior:["type",sp],updateCategoryValueRefsBehavior:["type",cp],setCompensationActivityAfterPasteBehavior:["type",up]};function lp(e){this._commandStack=e.get("commandStack",!1)}lp.$inject=["injector"],lp.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const gi={__init__:["rules"],rules:["type",lp]};function Yn(e){X.call(this,e),this.init()}Yn.$inject=["eventBus"],ie(Yn,X),Yn.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)})},Yn.prototype.init=function(){};function wg(e,t){var n=Zt(e,t,-15);return n!=="intersect"?n:null}function Jt(e){Yn.call(this,e)}ie(Jt,Yn),Jt.$inject=["eventBus"],Jt.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return NC(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 ic(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return ic(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 Ig(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return it(i)&&!rc(t,i)?!1:Rr(t,function(r){return it(r)?ic(r.source,r.target,r):r.host?da(r,r.host,null,n):hp(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 Tg(a)&&!n.includes(a.host)})?!1:da(n,t,null,i)||Og(n,t,i)||Lg(n,t)||rc(n,t)}),this.addRule("shape.create",function(e){return hp(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return da(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return Fg(n,t)})},Jt.prototype.canConnectMessageFlow=$g,Jt.prototype.canConnectSequenceFlow=jg,Jt.prototype.canConnectDataAssociation=mp,Jt.prototype.canConnectAssociation=Ng,Jt.prototype.canConnectCompensationAssociation=Bg,Jt.prototype.canMove=Lg,Jt.prototype.canAttach=da,Jt.prototype.canReplace=Og,Jt.prototype.canDrop=xo,Jt.prototype.canInsert=rc,Jt.prototype.canCreate=hp,Jt.prototype.canConnect=ic,Jt.prototype.canResize=Ig,Jt.prototype.canCopy=Fg;function NC(e){return pp(e)?null:De(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function pp(e){return!e||Me(e)}function Eg(e){do{if(v(e,"bpmn:Process"))return Z(e);if(v(e,"bpmn:Participant"))return Z(e).processRef||Z(e)}while(e=e.parent)}function fp(e){return v(e,"bpmn:TextAnnotation")}function dp(e){return v(e,"bpmn:Group")&&!e.labelTarget}function Sg(e){return v(e,"bpmn:BoundaryEvent")&&yi(e,"bpmn:CompensateEventDefinition")}function nc(e){return Z(e).isForCompensation}function BC(e,t){var n=Eg(e),i=Eg(t);return n===i}function $C(e){return v(e,"bpmn:InteractionNode")&&!v(e,"bpmn:BoundaryEvent")&&(!v(e,"bpmn:Event")||v(e,"bpmn:ThrowEvent")&&Pg(e,"bpmn:MessageEventDefinition"))}function jC(e){return v(e,"bpmn:InteractionNode")&&!nc(e)&&(!v(e,"bpmn:Event")||v(e,"bpmn:CatchEvent")&&Pg(e,"bpmn:MessageEventDefinition"))&&!(v(e,"bpmn:BoundaryEvent")&&!yi(e,"bpmn:MessageEventDefinition"))}function Rg(e){for(var t=e;t=t.parent;){if(v(t,"bpmn:FlowElementsContainer"))return Z(t);if(v(t,"bpmn:Participant"))return Z(t).processRef}return null}function Cg(e,t){var n=Rg(e),i=Rg(t);return n===i}function yi(e,t){var n=Z(e);return!!st(n.eventDefinitions||[],function(i){return v(i,t)})}function Pg(e,t){var n=Z(e);return(n.eventDefinitions||[]).every(function(i){return v(i,t)})}function FC(e){return v(e,"bpmn:FlowNode")&&!v(e,"bpmn:EndEvent")&&!cn(e)&&!(v(e,"bpmn:IntermediateThrowEvent")&&yi(e,"bpmn:LinkEventDefinition"))&&!Sg(e)&&!nc(e)}function HC(e){return v(e,"bpmn:FlowNode")&&!v(e,"bpmn:StartEvent")&&!v(e,"bpmn:BoundaryEvent")&&!cn(e)&&!(v(e,"bpmn:IntermediateCatchEvent")&&yi(e,"bpmn:LinkEventDefinition"))&&!nc(e)}function zC(e){return v(e,"bpmn:ReceiveTask")||v(e,"bpmn:IntermediateCatchEvent")&&(yi(e,"bpmn:MessageEventDefinition")||yi(e,"bpmn:TimerEventDefinition")||yi(e,"bpmn:ConditionalEventDefinition")||yi(e,"bpmn:SignalEventDefinition"))}function VC(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function Ag(e,t){var n=VC(t);return n.indexOf(e)!==-1}function ic(e,t,n){if(pp(e)||pp(t))return null;if(!v(n,"bpmn:DataAssociation")){if($g(e,t))return{type:"bpmn:MessageFlow"};if(jg(e,t))return{type:"bpmn:SequenceFlow"}}var i=mp(e,t);return i||(Bg(e,t)?{type:"bpmn:Association",associationDirection:"One"}:Ng(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function xo(e,t){return Me(e)||dp(e)?!0:v(t,"bpmn:Participant")&&!$e(t)?!1:v(e,"bpmn:Participant")?v(t,"bpmn:Process")||v(t,"bpmn:Collaboration"):De(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:v(e,"bpmn:Lane")?v(t,"bpmn:Participant")||v(t,"bpmn:Lane"):v(e,"bpmn:BoundaryEvent")&&!GC(e)?!1:v(e,"bpmn:FlowElement")&&!v(e,"bpmn:DataStoreReference")?v(t,"bpmn:FlowElementsContainer")?$e(t):De(t,["bpmn:Participant","bpmn:Lane"]):v(e,"bpmn:DataStoreReference")&&v(t,"bpmn:Collaboration")?Vi(Z(t).get("participants"),function(n){return!!n.get("processRef")}):De(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?De(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):v(e,"bpmn:MessageFlow")?v(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function GC(e){return Z(e).cancelActivity&&(Mg(e)||kg(e))}function Tg(e){return!Me(e)&&v(e,"bpmn:BoundaryEvent")}function WC(e){return v(e,"bpmn:Lane")}function UC(e){return Tg(e)||v(e,"bpmn:IntermediateThrowEvent")&&Mg(e)?!0:v(e,"bpmn:IntermediateCatchEvent")&&kg(e)}function Mg(e){var t=Z(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function kg(e){return Dg(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Dg(e,t){return t.some(function(n){return yi(e,n)})}function YC(e){return v(e,"bpmn:ReceiveTask")&&st(e.incoming,function(t){return v(t.source,"bpmn:EventBasedGateway")})}function da(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return Me(r)||!UC(r)||cn(t)||!v(t,"bpmn:Activity")||nc(t)||i&&!wg(i,t)||YC(t)?!1:"attach"}function Og(e,t,n){if(!t)return!1;var i={replacements:[]};return M(e,function(r){cn(t)||v(r,"bpmn:StartEvent")&&r.type!=="label"&&xo(r,t)&&(nS(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(iS(r)||rS(r)||oS(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),Dg(r,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&v(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"})),v(t,"bpmn:Transaction")||yi(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(v(r,"bpmn:EndEvent")&&xo(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),v(r,"bpmn:BoundaryEvent")&&da(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function Lg(e,t){return Vi(e,WC)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return xo(n,t)})}function hp(e,t,n,i){return t?Me(e)||dp(e)?!0:xo(e,t)||rc(e,t):!1}function Ig(e,t,n){return v(e,"bpmn:SubProcess")?$e(e)&&(!t||t.width>=100&&t.height>=80):v(e,"bpmn:Lane")||v(e,"bpmn:Participant")?!0:fp(e)?n?n==="e"||n==="w":!0:dp(e)?!0:Me(e)?n?n==="e"||n==="w":!0:!1}function qC(e,t){var n=fp(e),i=fp(t);return(n||i)&&n!==i}function Ng(e,t){return Ag(t,e)||Ag(e,t)?!1:qC(e,t)?!0:!!mp(e,t)}function Bg(e,t){return Cg(e,t)&&Sg(e)&&v(t,"bpmn:Activity")&&!XC(t,e)&&!cn(t)}function $g(e,t){return zg(e)&&!zg(t)?!1:$C(e)&&jC(t)&&!BC(e,t)}function jg(e,t){return FC(e)&&HC(t)&&Cg(e,t)&&!(v(e,"bpmn:EventBasedGateway")&&!zC(t))}function mp(e,t){return De(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&De(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:De(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&De(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function rc(e,t,n){if(!t)return!1;if(Array.isArray(e)){if(e.length!==1)return!1;e=e[0]}return t.source===e||t.target===e?!1:De(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!Me(t)&&v(e,"bpmn:FlowNode")&&!v(e,"bpmn:BoundaryEvent")&&xo(e,t.parent)}function gp(e,t){return e&&t&&e.indexOf(t)!==-1}function Fg(e,t){return Me(t)?!0:!(v(t,"bpmn:Lane")&&!gp(e,t.parent)||v(t,"bpmn:MessageFlow")&&!KC(e,t))}function KC(e,t){var n=Hg(t.source),i=Hg(t.target);return gp(e,n)&&gp(e,i)}function Hg(e){for(;e;e=e.parent)if(v(e,"bpmn:Participant"))return e;return null}function zg(e){return ho(e,"bpmn:Process")||ho(e,"bpmn:Collaboration")}function XC(e,t){return e.attachers.includes(t)}const ZC={__depends__:[gi],__init__:["bpmnRules"],bpmnRules:["type",Jt]};var QC=2e3;function Vg(e,t){e.on("saveXML.start",QC,n);function n(){var i=t.getRootElements();M(i,function(r){var o=Ve(r),a,s;a=Xo([r]),a=Oe(a,function(c){return c!==r&&!c.labelTarget}),s=rn(a,Ve),o.set("planeElement",s)})}}Vg.$inject=["eventBus","canvas"];const JC={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Vg]};function oc(e){X.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)})}oc.prototype.getOrdering=function(e,t){return null},ie(oc,X);function yp(e,t){oc.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=st(n,function(c){return De(a,[c.type])});return s&&s.order||{level:1}}function r(a){var s=a.order;if(s||(a.order=s=i(a)),!s)throw new Error(`no order for <${a.id}>`);return s}function o(a,s,c){for(var u=s;u&&!De(u,c);)u=u.parent;if(!u)throw new Error(`no parent for <${a.id}> in <${s&&s.id}>`);return u}this.getOrdering=function(a,s){if(a.labelTarget||v(a,"bpmn:TextAnnotation"))return{parent:t.findRoot(s)||t.getRootElement(),index:-1};var c=r(a);c.containers&&(s=o(a,s,c.containers));var u=s.children.indexOf(a),l=Wf(s.children,function(p){return!a.labelTarget&&p.labelTarget?!1:c.level<r(p).level});return l!==-1&&u!==-1&&u<l&&(l-=1),{index:l,parent:s}}}yp.$inject=["eventBus","canvas"],ie(yp,oc);const eP={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",yp]};function ha(){}ha.prototype.get=function(){return this._data},ha.prototype.set=function(e){this._data=e},ha.prototype.clear=function(){var e=this._data;return delete this._data,e},ha.prototype.isEmpty=function(){return!this._data};const tP={clipboard:["type",ha]};var Gg=1500;function Wg(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",Gg,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",Gg,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=Br(a),c=document.elementFromPoint(s.x,s.y),nP(c)}}Wg.$inject=["elementRegistry","eventBus","injector"];function nP(e){return kr(e,"svg, .djs-element",!0)}const iP={__init__:["hoverFix"],hoverFix:["type",Wg]};function rP(e){return!0}function ac(e){return ar(e)||uC(e)}var Ug=500;function Yg(e,t,n){var i=this;function r(A,j,H){if(!s(A,j)){var N,G,fe;H?G=t.getGraphics(H):(N=j.delegateTarget||j.target,N&&(G=N,H=t.get(G))),!(!G||!H)&&(fe=e.fire(A,{element:H,gfx:G,originalEvent:j}),fe===!1&&(j.stopPropagation(),j.preventDefault()))}}var o={};function a(A){return o[A]}function s(A,j){var H=u[A]||ar;return!H(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":rP,"element.mousedown":ac,"element.mouseup":ac,"element.click":ac,"element.dblclick":ac};function l(A,j,H){var N=c[A];if(!N)throw new Error("unmapped DOM event name <"+A+">");return r(N,j,H)}var p="svg, .djs-element";function f(A,j,H,N){var G=o[H]=function(fe){r(H,fe)};N&&(u[H]=N),G.$delegate=Cn.bind(A,p,j,G)}function d(A,j,H){var N=a(H);N&&Cn.unbind(A,j,N.$delegate)}function h(A){M(c,function(j,H){f(A,H,j)})}function m(A){M(c,function(j,H){d(A,H,j)})}e.on("canvas.destroy",function(A){m(A.svg)}),e.on("canvas.init",function(A){h(A.svg)}),e.on(["shape.added","connection.added"],function(A){var j=A.element,H=A.gfx;e.fire("interactionEvents.createHit",{element:j,gfx:H})}),e.on(["shape.changed","connection.changed"],Ug,function(A){var j=A.element,H=A.gfx;e.fire("interactionEvents.updateHit",{element:j,gfx:H})}),e.on("interactionEvents.createHit",Ug,function(A){var j=A.element,H=A.gfx;i.createDefaultHit(j,H)}),e.on("interactionEvents.updateHit",function(A){var j=A.element,H=A.gfx;i.updateDefaultHit(j,H)});var g=E("djs-hit djs-hit-stroke"),R=E("djs-hit djs-hit-click-stroke"),w=E("djs-hit djs-hit-all"),b=E("djs-hit djs-hit-no-move"),x={all:w,"click-stroke":R,stroke:g,"no-move":b};function E(A,j){return j=O({stroke:"white",strokeWidth:15},j||{}),n.cls(A,["no-fill","no-border"],j)}function T(A,j){var H=x[j];if(!H)throw new Error("invalid hit type <"+j+">");return re(A,H),A}function L(A,j){Re(A,j)}this.removeHits=function(A){var j=ys(".djs-hit",A);M(j,Ft)},this.createDefaultHit=function(A,j){var H=A.waypoints,N=A.isFrame,G;return H?this.createWaypointsHit(j,H):(G=N?"stroke":"all",this.createBoxHit(j,G,{width:A.width,height:A.height}))},this.createWaypointsHit=function(A,j){var H=Ko(j);return T(H,"stroke"),L(A,H),H},this.createBoxHit=function(A,j,H){H=O({x:0,y:0},H);var N=me("rect");return T(N,j),re(N,H),L(A,N),N},this.updateDefaultHit=function(A,j){var H=et(".djs-hit",j);if(H)return A.waypoints?il(H,A.waypoints):re(H,{width:A.width,height:A.height}),H},this.fire=r,this.triggerMouseEvent=l,this.mouseHandler=a,this.registerEvent=f,this.unregisterEvent=d}Yg.$inject=["eventBus","elementRegistry","styles"];const sc={__init__:["interactionEvents"],interactionEvents:["type",Yg]};function wo(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)})}wo.$inject=["eventBus","canvas"],wo.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()})}},wo.prototype.get=function(){return Array.from(this._selectedElements)},wo.prototype.isSelected=function(e){return this._selectedElements.has(e)},wo.prototype.select=function(e,t){var n=this.get();_e(e)||(e=e?[e]:[]);var i=this._canvas,r=i.getRootElement();e=e.filter(function(o){var a=i.findRoot(o);return r===a}),t?M(e,o=>{this._selectedElements.add(o)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var qg="hover",Kg="selected";function Xg(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,qg)}),t.on("element.out",function(r){i(r.element,qg)}),t.on("selection.changed",function(r){function o(u){i(u,Kg)}function a(u){n(u,Kg)}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)})}Xg.$inject=["canvas","eventBus"];function Zg(e,t,n,i){e.on("create.end",500,function(r){var o=r.context,a=o.canExecute,s=o.elements,c=o.hints||{},u=c.autoSelect;if(a){if(u===!1)return;_e(u)?t.select(u):t.select(s.filter(oP))}}),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=st(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(ar(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=ec(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}Zg.$inject=["eventBus","selection","canvas","elementRegistry"];function oP(e){return!e.hidden}const qn={__init__:["selectionVisuals","selectionBehavior"],__depends__:[sc],selection:["type",wo],selectionVisuals:["type",Xg],selectionBehavior:["type",Zg]};var aP=/^djs-cursor-.*$/;function cc(e){var t=mt(document.body);t.removeMatching(aP),e&&t.add("djs-cursor-"+e)}function Qg(){cc(null)}var sP=5e3;function Jg(e,t){t=t||"element.click";function n(){return!1}return e.once(t,sP,n),function(){e.off(t,n)}}var cP=["c","C"],uP=["v","V"],lP=["d","D"],pP=["x","X"],fP=["y","Y"],ey=["z","Z"];function dP(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Tn(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function Ht(e,t){return e=_e(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function vp(e){return e.shiftKey}function hP(e){return Tn(e)&&Ht(cP,e)}function mP(e){return Tn(e)&&Ht(uP,e)}function gP(e){return Tn(e)&&Ht(lP,e)}function yP(e){return Tn(e)&&Ht(pP,e)}function vP(e){return Tn(e)&&!vp(e)&&Ht(ey,e)}function _P(e){return Tn(e)&&(Ht(fP,e)||Ht(ey,e)&&vp(e))}var Eo=Math.round,ty="djs-drag-active";function jr(e){e.preventDefault()}function bP(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function xP(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function ny(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(b){var x=t.viewbox(),E=t._container.getBoundingClientRect();return{x:x.x+(b.x-E.left)/x.scale,y:x.y+(b.y-E.top)/x.scale}}function s(b,x){x=x||o;var E=e.createEvent(O({},x.payload,x.data,{isTouch:x.isTouch}));return e.fire("drag."+b,E)===!1?!1:e.fire(x.prefix+"."+b,E)}function c(b){var x=b.filter(function(E){return i.get(E.id)});x.length&&n.select(x)}function u(b,x){var E=o.payload,T=o.displacement,L=o.globalStart,A=Br(b),j=ii(A,L),H=o.localStart,N=a(A),G=ii(N,H);if(!o.active&&(x||xP(j)>o.threshold)){if(O(E,{x:Eo(H.x+T.x),y:Eo(H.y+T.y),dx:0,dy:0},{originalEvent:b}),s("start")===!1)return g();o.active=!0,o.keepSelection||(E.previousSelection=n.get(),n.select(null)),o.cursor&&cc(o.cursor),t.addMarker(t.getRootElement(),ty)}Zl(b),o.active&&(O(E,{x:Eo(N.x+T.x),y:Eo(N.y+T.y),dx:Eo(G.x),dy:Eo(G.y)},{originalEvent:b}),s("move"))}function l(b){var x,E=!0;o.active&&(b&&(o.payload.originalEvent=b,Zl(b)),E=s("end")),E===!1&&s("rejected"),x=R(E!==!0),s("ended",x)}function p(b){Ht("Escape",b)&&(jr(b),g())}function f(b){var x;o.active&&(x=Jg(e),setTimeout(x,400),jr(b)),l(b)}function d(b){u(b)}function h(b){var x=o.payload;x.hoverGfx=b.gfx,x.hover=b.element,s("hover")}function m(b){s("out");var x=o.payload;x.hoverGfx=null,x.hover=null}function g(b){var x;if(o){var E=o.active;E&&s("cancel"),x=R(b),E&&s("canceled",x)}}function R(b){var x,E;s("cleanup"),Qg(),o.trapClick?E=f:E=l,Se.unbind(document,"mousemove",u),Se.unbind(document,"dragstart",jr),Se.unbind(document,"selectstart",jr),Se.unbind(document,"mousedown",E,!0),Se.unbind(document,"mouseup",E,!0),Se.unbind(document,"keyup",p),Se.unbind(document,"touchstart",d,!0),Se.unbind(document,"touchcancel",g,!0),Se.unbind(document,"touchmove",u,!0),Se.unbind(document,"touchend",l,!0),e.off("element.hover",h),e.off("element.out",m),t.removeMarker(t.getRootElement(),ty);var T=o.payload.previousSelection;return b!==!1&&T&&!n.get().length&&c(T),x=o,o=null,x}function w(b,x,E,T){o&&g(!1),typeof x=="string"&&(T=E,E=x,x=null),T=O({},r,T||{});var L=T.data||{},A,j,H,N,G;if(T.trapClick?N=f:N=l,b?(A=bo(b)||b,j=Br(b),Zl(b),A.type==="dragstart"&&jr(A)):(A=null,j={x:0,y:0}),H=a(j),x||(x=H),G=bP(A),o=O({prefix:E,data:L,payload:{},globalStart:j,displacement:ii(x,H),localStart:H,isTouch:G},T),T.manual||(G?(Se.bind(document,"touchstart",d,!0),Se.bind(document,"touchcancel",g,!0),Se.bind(document,"touchmove",u,!0),Se.bind(document,"touchend",l,!0)):(Se.bind(document,"mousemove",u),Se.bind(document,"dragstart",jr),Se.bind(document,"selectstart",jr),Se.bind(document,"mousedown",N,!0),Se.bind(document,"mouseup",N,!0)),Se.bind(document,"keyup",p),e.on("element.hover",h),e.on("element.out",m)),s("init")===!1)return g(),!1;T.autoActivate&&u(b,!0)}e.on("diagram.destroy",g),this.init=w,this.move=u,this.hover=h,this.out=m,this.end=l,this.cancel=g,this.context=function(){return o},this.setOptions=function(b){O(r,b)}}ny.$inject=["eventBus","canvas","selection","elementRegistry"];const Li={__depends__:[iP,qn],dragging:["type",ny]};function So(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}So.prototype.next=function(){return this._prefix+ ++this._counter};const wP=new So("ps");var EP=["marker-start","marker-mid","marker-end"],SP=["circle","ellipse","line","path","polygon","polyline","path","rect"];function sr(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}sr.$inject=["elementRegistry","eventBus","canvas","styles"],sr.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")},sr.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},sr.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=mh(n);return this._cloneMarkers(Lr(r),i),re(r,this._styles.cls(i,[])),Re(t,r),re(r,"data-preview-support-element-id",e.id),r},sr.prototype.addFrame=function(e,t){var n=me("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return Re(t,n),re(n,"data-preview-support-element-id",e.id),n},sr.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),AP(e)&&EP.forEach(function(r){if(re(e,r)){var o=RP(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},sr.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,wP.next()].join("-"),a=et("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||mh(n);s.id=o,je(s).add(r);var c=et(":scope > defs",e);c||(c=me("defs"),Re(e,c)),Re(c,s);var u=PP(s.id);re(t,i,u)};function RP(e,t,n){var i=CP(re(e,t));return et("marker#"+i,n||document)}function CP(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function PP(e){return"url(#"+e+")"}function AP(e){return SP.indexOf(e.nodeName)!==-1}const Ro={__init__:["previewSupport"],previewSupport:["type",sr]};var TP="drop-ok",iy="drop-not-ok",ry="attach-ok",oy="new-parent",ay="create",MP=2e3;function sy(e,t,n,i,r){function o(c,u,l,p,f){if(!u)return!1;c=Oe(c,function(w){var b=w.labelTarget;return!w.parent&&!(Me(w)&&c.indexOf(b)!==-1)});var d=st(c,function(w){return!it(w)}),h=!1,m=!1,g=!1;uy(c)&&(h=r.allowed("shape.attach",{position:l,shape:d,target:u})),h||(uy(c)?g=r.allowed("shape.create",{position:l,shape:d,source:p,target:u}):g=r.allowed("elements.create",{elements:c,position:l,target:u}));var R=f.connectionTarget;return g||h?(d&&p&&(m=r.allowed("connection.create",{source:R===p?d:p,target:R===p?p:d,hints:{targetParent:u,targetAttach:h}})),{attach:h,connect:m}):g===null||h===null?null:!1}function a(c,u){[ry,TP,iy,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,p=c.hover,f=u.source,d=u.hints||{};if(!p){u.canExecute=!1,u.target=null;return}cy(c);var h={x:c.x,y:c.y},m=u.canExecute=p&&o(l,p,h,f,d);p&&m!==null&&(u.target=p,m&&m.attach?a(p,ry):a(p,m?oy:iy))}),n.on(["create.end","create.out","create.cleanup"],function(c){var u=c.hover;u&&a(u,null)}),n.on("create.end",function(c){var u=c.context,l=u.source,p=u.shape,f=u.elements,d=u.target,h=u.canExecute,m=h&&h.attach,g=h&&h.connect,R=u.hints||{};if(h===!1||!d)return!1;cy(c);var w={x:c.x,y:c.y};g?p=i.appendShape(l,p,w,d,{attach:m,connection:g===!0?{}:g,connectionTarget:R.connectionTarget}):(f=i.createElements(f,w,d,O({},R,{attach:m})),p=st(f,function(b){return!it(b)})),O(u,{elements:f,shape:p}),O(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===ay&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],MP,function(){n.off("elements.changed",s)})}),this.start=function(c,u,l){_e(u)||(u=[u]);var p=st(u,function(h){return!it(h)});if(p){l=O({elements:u,hints:{},shape:p},l||{}),M(u,function(h){we(h.x)||(h.x=0),we(h.y)||(h.y=0)});var f=Oe(u,function(h){return!h.hidden}),d=At(f);M(u,function(h){it(h)&&(h.waypoints=rn(h.waypoints,function(m){return{x:m.x-d.x-d.width/2,y:m.y-d.y-d.height/2}})),O(h,{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2})}),t.init(c,ay,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:u,context:l}})}}}sy.$inject=["canvas","dragging","eventBus","modeling","rules"];function cy(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 uy(e){return e&&e.length===1&&!it(e[0])}var kP=750;function ly(e,t,n,i,r){function o(a){var s=me("g");re(s,r.cls("djs-drag-group",["no-events"]));var c=me("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),Qt(l,u.x,u.y)),i.addDragger(u,s,l))}),s}t.on("create.move",kP,function(a){var s=a.hover,c=a.context,u=c.elements,l=c.dragGroup;l||(l=c.dragGroup=o(u));var p;s?(l.parentNode||(p=e.getActiveLayer(),Re(p,l)),Qt(l,a.x,a.y)):Ft(l)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&Ft(c)})}ly.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const uc={__depends__:[Li,Ro,gi,qn],__init__:["create","createPreview"],create:["type",sy],createPreview:["type",ly]};function _p(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)})}_p.$inject=["eventBus"],_p.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||DP(0,0)};function DP(e,t){var n=document.createEvent("MouseEvent"),i=e,r=t,o=e,a=t;return n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,i,r,o,a,!1,!1,!1,!1,0,null),n}const ma={__init__:["mouse"],mouse:["type",_p]};var py=2e3;function Mn(e,t,n,i,r,o,a,s){this._canvas=e,this._create=t,this._elementFactory=i,this._eventBus=r,this._modeling=o,this._mouse=a,this._rules=s,r.on("copyPaste.copyElement",function(c){var u=c.descriptor,l=c.element,p=c.elementsSet;u.priority=1,u.id=l.id,p.has(l.parent)&&(u.parent=l.parent.id),OP(l)&&(u.priority=2,u.host=l.host.id),it(l)&&(u.priority=3,u.source=l.source.id,u.target=l.target.id,u.waypoints=LP(l)),Me(l)&&(u.priority=4,u.labelTarget=l.labelTarget.id),M(["x","y","width","height"],function(f){we(l[f])&&(u[f]=l[f])}),u.hidden=l.hidden,u.collapsed=l.collapsed}),r.on("copyPaste.elementsCopied",py,function(c){var u;((u=c.hints)==null?void 0:u.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",py,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var u=c.hints;O(u,{createElementsBehavior:!1})})}Mn.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],Mn.prototype.copy=function(e,t={}){var n,i;return _e(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(_e(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},Mn.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})}}},Mn.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},Mn.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},Mn.prototype._getElementIdsFromTree=function(e){var t={};return M(e,function(n){M(n,function(i){i.id&&(t[i.id]=!0)})}),t},Mn.prototype._paste=function(e,t,n,i){M(e,function(o){we(o.x)||(o.x=0),we(o.y)||(o.y=0)});var r=At(e);return M(e,function(o){it(o)&&(o.waypoints=rn(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),O(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,O({},i))},Mn.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return M(e,function(o,a){o=oi(o,"priority"),M(o,function(s){var c=O({},ai(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var u;if(it(c)){c.source=i[s.source],c.target=i[s.target],u=i[s.id]=t.createConnection(c),r.push(u);return}if(Me(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},Mn.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(ai(e,["id"]));return t},Mn.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(ai(e,["id"]));return t},Mn.prototype.createShape=function(e){var t=this._elementFactory.createShape(ai(e,["id"]));return t},Mn.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(it(e)&&(!n.has(e.source)||!n.has(e.target))||Me(e)&&!n.has(e.labelTarget))},Mn.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=xs(e);function s(p,f){return t.allowed("element.copy",{element:p,elements:f})}function c(p,f){var d=o.get(p);if(!d){var h={element:p,depth:f};r.push(h),o.set(p,h);return}if(d.depth<f){r=u(d,r);var m={element:d.element,depth:f};r.push(m),o.set(p,m)}}function u(p,f){var d=f.indexOf(p);return d!==-1&&f.splice(d,1),f}Or(a,function(p,f,d){if(Me(p))return;M(p.labels,function(g){c(g,d)});function h(g){g&&g.length&&M(g,function(R){M(R.labels,function(w){c(w,d)}),c(R,d)})}M([p.attachers,p.incoming,p.outgoing],h),c(p,d);var m=[];return p.children&&(m=p.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:p,children:m}),m}),e=rn(r,function(p){return p.element});var l=new Set(e);return r=rn(r,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:l}),p}),r=oi(r,function(p){return p.descriptor.priority}),e=rn(r,function(p){return p.element}),M(r,function(p){var f=p.depth;if(!n.hasRelations(p.element,e,l)){dy(p.element,e),l.delete(p.element);return}if(!s(p.element,e)){dy(p.element,e),l.delete(p.element);return}i[f]||(i[f]=[]),i[f].push(p.descriptor)}),i};function OP(e){return!!e.host}function LP(e){return rn(e.waypoints,function(t){return t=fy(t),t.original&&(t.original=fy(t.original)),t})}function fy(e){return O({},e)}function dy(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const IP={__depends__:[tP,uc,ma,gi],__init__:["copyPaste"],copyPaste:["type",Mn]};function bp(e,t,n){_e(n)||(n=[n]),M(n,function(i){Sr(e[i])||(t[i]=e[i])})}var xp=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",xp,function(c){var u=c.descriptor,l=c.element,p=Z(l);if(Me(l))return u;var f=u.businessObject=i(p,!0),d=u.di=i(Ve(l),!0);d.bpmnElement=f,bp(f,u,"name"),bp(d,u,"isExpanded"),p.default&&(u.default=p.default.id)});var r="-bpmn-js-refs";function o(c){return c[r]=c[r]||{}}function a(c,u){c[r]=u}function s(c,u,l){var p=Z(c);return c.default&&(l[c.default]={element:p,property:"default"}),c.host&&(Z(c).attachedToRef=Z(u[c.host])),ai(l,Sn(l,function(f,d,h){var m=d.element,g=d.property;return h===c.id&&(m.set(g,p),f.push(c.id)),f},[]))}t.on("copyPaste.pasteElement",function(c){var u=c.cache,l=c.descriptor,p=l.businessObject,f=l.di;if(Me(l)){l.businessObject=Z(u[l.labelTarget]),l.di=Ve(u[l.labelTarget]);return}p=l.businessObject=i(p),f=l.di=i(f),f.bpmnElement=p,bp(l,p,["isExpanded","name"]),l.type=p.$type}),t.on("copyPaste.copyElement",xp,function(c){var u=c.descriptor,l=c.element;if(v(l,"bpmn:Participant")){var p=Z(l);p.processRef&&(u.processRef=i(p.processRef,!0))}}),t.on("copyPaste.pasteElement",function(c){var u=c.descriptor,l=u.processRef;l&&(u.processRef=i(l))}),t.on("copyPaste.createTree",function(c){var u=c.element,l=c.children;v(u,"bpmn:SubProcess")&&M(na(l),p=>{l.push(p.annotation)})}),t.on("copyPaste.pasteElement",xp,function(c){var u=c.cache,l=c.descriptor;a(u,s(l,u,o(u)))})}hy.$inject=["bpmnFactory","eventBus","moddleCopy"];const NP=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],BP=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function ga(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",i=>{const{propertyNames:r}=i;if(!(!r||!r.length))return oi(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=Gt(r)&&r.$descriptor;if(a&&BP.includes(a))return o;if(a&&NP.includes(a)||a&&s&&!st(s.properties,Jr({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:r}=i;if(v(r,"bpmn:ExtensionElements")&&(!r.values||!r.values.length))return!1})}ga.$inject=["eventBus","bpmnFactory","moddle"],ga.prototype.copyElement=function(e,t,n,i=!1){n&&!_e(n)&&(n=[n]),n=n||wp(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(_e(r)&&(n=r),M(n,o=>{let a;En(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!$t(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},ga.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 Gt(r)&&r.$type&&!r.$parent&&(r.$parent=t),r;const o=this._moddle.getPropertyDescriptor(t,n);if(!o.isReference)return o.isId?e&&this._copyId(e,t,i):_e(e)?Sn(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):Gt(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},ga.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 wp(e,t){return Sn(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const my={__depends__:[IP],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",hy],moddleCopy:["type",ga]};var gy=Math.round;function Ep(e,t){this._modeling=e,this._eventBus=t}Ep.$inject=["modeling","eventBus"],Ep.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),p=i.replaceShape(e,O({},t,{x:u,y:l,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:p,hints:n}),p};function yy(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}yy.$inject=["selection","eventBus"];const $P={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",yy],replace:["type",Ep]};function jP(e,t,n){_e(n)||(n=[n]),M(n,function(i){Sr(e[i])||(t[i]=e[i])})}var FP=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function HP(e,t){var n=e&&En(e,"collapsed")?e.collapsed:!$e(e),i;return t&&(En(t,"collapsed")||En(t,"isExpanded"))?i=En(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function vy(e,t,n,i,r,o){function a(s,c,u){u=u||{};var l=c.type,p=s.businessObject;if(lc(p)&&(l==="bpmn:SubProcess"||l==="bpmn:AdHocSubProcess")&&HP(s,c))return i.toggleCollapse(s),s;var f=e.create(l),d={type:l,businessObject:f};d.di={},l==="bpmn:ExclusiveGateway"&&(d.di.isMarkerVisible=!0),jP(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var h=wp(p.$descriptor),m=wp(f.$descriptor,!0),g=zP(h,m);O(f,ni(c,FP));var R=Oe(g,function(x){return x==="eventDefinitions"?_y(s,c.eventDefinitionType):x==="loopCharacteristics"?!cn(f):En(f,x)||x==="processRef"&&c.isExpanded===!1||x==="triggeredByEvent"?!1:x==="isForCompensation"?!cn(f):!0});if(f=n.copyElement(p,f,R),c.eventDefinitionType&&(_y(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),v(p,"bpmn:Activity")){if(lc(p))d.isExpanded=$e(s);else if(c&&En(c,"isExpanded")){d.isExpanded=c.isExpanded;var w=t.getDefaultSize(f,{isExpanded:d.isExpanded});d.width=w.width,d.height=w.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}$e(s)&&!v(p,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(lc(p)&&!lc(f)&&(u.moveChildren=!1),v(p,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):u.moveChildren=!1;var b=Yt(s);Ve(s).isHorizontal||(Ve(d).isHorizontal=b),d.width=b?s.width:t.getDefaultSize(d).width,d.height=b?t.getDefaultSize(d).height:s.height}return o.allowed("shape.resize",{shape:f})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),f.name=p.name,De(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&De(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(f.default=p.default),c.host&&!v(p,"bpmn:BoundaryEvent")&&v(f,"bpmn:BoundaryEvent")&&(d.host=c.host),(d.type==="bpmn:DataStoreReference"||d.type==="bpmn:DataObjectReference")&&(d.x=s.x+(s.width-d.width)/2),r.replaceElement(s,d,{...u,targetElement:c})}this.replaceElement=a}vy.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function lc(e){return v(e,"bpmn:SubProcess")}function _y(e,t){var n=Z(e);return t&&n.get("eventDefinitions").some(function(i){return v(i,t)})}function zP(e,t){return e.filter(function(n){return t.includes(n)})}const by={__depends__:[my,$P,qn],bpmnReplace:["type",vy]};var VP=250;function Fr(e){this._eventBus=e,this._tools=[],this._active=null}Fr.$inject=["eventBus"],Fr.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)},Fr.prototype.isActive=function(e){return e&&this._active===e},Fr.prototype.length=function(e){return this._tools.length},Fr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Fr.prototype.bindEvents=function(e,t){var n=this._eventBus,i=[];n.on(t.tool+".init",function(r){var o=r.context;if(!o.reactivate&&this.isActive(e)){this.setActive(null);return}this.setActive(e)},this),M(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,VP,function(r){this._active&&(GP(r)||this.setActive(null))},this)};function GP(e){var t=e.originalEvent&&e.originalEvent.target;return t&&kr(t,'.group[data-group="tools"]')}const pc={__depends__:[Li],__init__:["toolManager"],toolManager:["type",Fr]};function WP(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 UP(e,t){var n=[],i=new Set(e);M(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,s=o.outgoing;M(a.concat(s),function(c){var u=c.source,l=c.target;(i.has(u)||i.has(l))&&(r.has(c)||(r.add(c),n.push(c)))})}),n}function YP(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 Sp=Math.abs,qP=Math.round,Ii={x:"width",y:"height"},xy="crosshair",cr={n:"top",w:"left",s:"bottom",e:"right"},KP=1500,fc={n:"s",w:"e",s:"n",e:"w"},dc=20;function Kn(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",KP,function(c){var u=c.context,l=u.initialized;l||(l=u.initialized=s.init(c,u)),l&&Ey(c)}),n.on("spaceTool.end",function(c){var u=c.context,l=u.axis,p=u.direction,f=u.movingShapes,d=u.resizingShapes,h=u.start;if(u.initialized){Ey(c);var m={x:0,y:0};m[l]=qP(c["d"+l]),s.makeSpace(f,d,m,p,h),n.once("spaceTool.ended",function(g){s.activateSelection(g.originalEvent,!0,!0)})}})}Kn.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Kn.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:xy,data:{context:{reactivate:n}},trapClick:!1})},Kn.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:xy,data:{context:{}}})},Kn.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},Kn.prototype.init=function(e,t){var n=Sp(e.dx)>Sp(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(Sp(i)<5)return!1;i<0&&(i*=-1),fa(e)&&(i*=-1);var o=WP(n,i),a=this._canvas.getRootElement();!ec(e)&&e.hover&&(a=e.hover);var s=[...Xo(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=XP(c,n,o,r,u);return O(t,c,{axis:n,direction:o,spaceToolConstraints:l,start:r}),cc("resize-"+(n==="x"?"ew":"ns")),!0},Kn.prototype.calculateAdjustments=function(e,t,n,i){var r=this._rules,o=[],a=[],s=new Set,c=new Set,u=[],l=[];function p(d){s.has(d)||(s.add(d),o.push(d));var h=d.label;h&&!s.has(h)&&(s.add(h),o.push(h))}function f(d){c.has(d)||(c.add(d),a.push(d))}return M(e,function(d){if(!(!d.parent||Me(d))){if(it(d)){l.push(d);return}var h=d[t],m=h+d[Ii[t]];if(ZP(d)&&(n>0&&be(d)[t]>i||n<0&&be(d)[t]<i)){u.push(d);return}if(n>0&&h>i||n<0&&m<i){p(d);return}if(h<i&&m>i&&r.allowed("shape.resize",{shape:d})){f(d);return}}}),M(o,function(d){var h=d.attachers;h&&M(h,function(m){p(m)})}),M(u,function(d){var h=d.host;(s.has(h)||c.has(h))&&p(d)}),M(l,function(d){var h=d.source,m=d.target,g=d.label;(s.has(h)||c.has(h))&&(s.has(m)||c.has(m))&&g&&p(g)}),{movingShapes:o,resizingShapes:a}},Kn.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Kn.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function wy(e){return{top:e.top-dc,right:e.right+dc,bottom:e.bottom+dc,left:e.left-dc}}function Ey(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;we(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),we(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),we(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),we(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function XP(e,t,n,i,r){var o=e.movingShapes,a=e.resizingShapes;if(a.length){var s={},c,u,l=new Set(o),p=new Set(a);return M(a,function(f){var d=f.attachers,h=f.children,m=ye(f),g=Oe(h,function(G){return!it(G)&&!Me(G)&&!l.has(G)&&!p.has(G)}),R=Oe(h,function(G){return!it(G)&&!Me(G)&&l.has(G)}),w,b,x,E=[],T=[],L,A,j,H;g.length&&(b=wy(ye(At(g))),w=i-m[cr[n]]+b[cr[n]],n==="n"?s.bottom=u=we(u)?Math.min(u,w):w:n==="w"?s.right=u=we(u)?Math.min(u,w):w:n==="s"?s.top=c=we(c)?Math.max(c,w):w:n==="e"&&(s.left=c=we(c)?Math.max(c,w):w)),R.length&&(x=wy(ye(At(R))),w=i-x[cr[fc[n]]]+m[cr[fc[n]]],n==="n"?s.bottom=u=we(u)?Math.min(u,w):w:n==="w"?s.right=u=we(u)?Math.min(u,w):w:n==="s"?s.top=c=we(c)?Math.max(c,w):w:n==="e"&&(s.left=c=we(c)?Math.max(c,w):w)),d&&d.length&&(d.forEach(function(G){l.has(G)?E.push(G):T.push(G)}),E.length&&(L=ye(At(E.map(be))),A=m[cr[fc[n]]]-(L[cr[fc[n]]]-i)),T.length&&(j=ye(At(T.map(be))),H=j[cr[n]]-(m[cr[n]]-i)),n==="n"?(w=Math.min(A||1/0,H||1/0),s.bottom=u=we(u)?Math.min(u,w):w):n==="w"?(w=Math.min(A||1/0,H||1/0),s.right=u=we(u)?Math.min(u,w):w):n==="s"?(w=Math.max(A||-1/0,H||-1/0),s.top=c=we(c)?Math.max(c,w):w):n==="e"&&(w=Math.max(A||-1/0,H||-1/0),s.left=c=we(c)?Math.max(c,w):w));var N=r&&r[f.id];N&&(n==="n"?(w=i+f[Ii[t]]-N[Ii[t]],s.bottom=u=we(u)?Math.min(u,w):w):n==="w"?(w=i+f[Ii[t]]-N[Ii[t]],s.right=u=we(u)?Math.min(u,w):w):n==="s"?(w=i-f[Ii[t]]+N[Ii[t]],s.top=c=we(c)?Math.max(c,w):w):n==="e"&&(w=i-f[Ii[t]]+N[Ii[t]],s.left=c=we(c)?Math.max(c,w):w))}),s}}function ZP(e){return!!e.host}var Rp="djs-dragging",Sy="djs-resizing",QP=250,hc=Math.max;function Ry(e,t,n,i,r){function o(a,s){M(a,function(c){r.addDragger(c,s),n.addMarker(c,Rp)})}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=me("g");re(l,i.cls("djs-crosshair-group",["no-events"])),Re(s,l);var p=me("path");re(p,"d",u.x),je(p).add("djs-crosshair"),Re(l,p);var f=me("path");re(f,"d",u.y),je(f).add("djs-crosshair"),Re(l,f),c.crosshairGroup=l}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;Qt(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",QP,function(a){var s=a.context,c=s.line,u=s.axis,l=s.movingShapes,p=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var f=n.getLayer("space");c=me("path"),re(c,"d","M0,0 L0,0"),je(c).add("djs-crosshair"),Re(f,c),s.line=c;var d=me("g");re(d,i.cls("djs-drag-group",["no-events"])),Re(n.getActiveLayer(),d),o(l,d);var h=new Set(l);M(p,function(T){h.add(T)});var m=new Set,g=s.movingConnections=[];h.forEach(function(T){M(T.outgoing,function(L){m.has(L)||!it(L)||!h.has(L.target)||(m.add(L),g.push(L))})}),o(g,d),s.dragGroup=d}if(!s.frameGroup){var R=me("g");re(R,i.cls("djs-frame-group",["no-events"])),Re(n.getActiveLayer(),R);var w=[];M(p,function(T){var L=r.addFrame(T,R),A=L.getBBox();w.push({element:L,initialBounds:A}),n.addMarker(T,Sy)}),s.frameGroup=R,s.frames=w}var b={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};re(c,{d:b[u]});var x={x:"y",y:"x"},E={x:a.dx,y:a.dy};E[x[s.axis]]=0,Qt(s.dragGroup,E.x,E.y),M(s.frames,function(T){var L=T.element,A=T.initialBounds,j,H;s.direction==="e"?re(L,{width:hc(A.width+E.x,5)}):(j=hc(A.width-E.x,5),re(L,{width:j,x:A.x+A.width-j})),s.direction==="s"?re(L,{height:hc(A.height+E.y,5)}):(H=hc(A.height-E.y,5),re(L,{height:H,y:A.y+A.height-H}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,u=s.movingConnections,l=s.resizingShapes,p=s.line,f=s.dragGroup,d=s.frameGroup;M(c,function(h){n.removeMarker(h,Rp)}),M(u,function(h){n.removeMarker(h,Rp)}),f&&(Ft(p),Ft(f)),M(l,function(h){n.removeMarker(h,Sy)}),d&&Ft(d)})}Ry.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const JP={__init__:["spaceToolPreview"],__depends__:[Li,gi,pc,Ro,ma],spaceTool:["type",Kn],spaceToolPreview:["type",Ry]};function mc(e,t){e.invoke(Kn,this),this._canvas=t}mc.$inject=["injector","canvas"],ie(mc,Kn),mc.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=Zr(ao(r.children.filter(u=>v(u,"bpmn:Artifact")),At(o))));const s=[...e,...a];var c=Kn.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(u){return!(v(u,"bpmn:TextAnnotation")||eA(u)&&(t==="y"&&Yt(u)||t==="x"&&!Yt(u)))}),c};function eA(e){return v(e,"bpmn:Participant")&&!Z(e).processRef}const Cy={__depends__:[JP],spaceTool:["type",mc]};function vt(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)}vt.$inject=["eventBus","injector"],vt.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()},vt.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},vt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},vt.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()}},vt.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()}},vt.prototype.register=function(e,t){this._setHandler(e,t)},vt.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)},vt.prototype.canUndo=function(){return!!this._getUndoAction()},vt.prototype.canRedo=function(){return!!this._getRedoAction()},vt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},vt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},vt.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)})},vt.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},vt.prototype._createId=function(){return this._uid++},vt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},vt.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()},vt.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)},vt.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:Uf("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},vt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=_e(e)?e:[e],t.dirty=t.dirty.concat(e))},vt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},vt.prototype._revertedAction=function(e){this._stackIdx--},vt.prototype._getHandler=function(e){return this._handlerMap[e]},vt.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 tA={commandStack:["type",vt]};function ur(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 nA=250,Py=1400;function Cp(e,t,n){X.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",Py,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=Ay(a),o.validatedShapes=Ay(s)}),i&&t.on("shape.move.start",nA,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",Py,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];M(s,function(u){M(u.labels,function(l){s[l.id]||c.push(l)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(r){var o=r.context,a=o.connection||o.shape;ur(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=ol(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&&(St(s.labels,a,c),a.labelTarget=s)})}ie(Cp,X),Cp.$inject=["injector","eventBus","modeling"];function Ay(e){var t=new Set(e);return Oe(e,function(n){return!t.has(n.labelTarget)})}const iA={__init__:["labelSupport"],labelSupport:["type",Cp]};var rA=251,Ty=1401,My="attach-ok";function Pp(e,t,n,i,r){X.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",Ty,function(a){var s=a.context,c=s.shapes,u=s.validatedShapes;s.shapes=oA(c),s.validatedShapes=aA(u)}),o&&t.on("shape.move.start",rA,function(a){var s=a.context,c=s.shapes,u=Ap(c);M(u,function(l){o.makeDraggable(s,l,!0),M(l.labels,function(p){o.makeDraggable(s,p,!0)})})}),o&&t.on("shape.move.start",function(a){var s=a.context,c=s.shapes;if(c.length===1){var u=c[0],l=u.host;l&&(n.addMarker(l,My),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(l,My)}))}}),this.preExecuted("elements.move",Ty,function(a){var s=a.context,c=s.closure,u=s.shapes,l=Ap(u);M(l,function(p){c.add(p,c.topLevel[p.host.id])})}),this.postExecuted("elements.move",function(a){var s=a.context,c=s.shapes,u=s.newHost,l;u&&c.length!==1||(u?l=c:l=Oe(c,function(p){var f=p.host;return sA(p)&&!cA(c,f)}),M(l,function(p){r.updateAttachment(p,u)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;M(s,function(c){M(c.attachers,function(u){M(u.outgoing.slice(),function(l){var p=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});p||r.removeConnection(l)}),M(u.incoming.slice(),function(l){var p=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});p||r.removeConnection(l)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,u=s.host;u&&r.updateAttachment(c,u)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,u=s.newShape;ur(c.attachers,function(l){var p=i.allowed("elements.move",{target:u,shapes:[l]});p==="attach"?r.updateAttachment(l,u):r.removeShape(l)}),u.attachers.length&&M(u.attachers,function(l){var p=qm(l,c,u);r.moveShape(l,p,l.parent)})}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.oldBounds,l=s.newBounds,p=c.attachers,f=s.hints||{};f.attachSupport!==!1&&M(p,function(d){var h=qm(d,u,l);r.moveShape(d,h,d.parent),M(d.labels,function(m){r.moveShape(m,h,m.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;ur(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}ie(Pp,X),Pp.$inject=["injector","eventBus","canvas","rules","modeling"];function Ap(e){return Eu(rn(e,function(t){return t.attachers||[]}))}function oA(e){var t=Ap(e);return Kx("id",e,t)}function aA(e){var t=Qr(e,"id");return Oe(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function sA(e){return!!e.host}function cA(e,t){return e.indexOf(t)!==-1}const uA={__depends__:[gi],__init__:["attachSupport"],attachSupport:["type",Pp]};function ky(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(Eh(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)})}ky.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const Tp={__init__:["changeSupport"],changeSupport:["type",ky]};function Xn(e){this._model=e}Xn.$inject=["moddle"],Xn.prototype._needsId=function(e){return De(e,["bpmn:RootElement","bpmn:FlowElement","bpmn:MessageFlow","bpmn:DataAssociation","bpmn:Artifact","bpmn:Participant","bpmn:Lane","bpmn:LaneSet","bpmn:Process","bpmn:Collaboration","bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane","bpmn:Property","bpmn:CategoryValue"])},Xn.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;v(e,"bpmn:Activity")?t="Activity":v(e,"bpmn:Event")?t="Event":v(e,"bpmn:Gateway")?t="Gateway":De(e,["bpmn:SequenceFlow","bpmn:MessageFlow"])?t="Flow":t=(e.$type||"").replace(/^[^:]*:/g,""),t+="_",!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e))},Xn.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Xn.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Xn.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",O({bpmnElement:e,bounds:this.createDiBounds()},t))},Xn.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Xn.prototype.createDiWaypoints=function(e){var t=this;return rn(e,function(n){return t.createDiWaypoint(n)})},Xn.prototype.createDiWaypoint=function(e){return this.create("dc:Point",ni(e,["x","y"]))},Xn.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",O({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Xn.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",O({bpmnElement:e},t))};function kn(e,t,n){X.call(this,e),this._bpmnFactory=t;var i=this;function r(d){var h=d.context,m=h.hints||{},g;!h.cropped&&m.createElementsBehavior!==!1&&(g=h.connection,g.waypoints=n.getCroppedWaypoints(g),h.cropped=!0)}this.executed(["connection.layout","connection.create"],r),this.reverted(["connection.layout"],function(d){delete d.context.cropped});function o(d){var h=d.context;i.updateParent(h.shape||h.connection,h.oldParent)}function a(d){var h=d.context,m=h.shape||h.connection,g=h.parent||h.newParent;i.updateParent(m,g)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Dn(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Dn(a));function s(d){var h=d.context,m=h.oldRoot,g=m.children;M(g,function(R){v(R,"bpmn:BaseElement")&&i.updateParent(R)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var h=d.context.shape;v(h,"bpmn:BaseElement")&&i.updateBounds(h)}this.executed(["shape.move","shape.create","shape.resize"],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 h=d.context,m=h.connection,g=h.oldSource,R=h.newSource,w=Z(m),b=Z(g),x=Z(R);w.conditionExpression&&!De(x,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(h.oldConditionExpression=w.conditionExpression,delete w.conditionExpression),g!==R&&b.default===w&&(h.oldDefault=b.default,delete b.default)})),this.reverted("connection.reconnect",Dn(function(d){var h=d.context,m=h.connection,g=h.oldSource,R=h.newSource,w=Z(m),b=Z(g),x=Z(R);h.oldConditionExpression&&(w.conditionExpression=h.oldConditionExpression),h.oldDefault&&(b.default=h.oldDefault,delete x.default)}));function p(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],Dn(p)),this.reverted(["element.updateAttachment"],Dn(p)),this.executed("element.updateLabel",Dn(f)),this.reverted("element.updateLabel",Dn(f));function f(d){const{element:h}=d.context,m=jn(h),g=Ve(h),R=g&&g.get("label");nr(h)||tc(h)||(m&&!R?g.set("label",t.create("bpmndi:BPMNLabel")):!m&&R&&g.set("label",void 0))}}ie(kn,X),kn.$inject=["eventBus","bpmnFactory","connectionDocking"],kn.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},kn.prototype.updateParent=function(e,t){if(!Me(e)&&!(v(e,"bpmn:DataStoreReference")&&e.parent&&v(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=Ve(e),o=n&&n.businessObject,a=Ve(n);v(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),v(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),v(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(i,o),v(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},kn.prototype.updateBounds=function(e){var t=Ve(e),n=pA(e);if(n){var i=ii(n,t.get("bounds"));O(n,{x:e.x+i.x,y:e.y+i.y})}var r=Me(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),O(o,{x:e.x,y:e.y,width:e.width,height:e.height})},kn.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;v(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),wt(i,e)),v(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),St(r,e))}},kn.prototype.updateDiConnection=function(e,t,n){var i=Ve(e),r=Ve(t),o=Ve(n);i.sourceElement&&i.sourceElement.bpmnElement!==Z(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==Z(n)&&(i.targetElement=n&&o)},kn.prototype.updateDiParent=function(e,t){if(t&&!v(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(wt(n,e),e.$parent=null)}};function lA(e){for(;e&&!v(e,"bpmn:Definitions");)e=e.$parent;return e}kn.prototype.getLaneSet=function(e){var t,n;return v(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(v(e,"bpmn:Participant")&&(e=e.processRef),n=e.get("laneSets"),t=n[0],t||(t=this._bpmnFactory.create("bpmn:LaneSet"),t.$parent=e,n.push(t)),t)},kn.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((v(e,"bpmn:DataInput")||v(e,"bpmn:DataOutput"))&&(v(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(v(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(v(e,"bpmn:FlowElement")){if(t){if(v(t,"bpmn:Participant"))t=t.processRef;else if(v(t,"bpmn:Lane"))do t=t.$parent.$parent;while(v(t,"bpmn:Lane"))}i="flowElements"}else if(v(e,"bpmn:Artifact")){for(;t&&!v(t,"bpmn:Process")&&!v(t,"bpmn:SubProcess")&&!v(t,"bpmn:Collaboration");)if(v(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(v(e,"bpmn:MessageFlow"))i="messageFlows";else if(v(e,"bpmn:Participant")){i="participants";var r=e.processRef,o;r&&(o=lA(e.$parent||t),e.$parent&&(wt(o.get("rootElements"),r),r.$parent=null),t&&(St(o.get("rootElements"),r),r.$parent=o))}else v(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":v(e,"bpmn:DataInputAssociation")&&(i="dataInputAssociations");if(!i)throw new Error(`no parent for <${e.id}> in <${t.id}>`);var a;if(e.$parent&&(a=e.$parent.get(i),wt(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);wt(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},kn.prototype.updateConnectionWaypoints=function(e){var t=Ve(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},kn.prototype.updateConnection=function(e){var t=e.connection,n=Z(t),i=t.source,r=Z(i),o=t.target,a=Z(t.target),s;if(v(n,"bpmn:DataAssociation"))v(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=r,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):v(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||r,this.updateSemanticParent(n,r,s),n.targetRef=a);else{var c=v(n,"bpmn:SequenceFlow");n.sourceRef!==r&&(c&&(wt(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(wt(n.targetRef&&n.targetRef.get("incoming"),n),a&&a.get("incoming")&&a.get("incoming").push(n)),n.targetRef=a)}this.updateConnectionWaypoints(t),this.updateDiConnection(t,i,o)},kn.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;v(i,"bpmn:BaseElement")&&e(t)}}function pA(e){if(v(e,"bpmn:Activity")){var t=Ve(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function lr(e,t){Mi.call(this),this._bpmnFactory=e,this._moddle=t}ie(lr,Mi),lr.$inject=["bpmnFactory","moddle"],lr.prototype._baseCreate=Mi.prototype.create,lr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,O({type:"label",di:n},Ir,t))}return this.createElement(e,t)},lr.prototype.createElement=function(e,t){t=O({},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(!dA(r)){var o=O({},r||{},{id:i.id+"_di"});e==="root"?r=this._bpmnFactory.createDiPlane(i,o):e==="connection"?r=this._bpmnFactory.createDiEdge(i,o):r=this._bpmnFactory.createDiShape(i,o)}v(i,"bpmn:Group")&&(t=O({isFrame:!0},t)),t=fA(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Mp(r,t,"isExpanded")),De(i,["bpmn:Lane","bpmn:Participant"])&&(t=Mp(r,t,"isHorizontal")),v(i,"bpmn:SubProcess")&&(t.collapsed=!$e(i,r)),v(i,"bpmn:ExclusiveGateway")&&(En(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),$t(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),$t(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=O({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},lr.prototype.getDefaultSize=function(e,t){var n=Z(e);if(t=t||Ve(e),v(n,"bpmn:SubProcess"))return $e(n,t)?{width:350,height:200}:{width:100,height:80};if(v(n,"bpmn:Task"))return{width:100,height:80};if(v(n,"bpmn:Gateway"))return{width:50,height:50};if(v(n,"bpmn:Event"))return{width:36,height:36};if(v(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return $e(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return v(n,"bpmn:Lane")?{width:400,height:100}:v(n,"bpmn:DataObjectReference")?{width:36,height:50}:v(n,"bpmn:DataStoreReference")?{width:50,height:50}:v(n,"bpmn:TextAnnotation")?{width:100,height:40}:v(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},lr.prototype.createParticipantShape=function(e){return Gt(e)||(e={isExpanded:e}),e=O({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function fA(e,t,n){return M(n,function(i){t=Mp(e,t,i)}),t}function Mp(e,t,n){return t[n]===void 0?t:(e[n]=t[n],ai(t,[n]))}function dA(e){return De(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function gc(e,t){this._modeling=e,this._canvas=t}gc.$inject=["modeling","canvas"],gc.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;M(n,function(r){var o={x:0,y:0};$t(i.left)?o.x=i.left-r.x:$t(i.right)?o.x=i.right-r.width-r.x:$t(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:$t(i.top)?o.y=i.top-r.y:$t(i.bottom)?o.y=i.bottom-r.height-r.y:$t(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},gc.prototype.postExecute=function(e){};function yc(e){this._modeling=e}yc.$inject=["modeling"],yc.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},yc.prototype.postExecute=function(e){var t=e.hints||{};hA(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 hA(e,t){return Vi(e.outgoing,function(n){return n.target===t})}function vc(e,t){this._canvas=e,this._layouter=t}vc.$inject=["canvas","layouter"],vc.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},vc.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var _c=Math.round;function kp(e){this._modeling=e}kp.$inject=["modeling"],kp.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;M(t,function(p){we(p.x)||(p.x=0),we(p.y)||(p.y=0)});var s=Oe(t,function(p){return!p.hidden}),c=At(s);M(t,function(p){it(p)&&(p.waypoints=rn(p.waypoints,function(f){return{x:_c(f.x-c.x-c.width/2+r.x),y:_c(f.y-c.y-c.height/2+r.y)}})),O(p,{x:_c(p.x-c.x-c.width/2+r.x),y:_c(p.y-c.y-c.height/2+r.y)})});var u=new Set(xs(t)),l={};M(t,function(p){if(it(p)){l[p.id]=we(i)?a.createConnection(l[p.source.id],l[p.target.id],i,p,p.parent||n,o):a.createConnection(l[p.source.id],l[p.target.id],p,p.parent||n,o);return}var f=O({},o);u.has(p)||(f.autoResize=!1),Me(p)&&(f=ai(f,["attach"])),l[p.id]=we(i)?a.createShape(p,ni(p,["x","y","width","height"]),p.parent||n,i,f):a.createShape(p,ni(p,["x","y","width","height"]),p.parent||n,f)}),e.elements=Zr(l)};var Dy=Math.round;function pr(e){this._canvas=e}pr.$inject=["canvas"],pr.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?O(t,n):O(t,{x:n.x-Dy(t.width/2),y:n.y-Dy(t.height/2)}),this._canvas.addShape(t,i,r),t},pr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function ya(e){pr.call(this,e)}ie(ya,pr),ya.$inject=["canvas"];var mA=pr.prototype.execute;ya.prototype.execute=function(e){var t=e.shape;return yA(t),t.labelTarget=e.labelTarget,mA.call(this,e)};var gA=pr.prototype.revert;ya.prototype.revert=function(e){return e.shape.labelTarget=null,gA.call(this,e)};function yA(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function va(e,t){this._canvas=e,this._modeling=t}va.$inject=["canvas","modeling"],va.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;ur(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),ur(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},va.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=ol(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},va.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,St(n.children,t,i),this._canvas.addConnection(t,n),t};function Dp(e,t){this._modeling=e,this._elementRegistry=t}Dp.$inject=["modeling","elementRegistry"],Dp.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;M(i,function(r){n.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};function _a(e,t){this._canvas=e,this._modeling=t}_a.$inject=["canvas","modeling"],_a.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;ur(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),ur(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),ur(n.children,function(i){it(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},_a.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=ol(i.children,n),t.removeShape(n),n},_a.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return St(i.children,n,r),t.addShape(n,i),n};function bc(e){this._modeling=e}bc.$inject=["modeling"];var Oy={x:"y",y:"x"};bc.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(g,R){g.range.min=Math.min(R[i],g.range.min),g.range.max=Math.max(R[i]+R[r],g.range.max)}function a(g){return g[i]+g[r]/2}function s(g){return g.length-1}function c(g){return g.max-g.min}function u(g,R){var w={y:0};w[i]=g-a(R),w[i]&&(w[Oy[i]]=0,t.moveElements([R],w,R.parent))}var l=n[0],p=s(n),f=n[p],d,h,m=0;M(n,function(g,R){var w,b,x;if(g.elements.length<2){R&&R!==n.length-1&&(o(g,g.elements[0]),m+=c(g.range));return}w=oi(g.elements,i),b=w[0],R===p&&(b=w[s(w)]),x=a(b),g.range=null,M(w,function(E){if(u(x,E),g.range===null){g.range={min:E[i],max:E[i]+E[r]};return}o(g,E)}),R&&R!==n.length-1&&(m+=c(g.range))}),h=Math.abs(f.range.min-l.range.max),d=Math.round((h-m)/(n.length-1)),!(d<n.length-1)&&M(n,function(g,R){var w={},b;g===l||g===f||(b=n[R-1],g.range.max=0,M(g.elements,function(x,E){w[Oy[i]]=0,w[i]=b.range.max-x[i]+d,g.range.min!==x[i]&&(w[i]+=x[i]-g.range.min),w[i]&&t.moveElements([x],w,x.parent),g.range.max=Math.max(x[i]+x[r],E?g.range.max:0)}))})},bc.prototype.postExecute=function(e){};function xc(e,t){this._layouter=e,this._canvas=t}xc.$inject=["layouter","canvas"],xc.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return O(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},xc.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Op(){}Op.prototype.execute=function(e){var t=e.connection,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldParent=o,e.oldParentIndex=wt(o.children,t),St(i.children,t,r),t.parent=i,M(t.waypoints,function(a){a.x+=n.x,a.y+=n.y,a.original&&(a.original.x+=n.x,a.original.y+=n.y)}),t},Op.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return wt(n.children,t),St(i.children,t,r),t.parent=i,M(t.waypoints,function(a){a.x-=o.x,a.y-=o.y,a.original&&(a.original.x-=o.x,a.original.y-=o.y)}),t};function Lp(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Lp.prototype.add=function(e,t){return this.addAll([e],t)},Lp.prototype.addAll=function(e,t){var n=YE(e,!!t,this);return O(this,n),this};function ba(e){this._modeling=e}ba.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},ba.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,u=e.topLevel,l=!1;r&&r.parent===n&&(l=!0),M(a,function(p){o.moveShape(p,t,u[p.id]&&!l&&n,{recurse:!1,layout:!1})}),M(s,function(p){var f=!!a[p.source.id],d=!!a[p.target.id];c[p.id]&&f&&d?o.moveConnection(p,t,u[p.id]&&!l&&n):o.layoutConnection(p,{connectionStart:f&&Hl(p,p.source,t),connectionEnd:d&&zl(p,p.target,t)})})},ba.prototype.getClosure=function(e){return new Lp().addAll(e,!0)};function wc(e){this._helper=new ba(e)}wc.$inject=["modeling"],wc.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},wc.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 ba(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=ni(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=wt(o.children,t),St(i.children,t,r),O(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&&(M(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:zl(o,t,n)})}),M(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:Hl(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 St(n.children,t,i),O(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 xa(e){this._modeling=e}xa.$inject=["modeling"],xa.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,i=e.connection,r=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return _e(r)&&(e.oldWaypoints=i.waypoints,i.waypoints=r),t&&(e.oldSource=i.source,i.source=t),n&&(e.oldTarget=i.target,i.target=n),i},xa.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||Ly(_e(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||Ly(_e(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},xa.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 Ly(e){return e.original||e}function Ni(e,t){this._modeling=e,this._rules=t}Ni.$inject=["modeling","rules"],Ni.prototype.preExecute=function(e){var t=this,n=this._modeling,i=this._rules,r=e.oldShape,o=e.newData,a=e.hints||{},s;function c(h,m,g){return i.allowed("connection.reconnect",{connection:g,source:h,target:m})}var u={x:o.x,y:o.y},l={x:r.x,y:r.y,width:r.width,height:r.height};s=e.newShape=e.newShape||t.createShape(o,u,r.parent,a),r.host&&n.updateAttachment(s,r.host);var p;a.moveChildren!==!1&&(p=r.children.slice(),n.moveElements(p,{x:0,y:0},s,a));var f=r.incoming.slice(),d=r.outgoing.slice();M(f,function(h){var m=h.source,g=c(m,s,h);g&&t.reconnectEnd(h,s,Ks(h,s,l),a)}),M(d,function(h){var m=h.target,g=c(s,m,h);g&&t.reconnectStart(h,s,qs(h,s,l),a)})},Ni.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Ni.prototype.execute=function(e){},Ni.prototype.revert=function(e){},Ni.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},Ni.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},Ni.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function wa(e){this._modeling=e}wa.$inject=["modeling"],wa.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},O(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},wa.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(M(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:Ks(o,n,i)})}),M(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:qs(o,n,i)})}))},wa.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return O(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function fr(e){this._modeling=e}fr.$inject=["modeling"],fr.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,r=e.resizingShapes,o=e.start,a={};this.moveShapes(i,t),M(r,function(s){a[s.id]=_A(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(UP(i,r),t,n,o,i,r,a)},fr.prototype.execute=function(){},fr.prototype.revert=function(){},fr.prototype.moveShapes=function(e,t){var n=this;M(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},fr.prototype.resizeShapes=function(e,t,n){var i=this;M(e,function(r){var o=YP(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},fr.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=new Set(r),u=new Set(o);M(e,function(l){var p=l.source,f=l.target,d=vA(l),h=Ny(n),m={},g=c.has(p)||u.has(p),R=c.has(f)||u.has(f);g&&R?(d=rn(d,function(w){return By(w,i,n)&&(w[h]=w[h]+t[h]),w.original&&By(w.original,i,n)&&(w.original[h]=w.original[h]+t[h]),w}),s._modeling.updateWaypoints(l,d,{labelBehavior:!1})):(g||R)&&(c.has(p)?m.connectionStart=Hl(l,p,t):c.has(f)?m.connectionEnd=zl(l,f,t):u.has(p)?m.connectionStart=qs(l,p,a[p.id]):u.has(f)&&(m.connectionEnd=Ks(l,f,a[f.id])),s._modeling.layoutConnection(l,m))})};function Iy(e){return O({},e)}function vA(e){return rn(e.waypoints,function(t){return t=Iy(t),t.original&&(t.original=Iy(t.original)),t})}function Ny(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function By(e,t,n){var i=Ny(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function _A(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Ec(e){this._modeling=e}Ec.$inject=["modeling"],Ec.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=$y(n),t.collapsed=!t.collapsed;var i=jy(n,t.collapsed);return[t].concat(i)},Ec.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=Fy(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function $y(e){var t={};return M(e,function(n){t[n.id]=n.hidden,n.children&&(t=O({},t,$y(n.children)))}),t}function jy(e,t){var n=[];return M(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(jy(i.children,i.collapsed||t)))}),n}function Fy(e,t){var n=[];return M(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(Fy(i.children,t)))}),n}function Sc(e){this._modeling=e}Sc.$inject=["modeling"],Sc.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Hy(i,t),zy(n,t),t.host=n,t},Sc.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,Hy(n,t),zy(i,t,r),t};function Hy(e,t){return wt(e&&e.attachers,t)}function zy(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),St(i,t,n)}}function Ip(){}Ip.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},Ip.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function rt(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}rt.$inject=["eventBus","elementFactory","commandStack"],rt.prototype.getHandlers=function(){return{"shape.append":yc,"shape.create":pr,"shape.delete":_a,"shape.move":Hr,"shape.resize":wa,"shape.replace":Ni,"shape.toggleCollapse":Ec,spaceTool:fr,"label.create":ya,"connection.create":vc,"connection.delete":va,"connection.move":Op,"connection.layout":xc,"connection.updateWaypoints":Ip,"connection.reconnect":xa,"elements.create":kp,"elements.move":wc,"elements.delete":Dp,"elements.distribute":bc,"elements.align":gc,"element.updateAttachment":Sc}},rt.prototype.registerHandlers=function(e){M(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},rt.prototype.moveShape=function(e,t,n,i,r){typeof i=="object"&&(r=i,i=null);var o={shape:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("shape.move",o)},rt.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},rt.prototype.moveElements=function(e,t,n,i){i=i||{};var r=i.attach,o=n,a;r===!0?(a=n,o=n.parent):r===!1&&(a=null);var s={shapes:e,delta:t,newParent:o,newHost:a,hints:i};this._commandStack.execute("elements.move",s)},rt.prototype.moveConnection=function(e,t,n,i,r){typeof i=="object"&&(r=i,i=void 0);var o={connection:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("connection.move",o)},rt.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},rt.prototype.createConnection=function(e,t,n,i,r,o){typeof n=="object"&&(o=r,r=i,i=n,n=void 0),i=this._create("connection",i);var a={source:e,target:t,parent:r,parentIndex:n,connection:i,hints:o};return this._commandStack.execute("connection.create",a),a.connection},rt.prototype.createShape=function(e,t,n,i,r){typeof i!="number"&&(r=i,i=void 0),r=r||{};var o=r.attach,a,s;e=this._create("shape",e),o?(a=n.parent,s=n):a=n;var c={position:t,shape:e,parent:a,parentIndex:i,host:s,hints:r};return this._commandStack.execute("shape.create",c),c.shape},rt.prototype.createElements=function(e,t,n,i,r){_e(e)||(e=[e]),typeof i!="number"&&(r=i,i=void 0),r=r||{};var o={position:t,elements:e,parent:n,parentIndex:i,hints:r};return this._commandStack.execute("elements.create",o),o.elements},rt.prototype.createLabel=function(e,t,n,i){n=this._create("label",n);var r={labelTarget:e,position:t,parent:i||e.parent,shape:n};return this._commandStack.execute("label.create",r),r.shape},rt.prototype.appendShape=function(e,t,n,i,r){r=r||{},t=this._create("shape",t);var o={source:e,position:n,target:i,shape:t,connection:r.connection,connectionParent:r.connectionParent,hints:r};return this._commandStack.execute("shape.append",o),o.shape},rt.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},rt.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},rt.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},rt.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},rt.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},rt.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},rt.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},rt.prototype.createSpace=function(e,t,n,i,r){var o={delta:n,direction:i,movingShapes:e,resizingShapes:t,start:r};this._commandStack.execute("spaceTool",o)},rt.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},rt.prototype.reconnect=function(e,t,n,i,r){var o={connection:e,newSource:t,newTarget:n,dockingOrPoints:i,hints:r||{}};this._commandStack.execute("connection.reconnect",o)},rt.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,O(i,{docking:"source"}))},rt.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,O(i,{docking:"target"}))},rt.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},rt.prototype._create=function(e,t){return D1(t)?t:this._elementFactory.create(e,t)},rt.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function Ea(e){this._elementRegistry=e}Ea.$inject=["elementRegistry"],Ea.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||bA(n,Xa(i));return Vy(n,i),e.oldProperties=o,e.changed=r,r},Ea.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return Vy(n,t),i},Ea.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return v(e,"bpmn:DataObject")?xA(e,t):[]};function bA(e,t){return Sn(t,function(n,i){return n[i]=e.get(i),n},{})}function Vy(e,t){M(t,function(n,i){e.set(i,n)})}function xA(e,t){return t.filter(function(n){return v(n,"bpmn:DataObjectReference")&&Z(n).dataObjectRef===e})}var Sa="default",Bi="id",Gy="di",wA={width:0,height:0};function Ra(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}Ra.$inject=["elementRegistry","moddle","modeling","textRenderer"],Ra.prototype.execute=function(e){var t=e.element,n=[t];if(!t)throw new Error("element required");var i=this._elementRegistry,r=this._moddle.ids,o=t.businessObject,a=PA(e.properties),s=e.oldProperties||EA(t,a);return Wy(a,o)&&(r.unclaim(o[Bi]),i.updateId(t,a[Bi]),r.claim(a[Bi],o)),Sa in a&&(a[Sa]&&n.push(i.get(a[Sa].id)),o[Sa]&&n.push(i.get(o[Sa].id))),Uy(t,a),e.oldProperties=s,e.changed=n,n},Ra.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&Z(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,wA)}},Ra.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 Uy(t,i),Wy(n,r)&&(a.unclaim(n[Bi]),o.updateId(t,i[Bi]),a.claim(i[Bi],r)),e.changed};function Wy(e,t){return Bi in e&&e[Bi]!==t[Bi]}function EA(e,t){var n=Xa(t),i=e.businessObject,r=Ve(e);return Sn(n,function(o,a){return a!==Gy?o[a]=i.get(a):o[a]=SA(r,Xa(t.di)),o},{})}function SA(e,t){return Sn(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function Uy(e,t){var n=e.businessObject,i=Ve(e);M(t,function(r,o){o!==Gy?n.set(o,r):i&&RA(i,r)})}function RA(e,t){M(t,function(n,i){e.set(i,n)})}var CA=["default"];function PA(e){var t=O({},e);return CA.forEach(function(n){n in e&&(t[n]=Z(t[n]))}),t}function Rc(e,t){this._canvas=e,this._modeling=t}Rc.$inject=["canvas","modeling"],Rc.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=Ve(r);return t.setRootElement(n),t.removeRootElement(r),St(a.rootElements,i),i.$parent=a,wt(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},Rc.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=Ve(n);return t.setRootElement(r),t.removeRootElement(n),wt(a.rootElements,i),i.$parent=null,St(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function Np(e,t){this._modeling=e,this._spaceTool=t}Np.$inject=["modeling","spaceTool"],Np.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=Un(i),a=o===i,s=a?i:i.parent,c=rr(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+Wn,y:i.y,width:i.width-Wn,height:i.height}:{x:i.x,y:i.y+Wn,width:i.width,height:i.height-Wn};n.createShape({type:"bpmn:Lane",isHorizontal:u},l,s)}var p=[];Or(o,function(x){return p.push(x),x.label&&p.push(x.label),x===i?[]:Oe(x.children,function(E){return E!==i})});var f,d,h,m,g;r==="top"?(f=-120,d=i.y,h=d+10,m="n",g="y"):r==="left"?(f=-120,d=i.x,h=d+10,m="w",g="x"):r==="bottom"?(f=120,d=i.y+i.height,h=d-10,m="s",g="y"):r==="right"&&(f=120,d=i.x+i.width,h=d-10,m="e",g="x");var R=t.calculateAdjustments(p,g,f,h),w=u?{x:0,y:f}:{x:f,y:0};t.makeSpace(R.movingShapes,R.resizingShapes,w,m,h);var b=u?{x:i.x+(a?Wn:0),y:d-(r==="top"?120:0),width:i.width-(a?Wn:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?Wn:0),width:120,height:i.height-(a?Wn:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:u},b,s)};function Bp(e){this._modeling=e}Bp.$inject=["modeling"],Bp.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=rr(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,p,f;for(f=0;f<i;f++)f===i-1?u=s-c*f:u=c,l=a?{x:n.x+Wn,y:n.y+f*c,width:n.width-Wn,height:u}:{x:n.x+f*c,y:n.y+Wn,width:u,height:n.height-Wn},f<o?t.resizeShape(r[f],l):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,l,n))};function Ca(e,t){this._modeling=e,this._spaceTool=t}Ca.$inject=["modeling","spaceTool"],Ca.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Ca.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=xR(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},Ca.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=ye(e),r=ye(t),o=Sm(r,i),a=Un(e),s=[],c=[];Or(a,function(h){return s.push(h),(v(h,"bpmn:Lane")||v(h,"bpmn:Participant"))&&c.push(h),h.children});var u,l,p,f,d;(o.bottom||o.top)&&(u=o.bottom||o.top,l=e.y+(o.bottom?e.height:0)+(o.bottom?-10:10),p=o.bottom?"s":"n",f=o.top>0||o.bottom<0?-u:u,d=n.calculateAdjustments(s,"y",f,l),n.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:u},p)),(o.left||o.right)&&(u=o.right||o.left,l=e.x+(o.right?e.width:0)+(o.right?-10:100),p=o.right?"e":"w",f=o.left>0||o.right<0?-u:u,d=n.calculateAdjustments(c,"x",f,l),n.makeSpace(d.movingShapes,d.resizingShapes,{x:u,y:0},p))};var Pa="flowNodeRef",$p="lanes";function Cc(){}Cc.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(l,p){var f=ye(p),d={x:l.x+l.width/2,y:l.y+l.height/2};return d.x>f.left&&d.x<f.right&&d.y>f.top&&d.y<f.bottom}function s(l){n.indexOf(l)===-1&&(o.push(l),n.push(l))}function c(l){var p=Un(l);return r[p.id]||(r[p.id]=Vs(p)),r[p.id]}function u(l){if(!l.parent)return[];var p=c(l);return p.filter(function(f){return a(l,f)}).map(function(f){return f.businessObject})}return t.forEach(function(l){var p=Un(l);if(!(!p||n.indexOf(p)!==-1)){var f=p.children.filter(function(d){return v(d,"bpmn:FlowNode")});f.forEach(s),n.push(p)}}),e.forEach(s),o.forEach(function(l){var p=l.businessObject,f=p.get($p),d=f.slice(),h=u(l);i.push({flowNode:p,remove:d,add:h})}),t.forEach(function(l){var p=l.businessObject;l.parent||p.get(Pa).forEach(function(f){i.push({flowNode:f,remove:[p],add:[]})})}),i},Cc.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($p);n.remove.forEach(function(o){wt(r,o),wt(o.get(Pa),i)}),n.add.forEach(function(o){St(r,o),St(o.get(Pa),i)})}),[]},Cc.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get($p);n.add.forEach(function(o){wt(r,o),wt(o.get(Pa),i)}),n.remove.forEach(function(o){St(r,o),St(o.get(Pa),i)})}),[]};var jp="categoryValueRef";function Aa(e,t){this._bpmnFactory=e,this._elementRegistry=t}Aa.$inject=["bpmnFactory","elementRegistry"],Aa.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,r=new Map,o=[],a=new Map;function s(w,b,x){if(b){var E=a.get(w);E||(E={},a.set(w,E)),!(x&&E.present)&&(!x&&E.past||(x?E.present={categoryValue:b,root:Fp(w)}:E.past={categoryValue:b}))}}function c(w){r.set(w,Z(w))}function u(){n.filter(function(w){return v(w,"bpmn:FlowElement")&&!Me(w)&&w.parent}).forEach(c)}function l(w){var b=Z(w),x=b.get("categoryValueRef");return x||(x=_m(i,b),o.push(AA(w,x))),x}function p(w){return w.reduce(function(b,x){var E=Fp(x),T=b.get(E);return T||(T=[],b.set(E,T)),T.push(x),b},new Map)}e=Array.from(e||[]);var f=p(e);t.length&&u(),e.forEach(c),n.filter(function(w){return v(w,"bpmn:Group")&&!Me(w)&&w.parent}).forEach(function(w){var b=Z(w).get("categoryValueRef");if(!b){var x=Fp(w),E=f.get(x)||[],T=ao(E,w),L=Object.keys(T).length>0;L&&(b=l(w))}s(w,b,!0)}),t.forEach(function(w){s(w.groupShape,w.categoryValue,!1)}),o.length&&u();var d=Array.from(r.keys()),h=Array.from(a.values()).reduce(function(w,b){return b.present&&w.add(b.present.categoryValue),b.past&&w.add(b.past.categoryValue),w},new Set),m=new Map,g=p(d);a.forEach(function(w,b){var x=w.present;if(x){var E=g.get(x.root)||[],T=ao(E,b);E.forEach(function(L){if(T[L.id]){var A=m.get(L);A||(A=new Set,m.set(L,A)),A.add(x.categoryValue)}})}});var R=d.reduce(function(w,b){var x=r.get(b),E=x.get(jp),T=new Set(E),L=m.get(b)||new Set,A=Array.from(L).filter(function(H){return!T.has(H)}),j=E.filter(function(H){return h.has(H)&&!L.has(H)});return(A.length||j.length)&&w.push({businessObject:x,categoryValuesToAdd:A,categoryValuesToRemove:j}),w},[]);return{flowElements:R,groups:o}},Aa.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),TA(t.groups),kA(t.flowElements),[]},Aa.prototype.revert=function(e){var t=e.updates;return DA(t.flowElements),MA(t.groups),[]};function AA(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function TA(e){e.forEach(function(t){Z(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function MA(e){e.forEach(function(t){Z(t.groupShape).categoryValueRef=null})}function kA(e){e.forEach(function(t){var n=t.businessObject,i=n.get(jp);t.categoryValuesToRemove.forEach(function(r){wt(i,r)}),t.categoryValuesToAdd.forEach(function(r){St(i,r,!0)})})}function DA(e){e.forEach(function(t){var n=t.businessObject,i=n.get(jp);t.categoryValuesToAdd.forEach(function(r){wt(i,r)}),t.categoryValuesToRemove.forEach(function(r){St(i,r,!0)})})}function Fp(e){for(;e.parent;)e=e.parent;return e}function Pc(e){this._moddle=e}Pc.$inject=["moddle"],Pc.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),[]},Pc.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 OA={fill:void 0,stroke:void 0};function Hp(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(wn(t)){var n=LA(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}Hp.$inject=["commandStack"],Hp.prototype.postExecute=function(e){var t=e.elements,n=e.colors||OA,i=this,r={};"fill"in n&&O(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&O(r,{"border-color":this._normalizeColor(n.stroke)}),M(t,function(o){var a=it(o)?ni(r,["border-color"]):r,s=Ve(o);if(IA(a),Me(o)){if(!s||!v(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:s.label,properties:{color:r["border-color"]}})}else{if(!De(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function LA(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 IA(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var NA={width:0,height:0};function Yy(e,t,n){function i(c,u){var l=c.label||c,p=c.labelTarget||c;return lS(l,u),[l,p]}function r(c){var u=c.element,l=u.businessObject,p=c.newLabel;if(!Me(u)&&nr(u)&&!Ms(u)&&!qy(p)){var f=7,d=pl(u);d={x:d.x,y:d.y+f},e.createLabel(u,d,{id:l.id+"_label",businessObject:l,di:u.di})}}function o(c){return c.oldLabel=jn(c.element),i(c.element,c.newLabel)}function a(c){return i(c.element,c.oldLabel)}function s(c){var u=c.element,l=u.label||u,p=c.newLabel,f=c.newBounds,d=c.hints||{};if(!(!Me(l)&&!v(l,"bpmn:TextAnnotation"))){if(Me(l)&&qy(p)){d.removeShape!==!1&&e.removeShape(l,{unsetLabel:!1});return}var h=jn(u);typeof f>"u"&&(f=t.getExternalLabelBounds(l,h)),f&&e.resizeShape(l,f,NA)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}Yy.$inject=["modeling","textRenderer","bpmnFactory"];function qy(e){return!e||!e.trim()}function en(e,t,n,i){rt.call(this,e,t,n),this._bpmnRules=i}ie(en,rt),en.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],en.prototype.getHandlers=function(){var e=rt.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=Ea,e["element.updateProperties"]=Ra,e["canvas.updateRoot"]=Rc,e["lane.add"]=Np,e["lane.resize"]=Ca,e["lane.split"]=Bp,e["lane.updateRefs"]=Cc,e["group.updateRefs"]=Aa,e["id.updateClaim"]=Pc,e["element.setColor"]=Hp,e["element.updateLabel"]=Yy,e},en.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},en.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)},en.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},en.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},en.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},en.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},en.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},en.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},en.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},en.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},en.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},en.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},en.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},en.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function Ky(){}Ky.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||be(t.source||e.source),t.connectionEnd||be(t.target||e.target)]};var Ac=20,BA=5,Tc=Math.round,Xy=20,$A={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function jA(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function FA(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function Zy(e,t,n){var i=Zt(t,e,BA),r=n.split(":")[0],o=Tc((t.x-e.x)/2+e.x),a=Tc((t.y-e.y)/2+e.y),s,c,u=FA(r,i),l=/h|r|l/.test(r),p=!1,f=!1;return u?(s=l?{x:o,y:e.y}:{x:e.x,y:a},c=l?"h:h":"v:v"):(p=jA(i,r),c=l?"h:v":"v:h",p?l?(f=a===e.y,s={x:e.x+Ac*(/l/.test(r)?-1:1),y:f?a+Ac:a}):(f=o===e.x,s={x:f?o+Ac:o,y:e.y+Ac*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:zp(e,s,c).concat(s),directions:c,turnNextDirections:f}}function HA(e,t,n){return Zy(e,t,n)}function zA(e,t,n){var i=Zy(t,e,Qy(n));return{waypoints:i.waypoints.slice().reverse(),directions:Qy(i.directions),turnNextDirections:i.turnNextDirections}}function VA(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=zp(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function Qy(e){return e.split(":").reverse().join(":")}function GA(e,t,n){var i=Tc((t.x-e.x)/2+e.x),r=Tc((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 zp(e,t,n){if(n=n||"h:h",!JA(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(ev(n)){var i=HA(e,t,n),r=zA(e,t,n),o=VA(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return GA(e,t,n)}function WA(e,t,n){var i=zp(e,t,n);return i.unshift(e),i.push(t),nv(i)}function UA(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=Yx(o,"straight")[0]||"h:h",s=$A[a]||0,c=Zt(e,t,s),u=QA(c,a);n=n||be(e),i=i||be(t);var l=u.split(":"),p=tv(n,e,l[0],eT(c)),f=tv(i,t,l[1],c);return WA(p,f,u)}function YA(e,t,n,i,r,o){_e(n)&&(r=n,o=i,n=be(e),i=be(t)),o=O({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&KA(e,t,n,i,o),c||(c=o.connectionEnd&&ZA(t,e,i,r),c)||(c=o.connectionStart&&XA(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:UA(e,t,n,i,o)}function qA(e,t,n){return e>=t&&e<=n}function Jy(e,t,n){var i={x:"width",y:"height"};return qA(t[e],n[e],n[e]+n[i[e]])}function KA(e,t,n,i,r){var o={},a,s;return s=Zt(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?Jy(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:Jy(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 XA(e,t,n,i){return Vp(e,t,n,i)}function ZA(e,t,n,i){var r=i.slice().reverse();return r=Vp(e,t,n,r),r?r.reverse():null}function Vp(e,t,n,i){function r(l){return l.length<3?!0:l.length>4?!1:!!st(l,function(p,f){var d=l[f-1];return d&&Qo(p,d)<3})}function o(l,p,f){var d=Ai(p,l);switch(d){case"v":return{x:f.x,y:l.y};case"h":return{x:l.x,y:f.y}}return{x:l.x,y:l.y}}function a(l,p,f){var d;for(d=l.length-2;d!==0;d--)if(Rh(l[d],p,Xy)||Rh(l[d],f,Xy))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=Vp(e,t,n,u)),c&&Ai(c)?null:c}function QA(e,t){if(ev(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 JA(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function ev(e){return e&&/t|r|b|l/.test(e)}function eT(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 nv(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return al(r,o,n,0)||t.push(n),t},[])}var tT=-10,nT=40,iT={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},rT={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},Gp={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Ta={top:"t",right:"r",bottom:"b",left:"l"};function Mc(e){this._elementRegistry=e}ie(Mc,Ky),Mc.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=iv(r&&r[0],n)),a||(a=iv(r&&r[r.length-1],i)),(v(e,"bpmn:Association")||v(e,"bpmn:DataAssociation"))&&r&&!rv(n,i))return[].concat([o],r.slice(1,-1),[a]);var l=mm(n,s)?iT:rT;return v(e,"bpmn:MessageFlow")?c=aT(n,i,l):(v(e,"bpmn:SequenceFlow")||rv(n,i))&&(n===i?c={preferredLayouts:fT(n,e,l)}:v(n,"bpmn:BoundaryEvent")?c={preferredLayouts:dT(n,i,a,l)}:Ma(n)||Ma(i)?c={preferredLayouts:l.subProcess,preserveDocking:cT(n)}:v(n,"bpmn:Gateway")?c={preferredLayouts:l.fromGateway}:v(i,"bpmn:Gateway")?c={preferredLayouts:l.toGateway}:c={preferredLayouts:l.default}),c&&(c=O(c,t),u=nv(YA(n,i,o,a,r,c))),u||[o,a]};function oT(e){var t=e.host;return Zt(be(e),t,tT)}function aT(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:sT(e,t)}}function sT(e,t){return v(t,"bpmn:Participant")?"source":v(e,"bpmn:Participant")?"target":Ma(t)?"source":Ma(e)||v(t,"bpmn:Event")?"target":v(e,"bpmn:Event")?"source":null}function cT(e){return Ma(e)?"target":"source"}function iv(e,t){return e?e.original||e:be(t)}function rv(e,t){return v(t,"bpmn:Activity")&&v(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Ma(e){return v(e,"bpmn:SubProcess")&&$e(e)}function zr(e,t){return e===t}function uT(e,t){return t.indexOf(e)!==-1}function Co(e){var t=/right|left/.exec(e);return t&&t[0]}function Po(e){var t=/top|bottom/.exec(e);return t&&t[0]}function ov(e,t){return Gp[e]===t}function lT(e,t){var n=Co(e),i=Gp[n];return t.indexOf(i)!==-1}function pT(e,t){var n=Po(e),i=Gp[n];return t.indexOf(i)!==-1}function av(e){return e==="right"||e==="left"}function fT(e,t,n){var i=t.waypoints,r=i&&i.length&&Zt(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function dT(e,t,n,i){var r=be(e),o=be(t),a=oT(e),s,c,u=zr(e.host,t),l=uT(a,["top","right","bottom","left"]),p=Zt(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?hT(a,l,e,t,n,i):(s=mT(a,p,l,i.isHorizontal),c=gT(a,p,l,i.isHorizontal),[s+":"+c])}function hT(e,t,n,i,r,o){var a=t?e:o.isHorizontal?Po(e):Co(e),s=Ta[a],c;return t?av(e)?c=sv("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=sv("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function sv(e,t,n,i){var r=nT;return!(Wp(e,i,n,r)||Wp(e,i,{x:n.x+n.width,y:n.y+n.height},r)||Wp(e,i,be(t),r))}function Wp(e,t,n,i){return Math.abs(t[e]-n[e])<i}function mT(e,t,n,i){if(n)return Ta[e];var r=Po(e),o=Co(e),a=Po(t),s=Co(t);if(i){if(zr(r,a)||ov(o,s))return Ta[r]}else if(zr(o,s)||ov(r,a))return Ta[o];return Ta[i?o:r]}function gT(e,t,n,i){if(n)return av(e)?lT(e,t)||zr(e,t)?"h":"v":pT(e,t)||zr(e,t)?"v":"h";var r=Po(e),o=Co(e),a=Po(t),s=Co(t);return a&&!s?"v":s&&!a?"h":i?zr(r,a)?"h":"v":zr(o,s)?"v":"h"}Mc.$inject=["elementRegistry"];function cv(e){return O({original:e.point.original||e.point},e.actual)}function dr(e,t){this._elementRegistry=e,this._graphicsFactory=t}dr.$inject=["elementRegistry","graphicsFactory"],dr.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(cv(i)),o.push(cv(r)),o},dr.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}},dr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return Jo(i,r,n)},dr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},dr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},dr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const Up={__init__:["modeling","bpmnUpdater"],__depends__:[IC,ZC,JC,eP,by,tA,iA,uA,qn,Tp,Cy],bpmnFactory:["type",Xn],bpmnUpdater:["type",kn],elementFactory:["type",lr],modeling:["type",en],layouter:["type",Mc],connectionDocking:["type",dr]};var yT=10,uv=50,vT=250;function Yp(e,t,n,i){for(var r;r=_T(e,n,t);)n=i(t,n,r);return n}function qp(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 _T(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=xT(e);return st(r,function(o){if(o===n)return!1;var a=Zt(o,i,yT);return a==="intersect"})}function bT(e,t){t||(t={});function n(h){return h.source===e?1:-1}var i=t.defaultDistance||uv,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||vT,c=t.reference||"start";o||(o=ST);function u(h,m){return r==="n"?c==="start"?ye(h).top-ye(m).bottom:c==="center"?ye(h).top-be(m).y:ye(h).top-ye(m).top:r==="w"?c==="start"?ye(h).left-ye(m).right:c==="center"?ye(h).left-be(m).x:ye(h).left-ye(m).left:r==="s"?c==="start"?ye(m).top-ye(h).bottom:c==="center"?be(m).y-ye(h).bottom:ye(m).bottom-ye(h).bottom:c==="start"?ye(m).left-ye(h).right:c==="center"?be(m).x-ye(h).right:ye(m).right-ye(h).right}var l=e.incoming.filter(o).map(function(h){var m=a(h),g=m<0?u(h.source,e):u(e,h.source);return{id:h.source.id,distance:g,weight:m}}),p=e.outgoing.filter(o).map(function(h){var m=a(h),g=m>0?u(e,h.target):u(h.target,e);return{id:h.target.id,distance:g,weight:m}}),f=l.concat(p).reduce(function(h,m){return h[m.id+"__weight_"+m.weight]=m,h},{}),d=Sn(f,function(h,m){var g=m.distance,R=m.weight;return g<0||g>s||(h[String(g)]||(h[String(g)]=0),h[String(g)]+=1*R,(!h.distance||h[h.distance]<h[String(g)])&&(h.distance=g)),h},{});return d.distance||i}function xT(e){var t=Kp(e);return e.host&&(t=t.concat(Kp(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(Kp(i))},[]))),t}function Kp(e){return ET(e).concat(wT(e))}function wT(e){return e.incoming.map(function(t){return t.source})}function ET(e){return e.outgoing.map(function(t){return t.target})}function ST(){return!0}var RT=100;function lv(e,t,n){e.on("autoPlace",RT,function(i){var r=i.shape,o=i.source;return CT(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}}lv.$inject=["eventBus","modeling","canvas"];function CT(e,t,n){n||(n={});var i=n.defaultDistance||uv,r=be(e),o=ye(e);return{x:o.right+i+t.width/2,y:r.y}}function pv(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}pv.$inject=["eventBus","selection"];const PT={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",lv],autoPlaceSelectionBehavior:["type",pv]};function fv(e,t,n){var i=mm(e,n);if(v(t,"bpmn:TextAnnotation"))return TT(e,t,i);if(De(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return MT(e,t,i);if(v(t,"bpmn:FlowNode"))return AT(e,t,i)}function AT(e,t,n){var i=ye(e),r=be(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=bT(e,{filter:function(d){return v(d,"bpmn:SequenceFlow")},direction:o.directionHint}),s=30,c=o.minDistance,u=o.baseOrientation;v(e,"bpmn:BoundaryEvent")&&(u=Zt(e,e.host,-25),u.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var l=n?{x:i.right+a+t.width/2,y:r.y+dv(u,c,o)}:{x:r.x+dv(u,c,o),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},f=n?{y:p}:{x:p};return Yp(e,t,l,qp(f))}function dv(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function TT(e,t,n){var i=ye(e),r=n?{x:i.right+t.width/2,y:i.top-50-t.height/2}:{x:i.right+50+t.width/2,y:i.bottom+t.height/2};it(e)&&(r=be(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 Yp(e,t,r,qp(a))}function MT(e,t,n){var i=ye(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 Yp(e,t,r,qp(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 kc={__depends__:[PT],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",hv]},mv=[dm,oa,Up,kc];function kT(e={}){hd(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new uo({container:t,moddleExtensions:e.moddleExtensions??is,additionalModules:[...mv,...e.additionalModules??[]]})}var DT=new So("ov"),OT=500;function qt(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=DT,this._overlayDefaults=O({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=LT(n.getContainer()),this._init()}qt.$inject=["config.overlays","eventBus","canvas","elementRegistry"],qt.prototype.get=function(e){if(wn(e)&&(e={id:e}),wn(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?Oe(t.overlays,Jr({type:e.type})):t.overlays.slice():[]}else return e.type?Oe(this._overlays,Jr({type:e.type})):e.id?this._overlays[e.id]:null},qt.prototype.add=function(e,t,n){if(Gt(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=O({},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)||[];_e(t)||(t=[t]);var n=this;M(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(li(i.html),li(i.htmlContainer),delete i.htmlContainer,delete i.element,delete n._overlays[i.id]),r){var o=r.overlays.indexOf(i);o!==-1&&r.overlays.splice(o,1)}})},qt.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},qt.prototype.show=function(){Dc(this._overlayRoot)},qt.prototype.hide=function(){Dc(this._overlayRoot,!1)},qt.prototype.clear=function(){this._overlays={},this._overlayContainers=[],ms(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=At(t);i=o.x,r=o.y}gv(n,i,r),an(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=At(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=At(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=ut('<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(",")+")";yv(this._overlayRoot,n)},qt.prototype._getOverlayContainer=function(e,t){var n=st(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)),wn(i)&&(i=ut(i)),o=this._getOverlayContainer(n),r=ut('<div class="djs-overlay" data-overlay-id="'+t+'">'),mn(r,{position:"absolute"}),r.appendChild(i),e.type&&mt(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();Dc(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&&($t(r)&&r>t.scale||$t(o)&&o<t.scale))&&(c=!1),Dc(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),$t(i)&&t.scale<i&&(a=(1/t.scale||1)*i),$t(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),$t(a)&&(s="scale("+a+","+a+")"),yv(o,s)},qt.prototype._updateOverlaysVisibilty=function(e){var t=this;M(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});M(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){li(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",OT,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&(M(o.overlays,function(a){t._updateOverlay(a)}),t._updateOverlayContainer(o))}),e.on("element.marker.update",function(i){var r=t._getOverlayContainer(i.element,!0);r&&mt(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 LT(e){var t=ut('<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 Dc(e,t){e.style.display=t===!1?"none":""}function yv(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Oc={__init__:["overlays"],overlays:["type",qt]};function Xp(e,t){t.invoke(X,this),this.executed(function(n){var i=n.context;i.rootElement?e.setRootElement(i.rootElement):i.rootElement=e.getRootElement()}),this.revert(function(n){var i=n.context;i.rootElement&&e.setRootElement(i.rootElement)})}ie(Xp,X),Xp.$inject=["canvas","injector"];const IT={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",Xp]};function ka(e){return CSS.escape(e)}var NT={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function vv(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return NT[t]})}var BT="bjs-breadcrumbs-shown";function _v(e,t,n){var i=ut('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=mt(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var u=c.element,l=Z(u),p=st(a,function(f){return f===l});p&&s()});function s(c){c&&(a=$T(c));var u=a.flatMap(function(p){var f=n.findRoot(mi(p))||n.findRoot(p.id);if(!f&&v(p,"bpmn:Process")){var d=t.find(function(g){var R=Z(g);return R&&R.get("processRef")===p});f=d&&n.findRoot(d.id)}if(!f)return[];var h=vv(p.name||p.id),m=ut('<li><span class="bjs-crumb"><a title="'+h+'">'+h+"</a></span></li>");return m.addEventListener("click",function(){n.setRootElement(f)}),m});i.innerHTML="";var l=u.length>1;o.toggle(BT,l),u.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}_v.$inject=["eventBus","elementRegistry","canvas"];function $T(e){for(var t=Z(e),n=[],i=t;i;i=i.$parent)(v(i,"bpmn:SubProcess")||v(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function bv(e,t){var n=null,i=new jT;e.on("root.set",function(r){var o=r.element,a=t.viewbox(),s=i.get(o);if(i.set(n,{x:a.x,y:a.y,zoom:a.scale}),n=o,!(!v(o,"bpmn:SubProcess")&&!s)){s=s||{x:0,y:0,zoom:1};var c=(a.x-s.x)*a.scale,u=(a.y-s.y)*a.scale;(c!==0||u!==0)&&t.scroll({dx:c,dy:u}),s.zoom!==a.scale&&t.zoom(s.zoom,{x:0,y:0})}}),e.on("diagram.clear",function(){i.clear(),n=null})}bv.$inject=["eventBus","canvas"];function jT(){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 xv={x:180,y:160};function Vr(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}Vr.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)})}},Vr.prototype._createNewDiagrams=function(e){var t=this,n=[],i=[];e.get("planeElement").forEach(function(o){var a=o.bpmnElement;if(a){var s=a.$parent;v(a,"bpmn:SubProcess")&&!o.isExpanded&&n.push(a),HT(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},Vr.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=FT(e),i={x:n.x-xv.x,y:n.y-xv.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)})},Vr.prototype._moveToDiPlane=function(e,t){var n=wv(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},Vr.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},Vr.$inject=["eventBus","moddle"];function wv(e){return v(e,"bpmndi:BPMNDiagram")?e:wv(e.$parent)}function FT(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=ye(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),Ss(t)}function HT(e,t){var n=e.$parent;return!(!v(n,"bpmn:SubProcess")||n===t.bpmnElement||De(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var Lc=250,zT='<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>',VT="bjs-drilldown-empty";function hr(e,t,n,i,r){X.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",Lc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",Lc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],Lc,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"],Lc,function(a){var s=a.oldParent,c=a.newParent||a.parent,u=a.shape;o._canDrillDown(u)&&o._addOverlay(u),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(u)},!0),t.on("import.render.complete",function(){n.filter(function(a){return o._canDrillDown(a)}).map(function(a){o._addOverlay(a)})})}ie(hr,X),hr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},hr.prototype._canDrillDown=function(e){var t=this._canvas;return v(e,"bpmn:SubProcess")&&t.findRoot(mi(e))},hr.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=Z(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;mt(i.html).toggle(VT,!r)}},hr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=Z(e),r=n.get({element:e,type:"drilldown"});r.length&&this._removeOverlay(e);var o=ut('<button type="button" class="bjs-drilldown">'+zT+"</button>"),a=i.get("name")||i.get("id"),s=this._translate("Open {element}",{element:a});o.setAttribute("title",s),o.addEventListener("click",function(){t.setRootElement(t.findRoot(mi(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},hr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},hr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const GT={__depends__:[Oc,Tp,IT],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",_v],drilldownCentering:["type",bv],drilldownOverlayBehavior:["type",hr],subprocessCompatibility:["type",Vr]};function mr(e){yt.call(this,e)}ie(mr,yt),mr.prototype._modules=[dm,GT,Oc,qn,oa],mr.prototype._moddleExtensions={};var Ic="keyboard.keydown",WT="keyboard.keyup",UT=1e3,Ev="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(Ev));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,Ic)},gn.prototype._keyupHandler=function(e){this._keyHandler(e,WT)},gn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Ic,i),n&&e.preventDefault()}},gn.prototype._isEventIgnored=function(e){return!1},gn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(Ev)),this.unbind(),e=this._node=this._target,Se.bind(e,"keydown",this._keydownHandler),Se.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"),Se.unbind(e,"keydown",this._keydownHandler),Se.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){Wt(e)&&(n=t,t=e,e=UT),this._eventBus.on(n||Ic,e,t)},gn.prototype.removeListener=function(e,t){this._eventBus.off(t||Ic,e)},gn.prototype.hasModifier=dP,gn.prototype.isCmd=Tn,gn.prototype.isShift=vp,gn.prototype.isKey=Ht;var YT=500;function Ao(e,t){var n=this;e.on("editorActions.init",YT,function(i){var r=i.editorActions;n.registerBindings(t,r)})}Ao.$inject=["eventBus","keyboard"],Ao.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(vP(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(_P(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(hP(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(mP(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(gP(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(yP(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Ht(["+","Add","="],r)&&Tn(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Ht(["-","Subtract"],r)&&Tn(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(Ht("0",r)&&Tn(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(Ht(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const Zp={__init__:["keyboard","keyboardBindings"],keyboard:["type",gn],keyboardBindings:["type",Ao]};var qT={moveSpeed:50,moveSpeedAccelerated:200};function Sv(e,t,n){var i=this;this._config=O({},qT,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})}}Sv.$inject=["config.keyboardMove","keyboard","canvas"];const Rv={__depends__:[Zp],__init__:["keyboardMove"],keyboardMove:["type",Sv]};var KT=15;function Cv(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=Br(s),p=ii(l,c);if(!n.dragging&&XT(p)>KT&&(n.dragging=!0,u===0&&Jg(e),cc("grab")),n.dragging){var f=n.last||n.start;p=ii(l,f),t.scroll({dx:p.x,dy:p.y}),n.last=l}s.preventDefault()}function o(s){Se.unbind(document,"mousemove",r),Se.unbind(document,"mouseup",o),n=null,Qg()}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:Br(s)},Se.bind(document,"mousemove",r),Se.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}Cv.$inject=["eventBus","canvas"];function XT(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const Pv={__init__:["moveCanvas"],moveCanvas:["type",Cv]};function Av(e,t){var n=ml(e.min),i=ml(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function ZT(e,t){return Math.max(e.min,Math.min(e.max,t))}var QT=Math.sign||function(e){return e>=0?1:-1},Qp={min:.2,max:4},Tv=10,JT=.1,eM=.75;function vi(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||eM;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}vi.$inject=["config.zoomScroll","eventBus","canvas"],vi.prototype.scroll=function(t){this._canvas.scroll(t)},vi.prototype.reset=function(){this._canvas.zoom("fit-viewport")},vi.prototype.zoom=function(t,n){var i=Av(Qp,Tv*2);this._totalDelta+=t,Math.abs(this._totalDelta)>JT&&(this._zoom(t,n,i),this._totalDelta=0)},vi.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||ag()&&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))*QT(t.deltaY)*o,this.zoom(a,c)}else r?a={dx:o*t.deltaY,dy:0}:a={dx:o*t.deltaX,dy:o*t.deltaY},this.scroll(a)}},vi.prototype.stepZoom=function(t,n){var i=Av(Qp,Tv);this._zoom(t,n,i)},vi.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=ml(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(ZT(Qp,s),t)},vi.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&Se[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},vi.prototype._init=function(e){this.toggle(e)};const Mv={__init__:["zoomScroll"],zoomScroll:["type",vi]};function Da(e){mr.call(this,e)}ie(Da,mr),Da.prototype._navigationModules=[Rv,Pv,Mv],Da.prototype._modules=[].concat(mr.prototype._modules,Da.prototype._navigationModules);function Jp(e){return e&&e[e.length-1]}function kv(e){return e.y}function Dv(e){return e.x}var tM={left:Dv,center:Dv,right:function(e){return e.x+e.width},top:kv,middle:kv,bottom:function(e){return e.y+e.height}};function To(e,t){this._modeling=e,this._rules=t}To.$inject=["modeling","rules"],To.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}},To.prototype._isType=function(e,t){return t.indexOf(e)!==-1},To.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),i=n.axis,r=n.dimension,o={},a={},s=!1,c,u,l;function p(f,d){return Math.round((f[i]+d[i]+d[r])/2)}if(this._isType(e,["left","top"]))o[e]=t[0][i];else if(this._isType(e,["right","bottom"]))l=Jp(t),o[e]=l[i]+l[r];else if(this._isType(e,["center","middle"])){if(M(t,function(f){var d=f[i]+Math.round(f[r]/2);a[d]?a[d].elements.push(f):a[d]={elements:[f],center:d}}),c=oi(a,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return o[e]=Jp(c).center,o;u=t[0],t=oi(t,function(f){return f[i]+f[r]}),l=Jp(t),o[e]=p(u,l)}return o},To.prototype.trigger=function(e,t){var n=this._modeling,i,r=Oe(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),_e(i)&&(r=i),!(r.length<2||!i)){var o=tM[t],a=oi(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const nM={__init__:["alignElements"],alignElements:["type",To]},iM=new So;function Mo(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Mo.$inject=["eventBus"],Mo.prototype.schedule=function(e,t=iM.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},Mo.prototype._schedule=function(e,t){const n=rM();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}},Mo.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Mo.prototype._cancel=function(e){clearTimeout(e.executionId)};function rM(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const oM={scheduler:["type",Mo]};var aM="djs-element-hidden",Nc=".entry",sM=1e3,Ov=8,cM=300;function Mt(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}Mt.$inject=["canvas","elementRegistry","eventBus","scheduler"],Mt.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",function(t){var n=t.newSelection,i=n.length?n.length===1?n[0]:n:null;i?e.open(i,!0):e.close()}),this._eventBus.on("elements.changed",function(t){var n=t.elements,i=e._current;if(i){var r=i.target,o=_e(r)?r:[r],a=o.filter(function(c){return n.includes(c)});if(a.length){e.close();var s=o.filter(function(c){return e._elementRegistry.get(c.id)});s.length&&e._updateAndOpen(s.length>1?s:s[0])}}}),this._eventBus.on("canvas.viewbox.changed",function(){e._updatePosition()}),this._eventBus.on("element.marker.update",function(t){if(e.isOpen()){var n=t.element,i=e._current,r=_e(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},Mt.prototype._createContainer=function(){var e=ut('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},Mt.prototype.registerProvider=function(e,t){t||(t=e,e=sM),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},Mt.prototype.getEntries=function(e){var t=this._getProviders(),n=_e(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return M(t,function(r){if(Wt(r[n])){var o=r[n](e);Wt(o)?i=o(i):M(o,function(a,s){i[s]=a})}}),i},Mt.prototype.trigger=function(e,t,n){var i=this,r,o,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(r=an(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},cM);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,o,n)},Mt.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(Wt(s)){if(t==="click")return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},Mt.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))}},Mt.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Mt.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;M(t,function(r,o){var a=r.group||"default",s=ut(r.html||'<div class="entry" draggable="true"></div>'),c;an(s,"data-action",o),c=et("[data-group="+ka(a)+"]",n),c||(c=ut('<div class="group"></div>'),an(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&uM(s,r.className),r.title&&an(s,"title",r.title),r.imageUrl&&(i=ut("<img>"),an(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),mt(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},Mt.prototype._createHtml=function(e){var t=this,n=ut('<div class="djs-context-pad"></div>');return Cn.bind(n,Nc,"click",function(i){t.trigger("click",i)}),Cn.bind(n,Nc,"dragstart",function(i){t.trigger("dragstart",i)}),Cn.bind(n,Nc,"mouseover",function(i){t.trigger("mouseover",i)}),Cn.bind(n,Nc,"mouseout",function(i){t.trigger("mouseout",i)}),Se.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},Mt.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()&&pM(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},Mt.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},Mt.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return _e(e)!==_e(n)?!1:_e(e)?e.length===n.length&&Rr(e,function(i){return n.includes(i)}):n===e},Mt.prototype.isShown=function(){return this.isOpen()&&mt(this._current.html).has("open")},Mt.prototype.show=function(){this.isOpen()&&(mt(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},Mt.prototype.hide=function(){this.isOpen()&&(mt(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},Mt.prototype._getPosition=function(e){if(!_e(e)&&it(e)){var t=this._canvas.viewbox(),n=lM(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+Ov*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+Ov*this._canvas.zoom(),top:s.top-a.top}},Mt.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")},Mt.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=_e(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,aM)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},Mt.prototype._getTargetBounds=function(e){var t=this,n=_e(e)?e:[e],i=n.map(function(r){return t._canvas.getGraphics(r)});return i.reduce(function(r,o){const a=o.getBoundingClientRect();return r.top=Math.min(r.top,a.top),r.right=Math.max(r.right,a.right),r.bottom=Math.max(r.bottom,a.bottom),r.left=Math.min(r.left,a.left),r.x=r.left,r.y=r.top,r.width=r.right-r.left,r.height=r.bottom-r.top,r},{top:1/0,right:-1/0,bottom:-1/0,left:1/0})};function uM(e,t){var n=mt(e);t=_e(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function lM(e){return e.waypoints[e.waypoints.length-1]}function pM(e,t){return e=_e(e)?e:[e],t=_e(t)?t:[t],e.length===t.length&&Rr(e,function(n){return t.includes(n)})}const Lv={__depends__:[sc,oM,Oc],contextPad:["type",Mt]};var Bc,_t,Iv,gr,Nv,Bv,$v,ef,$c,Oa,jv,tf,nf,rf,jc={},Fc=[],fM=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Hc=Array.isArray;function $i(e,t){for(var n in t)e[n]=t[n];return e}function of(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Fv(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?Bc.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 zc(e,a,i,r,null)}function zc(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??++Iv,__i:-1,__u:0};return r==null&&_t.vnode!=null&&_t.vnode(o),o}function Vc(e){return e.children}function Gc(e,t){this.props=e,this.context=t}function Gr(e,t){if(t==null)return e.__?Gr(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"?Gr(e):null}function dM(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=$i({},t);o.__v=t.__v+1,_t.vnode&&_t.vnode(o),af(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??Gr(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,qv(i,o,r),t.__e=t.__=null,o.__e!=n&&Hv(o)}}function Hv(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}),Hv(e)}function zv(e){(!e.__d&&(e.__d=!0)&&gr.push(e)&&!Wc.__r++||Nv!=_t.debounceRendering)&&((Nv=_t.debounceRendering)||Bv)(Wc)}function Wc(){try{for(var e,t=1;gr.length;)gr.length>t&&gr.sort($v),e=gr.shift(),t=gr.length,dM(e)}finally{gr.length=Wc.__r=0}}function Vv(e,t,n,i,r,o,a,s,c,u,l){var p,f,d,h,m,g,R=i&&i.__k||Fc,w=t.length;for(c=hM(n,t,R,c,w),p=0;p<w;p++)(d=n.__k[p])!=null&&(f=d.__i!=-1&&R[d.__i]||jc,d.__i=p,g=af(e,d,f,r,o,a,s,c,u,l),h=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&sf(f.ref,null,d),l.push(d.ref,d.__c||h,d)),m==null&&h!=null&&(m=h),4&d.__u?(c=Gv(d,c,e),f.__e&&(f.__e=null)):typeof d.type=="function"&&g!==void 0?c=g:h&&(c=h.nextSibling),d.__u&=-7);return n.__e=m,c}function hM(e,t,n,i,r){var o,a,s,c,u,l=n.length,p=l,f=0;for(e.__k=new Array(r),o=0;o<r;o++)(a=t[o])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[o]=zc(null,a,null,null,null):Hc(a)?a=e.__k[o]=zc(Vc,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=zc(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[o]=a,c=o+f,a.__=e,a.__b=e.__b+1,s=null,(u=a.__i=mM(a,n,c,p))!=-1&&(p--,(s=n[u])&&(s.__u|=2)),s==null||s.__v==null?(u==-1&&(r>l?f--:r<l&&f++),typeof a.type!="function"&&(a.__u|=4)):u!=c&&(u==c-1?f--:u==c+1?f++:(u>c?f--:f++,a.__u|=4))):e.__k[o]=null;if(p)for(o=0;o<l;o++)(s=n[o])!=null&&(2&s.__u)==0&&(s.__e==i&&(i=Gr(s)),Xv(s,s));return i}function Gv(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=Gv(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Gr(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function mM(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 Wv(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||fM.test(t)?n:n+"px"}function Uc(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||Wv(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||Wv(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(jv,"$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[Oa]=i[Oa]:(n[Oa]=tf,e.addEventListener(t,o?rf:nf,o)):e.removeEventListener(t,o?rf:nf,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 Uv(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[$c]==null)t[$c]=tf++;else if(t[$c]<n[Oa])return;return n(_t.event?_t.event(t):t)}}}function af(e,t,n,i,r,o,a,s,c,u){var l,p,f,d,h,m,g,R,w,b,x,E,T,L,A,j,H=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(l=_t.__b)&&l(t);e:if(typeof H=="function"){p=a.length;try{if(w=t.props,b=H.prototype&&H.prototype.render,x=(l=H.contextType)&&i[l.__c],E=l?x?x.props.value:l.__:i,n.__c?R=(f=t.__c=n.__c).__=f.__E:(b?t.__c=f=new H(w,E):(t.__c=f=new Gc(w,E),f.constructor=H,f.render=yM),x&&x.sub(f),f.state||(f.state={}),f.__n=i,d=f.__d=!0,f.__h=[],f._sb=[]),b&&f.__s==null&&(f.__s=f.state),b&&H.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=$i({},f.__s)),$i(f.__s,H.getDerivedStateFromProps(w,f.__s))),h=f.props,m=f.state,f.__v=t,d)b&&H.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),b&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(b&&H.getDerivedStateFromProps==null&&w!==h&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(w,E),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(w,f.__s,E)===!1){t.__v!=n.__v&&(f.props=w,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(N){N&&(N.__=t)}),Fc.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&a.push(f),s=Gr(n);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(w,f.__s,E),b&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(h,m,g)})}if(f.context=E,f.props=w,f.__P=e,f.__e=!1,T=_t.__r,L=0,b)f.state=f.__s,f.__d=!1,T&&T(t),l=f.render(f.props,f.state,f.context),Fc.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,T&&T(t),l=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++L<25);f.state=f.__s,f.getChildContext!=null&&(i=$i($i({},i),f.getChildContext())),b&&!d&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(h,m)),A=l!=null&&l.type===Vc&&l.key==null?Kv(l.props.children):l,s=Vv(e,Hc(A)?A:[A],t,n,i,r,o,a,s,c,u),f.base=t.__e,t.__u&=-161,f.__h.length&&a.push(f),R&&(f.__E=f.__=null)}catch(N){if(a.length=p,t.__v=null,c||o!=null){if(N.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;o!=null&&(o[o.indexOf(s)]=null),t.__e=s}else if(o!=null)for(j=o.length;j--;)of(o[j])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),N.then||Yv(t),_t.__e(N,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=gM(n.__e,t,n,i,r,o,a,c,u);return(l=_t.diffed)&&l(t),128&t.__u?void 0:s}function Yv(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Yv))}function qv(e,t,n){for(var i=0;i<n.length;i++)sf(n[i],n[++i],n[++i]);_t.__c&&_t.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){_t.__e(o,r.__v)}})}function Kv(e){return typeof e!="object"||e==null||e.__b>0?e:Hc(e)?e.map(Kv):e.constructor!==void 0?null:$i({},e)}function gM(e,t,n,i,r,o,a,s,c){var u,l,p,f,d,h,m,g=n.props||jc,R=t.props,w=t.type;if(w=="svg"?r="http://www.w3.org/2000/svg":w=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),o!=null){for(u=0;u<o.length;u++)if((d=o[u])&&"setAttribute"in d==!!w&&(w?d.localName==w:d.nodeType==3)){e=d,o[u]=null;break}}if(e==null){if(w==null)return document.createTextNode(R);e=document.createElementNS(r,w,R.is&&R),s&&(_t.__m&&_t.__m(t,o),s=!1),o=null}if(w==null)g===R||s&&e.data==R||(e.data=R);else{if(o=w=="textarea"&&R.defaultValue!=null?null:o&&Bc.call(e.childNodes),!s&&o!=null)for(g={},u=0;u<e.attributes.length;u++)g[(d=e.attributes[u]).name]=d.value;for(u in g)d=g[u],u=="dangerouslySetInnerHTML"?p=d:u=="children"||u in R||u=="value"&&"defaultValue"in R||u=="checked"&&"defaultChecked"in R||Uc(e,u,null,d,r);for(u in R)d=R[u],u=="children"?f=d:u=="dangerouslySetInnerHTML"?l=d:u=="value"?h=d:u=="checked"?m=d:s&&typeof d!="function"||g[u]===d||Uc(e,u,d,g[u],r);if(l)s||p&&(l.__html==p.__html||l.__html==e.innerHTML)||(e.innerHTML=l.__html),t.__k=[];else if(p&&(e.innerHTML=""),Vv(t.type=="template"?e.content:e,Hc(f)?f:[f],t,n,i,w=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&Gr(n,0),s,c),o!=null)for(u=o.length;u--;)of(o[u]);s&&w!="textarea"||(u="value",w=="progress"&&h==null?e.removeAttribute("value"):h!=null&&(h!==e[u]||w=="progress"&&!h||w=="option"&&h!=g[u])&&Uc(e,u,h,g[u],r),u="checked",m!=null&&m!=e[u]&&Uc(e,u,m,g[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){_t.__e(r,n)}}function Xv(e,t,n){var i,r;if(_t.unmount&&_t.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){_t.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&Xv(i[r],t,n||typeof e.type!="function");n||of(e.__e),e.__c=e.__=e.__e=void 0}function yM(e,t,n){return this.constructor(e,n)}function Zv(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),_t.__&&_t.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],af(t,e=t.__k=Fv(Vc,null,[e]),r||jc,jc,t.namespaceURI,r?null:t.firstChild?Bc.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),qv(o,e,a),e.props.children=null}Bc=Fc.slice,_t={__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}},Iv=0,Gc.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=$i({},this.state),typeof e=="function"&&(e=e($i({},n),this.props)),e&&$i(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),zv(this))},Gc.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),zv(this))},Gc.prototype.render=Vc,gr=[],Bv=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,$v=function(e,t){return e.__v.__b-t.__v.__b},Wc.__r=0,ef=Math.random().toString(8),$c="__d"+ef,Oa="__a"+ef,jv=/(PointerCapture)$|Capture$/i,tf=0,nf=Uv(!1),rf=Uv(!0);var Qv=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,Qv(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},Jv=new Map;function vM(e){var t=Jv.get(this);return t||(t=new Map,Jv.set(this,t)),(t=Qv(this,t.get(e)||(t.set(e,t=(function(n){for(var i,r,o=1,a="",s="",c=[0],u=function(f){o===1&&(f||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,f,a):o===3&&(f||a)?(c.push(3,f,a),o=2):o===2&&a==="..."&&f?c.push(4,f,0):o===2&&a&&!f?c.push(5,0,!0,a):o>=5&&((a||!f&&o===5)&&(c.push(o,0,a,r),o=6),f&&(c.push(o,f,0,r),o=6)),a=""},l=0;l<n.length;l++){l&&(o===1&&u(),u(l));for(var p=0;p<n[l].length;p++)i=n[l][p],o===1?i==="<"?(u(),c=[c],o=3):a+=i:o===4?a==="--"&&i===">"?(o=1,a=""):a=i+a[0]:s?i===s?s="":a+=i:i==='"'||i==="'"?s=i:i===">"?(u(),o=1):o&&(i==="="?(o=5,r=a,a=""):i==="/"&&(o<5||n[l][p+1]===">")?(u(),o===3&&(c=c[0]),o=c,(c=c[0]).push(2,0,o),o=0):i===" "||i===" "||i===`
11
+ `||i==="\r"?(u(),o=2):a+=i),o===3&&a==="!--"&&(o=4,c=c[0])}return u(),c})(e)),t),arguments,[])).length>1?t:t[0]}var ot=vM.bind(Fv),ko,kt,cf,e_,La=0,t_=[],zt=_t,n_=zt.__b,i_=zt.__r,r_=zt.diffed,o_=zt.__c,a_=zt.unmount,s_=zt.__;function Yc(e,t){zt.__h&&zt.__h(kt,e,La||t),La=0;var n=kt.__H||(kt.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function uf(e){return La=1,_M(u_,e)}function _M(e,t,n){var i=Yc(ko++,2);if(i.t=e,!i.__c&&(i.__=[u_(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=kt,!kt.__f)){var r=function(s,c,u){if(!i.__c.__H)return!0;var l=!1,p=i.__c.props!==s;if(i.__c.__H.__.some(function(d){if(d.__N){l=!0;var h=d.__[0];d.__=d.__N,d.__N=void 0,h!==d.__[0]&&(p=!0)}}),o){var f=o.call(this,s,c,u);return l?f||p:f}return!l||p};kt.__f=!0;var o=kt.shouldComponentUpdate,a=kt.componentWillUpdate;kt.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)},kt.shouldComponentUpdate=r}return i.__N||i.__}function qc(e,t){var n=Yc(ko++,3);!zt.__s&&ff(n.__H,t)&&(n.__=e,n.u=t,kt.__H.__h.push(n))}function lf(e,t){var n=Yc(ko++,4);!zt.__s&&ff(n.__H,t)&&(n.__=e,n.u=t,kt.__h.push(n))}function Kc(e){return La=5,ji(function(){return{current:e}},[])}function ji(e,t){var n=Yc(ko++,7);return ff(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Ia(e,t){return La=8,ji(function(){return e},t)}function bM(){for(var e;e=t_.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Xc),t.__h.some(pf),t.__h=[]}catch(n){t.__h=[],zt.__e(n,e.__v)}}}zt.__b=function(e){kt=null,n_&&n_(e)},zt.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),s_&&s_(e,t)},zt.__r=function(e){i_&&i_(e),ko=0;var t=(kt=e.__c).__H;t&&(cf===kt?(t.__h=[],kt.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(Xc),t.__h.some(pf),t.__h=[],ko=0)),cf=kt},zt.diffed=function(e){r_&&r_(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(t_.push(t)!==1&&e_===zt.requestAnimationFrame||((e_=zt.requestAnimationFrame)||xM)(bM)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),cf=kt=null},zt.__c=function(e,t){t.some(function(n){try{n.__h.some(Xc),n.__h=n.__h.filter(function(i){return!i.__||pf(i)})}catch(i){t.some(function(r){r.__h&&(r.__h=[])}),t=[],zt.__e(i,n.__v)}}),o_&&o_(e,t)},zt.unmount=function(e){a_&&a_(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{Xc(i)}catch(r){t=r}}),n.__H=void 0,t&&zt.__e(t,n.__v))};var c_=typeof requestAnimationFrame=="function";function xM(e){var t,n=function(){clearTimeout(i),c_&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);c_&&(t=requestAnimationFrame(n))}function Xc(e){var t=kt,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),kt=t}function pf(e){var t=kt;e.__c=e.__(),kt=t}function ff(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function u_(e,t){return typeof t=="function"?t(e):t}function wM(e){const{navigationStack:t,setNavigationStack:n}=e,i=ji(()=>t.length<=1?[]:t.slice(0,-1).map((a,s)=>({label:a.label,onClick:()=>n(c=>c.slice(0,s+1))})),[t,n]),r=t.length>0?()=>n([]):null,o=t.length>0?t[t.length-1].label:null;return ot`
12
12
  <div class="djs-popup-breadcrumbs">
13
13
  ${r&&ot`
14
14
  <button
@@ -23,9 +23,9 @@
23
23
  </svg>
24
24
  </button>
25
25
  `}
26
- ${i.map((a,c)=>ot`
26
+ ${i.map((a,s)=>ot`
27
27
  <button
28
- key=${c}
28
+ key=${s}
29
29
  type="button"
30
30
  class="djs-popup-breadcrumbs-item"
31
31
  onClick=${a.onClick}
@@ -41,7 +41,7 @@
41
41
  </span>
42
42
  `}
43
43
  </div>
44
- `}function c_(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=c_(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function Zc(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=c_(e))&&(i&&(i+=" "),i+=t);return i}function bM(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:r,title:o}=e,a=ji(()=>xM(t),[t]),c=u=>u.action&&!u.disabled,s=(u,l)=>{if(c(l))return n(u,l)};return ot`
44
+ `}function l_(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=l_(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function Zc(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=l_(e))&&(i&&(i+=" "),i+=t);return i}function EM(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:r,title:o}=e,a=ji(()=>SM(t),[t]),s=u=>u.action&&!u.disabled,c=(u,l)=>{if(s(l))return n(u,l)};return ot`
45
45
  <div class="djs-popup-header">
46
46
  <h3 class="djs-popup-title" title=${o}>${o}</h3>
47
47
  ${a.map(u=>ot`
@@ -49,16 +49,16 @@
49
49
 
50
50
  ${u.entries.map(l=>ot`
51
51
  <li key=${l.id}>
52
- <${c(l)?"button":"span"}
53
- class=${wM(l,l===i)}
54
- onClick=${p=>s(p,l)}
52
+ <${s(l)?"button":"span"}
53
+ class=${RM(l,l===i)}
54
+ onClick=${p=>c(p,l)}
55
55
  title=${l.title||l.label}
56
56
  data-id=${l.id}
57
57
  aria-disabled=${l.disabled||void 0}
58
- onMouseEnter=${()=>c(l)&&r(l)}
59
- onMouseLeave=${()=>c(l)&&r(null)}
60
- onFocus=${()=>c(l)&&r(l)}
61
- onBlur=${()=>c(l)&&r(null)}
58
+ onMouseEnter=${()=>s(l)&&r(l)}
59
+ onMouseLeave=${()=>s(l)&&r(null)}
60
+ onFocus=${()=>s(l)&&r(l)}
61
+ onBlur=${()=>s(l)&&r(null)}
62
62
  >
63
63
  ${l.imageUrl&&ot`<img class="djs-popup-entry-icon" src=${l.imageUrl} alt="" />`||l.imageHtml&&ot`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:l.imageHtml}} />`}
64
64
  ${l.label?ot`
@@ -70,21 +70,21 @@
70
70
  </ul>
71
71
  `)}
72
72
  </div>
73
- `}function xM(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 wM(e,t){return Zc("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function u_(e,t){return`${e}-entry-${t.id}`}function EM(e){const{idPrefix:t,entry:n,selected:i,onMouseEnter:r,onMouseLeave:o,onAction:a}=e,c=(u,l)=>{if(!n.disabled)return a(u,n,l)},s=!n.entries;return ot`
73
+ `}function SM(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 RM(e,t){return Zc("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function p_(e,t){return`${e}-entry-${t.id}`}function CM(e){const{idPrefix:t,entry:n,selected:i,onMouseEnter:r,onMouseLeave:o,onAction:a}=e,s=(u,l)=>{if(!n.disabled)return a(u,n,l)},c=!n.entries;return ot`
74
74
  <li
75
75
  class=${Zc("entry",{selected:i,disabled:n.disabled})}
76
76
  data-id=${n.id}
77
- id=${u_(t,n)}
77
+ id=${p_(t,n)}
78
78
  role="option"
79
79
  aria-selected=${i||void 0}
80
80
  aria-haspopup=${n.entries?"true":void 0}
81
81
  title=${n.title}
82
82
  aria-disabled=${n.disabled||void 0}
83
- onClick=${c}
83
+ onClick=${s}
84
84
  onMouseEnter=${r}
85
85
  onMouseLeave=${o}
86
- onDragStart=${u=>s&&c(u,"dragstart")}
87
- draggable=${s}
86
+ onDragStart=${u=>c&&s(u,"dragstart")}
87
+ draggable=${c}
88
88
  >
89
89
  <div class="djs-popup-entry-content">
90
90
  <span
@@ -131,20 +131,20 @@
131
131
  </div>
132
132
  `}
133
133
  </li>
134
- `}function SM(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:r,idPrefix:o,id:a,ariaLabel:c,tabIndex:s,ariaActivedescendant:u,...l}=e,p=Kc();cf(()=>{if(!r||!r.current)return;const m=p.current;if(!m)return;const g=m.querySelector(".selected");g&&RM(g)},[t]);const f=()=>{r.current=!1},d=m=>{r.current||n(m)},h=()=>{r.current||n(null)};return ot`
134
+ `}function PM(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:r,idPrefix:o,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:u,...l}=e,p=Kc();lf(()=>{if(!r||!r.current)return;const m=p.current;if(!m)return;const g=m.querySelector(".selected");g&&AM(g)},[t]);const f=()=>{r.current=!1},d=m=>{r.current||n(m)},h=()=>{r.current||n(null)};return ot`
135
135
  <div
136
136
  class="djs-popup-results"
137
137
  ref=${p}
138
138
  id=${a}
139
139
  role="listbox"
140
- aria-label=${c}
141
- tabIndex=${s}
140
+ aria-label=${s}
141
+ tabIndex=${c}
142
142
  aria-activedescendant=${u}
143
143
  onMouseMove=${f}
144
144
  >
145
145
  ${i.map(m=>ot`
146
146
  ${m.name&&ot`
147
- <div key=${m.id} id=${l_(o,m)} class="entry-header" title=${m.name}>
147
+ <div key=${m.id} id=${f_(o,m)} class="entry-header" title=${m.name}>
148
148
  ${m.name}
149
149
  </div>
150
150
  `}
@@ -152,10 +152,10 @@
152
152
  class="djs-popup-group"
153
153
  data-group=${m.id}
154
154
  role="group"
155
- aria-labelledby=${m.name?l_(o,m):void 0}
155
+ aria-labelledby=${m.name?f_(o,m):void 0}
156
156
  >
157
157
  ${m.entries.map(g=>ot`
158
- <${EM}
158
+ <${CM}
159
159
  key=${g.id}
160
160
  idPrefix=${o}
161
161
  entry=${g}
@@ -168,28 +168,28 @@
168
168
  </ul>
169
169
  `)}
170
170
  </div>
171
- `}function l_(e,t){return`${e}-group-${t.id}`}function RM(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const CM=new wo("djs-popup");function PM(e){const{onClose:t,onSelect:n,className:i,headerEntries:r,position:o,title:a,width:c,scale:s,search:u,emptyPlaceholder:l,searchFn:p,entries:f,onOpened:d,onClosed:h}=e,[m,g]=sf([]);qc(()=>{g([])},[f]);const[R,w]=sf(""),x=R.trim().length>0,b=ji(()=>MM(f),[f]),E=ji(()=>$t(u)?b.length>5:!1,[u,b]),T=ji(()=>{const j=m.length?m[m.length-1].entries:f;return E?x?p(b.filter(({searchable:$})=>$!==!1),R,{keys:["label","search","description"]}).map(({item:$})=>$):j.filter(({rank:$=0})=>$>=0):j},[E,x,b,R,p,m,f]),L=ji(()=>x?T.length?[{id:"default",entries:T}]:[]:kM(T),[T,x]),[A,F]=sf(T[0]),H=Kc(null),N=Kc(!1),V=ji(()=>CM.next(),[]),fe=`${V}-results`,je=A&&u_(V,A);qc(()=>{const j=H.current;j&&T.includes(j)?F(j):F(T[0]),H.current=null},[T]);const lt=La(j=>{const $=TM(L);let ke=$.indexOf(A)+j;ke<0&&(ke=$.length-1),ke>=$.length&&(ke=0),N.current=!0,F($[ke])},[L,A]),q=La(j=>{j>0&&A&&A.entries&&(N.current=!0,g($=>[...$,A])),j<0&&m.length>0&&(N.current=!0,H.current=m[m.length+j],g($=>$.slice(0,j)))},[A,m]),de=La((j,$,U)=>{if(!(!$||$.disabled))return $.entries?(j.preventDefault(),q(1)):n(j,$,U)},[n,q]),he=La(j=>{if(j.key==="Enter"&&A){const $=j.target;return!!kr($,"a, button",!0)||A.disabled?void 0:de(j,A)}if(j.key==="Backspace"){const $=j.target;if(!(Uu($,"input")&&$.value!==""))return q(-1),j.preventDefault()}if(j.key==="ArrowUp")return lt(-1),j.preventDefault();if(j.key==="ArrowDown")return lt(1),j.preventDefault();if(j.key==="ArrowRight")return q(1),j.preventDefault();if(j.key==="ArrowLeft")return q(-1),j.preventDefault()},[A,lt,q,de]),ce=La(j=>{Uu(j.target,"input")&&w(()=>j.target.value)},[w]);qc(()=>(d(),()=>{h()}),[]);const ue=!x&&m.length>0,ee=(a||r.length>0)&&!ue;return ot`
172
- <${p_}
171
+ `}function f_(e,t){return`${e}-group-${t.id}`}function AM(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const TM=new So("djs-popup");function MM(e){const{onClose:t,onSelect:n,className:i,headerEntries:r,position:o,title:a,width:s,scale:c,search:u,emptyPlaceholder:l,searchFn:p,entries:f,onOpened:d,onClosed:h}=e,[m,g]=uf([]);qc(()=>{g([])},[f]);const[R,w]=uf(""),b=R.trim().length>0,x=ji(()=>OM(f),[f]),E=ji(()=>$t(u)?x.length>5:!1,[u,x]),T=ji(()=>{const F=m.length?m[m.length-1].entries:f;return E?b?p(x.filter(({searchable:$})=>$!==!1),R,{keys:["label","search","description"]}).map(({item:$})=>$):F.filter(({rank:$=0})=>$>=0):F},[E,b,x,R,p,m,f]),L=ji(()=>b?T.length?[{id:"default",entries:T}]:[]:LM(T),[T,b]),[A,j]=uf(T[0]),H=Kc(null),N=Kc(!1),G=ji(()=>TM.next(),[]),fe=`${G}-results`,Fe=A&&p_(G,A);qc(()=>{const F=H.current;F&&T.includes(F)?j(F):j(T[0]),H.current=null},[T]);const lt=Ia(F=>{const $=DM(L);let ke=$.indexOf(A)+F;ke<0&&(ke=$.length-1),ke>=$.length&&(ke=0),N.current=!0,j($[ke])},[L,A]),Y=Ia(F=>{F>0&&A&&A.entries&&(N.current=!0,g($=>[...$,A])),F<0&&m.length>0&&(N.current=!0,H.current=m[m.length+F],g($=>$.slice(0,F)))},[A,m]),de=Ia((F,$,U)=>{if(!(!$||$.disabled))return $.entries?(F.preventDefault(),Y(1)):n(F,$,U)},[n,Y]),he=Ia(F=>{if(F.key==="Enter"&&A){const $=F.target;return!!kr($,"a, button",!0)||A.disabled?void 0:de(F,A)}if(F.key==="Backspace"){const $=F.target;if(!(qu($,"input")&&$.value!==""))return Y(-1),F.preventDefault()}if(F.key==="ArrowUp")return lt(-1),F.preventDefault();if(F.key==="ArrowDown")return lt(1),F.preventDefault();if(F.key==="ArrowRight")return Y(1),F.preventDefault();if(F.key==="ArrowLeft")return Y(-1),F.preventDefault()},[A,lt,Y,de]),se=Ia(F=>{qu(F.target,"input")&&w(()=>F.target.value)},[w]);qc(()=>(d(),()=>{h()}),[]);const ce=!b&&m.length>0,ee=(a||r.length>0)&&!ce;return ot`
172
+ <${d_}
173
173
  onClose=${t}
174
- onKeyup=${ce}
174
+ onKeyup=${se}
175
175
  onKeydown=${he}
176
176
  className=${i}
177
177
  position=${o}
178
- width=${c}
179
- scale=${s}
178
+ width=${s}
179
+ scale=${c}
180
180
  navigationStack=${m}
181
181
  >
182
182
  ${ee&&ot`
183
- <${bM}
183
+ <${EM}
184
184
  headerEntries=${r}
185
185
  onSelect=${n}
186
186
  selectedEntry=${A}
187
- setSelectedEntry=${F}
187
+ setSelectedEntry=${j}
188
188
  title=${a}
189
189
  />
190
190
  `}
191
- ${ue&&ot`
192
- <${_M}
191
+ ${ce&&ot`
192
+ <${wM}
193
193
  navigationStack=${m}
194
194
  setNavigationStack=${g}
195
195
  />
@@ -209,29 +209,29 @@
209
209
  aria-label="${a||"Search"}"
210
210
  aria-expanded="true"
211
211
  aria-controls=${fe}
212
- aria-activedescendant=${je||void 0}
212
+ aria-activedescendant=${Fe||void 0}
213
213
  aria-autocomplete="list"
214
214
  />
215
215
  </div>
216
216
  `}
217
217
 
218
- ${x&&ot`
218
+ ${b&&ot`
219
219
  <div class="djs-popup-search-count" aria-live="polite">
220
220
  ${T.length} ${T.length===1?"result":"results"} found
221
221
  </div>
222
222
  `}
223
223
 
224
- <${SM}
224
+ <${PM}
225
225
  groupedEntries=${L}
226
226
  selectedEntry=${A}
227
- setSelectedEntry=${F}
227
+ setSelectedEntry=${j}
228
228
  keyboardSelection=${N}
229
229
  onAction=${de}
230
- idPrefix=${V}
230
+ idPrefix=${G}
231
231
  id=${fe}
232
232
  ariaLabel=${a||"Results"}
233
233
  tabIndex=${E?-1:0}
234
- ariaActivedescendant=${E?void 0:je||void 0}
234
+ ariaActivedescendant=${E?void 0:Fe||void 0}
235
235
  />
236
236
 
237
237
  ${A&&A.documentationRef&&ot`
@@ -239,7 +239,7 @@
239
239
  <a
240
240
  class="djs-popup-footer-docs"
241
241
  href=${A.documentationRef}
242
- onClick=${j=>j.stopPropagation()}
242
+ onClick=${F=>F.stopPropagation()}
243
243
  aria-label=${A.label?`Open entry documentation for ${A.label}`:"Open entry documentation"}
244
244
  target="_blank"
245
245
  rel="noopener"
@@ -257,26 +257,26 @@
257
257
  ${l&&T.length===0&&ot`
258
258
  <div class="djs-popup-no-results">${Wt(l)?l(R):l}</div>
259
259
  `}
260
- </${p_}>
261
- `}function p_(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,navigationStack:a,position:c}=e,s=Kc();return cf(()=>{if(typeof c!="function")return;const u=s.current,l=c(u);u.style.left=`${l.x}px`,u.style.top=`${l.y}px`},[s.current,c]),cf(()=>{const u=s.current;if(!u)return;(u.querySelector("input")||u.querySelector('[role="listbox"]')||u).focus()},[a]),qc(()=>{const u=p=>{if(p.key==="Escape")return p.preventDefault(),t()},l=p=>{if(!kr(p.target,".djs-popup",!0))return t()};return document.documentElement.addEventListener("keydown",u),document.body.addEventListener("click",l,!0),()=>{document.documentElement.removeEventListener("keydown",u),document.body.removeEventListener("click",l,!0)}},[]),ot`
260
+ </${d_}>
261
+ `}function d_(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,navigationStack:a,position:s}=e,c=Kc();return lf(()=>{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]),lf(()=>{const u=c.current;if(!u)return;(u.querySelector("input")||u.querySelector('[role="listbox"]')||u).focus()},[a]),qc(()=>{const u=p=>{if(p.key==="Escape")return p.preventDefault(),t()},l=p=>{if(!kr(p.target,".djs-popup",!0))return t()};return document.documentElement.addEventListener("keydown",u),document.body.addEventListener("click",l,!0),()=>{document.documentElement.removeEventListener("keydown",u),document.body.removeEventListener("click",l,!0)}},[]),ot`
262
262
  <div
263
263
  class=${Zc("djs-popup",r)}
264
- style=${AM(e)}
264
+ style=${kM(e)}
265
265
  onKeydown=${n}
266
266
  onKeyup=${i}
267
- ref=${s}
267
+ ref=${c}
268
268
  tabIndex="-1"
269
269
  >
270
270
  ${o}
271
271
  </div>
272
- `}function AM(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:$t(t)?n:void 0,maxWidth:$t(t)?"unset":void 0,"transform-origin":"top left"}}function TM(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function MM(e){const t=[];function n(i){i.forEach(r=>{if(r.entries){n(r.entries);return}t.push(r)})}return n(e),t}function kM(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 DM="data-id",f_=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],OM=1e3;function bt(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var r=$t(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()})}bt.$inject=["config.popupMenu","eventBus","canvas","search"],bt.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:r,options:o}=this._current,a=d_(n),c=Object.entries(i).map(([f,d])=>({id:f,...d})),s=e&&(f=>this._ensureVisible(f,e)),u=this._updateScale(this._current.container);Kv(ot`
273
- <${PM}
272
+ `}function kM(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:$t(t)?n:void 0,maxWidth:$t(t)?"unset":void 0,"transform-origin":"top left"}}function DM(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function OM(e){const t=[];function n(i){i.forEach(r=>{if(r.entries){n(r.entries);return}t.push(r)})}return n(e),t}function LM(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 IM="data-id",h_=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],NM=1e3;function bt(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var r=$t(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()})}bt.$inject=["config.popupMenu","eventBus","canvas","search"],bt.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:r,options:o}=this._current,a=m_(n),s=Object.entries(i).map(([f,d])=>({id:f,...d})),c=e&&(f=>this._ensureVisible(f,e)),u=this._updateScale(this._current.container);Zv(ot`
273
+ <${MM}
274
274
  onClose=${f=>this.close(f)}
275
275
  onSelect=${(f,d,h)=>this.trigger(f,d,h)}
276
- position=${s}
276
+ position=${c}
277
277
  className=${t}
278
278
  entries=${a}
279
- headerEntries=${c}
279
+ headerEntries=${s}
280
280
  emptyPlaceholder=${r}
281
281
  scale=${u}
282
282
  onOpened=${this._onOpened.bind(this)}
@@ -284,7 +284,7 @@
284
284
  searchFn=${this._search}
285
285
  ...${{...o}}
286
286
  />
287
- `,this._current.container)},bt.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:c}=this._getContext(e,t);this._current={position:n,providerId:t,target:e,entries:o,headerEntries:a,emptyPlaceholder:c,container:this._createContainer({provider:t}),options:i},this._emit("open"),this._bindAutoClose(),this._render()},bt.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()},bt.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)}},bt.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},bt.prototype.reset=function(){const e=this._current.container;Kv(null,e),li(e)},bt.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},bt.prototype._onOpened=function(){this._emit("opened")},bt.prototype._onClosed=function(){this._emit("closed")},bt.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=ut(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},bt.prototype._bindAutoClose=function(){this._eventBus.once(f_,this.close,this)},bt.prototype._unbindAutoClose=function(){this._eventBus.off(f_,this.close,this)},bt.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),$t(n)&&e<n&&(r=n),$t(i)&&e>i&&(r=i)),r},bt.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}},bt.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},bt.prototype.registerProvider=function(e,t,n){n||(n=t,t=OM),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},bt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},bt.prototype._getEntries=function(e,t){var n={};return M(t,function(i){if(!i.getPopupMenuEntries){M(i.getEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=ai(o,["id"])});return}var r=i.getPopupMenuEntries(e);Wt(r)?n=r(n):M(r,function(o,a){n[a]=o})}),n},bt.prototype._getHeaderEntries=function(e,t){var n={};return M(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;M(i.getHeaderEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=ai(o,["id"])});return}var r=i.getPopupMenuHeaderEntries(e);Wt(r)?n=r(n):M(r,function(o,a){n[a]=o})}),n},bt.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>Wt(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},bt.prototype.isOpen=function(){return!!this._current},bt.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let r=kr(e.delegateTarget||e.target,".entry",!0),o=an(r,DM);t={id:o,...this._getEntry(o)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(Wt(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},bt.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 d_(e,t=[]){return Object.entries(e).map(([n,i])=>{const r={id:n,...i};return r.entries?r.entries=d_(r.entries,[...t,...h_(r.search)]):t.length&&(r.search=[...t,...h_(r.search)]),r})}function h_(e){return e?_e(e)?e:[e]:[]}function LM(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=IM(o,r,i);return a?{item:o,tokens:a}:[]}).sort(NM(i))}function IM(e,t,n){const{matchedWords:i,tokens:r}=n.reduce((o,a)=>{const c=e[a],{tokens:s,matchedWords:u}=_e(c)?c.reduce((l,p)=>{const{tokens:f,matchedWords:d}=__(p,t);return{tokens:[...l.tokens,f],matchedWords:{...l.matchedWords,...d}}},{matchedWords:{},tokens:[]}):__(c,t);return{tokens:{...o.tokens,[a]:s},matchedWords:{...o.matchedWords,...u}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:r}function NM(e){return(t,n)=>{let i=0,r=1;for(const o of e){const a=BM(t.tokens[o],n.tokens[o]);if(a!==0){i+=a*r,r*=m_;continue}const c=$M(t.item[o],n.item[o]);if(c!==0){i+=c*r,r*=m_;continue}}return i}}function BM(e,t){return g_(t)-g_(e)}const m_=.5,Mo={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function g_(e){const t=e.reduce((c,s)=>c+y_(s),0),n=e.flat(),i=n.reduce((c,s)=>c+s.value.length,0),r=n.reduce((c,s)=>c+(s.match?s.value.length:0),0),o=i?r/i:0;return t*(1+o)}function y_(e){if(_e(e))return Math.max(...e.map(y_));const t=Math.log(e.value.length);return e.match?(e.start?e.end?Mo.FULL:e.wordEnd?Mo.START_FULL_WORD:Mo.START_WORD_PART:e.wordStart?Mo.WORD_START:Mo.WORD_PART)*t:Mo.NO_MATCH*t}function v_(e=""){return _e(e)?e.join(", "):e}function $M(e,t){return v_(e).localeCompare(v_(t))}function __(e,t){var u;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map(jM),o=[`(?<all>${r.join("\\s+")})`,...r].join("|"),a=new RegExp(o,"ig");let c,s=0;for(;c=a.exec(e);){const[l]=c,p=c.index,f=c.index+l.length,d=p===0,h=f===e.length,m=!!((u=c.groups)!=null&&u.all),g=d||/\s/.test(e.charAt(p-1)),R=h||/\s/.test(e.charAt(f));c.index>s&&n.push({value:e.slice(s,c.index),index:s}),n.push({value:l,index:c.index,match:!0,wordStart:g,wordEnd:R,start:d,end:h,all:m});const w=m?t:[l];for(const x of w)i[x.toLowerCase()]=!0;s=c.index+l.length}return s<e.length&&n.push({value:e.slice(s),index:s}),{tokens:n,matchedWords:i}}function jM(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const b_={search:["value",LM]},pf={__depends__:[b_],__init__:["popupMenu"],popupMenu:["type",bt]};var x_={align:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 2000">
287
+ `,this._current.container)},bt.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()},bt.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()},bt.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)}},bt.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},bt.prototype.reset=function(){const e=this._current.container;Zv(null,e),li(e)},bt.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},bt.prototype._onOpened=function(){this._emit("opened")},bt.prototype._onClosed=function(){this._emit("closed")},bt.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=ut(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},bt.prototype._bindAutoClose=function(){this._eventBus.once(h_,this.close,this)},bt.prototype._unbindAutoClose=function(){this._eventBus.off(h_,this.close,this)},bt.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),$t(n)&&e<n&&(r=n),$t(i)&&e>i&&(r=i)),r},bt.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}},bt.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},bt.prototype.registerProvider=function(e,t,n){n||(n=t,t=NM),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},bt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},bt.prototype._getEntries=function(e,t){var n={};return M(t,function(i){if(!i.getPopupMenuEntries){M(i.getEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=ai(o,["id"])});return}var r=i.getPopupMenuEntries(e);Wt(r)?n=r(n):M(r,function(o,a){n[a]=o})}),n},bt.prototype._getHeaderEntries=function(e,t){var n={};return M(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;M(i.getHeaderEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=ai(o,["id"])});return}var r=i.getPopupMenuHeaderEntries(e);Wt(r)?n=r(n):M(r,function(o,a){n[a]=o})}),n},bt.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>Wt(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},bt.prototype.isOpen=function(){return!!this._current},bt.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let r=kr(e.delegateTarget||e.target,".entry",!0),o=an(r,IM);t={id:o,...this._getEntry(o)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(Wt(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},bt.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 m_(e,t=[]){return Object.entries(e).map(([n,i])=>{const r={id:n,...i};return r.entries?r.entries=m_(r.entries,[...t,...g_(r.search)]):t.length&&(r.search=[...t,...g_(r.search)]),r})}function g_(e){return e?_e(e)?e:[e]:[]}function BM(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=$M(o,r,i);return a?{item:o,tokens:a}:[]}).sort(jM(i))}function $M(e,t,n){const{matchedWords:i,tokens:r}=n.reduce((o,a)=>{const s=e[a],{tokens:c,matchedWords:u}=_e(s)?s.reduce((l,p)=>{const{tokens:f,matchedWords:d}=x_(p,t);return{tokens:[...l.tokens,f],matchedWords:{...l.matchedWords,...d}}},{matchedWords:{},tokens:[]}):x_(s,t);return{tokens:{...o.tokens,[a]:c},matchedWords:{...o.matchedWords,...u}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:r}function jM(e){return(t,n)=>{let i=0,r=1;for(const o of e){const a=FM(t.tokens[o],n.tokens[o]);if(a!==0){i+=a*r,r*=y_;continue}const s=HM(t.item[o],n.item[o]);if(s!==0){i+=s*r,r*=y_;continue}}return i}}function FM(e,t){return v_(t)-v_(e)}const y_=.5,Do={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function v_(e){const t=e.reduce((s,c)=>s+__(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 __(e){if(_e(e))return Math.max(...e.map(__));const t=Math.log(e.value.length);return e.match?(e.start?e.end?Do.FULL:e.wordEnd?Do.START_FULL_WORD:Do.START_WORD_PART:e.wordStart?Do.WORD_START:Do.WORD_PART)*t:Do.NO_MATCH*t}function b_(e=""){return _e(e)?e.join(", "):e}function HM(e,t){return b_(e).localeCompare(b_(t))}function x_(e,t){var u;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map(zM),o=[`(?<all>${r.join("\\s+")})`,...r].join("|"),a=new RegExp(o,"ig");let s,c=0;for(;s=a.exec(e);){const[l]=s,p=s.index,f=s.index+l.length,d=p===0,h=f===e.length,m=!!((u=s.groups)!=null&&u.all),g=d||/\s/.test(e.charAt(p-1)),R=h||/\s/.test(e.charAt(f));s.index>c&&n.push({value:e.slice(c,s.index),index:c}),n.push({value:l,index:s.index,match:!0,wordStart:g,wordEnd:R,start:d,end:h,all:m});const w=m?t:[l];for(const b of w)i[b.toLowerCase()]=!0;c=s.index+l.length}return c<e.length&&n.push({value:e.slice(c),index:c}),{tokens:n,matchedWords:i}}function zM(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const w_={search:["value",BM]},df={__depends__:[w_],__init__:["popupMenu"],popupMenu:["type",bt]};var E_={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>`},FM=900;function ko(e,t,n,i){e.registerProvider(FM,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}ko.$inject=["contextPad","popupMenu","translate","canvas"],ko.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&O(t,this._getEntries(e)),t},ko.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},ko.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${x_.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);O(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},ko.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 HM=["left","center","right","top","middle","bottom"];function Ia(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}Ia.$inject=["popupMenu","alignElements","translate","rules"],Ia.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&O(t,this._getEntries(e)),t},Ia.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Ia.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return M(HM,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:x_[o],action:function(){t.trigger(e,o),i.close()}}}),r};function Qc(e){Yn.call(this,e)}Qc.$inject=["eventBus"],ie(Qc,Yn),Qc.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=Oe(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=xs(n),n.length<2?!1:n})};const zM={__depends__:[JT,Dv,pf],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",ko],alignElementsMenuProvider:["type",Ia],bpmnAlignElements:["type",Qc]};function Fi(e,t,n,i){X.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,c=a.hints||{},s=a.shape,u=a.parent||a.newParent;c.autoResize!==!1&&r._expand([s],u)}),this.postExecuted(["elements.move"],function(o){var a=o.context,c=Eu(Zr(a.closure.topLevel)),s=a.hints,u=s?s.autoResize:!0;if(u!==!1){var l=Qr(c,function(p){return p.parent.id});M(l,function(p,f){_e(u)&&(p=p.filter(function(d){return st(u,Jr({id:d.id}))})),r._expand(p,f)})}}),this.postExecuted(["shape.toggleCollapse"],function(o){var a=o.context,c=a.hints,s=a.shape;c&&c.autoResize===!1||s.collapsed||r._expand(s.children||[],s)}),this.postExecuted(["shape.resize"],function(o){var a=o.context,c=a.hints,s=a.shape,u=s.parent;c&&c.autoResize===!1||u&&r._expand([s],u)})}Fi.$inject=["eventBus","elementRegistry","modeling","rules"],ie(Fi,X),Fi.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=ye(At(e)),o=ye(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),Ss(O({},o,a))},Fi.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(VM(i,t)){var r=GM(ni(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},Fi.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Fi.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Fi.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function VM(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function GM(e,t){var n="";return e=ye(e),t=ye(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 Jc(e){e.invoke(Fi,this)}Jc.$inject=["injector"],ie(Jc,Fi),Jc.prototype.resize=function(e,t,n){v(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function Na(e){Yn.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}Na.$inject=["eventBus"],ie(Na,Yn),Na.prototype.canResize=function(e,t){return!1};function eu(e,t){Na.call(this,e),this._modeling=t}ie(eu,Na),eu.$inject=["eventBus","modeling"],eu.prototype.canResize=function(e,t){if(v(t.di,"bpmndi:BPMNPlane")||!v(t,"bpmn:Participant")&&!v(t,"bpmn:Lane")&&!v(t,"bpmn:SubProcess"))return!1;var n=!0;return M(e,function(i){if(v(i,"bpmn:Lane")||Me(i)){n=!1;return}}),n};const WM={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Jc],bpmnAutoResizeProvider:["type",eu]};function Do(e,t,n){this._canvas=n,this._opts=O({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()})}Do.$inject=["config.autoScroll","eventBus","canvas"],Do.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,c=0,s=0;s<4;s++)UM(o[s],n.scrollThresholdOut[s],n.scrollThresholdIn[s])&&(s===0?a=n.scrollStep:s==1?c=n.scrollStep:s==2?a=-n.scrollStep:s==3&&(c=-n.scrollStep));(a!==0||c!==0)&&(t.scroll({dx:a,dy:c}),this._scrolling=setTimeout(function(){i.startScroll(e)},n.scrollRepeatTimeout))};function UM(e,t,n){return t<e&&e<n}Do.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Do.prototype.setOptions=function(e){this._opts=O({},this._opts,e)},Do.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Br(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const YM={__depends__:[Li],__init__:["autoScroll"],autoScroll:["type",Do]};var w_="djs-bendpoint",E_="djs-segment-dragger";function qM(e,t){var n=Br(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 ff(e,t,n){var i=qM(e,n),r=Ml(t,i);return r}function df(e,t){var n=me("g");Fe(n).add(w_),Re(e,n);var i=me("circle");re(i,{cx:0,cy:0,r:4}),Fe(i).add("djs-visual"),Re(n,i);var r=me("circle");return re(r,{cx:0,cy:0,r:10}),Fe(r).add("djs-hit"),Re(n,r),t&&Fe(n).add(t),n}function KM(e,t,n,i){var r=me("g");Re(e,r);var o=18,a=6,c=11,s=ZM(t,n,i),u=a+c,l=me("rect");re(l,{x:-o/2,y:-a/2,width:o,height:a}),Fe(l).add("djs-visual"),Re(r,l);var p=me("rect");return re(p,{x:-s/2,y:-u/2,width:s,height:u}),Fe(p).add("djs-hit"),Re(r,p),Xh(r,i==="v"?90:0),r}function S_(e,t,n){var i=me("g"),r=ol(t,n),o=Ai(t,n);return Re(e,i),KM(i,t,n,o),Fe(i).add(E_),Fe(i).add(o==="h"?"horizontal":"vertical"),Qt(i,r.x,r.y),i}function hf(e){return Math.abs(Math.round(e*2/3))}function XM(e,t){var n=QM(e,t);return Nl(e,n)}function ZM(e,t,n){var i=t.x-e.x,r=t.y-e.y;return hf(n==="h"?i:r)}function QM(e,t){for(var n=t.waypoints,i=1/0,r,o=0;o<n.length-1;o++){var a=n[o],c=n[o+1],s=Nm(e,[a,c]);s<i&&(i=s,r=o)}return[n[r],n[r+1]]}function R_(e,t,n,i,r){function o(x,b,E){var T=x.index,L=x.point,A,F,H,N,V,fe;return T<=0||x.bendpoint?!1:(A=b[T-1],F=b[T],H=ol(A,F),N=Ai(A,F),V=Math.abs(L.x-H.x),fe=Math.abs(L.y-H.y),N&&V<=E&&fe<=E)}function a(x,b){var E=x.waypoints,T,L,A,F;return b.index<=0||b.bendpoint||(T={start:E[b.index-1],end:E[b.index]},L=Ai(T.start,T.end),!L)?null:(L==="h"?A=T.end.x-T.start.x:A=T.end.y-T.start.y,F=hf(A)/2,F)}function c(x,b){var E=b.waypoints,T=ff(t,E,x),L;if(T){L=a(b,T);var A;if(o(T,E,L)?A=r.start(x,b,T.index):A=i.start(x,b,T.index,!T.bendpoint),A!==!1)return!0}}function s(x,b,E){Se.bind(x,b,function(T){n.triggerMouseEvent(b,T,E),T.stopPropagation()})}function u(x,b){var E=t.getLayer("overlays"),T=et('.djs-bendpoints[data-element-id="'+Ma(x.id)+'"]',E);return!T&&b&&(T=me("g"),re(T,{"data-element-id":x.id}),Fe(T).add("djs-bendpoints"),Re(E,T),s(T,"mousedown",x),s(T,"click",x),s(T,"dblclick",x)),T}function l(x,b){return et('.djs-segment-dragger[data-segment-idx="'+x+'"]',b)}function p(x,b){b.waypoints.forEach(function(E,T){var L=df(x);Re(x,L),Qt(L,E.x,E.y)}),df(x,"floating")}function f(x,b){for(var E=b.waypoints,T,L,A,F=1;F<E.length;F++)T=E[F-1],L=E[F],Ai(T,L)&&(A=S_(x,T,L),re(A,{"data-segment-idx":F}),s(A,"mousemove",b))}function d(x){M(ys("."+w_,x),function(b){Ft(b)})}function h(x){M(ys("."+E_,x),function(b){Ft(b)})}function m(x){var b=u(x);return b||(b=u(x,!0),p(b,x),f(b,x)),b}function g(x){var b=u(x);b&&(h(b),d(b),f(b,x),p(b,x))}function R(x,b){var E=et(".floating",x),T=b.point;E&&(Qt(E,T.x,T.y),Fe(E).add("positioned"))}function w(x,b,E){var T=l(b.index,x),L=E[b.index-1],A=E[b.index],F=b.point,H=ol(L,A),N=Ai(L,A),V,fe;T&&(V=JM(T),fe={x:F.x-H.x,y:F.y-H.y},N==="v"&&(fe={x:fe.y,y:fe.x}),Qt(V,fe.x,fe.y))}e.on("connection.changed",function(x){g(x.element)}),e.on("connection.remove",function(x){var b=u(x.element);b&&Ft(b)}),e.on("element.marker.update",function(x){var b=x.element,E;b.waypoints&&(E=m(b),x.add?Fe(E).add(x.marker):Fe(E).remove(x.marker))}),e.on("element.mousemove",function(x){var b=x.element,E=b.waypoints,T,L;if(E){if(T=u(b,!0),L=ff(t,E,x.originalEvent),!L)return;R(T,L),L.bendpoint||w(T,L,E)}}),e.on("element.mousedown",function(x){if(ar(x)){var b=x.originalEvent,E=x.element;if(E.waypoints)return c(b,E)}}),e.on("selection.changed",function(x){var b=x.newSelection,E=b[0];E&&E.waypoints&&m(E)}),e.on("element.hover",function(x){var b=x.element;b.waypoints&&m(b)}),e.on("element.out",function(x){var b=x.element;if(b.waypoints){var E=u(b);if(E){var T=et(".floating",E);T&&Fe(T).remove("positioned")}}}),e.on("element.updateId",function(x){var b=x.element,E=x.newId;if(b.waypoints){var T=u(b);T&&re(T,{"data-element-id":E})}}),this.addHandles=m,this.updateHandles=g,this.getBendpointsContainer=u,this.getSegmentDragger=l}R_.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function JM(e){return et(".djs-visual",e)}var C_=Math.round,Wr="reconnectStart",Ur="reconnectEnd",Ba="updateWaypoints";function mf(e,t,n,i,r,o){this._injector=e,this.start=function(a,c,s,u){var l=n.getGraphics(c),p=c.source,f=c.target,d=c.waypoints,h;!u&&s===0?h=Wr:!u&&s===d.length-1?h=Ur:h=Ba;var m=h===Ba?"connection.updateWaypoints":"connection.reconnect",g=r.allowed(m,{connection:c,source:p,target:f});if(g===!1&&(g=r.allowed(m,{connection:c,source:f,target:p})),g!==!1)return i.init(a,"bendpoint.move",{data:{connection:c,connectionGfx:l,context:{allowed:g,bendpointIndex:s,connection:c,source:p,target:f,insert:u,type:h}}})},t.on("bendpoint.move.hover",function(a){var c=a.context,s=c.connection,u=s.source,l=s.target,p=a.hover,f=c.type;c.hover=p;var d;if(p){var h=f===Ba?"connection.updateWaypoints":"connection.reconnect";if(d=c.allowed=r.allowed(h,{connection:s,source:f===Wr?p:u,target:f===Ur?p:l}),d){c.source=f===Wr?p:u,c.target=f===Ur?p:l;return}d===!1&&(d=c.allowed=r.allowed(h,{connection:s,source:f===Ur?p:l,target:f===Wr?p:u})),d&&(c.source=f===Ur?p:l,c.target=f===Wr?p:u)}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(a){var c=a.context,s=c.type;c.hover=null,c.source=null,c.target=null,s!==Ba&&(c.allowed=!1)}),t.on("bendpoint.move.end",function(a){var c=a.context,s=c.allowed,u=c.bendpointIndex,l=c.connection,p=c.insert,f=l.waypoints.slice(),d=c.source,h=c.target,m=c.type,g=c.hints||{},R={x:C_(a.x),y:C_(a.y)};if(!s)return!1;m===Ba?(p?f.splice(u,0,R):f[u]=R,g.bendpointMove={insert:p,bendpointIndex:u},f=this.cropWaypoints(l,f),o.updateWaypoints(l,g1(f),g)):(m===Wr?(g.docking="source",tu(c)&&(g.docking="target",g.newWaypoints=f.reverse())):m===Ur&&(g.docking="target",tu(c)&&(g.docking="source",g.newWaypoints=f.reverse())),o.reconnect(l,d,h,R,g))},this)}mf.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],mf.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 tu(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 e2="reconnectStart",t2="reconnectEnd",P_="updateWaypoints",$a="connect-ok",nu="connect-not-ok",A_="connect-hover",T_="djs-updating",M_="djs-dragging",k_=1100;function D_(e,t,n,i){this._injector=t;var r=t.get("connectionPreview",!1);n.on("bendpoint.move.start",function(o){var a=o.context,c=a.bendpointIndex,s=a.connection,u=a.insert,l=s.waypoints,p=l.slice();a.waypoints=l,u&&p.splice(c,0,{x:o.x,y:o.y}),s.waypoints=p;var f=a.draggerGfx=df(i.getLayer("overlays"));Fe(f).add("djs-dragging"),i.addMarker(s,M_),i.addMarker(s,T_)}),n.on("bendpoint.move.hover",function(o){var a=o.context,c=a.allowed,s=a.hover,u=a.type;if(s){if(i.addMarker(s,A_),u===P_)return;c?(i.removeMarker(s,nu),i.addMarker(s,$a)):c===!1&&(i.removeMarker(s,$a),i.addMarker(s,nu))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],k_,function(o){var a=o.context,c=a.hover,s=a.target;c&&(i.removeMarker(c,A_),i.removeMarker(c,s?$a:nu))}),n.on("bendpoint.move.move",function(o){var a=o.context,c=a.allowed,s=a.bendpointIndex,u=a.draggerGfx,l=a.hover,p=a.type,f=a.connection,d=f.source,h=f.target,m=f.waypoints.slice(),g={x:o.x,y:o.y},R=a.hints||{},w={};r&&(R.connectionStart&&(w.connectionStart=R.connectionStart),R.connectionEnd&&(w.connectionEnd=R.connectionEnd),p===e2?tu(a)?(w.connectionEnd=w.connectionEnd||g,w.source=h,w.target=l||d,m=m.reverse()):(w.connectionStart=w.connectionStart||g,w.source=l||d,w.target=h):p===t2?tu(a)?(w.connectionStart=w.connectionStart||g,w.source=l||h,w.target=d,m=m.reverse()):(w.connectionEnd=w.connectionEnd||g,w.source=d,w.target=l||h):(w.noCropping=!0,w.noLayout=!0,m[s]=g),p===P_&&(m=e.cropWaypoints(f,m)),w.waypoints=m,r.drawPreview(a,c,w)),Qt(u,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],k_,function(o){var a=o.context,c=a.connection,s=a.draggerGfx,u=a.hover,l=a.target,p=a.waypoints;c.waypoints=p,Ft(s),i.removeMarker(c,T_),i.removeMarker(c,M_),u&&(i.removeMarker(u,$a),i.removeMarker(u,l?$a:nu)),r&&r.cleanUp(a)})}D_.$inject=["bendpointMove","injector","eventBus","canvas"];var O_="connect-hover",L_="djs-updating";function I_(e,t,n){return gf(e,t,e[t]+n)}function gf(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function n2(e,t,n,i){var r=Math.max(t[i],n[i]),o=Math.min(t[i],n[i]),a=20,c=Math.min(Math.max(o+a,e[i]),r-a);return gf(t,i,c)}function N_(e){return e==="x"?"y":"x"}function B_(e,t,n){var i,r;return e.original?e.original:(i=be(t),r=N_(n),gf(e,r,i[r]))}function $_(e,t,n,i,r,o){var a=e.get("connectionDocking",!1);this.start=function(p,f,d){var h,m=n.getGraphics(f),g=d-1,R=d,w=f.waypoints,x=w[g],b=w[R],E=ff(n,w,p),T,L,A;if(T=Ai(x,b),!!T)return L=T==="v"?"x":"y",g===0&&(x=B_(x,f.source,L)),R===w.length-1&&(b=B_(b,f.target,L)),E?A=E.point:A={x:(x.x+b.x)/2,y:(x.y+b.y)/2},h={connection:f,segmentStartIndex:g,segmentEndIndex:R,segmentStart:x,segmentEnd:b,axis:L,dragPosition:A},i.init(p,A,"connectionSegment.move",{cursor:L==="x"?"resize-ew":"resize-ns",data:{connection:f,connectionGfx:m,context:h}})};function c(p,f){if(!a)return f;var d=p.waypoints,h;return p.waypoints=f,h=a.getCroppedWaypoints(p),p.waypoints=d,h}function s(p){r.update("connection",p.connection,p.connectionGfx)}function u(p,f,d){var h=p.newWaypoints,m=p.segmentStartIndex+f,g=h[m],R=p.segmentEndIndex+f,w=h[R],x=N_(p.axis),b=n2(d,g,w,x);Qt(p.draggerGfx,b.x,b.y)}function l(p,f){var d=0,h=p.filter(function(m,g){return rl(p[g-1],p[g+1],m)?(d=g<=f?d-1:d,!1):!0});return{waypoints:h,segmentOffset:d}}t.on("connectionSegment.move.start",function(p){var f=p.context,d=p.connection,h=n.getLayer("overlays");f.originalWaypoints=d.waypoints.slice(),f.draggerGfx=S_(h,f.segmentStart,f.segmentEnd),Fe(f.draggerGfx).add("djs-dragging"),n.addMarker(d,L_)}),t.on("connectionSegment.move.move",function(p){var f=p.context,d=f.connection,h=f.segmentStartIndex,m=f.segmentEndIndex,g=f.segmentStart,R=f.segmentEnd,w=f.axis,x=f.originalWaypoints.slice(),b=I_(g,w,p["d"+w]),E=I_(R,w,p["d"+w]),T=x.length,L=0;x[h]=b,x[m]=E;var A,F;h<2&&(A=Zt(d.source,b),h===1?A==="intersect"&&(x.shift(),x[0]=b,L--):A!=="intersect"&&(x.unshift(g),L++)),m>T-3&&(F=Zt(d.target,E),m===T-2?F==="intersect"&&(x.pop(),x[x.length-1]=E):F!=="intersect"&&x.push(R)),f.newWaypoints=d.waypoints=c(d,x),u(f,L,p),f.newSegmentStartIndex=h+L,s(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,O_)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,O_)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,d=f.connection;f.draggerGfx&&Ft(f.draggerGfx),n.removeMarker(d,L_)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(p){var f=p.context,d=f.connection;d.waypoints=f.originalWaypoints,s(p)}),t.on("connectionSegment.move.end",function(p){var f=p.context,d=f.connection,h=f.newWaypoints,m=f.newSegmentStartIndex;h=h.map(function(E){return{original:E.original,x:Math.round(E.x),y:Math.round(E.y)}});var g=l(h,m),R=g.waypoints,w=c(d,R),x=g.segmentOffset,b={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:m+x}};o.updateWaypoints(d,w,b)})}$_.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var i2=Math.abs,j_=Math.round;function r2(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],i2(r-e)<=n)return r}function F_(e){return{x:e.x,y:e.y}}function H_(e){return{x:e.x+e.width,y:e.y+e.height}}function Zn(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:j_(e.x+e.width/2),y:j_(e.y+e.height/2)}}function Oo(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function Dt(e,t,n){if(typeof t!="string")throw new Error("axis must be in [x, y]");if(typeof n!="number"&&n!==!1)throw new Error("value must be Number or false");var i,r=e[t],o=e.snapped=e.snapped||{};return n===!1?o[t]=!1:(o[t]=!0,i=n-r,e[t]+=i,e["d"+t]+=i),r}function z_(e){return e.children||[]}var o2=Math.abs,V_=Math.round,yf=10;function G_(e){function t(o,a){if(_e(o)){for(var c=o.length;c--;)if(o2(o[c]-a)<=yf)return o[c]}else{o=+o;var s=a%o;if(s<yf)return a-s;if(s>o-yf)return a-s+o}return a}function n(o,a){if(o.waypoints)return XM(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,c=a.snapPoints,s=a.connection,u=s.waypoints,l=a.segmentStart,p=a.segmentStartIndex,f=a.segmentEnd,d=a.segmentEndIndex,h=a.axis;if(c)return c;var m=[u[p-1],l,f,u[d+1]];return p<2&&m.unshift(n(s.source,o)),d>u.length-3&&m.unshift(n(s.target,o)),a.snapPoints=c={horizontal:[],vertical:[]},M(m,function(g){g&&(g=g.original||g,h==="y"&&c.horizontal.push(g.y),h==="x"&&c.vertical.push(g.x))}),c}e.on("connectionSegment.move.move",1500,function(o){var a=i(o),c=o.x,s=o.y,u,l;if(a){u=t(a.vertical,c),l=t(a.horizontal,s);var p=c-u,f=s-l;O(o,{dx:o.dx-p,dy:o.dy-f,x:u,y:l}),(p||a.vertical.indexOf(c)!==-1)&&Dt(o,"x",u),(f||a.horizontal.indexOf(s)!==-1)&&Dt(o,"y",l)}});function r(o){var a=o.snapPoints,c=o.connection.waypoints,s=o.bendpointIndex;if(a)return a;var u=[c[s-1],c[s+1]];return o.snapPoints=a={horizontal:[],vertical:[]},M(u,function(l){l&&(l=l.original||l,a.horizontal.push(l.y),a.vertical.push(l.x))}),a}e.on(["connect.hover","connect.move","connect.end"],1500,function(o){var a=o.context,c=a.hover,s=c&&n(c,o);!it(c)||!s||!s.x||!s.y||(Dt(o,"x",s.x),Dt(o,"y",s.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(o){var a=o.context,c=r(a),s=a.hover,u=s&&n(s,o),l=o.x,p=o.y,f,d;if(c){f=t(u?c.vertical.concat([u.x]):c.vertical,l),d=t(u?c.horizontal.concat([u.y]):c.horizontal,p);var h=l-f,m=p-d;O(o,{dx:o.dx-h,dy:o.dy-m,x:o.x-h,y:o.y-m}),(h||c.vertical.indexOf(l)!==-1)&&Dt(o,"x",f),(m||c.horizontal.indexOf(p)!==-1)&&Dt(o,"y",d)}})}G_.$inject=["eventBus"];const a2={__depends__:[Li,gi],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",R_],bendpointMove:["type",mf],bendpointMovePreview:["type",D_],connectionSegmentMove:["type",$_],bendpointSnapping:["type",G_]};function W_(e,t,n,i){function r(a,c){return i.allowed("connection.create",{source:a,target:c})}function o(a,c){return r(c,a)}e.on("connect.hover",function(a){var c=a.context,s=c.start,u=a.hover,l;if(c.hover=u,l=c.canExecute=r(s,u),!Xr(l)){if(l!==!1){c.source=s,c.target=u;return}l=c.canExecute=o(s,u),!Xr(l)&&l!==!1&&(c.source=u,c.target=s)}}),e.on(["connect.out","connect.cleanup"],function(a){var c=a.context;c.hover=null,c.source=null,c.target=null,c.canExecute=!1}),e.on("connect.end",function(a){var c=a.context,s=c.canExecute,u=c.connectionStart,l={x:a.x,y:a.y},p=c.source,f=c.target;if(!s)return!1;var d=null,h={connectionStart:vf(c)?l:u,connectionEnd:vf(c)?u:l};Gt(s)&&(d=s),c.connection=n.connect(p,f,d,h)}),this.start=function(a,c,s,u){Gt(s)||(u=s,s=be(c)),t.init(a,"connect",{autoActivate:u,data:{shape:c,context:{start:c,connectionStart:s}}})}}W_.$inject=["eventBus","dragging","modeling","rules"];function vf(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var s2=1100,c2=900,U_="connect-ok",Y_="connect-not-ok";function q_(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",function(r){var o=r.context,a=o.canExecute,c=o.hover,s=o.source,u=o.start,l=o.startPosition,p=o.target,f=o.connectionStart||l,d=o.connectionEnd||{x:r.x,y:r.y},h=f,m=d;vf(o)&&(h=d,m=f),i.drawPreview(o,a,{source:s||u,target:p||c,connectionStart:h,connectionEnd:m})}),t.on("connect.hover",c2,function(r){var o=r.context,a=r.hover,c=o.canExecute;c!==null&&n.addMarker(a,c?U_:Y_)}),t.on(["connect.out","connect.cleanup"],s2,function(r){var o=r.hover;o&&(n.removeMarker(o,U_),n.removeMarker(o,Y_))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}q_.$inject=["injector","eventBus","canvas"];const _f={__depends__:[qn,gi,Li],__init__:["connectPreview"],connect:["type",W_],connectPreview:["type",q_]};var u2="djs-dragger";function Hi(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)}Hi.$inject=["injector","canvas","graphicsFactory","elementFactory"],Hi.prototype.drawPreview=function(e,t,n){n=n||{};var i=e.connectionPreviewGfx,r=e.getConnection,o=n.source,a=n.target,c=n.waypoints,s=n.connectionStart,u=n.connectionEnd,l=n.noLayout,p=n.noCropping,f=n.noNoop,d,h=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),vs(i),r||(r=e.getConnection=l2(function(m,g,R){return h.getConnection(m,g,R)})),t&&(d=r(t,o,a)),!d){!f&&this.drawNoopPreview(i,n);return}d.waypoints=c||[],this._layouter&&!l&&(d.waypoints=this._layouter.layoutConnection(d,{source:o,target:a,connectionStart:s,connectionEnd:u,waypoints:n.waypoints||d.waypoints})),(!d.waypoints||!d.waypoints.length)&&(d.waypoints=[o?be(o):s,a?be(a):u]),this._connectionDocking&&(o||a)&&!p&&(d.waypoints=this._connectionDocking.getCroppedWaypoints(d,o,a)),this._graphicsFactory.drawConnection(i,d,{stroke:"var(--element-dragger-color)"})},Hi.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||be(n),o=t.connectionEnd||be(i),a=this.cropWaypoints(r,o,n,i),c=this.createNoopConnection(a[0],a[1]);Re(e,c)},Hi.prototype.cropWaypoints=function(e,t,n,i){var r=this._graphicsFactory,o=n&&r.getShapePath(n),a=i&&r.getShapePath(i),c=r.getConnectionPath({waypoints:[e,t]});return e=n&&Qo(o,c,!0)||e,t=i&&Qo(a,c,!1)||t,[e,t]},Hi.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&Ft(e.connectionPreviewGfx)},Hi.prototype.getConnection=function(e){var t=p2(e);return this._elementFactory.createConnection(t)},Hi.prototype.createConnectionPreviewGfx=function(){var e=me("g");return re(e,{pointerEvents:"none"}),Fe(e).add(u2),Re(this._canvas.getActiveLayer(),e),e},Hi.prototype.createNoopConnection=function(e,t){return qo([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function l2(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 p2(e){return Gt(e)?e:{}}const f2={__init__:["connectionPreview"],connectionPreview:["type",Hi]},iu="complex-preview";class K_{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(iu);n.filter(c=>!d2(c)).forEach(c=>{let s;it(c)?(s=this._graphicsFactory._createContainer("connection",me("g")),this._graphicsFactory.drawConnection(Lr(s),c)):(s=this._graphicsFactory._createContainer("shape",me("g")),this._graphicsFactory.drawShape(Lr(s),c),Qt(s,c.x,c.y)),this._previewSupport.addDragger(c,a,s)}),i.forEach(({element:c,delta:s})=>{this._previewSupport.addDragger(c,a,void 0,"djs-dragging"),this._canvas.addMarker(c,"djs-element-hidden"),this._markers.push([c,"djs-element-hidden"]);const u=this._previewSupport.addDragger(c,a);it(c)?Qt(u,s.x,s.y):Qt(u,c.x+s.x,c.y+s.y)}),r.forEach(c=>{this._previewSupport.addDragger(c,a,void 0,"djs-dragging"),this._canvas.addMarker(c,"djs-element-hidden"),this._markers.push([c,"djs-element-hidden"])}),o.forEach(({shape:c,bounds:s})=>{this._canvas.addMarker(c,"djs-hidden"),this._markers.push([c,"djs-hidden"]),this._previewSupport.addDragger(c,a,void 0,"djs-dragging");const u=this._graphicsFactory._createContainer("shape",me("g"));this._graphicsFactory.drawShape(Lr(u),c,{width:s.width,height:s.height}),Qt(u,s.x,s.y),this._previewSupport.addDragger(c,a,u)})}cleanUp(){vs(this._canvas.getLayer(iu)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(iu)}hide(){this._canvas.hideLayer(iu)}}K_.$inject=["canvas","graphicsFactory","previewSupport"];function d2(e){return e.hidden}const h2={__depends__:[Eo],__init__:["complexPreview"],complexPreview:["type",K_]},X_=Math.round;function ru(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}ru.prototype.create=function(e,t,n){const i=this._complexPreview,r=this._connectionDocking,o=this._elementFactory,a=this._eventBus,c=this._layouter,s=this._rules,u=o.createShape(O({type:t},n)),l=a.fire("autoPlace",{source:e,shape:u});if(!l)return;O(u,{x:l.x-X_(u.width/2),y:l.y-X_(u.height/2)});const p=s.allowed("connection.create",{source:e,target:u,hints:{targetParent:e.parent}});let f=null;p&&(f=o.createConnection(p),f.waypoints=c.layoutConnection(f,{source:e,target:u}),f.waypoints=r.getCroppedWaypoints(f,e,u)),i.create({created:[u,f].filter(d=>!Xr(d))})},ru.prototype.cleanUp=function(){this._complexPreview.cleanUp()},ru.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const m2={__depends__:[kc,h2,Gp],__init__:["appendPreview"],appendPreview:["type",ru]};var Z_=Math.min,Q_=Math.max;function bf(e){e.preventDefault()}function ja(e){e.stopPropagation()}function g2(e){return e.nodeType===Node.TEXT_NODE}function y2(e){return[].slice.call(e)}function ri(e){this.container=e.container,this.parent=ut('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=et("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=vn(this.autoResize,this),this.handlePaste=vn(this.handlePaste,this)}ri.prototype.create=function(e,t,n,i){var r=this,o=this.parent,a=this.content,c=this.container;i=this.options=i||{},t=this.style=t||{};var s=ni(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);O(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"},s);var u=ni(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return O(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},u),i.centerVertically&&O(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},u),a.innerText=n,Se.bind(a,"keydown",this.keyHandler),Se.bind(a,"mousedown",ja),Se.bind(a,"paste",r.handlePaste),Se.bind(a,"focusout",this.focusoutHandler),i.autoResize&&Se.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),c.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},ri.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)}},ri.prototype.insertText=function(e){e=v2(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},ri.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,c=y2(a.childNodes),s,u;if(g2(a)){var l=n.textContent;n.textContent=l.substring(0,r)+e+l.substring(o),s=n,u=r+e.length}else if(n===this.content&&i===this.content){var p=document.createTextNode(e);this.content.insertBefore(p,c[r]),s=p,u=p.textContent.length}else{var f=c.indexOf(n),d=c.indexOf(i);c.forEach(function(h,m){m===f?h.textContent=n.textContent.substring(0,r)+e+i.textContent.substring(o):m>f&&m<=d&&li(h)}),s=n,u=r+e.length}s&&u!==void 0&&setTimeout(function(){self.setSelection(s,u)})},ri.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})}},ri.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,i=parseInt(this.style.minWidth)||0,r=parseInt(this.style.minHeight)||0,o=parseInt(this.style.maxWidth)||1/0,a=parseInt(this.style.maxHeight)||1/0;if(!n){n=this.resizeHandle=ut('<div class="djs-direct-editing-resize-handle"></div>');var c,s,u,l,p=function(h){bf(h),ja(h),c=h.clientX,s=h.clientY;var m=t.getBoundingClientRect();u=m.width,l=m.height,Se.bind(document,"mousemove",f),Se.bind(document,"mouseup",d)},f=function(h){bf(h),ja(h);var m=Z_(Q_(u+h.clientX-c,i),o),g=Z_(Q_(l+h.clientY-s,r),a);t.style.width=m+"px",t.style.height=g+"px",e.resizeHandler({width:u,height:l,dx:h.clientX-c,dy:h.clientY-s})},d=function(h){bf(h),ja(h),Se.unbind(document,"mousemove",f,!1),Se.unbind(document,"mouseup",d,!1)};Se.bind(n,"mousedown",p)}O(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)},ri.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),Se.unbind(t,"keydown",this.keyHandler),Se.unbind(t,"mousedown",ja),Se.unbind(t,"input",this.autoResize),Se.unbind(t,"paste",this.handlePaste),Se.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),li(n)),li(e)},ri.prototype.getValue=function(){return this.content.innerText.trim()},ri.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},ri.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 v2(e){return e.replace(/\r\n|\r|\n/g,`
316
- `)}function Dn(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new ri({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())}Dn.$inject=["eventBus","canvas"],Dn.prototype.registerProvider=function(e){this._providers.push(e)},Dn.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},Dn.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},Dn.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},Dn.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},Dn.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},Dn.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()}},Dn.prototype.getValue=function(){return this._textbox.getValue()},Dn.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()},Dn.prototype._handleResize=function(e){this._fire("resize",e)},Dn.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},Dn.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=st(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 J_={__depends__:[sc],__init__:["directEditing"],directEditing:["type",Dn]};function _2(e){return function(t){var n=t.target,i=Z(e),r=i.eventDefinitions&&i.eventDefinitions[0],o=i.$type===n.type,a=(r&&r.$type)===n.eventDefinitionType,c=!!n.triggeredByEvent==!!i.triggeredByEvent,s=n.isExpanded===void 0||n.isExpanded===$e(e);return!o||!a||!c||!s}}const b2={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 K(e,t={}){var n=b2[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var x2=[K("none-start-event",{actionName:"replace-with-none-start"}),K("none-intermediate-throwing"),K("none-end-event",{actionName:"replace-with-none-end"}),K("message-start"),K("timer-start"),K("conditional-start"),K("signal-start")],w2=[K("none-start-event",{actionName:"replace-with-none-start"}),K("none-intermediate-throwing"),K("none-end-event",{actionName:"replace-with-none-end"})],E2=[K("none-start-event",{actionName:"replace-with-none-start"}),K("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),K("none-end-event",{actionName:"replace-with-none-end"}),K("message-intermediate-catch"),K("message-intermediate-throw"),K("timer-intermediate-catch"),K("escalation-intermediate-throw"),K("conditional-intermediate-catch"),K("link-intermediate-catch"),K("link-intermediate-throw"),K("compensation-intermediate-throw"),K("signal-intermediate-catch"),K("signal-intermediate-throw")],S2=[K("none-start-event",{actionName:"replace-with-none-start"}),K("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),K("none-end-event",{actionName:"replace-with-none-end"}),K("message-end"),K("escalation-end"),K("error-end"),K("cancel-end"),K("compensation-end"),K("signal-end"),K("terminate-end")],R2=[K("exclusive-gateway"),K("parallel-gateway"),K("inclusive-gateway"),K("complex-gateway"),K("event-based-gateway")],C2=[K("transaction"),K("event-subprocess"),K("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),K("collapsed-subprocess")],P2=[K("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),K("transaction"),K("event-subprocess"),K("collapsed-ad-hoc-subprocess")],eb=[K("transaction"),K("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),K("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),K("event-subprocess")],A2=eb,tb=[K("task"),K("user-task"),K("service-task"),K("send-task"),K("receive-task"),K("manual-task"),K("rule-task"),K("script-task"),K("call-activity"),K("collapsed-subprocess"),K("expanded-subprocess"),K("collapsed-ad-hoc-subprocess"),K("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],T2=[K("data-store-reference")],M2=[K("data-object-reference")],k2=[K("message-boundary"),K("timer-boundary"),K("escalation-boundary"),K("conditional-boundary"),K("error-boundary"),K("cancel-boundary"),K("signal-boundary"),K("compensation-boundary"),K("non-interrupting-message-boundary"),K("non-interrupting-timer-boundary"),K("non-interrupting-escalation-boundary"),K("non-interrupting-conditional-boundary"),K("non-interrupting-signal-boundary")],D2=[K("message-start"),K("timer-start"),K("conditional-start"),K("signal-start"),K("error-start"),K("escalation-start"),K("compensation-start"),K("non-interrupting-message-start"),K("non-interrupting-timer-start"),K("non-interrupting-conditional-start"),K("non-interrupting-signal-start"),K("non-interrupting-escalation-start")],O2=[{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"}],L2=[K("expanded-pool"),K("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],I2={"bpmn:MessageEventDefinition":[K("message-start"),K("message-intermediate-catch"),K("message-intermediate-throw"),K("message-end")],"bpmn:TimerEventDefinition":[K("timer-start"),K("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[K("conditional-start"),K("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[K("signal-start"),K("signal-intermediate-catch"),K("signal-intermediate-throw"),K("signal-end")],"bpmn:ErrorEventDefinition":[K("error-start"),K("error-end")],"bpmn:EscalationEventDefinition":[K("escalation-start"),K("escalation-intermediate-throw"),K("escalation-end")],"bpmn:CompensateEventDefinition":[K("compensation-start"),K("compensation-intermediate-throw"),K("compensation-end")]};const nb={"start-event-non-interrupting":`
315
+ </svg>`},VM=900;function Oo(e,t,n,i){e.registerProvider(VM,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}Oo.$inject=["contextPad","popupMenu","translate","canvas"],Oo.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&O(t,this._getEntries(e)),t},Oo.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Oo.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${E_.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);O(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},Oo.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 GM=["left","center","right","top","middle","bottom"];function Na(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}Na.$inject=["popupMenu","alignElements","translate","rules"],Na.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&O(t,this._getEntries(e)),t},Na.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Na.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return M(GM,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:E_[o],action:function(){t.trigger(e,o),i.close()}}}),r};function Qc(e){Yn.call(this,e)}Qc.$inject=["eventBus"],ie(Qc,Yn),Qc.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=Oe(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=xs(n),n.length<2?!1:n})};const WM={__depends__:[nM,Lv,df],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Oo],alignElementsMenuProvider:["type",Na],bpmnAlignElements:["type",Qc]};function Fi(e,t,n,i){X.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=Eu(Zr(a.closure.topLevel)),c=a.hints,u=c?c.autoResize:!0;if(u!==!1){var l=Qr(s,function(p){return p.parent.id});M(l,function(p,f){_e(u)&&(p=p.filter(function(d){return st(u,Jr({id:d.id}))})),r._expand(p,f)})}}),this.postExecuted(["shape.toggleCollapse"],function(o){var a=o.context,s=a.hints,c=a.shape;s&&s.autoResize===!1||c.collapsed||r._expand(c.children||[],c)}),this.postExecuted(["shape.resize"],function(o){var a=o.context,s=a.hints,c=a.shape,u=c.parent;s&&s.autoResize===!1||u&&r._expand([c],u)})}Fi.$inject=["eventBus","elementRegistry","modeling","rules"],ie(Fi,X),Fi.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=ye(At(e)),o=ye(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),Ss(O({},o,a))},Fi.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(UM(i,t)){var r=YM(ni(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},Fi.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Fi.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Fi.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function UM(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function YM(e,t){var n="";return e=ye(e),t=ye(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 Jc(e){e.invoke(Fi,this)}Jc.$inject=["injector"],ie(Jc,Fi),Jc.prototype.resize=function(e,t,n){v(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function Ba(e){Yn.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}Ba.$inject=["eventBus"],ie(Ba,Yn),Ba.prototype.canResize=function(e,t){return!1};function eu(e,t){Ba.call(this,e),this._modeling=t}ie(eu,Ba),eu.$inject=["eventBus","modeling"],eu.prototype.canResize=function(e,t){if(v(t.di,"bpmndi:BPMNPlane")||!v(t,"bpmn:Participant")&&!v(t,"bpmn:Lane")&&!v(t,"bpmn:SubProcess"))return!1;var n=!0;return M(e,function(i){if(v(i,"bpmn:Lane")||Me(i)){n=!1;return}}),n};const qM={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Jc],bpmnAutoResizeProvider:["type",eu]};function Lo(e,t,n){this._canvas=n,this._opts=O({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()})}Lo.$inject=["config.autoScroll","eventBus","canvas"],Lo.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++)KM(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 KM(e,t,n){return t<e&&e<n}Lo.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Lo.prototype.setOptions=function(e){this._opts=O({},this._opts,e)},Lo.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Br(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const XM={__depends__:[Li],__init__:["autoScroll"],autoScroll:["type",Lo]};var S_="djs-bendpoint",R_="djs-segment-dragger";function ZM(e,t){var n=Br(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 hf(e,t,n){var i=ZM(e,n),r=Dl(t,i);return r}function mf(e,t){var n=me("g");je(n).add(S_),Re(e,n);var i=me("circle");re(i,{cx:0,cy:0,r:4}),je(i).add("djs-visual"),Re(n,i);var r=me("circle");return re(r,{cx:0,cy:0,r:10}),je(r).add("djs-hit"),Re(n,r),t&&je(n).add(t),n}function QM(e,t,n,i){var r=me("g");Re(e,r);var o=18,a=6,s=11,c=e2(t,n,i),u=a+s,l=me("rect");re(l,{x:-o/2,y:-a/2,width:o,height:a}),je(l).add("djs-visual"),Re(r,l);var p=me("rect");return re(p,{x:-c/2,y:-u/2,width:c,height:u}),je(p).add("djs-hit"),Re(r,p),Qh(r,i==="v"?90:0),r}function C_(e,t,n){var i=me("g"),r=sl(t,n),o=Ai(t,n);return Re(e,i),QM(i,t,n,o),je(i).add(R_),je(i).add(o==="h"?"horizontal":"vertical"),Qt(i,r.x,r.y),i}function gf(e){return Math.abs(Math.round(e*2/3))}function JM(e,t){var n=t2(e,t);return $l(e,n)}function e2(e,t,n){var i=t.x-e.x,r=t.y-e.y;return gf(n==="h"?i:r)}function t2(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=$m(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function P_(e,t,n,i,r){function o(b,x,E){var T=b.index,L=b.point,A,j,H,N,G,fe;return T<=0||b.bendpoint?!1:(A=x[T-1],j=x[T],H=sl(A,j),N=Ai(A,j),G=Math.abs(L.x-H.x),fe=Math.abs(L.y-H.y),N&&G<=E&&fe<=E)}function a(b,x){var E=b.waypoints,T,L,A,j;return x.index<=0||x.bendpoint||(T={start:E[x.index-1],end:E[x.index]},L=Ai(T.start,T.end),!L)?null:(L==="h"?A=T.end.x-T.start.x:A=T.end.y-T.start.y,j=gf(A)/2,j)}function s(b,x){var E=x.waypoints,T=hf(t,E,b),L;if(T){L=a(x,T);var A;if(o(T,E,L)?A=r.start(b,x,T.index):A=i.start(b,x,T.index,!T.bendpoint),A!==!1)return!0}}function c(b,x,E){Se.bind(b,x,function(T){n.triggerMouseEvent(x,T,E),T.stopPropagation()})}function u(b,x){var E=t.getLayer("overlays"),T=et('.djs-bendpoints[data-element-id="'+ka(b.id)+'"]',E);return!T&&x&&(T=me("g"),re(T,{"data-element-id":b.id}),je(T).add("djs-bendpoints"),Re(E,T),c(T,"mousedown",b),c(T,"click",b),c(T,"dblclick",b)),T}function l(b,x){return et('.djs-segment-dragger[data-segment-idx="'+b+'"]',x)}function p(b,x){x.waypoints.forEach(function(E,T){var L=mf(b);Re(b,L),Qt(L,E.x,E.y)}),mf(b,"floating")}function f(b,x){for(var E=x.waypoints,T,L,A,j=1;j<E.length;j++)T=E[j-1],L=E[j],Ai(T,L)&&(A=C_(b,T,L),re(A,{"data-segment-idx":j}),c(A,"mousemove",x))}function d(b){M(ys("."+S_,b),function(x){Ft(x)})}function h(b){M(ys("."+R_,b),function(x){Ft(x)})}function m(b){var x=u(b);return x||(x=u(b,!0),p(x,b),f(x,b)),x}function g(b){var x=u(b);x&&(h(x),d(x),f(x,b),p(x,b))}function R(b,x){var E=et(".floating",b),T=x.point;E&&(Qt(E,T.x,T.y),je(E).add("positioned"))}function w(b,x,E){var T=l(x.index,b),L=E[x.index-1],A=E[x.index],j=x.point,H=sl(L,A),N=Ai(L,A),G,fe;T&&(G=n2(T),fe={x:j.x-H.x,y:j.y-H.y},N==="v"&&(fe={x:fe.y,y:fe.x}),Qt(G,fe.x,fe.y))}e.on("connection.changed",function(b){g(b.element)}),e.on("connection.remove",function(b){var x=u(b.element);x&&Ft(x)}),e.on("element.marker.update",function(b){var x=b.element,E;x.waypoints&&(E=m(x),b.add?je(E).add(b.marker):je(E).remove(b.marker))}),e.on("element.mousemove",function(b){var x=b.element,E=x.waypoints,T,L;if(E){if(T=u(x,!0),L=hf(t,E,b.originalEvent),!L)return;R(T,L),L.bendpoint||w(T,L,E)}}),e.on("element.mousedown",function(b){if(ar(b)){var x=b.originalEvent,E=b.element;if(E.waypoints)return s(x,E)}}),e.on("selection.changed",function(b){var x=b.newSelection,E=x[0];E&&E.waypoints&&m(E)}),e.on("element.hover",function(b){var x=b.element;x.waypoints&&m(x)}),e.on("element.out",function(b){var x=b.element;if(x.waypoints){var E=u(x);if(E){var T=et(".floating",E);T&&je(T).remove("positioned")}}}),e.on("element.updateId",function(b){var x=b.element,E=b.newId;if(x.waypoints){var T=u(x);T&&re(T,{"data-element-id":E})}}),this.addHandles=m,this.updateHandles=g,this.getBendpointsContainer=u,this.getSegmentDragger=l}P_.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function n2(e){return et(".djs-visual",e)}var A_=Math.round,Wr="reconnectStart",Ur="reconnectEnd",$a="updateWaypoints";function yf(e,t,n,i,r,o){this._injector=e,this.start=function(a,s,c,u){var l=n.getGraphics(s),p=s.source,f=s.target,d=s.waypoints,h;!u&&c===0?h=Wr:!u&&c===d.length-1?h=Ur:h=$a;var m=h===$a?"connection.updateWaypoints":"connection.reconnect",g=r.allowed(m,{connection:s,source:p,target:f});if(g===!1&&(g=r.allowed(m,{connection:s,source:f,target:p})),g!==!1)return i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:l,context:{allowed:g,bendpointIndex:c,connection:s,source:p,target:f,insert:u,type:h}}})},t.on("bendpoint.move.hover",function(a){var s=a.context,c=s.connection,u=c.source,l=c.target,p=a.hover,f=s.type;s.hover=p;var d;if(p){var h=f===$a?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(h,{connection:c,source:f===Wr?p:u,target:f===Ur?p:l}),d){s.source=f===Wr?p:u,s.target=f===Ur?p:l;return}d===!1&&(d=s.allowed=r.allowed(h,{connection:c,source:f===Ur?p:l,target:f===Wr?p:u})),d&&(s.source=f===Ur?p:l,s.target=f===Wr?p:u)}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(a){var s=a.context,c=s.type;s.hover=null,s.source=null,s.target=null,c!==$a&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(a){var s=a.context,c=s.allowed,u=s.bendpointIndex,l=s.connection,p=s.insert,f=l.waypoints.slice(),d=s.source,h=s.target,m=s.type,g=s.hints||{},R={x:A_(a.x),y:A_(a.y)};if(!c)return!1;m===$a?(p?f.splice(u,0,R):f[u]=R,g.bendpointMove={insert:p,bendpointIndex:u},f=this.cropWaypoints(l,f),o.updateWaypoints(l,_1(f),g)):(m===Wr?(g.docking="source",tu(s)&&(g.docking="target",g.newWaypoints=f.reverse())):m===Ur&&(g.docking="target",tu(s)&&(g.docking="source",g.newWaypoints=f.reverse())),o.reconnect(l,d,h,R,g))},this)}yf.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],yf.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 tu(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 i2="reconnectStart",r2="reconnectEnd",T_="updateWaypoints",ja="connect-ok",nu="connect-not-ok",M_="connect-hover",k_="djs-updating",D_="djs-dragging",O_=1100;function L_(e,t,n,i){this._injector=t;var r=t.get("connectionPreview",!1);n.on("bendpoint.move.start",function(o){var a=o.context,s=a.bendpointIndex,c=a.connection,u=a.insert,l=c.waypoints,p=l.slice();a.waypoints=l,u&&p.splice(s,0,{x:o.x,y:o.y}),c.waypoints=p;var f=a.draggerGfx=mf(i.getLayer("overlays"));je(f).add("djs-dragging"),i.addMarker(c,D_),i.addMarker(c,k_)}),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,M_),u===T_)return;s?(i.removeMarker(c,nu),i.addMarker(c,ja)):s===!1&&(i.removeMarker(c,ja),i.addMarker(c,nu))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],O_,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,M_),i.removeMarker(s,c?ja:nu))}),n.on("bendpoint.move.move",function(o){var a=o.context,s=a.allowed,c=a.bendpointIndex,u=a.draggerGfx,l=a.hover,p=a.type,f=a.connection,d=f.source,h=f.target,m=f.waypoints.slice(),g={x:o.x,y:o.y},R=a.hints||{},w={};r&&(R.connectionStart&&(w.connectionStart=R.connectionStart),R.connectionEnd&&(w.connectionEnd=R.connectionEnd),p===i2?tu(a)?(w.connectionEnd=w.connectionEnd||g,w.source=h,w.target=l||d,m=m.reverse()):(w.connectionStart=w.connectionStart||g,w.source=l||d,w.target=h):p===r2?tu(a)?(w.connectionStart=w.connectionStart||g,w.source=l||h,w.target=d,m=m.reverse()):(w.connectionEnd=w.connectionEnd||g,w.source=d,w.target=l||h):(w.noCropping=!0,w.noLayout=!0,m[c]=g),p===T_&&(m=e.cropWaypoints(f,m)),w.waypoints=m,r.drawPreview(a,s,w)),Qt(u,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],O_,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,u=a.hover,l=a.target,p=a.waypoints;s.waypoints=p,Ft(c),i.removeMarker(s,k_),i.removeMarker(s,D_),u&&(i.removeMarker(u,ja),i.removeMarker(u,l?ja:nu)),r&&r.cleanUp(a)})}L_.$inject=["bendpointMove","injector","eventBus","canvas"];var I_="connect-hover",N_="djs-updating";function B_(e,t,n){return vf(e,t,e[t]+n)}function vf(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function o2(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 vf(t,i,s)}function $_(e){return e==="x"?"y":"x"}function j_(e,t,n){var i,r;return e.original?e.original:(i=be(t),r=$_(n),vf(e,r,i[r]))}function F_(e,t,n,i,r,o){var a=e.get("connectionDocking",!1);this.start=function(p,f,d){var h,m=n.getGraphics(f),g=d-1,R=d,w=f.waypoints,b=w[g],x=w[R],E=hf(n,w,p),T,L,A;if(T=Ai(b,x),!!T)return L=T==="v"?"x":"y",g===0&&(b=j_(b,f.source,L)),R===w.length-1&&(x=j_(x,f.target,L)),E?A=E.point:A={x:(b.x+x.x)/2,y:(b.y+x.y)/2},h={connection:f,segmentStartIndex:g,segmentEndIndex:R,segmentStart:b,segmentEnd:x,axis:L,dragPosition:A},i.init(p,A,"connectionSegment.move",{cursor:L==="x"?"resize-ew":"resize-ns",data:{connection:f,connectionGfx:m,context:h}})};function s(p,f){if(!a)return f;var d=p.waypoints,h;return p.waypoints=f,h=a.getCroppedWaypoints(p),p.waypoints=d,h}function c(p){r.update("connection",p.connection,p.connectionGfx)}function u(p,f,d){var h=p.newWaypoints,m=p.segmentStartIndex+f,g=h[m],R=p.segmentEndIndex+f,w=h[R],b=$_(p.axis),x=o2(d,g,w,b);Qt(p.draggerGfx,x.x,x.y)}function l(p,f){var d=0,h=p.filter(function(m,g){return al(p[g-1],p[g+1],m)?(d=g<=f?d-1:d,!1):!0});return{waypoints:h,segmentOffset:d}}t.on("connectionSegment.move.start",function(p){var f=p.context,d=p.connection,h=n.getLayer("overlays");f.originalWaypoints=d.waypoints.slice(),f.draggerGfx=C_(h,f.segmentStart,f.segmentEnd),je(f.draggerGfx).add("djs-dragging"),n.addMarker(d,N_)}),t.on("connectionSegment.move.move",function(p){var f=p.context,d=f.connection,h=f.segmentStartIndex,m=f.segmentEndIndex,g=f.segmentStart,R=f.segmentEnd,w=f.axis,b=f.originalWaypoints.slice(),x=B_(g,w,p["d"+w]),E=B_(R,w,p["d"+w]),T=b.length,L=0;b[h]=x,b[m]=E;var A,j;h<2&&(A=Zt(d.source,x),h===1?A==="intersect"&&(b.shift(),b[0]=x,L--):A!=="intersect"&&(b.unshift(g),L++)),m>T-3&&(j=Zt(d.target,E),m===T-2?j==="intersect"&&(b.pop(),b[b.length-1]=E):j!=="intersect"&&b.push(R)),f.newWaypoints=d.waypoints=s(d,b),u(f,L,p),f.newSegmentStartIndex=h+L,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,I_)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,I_)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,d=f.connection;f.draggerGfx&&Ft(f.draggerGfx),n.removeMarker(d,N_)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(p){var f=p.context,d=f.connection;d.waypoints=f.originalWaypoints,c(p)}),t.on("connectionSegment.move.end",function(p){var f=p.context,d=f.connection,h=f.newWaypoints,m=f.newSegmentStartIndex;h=h.map(function(E){return{original:E.original,x:Math.round(E.x),y:Math.round(E.y)}});var g=l(h,m),R=g.waypoints,w=s(d,R),b=g.segmentOffset,x={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:m+b}};o.updateWaypoints(d,w,x)})}F_.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var a2=Math.abs,H_=Math.round;function s2(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],a2(r-e)<=n)return r}function z_(e){return{x:e.x,y:e.y}}function V_(e){return{x:e.x+e.width,y:e.y+e.height}}function Zn(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 Io(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function Dt(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 G_(e){return e.children||[]}var c2=Math.abs,W_=Math.round,_f=10;function U_(e){function t(o,a){if(_e(o)){for(var s=o.length;s--;)if(c2(o[s]-a)<=_f)return o[s]}else{o=+o;var c=a%o;if(c<_f)return a-c;if(c>o-_f)return a-c+o}return a}function n(o,a){if(o.waypoints)return JM(a,o);if(o.width)return{x:W_(o.width/2+o.x),y:W_(o.height/2+o.y)}}function i(o){var a=o.context,s=a.snapPoints,c=a.connection,u=c.waypoints,l=a.segmentStart,p=a.segmentStartIndex,f=a.segmentEnd,d=a.segmentEndIndex,h=a.axis;if(s)return s;var m=[u[p-1],l,f,u[d+1]];return p<2&&m.unshift(n(c.source,o)),d>u.length-3&&m.unshift(n(c.target,o)),a.snapPoints=s={horizontal:[],vertical:[]},M(m,function(g){g&&(g=g.original||g,h==="y"&&s.horizontal.push(g.y),h==="x"&&s.vertical.push(g.x))}),s}e.on("connectionSegment.move.move",1500,function(o){var a=i(o),s=o.x,c=o.y,u,l;if(a){u=t(a.vertical,s),l=t(a.horizontal,c);var p=s-u,f=c-l;O(o,{dx:o.dx-p,dy:o.dy-f,x:u,y:l}),(p||a.vertical.indexOf(s)!==-1)&&Dt(o,"x",u),(f||a.horizontal.indexOf(c)!==-1)&&Dt(o,"y",l)}});function r(o){var a=o.snapPoints,s=o.connection.waypoints,c=o.bendpointIndex;if(a)return a;var u=[s[c-1],s[c+1]];return o.snapPoints=a={horizontal:[],vertical:[]},M(u,function(l){l&&(l=l.original||l,a.horizontal.push(l.y),a.vertical.push(l.x))}),a}e.on(["connect.hover","connect.move","connect.end"],1500,function(o){var a=o.context,s=a.hover,c=s&&n(s,o);!it(s)||!c||!c.x||!c.y||(Dt(o,"x",c.x),Dt(o,"y",c.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(o){var a=o.context,s=r(a),c=a.hover,u=c&&n(c,o),l=o.x,p=o.y,f,d;if(s){f=t(u?s.vertical.concat([u.x]):s.vertical,l),d=t(u?s.horizontal.concat([u.y]):s.horizontal,p);var h=l-f,m=p-d;O(o,{dx:o.dx-h,dy:o.dy-m,x:o.x-h,y:o.y-m}),(h||s.vertical.indexOf(l)!==-1)&&Dt(o,"x",f),(m||s.horizontal.indexOf(p)!==-1)&&Dt(o,"y",d)}})}U_.$inject=["eventBus"];const u2={__depends__:[Li,gi],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",P_],bendpointMove:["type",yf],bendpointMovePreview:["type",L_],connectionSegmentMove:["type",F_],bendpointSnapping:["type",U_]};function Y_(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),!Xr(l)){if(l!==!1){s.source=c,s.target=u;return}l=s.canExecute=o(c,u),!Xr(l)&&l!==!1&&(s.source=u,s.target=c)}}),e.on(["connect.out","connect.cleanup"],function(a){var s=a.context;s.hover=null,s.source=null,s.target=null,s.canExecute=!1}),e.on("connect.end",function(a){var s=a.context,c=s.canExecute,u=s.connectionStart,l={x:a.x,y:a.y},p=s.source,f=s.target;if(!c)return!1;var d=null,h={connectionStart:bf(s)?l:u,connectionEnd:bf(s)?u:l};Gt(c)&&(d=c),s.connection=n.connect(p,f,d,h)}),this.start=function(a,s,c,u){Gt(c)||(u=c,c=be(s)),t.init(a,"connect",{autoActivate:u,data:{shape:s,context:{start:s,connectionStart:c}}})}}Y_.$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 l2=1100,p2=900,q_="connect-ok",K_="connect-not-ok";function X_(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",function(r){var o=r.context,a=o.canExecute,s=o.hover,c=o.source,u=o.start,l=o.startPosition,p=o.target,f=o.connectionStart||l,d=o.connectionEnd||{x:r.x,y:r.y},h=f,m=d;bf(o)&&(h=d,m=f),i.drawPreview(o,a,{source:c||u,target:p||s,connectionStart:h,connectionEnd:m})}),t.on("connect.hover",p2,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?q_:K_)}),t.on(["connect.out","connect.cleanup"],l2,function(r){var o=r.hover;o&&(n.removeMarker(o,q_),n.removeMarker(o,K_))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}X_.$inject=["injector","eventBus","canvas"];const xf={__depends__:[qn,gi,Li],__init__:["connectPreview"],connect:["type",Y_],connectPreview:["type",X_]};var f2="djs-dragger";function Hi(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)}Hi.$inject=["injector","canvas","graphicsFactory","elementFactory"],Hi.prototype.drawPreview=function(e,t,n){n=n||{};var i=e.connectionPreviewGfx,r=e.getConnection,o=n.source,a=n.target,s=n.waypoints,c=n.connectionStart,u=n.connectionEnd,l=n.noLayout,p=n.noCropping,f=n.noNoop,d,h=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),vs(i),r||(r=e.getConnection=d2(function(m,g,R){return h.getConnection(m,g,R)})),t&&(d=r(t,o,a)),!d){!f&&this.drawNoopPreview(i,n);return}d.waypoints=s||[],this._layouter&&!l&&(d.waypoints=this._layouter.layoutConnection(d,{source:o,target:a,connectionStart:c,connectionEnd:u,waypoints:n.waypoints||d.waypoints})),(!d.waypoints||!d.waypoints.length)&&(d.waypoints=[o?be(o):c,a?be(a):u]),this._connectionDocking&&(o||a)&&!p&&(d.waypoints=this._connectionDocking.getCroppedWaypoints(d,o,a)),this._graphicsFactory.drawConnection(i,d,{stroke:"var(--element-dragger-color)"})},Hi.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||be(n),o=t.connectionEnd||be(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);Re(e,s)},Hi.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&&Jo(o,s,!0)||e,t=i&&Jo(a,s,!1)||t,[e,t]},Hi.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&Ft(e.connectionPreviewGfx)},Hi.prototype.getConnection=function(e){var t=h2(e);return this._elementFactory.createConnection(t)},Hi.prototype.createConnectionPreviewGfx=function(){var e=me("g");return re(e,{pointerEvents:"none"}),je(e).add(f2),Re(this._canvas.getActiveLayer(),e),e},Hi.prototype.createNoopConnection=function(e,t){return Ko([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function d2(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 h2(e){return Gt(e)?e:{}}const m2={__init__:["connectionPreview"],connectionPreview:["type",Hi]},iu="complex-preview";class Z_{constructor(t,n,i){this._canvas=t,this._graphicsFactory=n,this._previewSupport=i,this._markers=[]}create(t){this.cleanUp();const{created:n=[],moved:i=[],removed:r=[],resized:o=[]}=t,a=this._canvas.getLayer(iu);n.filter(s=>!g2(s)).forEach(s=>{let c;it(s)?(c=this._graphicsFactory._createContainer("connection",me("g")),this._graphicsFactory.drawConnection(Lr(c),s)):(c=this._graphicsFactory._createContainer("shape",me("g")),this._graphicsFactory.drawShape(Lr(c),s),Qt(c,s.x,s.y)),this._previewSupport.addDragger(s,a,c)}),i.forEach(({element:s,delta:c})=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"]);const u=this._previewSupport.addDragger(s,a);it(s)?Qt(u,c.x,c.y):Qt(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",me("g"));this._graphicsFactory.drawShape(Lr(u),s,{width:c.width,height:c.height}),Qt(u,c.x,c.y),this._previewSupport.addDragger(s,a,u)})}cleanUp(){vs(this._canvas.getLayer(iu)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(iu)}hide(){this._canvas.hideLayer(iu)}}Z_.$inject=["canvas","graphicsFactory","previewSupport"];function g2(e){return e.hidden}const y2={__depends__:[Ro],__init__:["complexPreview"],complexPreview:["type",Z_]},Q_=Math.round;function ru(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}ru.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(O({type:t},n)),l=a.fire("autoPlace",{source:e,shape:u});if(!l)return;O(u,{x:l.x-Q_(u.width/2),y:l.y-Q_(u.height/2)});const p=c.allowed("connection.create",{source:e,target:u,hints:{targetParent:e.parent}});let f=null;p&&(f=o.createConnection(p),f.waypoints=s.layoutConnection(f,{source:e,target:u}),f.waypoints=r.getCroppedWaypoints(f,e,u)),i.create({created:[u,f].filter(d=>!Xr(d))})},ru.prototype.cleanUp=function(){this._complexPreview.cleanUp()},ru.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const v2={__depends__:[kc,y2,Up],__init__:["appendPreview"],appendPreview:["type",ru]};var J_=Math.min,eb=Math.max;function wf(e){e.preventDefault()}function Fa(e){e.stopPropagation()}function _2(e){return e.nodeType===Node.TEXT_NODE}function b2(e){return[].slice.call(e)}function ri(e){this.container=e.container,this.parent=ut('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=et("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=vn(this.autoResize,this),this.handlePaste=vn(this.handlePaste,this)}ri.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=ni(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);O(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=ni(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return O(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},u),i.centerVertically&&O(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},u),a.innerText=n,Se.bind(a,"keydown",this.keyHandler),Se.bind(a,"mousedown",Fa),Se.bind(a,"paste",r.handlePaste),Se.bind(a,"focusout",this.focusoutHandler),i.autoResize&&Se.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},ri.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)}},ri.prototype.insertText=function(e){e=x2(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},ri.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=b2(a.childNodes),c,u;if(_2(a)){var l=n.textContent;n.textContent=l.substring(0,r)+e+l.substring(o),c=n,u=r+e.length}else if(n===this.content&&i===this.content){var p=document.createTextNode(e);this.content.insertBefore(p,s[r]),c=p,u=p.textContent.length}else{var f=s.indexOf(n),d=s.indexOf(i);s.forEach(function(h,m){m===f?h.textContent=n.textContent.substring(0,r)+e+i.textContent.substring(o):m>f&&m<=d&&li(h)}),c=n,u=r+e.length}c&&u!==void 0&&setTimeout(function(){self.setSelection(c,u)})},ri.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})}},ri.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,i=parseInt(this.style.minWidth)||0,r=parseInt(this.style.minHeight)||0,o=parseInt(this.style.maxWidth)||1/0,a=parseInt(this.style.maxHeight)||1/0;if(!n){n=this.resizeHandle=ut('<div class="djs-direct-editing-resize-handle"></div>');var s,c,u,l,p=function(h){wf(h),Fa(h),s=h.clientX,c=h.clientY;var m=t.getBoundingClientRect();u=m.width,l=m.height,Se.bind(document,"mousemove",f),Se.bind(document,"mouseup",d)},f=function(h){wf(h),Fa(h);var m=J_(eb(u+h.clientX-s,i),o),g=J_(eb(l+h.clientY-c,r),a);t.style.width=m+"px",t.style.height=g+"px",e.resizeHandler({width:u,height:l,dx:h.clientX-s,dy:h.clientY-c})},d=function(h){wf(h),Fa(h),Se.unbind(document,"mousemove",f,!1),Se.unbind(document,"mouseup",d,!1)};Se.bind(n,"mousedown",p)}O(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)},ri.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),Se.unbind(t,"keydown",this.keyHandler),Se.unbind(t,"mousedown",Fa),Se.unbind(t,"input",this.autoResize),Se.unbind(t,"paste",this.handlePaste),Se.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),li(n)),li(e)},ri.prototype.getValue=function(){return this.content.innerText.trim()},ri.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},ri.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 x2(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 ri({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=st(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 tb={__depends__:[sc],__init__:["directEditing"],directEditing:["type",On]};function w2(e){return function(t){var n=t.target,i=Z(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===$e(e);return!o||!a||!s||!c}}const E2={task:{label:"Task",className:"bpmn-icon-task",target:{type:"bpmn:Task"}},"user-task":{label:"User task",className:"bpmn-icon-user",target:{type:"bpmn:UserTask"}},"service-task":{label:"Service task",className:"bpmn-icon-service",target:{type:"bpmn:ServiceTask"}},"send-task":{label:"Send task",className:"bpmn-icon-send",target:{type:"bpmn:SendTask"}},"receive-task":{label:"Receive task",className:"bpmn-icon-receive",target:{type:"bpmn:ReceiveTask"}},"manual-task":{label:"Manual task",className:"bpmn-icon-manual",target:{type:"bpmn:ManualTask"}},"rule-task":{label:"Business rule task",className:"bpmn-icon-business-rule",target:{type:"bpmn:BusinessRuleTask"}},"script-task":{label:"Script task",className:"bpmn-icon-script",target:{type:"bpmn:ScriptTask"}},"call-activity":{label:"Call activity",className:"bpmn-icon-call-activity",target:{type:"bpmn:CallActivity"}},transaction:{label:"Transaction",className:"bpmn-icon-transaction",target:{type:"bpmn:Transaction",isExpanded:!0}},"event-subprocess":{label:"Event sub-process",className:"bpmn-icon-event-subprocess-expanded",target:{type:"bpmn:SubProcess",triggeredByEvent:!0,isExpanded:!0}},"collapsed-subprocess":{label:"Sub-process (collapsed)",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:SubProcess",isExpanded:!1}},"expanded-subprocess":{label:"Sub-process (expanded)",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:SubProcess",isExpanded:!0}},"collapsed-ad-hoc-subprocess":{label:"Ad-hoc sub-process (collapsed)",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:AdHocSubProcess",isExpanded:!1}},"expanded-ad-hoc-subprocess":{label:"Ad-hoc sub-process (expanded)",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:AdHocSubProcess",isExpanded:!0}},"exclusive-gateway":{label:"Exclusive gateway",className:"bpmn-icon-gateway-xor",target:{type:"bpmn:ExclusiveGateway"}},"parallel-gateway":{label:"Parallel gateway",className:"bpmn-icon-gateway-parallel",target:{type:"bpmn:ParallelGateway"}},"inclusive-gateway":{label:"Inclusive gateway",className:"bpmn-icon-gateway-or",target:{type:"bpmn:InclusiveGateway"}},"complex-gateway":{label:"Complex gateway",className:"bpmn-icon-gateway-complex",target:{type:"bpmn:ComplexGateway"}},"event-based-gateway":{label:"Event-based gateway",className:"bpmn-icon-gateway-eventbased",target:{type:"bpmn:EventBasedGateway",instantiate:!1,eventGatewayType:"Exclusive"}},"data-store-reference":{label:"Data store reference",className:"bpmn-icon-data-store",target:{type:"bpmn:DataStoreReference"}},"data-object-reference":{label:"Data object reference",className:"bpmn-icon-data-object",target:{type:"bpmn:DataObjectReference"}},"expanded-pool":{label:"Expanded pool/participant",className:"bpmn-icon-participant",target:{type:"bpmn:Participant",isExpanded:!0}},"collapsed-pool":{label:"Empty pool/participant",className:"bpmn-icon-lane",target:{type:"bpmn:Participant",isExpanded:!1}},"none-start-event":{label:"Start event",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},"none-intermediate-throwing":{label:"Intermediate throw event",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},"none-boundary-event":{label:"Boundary event",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:BoundaryEvent"}},"none-end-event":{label:"End event",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}},"message-start":{label:"Message start event",className:"bpmn-icon-start-event-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition",isInterrupting:!0}},"timer-start":{label:"Timer start event",className:"bpmn-icon-start-event-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition",isInterrupting:!0}},"conditional-start":{label:"Conditional start event",className:"bpmn-icon-start-event-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",isInterrupting:!0}},"signal-start":{label:"Signal start event",className:"bpmn-icon-start-event-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition",isInterrupting:!0}},"error-start":{label:"Error start event",className:"bpmn-icon-start-event-error",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ErrorEventDefinition",isInterrupting:!0}},"escalation-start":{label:"Escalation start event",className:"bpmn-icon-start-event-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",isInterrupting:!0}},"compensation-start":{label:"Compensation start event",className:"bpmn-icon-start-event-compensation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:CompensateEventDefinition",isInterrupting:!0}},"non-interrupting-message-start":{label:"Message start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition",isInterrupting:!1}},"non-interrupting-timer-start":{label:"Timer start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition",isInterrupting:!1}},"non-interrupting-conditional-start":{label:"Conditional start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",isInterrupting:!1}},"non-interrupting-signal-start":{label:"Signal start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition",isInterrupting:!1}},"non-interrupting-escalation-start":{label:"Escalation start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",isInterrupting:!1}},"message-intermediate-catch":{label:"Message intermediate catch event",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},"message-intermediate-throw":{label:"Message intermediate throw event",className:"bpmn-icon-intermediate-event-throw-message",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},"timer-intermediate-catch":{label:"Timer intermediate catch event",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},"escalation-intermediate-throw":{label:"Escalation intermediate throw event",className:"bpmn-icon-intermediate-event-throw-escalation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},"conditional-intermediate-catch":{label:"Conditional intermediate catch event",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},"link-intermediate-catch":{label:"Link intermediate catch event",className:"bpmn-icon-intermediate-event-catch-link",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:LinkEventDefinition",eventDefinitionAttrs:{name:""}}},"link-intermediate-throw":{label:"Link intermediate throw event",className:"bpmn-icon-intermediate-event-throw-link",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:LinkEventDefinition",eventDefinitionAttrs:{name:""}}},"compensation-intermediate-throw":{label:"Compensation intermediate throw event",className:"bpmn-icon-intermediate-event-throw-compensation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},"signal-intermediate-catch":{label:"Signal intermediate catch event",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},"signal-intermediate-throw":{label:"Signal intermediate throw event",className:"bpmn-icon-intermediate-event-throw-signal",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},"message-boundary":{label:"Message boundary event",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!0}},"timer-boundary":{label:"Timer boundary event",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!0}},"escalation-boundary":{label:"Escalation boundary event",className:"bpmn-icon-intermediate-event-catch-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!0}},"conditional-boundary":{label:"Conditional boundary event",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!0}},"error-boundary":{label:"Error boundary event",className:"bpmn-icon-intermediate-event-catch-error",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ErrorEventDefinition",cancelActivity:!0}},"cancel-boundary":{label:"Cancel boundary event",className:"bpmn-icon-intermediate-event-catch-cancel",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CancelEventDefinition",cancelActivity:!0}},"signal-boundary":{label:"Signal boundary event",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!0}},"compensation-boundary":{label:"Compensation boundary event",className:"bpmn-icon-intermediate-event-catch-compensation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CompensateEventDefinition",cancelActivity:!0}},"non-interrupting-message-boundary":{label:"Message boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!1}},"non-interrupting-timer-boundary":{label:"Timer boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!1}},"non-interrupting-escalation-boundary":{label:"Escalation boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!1}},"non-interrupting-conditional-boundary":{label:"Conditional boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!1}},"non-interrupting-signal-boundary":{label:"Signal boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!1}},"message-end":{label:"Message end event",className:"bpmn-icon-end-event-message",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},"escalation-end":{label:"Escalation end event",className:"bpmn-icon-end-event-escalation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},"error-end":{label:"Error end event",className:"bpmn-icon-end-event-error",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}},"cancel-end":{label:"Cancel end event",className:"bpmn-icon-end-event-cancel",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CancelEventDefinition"}},"compensation-end":{label:"Compensation end event",className:"bpmn-icon-end-event-compensation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},"signal-end":{label:"Signal end event",className:"bpmn-icon-end-event-signal",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},"terminate-end":{label:"Terminate end event",className:"bpmn-icon-end-event-terminate",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:TerminateEventDefinition"}}};function q(e,t={}){var n=E2[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var S2=[q("none-start-event",{actionName:"replace-with-none-start"}),q("none-intermediate-throwing"),q("none-end-event",{actionName:"replace-with-none-end"}),q("message-start"),q("timer-start"),q("conditional-start"),q("signal-start")],R2=[q("none-start-event",{actionName:"replace-with-none-start"}),q("none-intermediate-throwing"),q("none-end-event",{actionName:"replace-with-none-end"})],C2=[q("none-start-event",{actionName:"replace-with-none-start"}),q("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),q("none-end-event",{actionName:"replace-with-none-end"}),q("message-intermediate-catch"),q("message-intermediate-throw"),q("timer-intermediate-catch"),q("escalation-intermediate-throw"),q("conditional-intermediate-catch"),q("link-intermediate-catch"),q("link-intermediate-throw"),q("compensation-intermediate-throw"),q("signal-intermediate-catch"),q("signal-intermediate-throw")],P2=[q("none-start-event",{actionName:"replace-with-none-start"}),q("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),q("none-end-event",{actionName:"replace-with-none-end"}),q("message-end"),q("escalation-end"),q("error-end"),q("cancel-end"),q("compensation-end"),q("signal-end"),q("terminate-end")],A2=[q("exclusive-gateway"),q("parallel-gateway"),q("inclusive-gateway"),q("complex-gateway"),q("event-based-gateway")],T2=[q("transaction"),q("event-subprocess"),q("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),q("collapsed-subprocess")],M2=[q("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),q("transaction"),q("event-subprocess"),q("collapsed-ad-hoc-subprocess")],nb=[q("transaction"),q("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),q("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),q("event-subprocess")],k2=nb,ib=[q("task"),q("user-task"),q("service-task"),q("send-task"),q("receive-task"),q("manual-task"),q("rule-task"),q("script-task"),q("call-activity"),q("collapsed-subprocess"),q("expanded-subprocess"),q("collapsed-ad-hoc-subprocess"),q("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],D2=[q("data-store-reference")],O2=[q("data-object-reference")],L2=[q("message-boundary"),q("timer-boundary"),q("escalation-boundary"),q("conditional-boundary"),q("error-boundary"),q("cancel-boundary"),q("signal-boundary"),q("compensation-boundary"),q("non-interrupting-message-boundary"),q("non-interrupting-timer-boundary"),q("non-interrupting-escalation-boundary"),q("non-interrupting-conditional-boundary"),q("non-interrupting-signal-boundary")],I2=[q("message-start"),q("timer-start"),q("conditional-start"),q("signal-start"),q("error-start"),q("escalation-start"),q("compensation-start"),q("non-interrupting-message-start"),q("non-interrupting-timer-start"),q("non-interrupting-conditional-start"),q("non-interrupting-signal-start"),q("non-interrupting-escalation-start")],N2=[{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"}],B2=[q("expanded-pool"),q("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],$2={"bpmn:MessageEventDefinition":[q("message-start"),q("message-intermediate-catch"),q("message-intermediate-throw"),q("message-end")],"bpmn:TimerEventDefinition":[q("timer-start"),q("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[q("conditional-start"),q("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[q("signal-start"),q("signal-intermediate-catch"),q("signal-intermediate-throw"),q("signal-end")],"bpmn:ErrorEventDefinition":[q("error-start"),q("error-end")],"bpmn:EscalationEventDefinition":[q("escalation-start"),q("escalation-intermediate-throw"),q("escalation-end")],"bpmn:CompensateEventDefinition":[q("compensation-start"),q("compensation-intermediate-throw"),q("compensation-end")]};const rb={"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 Qn(e,t,n,i,r,o,a,c){this._bpmnFactory=e,this._popupMenu=t,this._modeling=n,this._moddle=i,this._bpmnReplace=r,this._rules=o,this._translate=a,this._moddleCopy=c,this._register()}Qn.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Qn.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Qn.prototype.getPopupMenuEntries=function(e){var c;var t=e.businessObject,n=this._rules,i=[],r,o=[];if(_e(e)||!n.allowed("shape.replace",{element:e}))return{};var a=_2(e);return v(t,"bpmn:DataObjectReference")?this._createEntries(e,T2):v(t,"bpmn:DataStoreReference")&&!v(e.parent,"bpmn:Collaboration")?this._createEntries(e,M2):(v(t,"bpmn:Event")&&!v(t,"bpmn:BoundaryEvent")&&(r=(c=t.get("eventDefinitions")[0])==null?void 0:c.$type,i=I2[r]||[],!cn(t.$parent)&&v(t.$parent,"bpmn:SubProcess")&&(i=Oe(i,function(s){return s.target.type!=="bpmn:StartEvent"}))),v(t,"bpmn:StartEvent")&&!v(t.$parent,"bpmn:SubProcess")?(o=Oe(x2.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:Participant")?(o=Oe(L2,function(s){return $e(e)!==s.target.isExpanded}),this._createEntries(e,o)):v(t,"bpmn:StartEvent")&&cn(t.$parent)?(o=Oe(D2.concat(i),function(s){var u=s.target,l=u.isInterrupting!==!1,p=t.isInterrupting===l;return a(s)||!a(s)&&!p}),this._createEntries(e,o)):v(t,"bpmn:StartEvent")&&!cn(t.$parent)&&v(t.$parent,"bpmn:SubProcess")?(o=Oe(w2.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:EndEvent")?(o=Oe(S2.concat(i),function(s){var u=s.target;return u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!v(t.$parent,"bpmn:Transaction")?!1:a(s)}),this._createEntries(e,o)):v(t,"bpmn:BoundaryEvent")?(o=Oe(k2,function(s){var u=s.target;if(u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!v(t.attachedToRef,"bpmn:Transaction"))return!1;var l=u.cancelActivity!==!1,p=t.cancelActivity==l;return a(s)||!a(s)&&!p}),this._createEntries(e,o)):v(t,"bpmn:IntermediateCatchEvent")||v(t,"bpmn:IntermediateThrowEvent")?(o=Oe(E2.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:Gateway")?(o=Oe(R2,a),this._createEntries(e,o)):v(t,"bpmn:Transaction")?(o=Oe(eb,a),this._createEntries(e,o)):cn(t)&&$e(e)?(o=Oe(A2,a),this._createEntries(e,o)):v(t,"bpmn:AdHocSubProcess")&&$e(e)?(o=Oe(P2,a),this._createEntries(e,o)):v(t,"bpmn:SubProcess")&&$e(e)?(o=Oe(C2,a),this._createEntries(e,o)):v(t,"bpmn:SubProcess")&&!$e(e)?(o=Oe(tb,function(s){var u=s.target.type===e.type,l=s.target.isExpanded===!0;return u===l}),this._createEntries(e,o)):v(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,O2):v(t,"bpmn:FlowNode")?(o=Oe(tb,a),this._createEntries(e,o)):{})},Qn.prototype.getPopupMenuHeaderEntries=function(e){var t={};return v(e,"bpmn:Activity")&&!cn(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),v(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),v(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),Zm(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Qn.prototype._createEntries=function(e,t){var n={},i=this;return M(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},Qn.prototype._createSequenceFlowEntries=function(e,t){var n=Z(e),i={},r=this._modeling,o=this._moddle,a=this;return M(t,function(c){switch(c.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(v(n.sourceRef,"bpmn:ExclusiveGateway")||v(n.sourceRef,"bpmn:InclusiveGateway")||v(n.sourceRef,"bpmn:ComplexGateway")||v(n.sourceRef,"bpmn:Activity"))&&(i={...i,[c.actionName]:a._createEntry(c,e,function(){r.updateProperties(e.source,{default:n})})});break;case"replace-with-conditional-flow":!n.conditionExpression&&v(n.sourceRef,"bpmn:Activity")&&(i={...i,[c.actionName]:a._createEntry(c,e,function(){var s=o.create("bpmn:FormalExpression",{body:""});r.updateProperties(e,{conditionExpression:s})})});break;default:v(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[c.actionName]:a._createEntry(c,e,function(){r.updateProperties(e,{conditionExpression:void 0})})}),(v(n.sourceRef,"bpmn:ExclusiveGateway")||v(n.sourceRef,"bpmn:InclusiveGateway")||v(n.sourceRef,"bpmn:ComplexGateway")||v(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n&&(i={...i,[c.actionName]:a._createEntry(c,e,function(){r.updateProperties(e.source,{default:void 0})})})}}),i},Qn.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}},Qn.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(u,l){if(l.active){t._modeling.updateProperties(e,{loopCharacteristics:void 0});return}var p=e.businessObject.get("loopCharacteristics");p&&v(p,l.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,p,{isSequential:l.options.isSequential}):(p=t._moddle.create(l.options.loopCharacteristics,{isSequential:l.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:p}))}var r=Z(e),o=r.loopCharacteristics,a,c,s;return o&&(a=o.isSequential,c=o.isSequential===void 0,s=o.isSequential!==void 0&&!o.isSequential),{"toggle-parallel-mi":{className:"bpmn-icon-parallel-mi-marker",title:n("Parallel multi-instance"),active:s,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:c,action:i,options:{loopCharacteristics:"bpmn:StandardLoopCharacteristics"}}}},Qn.prototype._getCollectionHeaderEntries=function(e){var t=this,n=this._translate,i=e.businessObject.dataObjectRef;if(!i)return{};function r(a,c){t._modeling.updateModdleProperties(e,i,{isCollection:!c.active})}var o=i.isCollection;return{"toggle-is-collection":{className:"bpmn-icon-parallel-mi-marker",title:n("Collection"),active:o,action:r}}},Qn.prototype._getParticipantMultiplicityHeaderEntries=function(e){var t=this,n=this._bpmnFactory,i=this._translate;function r(a,c){var s=c.active,u;s||(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}}},Qn.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=Z(e),i=this,r=Qm(e),o=v(e,"bpmn:BoundaryEvent")?nb["intermediate-event-non-interrupting"]:nb["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 N2={__depends__:[pf,vy,kc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Qn]};function Fa(e,t,n,i,r,o,a,c,s,u,l,p,f){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=r,this._elementFactory=o,this._connect=a,this._create=c,this._popupMenu=s,this._canvas=u,this._rules=l,this._translate=p,this._eventBus=n,this._appendPreview=f,e.autoPlace!==!1&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(d){var h=d.context,m=h.shape;if(!(!pa(d)||!i.isOpen(m))){var g=i.getEntries(m);g.replace&&g.replace.action.click(d,m)}}),n.on("contextPad.close",function(){f.cleanUp()})}Fa.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Fa.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&O(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},Fa.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return _e(t)?Rr(e,n=>t.includes(n)):t},Fa.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,r=this._connect,o=this._create,a=this._popupMenu,c=this._autoPlace,s=this._translate,u=this._appendPreview,l={};if(e.type==="label")return this._isDeleteAllowed([e])&&O(l,h()),l;var p=e.businessObject;function f(x,b){r.start(x,b)}function d(x,b){n.removeElements([b])}function h(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:s("Delete"),action:{click:d}}}}function m(x){var b=5,E=t.getPad(x).html,T=E.getBoundingClientRect(),L={x:T.left,y:T.bottom+b};return L}function g(x,b,E,T){function L(H,N){var V=i.createShape(O({type:x},T));o.start(H,V,{source:N})}var A=c?function(H,N){var V=i.createShape(O({type:x},T));c.append(N,V)}:L,F=c?function(H,N){return u.create(N,x,T),()=>{u.cleanUp()}}:null;return{group:"model",className:b,title:E,action:{dragstart:L,click:A,hover:F}}}function R(x){return function(b,E){n.splitLane(E,x),t.open(E,!0)}}if(De(p,["bpmn:Lane","bpmn:Participant"])&&$e(e)){var w=rr(e);O(l,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:s("Add lane above"),action:{click:function(x,b){n.addLane(b,"top")}}}}),w.length<2&&((Yt(e)?e.height>=120:e.width>=120)&&O(l,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:s("Divide into two lanes"),action:{click:R(2)}}}),(Yt(e)?e.height>=180:e.width>=180)&&O(l,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:s("Divide into three lanes"),action:{click:R(3)}}})),O(l,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:s("Add lane below"),action:{click:function(x,b){n.addLane(b,"bottom")}}}})}return v(p,"bpmn:FlowNode")&&(v(p,"bpmn:EventBasedGateway")?O(l,{"append.receive-task":g("bpmn:ReceiveTask","bpmn-icon-receive-task",s("Append receive task")),"append.message-intermediate-event":g("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",s("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":g("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",s("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":g("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",s("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":g("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",s("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):ib(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?O(l,{"append.compensation-activity":g("bpmn:Task","bpmn-icon-task",s("Append compensation activity"),{isForCompensation:!0})}):!v(p,"bpmn:EndEvent")&&!p.isForCompensation&&!ib(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!cn(p)&&O(l,{"append.end-event":g("bpmn:EndEvent","bpmn-icon-end-event-none",s("Append end event")),"append.gateway":g("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",s("Append gateway")),"append.append-task":g("bpmn:Task","bpmn-icon-task",s("Append task")),"append.intermediate-event":g("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",s("Append intermediate/boundary event"))})),a.isEmpty(e,"bpmn-replace")||O(l,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:s("Change element"),action:{click:function(x,b){var E=O(m(b),{cursor:{x:x.x,y:x.y}});a.open(b,"bpmn-replace",E,{title:s("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),v(p,"bpmn:SequenceFlow")&&O(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",s("Add text annotation"))}),v(p,"bpmn:MessageFlow")&&O(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",s("Add text annotation"))}),De(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&O(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",s("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:s("Connect to other element"),action:{click:f,dragstart:f}}}),v(p,"bpmn:TextAnnotation")&&O(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:s("Connect using association"),action:{click:f,dragstart:f}}}),De(p,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&O(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:s("Connect using data input association"),action:{click:f,dragstart:f}}}),v(p,"bpmn:Group")&&O(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",s("Add text annotation"))}),this._isDeleteAllowed([e])&&O(l,h()),l};function ib(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return M(o,function(a){a.$type===n&&(r=!0)}),i&&r}const B2={__depends__:[m2,J_,Dv,qn,_f,uc,N2],__init__:["contextPadProvider"],contextPadProvider:["type",Fa]};var $2={horizontal:["x","width"],vertical:["y","height"]},rb=5;function zi(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return _e(i)?i:i?n:[]})}zi.$inject=["modeling","rules"],zi.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},zi.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},zi.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(M(t,function(o){r=o(r,n,i)}),r):e},zi.prototype._createGroups=function(e){var t=[],n=this,i=this._axis,r=this._dimension;if(!i)throw new Error('must have a defined "axis" and "dimension"');var o=oi(e,i);return M(o,function(a,c){var s=n._findRange(a,i,r),u,l=t[t.length-1];l&&n._hasIntersection(l.range,s)?t[t.length-1].elements.push(a):(u={range:s,elements:[a]},t.push(u))}),t},zi.prototype._setOrientation=function(e){var t=$2[e];this._axis=t[0],this._dimension=t[1]},zi.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)},zi.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+rb,max:t+n-rb}};const j2={__init__:["distributeElements"],distributeElements:["type",zi]};function ou(e){Yn.call(this,e)}ou.$inject=["eventBus"],ie(ou,Yn),ou.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=Oe(t,function(n){var i=De(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=xs(t),t.length<3?!1:t})};var ob={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
327
+ </svg>`};function Qn(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()}Qn.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Qn.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Qn.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],r,o=[];if(_e(e)||!n.allowed("shape.replace",{element:e}))return{};var a=w2(e);return v(t,"bpmn:DataObjectReference")?this._createEntries(e,D2):v(t,"bpmn:DataStoreReference")&&!v(e.parent,"bpmn:Collaboration")?this._createEntries(e,O2):(v(t,"bpmn:Event")&&!v(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=$2[r]||[],!cn(t.$parent)&&v(t.$parent,"bpmn:SubProcess")&&(i=Oe(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),v(t,"bpmn:StartEvent")&&!v(t.$parent,"bpmn:SubProcess")?(o=Oe(S2.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:Participant")?(o=Oe(B2,function(c){return $e(e)!==c.target.isExpanded}),this._createEntries(e,o)):v(t,"bpmn:StartEvent")&&cn(t.$parent)?(o=Oe(I2.concat(i),function(c){var u=c.target,l=u.isInterrupting!==!1,p=t.isInterrupting===l;return a(c)||!a(c)&&!p}),this._createEntries(e,o)):v(t,"bpmn:StartEvent")&&!cn(t.$parent)&&v(t.$parent,"bpmn:SubProcess")?(o=Oe(R2.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:EndEvent")?(o=Oe(P2.concat(i),function(c){var u=c.target;return u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!v(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,o)):v(t,"bpmn:BoundaryEvent")?(o=Oe(L2,function(c){var u=c.target;if(u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!v(t.attachedToRef,"bpmn:Transaction"))return!1;var l=u.cancelActivity!==!1,p=t.cancelActivity==l;return a(c)||!a(c)&&!p}),this._createEntries(e,o)):v(t,"bpmn:IntermediateCatchEvent")||v(t,"bpmn:IntermediateThrowEvent")?(o=Oe(C2.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:Gateway")?(o=Oe(A2,a),this._createEntries(e,o)):v(t,"bpmn:Transaction")?(o=Oe(nb,a),this._createEntries(e,o)):cn(t)&&$e(e)?(o=Oe(k2,a),this._createEntries(e,o)):v(t,"bpmn:AdHocSubProcess")&&$e(e)?(o=Oe(M2,a),this._createEntries(e,o)):v(t,"bpmn:SubProcess")&&$e(e)?(o=Oe(T2,a),this._createEntries(e,o)):v(t,"bpmn:SubProcess")&&!$e(e)?(o=Oe(ib,function(c){var u=c.target.type===e.type,l=c.target.isExpanded===!0;return u===l}),this._createEntries(e,o)):v(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,N2):v(t,"bpmn:FlowNode")?(o=Oe(ib,a),this._createEntries(e,o)):{})},Qn.prototype.getPopupMenuHeaderEntries=function(e){var t={};return v(e,"bpmn:Activity")&&!cn(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),v(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),v(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),Jm(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Qn.prototype._createEntries=function(e,t){var n={},i=this;return M(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},Qn.prototype._createSequenceFlowEntries=function(e,t){var n=Z(e),i={},r=this._modeling,o=this._moddle,a=this;return M(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(v(n.sourceRef,"bpmn:ExclusiveGateway")||v(n.sourceRef,"bpmn:InclusiveGateway")||v(n.sourceRef,"bpmn:ComplexGateway")||v(n.sourceRef,"bpmn:Activity"))&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e.source,{default:n})})});break;case"replace-with-conditional-flow":!n.conditionExpression&&v(n.sourceRef,"bpmn:Activity")&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){var c=o.create("bpmn:FormalExpression",{body:""});r.updateProperties(e,{conditionExpression:c})})});break;default:v(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e,{conditionExpression:void 0})})}),(v(n.sourceRef,"bpmn:ExclusiveGateway")||v(n.sourceRef,"bpmn:InclusiveGateway")||v(n.sourceRef,"bpmn:ComplexGateway")||v(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e.source,{default:void 0})})})}}),i},Qn.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}},Qn.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(u,l){if(l.active){t._modeling.updateProperties(e,{loopCharacteristics:void 0});return}var p=e.businessObject.get("loopCharacteristics");p&&v(p,l.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,p,{isSequential:l.options.isSequential}):(p=t._moddle.create(l.options.loopCharacteristics,{isSequential:l.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:p}))}var r=Z(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"}}}},Qn.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}}},Qn.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}}},Qn.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=Z(e),i=this,r=eg(e),o=v(e,"bpmn:BoundaryEvent")?rb["intermediate-event-non-interrupting"]:rb["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 j2={__depends__:[df,by,kc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Qn]};function Ha(e,t,n,i,r,o,a,s,c,u,l,p,f){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=r,this._elementFactory=o,this._connect=a,this._create=s,this._popupMenu=c,this._canvas=u,this._rules=l,this._translate=p,this._eventBus=n,this._appendPreview=f,e.autoPlace!==!1&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(d){var h=d.context,m=h.shape;if(!(!fa(d)||!i.isOpen(m))){var g=i.getEntries(m);g.replace&&g.replace.action.click(d,m)}}),n.on("contextPad.close",function(){f.cleanUp()})}Ha.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Ha.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&O(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},Ha.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return _e(t)?Rr(e,n=>t.includes(n)):t},Ha.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])&&O(l,h()),l;var p=e.businessObject;function f(b,x){r.start(b,x)}function d(b,x){n.removeElements([x])}function h(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function m(b){var x=5,E=t.getPad(b).html,T=E.getBoundingClientRect(),L={x:T.left,y:T.bottom+x};return L}function g(b,x,E,T){function L(H,N){var G=i.createShape(O({type:b},T));o.start(H,G,{source:N})}var A=s?function(H,N){var G=i.createShape(O({type:b},T));s.append(N,G)}:L,j=s?function(H,N){return u.create(N,b,T),()=>{u.cleanUp()}}:null;return{group:"model",className:x,title:E,action:{dragstart:L,click:A,hover:j}}}function R(b){return function(x,E){n.splitLane(E,b),t.open(E,!0)}}if(De(p,["bpmn:Lane","bpmn:Participant"])&&$e(e)){var w=rr(e);O(l,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(b,x){n.addLane(x,"top")}}}}),w.length<2&&((Yt(e)?e.height>=120:e.width>=120)&&O(l,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:R(2)}}}),(Yt(e)?e.height>=180:e.width>=180)&&O(l,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:R(3)}}})),O(l,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(b,x){n.addLane(x,"bottom")}}}})}return v(p,"bpmn:FlowNode")&&(v(p,"bpmn:EventBasedGateway")?O(l,{"append.receive-task":g("bpmn:ReceiveTask","bpmn-icon-receive-task",c("Append receive task")),"append.message-intermediate-event":g("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":g("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":g("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":g("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):ob(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?O(l,{"append.compensation-activity":g("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!v(p,"bpmn:EndEvent")&&!p.isForCompensation&&!ob(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!cn(p)&&O(l,{"append.end-event":g("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append end event")),"append.gateway":g("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append gateway")),"append.append-task":g("bpmn:Task","bpmn-icon-task",c("Append task")),"append.intermediate-event":g("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append intermediate/boundary event"))})),a.isEmpty(e,"bpmn-replace")||O(l,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(b,x){var E=O(m(x),{cursor:{x:b.x,y:b.y}});a.open(x,"bpmn-replace",E,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),v(p,"bpmn:SequenceFlow")&&O(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),v(p,"bpmn:MessageFlow")&&O(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),De(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&O(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect to other element"),action:{click:f,dragstart:f}}}),v(p,"bpmn:TextAnnotation")&&O(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:f,dragstart:f}}}),De(p,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&O(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:f,dragstart:f}}}),v(p,"bpmn:Group")&&O(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&O(l,h()),l};function ob(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return M(o,function(a){a.$type===n&&(r=!0)}),i&&r}const F2={__depends__:[v2,tb,Lv,qn,xf,uc,j2],__init__:["contextPadProvider"],contextPadProvider:["type",Ha]};var H2={horizontal:["x","width"],vertical:["y","height"]},ab=5;function zi(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return _e(i)?i:i?n:[]})}zi.$inject=["modeling","rules"],zi.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},zi.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},zi.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(M(t,function(o){r=o(r,n,i)}),r):e},zi.prototype._createGroups=function(e){var t=[],n=this,i=this._axis,r=this._dimension;if(!i)throw new Error('must have a defined "axis" and "dimension"');var o=oi(e,i);return M(o,function(a,s){var c=n._findRange(a,i,r),u,l=t[t.length-1];l&&n._hasIntersection(l.range,c)?t[t.length-1].elements.push(a):(u={range:c,elements:[a]},t.push(u))}),t},zi.prototype._setOrientation=function(e){var t=H2[e];this._axis=t[0],this._dimension=t[1]},zi.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)},zi.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+ab,max:t+n-ab}};const z2={__init__:["distributeElements"],distributeElements:["type",zi]};function ou(e){Yn.call(this,e)}ou.$inject=["eventBus"],ie(ou,Yn),ou.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=Oe(t,function(n){var i=De(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=xs(t),t.length<3?!1:t})};var sb={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>`},F2=900;function Ha(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",F2,this)}Ha.$inject=["popupMenu","distributeElements","translate","rules"],Ha.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&O(t,this._getEntries(e)),t},Ha.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Ha.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:ob.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:ob.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const H2={__depends__:[pf,j2],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",ou],distributeElementsMenuProvider:["type",Ha]};var ab="is not a registered action",z2="is already registered";function Jn(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}Jn.$inject=["eventBus","injector"],Jn.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),c=e.get("rules",!1),s=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&&c&&this.register("cut",function(){var l=i.get();if(l.length){var p=c.allowed("elements.delete",{elements:l});if(p!==!1){var f=_e(p)?p:l;return o.cut(f.slice())}}}),r&&this.register("stepZoom",function(l){r.stepZoom(l.value)}),a&&this.register("zoom",function(l){a.zoom(l.value)}),n&&i&&c&&this.register("removeSelection",function(){var l=i.get();if(l.length){var p=c.allowed("elements.delete",{elements:l}),f;p!==!1&&(_e(p)?f=p:f=l,f.length&&n.removeElements(f.slice()))}}),s&&this.register("moveCanvas",function(l){s.moveCanvas(l)}),u&&this.register("moveSelection",function(l){u.moveSelection(l.direction,l.accelerated)})},Jn.prototype.trigger=function(e,t){if(!this._actions[e])throw xf(e,ab);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},Jn.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);M(e,function(i,r){n._registerAction(r,i)})},Jn.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw xf(e,z2);this._actions[e]=t},Jn.prototype.unregister=function(e){if(!this.isRegistered(e))throw xf(e,ab);this._actions[e]=void 0},Jn.prototype.getActions=function(){return Object.keys(this._actions)},Jn.prototype.isRegistered=function(e){return!!this._actions[e]};function xf(e,t){return new Error(e+" "+t)}const V2={__init__:["editorActions"],editorActions:["type",Jn]};function au(e){e.invoke(Jn,this)}ie(au,Jn),au.$inject=["injector"],au.prototype._registerDefaultActions=function(e){Jn.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),c=e.get("globalConnect",!1),s=e.get("distributeElements",!1),u=e.get("alignElements",!1),l=e.get("directEditing",!1),p=e.get("searchPad",!1),f=e.get("modeling",!1),d=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",function(){var h=t.getRootElement(),m=n.filter(function(g){return g!==h});return i.select(m),m}),r&&this._registerAction("spaceTool",function(){r.toggle()}),o&&this._registerAction("lassoTool",function(){o.toggle()}),a&&this._registerAction("handTool",function(){a.toggle()}),c&&this._registerAction("globalConnectTool",function(){c.toggle()}),i&&s&&this._registerAction("distributeElements",function(h){var m=i.get(),g=h.type;m.length&&s.trigger(m,g)}),i&&u&&this._registerAction("alignElements",function(h){var m=i.get(),g=[],R=h.type;m.length&&(g=Oe(m,function(w){return!v(w,"bpmn:Lane")}),u.trigger(g,R))}),i&&f&&this._registerAction("setColor",function(h){var m=i.get();m.length&&f.setColor(m,h)}),i&&l&&this._registerAction("directEditing",function(){var h=i.get();h.length&&l.activate(h[0])}),p&&this._registerAction("find",function(){p.toggle()}),t&&f&&this._registerAction("moveToOrigin",function(){var h=t.getRootElement(),m,g;v(h,"bpmn:Collaboration")?g=n.filter(function(R){return v(R.parent,"bpmn:Collaboration")}):g=n.filter(function(R){return R!==h&&!v(R.parent,"bpmn:SubProcess")}),m=At(g),f.moveElements(g,{x:-m.x,y:-m.y},h)}),i&&d&&this._registerAction("replaceElement",function(h){d.triggerEntry("replace","click",h)})};const G2={__depends__:[V2],editorActions:["type",au]};function sb(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;De(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}sb.$inject=["eventBus"];function Yr(e,t){X.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 c=r.shape,s=r.newBounds;xn(a)?r.newBounds=n.snapComplex(s,a):r.newBounds=n.snapSimple(c,s)}})}Yr.$inject=["eventBus","gridSnapping","modeling"],ie(Yr,X),Yr.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},Yr.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},Yr.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),O(e,o),e},Yr.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),O(e,o),e};var W2=2e3;function cb(e,t){e.on(["spaceTool.move","spaceTool.end"],W2,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)}})}cb.$inject=["eventBus","gridSnapping"];const U2={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Yr],gridSnappingSpaceToolBehavior:["type",cb]};var su=10;function wf(e,t,n){return n||(n="round"),Math[n](e/t)*t}var Y2=1200,q2=800;function yr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",q2,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"],Y2,function(o){var a=o.originalEvent;if(!(!r.active||a&&An(a))){var c=o.context,s=c.gridSnappingContext;s||(s=c.gridSnappingContext={}),["x","y"].forEach(function(u){var l={},p=X2(o,u,e);p&&(l.offset=p);var f=K2(o,u);f&&O(l,f),Oo(o,u)||r.snapEvent(o,u,l)})}})}yr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);Dt(e,t,i)},yr.prototype.getGridSpacing=function(){return su},yr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=wf(e,su);var i,r;return t&&t.min&&(i=t.min,we(i)&&(i=wf(i+n,su,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,we(r)&&(r=wf(r+n,su,"floor"),e=Math.min(e,r))),e-=n,e},yr.prototype.isActive=function(){return this.active},yr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},yr.prototype.toggleActive=function(){this.setActive(!this.active)},yr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function K2(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 c=n.direction;i&&(cu(t)?(a.x.min=i.left,a.x.max=i.right):(a.y.min=i.top,a.y.max=i.bottom));var s=r.min,u=r.max;return s&&(cu(t)?lb(c)?a.x.max=s.left:a.x.min=s.right:ub(c)?a.y.max=s.top:a.y.min=s.bottom),u&&(cu(t)?lb(c)?a.x.min=u.left:a.x.max=u.right:ub(c)?a.y.min=u.top:a.y.max=u.bottom),a[t]}function X2(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,c=o.snapOffset;return c&&we(c[t])||(c||(c=o.snapOffset={}),we(c[t])||(c[t]=0),!r)||(n.get(r.id)||(cu(t)?c[t]+=r[t]+r.width/2:c[t]+=r[t]+r.height/2),!a)||(t==="x"?/left/.test(a)?c[t]-=r.width/2:/right/.test(a)&&(c[t]+=r.width/2):/top/.test(a)?c[t]-=r.height/2:/bottom/.test(a)&&(c[t]+=r.height/2)),c[t]}function cu(e){return e==="x"}function ub(e){return e.indexOf("n")!==-1}function lb(e){return e.indexOf("w")!==-1}const Z2={__depends__:[U2],__init__:["gridSnapping"],gridSnapping:["type",yr]};var Q2=2e3;function pb(e,t,n){e.on("autoPlace",Q2,function(i){var r=i.source,o=be(r),a=i.shape,c=lv(r,a,n);return["x","y"].forEach(function(s){var u={};c[s]!==o[s]&&(c[s]>o[s]?u.min=c[s]:u.max=c[s],v(a,"bpmn:TextAnnotation")&&(J2(s)?u.offset=-a.width/2:u.offset=-a.height/2),c[s]=t.snapValue(c[s],u))}),c})}pb.$inject=["eventBus","gridSnapping","elementRegistry"];function J2(e){return e==="x"}var ek=1750;function fb(e,t,n){t.on(["create.start","shape.move.start"],ek,function(i){var r=i.context,o=r.shape,a=e.getRootElement();if(!(!v(o,"bpmn:Participant")||!v(a,"bpmn:Process")||!a.children.length)){var c=r.createConstraints;c&&(o.width=n.snapValue(o.width,{min:o.width}),o.height=n.snapValue(o.height,{min:o.height}))}})}fb.$inject=["canvas","eventBus","gridSnapping"];var tk=3e3;function uu(e,t,n){X.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],tk,function(r){var o=r.context,a=o.connection,c=o.hints||{},s=a.waypoints;c.connectionStart||c.connectionEnd||c.createElementsBehavior===!1||nk(s)&&n.updateWaypoints(a,i.snapMiddleSegments(s))})}uu.$inject=["eventBus","gridSnapping","modeling"],ie(uu,X),uu.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=ok(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function nk(e){return e.length>3}function ik(e){return e==="h"}function rk(e){return e==="v"}function ok(e,t,n){var i=Ai(t,n),r={};return ik(i)&&(r.y=e.snapValue(t.y)),rk(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=O({},t,r),n=O({},n,r)),[t,n]}const ak={__depends__:[Z2,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",pb],gridSnappingParticipantBehavior:["type",fb],gridSnappingLayoutConnectionBehavior:["type",uu]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",sb]};var sk=30,db=30;function za(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var r=i.element,o=i.gfx;if(v(r,"bpmn:Lane"))return n._createParticipantHit(r,o);if(v(r,"bpmn:Participant"))return $e(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(v(r,"bpmn:SubProcess"))return $e(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}za.$inject=["eventBus","interactionEvents"],za.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},za.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:sk,height:e.height}:{width:e.width,height:db};return this._interactionEvents.createBoxHit(t,"all",n),!0},za.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:db}),!0};const ck={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",za]};function lu(e){e.invoke(Co,this)}ie(lu,Co),lu.$inject=["injector"],lu.prototype.registerBindings=function(e,t){Co.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 uk={__depends__:[Kp],__init__:["keyboardBindings"],keyboardBindings:["type",lu]};var lk={moveSpeed:1,moveSpeedAccelerated:10},pk=1500,hb="left",mb="up",gb="right",yb="down",fk={ArrowLeft:hb,Left:hb,ArrowUp:mb,Up:mb,ArrowRight:gb,Right:gb,ArrowDown:yb,Down:yb},dk={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 vb(e,t,n,i,r){var o=this;this._config=O({},lk,e||{}),t.addListener(pk,function(a){var c=a.keyEvent,s=fk[c.key];if(s&&!t.isCmd(c)){var u=t.isShift(c);return o.moveSelection(s,u),!0}}),this.moveSelection=function(a,c){var s=r.get();if(s.length){var u=this._config[c?"moveSpeedAccelerated":"moveSpeed"],l=dk[a](u),p=i.allowed("elements.move",{shapes:s,hints:{keyboardMove:!0}});p&&n.moveElements(s,l)}}}vb.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const hk={__depends__:[Kp,qn],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",vb]};var _b=10;function Va(e,t,n,i){this._dragging=i,this._rules=t;var r=this;function o(s,u){var l=s.shape,p=s.direction,f=s.resizeConstraints,d;s.delta=u,d=lR(l,p,u),s.newBounds=fR(d,f),s.canExecute=r.canResize(s)}function a(s){var u=s.resizeConstraints,l=s.minBounds;u===void 0&&(l===void 0&&(l=r.computeMinResizeBox(s)),s.resizeConstraints={min:ye(l)})}function c(s){var u=s.shape,l=s.canExecute,p=s.newBounds;if(l){if(p=Nh(p),!mk(u,p))return;n.resizeShape(u,p)}}e.on("resize.start",function(s){a(s.context)}),e.on("resize.move",function(s){var u={x:s.dx,y:s.dy};o(s.context,u)}),e.on("resize.end",function(s){c(s.context)})}Va.prototype.canResize=function(e){var t=this._rules,n=ni(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Va.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=O({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,bb(t,o),"resize",{autoActivate:!0,cursor:gk(o),data:{shape:t,context:r}})},Va.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:_b,height:_b},r=Em(t,e.childrenBoxPadding),dR(n,t,i,r)},Va.$inject=["eventBus","rules","modeling","dragging"];function mk(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function bb(e,t){var n=be(e),i=ye(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 gk(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 xb="djs-resizing",wb="resize-not-ok",yk=500;function Eb(e,t,n){function i(o){var a=o.shape,c=o.newBounds,s=o.frame;s||(s=o.frame=n.addFrame(a,t.getActiveLayer()),t.addMarker(a,xb)),c.width>5&&re(s,{x:c.x,width:c.width}),c.height>5&&re(s,{y:c.y,height:c.height}),o.canExecute?Fe(s).remove(wb):Fe(s).add(wb)}function r(o){var a=o.shape,c=o.frame;c&&Ft(o.frame),t.removeMarker(a,xb)}e.on("resize.move",yk,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}Eb.$inject=["eventBus","canvas","previewSupport"];var pu=-6,fu=8,du=20,Ga="djs-resizer",vk=["n","w","s","e","nw","ne","se","sw"];function vr(e,t,n,i){this._resize=i,this._canvas=t;var r=this;e.on("selection.changed",function(o){var a=o.newSelection;r.removeResizers(),a.length===1&&M(a,vn(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}vr.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){ar(o)&&i.activate(o,e,n)}Se.bind(t,"mousedown",r),Se.bind(t,"touchstart",r)},vr.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=_k(i),a=me("g");Fe(a).add(Ga),Fe(a).add(Ga+"-"+e.id),Fe(a).add(Ga+"-"+i),Re(r,a);var c=me("rect");re(c,{x:-fu/2+o.x,y:-fu/2+o.y,width:fu,height:fu}),Fe(c).add(Ga+"-visual"),Re(a,c);var s=me("rect");return re(s,{x:-du/2+o.x,y:-du/2+o.y,width:du,height:du}),Fe(s).add(Ga+"-hit"),Re(a,s),Ps(a,t,n),a},vr.prototype.createResizer=function(e,t){var n=bb(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},vr.prototype.addResizer=function(e){var t=this;it(e)||M(vk,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},vr.prototype.removeResizers=function(){var e=this._getResizersParent();vs(e)},vr.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},vr.$inject=["eventBus","canvas","selection","resize"];function _k(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-pu:e.indexOf("w")!==-1&&(t.x=pu),e.indexOf("s")!==-1?t.y=-pu:e.indexOf("n")!==-1&&(t.y=pu),t}const Sb={__depends__:[gi,Li,Eo],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Va],resizePreview:["type",Eb],resizeHandles:["type",vr]};var bk=2e3;function Wa(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(s){c(s.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"],bk,function(s){i.isActive(s.element)&&i.cancel()}),e.on(["commandStack.changed"],function(s){i.isActive()&&i.cancel()}),e.on("directEditing.activate",function(s){o.removeResizers()}),e.on("create.end",500,function(s){var u=s.context,l=u.shape,p=s.context.canExecute,f=s.isTouch;f||p&&(u.hints&&u.hints.createElementsBehavior===!1||c(l))}),e.on("autoPlace.end",500,function(s){c(s.shape)});function c(s,u){(u||De(s,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(s)}}Wa.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Wa.prototype.activate=function(e){var t=jn(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);O(n,i);var r={},o=n.style||{};return O(o,{backgroundColor:null,border:null}),(De(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||Rb(e))&&O(r,{centerVertically:!0}),nr(e)&&(O(r,{resizable:!0,autoResize:!0}),O(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),v(e,"bpmn:TextAnnotation")&&(O(r,{resizable:!0,autoResize:!0}),O(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),O(n,{options:r,style:o}),n}},Wa.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(),c=this._textRenderer.getDefaultStyle(),s=this._textRenderer.getExternalStyle(),u=s.fontSize*a,l=s.lineHeight,p=c.fontSize*a,f=c.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(v(e,"bpmn:Lane")||Ek(e)){var h=Yt(e),m=h?{width:i.height,height:30*a,x:i.x-i.height/2+15*a,y:r.y-30*a/2}:{width:i.width,height:30*a};O(o,m),O(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:h?"rotate(-90deg)":null})}if(wk(e)){var g=Yt(e),R=g?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:r.x-i.height/2,y:r.y-i.width/2};O(o,R),O(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:g?null:"rotate(-90deg)"})}(De(e,["bpmn:Task","bpmn:CallActivity"])||Rb(e))&&(O(o,{width:i.width,height:i.height}),O(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),xk(e)&&(O(o,{width:i.width,x:i.x}),O(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var w=1,x=i.width+2*w;if(n.labelTarget&&(O(o,{width:x,height:i.height+2*w,x:i.x-w,y:i.y-w}),O(d,{fontSize:u+"px",lineHeight:l})),nr(n)&&!Ms(n)&&!Me(n)){var b=ul(e),E=t.getAbsoluteBBox({x:b.x,y:b.y,width:0,height:0}),T=u,L=Ir.width*a+2*w;O(o,{width:L,height:T+2*w,x:E.x-L/2,y:E.y-T/2-w}),O(d,{fontSize:u+"px",lineHeight:l})}return v(e,"bpmn:TextAnnotation")&&(O(o,{width:i.width+2*w,height:i.height+2*w,x:i.x-w,y:i.y-w,minWidth:30*a,minHeight:10*a}),O(d,{textAlign:"left",paddingTop:uo*a+"px",paddingBottom:uo*a+"px",paddingLeft:uo*a+"px",paddingRight:uo*a+"px",fontSize:p+"px",lineHeight:f})),{bounds:o,style:d}},Wa.prototype.update=function(e,t,n,i){var r,o;v(e,"bpmn:TextAnnotation")&&(o=this._canvas.getAbsoluteBBox(e),r={x:e.x,y:e.y,width:e.width/o.width*i.width,height:e.height/o.height*i.height}),Sk(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function Rb(e){return v(e,"bpmn:SubProcess")&&!$e(e)}function xk(e){return v(e,"bpmn:SubProcess")&&$e(e)}function wk(e){return v(e,"bpmn:Participant")&&!$e(e)}function Ek(e){return v(e,"bpmn:Participant")&&$e(e)}function Sk(e){return!e||!e.trim()}var Cb="djs-element-hidden",Pb="djs-label-hidden";function Ab(e,t,n){var i=this,r=t.getDefaultLayer(),o,a,c;e.on("directEditing.activate",function(s){var u=s.active;if(o=u.element.label||u.element,v(o,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(o),c=me("g");var l=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:o.height,position:{mx:0,my:0}}),p=i.path=me("path");re(p,{d:l,strokeWidth:2,stroke:Rk(o)}),Re(c,p),Re(r,c),Qt(c,o.x,o.y)}v(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,Cb):(v(o,"bpmn:Task")||v(o,"bpmn:CallActivity")||v(o,"bpmn:SubProcess")||v(o,"bpmn:Participant")||v(o,"bpmn:Lane"))&&t.addMarker(o,Pb)}),e.on("directEditing.resize",function(s){if(v(o,"bpmn:TextAnnotation")){var u=s.height,l=s.dy,p=Math.max(o.height/a.height*(u+l),0),f=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:p,position:{mx:0,my:0}});re(i.path,{d:f})}}),e.on(["directEditing.complete","directEditing.cancel"],function(s){var u=s.active;u&&(t.removeMarker(u.element.label||u.element,Cb),t.removeMarker(o,Pb)),o=void 0,a=void 0,c&&(Ft(c),c=void 0)})}Ab.$inject=["eventBus","canvas","pathMap"];function Rk(e,t){var n=Ve(e);return n.get("stroke")||t||"black"}const Ck={__depends__:[Pp,Sb,J_],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Wa],labelEditingPreview:["type",Ab]};var Pk=500,Ak=1e3;function _i(e,t,n){this._eventBus=e,this._elementRegistry=n,this._outlineOffset=5,this._outlineStyle=t.cls("djs-outline",["no-fill"]);var i=this;function r(o){f1(o)||i.createOutline(o)}e.on("element.hover",function(o){r(o.element)}),e.on("selection.changed",function(o){M(o.newSelection,r)}),e.on(["shape.changed","connection.changed"],Pk,function(o){var a=o.element,c=o.gfx,s=et(".djs-outline",c);s&&i.updateOutline(a,s)})}_i.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=et(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),Re(t,n),this.updateOutline(e,n)),n},_i.prototype._createOutlineGfx=function(){var e=me("rect");return re(e,O({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},_i.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},_i.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&M(i,function(r){n=n||r.updateOutline(t,e)}),n||re(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},_i.prototype.updateConnectionOutline=function(e,t){var n=At(t);re(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},_i.prototype.registerProvider=function(e,t){t||(t=e,e=Ak),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},_i.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},_i.prototype.getOutline=function(e){var t,n=this._getProviders();return M(n,function(i){Wt(i.getOutline)&&(t=t||i.getOutline(e))}),t},_i.$inject=["eventBus","styles","elementRegistry"];var hu=6;function Ef(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)})}Ef.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");vs(t);var n=e.length>1,i=this._canvas.getContainer();if(Fe(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=Tk(At(e)),o=me("rect");re(o,O({rx:3},r)),Fe(o).add("djs-selection-outline"),Re(t,o)}},Ef.$inject=["eventBus","canvas","selection"];function Tk(e){return{x:e.x-hu,y:e.y-hu,width:e.width+hu*2,height:e.height+hu*2}}const Sf={__depends__:[qn],__init__:["outline","multiSelectionOutline"],outline:["type",_i],multiSelectionOutline:["type",Ef]},Tb=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],Mb={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},Mk=15,mu=2;function kb(e,t,n,i,r){const o=t.getLayer("overlays");e.on(["selection.changed","shape.changed"],function(){c()}),e.on("selection.changed",function({newSelection:p}){var d;const f=p.filter(h=>De(h,Tb));if(f.length===1){const h=f[0];Me(h)?a(h,h.labelTarget):(d=h.labels)!=null&&d.length&&a(h.labels[0],h)}if(f.length===2){const h=f.find(Me),m=f.find(g=>{var R;return(R=g.labels)==null?void 0:R.includes(h)});h&&m&&a(h,m)}}),e.on("shape.changed",function({element:p}){var f;!De(p,Tb)||!l(p)||(Me(p)?a(p,p.labelTarget):(f=p.labels)!=null&&f.length&&a(p.labels[0],p))});function a(p,f){const d=qo([be(f),be(p)],Mb),h=d.getAttribute("d"),g=r.isSelected(p)?s(p):u(p),R=Qo(g,h);if(!R)return;const x=r.isSelected(f)?s(f):u(f),b=Qo(x,h)||be(f);ca(b,R)<Mk||(tl(d,[b,R]),Re(o,d))}function c(){ys(`.${Mb.class}`,o).forEach(Ft)}function s(p){const f=i.getOutline(p);if(!f)return u(p);if(f.x){const d={x:p.x+_r(f,"x")-mu,y:p.y+_r(f,"y")-mu,width:_r(f,"width")+mu*2,height:_r(f,"height")+mu*2};return pl(d,_r(f,"rx"))}if(f.cx){const d=_r(f,"r"),h={x:p.x+_r(f,"cx")-d,y:p.y+_r(f,"cy")-d,width:d*2,height:d*2};return am(h)}}function u(p){return n.getShapePath(p)}function l(p){return r.isSelected(p)}}kb.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function _r(e,t){return parseFloat(re(e,t)||0)}const kk={__depends__:[qn,Sf],__init__:["labelLink"],labelLink:["type",kb]};var Dk=new wo("tt");function Ok(e){var t=ut('<div class="djs-tooltip-container" />');return mn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function Lk(e,t,n){mn(e,{left:t+"px",top:n+"px"})}function Rf(e,t){e.style.display=t===!1?"none":""}var Db="djs-tooltip",Cf="."+Db;function bn(e,t){this._eventBus=e,this._canvas=t,this._ids=Dk,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=Ok(t.getContainer());var n=this;Rn.bind(this._tooltipRoot,Cf,"mousedown",function(i){i.stopPropagation()}),Rn.bind(this._tooltipRoot,Cf,"mouseover",function(i){n.trigger("mouseover",i)}),Rn.bind(this._tooltipRoot,Cf,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}bn.$inject=["eventBus","canvas"],bn.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=O({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},bn.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(an(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},bn.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},bn.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},bn.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)}},bn.prototype.remove=function(e){var t=this.get(e);t&&(li(t.html),li(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},bn.prototype.show=function(){Rf(this._tooltipRoot)},bn.prototype.hide=function(){Rf(this._tooltipRoot,!1)},bn.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},bn.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=ut(n)),i=ut('<div data-tooltip-id="'+t+'" class="'+Db+'">'),mn(i,{position:"absolute"}),i.appendChild(n),e.type&&ht(i).add("djs-tooltip-"+e.type),e.className&&ht(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},bn.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;Lk(n,t.x,t.y)},bn.prototype._updateTooltipVisibilty=function(e){M(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),Rf(i,r))})},bn.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 Ik={__init__:["tooltips"],tooltips:["type",bn]};var Nk="flow elements must be children of pools/participants",Bk="Data object must be placed within a pool/participant.";function Ob(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,c=o.target;v(c,"bpmn:Collaboration")&&(v(a,"bpmn:FlowNode")?i(r,n(Nk)):v(a,"bpmn:DataObjectReference")&&i(r,n(Bk)))})}Ob.$inject=["eventBus","tooltips","translate"];const $k={__depends__:[Ik],__init__:["modelingFeedback"],modelingFeedback:["type",Ob]};var jk=500,Fk=1250,Hk=1500,gu=Math.round;function zk(e){return{x:e.x+gu(e.width/2),y:e.y+gu(e.height/2)}}function Lb(e,t,n,i,r){function o(c,s,u,l){return r.allowed("elements.move",{shapes:c,delta:s,position:u,target:l})}e.on("shape.move.start",Hk,function(c){var s=c.context,u=c.shape,l=i.get().slice();l.indexOf(u)===-1&&(l=[u]),l=Vk(l),O(s,{shapes:l,validatedShapes:l,shape:u})}),e.on("shape.move.start",Fk,function(c){var s=c.context,u=s.validatedShapes,l;if(l=s.canExecute=o(u),!l)return!1}),e.on("shape.move.move",jk,function(c){var s=c.context,u=s.validatedShapes,l=c.hover,p={x:c.dx,y:c.dy},f={x:c.x,y:c.y},d;if(d=o(u,p,f,l),s.delta=p,s.canExecute=d,d===null){s.target=null;return}s.target=l}),e.on("shape.move.end",function(c){var s=c.context,u=s.delta,l=s.canExecute,p=l==="attach",f=s.shapes;if(l===!1)return!1;u.x=gu(u.x),u.y=gu(u.y),!(u.x===0&&u.y===0)&&n.moveElements(f,u,s.target,{primaryShape:s.shape,attach:p})}),e.on("element.mousedown",function(c){if(ar(c)){var s=vo(c);if(!s)throw new Error("must supply DOM mousedown event");return a(s,c.element)}});function a(c,s,u,l){if(Gt(u)&&(l=u,u=!1),!(s.waypoints||!s.parent)&&!Fe(c.target).has("djs-hit-no-move")){var p=zk(s),f=t.init(c,p,"shape.move",{cursor:"grabbing",autoActivate:u,data:{shape:s,context:l||{}}});if(f!==!1)return!0}}this.start=a}Lb.$inject=["eventBus","dragging","modeling","selection","rules"];function Vk(e){var t=Qr(e,"id");return Oe(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var Ib=499,Pf="djs-dragging",Nb="drop-ok",Bb="drop-not-ok",$b="new-parent",jb="attach-ok";function Fb(e,t,n,i){function r(s){var u=o(s),l=Gk(u);return l}function o(s){var u=Ko(s),l=u.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),p=u.concat(l),f=[...new Set(p)];return f}function a(s,u){[jb,Nb,Bb,$b].forEach(function(l){l===u?t.addMarker(s,l):t.removeMarker(s,l)})}function c(s,u,l){i.addDragger(u,s.dragGroup),l&&t.addMarker(u,Pf),s.allDraggedElements?s.allDraggedElements.push(u):s.allDraggedElements=[u]}e.on("shape.move.start",Ib,function(s){var u=s.context,l=u.shapes,p=u.allDraggedElements,f=r(l);if(!u.dragGroup){var d=me("g");re(d,n.cls("djs-drag-group",["no-events"]));var h=t.getActiveLayer();Re(h,d),u.dragGroup=d}f.forEach(function(m){i.addDragger(m,u.dragGroup)}),p?p=Eu([p,o(l)]):p=o(l),M(p,function(m){t.addMarker(m,Pf)}),u.allDraggedElements=p,u.differentParents=Wk(l)}),e.on("shape.move.move",Ib,function(s){var u=s.context,l=u.dragGroup,p=u.target,f=u.shape.parent,d=u.canExecute;p&&(d==="attach"?a(p,jb):u.canExecute&&f&&p.id!==f.id?a(p,$b):a(p,u.canExecute?Nb:Bb)),Qt(l,s.dx,s.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(s){var u=s.context,l=u.target;l&&a(l,null)}),e.on("shape.move.cleanup",function(s){var u=s.context,l=u.allDraggedElements,p=u.dragGroup;M(l,function(f){t.removeMarker(f,Pf)}),p&&Ft(p)}),this.makeDraggable=c}Fb.$inject=["eventBus","canvas","styles","previewSupport"];function Gk(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=Oe(e,function(i){return it(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function Wk(e){return Ux(Qr(e,function(t){return t.parent&&t.parent.id}))!==1}const Uk={__depends__:[sc,qn,Sf,gi,Li,Eo],__init__:["move","movePreview"],move:["type",Lb],movePreview:["type",Fb]};var Hb=".djs-palette-toggle",zb=".entry",Yk=Hb+", "+zb,Af="djs-palette-",qk="shown",Tf="open",Vb="two-column",Kk=1e3;function Ot(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()})}Ot.$inject=["eventBus","canvas"],Ot.prototype.registerProvider=function(e,t){t||(t=e,e=Kk),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},Ot.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(Zk,{})},Ot.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},Ot.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=ut(Ot.HTML_MARKUP);n.appendChild(i),ht(n).add(Af+qk),Rn.bind(i,Yk,"click",function(r){var o=r.delegateTarget;if(Uu(o,Hb))return e.toggle();e.trigger("click",r)}),Se.bind(i,"mousedown",function(r){r.stopPropagation()}),Rn.bind(i,zb,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},Ot.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},Ot.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,r,o=ht(n),a=ht(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(Vb,r),a.toggle(Af+Vb,r),"open"in e&&(o.toggle(Tf,e.open),a.toggle(Af+Tf,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},Ot.prototype._update=function(){var e=et(".djs-palette-entries",this._container),t=this._entries=this.getEntries();ms(e),M(t,function(n,i){var r=n.group||"default",o=et("[data-group="+Ma(r)+"]",e);o||(o=ut('<div class="group"></div>'),an(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),c=ut(a);if(o.appendChild(c),!n.separator&&(an(c,"data-action",i),n.title&&an(c,"title",n.title),n.className&&Xk(c,n.className),n.imageUrl)){var s=ut("<img>");an(s,"src",n.imageUrl),c.appendChild(s)}}),this.open()},Ot.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=an(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},Ot.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(Wt(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},Ot.prototype._layoutChanged=function(){this._toggleState({})},Ot.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},Ot.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},Ot.prototype.open=function(){this._toggleState({open:!0})},Ot.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Ot.prototype.isActiveTool=function(e){return e&&this._activeTool===e},Ot.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=et(".djs-palette-entries",this._container),this._toolsContainer=et("[data-group=tools]",t)),n=this._toolsContainer,M(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=ht(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},Ot.prototype.isOpen=function(){return ht(this._container).has(Tf)},Ot.prototype._getParentContainer=function(){return this._canvas.getContainer()},Ot.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function Xk(e,t){var n=ht(e),i=_e(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function Zk(e,t){var n=t.getPaletteEntries();return Wt(n)?n(e):(M(n,function(i,r){e[r]=i}),e)}const Qk={__init__:["palette"],palette:["type",Ot]};var Gb="crosshair",Wb="selected",Jk="djs-dragging-active-lasso";function br(e,t,n,i,r,o,a){this._selection=r,this._dragging=n,this._mouse=a;var c=this,s={create:function(p){var f=t.getActiveLayer(),d=p.frame=me("rect");re(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),Re(f,d),u(!0),this.update(p)},update:function(p){var f=p.frame,d=p.bbox;f&&d&&re(f,{x:d.x,y:d.y,width:d.width,height:d.height});var h=p.marked,m=p.lastMarked;if(h&&m){for(const g of m)h.has(g)||t.removeMarker(g,Wb);for(const g of h)m.has(g)||t.addMarker(g,Wb)}},remove:function(p){this.update(p),p.frame&&Ft(p.frame),u(!1)}};function u(p){Fe(t.getContainer()).toggle(Jk,p)}function l(p){var f=i.getAll();return new Set(Zr(ro(f,p)))}o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(p){var f=p.originalEvent.target;!p.hover&&!(f instanceof SVGElement)||e.once("lasso.selection.ended",function(){c.activateLasso(p.originalEvent,!0)})}),e.on("lasso.end",0,function(p){var f=p.context;c._select(Array.from(f.marked))}),e.on("lasso.start",function(p){var f=p.context;f.bbox=Ub(p),f.add=ec(p),f.lastMarked=new Set(r.get()),f.add?f.marked=f.lastMarked:f.marked=new Set,f.initialMarked=f.marked,s.create(f)}),e.on("lasso.move",function(p){var f=p.context,d=f.bbox=Ub(p),h=l(d),m=f.initialMarked.union(h);f.lastMarked=f.marked,f.marked=m,s.update(f)}),e.on("lasso.cleanup",function(p){var f=p.context;f.lastMarked=f.marked,f.marked=new Set(r.get()),s.remove(p.context)}),e.on("element.mousedown",1500,function(p){if(ec(p))return c.activateLasso(p.originalEvent),!0})}br.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],br.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:Gb,data:{context:{}},keepSelection:!0})},br.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:Gb,data:{context:{}},keepSelection:!0})},br.prototype._select=function(e){this._selection.select(e)},br.prototype.select=function(e,t,n=[]){var i=Zr(ro(e,t));this._select([...n,...i])},br.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},br.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function Ub(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 eD={__depends__:[pc,ha],__init__:["lassoTool"],lassoTool:["type",br]};var Mf=1500,Yb="grab";function Lo(e,t,n,i,r,o){this._dragging=n,this._mouse=o;var a=this,c=i.get("keyboard",!1);r.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",Mf,function(s){if(pa(s))return a.activateMove(s.originalEvent,!0),!1}),c&&c.addListener(Mf,function(s){if(!(!qb(s.keyEvent)||a.isActive())){var u=a._mouse.getLastMoveEvent();a.activateMove(u,!!u)}},"keyboard.keydown"),c&&c.addListener(Mf,function(s){!qb(s.keyEvent)||!a.isActive()||a.toggle()},"keyboard.keyup"),e.on("hand.end",function(s){var u=s.originalEvent.target;if(!s.hover&&!(u instanceof SVGElement))return!1;e.once("hand.ended",function(){a.activateMove(s.originalEvent,{reactivate:!0})})}),e.on("hand.move.move",function(s){var u=t.viewbox().scale;t.scroll({dx:s.dx*u,dy:s.dy*u})}),e.on("hand.move.end",function(s){var u=s.context,l=u.reactivate;return!pa(s)&&l&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}Lo.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Lo.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:Yb,data:{context:n||{}}})},Lo.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:Yb,data:{context:{reactivate:n}}})},Lo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Lo.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function qb(e){return Ht("Space",e)}const tD={__depends__:[pc,ha],__init__:["handTool"],handTool:["type",Lo]};var Kb="connect-ok",Xb="connect-not-ok";function Io(e,t,n,i,r,o,a){var c=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(s){var u=s.context,l=s.hover,p=u.canStartConnect=c.canStartConnect(l);p!==null&&(u.startTarget=l,i.addMarker(l,p?Kb:Xb))}),e.on(["global-connect.out","global-connect.cleanup"],function(s){var u=s.context.startTarget,l=s.context.canStartConnect;u&&i.removeMarker(u,l?Kb:Xb)}),e.on(["global-connect.ended"],function(s){var u=s.context,l=u.startTarget,p={x:s.x,y:s.y},f=c.canStartConnect(l);if(f)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,l,p)}),!1})}Io.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Io.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Io.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Io.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Io.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const nD={__depends__:[_f,gi,Li,pc,ha],globalConnect:["type",Io]};function kf(e,t,n,i,r,o,a,c){this._palette=e,this._create=t,this._elementFactory=n,this._spaceTool=i,this._lassoTool=r,this._handTool=o,this._globalConnect=a,this._translate=c,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,c=this._translate;function s(p,f,d,h,m){function g(R){var w=n.createShape(O({type:p},m));t.start(R,w)}return{group:f,className:d,title:h,action:{dragstart:g,click:g}}}function u(p){var f=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),d=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:f});t.start(p,[f,d],{hints:{autoSelect:[f]}})}function l(p){t.start(p,n.createParticipantShape())}return O(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:c("Activate hand tool"),action:{click:function(p){o.activateHand(p)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:c("Activate lasso tool"),action:{click:function(p){r.activateSelection(p)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:c("Activate create/remove space tool"),action:{click:function(p){i.activateSelection(p)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:c("Activate global connect tool"),action:{click:function(p){a.start(p)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":s("bpmn:StartEvent","event","bpmn-icon-start-event-none",c("Create start event")),"create.intermediate-event":s("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",c("Create intermediate/boundary event")),"create.end-event":s("bpmn:EndEvent","event","bpmn-icon-end-event-none",c("Create end event")),"create.exclusive-gateway":s("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",c("Create gateway")),"create.task":s("bpmn:Task","activity","bpmn-icon-task",c("Create task")),"create.data-object":s("bpmn:DataObjectReference","data-object","bpmn-icon-data-object",c("Create data object reference")),"create.data-store":s("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",c("Create data store reference")),"create.subprocess-expanded":{group:"activity",className:"bpmn-icon-subprocess-expanded",title:c("Create expanded sub-process"),action:{dragstart:u,click:u}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:c("Create pool/participant"),action:{dragstart:l,click:l}},"create.group":s("bpmn:Group","artifact","bpmn-icon-group",c("Create group"))}),e};const iD={__depends__:[Qk,uc,Sy,eD,tD,nD,ra],__init__:["paletteProvider"],paletteProvider:["type",kf]};var rD=250;function Df(e,t,n,i,r){X.call(this,e);function o(c){var s=c.canExecute.replacements;M(s,function(u){var l=u.oldElementId,p={type:u.newElementType};if(!c.visualReplacements[l]){var f=t.get(l);O(p,{x:f.x,y:f.y});var d=n.createShape(p);i.addShape(d,f.parent);var h=et('[data-element-id="'+Ma(f.id)+'"]',c.dragGroup);h&&re(h,{display:"none"});var m=r.addDragger(d,c.dragGroup);c.visualReplacements[l]=m,i.removeShape(d)}})}function a(c){var s=c.visualReplacements;M(s,function(u,l){var p=et('[data-element-id="'+Ma(l)+'"]',c.dragGroup);p&&re(p,{display:"inline"}),u.remove(),s[l]&&delete s[l]})}e.on("shape.move.move",rD,function(c){var s=c.context,u=s.canExecute;s.visualReplacements||(s.visualReplacements={}),u&&u.replacements?o(s):a(s)})}Df.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],ie(Df,X);const oD={__depends__:[Eo],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Df]};var aD=1250,Of=40,sD=20,cD=10,Zb=20,Qb=["x","y"],uD=Math.abs;function Jb(e){e.on(["connect.hover","connect.move","connect.end"],aD,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,c=n.target;t.originalEvent&&An(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&lD(t,o,hD(o)),o&&dD(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Zn(r),De(o,["bpmn:Event","bpmn:Gateway"])&&ex(t,Zn(o)),De(o,["bpmn:Task","bpmn:SubProcess"])&&pD(t,o),v(a,"bpmn:BoundaryEvent")&&c===a.host&&fD(t)):tx(i,"bpmn:MessageFlow")?(v(r,"bpmn:Event")&&(n.connectionStart=Zn(r)),v(o,"bpmn:Event")&&ex(t,Zn(o))):n.connectionStart=n.initialConnectionStart)})}Jb.$inject=["eventBus"];function lD(e,t,n){Qb.forEach(function(i){var r=nx(i,t);e[i]<t[i]+n?Dt(e,i,t[i]+n):e[i]>t[i]+r-n&&Dt(e,i,t[i]+r-n)})}function pD(e,t){var n=Zn(t);Qb.forEach(function(i){mD(e,t,i)&&Dt(e,i,n[i])})}function fD(e){var t=e.context,n=t.source,i=t.target;if(!gD(t)){var r=Zn(n),o=Zt(r,i,-10),a=[];/top|bottom/.test(o)&&a.push("x"),/left|right/.test(o)&&a.push("y"),a.forEach(function(c){var s=e[c],u;uD(s-r[c])<Of&&(s>r[c]?u=r[c]+Of:u=r[c]-Of,Dt(e,c,u))})}}function ex(e,t){Dt(e,"x",t.x),Dt(e,"y",t.y)}function tx(e,t){return e&&e.type===t}function dD(e,t){return Vi(t,function(n){return tx(e,n)})}function nx(e,t){return e==="x"?t.width:t.height}function hD(e){return v(e,"bpmn:Task")?cD:sD}function mD(e,t,n){return e[n]>t[n]+Zb&&e[n]<t[n]+nx(n,t)-Zb}function gD(e){var t=e.hover,n=e.source;return t&&n&&t===n}function xr(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}xr.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},xr.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},xr.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},xr.prototype.getSnapLocations=function(){return this._snapLocations},xr.prototype.setSnapLocations=function(e){this._snapLocations=e},xr.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new yu,n.initDefaults(this._defaultSnaps)),n};function yu(){this._snapValues={}}yu.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)},yu.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&r2(e[n],r[n],i)},yu.prototype.initDefaults=function(e){var t=this;M(e||{},function(n,i){M(n,function(r){t.add(i,r)})})};var yD=1250;function bi(e,t,n){var i=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],function(r){i.initSnap(r)}),t.on(["create.move","create.end","shape.move.move","shape.move.end"],yD,function(r){var o=r.context,a=o.shape,c=o.snapContext,s=o.target;if(!(r.originalEvent&&An(r.originalEvent))&&!(Oo(r)||!s)){var u=c.pointsForTarget(s);u.initialized||(u=i.addSnapTargetPoints(u,a,s),u.initialized=!0),n.snap(r,u)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){n.hide()})}bi.$inject=["elementRegistry","eventBus","snapping"],bi.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new xr);var o;t.get(i.id)?o=Zn(i,e):o={x:e.x+Zn(i).x,y:e.y+Zn(i).y};var a={x:o.x-i.width/2,y:o.y-i.height/2},c={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}),Me(i)||(r.setSnapOrigin("top-left",{x:a.x-e.x,y:a.y-e.y}),r.setSnapOrigin("bottom-right",{x:c.x-e.x,y:c.y-e.y})),r},bi.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return M(i,function(r){if(Me(r)){Me(t)&&e.add("mid",Zn(r));return}if(it(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);M(o,function(a){e.add("mid",a)});return}e.add("mid",Zn(r))}),!we(t.x)||!we(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Zn(t)),e},bi.prototype.getSnapTargets=function(e,t){return z_(t).filter(function(n){return!vD(n)})};function vD(e){return!!e.hidden}var ix=1500;function No(e,t){t.invoke(bi,this),e.on(["create.move","create.end"],ix,wD),e.on(["create.move","create.end","shape.move.move","shape.move.end"],ix,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!Oo(n)&&_D(n,o)})}ie(No,bi),No.$inject=["eventBus","injector"],No.prototype.initSnap=function(e){var t=bi.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return M(n.outgoing,function(r){var o=r.waypoints[0];o=o.original||o,t.setSnapOrigin(r.id+"-docking",ox(o,i,e))}),M(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",ox(o,i,e))}),v(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},No.prototype.addSnapTargetPoints=function(e,t,n){bi.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);M(i,function(o){(xD(o)||bD([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",F_(o)),e.add("bottom-right",H_(o)))});var r=this._elementRegistry;return M(t.incoming,function(o){if(r.get(t.id)){rx(i,o.source)||e.add("mid",be(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),M(t.outgoing,function(o){if(r.get(t.id)){rx(i,o.target)||e.add("mid",be(o.target));var a=o.waypoints[o.waypoints.length-1];e.add(o.id+"-docking",a.original||a)}}),v(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},No.prototype.getSnapTargets=function(e,t){return bi.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!v(n,"bpmn:Lane")})};function _D(e,t){var n=ye(t),i=bg(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=be(o),/top/.test(i)?Dt(e,"y",n.top-a.y):/bottom/.test(i)&&Dt(e,"y",n.bottom-a.y),/left/.test(i)?Dt(e,"x",n.left-a.x):/right/.test(i)&&Dt(e,"x",n.right-a.x)}function bD(e,t){return e.every(function(n){return v(n,t)})}function xD(e){return v(e,"bpmn:SubProcess")&&$e(e)?!0:v(e,"bpmn:Participant")}function wD(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)&&Dt(e,"x",e.x),(i&&i>=e.y||o&&o<=e.y)&&Dt(e,"y",e.y)}}function rx(e,t){return e.indexOf(t)!==-1}function ox(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var ED=1250;function Ua(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],ED,function(i){var r=i.context,o=r.shape,a=o.parent,c=r.direction,s=r.snapContext;if(!(i.originalEvent&&An(i.originalEvent))&&!Oo(i)){var u=s.pointsForTarget(a);u.initialized||(u=n.addSnapTargetPoints(u,o,a,c),u.initialized=!0),CD(c)&&Dt(i,"x",i.x),PD(c)&&Dt(i,"y",i.y),t.snap(i,u)}}),e.on(["resize.cleanup"],function(){t.hide()})}Ua.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new xr);var o=ax(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},Ua.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return M(r,function(o){e.add("corner",H_(o)),e.add("corner",F_(o))}),e.add("corner",ax(t,i)),e},Ua.$inject=["eventBus","snapping"],Ua.prototype.getSnapTargets=function(e,t){return z_(t).filter(function(n){return!SD(n,e)&&!it(n)&&!RD(n)&&!Me(n)})};function ax(e,t){var n=be(e),i=ye(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 SD(e,t){return e.host===t}function RD(e){return!!e.hidden}function CD(e){return e==="n"||e==="s"}function PD(e){return e==="e"||e==="w"}var AD=7,TD=1e3;function wr(e){this._canvas=e,this._asyncHide=Ru(vn(this.hide,this),TD)}wr.$inject=["canvas"],wr.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:Oo(e,"x"),y:Oo(e,"y")};M(r,function(a){var c=i.getSnapOrigin(a),s={x:e.x+c.x,y:e.y+c.y};if(M(["x","y"],function(u){var l;o[u]||(l=t.snap(s,a,u,AD),l!==void 0&&(o[u]={value:l,originValue:l-c[u]}))}),o.x&&o.y)return!1}),this.showSnapLine("vertical",o.x&&o.x.value),this.showSnapLine("horizontal",o.y&&o.y.value),M(["x","y"],function(a){var c=o[a];Gt(c)&&Dt(e,a,c.originValue)})},wr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=me("path");return re(n,{d:"M0,0 L0,0"}),Fe(n).add("djs-snap-line"),Re(t,n),{update:function(i){we(i)?e==="horizontal"?re(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):re(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):re(n,{display:"none"})}}},wr.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},wr.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},wr.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},wr.prototype.hide=function(){M(this._snapLines,function(e){e.update()})};const MD={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",bi],resizeSnapping:["type",Ua],snapping:["type",wr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",Jb],createMoveSnapping:["type",No]};var sx=300;function Ce(e,t,n,i){this._open=!1,this._results={},this._eventMaps=[],this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._canvas=e,this._eventBus=t,this._selection=n,this._translate=i,this._container=this._getBoxHtml(),this._searchInput=et(Ce.INPUT_SELECTOR,this._container),this._resultsContainer=et(Ce.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}Ce.$inject=["canvas","eventBus","selection","translate"],Ce.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,Ce.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,Ce.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,Ce.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,Ce.INPUT_SELECTOR,"keydown",function(n){Ht("ArrowUp",n)&&n.preventDefault(),Ht("ArrowDown",n)&&n.preventDefault()}),t(this._container,Ce.INPUT_SELECTOR,"keyup",function(n){if(Ht("Escape",n))return e.close();if(Ht("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(Ht("ArrowUp",n))return e._scrollToDirection(!0);if(Ht("ArrowDown",n))return e._scrollToDirection();Ht(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},Ce.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){Rn.unbind(e.el,e.type,e.listener)})},Ce.prototype._search=function(e){var t=this;if(this._clearResults(),!!e.trim()){var n=this._searchProvider.find(e);if(n=n.filter(function(r){return!t._canvas.getRootElements().includes(r.element)}),!n.length){this._selection.select(null);return}n.forEach(function(r){var o=r.element.id,a=t._createResultNode(r,o);t._results[o]={element:r.element,node:a}});var i=et(Ce.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},Ce.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},Ce.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)}},Ce.prototype._clearResults=function(){ms(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},Ce.prototype._getCurrentResult=function(){return et(Ce.RESULT_SELECTED_SELECTOR,this._resultsContainer)},Ce.prototype._createResultNode=function(e,t){var n=ut(Ce.RESULT_HTML);return e.primaryTokens.length>0&&cx(n,e.primaryTokens,Ce.RESULT_PRIMARY_HTML),cx(n,e.secondaryTokens,Ce.RESULT_SECONDARY_HTML),an(n,Ce.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},Ce.prototype.registerProvider=function(e){this._searchProvider=e},Ce.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,ht(this._canvas.getContainer()).add("djs-search-open"),ht(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},Ce.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,ht(this._canvas.getContainer()).remove("djs-search-open"),ht(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},Ce.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Ce.prototype.isOpen=function(){return this._open},Ce.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&ht(t).remove(Ce.RESULT_SELECTED_CLASS);var n=an(e,Ce.RESULT_ID_ATTRIBUTE),i=this._results[n].element;ht(e).add(Ce.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:sx}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},Ce.prototype._select=function(e){var t=an(e,Ce.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:sx}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},Ce.prototype._getBoxHtml=function(){const e=ut(Ce.BOX_HTML),t=et(Ce.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function cx(e,t,n){var i=kD(t),r=ut(n);r.innerHTML=i,e.appendChild(r)}function kD(e){var t="";return e.forEach(function(n){var i=gv(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+Ce.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}Ce.CONTAINER_SELECTOR=".djs-search-container",Ce.INPUT_SELECTOR=".djs-search-input input",Ce.RESULTS_CONTAINER_SELECTOR=".djs-search-results",Ce.RESULT_SELECTOR=".djs-search-result",Ce.RESULT_SELECTED_CLASS="djs-search-result-selected",Ce.RESULT_SELECTED_SELECTOR="."+Ce.RESULT_SELECTED_CLASS,Ce.RESULT_ID_ATTRIBUTE="data-result-id",Ce.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",Ce.BOX_HTML=`<div class="djs-search-container djs-scrollable">
335
+ </svg>`},V2=900;function za(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",V2,this)}za.$inject=["popupMenu","distributeElements","translate","rules"],za.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&O(t,this._getEntries(e)),t},za.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},za.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:sb.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:sb.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const G2={__depends__:[df,z2],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",ou],distributeElementsMenuProvider:["type",za]};var cb="is not a registered action",W2="is already registered";function Jn(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}Jn.$inject=["eventBus","injector"],Jn.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),i=e.get("selection",!1),r=e.get("zoomScroll",!1),o=e.get("copyPaste",!1),a=e.get("canvas",!1),s=e.get("rules",!1),c=e.get("keyboardMove",!1),u=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),o&&i&&this.register("copy",function(){var l=i.get();if(l.length)return o.copy(l)}),o&&i&&this.register("duplicate",function(){var l=i.get();if(l.length)return o.duplicate(l)}),o&&this.register("paste",function(){o.paste()}),o&&i&&s&&this.register("cut",function(){var l=i.get();if(l.length){var p=s.allowed("elements.delete",{elements:l});if(p!==!1){var f=_e(p)?p:l;return o.cut(f.slice())}}}),r&&this.register("stepZoom",function(l){r.stepZoom(l.value)}),a&&this.register("zoom",function(l){a.zoom(l.value)}),n&&i&&s&&this.register("removeSelection",function(){var l=i.get();if(l.length){var p=s.allowed("elements.delete",{elements:l}),f;p!==!1&&(_e(p)?f=p:f=l,f.length&&n.removeElements(f.slice()))}}),c&&this.register("moveCanvas",function(l){c.moveCanvas(l)}),u&&this.register("moveSelection",function(l){u.moveSelection(l.direction,l.accelerated)})},Jn.prototype.trigger=function(e,t){if(!this._actions[e])throw Ef(e,cb);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},Jn.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);M(e,function(i,r){n._registerAction(r,i)})},Jn.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Ef(e,W2);this._actions[e]=t},Jn.prototype.unregister=function(e){if(!this.isRegistered(e))throw Ef(e,cb);this._actions[e]=void 0},Jn.prototype.getActions=function(){return Object.keys(this._actions)},Jn.prototype.isRegistered=function(e){return!!this._actions[e]};function Ef(e,t){return new Error(e+" "+t)}const U2={__init__:["editorActions"],editorActions:["type",Jn]};function au(e){e.invoke(Jn,this)}ie(au,Jn),au.$inject=["injector"],au.prototype._registerDefaultActions=function(e){Jn.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),i=e.get("selection",!1),r=e.get("spaceTool",!1),o=e.get("lassoTool",!1),a=e.get("handTool",!1),s=e.get("globalConnect",!1),c=e.get("distributeElements",!1),u=e.get("alignElements",!1),l=e.get("directEditing",!1),p=e.get("searchPad",!1),f=e.get("modeling",!1),d=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",function(){var h=t.getRootElement(),m=n.filter(function(g){return g!==h});return i.select(m),m}),r&&this._registerAction("spaceTool",function(){r.toggle()}),o&&this._registerAction("lassoTool",function(){o.toggle()}),a&&this._registerAction("handTool",function(){a.toggle()}),s&&this._registerAction("globalConnectTool",function(){s.toggle()}),i&&c&&this._registerAction("distributeElements",function(h){var m=i.get(),g=h.type;m.length&&c.trigger(m,g)}),i&&u&&this._registerAction("alignElements",function(h){var m=i.get(),g=[],R=h.type;m.length&&(g=Oe(m,function(w){return!v(w,"bpmn:Lane")}),u.trigger(g,R))}),i&&f&&this._registerAction("setColor",function(h){var m=i.get();m.length&&f.setColor(m,h)}),i&&l&&this._registerAction("directEditing",function(){var h=i.get();h.length&&l.activate(h[0])}),p&&this._registerAction("find",function(){p.toggle()}),t&&f&&this._registerAction("moveToOrigin",function(){var h=t.getRootElement(),m,g;v(h,"bpmn:Collaboration")?g=n.filter(function(R){return v(R.parent,"bpmn:Collaboration")}):g=n.filter(function(R){return R!==h&&!v(R.parent,"bpmn:SubProcess")}),m=At(g),f.moveElements(g,{x:-m.x,y:-m.y},h)}),i&&d&&this._registerAction("replaceElement",function(h){d.triggerEntry("replace","click",h)})};const Y2={__depends__:[U2],editorActions:["type",au]};function ub(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;De(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}ub.$inject=["eventBus"];function Yr(e,t){X.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;wn(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}Yr.$inject=["eventBus","gridSnapping","modeling"],ie(Yr,X),Yr.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},Yr.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},Yr.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),O(e,o),e},Yr.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),O(e,o),e};var q2=2e3;function lb(e,t){e.on(["spaceTool.move","spaceTool.end"],q2,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)}})}lb.$inject=["eventBus","gridSnapping"];const K2={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Yr],gridSnappingSpaceToolBehavior:["type",lb]};var su=10;function Sf(e,t,n){return n||(n="round"),Math[n](e/t)*t}var X2=1200,Z2=800;function yr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",Z2,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"],X2,function(o){var a=o.originalEvent;if(!(!r.active||a&&Tn(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(u){var l={},p=J2(o,u,e);p&&(l.offset=p);var f=Q2(o,u);f&&O(l,f),Io(o,u)||r.snapEvent(o,u,l)})}})}yr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);Dt(e,t,i)},yr.prototype.getGridSpacing=function(){return su},yr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=Sf(e,su);var i,r;return t&&t.min&&(i=t.min,we(i)&&(i=Sf(i+n,su,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,we(r)&&(r=Sf(r+n,su,"floor"),e=Math.min(e,r))),e-=n,e},yr.prototype.isActive=function(){return this.active},yr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},yr.prototype.toggleActive=function(){this.setActive(!this.active)},yr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function Q2(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&&(cu(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&&(cu(t)?fb(s)?a.x.max=c.left:a.x.min=c.right:pb(s)?a.y.max=c.top:a.y.min=c.bottom),u&&(cu(t)?fb(s)?a.x.min=u.left:a.x.max=u.right:pb(s)?a.y.min=u.top:a.y.max=u.bottom),a[t]}function J2(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&we(s[t])||(s||(s=o.snapOffset={}),we(s[t])||(s[t]=0),!r)||(n.get(r.id)||(cu(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 cu(e){return e==="x"}function pb(e){return e.indexOf("n")!==-1}function fb(e){return e.indexOf("w")!==-1}const ek={__depends__:[K2],__init__:["gridSnapping"],gridSnapping:["type",yr]};var tk=2e3;function db(e,t,n){e.on("autoPlace",tk,function(i){var r=i.source,o=be(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],v(a,"bpmn:TextAnnotation")&&(nk(c)?u.offset=-a.width/2:u.offset=-a.height/2),s[c]=t.snapValue(s[c],u))}),s})}db.$inject=["eventBus","gridSnapping","elementRegistry"];function nk(e){return e==="x"}var ik=1750;function hb(e,t,n){t.on(["create.start","shape.move.start"],ik,function(i){var r=i.context,o=r.shape,a=e.getRootElement();if(!(!v(o,"bpmn:Participant")||!v(a,"bpmn:Process")||!a.children.length)){var s=r.createConstraints;s&&(o.width=n.snapValue(o.width,{min:o.width}),o.height=n.snapValue(o.height,{min:o.height}))}})}hb.$inject=["canvas","eventBus","gridSnapping"];var rk=3e3;function uu(e,t,n){X.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],rk,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||ok(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}uu.$inject=["eventBus","gridSnapping","modeling"],ie(uu,X),uu.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=ck(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function ok(e){return e.length>3}function ak(e){return e==="h"}function sk(e){return e==="v"}function ck(e,t,n){var i=Ai(t,n),r={};return ak(i)&&(r.y=e.snapValue(t.y)),sk(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=O({},t,r),n=O({},n,r)),[t,n]}const uk={__depends__:[ek,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",db],gridSnappingParticipantBehavior:["type",hb],gridSnappingLayoutConnectionBehavior:["type",uu]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",ub]};var lk=30,mb=30;function Va(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var r=i.element,o=i.gfx;if(v(r,"bpmn:Lane"))return n._createParticipantHit(r,o);if(v(r,"bpmn:Participant"))return $e(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(v(r,"bpmn:SubProcess"))return $e(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}Va.$inject=["eventBus","interactionEvents"],Va.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Va.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:lk,height:e.height}:{width:e.width,height:mb};return this._interactionEvents.createBoxHit(t,"all",n),!0},Va.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:mb}),!0};const pk={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Va]};function lu(e){e.invoke(Ao,this)}ie(lu,Ao),lu.$inject=["injector"],lu.prototype.registerBindings=function(e,t){Ao.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 fk={__depends__:[Zp],__init__:["keyboardBindings"],keyboardBindings:["type",lu]};var dk={moveSpeed:1,moveSpeedAccelerated:10},hk=1500,gb="left",yb="up",vb="right",_b="down",mk={ArrowLeft:gb,Left:gb,ArrowUp:yb,Up:yb,ArrowRight:vb,Right:vb,ArrowDown:_b,Down:_b},gk={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 bb(e,t,n,i,r){var o=this;this._config=O({},dk,e||{}),t.addListener(hk,function(a){var s=a.keyEvent,c=mk[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=gk[a](u),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,l)}}}bb.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const yk={__depends__:[Zp,qn],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",bb]};var xb=10;function Ga(e,t,n,i){this._dragging=i,this._rules=t;var r=this;function o(c,u){var l=c.shape,p=c.direction,f=c.resizeConstraints,d;c.delta=u,d=dR(l,p,u),c.newBounds=mR(d,f),c.canExecute=r.canResize(c)}function a(c){var u=c.resizeConstraints,l=c.minBounds;u===void 0&&(l===void 0&&(l=r.computeMinResizeBox(c)),c.resizeConstraints={min:ye(l)})}function s(c){var u=c.shape,l=c.canExecute,p=c.newBounds;if(l){if(p=$h(p),!vk(u,p))return;n.resizeShape(u,p)}}e.on("resize.start",function(c){a(c.context)}),e.on("resize.move",function(c){var u={x:c.dx,y:c.dy};o(c.context,u)}),e.on("resize.end",function(c){s(c.context)})}Ga.prototype.canResize=function(e){var t=this._rules,n=ni(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Ga.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=O({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,wb(t,o),"resize",{autoActivate:!0,cursor:_k(o),data:{shape:t,context:r}})},Ga.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:xb,height:xb},r=Rm(t,e.childrenBoxPadding),gR(n,t,i,r)},Ga.$inject=["eventBus","rules","modeling","dragging"];function vk(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function wb(e,t){var n=be(e),i=ye(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 _k(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 Eb="djs-resizing",Sb="resize-not-ok",bk=500;function Rb(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,Eb)),s.width>5&&re(c,{x:s.x,width:s.width}),s.height>5&&re(c,{y:s.y,height:s.height}),o.canExecute?je(c).remove(Sb):je(c).add(Sb)}function r(o){var a=o.shape,s=o.frame;s&&Ft(o.frame),t.removeMarker(a,Eb)}e.on("resize.move",bk,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}Rb.$inject=["eventBus","canvas","previewSupport"];var pu=-6,fu=8,du=20,Wa="djs-resizer",xk=["n","w","s","e","nw","ne","se","sw"];function vr(e,t,n,i){this._resize=i,this._canvas=t;var r=this;e.on("selection.changed",function(o){var a=o.newSelection;r.removeResizers(),a.length===1&&M(a,vn(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}vr.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){ar(o)&&i.activate(o,e,n)}Se.bind(t,"mousedown",r),Se.bind(t,"touchstart",r)},vr.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=wk(i),a=me("g");je(a).add(Wa),je(a).add(Wa+"-"+e.id),je(a).add(Wa+"-"+i),Re(r,a);var s=me("rect");re(s,{x:-fu/2+o.x,y:-fu/2+o.y,width:fu,height:fu}),je(s).add(Wa+"-visual"),Re(a,s);var c=me("rect");return re(c,{x:-du/2+o.x,y:-du/2+o.y,width:du,height:du}),je(c).add(Wa+"-hit"),Re(a,c),Ps(a,t,n),a},vr.prototype.createResizer=function(e,t){var n=wb(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},vr.prototype.addResizer=function(e){var t=this;it(e)||M(xk,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},vr.prototype.removeResizers=function(){var e=this._getResizersParent();vs(e)},vr.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},vr.$inject=["eventBus","canvas","selection","resize"];function wk(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-pu:e.indexOf("w")!==-1&&(t.x=pu),e.indexOf("s")!==-1?t.y=-pu:e.indexOf("n")!==-1&&(t.y=pu),t}const Cb={__depends__:[gi,Li,Ro],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Ga],resizePreview:["type",Rb],resizeHandles:["type",vr]};var Ek=2e3;function Ua(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"],Ek,function(c){i.isActive(c.element)&&i.cancel()}),e.on(["commandStack.changed"],function(c){i.isActive()&&i.cancel()}),e.on("directEditing.activate",function(c){o.removeResizers()}),e.on("create.end",500,function(c){var u=c.context,l=u.shape,p=c.context.canExecute,f=c.isTouch;f||p&&(u.hints&&u.hints.createElementsBehavior===!1||s(l))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,u){(u||De(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}Ua.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Ua.prototype.activate=function(e){var t=jn(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);O(n,i);var r={},o=n.style||{};return O(o,{backgroundColor:null,border:null}),(De(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||Pb(e))&&O(r,{centerVertically:!0}),nr(e)&&(O(r,{resizable:!0,autoResize:!0}),O(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),v(e,"bpmn:TextAnnotation")&&(O(r,{resizable:!0,autoResize:!0}),O(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),O(n,{options:r,style:o}),n}},Ua.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),r={x:i.x+i.width/2,y:i.y+i.height/2},o={x:i.x,y:i.y},a=t.zoom(),s=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),u=c.fontSize*a,l=c.lineHeight,p=s.fontSize*a,f=s.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(v(e,"bpmn:Lane")||Ck(e)){var h=Yt(e),m=h?{width:i.height,height:30*a,x:i.x-i.height/2+15*a,y:r.y-30*a/2}:{width:i.width,height:30*a};O(o,m),O(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:h?"rotate(-90deg)":null})}if(Rk(e)){var g=Yt(e),R=g?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:r.x-i.height/2,y:r.y-i.width/2};O(o,R),O(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:g?null:"rotate(-90deg)"})}(De(e,["bpmn:Task","bpmn:CallActivity"])||Pb(e))&&(O(o,{width:i.width,height:i.height}),O(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),Sk(e)&&(O(o,{width:i.width,x:i.x}),O(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var w=1,b=i.width+2*w;if(n.labelTarget&&(O(o,{width:b,height:i.height+2*w,x:i.x-w,y:i.y-w}),O(d,{fontSize:u+"px",lineHeight:l})),nr(n)&&!Ms(n)&&!Me(n)){var x=pl(e),E=t.getAbsoluteBBox({x:x.x,y:x.y,width:0,height:0}),T=u,L=Ir.width*a+2*w;O(o,{width:L,height:T+2*w,x:E.x-L/2,y:E.y-T/2-w}),O(d,{fontSize:u+"px",lineHeight:l})}return v(e,"bpmn:TextAnnotation")&&(O(o,{width:i.width+2*w,height:i.height+2*w,x:i.x-w,y:i.y-w,minWidth:30*a,minHeight:10*a}),O(d,{textAlign:"left",paddingTop:po*a+"px",paddingBottom:po*a+"px",paddingLeft:po*a+"px",paddingRight:po*a+"px",fontSize:p+"px",lineHeight:f})),{bounds:o,style:d}},Ua.prototype.update=function(e,t,n,i){var r,o;v(e,"bpmn:TextAnnotation")&&(o=this._canvas.getAbsoluteBBox(e),r={x:e.x,y:e.y,width:e.width/o.width*i.width,height:e.height/o.height*i.height}),Pk(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function Pb(e){return v(e,"bpmn:SubProcess")&&!$e(e)}function Sk(e){return v(e,"bpmn:SubProcess")&&$e(e)}function Rk(e){return v(e,"bpmn:Participant")&&!$e(e)}function Ck(e){return v(e,"bpmn:Participant")&&$e(e)}function Pk(e){return!e||!e.trim()}var Ab="djs-element-hidden",Tb="djs-label-hidden";function Mb(e,t,n){var i=this,r=t.getDefaultLayer(),o,a,s;e.on("directEditing.activate",function(c){var u=c.active;if(o=u.element.label||u.element,v(o,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(o),s=me("g");var l=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:o.height,position:{mx:0,my:0}}),p=i.path=me("path");re(p,{d:l,strokeWidth:2,stroke:Ak(o)}),Re(s,p),Re(r,s),Qt(s,o.x,o.y)}v(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,Ab):(v(o,"bpmn:Task")||v(o,"bpmn:CallActivity")||v(o,"bpmn:SubProcess")||v(o,"bpmn:Participant")||v(o,"bpmn:Lane"))&&t.addMarker(o,Tb)}),e.on("directEditing.resize",function(c){if(v(o,"bpmn:TextAnnotation")){var u=c.height,l=c.dy,p=Math.max(o.height/a.height*(u+l),0),f=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:p,position:{mx:0,my:0}});re(i.path,{d:f})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var u=c.active;u&&(t.removeMarker(u.element.label||u.element,Ab),t.removeMarker(o,Tb)),o=void 0,a=void 0,s&&(Ft(s),s=void 0)})}Mb.$inject=["eventBus","canvas","pathMap"];function Ak(e,t){var n=Ve(e);return n.get("stroke")||t||"black"}const Tk={__depends__:[Tp,Cb,tb],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Ua],labelEditingPreview:["type",Mb]};var Mk=500,kk=1e3;function _i(e,t,n){this._eventBus=e,this._elementRegistry=n,this._outlineOffset=5,this._outlineStyle=t.cls("djs-outline",["no-fill"]);var i=this;function r(o){m1(o)||i.createOutline(o)}e.on("element.hover",function(o){r(o.element)}),e.on("selection.changed",function(o){M(o.newSelection,r)}),e.on(["shape.changed","connection.changed"],Mk,function(o){var a=o.element,s=o.gfx,c=et(".djs-outline",s);c&&i.updateOutline(a,c)})}_i.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=et(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),Re(t,n),this.updateOutline(e,n)),n},_i.prototype._createOutlineGfx=function(){var e=me("rect");return re(e,O({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},_i.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},_i.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&M(i,function(r){n=n||r.updateOutline(t,e)}),n||re(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},_i.prototype.updateConnectionOutline=function(e,t){var n=At(t);re(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},_i.prototype.registerProvider=function(e,t){t||(t=e,e=kk),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},_i.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},_i.prototype.getOutline=function(e){var t,n=this._getProviders();return M(n,function(i){Wt(i.getOutline)&&(t=t||i.getOutline(e))}),t},_i.$inject=["eventBus","styles","elementRegistry"];var hu=6;function Rf(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)})}Rf.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");vs(t);var n=e.length>1,i=this._canvas.getContainer();if(je(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=Dk(At(e)),o=me("rect");re(o,O({rx:3},r)),je(o).add("djs-selection-outline"),Re(t,o)}},Rf.$inject=["eventBus","canvas","selection"];function Dk(e){return{x:e.x-hu,y:e.y-hu,width:e.width+hu*2,height:e.height+hu*2}}const Cf={__depends__:[qn],__init__:["outline","multiSelectionOutline"],outline:["type",_i],multiSelectionOutline:["type",Rf]},kb=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],Db={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},Ok=15,mu=2;function Ob(e,t,n,i,r){const o=t.getLayer("overlays");e.on(["selection.changed","shape.changed"],function(){s()}),e.on("selection.changed",function({newSelection:p}){var d;const f=p.filter(h=>De(h,kb));if(f.length===1){const h=f[0];Me(h)?a(h,h.labelTarget):(d=h.labels)!=null&&d.length&&a(h.labels[0],h)}if(f.length===2){const h=f.find(Me),m=f.find(g=>{var R;return(R=g.labels)==null?void 0:R.includes(h)});h&&m&&a(h,m)}}),e.on("shape.changed",function({element:p}){var f;!De(p,kb)||!l(p)||(Me(p)?a(p,p.labelTarget):(f=p.labels)!=null&&f.length&&a(p.labels[0],p))});function a(p,f){const d=Ko([be(f),be(p)],Db),h=d.getAttribute("d"),g=r.isSelected(p)?c(p):u(p),R=Jo(g,h);if(!R)return;const b=r.isSelected(f)?c(f):u(f),x=Jo(b,h)||be(f);ua(x,R)<Ok||(il(d,[x,R]),Re(o,d))}function s(){ys(`.${Db.class}`,o).forEach(Ft)}function c(p){const f=i.getOutline(p);if(!f)return u(p);if(f.x){const d={x:p.x+_r(f,"x")-mu,y:p.y+_r(f,"y")-mu,width:_r(f,"width")+mu*2,height:_r(f,"height")+mu*2};return dl(d,_r(f,"rx"))}if(f.cx){const d=_r(f,"r"),h={x:p.x+_r(f,"cx")-d,y:p.y+_r(f,"cy")-d,width:d*2,height:d*2};return cm(h)}}function u(p){return n.getShapePath(p)}function l(p){return r.isSelected(p)}}Ob.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function _r(e,t){return parseFloat(re(e,t)||0)}const Lk={__depends__:[qn,Cf],__init__:["labelLink"],labelLink:["type",Ob]};var Ik=new So("tt");function Nk(e){var t=ut('<div class="djs-tooltip-container" />');return mn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function Bk(e,t,n){mn(e,{left:t+"px",top:n+"px"})}function Pf(e,t){e.style.display=t===!1?"none":""}var Lb="djs-tooltip",Af="."+Lb;function bn(e,t){this._eventBus=e,this._canvas=t,this._ids=Ik,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=Nk(t.getContainer());var n=this;Cn.bind(this._tooltipRoot,Af,"mousedown",function(i){i.stopPropagation()}),Cn.bind(this._tooltipRoot,Af,"mouseover",function(i){n.trigger("mouseover",i)}),Cn.bind(this._tooltipRoot,Af,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}bn.$inject=["eventBus","canvas"],bn.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=O({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},bn.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(an(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},bn.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},bn.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},bn.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)}},bn.prototype.remove=function(e){var t=this.get(e);t&&(li(t.html),li(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},bn.prototype.show=function(){Pf(this._tooltipRoot)},bn.prototype.hide=function(){Pf(this._tooltipRoot,!1)},bn.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},bn.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)),wn(n)&&(n=ut(n)),i=ut('<div data-tooltip-id="'+t+'" class="'+Lb+'">'),mn(i,{position:"absolute"}),i.appendChild(n),e.type&&mt(i).add("djs-tooltip-"+e.type),e.className&&mt(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},bn.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;Bk(n,t.x,t.y)},bn.prototype._updateTooltipVisibilty=function(e){M(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),Pf(i,r))})},bn.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 $k={__init__:["tooltips"],tooltips:["type",bn]};var jk="flow elements must be children of pools/participants",Fk="Data object must be placed within a pool/participant.";function Ib(e,t,n){function i(r,o,a){t.add({position:{x:r.x+5,y:r.y+5},type:"error",timeout:2e3,html:"<div>"+o+"</div>"})}e.on(["shape.move.rejected","create.rejected"],function(r){var o=r.context,a=o.shape,s=o.target;v(s,"bpmn:Collaboration")&&(v(a,"bpmn:FlowNode")?i(r,n(jk)):v(a,"bpmn:DataObjectReference")&&i(r,n(Fk)))})}Ib.$inject=["eventBus","tooltips","translate"];const Hk={__depends__:[$k],__init__:["modelingFeedback"],modelingFeedback:["type",Ib]};var zk=500,Vk=1250,Gk=1500,gu=Math.round;function Wk(e){return{x:e.x+gu(e.width/2),y:e.y+gu(e.height/2)}}function Nb(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",Gk,function(s){var c=s.context,u=s.shape,l=i.get().slice();l.indexOf(u)===-1&&(l=[u]),l=Uk(l),O(c,{shapes:l,validatedShapes:l,shape:u})}),e.on("shape.move.start",Vk,function(s){var c=s.context,u=c.validatedShapes,l;if(l=c.canExecute=o(u),!l)return!1}),e.on("shape.move.move",zk,function(s){var c=s.context,u=c.validatedShapes,l=s.hover,p={x:s.dx,y:s.dy},f={x:s.x,y:s.y},d;if(d=o(u,p,f,l),c.delta=p,c.canExecute=d,d===null){c.target=null;return}c.target=l}),e.on("shape.move.end",function(s){var c=s.context,u=c.delta,l=c.canExecute,p=l==="attach",f=c.shapes;if(l===!1)return!1;u.x=gu(u.x),u.y=gu(u.y),!(u.x===0&&u.y===0)&&n.moveElements(f,u,c.target,{primaryShape:c.shape,attach:p})}),e.on("element.mousedown",function(s){if(ar(s)){var c=bo(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,u,l){if(Gt(u)&&(l=u,u=!1),!(c.waypoints||!c.parent)&&!je(s.target).has("djs-hit-no-move")){var p=Wk(c),f=t.init(s,p,"shape.move",{cursor:"grabbing",autoActivate:u,data:{shape:c,context:l||{}}});if(f!==!1)return!0}}this.start=a}Nb.$inject=["eventBus","dragging","modeling","selection","rules"];function Uk(e){var t=Qr(e,"id");return Oe(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var Bb=499,Tf="djs-dragging",$b="drop-ok",jb="drop-not-ok",Fb="new-parent",Hb="attach-ok";function zb(e,t,n,i){function r(c){var u=o(c),l=Yk(u);return l}function o(c){var u=Xo(c),l=u.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),p=u.concat(l),f=[...new Set(p)];return f}function a(c,u){[Hb,$b,jb,Fb].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,Tf),c.allDraggedElements?c.allDraggedElements.push(u):c.allDraggedElements=[u]}e.on("shape.move.start",Bb,function(c){var u=c.context,l=u.shapes,p=u.allDraggedElements,f=r(l);if(!u.dragGroup){var d=me("g");re(d,n.cls("djs-drag-group",["no-events"]));var h=t.getActiveLayer();Re(h,d),u.dragGroup=d}f.forEach(function(m){i.addDragger(m,u.dragGroup)}),p?p=Eu([p,o(l)]):p=o(l),M(p,function(m){t.addMarker(m,Tf)}),u.allDraggedElements=p,u.differentParents=qk(l)}),e.on("shape.move.move",Bb,function(c){var u=c.context,l=u.dragGroup,p=u.target,f=u.shape.parent,d=u.canExecute;p&&(d==="attach"?a(p,Hb):u.canExecute&&f&&p.id!==f.id?a(p,Fb):a(p,u.canExecute?$b:jb)),Qt(l,c.dx,c.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(c){var u=c.context,l=u.target;l&&a(l,null)}),e.on("shape.move.cleanup",function(c){var u=c.context,l=u.allDraggedElements,p=u.dragGroup;M(l,function(f){t.removeMarker(f,Tf)}),p&&Ft(p)}),this.makeDraggable=s}zb.$inject=["eventBus","canvas","styles","previewSupport"];function Yk(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=Oe(e,function(i){return it(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function qk(e){return qx(Qr(e,function(t){return t.parent&&t.parent.id}))!==1}const Kk={__depends__:[sc,qn,Cf,gi,Li,Ro],__init__:["move","movePreview"],move:["type",Nb],movePreview:["type",zb]};var Vb=".djs-palette-toggle",Gb=".entry",Xk=Vb+", "+Gb,Mf="djs-palette-",Zk="shown",kf="open",Wb="two-column",Qk=1e3;function Ot(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()})}Ot.$inject=["eventBus","canvas"],Ot.prototype.registerProvider=function(e,t){t||(t=e,e=Qk),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},Ot.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(eD,{})},Ot.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},Ot.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=ut(Ot.HTML_MARKUP);n.appendChild(i),mt(n).add(Mf+Zk),Cn.bind(i,Xk,"click",function(r){var o=r.delegateTarget;if(qu(o,Vb))return e.toggle();e.trigger("click",r)}),Se.bind(i,"mousedown",function(r){r.stopPropagation()}),Cn.bind(i,Gb,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},Ot.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},Ot.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,r,o=mt(n),a=mt(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(Wb,r),a.toggle(Mf+Wb,r),"open"in e&&(o.toggle(kf,e.open),a.toggle(Mf+kf,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},Ot.prototype._update=function(){var e=et(".djs-palette-entries",this._container),t=this._entries=this.getEntries();ms(e),M(t,function(n,i){var r=n.group||"default",o=et("[data-group="+ka(r)+"]",e);o||(o=ut('<div class="group"></div>'),an(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=ut(a);if(o.appendChild(s),!n.separator&&(an(s,"data-action",i),n.title&&an(s,"title",n.title),n.className&&Jk(s,n.className),n.imageUrl)){var c=ut("<img>");an(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},Ot.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=an(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},Ot.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(Wt(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},Ot.prototype._layoutChanged=function(){this._toggleState({})},Ot.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},Ot.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},Ot.prototype.open=function(){this._toggleState({open:!0})},Ot.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Ot.prototype.isActiveTool=function(e){return e&&this._activeTool===e},Ot.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=et(".djs-palette-entries",this._container),this._toolsContainer=et("[data-group=tools]",t)),n=this._toolsContainer,M(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=mt(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},Ot.prototype.isOpen=function(){return mt(this._container).has(kf)},Ot.prototype._getParentContainer=function(){return this._canvas.getContainer()},Ot.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function Jk(e,t){var n=mt(e),i=_e(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function eD(e,t){var n=t.getPaletteEntries();return Wt(n)?n(e):(M(n,function(i,r){e[r]=i}),e)}const tD={__init__:["palette"],palette:["type",Ot]};var Ub="crosshair",Yb="selected",nD="djs-dragging-active-lasso";function br(e,t,n,i,r,o,a){this._selection=r,this._dragging=n,this._mouse=a;var s=this,c={create:function(p){var f=t.getActiveLayer(),d=p.frame=me("rect");re(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),Re(f,d),u(!0),this.update(p)},update:function(p){var f=p.frame,d=p.bbox;f&&d&&re(f,{x:d.x,y:d.y,width:d.width,height:d.height});var h=p.marked,m=p.lastMarked;if(h&&m){for(const g of m)h.has(g)||t.removeMarker(g,Yb);for(const g of h)m.has(g)||t.addMarker(g,Yb)}},remove:function(p){this.update(p),p.frame&&Ft(p.frame),u(!1)}};function u(p){je(t.getContainer()).toggle(nD,p)}function l(p){var f=i.getAll();return new Set(Zr(ao(f,p)))}o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(p){var f=p.originalEvent.target;!p.hover&&!(f instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(p.originalEvent,!0)})}),e.on("lasso.end",0,function(p){var f=p.context;s._select(Array.from(f.marked))}),e.on("lasso.start",function(p){var f=p.context;f.bbox=qb(p),f.add=ec(p),f.lastMarked=new Set(r.get()),f.add?f.marked=f.lastMarked:f.marked=new Set,f.initialMarked=f.marked,c.create(f)}),e.on("lasso.move",function(p){var f=p.context,d=f.bbox=qb(p),h=l(d),m=f.initialMarked.union(h);f.lastMarked=f.marked,f.marked=m,c.update(f)}),e.on("lasso.cleanup",function(p){var f=p.context;f.lastMarked=f.marked,f.marked=new Set(r.get()),c.remove(p.context)}),e.on("element.mousedown",1500,function(p){if(ec(p))return s.activateLasso(p.originalEvent),!0})}br.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],br.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:Ub,data:{context:{}},keepSelection:!0})},br.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:Ub,data:{context:{}},keepSelection:!0})},br.prototype._select=function(e){this._selection.select(e)},br.prototype.select=function(e,t,n=[]){var i=Zr(ao(e,t));this._select([...n,...i])},br.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},br.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function qb(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 iD={__depends__:[pc,ma],__init__:["lassoTool"],lassoTool:["type",br]};var Df=1500,Kb="grab";function No(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",Df,function(c){if(fa(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(Df,function(c){if(!(!Xb(c.keyEvent)||a.isActive())){var u=a._mouse.getLastMoveEvent();a.activateMove(u,!!u)}},"keyboard.keydown"),s&&s.addListener(Df,function(c){!Xb(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!fa(c)&&l&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}No.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],No.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:Kb,data:{context:n||{}}})},No.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:Kb,data:{context:{reactivate:n}}})},No.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},No.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function Xb(e){return Ht("Space",e)}const rD={__depends__:[pc,ma],__init__:["handTool"],handTool:["type",No]};var Zb="connect-ok",Qb="connect-not-ok";function Bo(e,t,n,i,r,o,a){var s=this;this._dragging=t,this._rules=o,this._mouse=a,r.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",function(c){var u=c.context,l=c.hover,p=u.canStartConnect=s.canStartConnect(l);p!==null&&(u.startTarget=l,i.addMarker(l,p?Zb:Qb))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var u=c.context.startTarget,l=c.context.canStartConnect;u&&i.removeMarker(u,l?Zb:Qb)}),e.on(["global-connect.ended"],function(c){var u=c.context,l=u.startTarget,p={x:c.x,y:c.y},f=s.canStartConnect(l);if(f)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,l,p)}),!1})}Bo.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Bo.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Bo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Bo.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Bo.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const oD={__depends__:[xf,gi,Li,pc,ma],globalConnect:["type",Bo]};function Of(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)}Of.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],Of.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,i=this._spaceTool,r=this._lassoTool,o=this._handTool,a=this._globalConnect,s=this._translate;function c(p,f,d,h,m){function g(R){var w=n.createShape(O({type:p},m));t.start(R,w)}return{group:f,className:d,title:h,action:{dragstart:g,click:g}}}function u(p){var f=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),d=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:f});t.start(p,[f,d],{hints:{autoSelect:[f]}})}function l(p){t.start(p,n.createParticipantShape())}return O(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:s("Activate hand tool"),action:{click:function(p){o.activateHand(p)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:s("Activate lasso tool"),action:{click:function(p){r.activateSelection(p)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:s("Activate create/remove space tool"),action:{click:function(p){i.activateSelection(p)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:s("Activate global connect tool"),action:{click:function(p){a.start(p)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":c("bpmn:StartEvent","event","bpmn-icon-start-event-none",s("Create start event")),"create.intermediate-event":c("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",s("Create intermediate/boundary event")),"create.end-event":c("bpmn:EndEvent","event","bpmn-icon-end-event-none",s("Create end event")),"create.exclusive-gateway":c("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",s("Create gateway")),"create.task":c("bpmn:Task","activity","bpmn-icon-task",s("Create task")),"create.data-object":c("bpmn:DataObjectReference","data-object","bpmn-icon-data-object",s("Create data object reference")),"create.data-store":c("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",s("Create data store reference")),"create.subprocess-expanded":{group:"activity",className:"bpmn-icon-subprocess-expanded",title:s("Create expanded sub-process"),action:{dragstart:u,click:u}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:s("Create pool/participant"),action:{dragstart:l,click:l}},"create.group":c("bpmn:Group","artifact","bpmn-icon-group",s("Create group"))}),e};const aD={__depends__:[tD,uc,Cy,iD,rD,oD,oa],__init__:["paletteProvider"],paletteProvider:["type",Of]};var sD=250;function Lf(e,t,n,i,r){X.call(this,e);function o(s){var c=s.canExecute.replacements;M(c,function(u){var l=u.oldElementId,p={type:u.newElementType};if(!s.visualReplacements[l]){var f=t.get(l);O(p,{x:f.x,y:f.y});var d=n.createShape(p);i.addShape(d,f.parent);var h=et('[data-element-id="'+ka(f.id)+'"]',s.dragGroup);h&&re(h,{display:"none"});var m=r.addDragger(d,s.dragGroup);s.visualReplacements[l]=m,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;M(c,function(u,l){var p=et('[data-element-id="'+ka(l)+'"]',s.dragGroup);p&&re(p,{display:"inline"}),u.remove(),c[l]&&delete c[l]})}e.on("shape.move.move",sD,function(s){var c=s.context,u=c.canExecute;c.visualReplacements||(c.visualReplacements={}),u&&u.replacements?o(c):a(c)})}Lf.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],ie(Lf,X);const cD={__depends__:[Ro],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Lf]};var uD=1250,If=40,lD=20,pD=10,Jb=20,ex=["x","y"],fD=Math.abs;function tx(e){e.on(["connect.hover","connect.move","connect.end"],uD,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&Tn(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&dD(t,o,yD(o)),o&&gD(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Zn(r),De(o,["bpmn:Event","bpmn:Gateway"])&&nx(t,Zn(o)),De(o,["bpmn:Task","bpmn:SubProcess"])&&hD(t,o),v(a,"bpmn:BoundaryEvent")&&s===a.host&&mD(t)):ix(i,"bpmn:MessageFlow")?(v(r,"bpmn:Event")&&(n.connectionStart=Zn(r)),v(o,"bpmn:Event")&&nx(t,Zn(o))):n.connectionStart=n.initialConnectionStart)})}tx.$inject=["eventBus"];function dD(e,t,n){ex.forEach(function(i){var r=rx(i,t);e[i]<t[i]+n?Dt(e,i,t[i]+n):e[i]>t[i]+r-n&&Dt(e,i,t[i]+r-n)})}function hD(e,t){var n=Zn(t);ex.forEach(function(i){vD(e,t,i)&&Dt(e,i,n[i])})}function mD(e){var t=e.context,n=t.source,i=t.target;if(!_D(t)){var r=Zn(n),o=Zt(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;fD(c-r[s])<If&&(c>r[s]?u=r[s]+If:u=r[s]-If,Dt(e,s,u))})}}function nx(e,t){Dt(e,"x",t.x),Dt(e,"y",t.y)}function ix(e,t){return e&&e.type===t}function gD(e,t){return Vi(t,function(n){return ix(e,n)})}function rx(e,t){return e==="x"?t.width:t.height}function yD(e){return v(e,"bpmn:Task")?pD:lD}function vD(e,t,n){return e[n]>t[n]+Jb&&e[n]<t[n]+rx(n,t)-Jb}function _D(e){var t=e.hover,n=e.source;return t&&n&&t===n}function xr(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}xr.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},xr.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},xr.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},xr.prototype.getSnapLocations=function(){return this._snapLocations},xr.prototype.setSnapLocations=function(e){this._snapLocations=e},xr.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new yu,n.initDefaults(this._defaultSnaps)),n};function yu(){this._snapValues={}}yu.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)},yu.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&s2(e[n],r[n],i)},yu.prototype.initDefaults=function(e){var t=this;M(e||{},function(n,i){M(n,function(r){t.add(i,r)})})};var bD=1250;function bi(e,t,n){var i=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],function(r){i.initSnap(r)}),t.on(["create.move","create.end","shape.move.move","shape.move.end"],bD,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&Tn(r.originalEvent))&&!(Io(r)||!c)){var u=s.pointsForTarget(c);u.initialized||(u=i.addSnapTargetPoints(u,a,c),u.initialized=!0),n.snap(r,u)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){n.hide()})}bi.$inject=["elementRegistry","eventBus","snapping"],bi.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new xr);var o;t.get(i.id)?o=Zn(i,e):o={x:e.x+Zn(i).x,y:e.y+Zn(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}),Me(i)||(r.setSnapOrigin("top-left",{x:a.x-e.x,y:a.y-e.y}),r.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),r},bi.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return M(i,function(r){if(Me(r)){Me(t)&&e.add("mid",Zn(r));return}if(it(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);M(o,function(a){e.add("mid",a)});return}e.add("mid",Zn(r))}),!we(t.x)||!we(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Zn(t)),e},bi.prototype.getSnapTargets=function(e,t){return G_(t).filter(function(n){return!xD(n)})};function xD(e){return!!e.hidden}var ox=1500;function $o(e,t){t.invoke(bi,this),e.on(["create.move","create.end"],ox,RD),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&&!Io(n)&&wD(n,o)})}ie($o,bi),$o.$inject=["eventBus","injector"],$o.prototype.initSnap=function(e){var t=bi.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return M(n.outgoing,function(r){var o=r.waypoints[0];o=o.original||o,t.setSnapOrigin(r.id+"-docking",sx(o,i,e))}),M(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",sx(o,i,e))}),v(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},$o.prototype.addSnapTargetPoints=function(e,t,n){bi.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);M(i,function(o){(SD(o)||ED([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",z_(o)),e.add("bottom-right",V_(o)))});var r=this._elementRegistry;return M(t.incoming,function(o){if(r.get(t.id)){ax(i,o.source)||e.add("mid",be(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),M(t.outgoing,function(o){if(r.get(t.id)){ax(i,o.target)||e.add("mid",be(o.target));var a=o.waypoints[o.waypoints.length-1];e.add(o.id+"-docking",a.original||a)}}),v(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},$o.prototype.getSnapTargets=function(e,t){return bi.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!v(n,"bpmn:Lane")})};function wD(e,t){var n=ye(t),i=wg(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=be(o),/top/.test(i)?Dt(e,"y",n.top-a.y):/bottom/.test(i)&&Dt(e,"y",n.bottom-a.y),/left/.test(i)?Dt(e,"x",n.left-a.x):/right/.test(i)&&Dt(e,"x",n.right-a.x)}function ED(e,t){return e.every(function(n){return v(n,t)})}function SD(e){return v(e,"bpmn:SubProcess")&&$e(e)?!0:v(e,"bpmn:Participant")}function RD(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)&&Dt(e,"x",e.x),(i&&i>=e.y||o&&o<=e.y)&&Dt(e,"y",e.y)}}function ax(e,t){return e.indexOf(t)!==-1}function sx(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var CD=1250;function Ya(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],CD,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&Tn(i.originalEvent))&&!Io(i)){var u=c.pointsForTarget(a);u.initialized||(u=n.addSnapTargetPoints(u,o,a,s),u.initialized=!0),TD(s)&&Dt(i,"x",i.x),MD(s)&&Dt(i,"y",i.y),t.snap(i,u)}}),e.on(["resize.cleanup"],function(){t.hide()})}Ya.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new xr);var o=cx(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},Ya.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return M(r,function(o){e.add("corner",V_(o)),e.add("corner",z_(o))}),e.add("corner",cx(t,i)),e},Ya.$inject=["eventBus","snapping"],Ya.prototype.getSnapTargets=function(e,t){return G_(t).filter(function(n){return!PD(n,e)&&!it(n)&&!AD(n)&&!Me(n)})};function cx(e,t){var n=be(e),i=ye(e),r={x:n.x,y:n.y};return t.indexOf("n")!==-1?r.y=i.top:t.indexOf("s")!==-1&&(r.y=i.bottom),t.indexOf("e")!==-1?r.x=i.right:t.indexOf("w")!==-1&&(r.x=i.left),r}function PD(e,t){return e.host===t}function AD(e){return!!e.hidden}function TD(e){return e==="n"||e==="s"}function MD(e){return e==="e"||e==="w"}var kD=7,DD=1e3;function wr(e){this._canvas=e,this._asyncHide=Ru(vn(this.hide,this),DD)}wr.$inject=["canvas"],wr.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:Io(e,"x"),y:Io(e,"y")};M(r,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(M(["x","y"],function(u){var l;o[u]||(l=t.snap(c,a,u,kD),l!==void 0&&(o[u]={value:l,originValue:l-s[u]}))}),o.x&&o.y)return!1}),this.showSnapLine("vertical",o.x&&o.x.value),this.showSnapLine("horizontal",o.y&&o.y.value),M(["x","y"],function(a){var s=o[a];Gt(s)&&Dt(e,a,s.originValue)})},wr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=me("path");return re(n,{d:"M0,0 L0,0"}),je(n).add("djs-snap-line"),Re(t,n),{update:function(i){we(i)?e==="horizontal"?re(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):re(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):re(n,{display:"none"})}}},wr.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},wr.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},wr.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},wr.prototype.hide=function(){M(this._snapLines,function(e){e.update()})};const OD={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",bi],resizeSnapping:["type",Ya],snapping:["type",wr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",tx],createMoveSnapping:["type",$o]};var ux=300;function Ce(e,t,n,i){this._open=!1,this._results={},this._eventMaps=[],this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._canvas=e,this._eventBus=t,this._selection=n,this._translate=i,this._container=this._getBoxHtml(),this._searchInput=et(Ce.INPUT_SELECTOR,this._container),this._resultsContainer=et(Ce.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}Ce.$inject=["canvas","eventBus","selection","translate"],Ce.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:Cn.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,Ce.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,Ce.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,Ce.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,Ce.INPUT_SELECTOR,"keydown",function(n){Ht("ArrowUp",n)&&n.preventDefault(),Ht("ArrowDown",n)&&n.preventDefault()}),t(this._container,Ce.INPUT_SELECTOR,"keyup",function(n){if(Ht("Escape",n))return e.close();if(Ht("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(Ht("ArrowUp",n))return e._scrollToDirection(!0);if(Ht("ArrowDown",n))return e._scrollToDirection();Ht(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},Ce.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){Cn.unbind(e.el,e.type,e.listener)})},Ce.prototype._search=function(e){var t=this;if(this._clearResults(),!!e.trim()){var n=this._searchProvider.find(e);if(n=n.filter(function(r){return!t._canvas.getRootElements().includes(r.element)}),!n.length){this._selection.select(null);return}n.forEach(function(r){var o=r.element.id,a=t._createResultNode(r,o);t._results[o]={element:r.element,node:a}});var i=et(Ce.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},Ce.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},Ce.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)}},Ce.prototype._clearResults=function(){ms(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},Ce.prototype._getCurrentResult=function(){return et(Ce.RESULT_SELECTED_SELECTOR,this._resultsContainer)},Ce.prototype._createResultNode=function(e,t){var n=ut(Ce.RESULT_HTML);return e.primaryTokens.length>0&&lx(n,e.primaryTokens,Ce.RESULT_PRIMARY_HTML),lx(n,e.secondaryTokens,Ce.RESULT_SECONDARY_HTML),an(n,Ce.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},Ce.prototype.registerProvider=function(e){this._searchProvider=e},Ce.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,mt(this._canvas.getContainer()).add("djs-search-open"),mt(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},Ce.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,mt(this._canvas.getContainer()).remove("djs-search-open"),mt(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},Ce.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Ce.prototype.isOpen=function(){return this._open},Ce.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&mt(t).remove(Ce.RESULT_SELECTED_CLASS);var n=an(e,Ce.RESULT_ID_ATTRIBUTE),i=this._results[n].element;mt(e).add(Ce.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:ux}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},Ce.prototype._select=function(e){var t=an(e,Ce.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:ux}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},Ce.prototype._getBoxHtml=function(){const e=ut(Ce.BOX_HTML),t=et(Ce.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function lx(e,t,n){var i=LD(t),r=ut(n);r.innerHTML=i,e.appendChild(r)}function LD(e){var t="";return e.forEach(function(n){var i=vv(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+Ce.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}Ce.CONTAINER_SELECTOR=".djs-search-container",Ce.INPUT_SELECTOR=".djs-search-input input",Ce.RESULTS_CONTAINER_SELECTOR=".djs-search-results",Ce.RESULT_SELECTOR=".djs-search-result",Ce.RESULT_SELECTED_CLASS="djs-search-result-selected",Ce.RESULT_SELECTED_SELECTOR="."+Ce.RESULT_SELECTED_CLASS,Ce.RESULT_ID_ATTRIBUTE="data-result-id",Ce.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",Ce.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>`,Ce.RESULT_HTML='<div class="djs-search-result"></div>',Ce.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',Ce.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const DD={__depends__:[ra,Oc,qn],searchPad:["type",Ce]};function Lf(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}Lf.$inject=["elementRegistry","searchPad","canvas","search"],Lf.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!Me(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:jn(i),id:i.id})),e,{keys:["label","id"]}).map(OD)};function OD(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const LD={__depends__:[DD,b_],__init__:["bpmnSearch"],bpmnSearch:["type",Lf]},ID="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",ND="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",BD={width:36,height:50},$D={width:50,height:50};function ux(e,t,n){return me("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const ei=5;function vu(e,t){this._styles=t,e.registerProvider(this)}vu.$inject=["outline","styles"],vu.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(cS(e))return n=me("rect"),re(n,O({x:-ei,y:-ei,rx:4,width:e.width+ei*2,height:e.height+ei*2},t)),n;if(!Me(e))return v(e,"bpmn:Gateway")?(n=me("rect"),O(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),re(n,O({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):De(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=me("rect"),re(n,O({x:-ei,y:-ei,rx:14,width:e.width+ei*2,height:e.height+ei*2},t))):v(e,"bpmn:EndEvent")?(n=me("circle"),re(n,O({cx:e.width/2,cy:e.height/2,r:e.width/2+ei+1},t))):v(e,"bpmn:Event")?(n=me("circle"),re(n,O({cx:e.width/2,cy:e.height/2,r:e.width/2+ei},t))):v(e,"bpmn:DataObjectReference")&&lx(e,"bpmn:DataObjectReference")?n=ux(ID,{x:-6,y:-6},t):v(e,"bpmn:DataStoreReference")&&lx(e,"bpmn:DataStoreReference")&&(n=ux(ND,{x:-6,y:-6},t)),n},vu.prototype.updateOutline=function(e,t){if(!Me(e))return De(e,["bpmn:SubProcess","bpmn:Group"])?(re(t,{width:e.width+ei*2,height:e.height+ei*2}),!0):!!De(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function lx(e,t){var n;return t==="bpmn:DataObjectReference"?n=BD:t==="bpmn:DataStoreReference"&&(n=$D),e.width===n.width&&e.height===n.height}const jD={__depends__:[Sf],__init__:["outlineProvider"],outlineProvider:["type",vu]};var FD='<?xml version="1.0" encoding="UTF-8"?><bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" targetNamespace="http://bpmn.io/schema/bpmn" id="Definitions_1"><bpmn:process id="Process_1" isExecutable="false"><bpmn:startEvent id="StartEvent_1"/></bpmn:process><bpmndi:BPMNDiagram id="BPMNDiagram_1"><bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1"><bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"><dc:Bounds height="36.0" width="36.0" x="173.0" y="102.0"/></bpmndi:BPMNShape></bpmndi:BPMNPlane></bpmndi:BPMNDiagram></bpmn:definitions>';function xi(e){so.call(this,e)}ie(xi,so),xi.Viewer=mr,xi.NavigatedViewer=ka,xi.prototype.createDiagram=function(){return this.importXML(FD)},xi.prototype._interactionModules=[Ev,Rv,Av],xi.prototype._modelingModules=[zM,kc,YM,WM,a2,_f,f2,B2,dy,uc,H2,G2,ak,ck,uk,hk,Ck,kk,Gp,$k,Uk,iD,oD,Sb,MD,LD,jD],xi.prototype._modules=[].concat(mr.prototype._modules,xi.prototype._interactionModules,xi.prototype._modelingModules);const HD=((e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n})(Ct.defineComponent({__name:"BpmnModelerView",props:{xml:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,r=n,o=Ct.ref();let a;async function c(u){if(!a)throw new Error("modeler not mounted");try{const{warnings:l}=await a.importXML(u),p=ju(l);return r("imported",p),{warnings:p}}catch(l){throw r("import-error",l),l}}async function s(){if(!a)throw new Error("modeler not mounted");const{xml:u}=await a.saveXML({format:!0});return u??""}return Ct.onMounted(async()=>{a=new xi({container:o.value,moddleExtensions:ns}),i.xml&&await c(i.xml),r("ready")}),Ct.watch(()=>i.xml,u=>{u&&a&&c(u)}),Ct.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:c,saveXml:s,getModeler:()=>a}),(u,l)=>(Ct.openBlock(),Ct.createElementBlock("div",{ref_key:"container",ref:o,class:"bpmn-modeler-view"},null,512))}}),[["__scopeId","data-v-a9b41c97"]]);J.APPLY_BPMN_OPS_SCHEMA=zx,J.BPMN_MODDLE_EXTENSIONS=ns,J.BWL_MODDLE_SCHEMA=$f,J.BWL_NS=Bf,J.BWL_PREFIX=bu,J.BWL_SIDES=xu,J.BpmnModelerView=HD,J.EDITOR=sE,J.FLOW_LABEL_INDENT=gd,J.HEADLESS_BPMN_MODULES=dv,J.HEADLESS_TEXT_METRICS=io,J.I18N_NS=bw,J.I18N_PREFIX=ud,J.LABEL_FORK_MARGIN=Fu,J.MVP_FLOW_NODE_TYPES=wi,J.SYMBOLIC_OP_KINDS=Hf,J.SYMBOLIC_OP_SCHEMA=zf,J.UNDO_EPISODE_COMMAND=wu,J.applyBpmnOpBatch=ah,J.applyBpmnOps=nh,J.approximateTextWidth=Wo,J.auditBpmnGeometry=Cd,J.auditBpmnGeometryXml=Iw,J.auditGeometry=qi,J.auditTargetsOf=Ci,J.axisSegmentsOf=hn,J.buildBpmnOpBatch=aE,J.buildRegistryIndex=Ad,J.containerBoundarySegments=Go,J.createBpmnEditorController=cE,J.createBpmnModdle=ld,J.createHeadlessBpmnModeler=AT,J.crossedShapesOf=zn,J.crossingCost=Ri,J.describeProcess=oh,J.describeProcessXml=oE,J.edgeCrossCount=ss,J.edgeCrossingPairsOf=Hu,J.executeAsUndoEpisode=Ff,J.forwardThreePointCandidates=zu,J.geometryFindingKey=Yi,J.installHeadlessBpmnDom=Jd,J.isMvpFlowNodeType=Nf,J.labelRectsOf=cs,J.lineCrossesLabel=Si,J.lineThroughLabel=_d,J.lineThroughShapeLabel=Sd,J.loadBpmnXml=$u,J.lowerOps=th,J.oppositeOverlapCount=Rw,J.oppositeOverlapOf=md,J.planBackEdgeBoundaryClearance=Fd,J.planCrossPoolRoute=Nd,J.planEdgeRepair=Od,J.planLabelLineClearance=Wd,J.planLabelPlacement=Gd,J.planMiddleSegmentShifts=kd,J.planOppositeOverlapRepair=zd,J.planSegmentDetours=Md,J.planShapeLabelClearance=qd,J.repairIntroducedBoundaryHugging=Hd,J.repairIntroducedCrossings=Ld,J.repairIntroducedLabelLines=Ud,J.repairIntroducedOppositeOverlaps=Vd,J.repairIntroducedShapeLabelLines=Kd,J.repairIntroducedSharedSegmentLabels=Yd,J.rerouteIntroducedCrossPoolEdges=Bd,J.resolverServicesOf=eh,J.saveBpmnXml=xw,J.sceneCrossingCost=xd,J.sceneFromDefinitions=Rd,J.sceneFromRegistry=Ut,J.sharedSegmentUnderLabel=as,J.sharedSpansOf=os,J.unreadableOverlapCount=Tr,J.unreadableOverlapOf=rs,J.validateOps=Qd,J.warningMessages=ju,Object.defineProperty(J,Symbol.toStringTag,{value:"Module"})}));
343
+ </div>`,Ce.RESULT_HTML='<div class="djs-search-result"></div>',Ce.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',Ce.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const ID={__depends__:[oa,Oc,qn],searchPad:["type",Ce]};function Nf(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}Nf.$inject=["elementRegistry","searchPad","canvas","search"],Nf.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!Me(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:jn(i),id:i.id})),e,{keys:["label","id"]}).map(ND)};function ND(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const BD={__depends__:[ID,w_],__init__:["bpmnSearch"],bpmnSearch:["type",Nf]},$D="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",jD="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",FD={width:36,height:50},HD={width:50,height:50};function px(e,t,n){return me("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const ei=5;function vu(e,t){this._styles=t,e.registerProvider(this)}vu.$inject=["outline","styles"],vu.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(pS(e))return n=me("rect"),re(n,O({x:-ei,y:-ei,rx:4,width:e.width+ei*2,height:e.height+ei*2},t)),n;if(!Me(e))return v(e,"bpmn:Gateway")?(n=me("rect"),O(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),re(n,O({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):De(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=me("rect"),re(n,O({x:-ei,y:-ei,rx:14,width:e.width+ei*2,height:e.height+ei*2},t))):v(e,"bpmn:EndEvent")?(n=me("circle"),re(n,O({cx:e.width/2,cy:e.height/2,r:e.width/2+ei+1},t))):v(e,"bpmn:Event")?(n=me("circle"),re(n,O({cx:e.width/2,cy:e.height/2,r:e.width/2+ei},t))):v(e,"bpmn:DataObjectReference")&&fx(e,"bpmn:DataObjectReference")?n=px($D,{x:-6,y:-6},t):v(e,"bpmn:DataStoreReference")&&fx(e,"bpmn:DataStoreReference")&&(n=px(jD,{x:-6,y:-6},t)),n},vu.prototype.updateOutline=function(e,t){if(!Me(e))return De(e,["bpmn:SubProcess","bpmn:Group"])?(re(t,{width:e.width+ei*2,height:e.height+ei*2}),!0):!!De(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function fx(e,t){var n;return t==="bpmn:DataObjectReference"?n=FD:t==="bpmn:DataStoreReference"&&(n=HD),e.width===n.width&&e.height===n.height}const zD={__depends__:[Cf],__init__:["outlineProvider"],outlineProvider:["type",vu]};var VD='<?xml version="1.0" encoding="UTF-8"?><bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" targetNamespace="http://bpmn.io/schema/bpmn" id="Definitions_1"><bpmn:process id="Process_1" isExecutable="false"><bpmn:startEvent id="StartEvent_1"/></bpmn:process><bpmndi:BPMNDiagram id="BPMNDiagram_1"><bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1"><bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"><dc:Bounds height="36.0" width="36.0" x="173.0" y="102.0"/></bpmndi:BPMNShape></bpmndi:BPMNPlane></bpmndi:BPMNDiagram></bpmn:definitions>';function xi(e){uo.call(this,e)}ie(xi,uo),xi.Viewer=mr,xi.NavigatedViewer=Da,xi.prototype.createDiagram=function(){return this.importXML(VD)},xi.prototype._interactionModules=[Rv,Pv,Mv],xi.prototype._modelingModules=[WM,kc,XM,qM,u2,xf,m2,F2,my,uc,G2,Y2,uk,pk,fk,yk,Tk,Lk,Up,Hk,Kk,aD,cD,Cb,OD,BD,zD],xi.prototype._modules=[].concat(mr.prototype._modules,xi.prototype._interactionModules,xi.prototype._modelingModules);const GD=((e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n})(Ct.defineComponent({__name:"BpmnModelerView",props:{xml:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,r=n,o=Ct.ref();let a;async function s(u){if(!a)throw new Error("modeler not mounted");try{const{warnings:l}=await a.importXML(u),p=ju(l);return r("imported",p),{warnings:p}}catch(l){throw r("import-error",l),l}}async function c(){if(!a)throw new Error("modeler not mounted");const{xml:u}=await a.saveXML({format:!0});return u??""}return Ct.onMounted(async()=>{a=new xi({container:o.value,moddleExtensions:is}),i.xml&&await s(i.xml),r("ready")}),Ct.watch(()=>i.xml,u=>{u&&a&&s(u)}),Ct.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(u,l)=>(Ct.openBlock(),Ct.createElementBlock("div",{ref_key:"container",ref:o,class:"bpmn-modeler-view"},null,512))}}),[["__scopeId","data-v-a9b41c97"]]);Q.APPLY_BPMN_OPS_SCHEMA=Gx,Q.BPMN_MODDLE_EXTENSIONS=is,Q.BWL_MODDLE_SCHEMA=Ff,Q.BWL_NS=jf,Q.BWL_PREFIX=bu,Q.BWL_SIDES=xu,Q.BpmnModelerView=GD,Q.EDITOR=lE,Q.FLOW_LABEL_INDENT=bd,Q.HEADLESS_BPMN_MODULES=mv,Q.HEADLESS_TEXT_METRICS=no,Q.I18N_NS=ww,Q.I18N_PREFIX=pd,Q.LABEL_FORK_MARGIN=Hu,Q.MVP_FLOW_NODE_TYPES=wi,Q.SYMBOLIC_OP_KINDS=Vf,Q.SYMBOLIC_OP_SCHEMA=Gf,Q.UNDO_EPISODE_COMMAND=wu,Q.applyBpmnOpBatch=ch,Q.applyBpmnOps=rh,Q.approximateTextWidth=io,Q.auditBpmnGeometry=Td,Q.auditBpmnGeometryXml=Gw,Q.auditGeometry=qi,Q.auditTargetsOf=Ci,Q.axisSegmentsOf=hn,Q.blackBoxNameRect=Fu,Q.buildBpmnOpBatch=uE,Q.buildRegistryIndex=kd,Q.containerBoundarySegments=Wo,Q.createBpmnEditorController=pE,Q.createBpmnModdle=fd,Q.createHeadlessBpmnModeler=kT,Q.crossedShapesOf=zn,Q.crossingCost=Ri,Q.describeProcess=sh,Q.describeProcessXml=cE,Q.edgeCrossCount=cs,Q.edgeCrossingPairsOf=Vu,Q.executeAsUndoEpisode=zf,Q.forwardThreePointCandidates=Gu,Q.geometryFindingKey=Yi,Q.installHeadlessBpmnDom=hd,Q.isMvpFlowNodeType=$f,Q.labelRectsOf=Uo,Q.lineCrossesLabel=Si,Q.lineThroughLabel=wd,Q.lineThroughShapeLabel=Pd,Q.loadBpmnXml=$u,Q.lowerOps=ih,Q.oppositeOverlapCount=Lw,Q.oppositeOverlapOf=_d,Q.planBackEdgeBoundaryClearance=Vd,Q.planCrossPoolRoute=jd,Q.planEdgeRepair=Nd,Q.planLabelLineClearance=qd,Q.planLabelPlacement=Yd,Q.planMiddleSegmentShifts=Ld,Q.planOppositeOverlapRepair=Wd,Q.planSegmentDetours=Od,Q.planShapeLabelClearance=Zd,Q.repairIntroducedBoundaryHugging=Gd,Q.repairIntroducedCrossings=Bd,Q.repairIntroducedLabelLines=Kd,Q.repairIntroducedOppositeOverlaps=Ud,Q.repairIntroducedShapeLabelLines=Qd,Q.repairIntroducedSharedSegmentLabels=Xd,Q.rerouteIntroducedCrossPoolEdges=Fd,Q.resolverServicesOf=nh,Q.saveBpmnXml=Ew,Q.sceneCrossingCost=Sd,Q.sceneFromDefinitions=Ad,Q.sceneFromRegistry=Ut,Q.sharedSegmentUnderLabel=ss,Q.sharedSpansOf=as,Q.unreadableOverlapCount=Tr,Q.unreadableOverlapOf=os,Q.validateOps=th,Q.warningMessages=ju,Object.defineProperty(Q,Symbol.toStringTag,{value:"Module"})}));