@g1cloud/bpmn-modeler-next 5.0.0-alpha.17 → 5.0.0-alpha.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,16 +1,16 @@
1
- (function(Q,wt){typeof exports=="object"&&typeof module<"u"?wt(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],wt):(Q=typeof globalThis<"u"?globalThis:Q||self,wt(Q.BpmnModeler={},Q.Vue))})(this,(function(Q,wt){"use strict";var ED=Object.defineProperty;var wD=(Q,wt,yi)=>wt in Q?ED(Q,wt,{enumerable:!0,configurable:!0,writable:!0,value:yi}):Q[wt]=yi;var Hr=(Q,wt,yi)=>wD(Q,typeof wt!="symbol"?wt+"":wt,yi);const yi=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway"];function Tf(e){return yi.includes(e)}const Mf="http://g1project.net/spec/bpmn/bwl/1.0",pu="bwl",fu=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],kf={name:"bwl-hints",uri:Mf,prefix:pu,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"}]}]},du="bwl.undoEpisode",Df=new WeakSet;function ax(e){Df.has(e)||(e.register(du,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),Df.add(e))}function Of(e,t){ax(e);const n={run:t};if(e.execute(du,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const Lf=["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"],sx={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},cx={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},ux={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},lx={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다.",properties:{id:{type:"string"},type:{type:"string",enum:[...yi]},name:{type:"string"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},px={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},fx={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},dx={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"}},required:["id","source","target"],additionalProperties:!1},hx={type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},mx={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},gx={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},vx={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},yx={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},_x={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...fu]},offset:{type:"number"}},required:["anchor","side"],additionalProperties:!1};function Xt(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const bx={"participant.add":Xt("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트(생략 시 op 순서가 곧 배치 순서).",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":Xt("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":Xt("node.add",{description:'플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 갈래 1, 2…) — 위/아래가 아니라 "주 흐름에서 몇 번째 갈래"다. 행 배치(어느 갈래가 위/아래인지)는 호스트가 정한다(대칭·메시지 방향). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.',properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer"}},required:["node"]}),"node.update":Xt("node.update",{description:"노드 이름/레인/타입 갱신. lane = 레인 재배정(이동), type = 태스크·이벤트 타입 전환.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lane:{type:"string"},type:{type:"string",enum:[...yi]}},required:["id"]}),"sequenceFlow.add":Xt("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":Xt("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":Xt("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":Xt("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataStore.add":Xt("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":Xt("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataAssociation.add":Xt("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":Xt("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":Xt("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":Xt("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":Xt("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":Xt("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"element.remove":Xt("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},If={anyOf:Lf.map(e=>bx[e])},xx={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:cx,irParticipant:ux,irNode:lx,irFlowCondition:px,irSequenceFlow:fx,irMessageFlow:dx,irDataStore:hx,irDataAssociation:mx,irTextAnnotation:gx,irAssociation:vx,irGroup:yx,bwlPlacement:_x,nullableString:sx,symbolicOp:If}};function hu(e){return Array.prototype.concat.apply([],e)}const Mo=Object.prototype.toString,Ex=Object.prototype.hasOwnProperty;function vr(e){return e===void 0}function Ot(e){return e!==void 0}function zr(e){return e==null}function ge(e){return Mo.call(e)==="[object Array]"}function jt(e){return Mo.call(e)==="[object Object]"}function _e(e){return Mo.call(e)==="[object Number]"}function Ft(e){const t=Mo.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function gn(e){return Mo.call(e)==="[object String]"}function wx(e){if(!ge(e))throw new Error("must supply array")}function vn(e,t){return!zr(e)&&Ex.call(e,t)}function it(e,t){const n=Va(t);let i;return M(e,function(r,o){if(n(r,o))return i=r,!1}),i}function Nf(e,t){const n=Va(t);let i=ge(e)?-1:void 0;return M(e,function(r,o){if(n(r,o))return i=o,!1}),i}function Te(e,t){const n=Va(t);let i=[];return M(e,function(r,o){n(r,o)&&i.push(r)}),i}function M(e,t){let n,i;if(vr(e))return;const r=ge(e)?Ax:Px;for(let o in e)if(vn(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function Sx(e,t){if(vr(e))return[];wx(e);const n=Va(t);return e.filter(function(i,r){return!n(i,r)})}function yn(e,t,n){return M(e,function(i,r){n=t(n,i,r)}),n}function yr(e,t){return!!yn(e,function(n,i,r){return n&&t(i,r)},!0)}function Ni(e,t){return!!it(e,t)}function Zt(e,t){let n=[];return M(e,function(i,r){n.push(t(i,r))}),n}function za(e){return e&&Object.keys(e)||[]}function Rx(e){return za(e).length}function Vr(e){return Zt(e,t=>t)}function Gr(e,t,n={}){return t=mu(t),M(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function Bf(e,...t){e=mu(e);let n={};return M(t,r=>Gr(r,e,n)),Zt(n,function(r,o){return r[0]})}const Cx=Bf;function ti(e,t){t=mu(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)}),Zt(n,i=>i.v)}function Wr(e){return function(t){return yr(e,function(n,i){return t[i]===n})}}function mu(e){return Ft(e)?e:t=>t[e]}function Va(e){return Ft(e)?e:t=>t===e}function Px(e){return e}function Ax(e){return Number(e)}function gu(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 dn(e,t){return e.bind(t)}function D(e,...t){return Object.assign(e,...t)}function Tx(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];Ot(a)&&zr(s)&&(s=i[r]=isNaN(+a)?{}:[]),vr(a)?vr(n)?delete i[r]:i[r]=n:i=s}),e}function Zn(e,t){let n={},i=Object(e);return M(t,function(r){r in i&&(n[r]=e[r])}),n}function ni(e,t){let n={},i=Object(e);return M(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function vu(){}vu.prototype.get=function(e){return this.$model.properties.get(this,e)},vu.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function $f(e,t){this.model=e,this.properties=t}$f.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(vu.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,dn(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 Mx=D(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),jf=D(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 yu(e,t){var n=jf[e];return n?n(t):t}function _u(e){return!!Mx[e]}function Ff(e){return!!jf[e]}function Qt(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 An(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}An.prototype.build=function(){return Zn(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},An.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)},An.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},An.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=Qt(r[0],i),a=Qt(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},An.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},An.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},An.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},An.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},An.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},An.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")},An.prototype.hasProperty=function(e){return this.propertiesByName[e]},An.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,dn(function(o){o=D({},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 Bi(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,M(e,dn(this.registerPackage,this))}Bi.prototype.getPackage=function(e){return this.packageMap[e]},Bi.prototype.getPackages=function(){return this.packages},Bi.prototype.registerPackage=function(e){e=D({},e);var t=this.packageMap;Hf(t,e,"prefix"),Hf(t,e,"uri"),M(e.types,dn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Bi.prototype.registerType=function(e,t){e=D({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:D({},e.meta||{})});var n=Qt(e.name,t.prefix),i=n.name,r=Object.create(null);M(e.properties,dn(function(o){var a=Qt(o.name,n.prefix),s=a.name;_u(o.type)||(o.type=Qt(o.type,a.prefix).name),D(o,{ns:a,name:s}),r[s]=o},this)),D(e,{ns:n,name:i,propertiesByName:r}),M(e.extends,dn(function(o){var a=Qt(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},Bi.prototype.mapTypes=function(e,t,n){var i=_u(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,u){var l=Qt(c,_u(c)?"":e.prefix);r.mapTypes(l,t,u)}function a(c){return o(c,!0)}function s(c){return o(c,!1)}if(!i)throw new Error("unknown type <"+e.name+">");M(i.superClass,n?a:s),t(i,!n),M(i.traits,a)},Bi.prototype.getEffectiveDescriptor=function(e){var t=Qt(e),n=new An(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},Bi.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function Hf(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function _r(e){this.model=e}_r.prototype.set=function(e,t,n){if(!gn(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;kx(n)?i?delete e[r]:delete e.$attrs[bu(t)]:i?r in e?e[r]=n:zf(e,i,n):e.$attrs[bu(t)]=n},_r.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[bu(t)];var i=n.name;return!e[i]&&n.isMany&&zf(e,n,[]),e[i]},_r.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=D({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},_r.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},_r.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},_r.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 kx(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 bu(e){return e.replace(/^:/,"")}function Nn(e,t={}){this.properties=new _r(this),this.factory=new $f(this,this.properties),this.registry=new Bi(e,this.properties),this.typeCache=Object.create(null),this.config=t}Nn.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},Nn.prototype.getType=function(e){var t=this.typeCache,n=gn(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},Nn.prototype.createAny=function(e,t,n){var i=Qt(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){Tx(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){jt(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},Nn.prototype.getPackage=function(e){return this.registry.getPackage(e)},Nn.prototype.getPackages=function(){return this.registry.getPackages()},Nn.prototype.getElementDescriptor=function(e){return e.$descriptor},Nn.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},Nn.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},Nn.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var Vf=String.fromCharCode,Dx=Object.prototype.hasOwnProperty,Ox=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,ko={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(ko).forEach(function(e){ko[e.toUpperCase()]=ko[e]});function Lx(e,t,n,i){return i?Dx.call(ko,i)?ko[i]:"&"+i+";":Vf(t||parseInt(n,16))}function br(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(Ox,Lx):e}var Gf="non-whitespace outside of root node";function $i(e){return new Error(e)}function Ix(e){return"missing namespace for prefix <"+e+">"}function Ga(e){return{get:e,enumerable:!0}}function Nx(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var Wf=Symbol("nameCache");function xu(e){return e+"$uri"}function Bx(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[xu(i)]=n;return t}function Wa(){return{line:0,column:0}}function $x(e){throw e}function Uf(e){if(!this)return new Uf(e);var t=e&&e.proxy,n,i,r,o,a=$x,s,c,u,l,p=Wa,f=!1,d=!1,h="",m=!1,g=!1,S=null,E=!1,x,b,w,T;function O(I){I instanceof Error||(I=$i(I)),S=I,a(I,p)}function P(I){s&&(I instanceof Error||(I=$i(I)),s(I,p))}this.on=function(I,H){if(typeof H!="function")throw $i("required args <name, cb>");switch(I){case"openTag":i=H;break;case"text":n=H;break;case"closeTag":r=H;break;case"error":a=H;break;case"warn":s=H;break;case"cdata":o=H;break;case"attention":l=H;break;case"question":u=H;break;case"comment":c=H;break;default:throw $i("unsupported event: "+I)}return this},this.ns=function(I){if(typeof I>"u"&&(I={}),typeof I!="object")throw $i("required args <nsMap={}>");var H=Object.create(null),ae;for(ae in I)H[ae]=I[ae];return g=!0,T=H,this};function j(){x=g?[]:null,b=g?Bx(T):null,w=[],p=Wa,E=!1,S=null,d=!1,h=""}this.parse=function(I){if(typeof I!="string")throw $i("required args <xml=string>");if(f)throw $i("parse during stream; call end() first");return j(),F(I),p=Wa,E=!1,S},this.write=function(I){if(typeof I!="string")throw $i("required args <xml=string>");return f||(j(),f=!0),S||(h=F(h+I,!0)||""),this},this.end=function(){return f||j(),f=!1,S||F(h),h="",p=Wa,E=!1,S},this.stop=function(){E=!0};function F(I,H=!1){var ae=null,Ie=null,ot,X=0,oe=!1,me=!1,se=0,le=0,J,$,B,G,Pe,xt,C,_,v,k="",L=0,V;function te(Ze,$t){var Mt=Ze.indexOf(":");if(Mt===-1)return Ze;var nn=b[Ze.substring(0,Mt)];return nn?$t===nn?Ze.substr(Mt+1):nn+Ze.substr(Mt):(P(Ix(Ze.substring(0,Mt))),null)}function we(){if(V!==null)return V;var Ze,$t,Mt=g&&b.xmlns,nn=g&&m?[]:null,tt=L,kt=k,rn=kt.length,Fr,fn,Kn,On,Dt,ei={},ja=new Set,Ln,ze,Ye;e:for(;tt<rn;tt++)if(Ln=!1,ze=kt.charCodeAt(tt),!(ze===32||ze<14&&ze>8)){for((ze<65||ze>122||ze>90&&ze<97)&&ze!==95&&ze!==58&&(P("illegal first char attribute name"),Ln=!0),Ye=tt+1;Ye<rn;Ye++)if(ze=kt.charCodeAt(Ye),!(ze>96&&ze<123||ze>64&&ze<91||ze>47&&ze<59||ze===46||ze===45||ze===95)){if(ze===32||ze<14&&ze>8){P("missing attribute value"),tt=Ye;continue e}if(ze===61)break;P("illegal attribute name char"),Ln=!0}if(Dt=kt.substring(tt,Ye),Dt==="xmlns:xmlns"&&(P("illegal declaration of xmlns"),Ln=!0),ze=kt.charCodeAt(Ye+1),ze===34)Ye=kt.indexOf('"',tt=Ye+2),Ye===-1&&(Ye=kt.indexOf("'",tt),Ye!==-1&&(P("attribute value quote missmatch"),Ln=!0));else if(ze===39)Ye=kt.indexOf("'",tt=Ye+2),Ye===-1&&(Ye=kt.indexOf('"',tt),Ye!==-1&&(P("attribute value quote missmatch"),Ln=!0));else for(P("missing attribute value quotes"),Ln=!0,Ye=Ye+1;Ye<rn&&(ze=kt.charCodeAt(Ye+1),!(ze===32||ze<14&&ze>8));Ye++);for(Ye===-1&&(P("missing closing quotes"),Ye=rn,Ln=!0),Ln||(Kn=kt.substring(tt,Ye)),tt=Ye;Ye+1<rn&&(ze=kt.charCodeAt(Ye+1),!(ze===32||ze<14&&ze>8));Ye++)tt===Ye&&(P("illegal character after attribute end"),Ln=!0);if(tt=Ye+1,Ln)continue e;if(ja.has(Dt)){P("attribute <"+Dt+"> already defined");continue}if(ja.add(Dt),!g){ei[Dt]=Kn;continue}if(m){if(fn=Dt==="xmlns"?"xmlns":Dt.charCodeAt(0)===120&&Dt.substr(0,6)==="xmlns:"?Dt.substr(6):null,fn!==null){if(Ze=br(Kn),$t=xu(fn),On=T[Ze],!On){if(fn==="xmlns"||$t in b&&b[$t]!==Ze)do On="ns"+X++;while(typeof b[On]<"u");else On=fn;T[Ze]=On}b[fn]!==On&&(Fr||(b=Nx(b),Fr=!0),b[fn]=On,fn==="xmlns"&&(b[xu(On)]=Ze,Mt=On),b[$t]=Ze),ei[Dt]=Kn;continue}nn.push(Dt,Kn);continue}Dt=te(Dt,Mt),Dt!==null&&(ei[Dt]=Kn)}if(m)for(tt=0,rn=nn.length;tt<rn;tt++)Dt=te(nn[tt++],Mt),Kn=nn[tt],Dt!==null&&(ei[Dt]=Kn);return V=ei}function je(){for(var Ze=/(\r\n|\r|\n)/g,$t=0,Mt=0,nn=0,tt=le,kt,rn;se>=nn&&(kt=Ze.exec(I),!(!kt||(tt=kt[0].length+kt.index,tt>se)));)$t+=1,nn=tt;return se==-1?(Mt=tt,rn=I.substring(le)):le===0?rn=I.substring(le,se):(Mt=se-nn,rn=le==-1?I.substring(se):I.substring(se,le+1)),{data:rn,line:$t,column:Mt}}for(p=je,t&&(v=Object.create({},{name:Ga(function(){return C}),originalName:Ga(function(){return _}),attrs:Ga(we),ns:Ga(function(){return b})}));le!==-1;){if(I.charCodeAt(le)===60?se=le:se=I.indexOf("<",le),se===-1){if(H)return I.substring(le);if(w.length)return O("unexpected end of file");if(!d)return O("missing start tag");le<I.length&&I.substring(le).trim()&&P(Gf);return}if(d||(d=!0),le!==se){if(w.length){if(n&&(n(I.substring(le,se),br,p),E))return}else if(I.substring(le,se).trim()&&(P(Gf),E))return}if(G=I.charCodeAt(se+1),G===33){if(B=I.charCodeAt(se+2),B===91&&I.substr(se+3,6)==="CDATA["){if(le=I.indexOf("]]>",se),le===-1)return H?I.substring(se):O("unclosed cdata");if(o&&(o(I.substring(se+9,le),p),E))return;le+=3;continue}if(B===45&&I.charCodeAt(se+3)===45){if(le=I.indexOf("-->",se),le===-1)return H?I.substring(se):O("unclosed comment");if(c&&(c(I.substring(se+4,le),br,p),E))return;le+=3;continue}}if(G===63){if(le=I.indexOf("?>",se),le===-1)return H?I.substring(se):O("unclosed question");if(u&&(u(I.substring(se,le+2),p),E))return;le+=2;continue}for(J=se+1;;J++){if(Pe=I.charCodeAt(J),isNaN(Pe))return H?I.substring(se):(le=-1,O("unclosed tag"));if(Pe===34)B=I.indexOf('"',J+1),J=B!==-1?B:J;else if(Pe===39)B=I.indexOf("'",J+1),J=B!==-1?B:J;else if(Pe===62){le=J;break}}if(G===33){if(l&&(l(I.substring(se,le+1),br,p),E))return;le+=1;continue}if(V={},G===47){if(oe=!1,me=!0,!w.length)return O("missing open tag");if(J=C=w.pop(),B=se+2+J.length,I.substring(se+2,B)!==J)return O("closing tag mismatch");for(;B<le;B++)if(G=I.charCodeAt(B),!(G===32||G>8&&G<14))return O("close tag")}else{if(I.charCodeAt(le-1)===47?(J=C=I.substring(se+1,le-1),oe=!0,me=!0):(J=C=I.substring(se+1,le),oe=!0,me=!1),!(G>96&&G<123||G>64&&G<91||G===95||G===58))return O("illegal first char nodeName");for(B=1,$=J.length;B<$;B++)if(G=J.charCodeAt(B),!(G>96&&G<123||G>64&&G<91||G>47&&G<59||G===45||G===95||G==46)){if(G===32||G<14&&G>8){C=J.substring(0,B),V=null;break}return O("invalid nodeName")}me||w.push(C)}if(g){ot=b,oe&&(me||x.push(ot),V===null&&(m=J.indexOf("xmlns",B)!==-1)&&(L=B,k=J,we(),m=!1)),_=C,Ie!==b&&(ae=b[Wf],ae===void 0&&(ae=b[Wf]=Object.create(null)),Ie=b);var vt=ae[C];if(vt!==void 0)C=vt;else{if(G=C.indexOf(":"),G!==-1){if(xt=b[C.substring(0,G)],!xt)return O("missing namespace on <"+_+">");C=C.substr(G+1)}else xt=b.xmlns;xt&&(C=xt+":"+C),ae[_]=C}}if(oe&&(L=B,k=J,i&&(t?i(v,br,me,p):i(C,we,br,me,p),E)))return;if(me){if(r&&(r(t?v:C,br,oe,p),E))return;g&&(oe?b=ot:b=x.pop())}le+=1}}}function qf(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var Eu={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},Yf="property";function Kf(e){return e.xml&&e.xml.serialize}function jx(e){const t=Kf(e);return t!==Yf&&(t||null)}function Fx(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Xf(e,t){return qf(t)?e.prefix+":"+Fx(e.localName):e.name}function Hx(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 zx(e,t,n){const i=Qt(e,t.xmlns),r=`${t[i.prefix]||i.prefix}:${i.localName}`,o=Qt(r);var a=n.getPackage(o.prefix);return Hx(o,a)}function ji(e){return new Error(e)}function _i(e){return e.$descriptor}function Vx(e){D(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw ji("expected element");var n=this.elementsById,i=_i(t),r=i.idProperty,o;if(r&&(o=t.get(r.name),o)){if(!/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i.test(o))throw new Error("illegal ID <"+o+">");if(n[o])throw ji("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function Do(){}Do.prototype.handleEnd=function(){},Do.prototype.handleText=function(){},Do.prototype.handleNode=function(){};function wu(){}wu.prototype=Object.create(Do.prototype),wu.prototype.handleNode=function(){return this};function Ur(){}Ur.prototype=Object.create(Do.prototype),Ur.prototype.handleText=function(e){this.body=(this.body||"")+e};function Oo(e,t){this.property=e,this.context=t}Oo.prototype=Object.create(Ur.prototype),Oo.prototype.handleNode=function(e){if(this.element)throw ji("expected no sub nodes");return this.element=this.createReference(e),this},Oo.prototype.handleEnd=function(){this.element.id=this.body},Oo.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function Su(e,t){this.element=t,this.propertyDesc=e}Su.prototype=Object.create(Ur.prototype),Su.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=yu(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function Ua(){}Ua.prototype=Object.create(Ur.prototype),Ua.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 cn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}cn.prototype=Object.create(Ua.prototype),cn.prototype.addReference=function(e){this.context.addReference(e)},cn.prototype.handleText=function(e){var t=this.element,n=_i(t),i=n.bodyProperty;if(!i)throw ji("unexpected body text <"+e+">");Ur.prototype.handleText.call(this,e)},cn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=_i(t),i=n.bodyProperty;i&&e!==void 0&&(e=yu(i.type,e),t.set(i.name,e))},cn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=_i(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=yu(l.type,c):u==="xmlns"?u=":"+u:(s=Qt(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},cn.prototype.getPropertyForNode=function(e){var t=e.name,n=Qt(t),i=this.type,r=this.model,o=_i(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const u=jx(s);if(u){const l=e.attributes[u];if(l){const p=zx(l,e.ns,r),f=r.getType(p);return D({},s,{effectiveType:_i(f).name})}}return s}var c=r.getPackage(n.prefix);if(c){const u=Xf(n,c),l=r.getType(u);if(s=it(o.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&l.hasType(p.type)}),s)return D({},s,{effectiveType:_i(l).name})}else if(s=it(o.properties,function(u){return!u.isReference&&!u.isAttribute&&u.type==="Element"}),s)return s;throw ji("unrecognized element <"+n.name+">")},cn.prototype.toString=function(){return"ElementDescriptor["+_i(this.type).name+"]"},cn.prototype.valueHandler=function(e,t){return new Su(e,t)},cn.prototype.referenceHandler=function(e){return new Oo(e,this.context)},cn.prototype.handler=function(e){return e==="Element"?new qr(this.model,e,this.context):new cn(this.model,e,this.context)},cn.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,Ff(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?(D(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function Ru(e,t,n){cn.call(this,e,t,n)}Ru.prototype=Object.create(cn.prototype),Ru.prototype.createElement=function(e){var t=e.name,n=Qt(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&Xf(n,o)||t;if(!r.hasType(a))throw ji("unexpected element <"+e.originalName+">");return cn.prototype.createElement.call(this,e)};function qr(e,t,n){this.model=e,this.context=n}qr.prototype=Object.create(Ua.prototype),qr.prototype.createElement=function(e){var t=e.name,n=Qt(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},qr.prototype.handleChild=function(e){var t=new qr(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},qr.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function Cu(e){e instanceof Nn&&(e={model:e}),D(this,{lax:!1},e)}Cu.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof cn?(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 Vx(D({},t,{rootHandler:i})),s=new Uf({proxy:!0}),c=Gx();i.context=a,c.push(i);function u(w,T,O){var P=T(),j=P.line,F=P.column,I=P.data;I.charAt(0)==="<"&&I.indexOf(" ")!==-1&&(I=I.slice(0,I.indexOf(" "))+">");var H="unparsable content "+(I?I+" ":"")+`detected
2
- line: `+j+`
3
- column: `+F+`
4
- nested error: `+w.message;if(O)return a.addWarning({message:H,error:w}),!0;throw ji(H)}function l(w,T){return u(w,T,!0)}function p(){var w=a.elementsById,T=a.references,O,P;for(O=0;P=T[O];O++){var j=P.element,F=w[P.id],I=_i(j).propertiesByName[P.property];if(F||a.addWarning({message:"unresolved reference <"+P.id+">",element:P.element,property:P.property,value:P.id}),I.isMany){var H=j.get(I.name),ae=H.indexOf(P);ae===-1&&(ae=H.length),F?H[ae]=F:H.splice(ae,1)}else j.set(I.name,F)}}function f(){c.pop().handleEnd()}var d=/^<\?xml /i,h=/ encoding="([^"]+)"/i,m=/^utf-8$/i;function g(w){if(d.test(w)){var T=h.exec(w),O=T&&T[1];!O||m.test(O)||a.addWarning({message:"unsupported document encoding <"+O+">, falling back to UTF-8"})}}function S(w,T){var O=c.peek();try{c.push(O.handleNode(w))}catch(P){u(P,T,o)&&c.push(new wu)}}function E(w,T){try{c.peek().handleText(w)}catch(O){l(O,T)}}function x(w,T){w.trim()&&E(w,T)}var b=r.getPackages().reduce(function(w,T){return w[T.uri]=T.prefix,w},Object.entries(Eu).reduce(function(w,[T,O]){return w[O]=T,w},r.config&&r.config.nsMap||{}));return s.ns(b).on("openTag",function(w,T,O,P){var j=w.attrs||{},F=Object.keys(j).reduce(function(H,ae){var Ie=T(j[ae]);return H[ae]=Ie,H},{}),I={name:w.name,originalName:w.originalName,attributes:F,ns:w.ns};S(I,P)}).on("question",g).on("closeTag",f).on("cdata",E).on("text",function(w,T,O){x(T(w),O)}).on("error",u).on("warn",l),new Promise(function(w,T){var O;try{s.parse(e),p()}catch(H){O=H}var P=i.element;!O&&!P&&(O=ji("failed to parse document as <"+i.type.$descriptor.name+">"));var j=a.warnings,F=a.references,I=a.elementsById;return O?(O.warnings=j,T(O)):w({rootElement:P,elementsById:I,references:F,warnings:j})})},Cu.prototype.handler=function(e){return new Ru(this.model,e)};function Gx(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var Wx=`<?xml version="1.0" encoding="UTF-8"?>
5
- `,Ux=/<|>|'|"|&|\n\r|\n/g,Zf=/<|>|&/g;function ii(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}ii.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},ii.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},ii.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},ii.prototype.add=function(e,t){this.uriMap[e.uri]=e,t?this.wellknown.push(e):this.custom.push(e),this.mapPrefix(e.prefix,e.uri)},ii.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},ii.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},ii.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},ii.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},ii.prototype.getUsed=function(e){var t=[].concat(this.wellknown,this.custom);return t.filter(n=>{var i=this.getNSKey(n);return this.used[i]})};function qx(e){return e.charAt(0).toLowerCase()+e.slice(1)}function Yx(e,t){return qf(t)?qx(e):e}function Qf(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function Jf(e){return gn(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function Kx(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 Xx(e,t){return t.isGeneric?D({localName:t.ns.localName},e):D({localName:Yx(t.ns.localName,t.$pkg)},e)}function Zx(e,t){return D({localName:t.ns.localName},e)}function Qx(e){var t=e.$descriptor;return Te(t.properties,function(n){var i=n.name;if(n.isVirtual||!vn(e,i))return!1;var r=e[i];return r===n.default||r===null?!1:n.isMany?r.length:!0})}var Jx={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},e0={"<":"lt",">":"gt","&":"amp"};function ed(e,t,n){return e=gn(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function t0(e){return ed(e,Ux,Jx)}function n0(e){return ed(e,Zf,e0)}function i0(e){return Te(e,function(t){return t.isAttr})}function r0(e){return Te(e,function(t){return!t.isAttr})}function Pu(e){this.tagName=e}Pu.prototype.build=function(e){return this.element=e,this},Pu.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function xr(){}xr.prototype.serializeValue=xr.prototype.serializeTo=function(e){e.append(this.escape?n0(this.value):this.value)},xr.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(Zf)!==-1&&(this.escape=!0),this};function Au(e){this.tagName=e}Qf(Au,xr),Au.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function ut(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}ut.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=Qx(e),this.parseAttributes(i0(r)),this.parseContainments(r0(r))),this.parseGenericAttributes(e,i),this},ut.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return Xx(t,e)},ut.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return Zx(t,e)},ut.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},ut.prototype.nsAttributeName=function(e){var t;if(gn(e)?t=Qt(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}:D({localName:t.localName},n)},ut.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}))},ut.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new xr().build({type:"String"},t));var n=e.$children;n&&M(n,i=>{this.body.push(new ut(this).build(i))})},ut.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,r=Qt(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)}},ut.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},ut.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)}})},ut.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 xr().build(r,o[0]));else if(Ff(r.type))M(o,function(u){n.push(new Au(t.addTagName(t.nsPropertyTagName(r))).build(r,u))});else if(a)M(o,function(u){n.push(new Pu(t.addTagName(t.nsPropertyTagName(r))).build(u))});else{var c=Kf(r);M(o,function(u){var l;c?c===Yf?l=new ut(t,r):l=new qa(t,r,c):l=new ut(t),n.push(l.build(u))})}})},ut.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new ii(i):t=i),t},ut.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},ut.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},ut.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)})},ut.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),Jf(e)},ut.prototype.addAttribute=function(e,t){var n=this.attrs;gn(t)&&(t=t0(t));var i=Nf(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)},ut.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=Kx(n).concat(t)),M(t,function(i){e.append(" ").append(Jf(i.name)).append('="').append(i.value).append('"')})},ut.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==xr;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 qa(e,t,n){ut.call(this,e,t),this.serialization=n}Qf(qa,ut),qa.prototype.parseNsAttributes=function(e){var t=ut.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},qa.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function o0(){this.value="",this.write=function(e){this.value+=e}}function a0(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 s0(e){e=D({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new o0,o=new a0(r,e.format);e.preamble&&o.append(Wx);var a=new ut,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(c0(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function c0(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in Eu)n[i]=Eu[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 Ya(e,t){Nn.call(this,e,t)}Ya.prototype=Object.create(Nn.prototype),Ya.prototype.fromXML=function(e,t,n){gn(t)||(n=t,t="bpmn:Definitions");var i=new Cu(D({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},Ya.prototype.toXML=function(e,t){var n=new s0(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var u0="BPMN20",l0="http://www.omg.org/spec/BPMN/20100524/MODEL",p0="bpmn",f0=[],d0=[{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"}]}],h0=[{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"}]}],m0={tagAlias:"lowerCase",typePrefix:"t"},g0={name:u0,uri:l0,prefix:p0,associations:f0,types:d0,enumerations:h0,xml:m0},v0="BPMNDI",y0="http://www.omg.org/spec/BPMN/20100524/DI",_0="bpmndi",b0=[{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"]}],x0=[{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"}]}],E0=[],w0={name:v0,uri:y0,prefix:_0,types:b0,enumerations:x0,associations:E0},S0="DC",R0="http://www.omg.org/spec/DD/20100524/DC",C0="dc",P0=[{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}]}],A0=[],T0={name:S0,uri:R0,prefix:C0,types:P0,associations:A0},M0="DI",k0="http://www.omg.org/spec/DD/20100524/DI",D0="di",O0=[{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"}]}],L0=[],I0={tagAlias:"lowerCase"},N0={name:M0,uri:k0,prefix:D0,types:O0,associations:L0,xml:I0},B0="bpmn.io colors for BPMN",$0="http://bpmn.io/schema/bpmn/biocolor/1.0",j0="bioc",F0=[{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"}]}],H0=[],z0=[],V0={name:B0,uri:$0,prefix:j0,types:F0,enumerations:H0,associations:z0},G0="BPMN in Color",W0="http://www.omg.org/spec/BPMN/non-normative/color/1.0",U0="color",q0=[{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"}]}],Y0=[],K0=[],X0={name:G0,uri:W0,prefix:U0,types:q0,enumerations:Y0,associations:K0};const Z0={bpmn:g0,bpmndi:w0,dc:T0,di:N0,bioc:V0,color:X0};function td(e,t){const n=D({},Z0,e);return new Ya(n,t)}const Q0={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"}},J0="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",nd="i18n",Ka={[nd]:Q0,[pu]:kf};function id(){return td(Ka)}const rd=id();async function Tu(e){const{rootElement:t,warnings:n}=await rd.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function eE(e){const{xml:t}=await rd.toXML(e,{format:!0});return t}function Mu(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const Xa=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),tE=1,nE=2;function Fi(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}`}}const od=20,ad=1;function _n(e){const t=[];for(let n=0;n+1<e.waypoints.length;n++){const i=e.waypoints[n],r=e.waypoints[n+1];Math.abs(i.y-r.y)<.5&&Math.abs(i.x-r.x)>=.5?t.push({axis:"h",at:i.y,lo:Math.min(i.x,r.x),hi:Math.max(i.x,r.x),dir:r.x>i.x?1:-1}):Math.abs(i.x-r.x)<.5&&Math.abs(i.y-r.y)>=.5&&t.push({axis:"v",at:i.x,lo:Math.min(i.y,r.y),hi:Math.max(i.y,r.y),dir:r.y>i.y?1:-1})}return t}function Za(e,t){let n=null;const i=e.type!==t.type;for(const r of _n(e))for(const o of _n(t)){if(r.axis!==o.axis||Math.abs(r.at-o.at)>ad)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>=od&&(!n||s>n.length)&&(n={axis:r.axis,length:s,kind:a})}return n}function sd(e,t){const n=Za(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function iE(e,t){let n=0;for(const i of t)i.id!==e.id&&sd(e,i)&&n++;return n}function ku(e,t){let n=0;for(const i of t)i.id!==e.id&&Za(e,i)&&n++;return n}const cd=15,ud=20;function rE(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-ud||t.at>n[1]+ud)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 Du=20;function Qa(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>ad)continue;const r=Math.max(e.lo,i.lo),o=Math.min(e.hi,i.hi);o-r<od||n.push([r-Du,o+Du])}return n}function Ja(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of _n(e)){const o=rE(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of Qa(r,_n(a)))if(Math.min(c,o[1])>Math.max(s,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const oE=1,aE=(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 sE(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 ld(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 cE=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,Lo=1;function Io(e,t){const n=e.x+Lo,i=e.x+e.width-Lo,r=e.y+Lo,o=e.y+e.height-Lo;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 Ou(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 pd(e,t){const n=e.label;if(!n)return null;if(_n(e).some(i=>Io(n,i)))return e.id;for(const i of[...t.edges].filter(r=>r.id!==e.id).sort((r,o)=>r.id.localeCompare(o.id)))if(_n(i).some(r=>Io(n,r)))return i.id;for(const i of t.shapes.filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(Ou(i).some(r=>Io(n,r)))return i.id;return null}function Hi(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(sE(e.waypoints[o],e.waypoints[o+1],r,nE)){i.push(r);break}}return i}function uE(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 fd=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function es(e,t){let n=0;for(const i of t){if(i.id===e.id||fd(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++)uE(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function No(e,t){let n=0;for(const i of t)i.id===e.id||fd(e,i)||es(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function dd(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++)es(n[i],[n[r]])>0&&(t+=n[i].type===n[r].type?2:1);return t}function Lu(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(es(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]}`))}const Yr=e=>e.shapes.filter(t=>!t.container);function lE(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 Iu(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 zi(e){const t=[],n=e.shapes.filter(a=>!a.container);for(const a of e.edges)for(const s of Hi(a,n))t.push({kind:"edge-crosses-shape",edge:a.id,shape:s.id});const i=n.filter(a=>!a.attached);for(let a=0;a<i.length;a++)for(let s=a+1;s<i.length;s++){const c=i[a],u=i[s];if(!ld(c,u,tE))continue;const l=c.id<u.id?[c.id,u.id]:[u.id,c.id];t.push({kind:"shape-overlap",shapes:l,identical:cE(c,u)})}for(let a=0;a<e.edges.length;a++)for(let s=a+1;s<e.edges.length;s++){const c=e.edges[a],u=e.edges[s],l=Za(c,u);if(!l)continue;const p=c.id<u.id?[c.id,u.id]:[u.id,c.id];t.push({kind:l.kind==="opposite"?"edge-overlap-opposite":"edge-overlap-mixed",edges:p,axis:l.axis,length:Math.round(l.length)})}for(const a of e.edges){if(!a.label)continue;const s=Ja(a,e.edges);s&&t.push({kind:"label-on-shared-segment",edge:a.id,other:s.other,axis:s.axis})}for(const a of e.edges){if(!a.label)continue;const s=pd(a,e);s&&t.push({kind:"label-over-line",edge:a.id,line:s})}const r=Iu(e);for(const a of n)if(a.type==="bpmn:TextAnnotation")for(const{owner:s,rect:c}of r)s!==a.id&&ld(a,c,Lo)&&t.push({kind:"annotation-over-label",annotation:a.id,label:s});const o=new Map(e.shapes.map(a=>[a.id,a]));for(const a of n){const s=a.parent??lE(a,e,o);if(!s)continue;const c=o.get(s);!c||!c.container||aE(c,a,oE)||t.push({kind:"shape-outside-container",shape:a.id,container:c.id})}return t.sort((a,s)=>Fi(a).localeCompare(Fi(s)))}const _t=e=>typeof e=="object"&&e!==null?e:void 0,mt=e=>typeof e=="number"?e:0,Er=e=>{const t=_t(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function pE(e){const t=_t(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=Er(o);a&&n.push(a)}}return n}function fE(e,t){const n=_t(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const r=Er(n);return r?t.get(r):void 0}if(Xa.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return Er(n)}function hd(e){var o,a,s,c,u;const t=[],n=[],i=((o=_t(e))==null?void 0:o.diagrams)??[],r=new Map;for(const l of((a=_t(e))==null?void 0:a.rootElements)??[]){const p=_t(l);if((p==null?void 0:p.$type)==="bpmn:Collaboration")for(const f of p.participants??[]){const d=_t(f),h=Er(d),m=Er(d==null?void 0:d.processRef);h&&m&&r.set(m,h)}}for(const l of i){const p=_t((s=_t(l))==null?void 0:s.plane),f=(p==null?void 0:p.planeElement)??[];for(const d of f){const h=_t(d);if(!h)continue;const m=_t(h.bpmnElement),g=typeof(m==null?void 0:m.id)=="string"?m.id:void 0;if(!g)continue;const S=typeof(m==null?void 0:m.$type)=="string"?m.$type:"",E=_t(h.bounds);if(E){const b=h.isExpanded===!1,w=_t((c=_t(h.label))==null?void 0:c.bounds);t.push({id:g,type:S,x:mt(E.x),y:mt(E.y),width:mt(E.width),height:mt(E.height),container:Xa.has(S)&&!b,attached:(m==null?void 0:m.attachedToRef)!==void 0,...m?{parent:fE(m,r)}:{},...w?{label:{x:mt(w.x),y:mt(w.y),width:mt(w.width),height:mt(w.height)}}:{}});continue}const x=h.waypoint;if(Array.isArray(x)){const b=_t((u=_t(h.label))==null?void 0:u.bounds);n.push({id:g,type:S,waypoints:x.map(w=>{var T,O;return{x:mt((T=_t(w))==null?void 0:T.x),y:mt((O=_t(w))==null?void 0:O.y)}}),endpoints:pE(m),...b?{label:{x:mt(b.x),y:mt(b.y),width:mt(b.width),height:mt(b.height)}}:{}})}}}return{shapes:t,edges:n}}function md(e){return zi(hd(e))}async function dE(e){const{definitions:t,warnings:n}=await Tu(e);return{findings:md(t),warnings:n}}function Tn(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=_t(r.label);n.push({id:r.id,type:o,waypoints:a.map(d=>({x:mt(d.x),y:mt(d.y)})),endpoints:[Er(r.source),Er(r.target)].filter(d=>!!d),...f&&typeof f.x=="number"?{label:{x:f.x,y:mt(f.y),width:mt(f.width),height:mt(f.height)}}:{}});continue}if(typeof r.x!="number"||typeof r.y!="number")continue;const s=_t(r.businessObject),c=_t(r.label);let u=_t(r.parent);for(;u&&u.type==="bpmn:Lane";)u=_t(u.parent);const l=typeof(u==null?void 0:u.type)=="string"?u.type:"",p=u&&Xa.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:mt(r.width),height:mt(r.height),container:Xa.has(o)&&r.collapsed!==!0,attached:(s==null?void 0:s.attachedToRef)!==void 0,...p!==void 0?{parent:p}:{},...c&&typeof c.x=="number"?{label:{x:c.x,y:mt(c.y),width:mt(c.width),height:mt(c.height)}}:{}})}return{shapes:t,edges:n}}const hE={"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 mE(e,t){const n=hE[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function gd(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function vd(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 mE(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&gd(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?gd(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 yd=20,gE=4,un=(e,t)=>Math.abs(e-t)<.5;function _d(e,t,n,i=yd){if(un(e.y,t.y)&&!un(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(un(e.x,t.x)&&!un(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 bd(e,t,n=yd){if(e.length!==4)return null;const[i,r,o,a]=e;if(un(i.y,r.y)&&un(r.x,o.x)&&un(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(un(i.x,r.x)&&un(r.y,o.y)&&un(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 xd(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 Ed=30,vE=[0,-25,25,-40,40];function yE(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+Ed:s-Ed,u=a?i.y+i.height:i.y,l=n.x+n.width/2,p=i.x+i.width/2;return vE.map(f=>[{x:l,y:s},{x:l,y:c},{x:p+f,y:c},{x:p+f,y:u}])}const _E=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],ts=(e,t,n)=>Hi({...e,waypoints:t},n).length;function wd(e,t,n,i){let r=[...e.waypoints],o=ts(e,r,t);if(o===0)return null;let a=!1;for(const p of xd(e,t))if(ts(e,p,t)===0)return p;const s=(i??[]).filter(p=>p.id!==e.id).flatMap(_n),c=p=>_n({...e,waypoints:p}).some(f=>Qa(f,s).length>0),u=yE(e,t).filter(p=>ts(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<gE&&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)||Hi({...e,waypoints:[h,m]},[g]).length===0)continue;const S=_d(h,m,g),E=S?S.map(b=>_E(r,d,b)):bd(r,g)??[];if(!E.length)continue;const x=[...E].sort((b,w)=>Number(l(w))-Number(l(b)));for(const b of x){const w=ts(e,b,t);if(w<o){r=b,o=w,f=!0,a=!0;break}}if(f)break}}if(!f)break}return a&&o===0?r:null}function Sd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Tn(n),o=Yr(r),a=zi(r).filter(c=>c.kind==="edge-crosses-shape"&&!t.has(Fi(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=wd(u,o,f,r.edges);d&&i.updateWaypoints(l,d)}}const bE=10;function Rd(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 Cd(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(H=>H.type==="bpmn:Participant"&&H.container),i=t.shapes.find(H=>H.id===e.endpoints[0]),r=t.shapes.find(H=>H.id===e.endpoints[1]);if(!i||!r)return null;const o=Rd(i,n),a=Rd(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(H=>H.id!==o.id&&H.id!==a.id&&H.y>=c.y+c.height&&H.y+H.height<=u.y).sort((H,ae)=>H.y-ae.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,S=e.waypoints[0],E=e.waypoints[e.waypoints.length-1],x=Yr(t),b=t.edges.filter(H=>H.id!==e.id),w=No(e,b),T=Hi(e,x).length;if(w===0&&T===0)return null;const O=Math.min(...l.map(H=>H.x)),P=Math.max(...l.map(H=>H.x+H.width)),j=(S.x+E.x)/2,F=H=>H.filter((ae,Ie)=>Ie===0||!(un(ae.x,H[Ie-1].x)&&un(ae.y,H[Ie-1].y)));let I;for(let H=O;H<=P;H+=bE){const ae=F([S,{x:S.x,y:m},{x:H,y:m},{x:H,y:g},{x:E.x,y:g},E]),Ie={...e,waypoints:ae};if(Hi(Ie,x).length>0)continue;const ot=No(Ie,b),X=Math.abs(H-j);(!I||ot<I.cross||ot===I.cross&&X<I.detour)&&(I={pts:ae,cross:ot,detour:X})}return I&&(T>0?I.cross<=w:I.cross<w)?I.pts:null}function Pd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Tn(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=Tn(n),s=a.edges.find(l=>l.id===o.id);if(!s)continue;const c=Cd(s,a);if(!c)continue;const u=n.get(o.id);u&&i.updateWaypoints(u,c)}}const Nu=[25,-25,40,-40],Ad=35;function xE(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-Ad:n.y+n.height+Ad,p=[];for(const f of[0,...Nu]){if(Math.abs(f)>=i.width/2-5)continue;const d=o+f;p.push({pts:[{x:n.x,y:r},{x:d,y:r},{x:d,y:c}],cost:Math.abs(f)});for(const h of[0,...Nu]){if(Math.abs(h)>=n.width/2-5)continue;const m=a+h;p.push({pts:[{x:m,y:u},{x:m,y:l},{x:d,y:l},{x:d,y:c}],cost:Math.abs(f)+Math.abs(h)})}}return p}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=un(n[0].x,n[1].x)&&!un(n[0].y,n[1].y),s=un(n[n.length-1].x,n[n.length-2].x)&&!un(n[n.length-1].y,n[n.length-2].y);for(const c of Nu){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 Td(e,t){const n=new Map(t.shapes.map(l=>[l.id,l])),i=Yr(t),r=t.edges.filter(l=>l.id!==e.id),o=ku(e,r);if(o===0)return null;const a=No(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=[...xE(e,n),...EE(e,n)];for(const{pts:l,cost:p}of u){const f={...e,waypoints:l};if(Hi(f,i).length>0)continue;const d=ku(f,r),h=No(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 Md(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Tn(i),a=zi(o).filter(l=>(l.kind==="edge-overlap-opposite"||l.kind==="edge-overlap-mixed")&&!t.has(Fi(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=Tn(i),f=p.edges.find(m=>m.id===l);if(!f)continue;const d=Td(f,p);if(!d)continue;const h=i.get(l);h&&r.updateWaypoints(h,d)}}const wE=10,SE=(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 kd(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!Ja(e,i))return null;const r=Yr(t),o=i.flatMap(_n);for(const a of _n(e)){let s=[[a.lo,a.hi]];for(const[d,h]of Qa(a,o))s=s.flatMap(([m,g])=>{const S=[];return d>m&&S.push([m,Math.min(g,d)]),h<g&&S.push([Math.max(m,h),g]),S.filter(([E,x])=>x>E)});const c=a.axis==="h"?n.width:n.height,u=s.find(([d,h])=>h-d>=c+wE*2);if(!u)continue;const l=(u[0]+u[1])/2,p=a.axis==="h"?{x:l,y:a.at-cd}:{x:a.at+Kr+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(!Ja({...e,label:f},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&SE(f,d)))return f}return null}const Kr=8;function Dd(e,t){const n=e.label;if(!n)return null;const i=_n(e);if(!i.length)return null;const r=n.x+n.width/2,o=n.y+n.height/2,a=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(_n),...t.shapes.filter(f=>f.container).flatMap(Ou)],u=f=>!c.some(d=>Io(f,d));if(u(n))return null;const l=(s.axis==="v"?n.height:n.width)+Kr,p=[0,-l,l,-2*l,2*l];if(s.axis==="v")for(const f of[s.at+Kr,s.at-Kr-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-Kr-n.height,s.at+Kr])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 Od(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Tn(n);for(const o of r.edges){if(!o.label||t.has(o.id))continue;const a=Dd(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 Ld(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Tn(i),a=zi(o).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(Fi(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=kd(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})}}const RE=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,Id=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),Nd={"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}]},ns=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Bu=e=>typeof e=="string"&&e!=="";function CE(e){const t=[];function n(i,r,o,a){if(a===null){Bu(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!ns(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)Bu(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{if(!ns(i)||!Bu(i.kind)||!(i.kind in Nd)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const o of Nd[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(!ns(u))break;u=u[p]}if(!ns(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 Bd(e,t){const n=CE(e);if(n.length>0)return n;const i=[],r=new Map,o=new Map;function a(f,d,h){if(!RE.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:S,name:E,condition:x}=f.flow,b=u(d,g,"source",["flowNode"]),w=u(d,S,"target",["flowNode"]);b&&w&&c(g)!==c(S)&&i.push({kind:"flow-cross-pool",opIndex:d,id:m}),E!==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:S}=f.flow,E=u(d,g,"source",["flowNode","participant"]),x=u(d,S,"target",["flowNode","participant"]);if(E&&x){const b=c(g),w=c(S);b!==void 0&&b===w&&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(E=>E===f.dataStore.id).length!==1){i.push({kind:"data-association-ends",opIndex:d,source:m.source,target:m.target});continue}const S=m.source===f.dataStore.id?m.target:m.source;u(d,S,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:m,target:g}=f.association,S=u(d,m,"source"),E=u(d,g,"target");if(S&&E){const x=new Set([S,E]);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:S}=f.association,E=u(d,g,"source"),x=u(d,S,"target");E&&x&&E!=="annotation"&&x!=="annotation"&&i.push({kind:"association-detached",opIndex:d,annotation:m??`${g}->${S}`});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 S=m===f.annotation.id?g:m;u(d,S,"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&&Id.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(E=>E.id);for(const E of m)g.includes(E)||i.push({kind:"lane-shrink-unsupported",opIndex:d,participant:f.id,lane:E});for(const E of g)t.categoryOf(E)!==void 0&&!m.includes(E)&&i.push({kind:"id-duplicate",opIndex:d,id:E});const S=g.filter(E=>m.includes(E));S.length===m.length&&S.some((E,x)=>E!==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,S=t.endpointsOf(f.id),E=f.source??(S==null?void 0:S.source),x=f.target??(S==null?void 0:S.target);m&&g&&E!==void 0&&x!==void 0&&new Set([c(E),c(x),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&&Id.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 Xr={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},PE=/[ᄀ-ᇿ -〿぀-ヿ㐀-鿿가-힯＀-⦆]/;function AE(e){const t=Xr;return PE.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 Bo(e,t){let n=0;for(const i of e)n+=t*AE(i);return n}function $d(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&TE(e),ME(e),kE(e),DE(e)}function TE(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:Bo(r,o),fontBoundingBoxAscent:o*Xr.ascentEm,fontBoundingBoxDescent:o*Xr.descentEm,actualBoundingBoxAscent:o*Xr.ascentEm,actualBoundingBoxDescent:o*Xr.descentEm}}};t.getContext=()=>n}function ME(e){if(e.SVGMatrix)return;class t{constructor(){Hr(this,"a",1);Hr(this,"b",0);Hr(this,"c",0);Hr(this,"d",1);Hr(this,"e",0);Hr(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 kE(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 DE(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:Bo(n,12),height:14}})}function jd(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 is(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const $u={"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 Gt(e,t){return e.filter(n=>n.kind===t)}function Fd(e,t){var tx,nx,ix,rx,ox;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:s,bpmnReplace:c}=t,u=()=>a.getRootElement(),l=R=>o.get(R),p=R=>{const A=l(R);if(!A)throw new Error(`하강 참조 해소 실패: ${R}`);return A},f=R=>{let A=R.parent;for(;A;){if(A.type==="bpmn:Participant")return A;A=A.parent}},d=Gt(e,"participant.add"),h=Gt(e,"node.add"),m=Gt(e,"sequenceFlow.add"),g=Gt(e,"messageFlow.add"),S=Gt(e,"dataStore.add"),E=Gt(e,"dataAssociation.add"),x=Gt(e,"annotation.add"),b=Gt(e,"group.add"),w=new Map(h.map(R=>[R.node.id,R])),T=(R,A,N)=>{var Ve;const q=R.businessObject,Y=(((Ve=q.extensionElements)==null?void 0:Ve.values)??[]).filter(ue=>ue.$type!==A),z=N?[...Y,i.create(A,N)]:Y;if(!z.length){q.extensionElements&&n.updateProperties(R,{extensionElements:void 0});return}const Z=i.create("bpmn:ExtensionElements",{values:z});z.forEach(ue=>{ue.$parent=Z}),n.updateProperties(R,{extensionElements:Z})},O=R=>({anchor:R.anchor,side:R.side,...R.offset!==void 0?{offset:R.offset}:{}});for(const R of Gt(e,"element.remove")){const A=l(R.id);A&&n.removeElements([A])}const P=R=>o.filter(A=>{var N;return A.type==="bpmn:Lane"&&((N=f(A))==null?void 0:N.id)===R}).sort((A,N)=>A.y-N.y);for(const R of Gt(e,"participant.update")){const A=p(R.id);if(R.name!==void 0&&n.updateProperties(A,{name:R.name??void 0}),!R.lanes)continue;const N=P(R.id);if(!N.length){n.splitLane(A,R.lanes.length),P(R.id).forEach((Y,z)=>{const Z=R.lanes[z];Z&&n.updateProperties(Y,{id:Z.id,name:Z.name})});continue}const q=new Set(N.map(Y=>Y.id));R.lanes.forEach((Y,z)=>{if(q.has(Y.id)){n.updateProperties(p(Y.id),{name:Y.name});return}const Z=z===0?n.addLane(P(R.id)[0],"top"):n.addLane(p(R.lanes[z-1].id),"bottom");n.updateProperties(Z,{id:Y.id,name:Y.name})})}const j=150,F=80,I=90,H=180,ae=new Set;for(const R of d){ae.add(`pool:${R.participant.id}`);for(const A of R.participant.lanes??[])ae.add(A.id)}const Ie=new Map;for(const R of h){const A=R.node.lane??`pool:${R.node.participant??""}`;let N=Ie.get(A);N||Ie.set(A,N=new Set([0])),R.band!==void 0&&N.add(R.band)}const ot=new Map;for(const[R,A]of Ie){if(!ae.has(R))continue;const N=[...A].sort((z,Z)=>z-Z),q=N.map((z,Z)=>Z===0?0:Z%2===1?Math.ceil(Z/2):-(Z/2)),Y=Math.min(...q);ot.set(R,new Map(N.map((z,Z)=>[z,q[Z]-Y])))}{const R=new Map;for(const A of d)(A.participant.lanes??[]).forEach((N,q)=>R.set(N.id,q));for(const[A,N]of ot){if(!R.has(A)||N.size<2)continue;const q=R.get(A),Y=N.get(0)??0,z=new Set;for(const Fe of h){if(Fe.node.lane!==A||(Fe.band??0)!==0||!Fe.node.type.endsWith("Gateway"))continue;const De={in:new Set,out:new Set,cross:new Set};for(const at of m){const zt=at.flow.source===Fe.node.id;if(!zt&&at.flow.target!==Fe.node.id)continue;const on=w.get(zt?at.flow.target:at.flow.source);if(!on||on.node.participant!==Fe.node.participant||!on.node.lane)continue;let Xn,an=!1;if(on.node.lane!==A){const In=R.get(on.node.lane);if(In===void 0)continue;Xn=In>q?"down":"up",an=!0}else{const In=N.get(on.band??0)??Y;Xn=In>Y?"down":In<Y?"up":void 0}Xn&&(De[zt?"out":"in"].add(Xn),an&&De.cross.add(Xn))}for(const at of["up","down"])De.in.has(at)&&De.out.has(at)&&De.cross.has(at)&&z.add(at)}if(z.size!==1)continue;const[Z]=z,Ve=Math.max(...N.values()),ue=Z==="down"?Ve:0;if(Y===ue)continue;const ke=[...N.entries()].filter(([Fe])=>Fe!==0).sort((Fe,De)=>Fe[1]-De[1]),nt=[...Array(Ve+1).keys()].filter(Fe=>Fe!==ue),Et=new Map([[0,ue]]);ke.forEach(([Fe],De)=>Et.set(Fe,nt[De])),ot.set(A,Et)}}const X=R=>{var A;return(((A=Ie.get(R))==null?void 0:A.size)??0)>1},oe=R=>R.band??(R.node.lane||!X(`pool:${R.node.participant??""}`)?void 0:0),me=new Map,se=R=>me.get(R.node.id)??oe(R),le=(R,A)=>{var N;return((N=ot.get(R))==null?void 0:N.get(A))??A},J=new Map;for(const[R,A]of Ie){let N=0;for(const q of A)N=Math.max(N,le(R,q));J.set(R,N)}const $=R=>H+j*R,B=d.map((R,A)=>({op:R,declared:A}));B.sort((R,A)=>{const N=R.op.order??Number.POSITIVE_INFINITY,q=A.op.order??Number.POSITIVE_INFINITY;return N!==q?N-q:R.declared-A.declared});let G=80;for(const R of o.getAll())R.parent===u()&&"height"in R&&typeof R.y=="number"&&(G=Math.max(G,R.y+R.height+60));for(const{op:R}of B){const A=R.participant,N=h.filter(Fe=>Fe.node.participant===A.id).length,q=((tx=A.lanes)==null?void 0:tx.length)??0,Y=Math.max(1200,N*160+300),z=(A.lanes??[]).map(Fe=>$(J.get(Fe.id)??0)),Z=z.reduce((Fe,De)=>Fe+De,0);q&&Z<300&&(z[q-1]+=300-Z);const Ve=Math.max(300,j*((J.get(`pool:${A.id}`)??0)+1)),ue=A.blackBox||N+q===0?120:q?Math.max(300,Z):Ve,ke=r.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:A.id,name:A.name,...R.order!==void 0?{"bwl:poolOrder":R.order}:{},...A.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:Y,height:ue,isExpanded:!0}),nt=n.createShape(ke,{x:100+Y/2,y:G+ue/2},u()),Et=A.lanes??[];if(Et.length&&n.splitLane(nt,Et.length),Et.length){const Fe=o.filter(De=>{var at;return De.type==="bpmn:Lane"&&((at=f(De))==null?void 0:at.id)===A.id}).sort((De,at)=>De.y-at.y);if(Fe.forEach((De,at)=>{const zt=Et[at];zt&&n.updateProperties(De,{id:zt.id,name:zt.name})}),z.some(De=>De!==nt.height/q)){let De=nt.y;Fe.forEach((at,zt)=>{const on=z[zt];n.resizeShape(at,{x:at.x,y:De,width:at.width,height:on}),De+=on})}}G=nt.y+nt.height+60}const Pe=R=>{var q;const A=w.get(R);if(A)return A.node.participant??"";const N=l(R);return N?N.type==="bpmn:Participant"?N.id:((q=f(N))==null?void 0:q.id)??"":""},xt=new Map,C=R=>{let A=xt.get(R);return A||xt.set(R,A={nodes:[],flows:[]}),A};for(const R of h)C(R.node.participant??"").nodes.push(R);for(const R of m)C(Pe(R.flow.source)).flows.push(R);const _=R=>{var A;return i.create("bpmn:SequenceFlow",{id:R.id,name:R.name??((A=R.condition)==null?void 0:A.label)})},v=(R,A)=>r.createShape({type:is(R.type),businessObject:i.create(is(R.type),{id:R.id,name:R.name,...A!==void 0?{"bwl:band":A}:{}})}),k=[...B.map(({op:R})=>R.participant.id).filter(R=>xt.has(R)),...[...xt.keys()].filter(R=>!d.some(A=>A.participant.id===R))],L=R=>R.endsWith("Gateway");for(const R of k){const A=xt.get(R),N=R?p(R):void 0,q=N?N.x+150:250;let Y=N?N.y+80:120;const z=(ne,fe,ce)=>{const Ke=u().children.filter(Ge=>!("waypoints"in Ge&&Ge.waypoints)&&Ge.id!==fe&&typeof Ge.y=="number"&&Ge.y>=ne);Ke.length&&n.moveElements(Ke,{x:0,y:ce})},Z=(ne,fe)=>{if(ne){const Se=p(ne),We=$(fe);if(Se.height>=We)return;const he=We-Se.height,He=f(Se),Ne=He?He.y+He.height:Se.y+Se.height;n.resizeLane(Se,{x:Se.x,y:Se.y,width:Se.width,height:We},!1),z(Ne,He==null?void 0:He.id,he);return}if(!N)return;const ce=j*(fe+1);if(N.height>=ce)return;const Ke=ce-N.height,Ge=N.y+N.height;n.resizeShape(N,{x:N.x,y:N.y,width:N.width,height:ce}),z(Ge,N.id,Ke)},Ve=(ne,fe,ce)=>{if(ne){const Ke=p(ne);return Ke.y+Math.min(Ke.height/2,I)+le(ne,fe??0)*j}return fe!==void 0&&N?N.y+F+le(`pool:${R}`,fe)*j:ce},ue=(ne,fe,ce)=>{if(ne){const Ke=p(ne);return Ke.y+Math.min(Ke.height/2,I)+fe*j}return N?N.y+F+fe*j:ce},ke=ne=>ne.participant?p(ne.participant):u(),nt=30,Et=(ne,fe,ce,Ke)=>{const Ge=ce-fe.width/2,Se=Ke-fe.height/2;return(ne.children??[]).find(We=>!("waypoints"in We&&We.waypoints)&&We.type!=="bpmn:Lane"&&We.type!=="label"&&typeof We.x=="number"&&Ge<We.x+We.width+nt&&Ge+fe.width+nt>We.x&&Se<We.y+We.height&&Se+fe.height>We.y)},Fe=(ne,fe,ce,Ke,Ge,Se)=>{const We=ce!==void 0||Ke!==void 0,he=le(ce??`pool:${R}`,Ke??0);if(We)for(let Ue=0;Ue<4;Ue++){const yt=ue(ce,he+Ue,Se);if(!Et(ne,fe,Ge,yt))return Z(ce,he+Ue),{x:Ge,y:yt}}const He=Ve(ce,Ke,Se);We&&Z(ce,he);let Ne=Ge;for(let Ue=0;Ue<64;Ue++){const yt=Et(ne,fe,Ne,He);if(!yt)break;Ne=yt.x+yt.width+130+fe.width/2}return{x:Ne,y:He}},De=new Set(A.flows.map(ne=>ne.flow.target)),at=new Map;for(const ne of A.nodes){if(De.has(ne.node.id))continue;const fe=v(ne.node,ne.band),ce=oe(ne),Ke=ne.node.lane?`${ne.node.lane}|${ce??""}`:ce!==void 0?`band:${ce}`:"",Ge=ke(ne.node),Se=Fe(Ge,fe,ne.node.lane,ce,at.get(Ke)??q,Y);n.createShape(fe,Se,Ge),at.set(Ke,Se.x+fe.width+130),!ne.node.lane&&ce===void 0&&(Y+=160)}const zt=new Set,on=new Map,Xn=new Map,an=new Map;if(R&&ae.has(`pool:${R}`)){const ne=new Map;for(const he of A.flows)ne.set(he.flow.target,(ne.get(he.flow.target)??0)+1);const fe=he=>Ve(he.node.lane,se(he),Number.NaN),ce=new Set,Ke=he=>{var Ue;const He=(Ue=w.get(he))==null?void 0:Ue.node.participant;if(He)return l(He);const Ne=l(he);if(Ne)return Ne.type==="bpmn:Participant"?Ne:f(Ne)},Ge=he=>{const He=[],Ne=new Set([he]),Ue=[he];for(;Ue.length;){const yt=Ue.shift(),st=w.get(yt);st&&He.push(st);for(const Ae of A.flows)Ae.flow.source!==yt||Ne.has(Ae.flow.target)||(ne.get(Ae.flow.target)??0)!==1||(Ne.add(Ae.flow.target),Ue.push(Ae.flow.target))}return He},Se=he=>{if(!N)return;const He=new Set(he.map(yt=>yt.node.id));let Ne=!1,Ue=!1;for(const yt of g){if(!He.has(yt.flow.source))continue;const st=Ke(yt.flow.target);!st||st.id===N.id||(st.y<N.y?Ne=!0:Ue=!0)}return Ne&&!Ue?"up":Ue&&!Ne?"down":void 0};for(const he of A.nodes){if(!L(he.node.type))continue;const He=Ve(he.node.lane,oe(he),Number.NaN);if(Number.isNaN(He))continue;const Ne=[];for(const Ae of A.flows){if(Ae.flow.source!==he.node.id)continue;const qe=w.get(Ae.flow.target);if(!qe||qe.node.lane!==he.node.lane||(ne.get(qe.node.id)??0)!==1)continue;const ct=oe(qe);if(ct===void 0)continue;const sn=Ve(qe.node.lane,ct,Number.NaN);if(Number.isNaN(sn))continue;const uu=Ge(qe.node.id),lu=Se(uu);lu&&Ne.push({subtree:uu,band:ct,row:sn,dir:lu})}if(!Ne.some(Ae=>Ae.dir==="up")||!Ne.some(Ae=>Ae.dir==="down")||!Ne.some(Ae=>Ae.dir==="up"&&Ne.some(qe=>qe.dir==="down"&&qe.row<Ae.row)))continue;const yt=[...Ne].sort((Ae,qe)=>Ae.row-qe.row);[...Ne.filter(Ae=>Ae.dir==="up"),...Ne.filter(Ae=>Ae.dir==="down")].sort((Ae,qe)=>Ae.dir===qe.dir?Ae.row-qe.row:Ae.dir==="up"?-1:1).forEach((Ae,qe)=>{const ct=yt[qe].band;if(ct!==Ae.band){ce.add(he.node.id);for(const sn of Ae.subtree)oe(sn)===Ae.band&&me.set(sn.node.id,ct)}})}for(const he of A.nodes){if(!L(he.node.type))continue;const He=fe(he);if(Number.isNaN(He)||x.some(Ae=>{var qe,ct;return(((qe=Ae.placement)==null?void 0:qe.anchor)??(Ae.association?Ae.association.source===Ae.annotation.id?Ae.association.target:Ae.association.source:void 0))===he.node.id&&((ct=Ae.placement)==null?void 0:ct.side.startsWith("bottom"))}))continue;let Ue,yt=!1,st;for(const Ae of A.flows){if(Ae.flow.source!==he.node.id)continue;const qe=w.get(Ae.flow.target);if(!qe||!qe.node.lane&&oe(qe)===void 0)continue;const ct=fe(qe);Number.isNaN(ct)||(Math.abs(ct-He)<.5&&(yt=!0),ct>He?!Ue||ct>Ue.row?Ue={id:qe.node.id,row:ct,count:1}:ct===Ue.row&&Ue.count++:ct<He&&qe.node.lane===he.node.lane&&(!st||ct>st.row?st={op:qe,row:ct,count:1}:ct===st.row&&st.count++))}Ue&&Ue.count===1&&(ne.get(Ue.id)??0)===1&&!ce.has(he.node.id)&&zt.add(Ue.id),!yt&&st&&st.count===1&&(ne.get(st.op.node.id)??0)===1&&on.set(st.op.node.id,{lane:he.node.lane,band:se(he)})}const We=new Map;for(const he of g)We.set(he.flow.target,[...We.get(he.flow.target)??[],he]);for(const he of A.nodes){const He=We.get(he.node.id);if(!He||He.length!==1||!ne.get(he.node.id)||!he.node.lane&&oe(he)===void 0)continue;const Ne=(nx=w.get(He[0].flow.source))==null?void 0:nx.node.participant,Ue=Ne?l(Ne):void 0;if(!Ue||!N||Ue.id===N.id)continue;const yt=he.node.lane??`pool:${R}`,st=ot.get(yt);if(!st)continue;const Ae=st.get(0)??0,qe=(st.get(se(he)??0)??Ae)-Ae;if(qe===0)continue;const ct=Ue.y<N.y;if(ct&&qe<0||!ct&&qe>0)continue;let sn;for(const[uu,lu]of st){const Ha=lu-Ae;(ct&&Ha<0&&(!sn||Ha<sn.row)||!ct&&Ha>0&&(!sn||Ha>sn.row))&&(sn={band:uu,row:Ha})}sn&&Xn.set(he.node.id,{lane:he.node.lane,band:sn.band})}}const In=new Set;let cu=0;for(;cu++<A.nodes.length+2;){for(let ce=0;ce<A.nodes.length+A.flows.length+2;ce++){let Ke=!1;for(const Ge of A.flows){const Se=Ge.flow;if(In.has(Se.id))continue;const We=l(Se.source);if(!We)continue;const he=l(Se.target),He=w.get(Se.target);if(!he&&He){const Ne=v(He.node,He.band),Ue=se(He);if(He.node.lane||Ue!==void 0){const yt=ke(He.node),st=We,Ae=st.x+(an.get(Se.source)??0)+st.width+130,qe=on.get(Se.target)??Xn.get(Se.target),ct=Fe(yt,Ne,qe?qe.lane:He.node.lane,qe?qe.band:Ue,zt.has(Se.target)?st.x+st.width/2:Ae,Number.NaN),sn=n.createShape(Ne,ct,yt);zt.has(Se.target)&&an.set(Se.target,Ae-(sn.x+sn.width/2)),n.connect(We,sn,{type:"bpmn:SequenceFlow",businessObject:_(Se)})}else s.append(We,Ne,{connection:{type:"bpmn:SequenceFlow",businessObject:_(Se)}})}else if(he)n.connect(We,he,{type:"bpmn:SequenceFlow",businessObject:_(Se)});else continue;In.add(Se.id),Ke=!0}if(!Ke)break}const ne=A.nodes.filter(ce=>!l(ce.node.id));if(!ne.length)break;const fe=ne[0];{const ce=v(fe.node,fe.band),Ke=ke(fe.node),Ge=oe(fe);n.createShape(ce,Fe(Ke,ce,fe.node.lane,Ge,q,Y),Ke),!fe.node.lane&&Ge===void 0&&(Y+=160)}}}const V=40,te=(R,A=()=>!0)=>{const N=l(R);if(!N)return[];const q=[N],Y=new Set([R]);for(let z=0;z<q.length;z++){const Z=q[z].id;for(const Ve of m){const ue=Ve.flow.target;if(Ve.flow.source!==Z||Y.has(ue)||!w.has(ue))continue;Y.add(ue);const ke=l(ue);ke&&A(ke)&&q.push(ke)}}return q};for(const R of Gt(e,"sequenceFlow.update")){if(R.target===void 0)continue;const A=w.get(R.target);if(!A)continue;const N=l(R.target),q=l(R.id);if(!N||!q)continue;const Y=R.source!==void 0?l(R.source):q.source,z=q.target;if(!Y||!z||z.id===N.id)continue;const Z=te(R.target),Ve=new Set(Z.map(De=>De.id)),ue=Math.min(...Z.map(De=>De.x)),ke=Math.max(...Z.map(De=>De.x+De.width)),nt=Y.x+Y.width,Et=ke-ue+V*2-(z.x-nt);if(Et>0){const De=f(N),at=(De==null?void 0:De.children)??[],zt=an=>an.type==="bpmn:Lane",on=at.filter(an=>!("waypoints"in an&&an.waypoints)&&!zt(an)&&!Ve.has(an.id)&&an.x>=z.x),Xn=De?[De,...at.filter(an=>zt(an))]:[];on.length&&n.createSpace(on,Xn,{x:Et,y:0},"e",z.x-1)}const Fe=A.node.lane||A.band!==void 0?N.y+N.height/2:Y.y+Y.height/2;n.moveElements(Z,{x:nt+V-ue,y:Fe-(N.y+N.height/2)})}const we=(R,A)=>{const N=A.target===R,q=p(A.source),Y=p(A.target),z=N?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(q,Y,A.id?{type:z,businessObject:i.create(z,{id:A.id})}:{type:z})};for(const R of S){const A=R.associations??[],N=A.map(z=>z.source===R.dataStore.id?z.target:z.source).map(l).find(Boolean),q=N?f(N)??u():u(),Y=N?{x:N.x+N.width/2,y:N.y+N.height+110}:{x:200,y:G+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:R.dataStore.id,name:R.dataStore.name})},Y,q);for(const z of A)we(R.dataStore.id,z)}for(const R of E){const N=p(R.association.target).type==="bpmn:DataStoreReference"?R.association.target:R.association.source;we(N,R.association)}for(const R of g){const A=R.flow;n.connect(p(A.source),p(A.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:A.id,name:A.name})})}const je=100,vt=30,Ze=4,$t=R=>!("waypoints"in R&&R.waypoints)&&R.type!=="bpmn:Lane"&&R.type!=="label"&&typeof R.x=="number",Mt=()=>{const R=Tn(o);return{bad:zi(R).filter(A=>A.kind==="edge-crosses-shape"||A.kind==="edge-overlap-opposite"||A.kind==="edge-overlap-mixed").length,crossings:dd(R),straight:R.edges.filter(A=>A.type==="bpmn:MessageFlow"&&A.waypoints.length===2).length}},nn=R=>{const A=Tn(o),N=A.edges.find(q=>q.id===R);return!!N&&Hi(N,Yr(A)).length>0},tt=(R,A,N)=>{const q=new Set(R.map(ke=>ke.id)),Y=(A.children??[]).filter($t).filter(ke=>!q.has(ke.id));if(R.some(ke=>Y.some(nt=>ke.x+N<nt.x+nt.width+vt&&ke.x+N+ke.width+vt>nt.x&&ke.y<nt.y+nt.height&&ke.y+ke.height>nt.y)))return null;const Z=A.width;n.moveElements(R,{x:N,y:0});const ue=Math.max(...R.map(ke=>ke.x+ke.width))+150-(A.x+A.width);return ue>0&&n.resizeShape(A,{x:A.x,y:A.y,width:A.width+ue,height:A.height}),()=>{n.moveElements(R,{x:-N,y:0}),ue>0&&n.resizeShape(A,{x:A.x,y:A.y,width:Z,height:A.height})}},kt=(R,A)=>A.bad>R.bad||A.crossings>R.crossings&&A.straight<=R.straight,rn=(R,A,N,q=()=>!0)=>{const Y=Mt(),z=tt(R,A,N);if(!z)return!1;const Z=Mt();return kt(Y,Z)||!q()?(z(),!1):!0},Fr=R=>{var N;const A=(N=w.get(R))==null?void 0:N.node.participant;return!!A&&ae.has(`pool:${A}`)},fn=new Map;for(const R of g){if(!Fr(R.flow.target))continue;const A=fn.get(R.flow.target)??[];A.push(R),fn.set(R.flow.target,A)}const Kn=[...fn.keys()],On=new Set(m.map(R=>R.flow.target)),Dt=R=>B.findIndex(({op:A})=>A.participant.id===R);Kn.sort((R,A)=>{var Y,z;const N=On.has(R)?1:0,q=On.has(A)?1:0;return N!==q?N-q:Dt((Y=w.get(R))==null?void 0:Y.node.participant)-Dt((z=w.get(A))==null?void 0:z.node.participant)});const ei=R=>R.x+R.width/2,ja=R=>{let A;for(const N of fn.get(R)??[]){const q=l(N.flow.source);if(!q)continue;const Y=ei(q);(!A||Y>A.cx)&&(A={op:N,cx:Y})}return A==null?void 0:A.op},Ln=R=>{const A=ja(R),N=l(R),q=A?l(A.flow.source):void 0;return N&&q?ei(q)-ei(N):void 0},ze=R=>{const A=Ln(R);return A!==void 0&&Math.abs(A)<je},Ye=R=>{const A=ja(R);if(!A)return null;const N=l(R),q=l(A.flow.source);if(!N||!q)return null;const Y=ei(q)-ei(N);if(Y>=je){const z=p(w.get(R).node.participant);return{subtree:te(R,Z=>Z.x>=N.x),pool:z,dx:Y}}if(-Y>=je&&Fr(A.flow.source)){const z=p(w.get(A.flow.source).node.participant);return{subtree:te(A.flow.source,Z=>Z.x>=q.x&&!ze(Z.id)),pool:z,dx:-Y}}return null},Xb=()=>Kn.map(R=>({id:R,plan:Ye(R)})).filter(R=>!!R.plan).sort((R,A)=>Math.min(...R.plan.subtree.map(N=>N.x))-Math.min(...A.plan.subtree.map(N=>N.x))).map(R=>R.id);for(let R=0;R<3;R++){const A=Mt(),N=[];for(const Y of Xb()){const z=Ye(Y);if(!z)continue;const Z=tt(z.subtree,z.pool,z.dx);Z&&N.push(Z)}if(!N.length)break;if(!kt(A,Mt()))continue;for(const Y of N.reverse())Y();let q=!1;for(const Y of Xb()){const z=Ye(Y);z&&rn(z.subtree,z.pool,z.dx)&&(q=!0)}if(!q)break}for(const R of Kn.flatMap(A=>fn.get(A)??[])){if(!nn(R.flow.id))continue;const A=l(R.flow.target);if(!A)continue;const N=p(w.get(R.flow.target).node.participant),q=te(R.flow.target,z=>z.x>=A.x),Y=A.width+130;for(let z=1;z<=Ze&&!rn(q,N,Y*z,()=>!nn(R.flow.id));z++);}{const A=q=>q.y+q.height/2,N=[];for(const[q,Y]of w){const z=Y.node.participant;if(!z||!ae.has(`pool:${z}`))continue;const Z=m.filter(ke=>ke.flow.target===q);if(Z.length!==1)continue;const Ve=l(Z[0].flow.source),ue=l(q);!Ve||!ue||!w.has(Ve.id)||Math.abs(A(Ve)-A(ue))>1||ue.x-(Ve.x+Ve.width)<=131||N.push({id:q,pred:Ve,node:ue})}N.sort((q,Y)=>q.node.x-Y.node.x);for(const{id:q}of N){const Y=w.get(q),z=l(q),Z=l(m.find(De=>De.flow.target===q).flow.source);if(!z||!Z)continue;const Ve=z.x-(Z.x+Z.width);if(Ve<=131)continue;const ue=p(Y.node.participant),ke=te(q,De=>De.x>=z.x),nt=Mt(),Et=tt(ke,ue,-(Ve-130));if(!Et)continue;const Fe=Mt();(Fe.bad>nt.bad||Fe.crossings>=nt.crossings)&&Et()}}let Zb=0;for(const R of b){const A=(R.group.members??[]).map(l).filter(z=>!!z),N=40;let q;if(A.length){const z=Math.min(...A.map(ke=>ke.x))-N,Z=Math.min(...A.map(ke=>ke.y))-N,Ve=Math.max(...A.map(ke=>ke.x+ke.width))+N,ue=Math.max(...A.map(ke=>ke.y+ke.height))+N;q={x:z,y:Z,width:Ve-z,height:ue-Z}}else q={x:300+Zb*350,y:40,width:300,height:200},Zb++;const Y=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:R.group.id}),width:q.width,height:q.height},{x:q.x+q.width/2,y:q.y+q.height/2},u());R.group.name&&n.updateLabel(Y,R.group.name),(ix=R.group.members)!=null&&ix.length&&T(Y,"bwl:Members",{refs:R.group.members.join(" ")})}const Qb=R=>{const A=R.waypoints;if(A!=null&&A.length){const q=A[Math.floor((A.length-1)/2)];return{x:q.x,y:q.y,width:0,height:0}}const N=R;return{x:N.x,y:N.y,width:N.width,height:N.height}};let Fa=0;const Jb=12,ex=14,_D=15,bD=300,xD=R=>{const A=R.split(`
7
- `),N=Math.max(...A.map(z=>Bo(z,Jb))),q=Math.max(100,Math.min(bD,Math.ceil(N)+ex)),Y=A.reduce((z,Z)=>z+Math.max(1,Math.ceil((Bo(Z,Jb)+ex)/q)),0);return{width:q,height:Math.max(30,Y*_D+10)}},Kt=10;for(const R of x){const A=R.association,N=((rx=R.placement)==null?void 0:rx.anchor)??(A?A.source===R.annotation.id?A.target:A.source:void 0),q=N?l(N):void 0,Y=q?Qb(q):void 0,z=xD(R.annotation.text??"");let Z;if(Y&&R.placement){const[nt,Et]=$u[R.placement.side],Fe=R.placement.offset??50;Z={x:Y.x+Y.width/2+nt*(Y.width/2+z.width/2+Fe),y:Y.y+Y.height/2+Et*(Y.height/2+z.height/2+Fe)}}else Y?(Z={x:Y.x+Y.width/2+180+Fa%3*260,y:Y.y-110-Fa%2*95},Fa++):(Z={x:300+Fa*260,y:60},Fa++);const Ve=q?f(q)??u():u(),ue=Ve;if(Y&&typeof ue.x=="number"&&typeof ue.width=="number"&&ue.type==="bpmn:Participant"){const nt=(ne,fe)=>{const[ce,Ke]=$u[ne];let Ge={x:Y.x+Y.width/2+ce*(Y.width/2+z.width/2+fe),y:Y.y+Y.height/2+Ke*(Y.height/2+z.height/2+fe)};const Se=ue.x+Kt+z.width/2,We=ue.x+ue.width-Kt-z.width/2,he=ue.y+Kt+z.height/2,He=ue.y+ue.height-Kt-z.height/2,Ne={x:Math.min(We,Math.max(Se,Ge.x)),y:Math.min(He,Math.max(he,Ge.y))};return(Ne.x!==Ge.x||Ne.y!==Ge.y)&&(Ge=Math.abs(Ne.x-(Y.x+Y.width/2))<(Y.width+z.width)/2+Kt&&Math.abs(Ne.y-(Y.y+Y.height/2))<(Y.height+z.height)/2+Kt?{x:Y.x+Y.width+Kt+z.width/2,y:Ne.y}:Ne),Ge},Et=(ue.children??[]).filter(ne=>!("waypoints"in ne&&ne.waypoints)&&ne.type!=="bpmn:Lane"&&ne.type!=="label"&&typeof ne.x=="number"),Fe=Tn(o),De=Fe.edges.flatMap(_n),at=Iu(Fe).map(ne=>ne.rect),zt=ne=>({x0:ne.x-z.width/2-Kt,x1:ne.x+z.width/2+Kt,y0:ne.y-z.height/2-Kt,y1:ne.y+z.height/2+Kt}),on=ne=>{const fe=zt(ne);return Et.some(ce=>fe.x0<ce.x+ce.width&&fe.x1>ce.x&&fe.y0<ce.y+ce.height&&fe.y1>ce.y)},Xn=ne=>{const fe=zt(ne);return De.some(ce=>ce.axis==="h"?ce.at>fe.y0&&ce.at<fe.y1&&ce.lo<fe.x1&&ce.hi>fe.x0:ce.at>fe.x0&&ce.at<fe.x1&&ce.lo<fe.y1&&ce.hi>fe.y0)},an=ne=>{const fe=zt(ne);return at.some(ce=>fe.x0<ce.x+ce.width&&fe.x1>ce.x&&fe.y0<ce.y+ce.height&&fe.y1>ce.y)},In=ne=>on(ne)||Xn(ne)||an(ne),cu=ne=>ne.x-z.width/2>=ue.x&&ne.x+z.width/2<=ue.x+ue.width&&ne.y-z.height/2>=ue.y&&ne.y+z.height/2<=ue.y+ue.height;if(R.placement){const ne=Se=>Se.startsWith("top")?Se.replace(/^top/,"bottom"):Se.replace(/^bottom/,"top"),fe=Se=>Se.endsWith("left")?Se.replace(/left$/,"right"):Se.replace(/right$/,"left"),ce=R.placement.side,Ke=[ce,ne(ce),fe(ce),ne(fe(ce)),"top","bottom","right","left","top-right","top-left","bottom-right","bottom-left"],Ge=R.placement.offset??50;if(Z=nt(ce,Ge),In(Z)){const Se=new Set;for(const We of Ke){if(Se.has(We))continue;Se.add(We);const he=nt(We,Ge);if(cu(he)&&!In(he)){Z=he;break}}}}else{const ne=ue.x+Kt+z.width/2,fe=ue.x+ue.width-Kt-z.width/2,ce=ue.y+Kt+z.height/2,Ke=ue.y+ue.height-Kt-z.height/2;if(Z={x:Math.min(fe,Math.max(ne,Z.x)),y:Math.min(Ke,Math.max(ce,Z.y))},In(Z)){const Ge=(Y.width+z.width)/2+Kt,We=[{x:Z.x+Ge,y:Z.y},{x:Z.x-Ge,y:Z.y},{x:Z.x,y:Z.y-z.height-Kt},{x:Z.x,y:Z.y+z.height+Kt}].filter(cu).find(he=>!In(he));We&&(Z=We)}}}const ke=n.createShape({type:"bpmn:TextAnnotation",width:z.width,height:z.height,businessObject:i.create("bpmn:TextAnnotation",{id:R.annotation.id,text:R.annotation.text})},Z,Ve);if(A){const nt=Et=>Et===R.annotation.id?ke:p(Et);n.connect(nt(A.source),nt(A.target),A.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:A.id})}:{type:"bpmn:Association"})}R.placement&&T(ke,"bwl:Placement",O(R.placement))}for(const R of Gt(e,"association.add")){const A=R.association;n.connect(p(A.source),p(A.target),A.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:A.id})}:{type:"bpmn:Association"})}for(const R of Gt(e,"node.update")){let A=p(R.id);if(R.type&&is(R.type)!==A.type&&(A=c.replaceElement(A,{type:is(R.type)})),R.name!==void 0&&n.updateProperties(A,{name:R.name??void 0}),R.lane){const N=p(R.lane),q=N.y+N.height/2-(A.y+A.height/2);q!==0&&n.moveElements([A],{x:0,y:q})}}for(const R of Gt(e,"sequenceFlow.update")){const A=p(R.id);if(R.source!==void 0||R.target!==void 0){const N=A,q=R.source!==void 0?p(R.source):N.source,Y=R.target!==void 0?p(R.target):N.target,z=Z=>({x:Z.x+Z.width/2,y:Z.y+Z.height/2});n.reconnect(N,q,Y,[z(q),z(Y)])}R.name!==void 0&&n.updateProperties(A,{name:R.name??void 0}),R.condition!==void 0&&n.updateProperties(A,{name:((ox=R.condition)==null?void 0:ox.label)??void 0})}for(const R of Gt(e,"messageFlow.update"))R.name!==void 0&&n.updateProperties(p(R.id),{name:R.name??void 0});for(const R of Gt(e,"dataStore.update"))R.name!==void 0&&n.updateProperties(p(R.id),{name:R.name??void 0});for(const R of Gt(e,"annotation.update")){const A=p(R.id);if(R.text!==void 0&&n.updateProperties(A,{text:R.text}),R.placement===null)T(A,"bwl:Placement",null);else if(R.placement){const N=Qb(p(R.placement.anchor)),[q,Y]=$u[R.placement.side],z=R.placement.offset??50,Z=N.x+N.width/2+q*(N.width/2+A.width/2+z),Ve=N.y+N.height/2+Y*(N.height/2+A.height/2+z);n.moveElements([A],{x:Z-(A.x+A.width/2),y:Ve-(A.y+A.height/2)}),T(A,"bwl:Placement",O(R.placement))}}for(const R of Gt(e,"group.update")){const A=p(R.id);if(R.name!==void 0&&n.updateLabel(A,R.name??""),R.members){const N=R.members.map(l).filter(q=>!!q);if(N.length){const Y=Math.min(...N.map(ue=>ue.x))-40,z=Math.min(...N.map(ue=>ue.y))-40,Z=Math.max(...N.map(ue=>ue.x+ue.width))+40,Ve=Math.max(...N.map(ue=>ue.y+ue.height))+40;n.resizeShape(A,{x:Y,y:z,width:Z-Y,height:Ve-z})}T(A,"bwl:Members",{refs:R.members.join(" ")})}}}function Hd(e,t,n=Fd){const i=jd(e),r=Bd(t,vd(i.elementRegistry)),o={edgeCrossings:{before:0,after:0}};if(r.length)return{ok:!1,issues:r,findings:[],stats:o};const a=Tn(i.elementRegistry),s=new Set(zi(a).map(Fi)),c=new Set(a.edges.map(d=>d.id)),u=Lu(a).length,l=e.get("commandStack");try{Of(l,()=>{n(t,i),Pd(i,c),Sd(i,s),Md(i,s,c),Ld(i,s,c),Od(i,c)})}catch(d){return{ok:!1,issues:[{kind:"lower-failed",message:d instanceof Error?d.message:String(d)}],findings:[],stats:o}}const p=Tn(i.elementRegistry),f=zi(p).filter(d=>!s.has(Fi(d)));return{ok:!0,issues:[],findings:f,stats:{edgeCrossings:{before:u,after:Lu(p).length}}}}function OE(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function LE(e,t){return typeof e.get=="function"?e.get(t):e[t]}function zd(e,t){const n=LE(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Vd(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function IE(e){return typeof e=="string"&&fu.includes(e)}function ri(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function Gd(e){const t=e.rootElements??[],n=t.find(X=>X.$type==="bpmn:Collaboration"),i=new Map(t.filter(X=>X.$type==="bpmn:Process").map(X=>[X.id,X])),r=[],o=[],a=[],s=[],c=[],u=[],l={poolOrders:{},bands:{},placements:{}},p=[],f=[],d=[],h=[],m=[],g=[],S=new Set,E=new Set,x=X=>{X&&S.add(X)},b=X=>{S.add(X),E.add(X)},w=X=>{const oe=Vd(X,"bwl:Placement");if(!oe)return;const me=typeof oe.anchor=="string"?oe.anchor:void 0;if(!me||!IE(oe.side))return;const se=typeof oe.offset=="number"?oe.offset:void 0;m.push({owner:X.id,anchor:me,side:oe.side,...se!==void 0?{offset:se}:{}})},T=X=>{const oe=Vd(X,"bwl:Members"),me=typeof(oe==null?void 0:oe.refs)=="string"?oe.refs.split(/\s+/).filter(Boolean):[];me.length&&g.push({owner:X.id,refs:me})},O=X=>{var oe;for(const me of X)switch(x(me.id),me.$type){case"bpmn:TextAnnotation":b(me.id),s.push({id:me.id,text:typeof me.text=="string"?me.text:""}),w(me);break;case"bpmn:Association":d.push({id:me.id,type:me.$type,source:ri(me.sourceRef),target:ri(me.targetRef)});break;case"bpmn:Group":{b(me.id);const se=(oe=me.categoryValueRef)==null?void 0:oe.value;c.push({id:me.id,...typeof se=="string"&&se?{name:se}:{}}),T(me);break}default:u.push({id:me.id,type:me.$type,reason:"type-outside-mvp"})}},P=(X,oe)=>{const me=X.flowElements??[],se=(X.laneSets??[]).flatMap(J=>J.lanes??[]),le=new Map;for(const J of se){x(J.id);for(const $ of J.flowNodeRef??[]){const B=ri($);B&&le.set(B,J.id)}}for(const J of me){if(x(J.id),J.$type==="bpmn:SequenceFlow"){p.push({id:J.id,source:ri(J.sourceRef),target:ri(J.targetRef),...typeof J.name=="string"&&J.name?{name:J.name}:{}});continue}if(J.$type==="bpmn:DataStoreReference"){b(J.id),a.push({id:J.id,...J.name?{name:J.name}:{}});continue}const $=OE(J.$type);if(!Tf($)){u.push({id:J.id,type:J.$type,reason:"type-outside-mvp"});continue}b(J.id),o.push({id:J.id,type:$,...J.name?{name:J.name}:{},...oe?{participant:oe}:{},...le.has(J.id)?{lane:le.get(J.id)}:{}});const B=zd(J,"bwl:band");B!==void 0&&(l.bands[J.id]=B);for(const G of J.dataOutputAssociations??[])x(G.id),h.push({id:G.id,type:G.$type,source:J.id,target:ri(G.targetRef)});for(const G of J.dataInputAssociations??[])x(G.id),h.push({id:G.id,type:G.$type,source:ri((G.sourceRef??[])[0]),target:J.id})}O(X.artifacts??[])};if(n){const X=new Set;for(const oe of n.participants??[]){b(oe.id);const me=ri(oe.processRef);me&&X.add(me);const se=me?i.get(me):void 0,le=((se==null?void 0:se.laneSets)??[]).flatMap(G=>G.lanes??[]),J=le.map(G=>({id:G.id,...G.name?{name:G.name}:{}}));for(const G of J)b(G.id);const $=!se||(se.flowElements??[]).length===0&&le.length===0&&(se.artifacts??[]).length===0;r.push({id:oe.id,...oe.name?{name:oe.name}:{},...$?{blackBox:!0}:{},...J.length?{lanes:J}:{}});const B=zd(oe,"bwl:poolOrder");B!==void 0&&(l.poolOrders[oe.id]=B),se&&P(se,oe.id)}for(const oe of n.messageFlows??[])x(oe.id),f.push({id:oe.id,source:ri(oe.sourceRef),target:ri(oe.targetRef),...typeof oe.name=="string"&&oe.name?{name:oe.name}:{}});O(n.artifacts??[]);for(const[oe,me]of i)!X.has(oe)&&(me.flowElements??[]).length>0&&u.push({id:oe,type:me.$type,reason:"unreachable-process"})}else for(const X of i.values())P(X);const j=[],F=[],I=[],H=[],ae=(X,oe)=>!!X&&!!oe&&E.has(X)&&E.has(oe);for(const X of p){if(!ae(X.source,X.target)){u.push({id:X.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}j.push({id:X.id,source:X.source,target:X.target,...X.name?{name:X.name}:{}}),E.add(X.id)}for(const X of f){if(!ae(X.source,X.target)){u.push({id:X.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}F.push({id:X.id,source:X.source,target:X.target,...X.name?{name:X.name}:{}}),E.add(X.id)}for(const X of h){if(!ae(X.source,X.target)){u.push({id:X.id??"",type:X.type,reason:"endpoint-outside-mvp"});continue}H.push({...X.id?{id:X.id}:{},source:X.source,target:X.target}),X.id&&E.add(X.id)}for(const X of d){if(!ae(X.source,X.target)){u.push({id:X.id??"",type:X.type,reason:"endpoint-outside-mvp"});continue}I.push({...X.id?{id:X.id}:{},source:X.source,target:X.target})}const Ie=new Map(c.map(X=>[X.id,X]));for(const{owner:X,refs:oe}of g){const me=oe.filter(le=>S.has(le)),se=Ie.get(X);se&&me.length&&(se.members=me)}for(const X of m)S.has(X.anchor)&&(l.placements[X.owner]={anchor:X.anchor,side:X.side,...X.offset!==void 0?{offset:X.offset}:{}});return{definition:{...r.length?{participants:r}:{},nodes:o,sequenceFlows:j,...F.length?{messageFlows:F}:{},...a.length?{dataStores:a}:{},...H.length?{dataAssociations:H}:{},...s.length?{annotations:s}:{},...I.length?{associations:I}:{},...c.length?{groups:c}:{}},hints:l,omitted:u}}async function NE(e){const{definitions:t,warnings:n}=await Tu(e);return{...Gd(t),warnings:n}}function BE(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function Wd(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=Hd(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 $E=Symbol("bpmn-editor");function jE(){const e=wt.ref(!1),t=wt.ref(!0),n=wt.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 Wd(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:Mu(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 ju={exports:{}},Ud;function HE(){if(Ud)return ju.exports;Ud=1;var e=ju.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},ju.exports}var zE=HE(),VE=FE(zE);function oi(e){if(!(this instanceof oi))return new oi(e);e=e||[128,36,1],this._seed=e.length?VE.rack(e[0],e[1],e[2]):e}oi.prototype.next=function(e){return this._seed(e||!0)},oi.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},oi.prototype.claim=function(e,t){this._seed.set(e,t||!0)},oi.prototype.assigned=function(e){return this._seed.get(e)||!1},oi.prototype.unclaim=function(e){delete this._seed.hats[e]},oi.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const Lt={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};Lt.td=Lt.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],Lt.option=Lt.optgroup=[1,'<select multiple="multiple">',"</select>"],Lt.thead=Lt.tbody=Lt.colgroup=Lt.caption=Lt.tfoot=[1,"<table>","</table>"],Lt.polyline=Lt.ellipse=Lt.polygon=Lt.circle=Lt.text=Lt.line=Lt.path=Lt.rect=Lt.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function rt(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(Lt,i)?Lt[i]:Lt._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 ln(e,...t){const n=e.style;return M(t,function(i){i&&M(i,function(r,o){n[o]=r})}),e}function Jt(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const WE=Object.prototype.toString;function lt(e){return new Vi(e)}function Vi(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Vi.prototype.add=function(e){return this.list.add(e),this},Vi.prototype.remove=function(e){return WE.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Vi.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},Vi.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Vi.prototype.array=function(){return Array.from(this.list)},Vi.prototype.has=Vi.prototype.contains=function(e){return this.list.contains(e)};function rs(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function wr(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function UE(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var os={},qd;function qE(){if(qd)return os;qd=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return os.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},os.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},os}var Yd=qE(),YE=UE(Yd),be=GE({__proto__:null,default:YE},[Yd]),Kd=["focus","blur"];function KE(e,t,n,i,r){return Kd.indexOf(n)!==-1&&(r=!0),be.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=wr(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function XE(e,t,n,i){return Kd.indexOf(t)!==-1&&(i=!0),be.unbind(e,t,n,i)}var bn={bind:KE,unbind:XE};function Fu(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function Xe(e,t){return t=t||document,t.querySelector(e)}function as(e,t){return t=t||document,t.querySelectorAll(e)}function ai(e){e.parentNode&&e.parentNode.removeChild(e)}function ZE(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function QE(e,t){return t.appendChild(ZE(e,t))}function xe(e,t){return QE(t,e),e}var Hu=2,Xd={"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":Hu,"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":Hu,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function JE(e,t){return Xd[t]?e.style[t]:e.getAttributeNS(null,t)}function Zd(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=Xd[i];r?(r===Hu&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function ew(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)Zd(e,r,t[r])}function re(e,t,n){if(typeof t=="string")if(n!==void 0)Zd(e,t,n);else return JE(e,t);else ew(e,t);return e}const tw=Object.prototype.toString;function Le(e){return new Gi(e)}function Gi(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Gi.prototype.add=function(e){return this.list.add(e),this},Gi.prototype.remove=function(e){return tw.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Gi.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},Gi.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Gi.prototype.array=function(){return Array.from(this.list)},Gi.prototype.has=Gi.prototype.contains=function(e){return this.list.contains(e)};function ss(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Qd(e){return e.cloneNode(!0)}var zu={svg:"http://www.w3.org/2000/svg"},Jd='<svg xmlns="'+zu.svg+'"';function nw(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(zu.svg)===-1&&(e=Jd+e.substring(4)):(e=Jd+">"+e+"</svg>",t=!0);var n=iw(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function iw(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function pe(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=nw(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(zu.svg,e),t&&re(n,t),n}var Vu=null;function eh(){return Vu===null&&(Vu=pe("svg")),Vu}function th(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function rw(e,t,n,i,r,o){var a=eh().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return th(a,e);case 6:return th(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function $o(e){return eh().createSVGTransform()}var nh=/([&<>]{1})/g,ow=/([&<>\n\r"]{1})/g,aw={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function Gu(e,t){function n(i,r){return aw[r]||r}return e.replace(t,n)}function ih(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(Gu(e.textContent,nh));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,'="',Gu(o.value,ow),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)ih(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",Gu(e.nodeValue,nh),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function sw(e){for(var t=e.firstChild,n=[];t;)ih(t,n),t=t.nextSibling;return n.join("")}function rh(e,t){return sw(e)}function It(e){var t=e.parentNode;return t&&t.removeChild(e),e}function cw(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function uw(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(cw(e,i))}function jo(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),uw(n,t)),n.consolidate()}const lw=/^class[ {]/;function pw(e){return lw.test(e.toString())}function Wu(e){return Array.isArray(e)}function Uu(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function cs(...e){e.length===1&&Wu(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const fw=/constructor\s*[^(]*\(\s*([^)]*)\)/m,dw=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,hw=/\/\*([^*]*)\*\//m;function mw(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(pw(e)?fw:dw);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(hw);return(r&&r[1]||i).trim()})||[]}function oh(e,t){const n=t||{get:function(x,b){if(i.push(x),b===!1)return null;throw s(`No provider for "${x}"!`)}},i=[],r=this._providers=Object.create(n._providers||null),o=this._instances=Object.create(null),a=o.injector=this,s=function(x){const b=i.join(" -> ");return i.length=0,new Error(b?`${x} (Resolving: ${b})`:x)};function c(x,b){if(!r[x]&&x.includes(".")){const w=x.split(".");let T=c(w.shift());for(;w.length;)T=T[w.shift()];return T}if(Uu(o,x))return o[x];if(Uu(r,x)){if(i.indexOf(x)!==-1)throw i.push(x),s("Cannot resolve circular dependency!");return i.push(x),o[x]=r[x][0](r[x][1]),i.pop(),o[x]}return n.get(x,b)}function u(x,b){if(typeof b>"u"&&(b={}),typeof x!="function")if(Wu(x))x=cs(x.slice());else throw s(`Cannot invoke "${x}". Expected a function!`);const T=(x.$inject||mw(x)).map(O=>Uu(b,O)?b[O]:c(O));return{fn:x,dependencies:T}}function l(x){const{fn:b,dependencies:w}=u(x),T=Function.prototype.bind.call(b,null,...w);return new T}function p(x,b,w){const{fn:T,dependencies:O}=u(x,w);return T.apply(b,O)}function f(x){return cs(b=>x.get(b))}function d(x,b){if(b&&b.length){const w=Object.create(null),T=Object.create(null),O=[],P=[],j=[];let F,I,H,ae;for(let Ie in r)F=r[Ie],b.indexOf(Ie)!==-1&&(F[2]==="private"?(I=O.indexOf(F[3]),I===-1?(H=F[3].createChild([],b),ae=f(H),O.push(F[3]),P.push(H),j.push(ae),w[Ie]=[ae,Ie,"private",H]):w[Ie]=[j[I],Ie,"private",P[I]]):w[Ie]=[F[2],F[1]],T[Ie]=!0),(F[2]==="factory"||F[2]==="type")&&F[1].$scope&&b.forEach(ot=>{F[1].$scope.indexOf(ot)!==-1&&(w[Ie]=[F[2],F[1]],T[ot]=!0)});b.forEach(Ie=>{if(!T[Ie])throw new Error('No provider for "'+Ie+'". Cannot use provider from the parent!')}),x.unshift(w)}return new oh(x,a)}const h={factory:p,type:l,value:function(x){return x}};function m(x,b){const w=x.__init__||[];return function(){w.forEach(T=>{typeof T=="string"?b.get(T):b.invoke(T)})}}function g(x){const b=x.__exports__;if(b){const w=x.__modules__,T=Object.keys(x).reduce((I,H)=>(H!=="__exports__"&&H!=="__modules__"&&H!=="__init__"&&H!=="__depends__"&&(I[H]=x[H]),I),Object.create(null)),O=(w||[]).concat(T),P=d(O),j=cs(function(I){return P.get(I)});b.forEach(function(I){r[I]=[j,I,"private",P]});const F=(x.__init__||[]).slice();return F.unshift(function(){P.init()}),x=Object.assign({},x,{__init__:F}),m(x,P)}return Object.keys(x).forEach(function(w){if(w==="__init__"||w==="__depends__")return;const T=x[w];if(T[2]==="private"){r[w]=T;return}const O=T[0],P=T[1];r[w]=[h[O],gw(O,P),O]}),m(x,a)}function S(x,b){return x.indexOf(b)!==-1||(x=(b.__depends__||[]).reduce(S,x),x.indexOf(b)!==-1)?x:x.concat(b)}function E(x){const b=x.reduce(S,[]).map(g);let w=!1;return function(){w||(w=!0,b.forEach(T=>T()))}}this.get=c,this.invoke=p,this.instantiate=l,this.createChild=d,this.init=E(e)}function gw(e,t){return e!=="value"&&Wu(t)&&(t=cs(t.slice())),t}var vw=1e3;function bi(e,t){var n=this;t=t||vw,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)})}bi.prototype.canRender=function(e){},bi.prototype.drawShape=function(e,t){},bi.prototype.drawConnection=function(e,t){},bi.prototype.getShapePath=function(e){},bi.prototype.getConnectionPath=function(e){};function Sr(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function yw(e){return["M",e.x,e.y]}function qu(e){return["L",e.x,e.y]}function _w(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function bw(e,t){const n=e.length,i=[yw(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(qu(a));continue}const c=Math.min(t,Yu(a.x-o.x,a.y-o.y),Yu(s.x-a.x,s.y-a.y));if(!c){i.push(qu(a));continue}const u=us(a,o,c),l=us(a,o,c*.5),p=us(a,s,c),f=us(a,s,c*.5);i.push(qu(u)),i.push(_w(l,f,p))}return i}function us(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=Yu(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function Yu(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Fo(e,t,n){_e(t)&&(n=t,t=null),t||(t={});const i=pe("path",t);return _e(n)&&(i.dataset.cornerRadius=String(n)),Ku(i,e)}function Ku(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return re(e,{d:Sr(bw(t,n))}),e}function ls(e){var t=new Set(e);return Te(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function Rr(e,t,n){n=n||0,ge(e)||(e=[e]),M(e,function(i,r){var o=t(i,r,n);ge(o)&&o.length&&Rr(o,t,n+1)})}function Xu(e,t,n){var i=new Set,r=new Set;return Rr(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 Ho(e,t){return Xu(e)}function xw(e,t,n){vr(t)&&(t=!0),jt(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&&Gr(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 Rr(e,u),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function St(e,t){t=!!t,ge(e)||(e=[e]);var n,i,r,o;return M(e,function(a){var s=a;a.waypoints&&!t&&(s=St(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 Zr(e,t){var n={};return M(e,function(i){var r=i;r.waypoints&&(r=St(r)),!_e(t.y)&&r.x>t.x&&(n[i.id]=i),!_e(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(_e(t.width)&&_e(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!_e(t.width)||!_e(t.height))&&(n[i.id]=i)}),n}function ah(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function sh(e){return!!(e&&e.isFrame)}function zo(e,t){return D({},e||{},t||{})}var Ew=1;function Wi(e,t){bi.call(this,e,Ew),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(Wi,bi),Wi.prototype.canRender=function(){return!0},Wi.prototype.drawShape=function(t,n,i){var r=pe("rect");return re(r,{x:0,y:0,width:n.width||0,height:n.height||0}),sh(n)?re(r,D({},this.FRAME_STYLE,i||{})):re(r,D({},this.SHAPE_STYLE,i||{})),xe(t,r),r},Wi.prototype.drawConnection=function(t,n,i){var r=Fo(n.waypoints,D({},this.CONNECTION_STYLE,i||{}));return xe(t,r),r},Wi.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 Sr(a)},Wi.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 Sr(o)},Wi.$inject=["eventBus","styles"];function ww(){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 D(o,{class:n})},this.style=function(n,i){!ge(n)&&!i&&(i=n,n=[]);var r=yn(n,function(o,a){return D(o,e[a]||{})},{});return i?D(r,i):r},this.computeStyle=function(n,i,r){return ge(i)||(r=i,i=[]),t.style(i||[],D({},r,n||{}))}}const Sw={__init__:["defaultRenderer"],defaultRenderer:["type",Wi],styles:["type",ww]};function gt(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function bt(e,t,n){if(!(!e||!t)){typeof n!="number"&&(n=-1);var i=e.indexOf(t);if(i!==-1){if(i===n)return;if(n!==-1)e.splice(i,1);else return}n!==-1?e.splice(n,0,t):e.push(t)}}function Zu(e,t){return!e||!t?-1:e.indexOf(t)}function Vo(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Qu(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=Vo(e,t);return Math.abs(r/o)<=i}var Rw=2;function xi(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(Cw(r,n))return o;return!1}function Cw(e,t){const n=t[0];return yr(t,function(i){return Math.abs(n[e]-i[e])<=Rw})}function ch(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 Ju(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var Pw=/,?([a-z]),?/gi,uh=parseFloat,Rt=Math,Ui=Rt.PI,si=Rt.min,ci=Rt.max,lh=Rt.pow,qi=Rt.abs,Aw=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,Tw=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,ph=Array.isArray||function(e){return e instanceof Array};function Mw(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function kw(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 Dw(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 Mw(r,i)?(kw(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function Ow(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(Aw,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(Tw,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=tl,n}function Lw(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 Iw(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 el(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 tl(){return this.join(",").replace(Pw,"$1")}function Nw(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=tl,t}function fh(e,t,n,i,r,o,a,s,c){var u=1-c,l=lh(u,3),p=lh(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:ps(h),y:ps(m)}}function dh(e){var t=zw(...e);return el(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function Yi(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function Bw(e,t){return e=el(e),t=el(t),Yi(t,e.x,e.y)||Yi(t,e.x2,e.y)||Yi(t,e.x,e.y2)||Yi(t,e.x2,e.y2)||Yi(e,t.x,t.y)||Yi(e,t.x2,t.y)||Yi(e,t.x,t.y2)||Yi(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 hh(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,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=hh(m,e,n,r,a),S=hh(m,t,i,o,s),E=g*g+S*S;d+=f[h]*Rt.sqrt(E)}return u*d}function $w(e,t,n,i,r,o,a,s){if(!(ci(e,n)<si(r,a)||si(e,n)>ci(r,a)||ci(t,i)<si(o,s)||si(t,i)>ci(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=ps(c/l),f=ps(u/l),d=+p.toFixed(2),h=+f.toFixed(2);if(!(d<+si(e,n).toFixed(2)||d>+ci(e,n).toFixed(2)||d<+si(r,a).toFixed(2)||d>+ci(r,a).toFixed(2)||h<+si(t,i).toFixed(2)||h>+ci(t,i).toFixed(2)||h<+si(o,s).toFixed(2)||h>+ci(o,s).toFixed(2)))return{x:p,y:f}}}}function ps(e){return Math.round(e*1e11)/1e11}function jw(e,t,n){var i=dh(e),r=dh(t);if(!Bw(i,r))return[];var o=mh(...e),a=mh(...t),s=vh(e)?1:~~(o/5)||1,c=vh(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=fh(...e,d/s);u[d]={x:m.x,y:m.y,t:d/s}}for(d=0;d<c+1;d++)m=fh(...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],S=u[d+1],E=l[h],x=l[h+1],b=qi(S.x-g.x)<.01?"y":"x",w=qi(x.x-E.x)<.01?"y":"x",T=$w(g.x,g.y,S.x,S.y,E.x,E.y,x.x,x.y),O;if(T){if(O=T.x.toFixed(9)+"#"+T.y.toFixed(9),p[O])continue;p[O]=!0;var P=g.t+qi((T[b]-g[b])/(S[b]-g[b]))*(S.t-g.t),j=E.t+qi((T[w]-E[w])/(x[w]-E[w]))*(x.t-E.t);P>=0&&P<=1&&j>=0&&j<=1&&f.push({x:T.x,y:T.y,t1:P,t2:j})}}return f}function gh(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 S=0,E=t.length;S<E;S++){var x=t[S];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=jw(p,f);{for(var w=0,T=b.length;w<T;w++)b[w].segment1=h,b[w].segment2=S,b[w].bez1=p,b[w].bez2=f;d=d.concat(b)}}}}}return d}function Fw(e){return ph(e)&&ph(e[0])}function Hw(e){if(Lw(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=tl,t}function vh(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function fs(e,t,n,i){return[e,t,n,i,n,i]}function yh(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 _h(e,t,n,i,r,o,a,s,c,u){var l=Ui*120/180,p=Ui/180*(+r||0),f=[],d,h=Dw(function(C,_,v){var k=C*Rt.cos(v)-_*Rt.sin(v),L=C*Rt.sin(v)+_*Rt.cos(v);return{x:k,y:L}});if(u)O=u[0],P=u[1],w=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,S=m*m/(n*n)+g*g/(i*i);S>1&&(S=Rt.sqrt(S),n=S*n,i=S*i);var E=n*n,x=i*i,b=(o==a?-1:1)*Rt.sqrt(qi((E*x-E*g*g-x*m*m)/(E*g*g+x*m*m))),w=b*n*g/i+(e+s)/2,T=b*-i*m/n+(t+c)/2,O=Rt.asin(((t-T)/i).toFixed(9)),P=Rt.asin(((c-T)/i).toFixed(9));O=e<w?Ui-O:O,P=s<w?Ui-P:P,O<0&&(O=Ui*2+O),P<0&&(P=Ui*2+P),a&&O>P&&(O=O-Ui*2),!a&&P>O&&(P=P-Ui*2)}var j=P-O;if(qi(j)>l){var F=P,I=s,H=c;P=O+l*(a&&P>O?1:-1),s=w+n*Rt.cos(P),c=T+i*Rt.sin(P),f=_h(s,c,n,i,r,0,a,I,H,[P,F,w,T])}j=P-O;var ae=Rt.cos(O),Ie=Rt.sin(O),ot=Rt.cos(P),X=Rt.sin(P),oe=Rt.tan(j/4),me=4/3*n*oe,se=4/3*i*oe,le=[e,t],J=[e+me*Ie,t-se*ae],$=[s+me*X,c-se*ot],B=[s,c];if(J[0]=2*le[0]-J[0],J[1]=2*le[1]-J[1],u)return[J,$,B].concat(f);f=[J,$,B].concat(f).join().split(",");for(var G=[],Pe=0,xt=f.length;Pe<xt;Pe++)G[Pe]=Pe%2?h(f[Pe-1],f[Pe],p).y:h(f[Pe],f[Pe+1],p).x;return G}function zw(e,t,n,i,r,o,a,s){for(var c=[],u=[[],[]],l,p,f,d,h,m,g,S,E=0;E<2;++E){if(E==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),qi(l)<1e-12){if(qi(p)<1e-12)continue;d=-f/p,0<d&&d<1&&c.push(d);continue}g=p*p-4*f*l,S=Rt.sqrt(g),!(g<0)&&(h=(-p+S)/(2*l),0<h&&h<1&&c.push(h),m=(-p-S)/(2*l),0<m&&m<1&&c.push(m))}for(var x=c.length,b=x,w;x--;)d=c[x],w=1-d,u[0][x]=w*w*w*e+3*w*w*d*n+3*w*d*d*r+d*d*d*a,u[1][x]=w*w*w*t+3*w*w*d*i+3*w*d*d*o+d*d*d*s;return u[0][b]=e,u[1][b]=t,u[0][b+1]=a,u[1][b+1]=s,u[0].length=u[1].length=b+2,{x0:si(...u[0]),y0:si(...u[1]),x1:ci(...u[0]),y1:ci(...u[1])}}function bh(e){if(Fw(e)||(e=Ow(e)),Iw(e))return e;for(var t=Nw(Hw(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",..._h(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",...yh(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",...yh(d.x,d.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...fs(d.x,d.y,f[1],f[2])];break;case"H":f=["C",...fs(d.x,d.y,f[1],d.y)];break;case"V":f=["C",...fs(d.x,d.y,d.x,f[1])];break;case"Z":f=["C",...fs(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=uh(l[p-4])||n.x,n.by=uh(l[p-3])||n.y}return t}function Qe(e){return jt(e)&&vn(e,"waypoints")}function Re(e){return jt(e)&&vn(e,"labelTarget")}function Vw(e){return jt(e)&&zr(e.parent)}function xh(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function Ei(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function de(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function ds(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function Gw(e){return Ei({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function Ww(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=Yw(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 ve(e){return Qe(e)?Ww(e):Gw(e)}function Wt(e,t,n){n=n||0,jt(n)||(n={x:n,y:n});var i=de(e),r=de(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 Go(e,t,n){var i=Uw(e,t);return i.length===1||i.length===2&&Vo(i[0],i[1])<1?Ei(i[0]):i.length>1?(i=ti(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),Ei(i[n?0:i.length-1])):null}function Uw(e,t){return gh(e,t)}function qw(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],Vo(n,r)===0||Qu(i,r,n)?e.splice(t,1):t++;return e}function Yw(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function hs(e,t){return Math.round(e*t)/t}function Eh(e){return _e(e)?e+"px":e}function Kw(e){for(;e.parent;)e=e.parent;return e}function Xw(e){e=D({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),ln(n,{position:"relative",overflow:"hidden",width:Eh(e.width),height:Eh(e.height)}),t.appendChild(n),n}function wh(e,t,n){const i=pe("g");Le(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const Zw="base",Sh=0,Qw=1,Jw={shape:["x","y","width","height"],connection:["waypoints"]};function ye(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||{})}ye.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],ye.prototype._init=function(e){const t=this._eventBus,n=this._container=Xw(e),i=this._svg=pe("svg");re(i,{width:"100%",height:"100%"}),Jt(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")}),xe(n,i);const r=this._viewport=wh(i,"viewport");e.deferUpdate&&(this._viewboxChanged=gu(this._viewboxChanged,300)),this._restoreFocus=gu(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)},ye.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},ye.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},ye.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=ah(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},ye.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},ye.prototype.restoreFocus=function(){this._restoreFocus()},ye.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},ye.prototype.isFocused=function(){return this._focused},ye.prototype.getDefaultLayer=function(){return this.getLayer(Zw,Sh)},ye.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},ye.prototype._getChildIndex=function(e){return yn(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},ye.prototype._createLayer=function(e,t){typeof t>"u"&&(t=Qw);const n=this._getChildIndex(t);return{group:wh(this._viewport,"layer-"+e,n),index:t,visible:!0}},ye.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},ye.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&&(It(n),t.visible=!1),n},ye.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],It(t.group))},ye.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},ye.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(Kw(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},ye.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},ye.prototype._findPlaneForRoot=function(e){return it(this._planes,function(t){return t.rootElement===e})},ye.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},ye.prototype._resolveElements=function(e){return ge(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},ye.prototype.getContainer=function(){return this._container},ye.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),Le(r).add(t)):(e.markers.delete(t),Le(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},ye.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},ye.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},ye.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},ye.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},ye.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},ye.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,Sh);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},ye.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},ye.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},ye.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)},ye.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})},ye.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})},ye.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=Jw[e];if(!yr(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},ye.prototype._setParent=function(e,t,n){bt(t.children,e,n),e.parent=t},ye.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},ye.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},ye.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},ye.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),gt(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},ye.prototype.removeShape=function(e){return this._removeElement(e,"shape")},ye.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},ye.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},ye.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},ye.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},ye.prototype.viewbox=function(e){if(e===void 0&&this._cachedViewbox)return structuredClone(this._cachedViewbox);const t=this._viewport,n=this.getSize();let i,r,o,a,s,c,u;if(e)this._changeViewbox(function(){s=Math.min(n.width/e.width,n.height/e.height);const l=this._svg.createSVGMatrix().scale(s).translate(-e.x,-e.y);jo(t,l)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=jo(t),r=a?a.matrix:rw(),s=hs(r.a,1e3),c=hs(-r.e||0,1e3),u=hs(-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},ye.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=D({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Rh(t,n)}),{x:n.e,y:n.f}},ye.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=St(o),s=de(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=de(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),S=Math.min(0,s.top-f.top);l=h||m,p=g||S}this.scroll({dx:-l*u,dy:-p*u})},ye.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)}),hs(i.a,1e3)};function Rh(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}ye.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},ye.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=D(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),Rh(this._viewport,l),l},ye.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},ye.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}},ye.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var Qr="data-element-id";function Mn(e){this._elements={},this._eventBus=e}Mn.$inject=["eventBus"],Mn.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),re(t,Qr,i),n&&re(n,Qr,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},Mn.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(re(i.gfx,Qr,""),i.secondaryGfx&&re(i.secondaryGfx,Qr,""),delete t[n])},Mn.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)},Mn.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,Qr,i),t},Mn.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&re(e,Qr);var n=this._elements[t];return n&&n.element},Mn.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},Mn.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}},Mn.prototype.getAll=function(){return this.filter(function(e){return e})},Mn.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)})},Mn.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},Mn.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 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 t1(e){return e.__refs_collection===!0}function n1(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function Ch(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 i1(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 Bn(e,t){if(!(this instanceof Bn))return new Bn(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Bn.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?Ch(this,t,e):i1(this,t,e)},Bn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return t1(n)||Ch(this,t,e),n},Bn.prototype.ensureBound=function(e,t){n1(e,t)||this.bind(e,t)},Bn.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Bn.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var nl=new Bn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Ph=new Bn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Ah=new Bn({name:"attachers",collection:!0},{name:"host"}),Th=new Bn({name:"outgoing",collection:!0},{name:"source"}),Mh=new Bn({name:"incoming",collection:!0},{name:"target"});function Jr(){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)}}),nl.bind(this,"parent"),Ph.bind(this,"labels"),Th.bind(this,"outgoing"),Mh.bind(this,"incoming")}function Wo(){Jr.call(this),nl.bind(this,"children"),Ah.bind(this,"host"),Ah.bind(this,"attachers")}ie(Wo,Jr);function kh(){Jr.call(this),nl.bind(this,"children")}ie(kh,Wo);function Dh(){Wo.call(this),Ph.bind(this,"labelTarget")}ie(Dh,Wo);function Oh(){Jr.call(this),Th.bind(this,"source"),Mh.bind(this,"target")}ie(Oh,Jr);var r1={connection:Oh,shape:Wo,label:Dh,root:kh};function o1(e,t){var n=r1[e];if(!n)throw new Error("unknown type: <"+e+">");return D(new n,t)}function a1(e){return e instanceof Jr}function wi(){this._uid=12}wi.prototype.createRoot=function(e){return this.create("root",e)},wi.prototype.createLabel=function(e){return this.create("label",e)},wi.prototype.createShape=function(e){return this.create("shape",e)},wi.prototype.createConnection=function(e){return this.create("connection",e)},wi.prototype.create=function(e,t){return t=D({},t||{}),t.id||(t.id=e+"_"+this._uid++),o1(e,t)};var ms="__fn",Lh=1e3,s1=Array.prototype.slice;function xn(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}xn.prototype.on=function(e,t,n,i){if(e=ge(e)?e:[e],Ft(t)&&(i=n,n=t,t=Lh),!_e(t))throw new Error("priority must be a number");var r=n;i&&(r=dn(n,i),r[ms]=n[ms]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},xn.prototype.once=function(e,t,n,i){var r=this;if(Ft(t)&&(i=n,n=t,t=Lh),!_e(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[ms]=n,this.on(e,t,o)},xn.prototype.off=function(e,t){e=ge(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},xn.prototype.createEvent=function(e){var t=new Uo;return t.init(e),t},xn.prototype.fire=function(e,t){var n,i,r,o;if(o=s1.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 Uo?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}},xn.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},xn.prototype._destroy=function(){this._listeners={}},xn.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},xn.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=c1(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},xn.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},xn.prototype._getListeners=function(e){return this._listeners[e]},xn.prototype._setListeners=function(e,t){this._listeners[e]=t},xn.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[ms]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function Uo(){}Uo.prototype.stopPropagation=function(){this.cancelBubble=!0},Uo.prototype.preventDefault=function(){this.defaultPrevented=!0},Uo.prototype.init=function(e){D(this,e||{})};function c1(e,t){return e.apply(null,t)}function Cr(e){return e.childNodes[0]}function u1(e){return e.parentNode.childNodes[1]}function gs(e,t,n,i,r){var o=$o();o.setTranslate(t,n);var a=$o();a.setRotate(i||0,0,0);var s=$o();s.setScale(1,1),jo(e,[o,a,s])}function Ut(e,t,n){var i=$o();i.setTranslate(t,n),jo(e,i)}function Ih(e,t){var n=$o();n.setRotate(t,0,0),jo(e,n)}function kn(e,t){this._eventBus=e,this._elementRegistry=t}kn.$inject=["eventBus","elementRegistry"],kn.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=u1(t),n||(n=pe("g"),Le(n).add("djs-children"),xe(t.parentNode,n))):n=t,n},kn.prototype._clear=function(e){var t=Cr(e);return rs(t),t},kn.prototype._createContainer=function(e,t,n,i){var r=pe("g");Le(r).add("djs-group"),typeof n<"u"?l1(r,t,t.childNodes[n]):xe(t,r);var o=pe("g");Le(o).add("djs-element"),Le(o).add("djs-"+e),i&&Le(o).add("djs-frame"),xe(r,o);var a=pe("g");return Le(a).add("djs-visual"),xe(o,a),o},kn.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,sh(t))},kn.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=yn(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)})}})},kn.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},kn.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},kn.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},kn.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},kn.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),Ut(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")}},kn.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);It(t.parentNode)};function l1(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const p1={__depends__:[Sw],__init__:["canvas"],canvas:["type",ye],elementRegistry:["type",Mn],elementFactory:["type",wi],eventBus:["type",xn],graphicsFactory:["type",kn]};function f1(e){var t=new oh(e);return t.init(),t}function d1(e){e=e||{};var t={config:["value",e]},n=[t,p1].concat(e.modules||[]);return f1(n)}function Ki(e,t){this._injector=t||d1(e),this.get("eventBus").fire("diagram.init")}Ki.prototype.get=function(e,t){return this._injector.get(e,t)},Ki.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},Ki.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},Ki.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function en(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function hn(e,t){return e.$instanceOf(t)}function h1(e){return it(e.rootElements,function(t){return hn(t,"bpmn:Process")||hn(t,"bpmn:Collaboration")})}function m1(e){var t={},n=[],i={};function r($,B){return function(G){$(G,B)}}function o($){t[$.id]=$}function a($){return t[$.id]}function s($,B){var G=$.gfx;if(G)throw new Error(`already rendered ${en($)}`);return e.element($,i[$.id],B)}function c($,B){return e.root($,i[$.id],B)}function u($,B){try{var G=i[$.id]&&s($,B);return o($),G}catch(Pe){l(Pe.message,{element:$,error:Pe}),console.error(`failed to import ${en($)}`,Pe)}}function l($,B){e.error($,B)}var p=this.registerDi=function(B){var G=B.bpmnElement;G?i[G.id]?l(`multiple DI elements defined for ${en(G)}`,{element:G}):i[G.id]=B:l(`no bpmnElement referenced in ${en(B)}`,{element:B})};function f($){d($.plane)}function d($){p($),M($.planeElement,h)}function h($){p($)}this.handleDefinitions=function(B,G){var Pe=B.diagrams;if(G&&Pe.indexOf(G)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!G&&Pe&&Pe.length&&(G=Pe[0]),!G)throw new Error("no diagram to display");i={},f(G);var xt=G.plane;if(!xt)throw new Error(`no plane for ${en(G)}`);var C=xt.bpmnElement;if(!C)if(C=h1(B),C)l(`correcting missing bpmnElement on ${en(xt)} to ${en(C)}`),xt.bpmnElement=C,p(xt);else throw new Error("no process or collaboration to display");var _=c(C,xt);if(hn(C,"bpmn:Process")||hn(C,"bpmn:SubProcess"))g(C,_);else if(hn(C,"bpmn:Collaboration"))le(C,_),S(B.rootElements,_);else throw new Error(`unsupported bpmnElement for ${en(xt)}: ${en(C)}`);m(n)};var m=this.handleDeferred=function(){for(var B;n.length;)B=n.shift(),B()};function g($,B){oe($,B),j($.ioSpecification,B),P($.artifacts,B),o($)}function S($,B){var G=Te($,function(Pe){return!a(Pe)&&hn(Pe,"bpmn:Process")&&Pe.laneSets});G.forEach(r(g,B))}function E($,B){u($,B)}function x($,B){M($,r(E,B))}function b($,B){u($,B)}function w($,B){u($,B)}function T($,B){u($,B)}function O($,B){u($,B)}function P($,B){M($,function(G){hn(G,"bpmn:Association")?n.push(function(){O(G,B)}):O(G,B)})}function j($,B){$&&(M($.dataInputs,r(w,B)),M($.dataOutputs,r(T,B)))}var F=this.handleSubProcess=function(B,G){oe(B,G),P(B.artifacts,G)};function I($,B){var G=u($,B);hn($,"bpmn:SubProcess")&&F($,G||B),hn($,"bpmn:Activity")&&j($.ioSpecification,B),n.push(function(){M($.dataInputAssociations,r(b,B)),M($.dataOutputAssociations,r(b,B))})}function H($,B){u($,B)}function ae($,B){u($,B)}function Ie($,B){n.push(function(){var G=u($,B);$.childLaneSet&&ot($.childLaneSet,G||B),J($)})}function ot($,B){M($.lanes,r(Ie,B))}function X($,B){M($,r(ot,B))}function oe($,B){me($.flowElements,B),$.laneSets&&X($.laneSets,B)}function me($,B){M($,function(G){hn(G,"bpmn:SequenceFlow")?n.push(function(){H(G,B)}):hn(G,"bpmn:BoundaryEvent")?n.unshift(function(){I(G,B)}):hn(G,"bpmn:FlowNode")?I(G,B):hn(G,"bpmn:DataObject")||(hn(G,"bpmn:DataStoreReference")||hn(G,"bpmn:DataObjectReference")?ae(G,B):l(`unrecognized flowElement ${en(G)} in context ${en(B&&B.businessObject)}`,{element:G,context:B}))})}function se($,B){var G=u($,B),Pe=$.processRef;Pe&&g(Pe,G||B)}function le($,B){M($.participants,r(se,B)),n.push(function(){x($.messageFlows,B)}),P($.artifacts,B)}function J($){M($.flowNodeRef,function(B){var G=B.get("lanes");G&&G.push($)})}}function y(e,t){var n=K(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function Ce(e,t){return Ni(t,function(n){return y(e,n)})}function K(e){return e&&e.businessObject||e}function Be(e){return e&&e.di}function g1(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,S){return i.add(m,g,S)},error:function(m,g){s.push({message:m,context:g})}},f=new m1(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;!y(n,"bpmn:Process")&&!y(n,"bpmn:Collaboration")&&(i=y1(n));var r;y(i,"bpmn:Collaboration")?r=i:r=it(e.rootElements,function(u){if(y(u,"bpmn:Collaboration"))return it(u.participants,function(l){return l.processRef===i})});var o=[i];r&&(o=Zt(r.participants,function(u){return u.processRef}),o.push(r));var a=Nh(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 Nh(e){var t=[];return M(e,function(n){n&&(t.push(n),t=t.concat(Nh(n.flowElements)))}),t}function y1(e){for(var t=e;t;){if(y(t,"bpmn:Process"))return t;t=t.$parent}}var _1='<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>',Bh=_1,$h={verticalAlign:"middle"},jh={color:"#404040"},b1={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},x1={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},E1={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"},w1='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+Bh+'</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>',ui;function S1(){ui=rt(w1),ln(ui,b1),ln(Xe("svg",ui),$h),ln(Xe(".backdrop",ui),x1),ln(Xe(".notice",ui),E1),ln(Xe(".link",ui),jh,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function R1(){ui||(S1(),bn.bind(ui,".backdrop","click",function(e){document.body.removeChild(ui)})),document.body.appendChild(ui)}const vs=5,Fh="djs-outline-hidden";function pt(e){e=D({},P1,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),T1(this._container)}ie(pt,Ki),pt.prototype.importXML=async function(t,n){const i=this;function r(a){return i.get("eventBus").createEvent(a)}let o=[];try{t=this._emit("import.parse.start",{xml:t})||t;let a;try{a=await this._moddle.fromXML(t,"bpmn:Definitions")}catch(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||[]),ys(s,o),s=C1(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},pt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},pt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw ys(o,[]),o}if(typeof t=="string"&&(i=A1(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw ys(o,[]),o}try{this.clear()}catch(o){throw ys(o,[]),o}const{warnings:r}=await g1(this,n,i);return{warnings:r}},pt.prototype.saveXML=async function(t){t=t||{};let n=this._definitions,i,r;try{if(!n)throw new Error("no definitions loaded");n=this._emit("saveXML.start",{definitions:n})||n,r=(await this._moddle.toXML(n,t)).xml,r=this._emit("saveXML.serialized",{xml:r})||r}catch(a){i=a}const o=i?{error:i}:{xml:r};if(this._emit("saveXML.done",o),i)throw i;return o},pt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=Xe(":scope > defs",i._svg),a=rh(r),s=o?"<defs>"+rh(o)+"</defs>":"",c=i.getContainer();lt(c).add(Fh);let u;try{u=r.getBBox()}finally{lt(c).remove(Fh)}const l=u.x-vs,p=u.y-vs,f=u.width+vs*2,d=u.height+vs*2;t=`<?xml version="1.0" encoding="utf-8"?>
1
+ (function(Q,St){typeof exports=="object"&&typeof module<"u"?St(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],St):(Q=typeof globalThis<"u"?globalThis:Q||self,St(Q.BpmnModeler={},Q.Vue))})(this,(function(Q,St){"use strict";var DD=Object.defineProperty;var OD=(Q,St,_i)=>St in Q?DD(Q,St,{enumerable:!0,configurable:!0,writable:!0,value:_i}):Q[St]=_i;var Vr=(Q,St,_i)=>OD(Q,typeof St!="symbol"?St+"":St,_i);const _i=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway"];function Of(e){return _i.includes(e)}const Lf="http://g1project.net/spec/bpmn/bwl/1.0",gu="bwl",yu=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],If={name:"bwl-hints",uri:Lf,prefix:gu,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"}]}]},vu="bwl.undoEpisode",Nf=new WeakSet;function hx(e){Nf.has(e)||(e.register(vu,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),Nf.add(e))}function Bf(e,t){hx(e);const n={run:t};if(e.execute(vu,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const $f=["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"}]},gx={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},yx={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},vx={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다.",properties:{id:{type:"string"},type:{type:"string",enum:[..._i]},name:{type:"string"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},_x={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},bx={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},xx={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"}},required:["id","source","target"],additionalProperties:!1},Ex={type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},wx={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},Sx={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},Rx={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},Cx={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},Px={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...yu]},offset:{type:"number"}},required:["anchor","side"],additionalProperties:!1};function Jt(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const Ax={"participant.add":Jt("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트(생략 시 op 순서가 곧 배치 순서).",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":Jt("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":Jt("node.add",{description:'플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 갈래 1, 2…) — 위/아래가 아니라 "주 흐름에서 몇 번째 갈래"다. 행 배치(어느 갈래가 위/아래인지)는 호스트가 정한다(대칭·메시지 방향). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.',properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer"}},required:["node"]}),"node.update":Jt("node.update",{description:"노드 이름/레인/타입 갱신. lane = 레인 재배정(이동), type = 태스크·이벤트 타입 전환.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lane:{type:"string"},type:{type:"string",enum:[..._i]}},required:["id"]}),"sequenceFlow.add":Jt("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":Jt("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":Jt("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":Jt("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataStore.add":Jt("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":Jt("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataAssociation.add":Jt("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":Jt("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":Jt("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":Jt("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":Jt("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":Jt("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"element.remove":Jt("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},jf={anyOf:$f.map(e=>Ax[e])},Tx={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:gx,irParticipant:yx,irNode:vx,irFlowCondition:_x,irSequenceFlow:bx,irMessageFlow:xx,irDataStore:Ex,irDataAssociation:wx,irTextAnnotation:Sx,irAssociation:Rx,irGroup:Cx,bwlPlacement:Px,nullableString:mx,symbolicOp:jf}};function _u(e){return Array.prototype.concat.apply([],e)}const Oo=Object.prototype.toString,Mx=Object.prototype.hasOwnProperty;function vr(e){return e===void 0}function Ot(e){return e!==void 0}function Gr(e){return e==null}function ge(e){return Oo.call(e)==="[object Array]"}function Ft(e){return Oo.call(e)==="[object Object]"}function xe(e){return Oo.call(e)==="[object Number]"}function Ht(e){const t=Oo.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function gn(e){return Oo.call(e)==="[object String]"}function kx(e){if(!ge(e))throw new Error("must supply array")}function yn(e,t){return!Gr(e)&&Mx.call(e,t)}function rt(e,t){const n=Wa(t);let i;return M(e,function(r,o){if(n(r,o))return i=r,!1}),i}function Ff(e,t){const n=Wa(t);let i=ge(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=Wa(t);let i=[];return M(e,function(r,o){n(r,o)&&i.push(r)}),i}function M(e,t){let n,i;if(vr(e))return;const r=ge(e)?Nx:Ix;for(let o in e)if(yn(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function Dx(e,t){if(vr(e))return[];kx(e);const n=Wa(t);return e.filter(function(i,r){return!n(i,r)})}function vn(e,t,n){return M(e,function(i,r){n=t(n,i,r)}),n}function _r(e,t){return!!vn(e,function(n,i,r){return n&&t(i,r)},!0)}function Bi(e,t){return!!rt(e,t)}function en(e,t){let n=[];return M(e,function(i,r){n.push(t(i,r))}),n}function Ga(e){return e&&Object.keys(e)||[]}function Ox(e){return Ga(e).length}function Wr(e){return en(e,t=>t)}function Ur(e,t,n={}){return t=bu(t),M(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function Hf(e,...t){e=bu(e);let n={};return M(t,r=>Ur(r,e,n)),en(n,function(r,o){return r[0]})}const Lx=Hf;function ti(e,t){t=bu(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)}),en(n,i=>i.v)}function qr(e){return function(t){return _r(e,function(n,i){return t[i]===n})}}function bu(e){return Ht(e)?e:t=>t[e]}function Wa(e){return Ht(e)?e:t=>t===e}function Ix(e){return e}function Nx(e){return Number(e)}function xu(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 dn(e,t){return e.bind(t)}function D(e,...t){return Object.assign(e,...t)}function Bx(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];Ot(a)&&Gr(s)&&(s=i[r]=isNaN(+a)?{}:[]),vr(a)?vr(n)?delete i[r]:i[r]=n:i=s}),e}function Xn(e,t){let n={},i=Object(e);return M(t,function(r){r in i&&(n[r]=e[r])}),n}function ni(e,t){let n={},i=Object(e);return M(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function Eu(){}Eu.prototype.get=function(e){return this.$model.properties.get(this,e)},Eu.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function zf(e,t){this.model=e,this.properties=t}zf.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Eu.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,dn(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 $x=D(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),Vf=D(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 wu(e,t){var n=Vf[e];return n?n(t):t}function Su(e){return!!$x[e]}function Gf(e){return!!Vf[e]}function tn(e,t){var n=e.split(/:/),i,r;if(n.length===1)i=e,r=t;else if(n.length===2)i=n[1],r=n[0];else throw new Error("expected <prefix:localName> or <localName>, got "+e);return e=(r?r+":":"")+i,{name:e,prefix:r,localName:i}}function Mn(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}Mn.prototype.build=function(){return Xn(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},Mn.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)},Mn.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},Mn.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=tn(r[0],i),a=tn(r[1],o.prefix).name,s=this.propertiesByName[a];if(s)this.replaceProperty(s,e,n);else throw new Error("refined property <"+a+"> not found");delete e.redefines},Mn.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},Mn.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},Mn.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},Mn.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},Mn.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},Mn.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")},Mn.prototype.hasProperty=function(e){return this.propertiesByName[e]},Mn.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,dn(function(o){o=D({},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 $i(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,M(e,dn(this.registerPackage,this))}$i.prototype.getPackage=function(e){return this.packageMap[e]},$i.prototype.getPackages=function(){return this.packages},$i.prototype.registerPackage=function(e){e=D({},e);var t=this.packageMap;Wf(t,e,"prefix"),Wf(t,e,"uri"),M(e.types,dn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},$i.prototype.registerType=function(e,t){e=D({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:D({},e.meta||{})});var n=tn(e.name,t.prefix),i=n.name,r=Object.create(null);M(e.properties,dn(function(o){var a=tn(o.name,n.prefix),s=a.name;Su(o.type)||(o.type=tn(o.type,a.prefix).name),D(o,{ns:a,name:s}),r[s]=o},this)),D(e,{ns:n,name:i,propertiesByName:r}),M(e.extends,dn(function(o){var a=tn(o,n.prefix),s=this.typeMap[a.name];s.traits=s.traits||[],s.traits.push(i)},this)),this.definePackage(e,t),this.typeMap[i]=e},$i.prototype.mapTypes=function(e,t,n){var i=Su(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,u){var l=tn(c,Su(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)},$i.prototype.getEffectiveDescriptor=function(e){var t=tn(e),n=new Mn(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},$i.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function Wf(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function br(e){this.model=e}br.prototype.set=function(e,t,n){if(!gn(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;jx(n)?i?delete e[r]:delete e.$attrs[Ru(t)]:i?r in e?e[r]=n:Uf(e,i,n):e.$attrs[Ru(t)]=n},br.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[Ru(t)];var i=n.name;return!e[i]&&n.isMany&&Uf(e,n,[]),e[i]},br.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=D({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},br.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},br.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},br.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 jx(e){return typeof e>"u"}function Uf(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Ru(e){return e.replace(/^:/,"")}function Nn(e,t={}){this.properties=new br(this),this.factory=new zf(this,this.properties),this.registry=new $i(e,this.properties),this.typeCache=Object.create(null),this.config=t}Nn.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},Nn.prototype.getType=function(e){var t=this.typeCache,n=gn(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},Nn.prototype.createAny=function(e,t,n){var i=tn(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){Bx(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){Ft(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},Nn.prototype.getPackage=function(e){return this.registry.getPackage(e)},Nn.prototype.getPackages=function(){return this.registry.getPackages()},Nn.prototype.getElementDescriptor=function(e){return e.$descriptor},Nn.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},Nn.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},Nn.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var qf=String.fromCharCode,Fx=Object.prototype.hasOwnProperty,Hx=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,Lo={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(Lo).forEach(function(e){Lo[e.toUpperCase()]=Lo[e]});function zx(e,t,n,i){return i?Fx.call(Lo,i)?Lo[i]:"&"+i+";":qf(t||parseInt(n,16))}function xr(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(Hx,zx):e}var Yf="non-whitespace outside of root node";function ji(e){return new Error(e)}function Vx(e){return"missing namespace for prefix <"+e+">"}function Ua(e){return{get:e,enumerable:!0}}function Gx(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var Kf=Symbol("nameCache");function Cu(e){return e+"$uri"}function Wx(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[Cu(i)]=n;return t}function qa(){return{line:0,column:0}}function Ux(e){throw e}function Xf(e){if(!this)return new Xf(e);var t=e&&e.proxy,n,i,r,o,a=Ux,s,c,u,l,p=qa,f=!1,d=!1,h="",m=!1,g=!1,R=null,E=!1,x,b,w,T;function L(N){N instanceof Error||(N=ji(N)),R=N,a(N,p)}function A(N){s&&(N instanceof Error||(N=ji(N)),s(N,p))}this.on=function(N,z){if(typeof z!="function")throw ji("required args <name, cb>");switch(N){case"openTag":i=z;break;case"text":n=z;break;case"closeTag":r=z;break;case"error":a=z;break;case"warn":s=z;break;case"cdata":o=z;break;case"attention":l=z;break;case"question":u=z;break;case"comment":c=z;break;default:throw ji("unsupported event: "+N)}return this},this.ns=function(N){if(typeof N>"u"&&(N={}),typeof N!="object")throw ji("required args <nsMap={}>");var z=Object.create(null),ce;for(ce in N)z[ce]=N[ce];return g=!0,T=z,this};function F(){x=g?[]:null,b=g?Wx(T):null,w=[],p=qa,E=!1,R=null,d=!1,h=""}this.parse=function(N){if(typeof N!="string")throw ji("required args <xml=string>");if(f)throw ji("parse during stream; call end() first");return F(),H(N),p=qa,E=!1,R},this.write=function(N){if(typeof N!="string")throw ji("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,E=!1,R},this.stop=function(){E=!0};function H(N,z=!1){var ce=null,Be=null,it,X=0,ae=!1,me=!1,se=0,pe=0,ee,$,B,U,Pe,wt,C,_,y,k="",I=0,W;function oe(Je,kt){var Wt=Je.indexOf(":");if(Wt===-1)return Je;var an=b[Je.substring(0,Wt)];return an?kt===an?Je.substr(Wt+1):an+Je.substr(Wt):(A(Vx(Je.substring(0,Wt))),null)}function Ae(){if(W!==null)return W;var Je,kt,Wt=g&&b.xmlns,an=g&&m?[]:null,at=I,$t=k,jt=$t.length,zr,An,Jn,Ln,Dt,ei={},Do=new Set,Tn,Ve,We;e:for(;at<jt;at++)if(Tn=!1,Ve=$t.charCodeAt(at),!(Ve===32||Ve<14&&Ve>8)){for((Ve<65||Ve>122||Ve>90&&Ve<97)&&Ve!==95&&Ve!==58&&(A("illegal first char attribute name"),Tn=!0),We=at+1;We<jt;We++)if(Ve=$t.charCodeAt(We),!(Ve>96&&Ve<123||Ve>64&&Ve<91||Ve>47&&Ve<59||Ve===46||Ve===45||Ve===95)){if(Ve===32||Ve<14&&Ve>8){A("missing attribute value"),at=We;continue e}if(Ve===61)break;A("illegal attribute name char"),Tn=!0}if(Dt=$t.substring(at,We),Dt==="xmlns:xmlns"&&(A("illegal declaration of xmlns"),Tn=!0),Ve=$t.charCodeAt(We+1),Ve===34)We=$t.indexOf('"',at=We+2),We===-1&&(We=$t.indexOf("'",at),We!==-1&&(A("attribute value quote missmatch"),Tn=!0));else if(Ve===39)We=$t.indexOf("'",at=We+2),We===-1&&(We=$t.indexOf('"',at),We!==-1&&(A("attribute value quote missmatch"),Tn=!0));else for(A("missing attribute value quotes"),Tn=!0,We=We+1;We<jt&&(Ve=$t.charCodeAt(We+1),!(Ve===32||Ve<14&&Ve>8));We++);for(We===-1&&(A("missing closing quotes"),We=jt,Tn=!0),Tn||(Jn=$t.substring(at,We)),at=We;We+1<jt&&(Ve=$t.charCodeAt(We+1),!(Ve===32||Ve<14&&Ve>8));We++)at===We&&(A("illegal character after attribute end"),Tn=!0);if(at=We+1,Tn)continue e;if(Do.has(Dt)){A("attribute <"+Dt+"> already defined");continue}if(Do.add(Dt),!g){ei[Dt]=Jn;continue}if(m){if(An=Dt==="xmlns"?"xmlns":Dt.charCodeAt(0)===120&&Dt.substr(0,6)==="xmlns:"?Dt.substr(6):null,An!==null){if(Je=xr(Jn),kt=Cu(An),Ln=T[Je],!Ln){if(An==="xmlns"||kt in b&&b[kt]!==Je)do Ln="ns"+X++;while(typeof b[Ln]<"u");else Ln=An;T[Je]=Ln}b[An]!==Ln&&(zr||(b=Gx(b),zr=!0),b[An]=Ln,An==="xmlns"&&(b[Cu(Ln)]=Je,Wt=Ln),b[kt]=Je),ei[Dt]=Jn;continue}an.push(Dt,Jn);continue}Dt=oe(Dt,Wt),Dt!==null&&(ei[Dt]=Jn)}if(m)for(at=0,jt=an.length;at<jt;at++)Dt=oe(an[at++],Wt),Jn=an[at],Dt!==null&&(ei[Dt]=Jn);return W=ei}function je(){for(var Je=/(\r\n|\r|\n)/g,kt=0,Wt=0,an=0,at=pe,$t,jt;se>=an&&($t=Je.exec(N),!(!$t||(at=$t[0].length+$t.index,at>se)));)kt+=1,an=at;return se==-1?(Wt=at,jt=N.substring(pe)):pe===0?jt=N.substring(pe,se):(Wt=se-an,jt=pe==-1?N.substring(se):N.substring(se,pe+1)),{data:jt,line:kt,column:Wt}}for(p=je,t&&(y=Object.create({},{name:Ua(function(){return C}),originalName:Ua(function(){return _}),attrs:Ua(Ae),ns:Ua(function(){return b})}));pe!==-1;){if(N.charCodeAt(pe)===60?se=pe:se=N.indexOf("<",pe),se===-1){if(z)return N.substring(pe);if(w.length)return L("unexpected end of file");if(!d)return L("missing start tag");pe<N.length&&N.substring(pe).trim()&&A(Yf);return}if(d||(d=!0),pe!==se){if(w.length){if(n&&(n(N.substring(pe,se),xr,p),E))return}else if(N.substring(pe,se).trim()&&(A(Yf),E))return}if(U=N.charCodeAt(se+1),U===33){if(B=N.charCodeAt(se+2),B===91&&N.substr(se+3,6)==="CDATA["){if(pe=N.indexOf("]]>",se),pe===-1)return z?N.substring(se):L("unclosed cdata");if(o&&(o(N.substring(se+9,pe),p),E))return;pe+=3;continue}if(B===45&&N.charCodeAt(se+3)===45){if(pe=N.indexOf("-->",se),pe===-1)return z?N.substring(se):L("unclosed comment");if(c&&(c(N.substring(se+4,pe),xr,p),E))return;pe+=3;continue}}if(U===63){if(pe=N.indexOf("?>",se),pe===-1)return z?N.substring(se):L("unclosed question");if(u&&(u(N.substring(se,pe+2),p),E))return;pe+=2;continue}for(ee=se+1;;ee++){if(Pe=N.charCodeAt(ee),isNaN(Pe))return z?N.substring(se):(pe=-1,L("unclosed tag"));if(Pe===34)B=N.indexOf('"',ee+1),ee=B!==-1?B:ee;else if(Pe===39)B=N.indexOf("'",ee+1),ee=B!==-1?B:ee;else if(Pe===62){pe=ee;break}}if(U===33){if(l&&(l(N.substring(se,pe+1),xr,p),E))return;pe+=1;continue}if(W={},U===47){if(ae=!1,me=!0,!w.length)return L("missing open tag");if(ee=C=w.pop(),B=se+2+ee.length,N.substring(se+2,B)!==ee)return L("closing tag mismatch");for(;B<pe;B++)if(U=N.charCodeAt(B),!(U===32||U>8&&U<14))return L("close tag")}else{if(N.charCodeAt(pe-1)===47?(ee=C=N.substring(se+1,pe-1),ae=!0,me=!0):(ee=C=N.substring(se+1,pe),ae=!0,me=!1),!(U>96&&U<123||U>64&&U<91||U===95||U===58))return L("illegal first char nodeName");for(B=1,$=ee.length;B<$;B++)if(U=ee.charCodeAt(B),!(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,B),W=null;break}return L("invalid nodeName")}me||w.push(C)}if(g){it=b,ae&&(me||x.push(it),W===null&&(m=ee.indexOf("xmlns",B)!==-1)&&(I=B,k=ee,Ae(),m=!1)),_=C,Be!==b&&(ce=b[Kf],ce===void 0&&(ce=b[Kf]=Object.create(null)),Be=b);var _t=ce[C];if(_t!==void 0)C=_t;else{if(U=C.indexOf(":"),U!==-1){if(wt=b[C.substring(0,U)],!wt)return L("missing namespace on <"+_+">");C=C.substr(U+1)}else wt=b.xmlns;wt&&(C=wt+":"+C),ce[_]=C}}if(ae&&(I=B,k=ee,i&&(t?i(y,xr,me,p):i(C,Ae,xr,me,p),E)))return;if(me){if(r&&(r(t?y:C,xr,ae,p),E))return;g&&(ae?b=it:b=x.pop())}pe+=1}}}function Zf(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var Pu={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},Qf="property";function Jf(e){return e.xml&&e.xml.serialize}function qx(e){const t=Jf(e);return t!==Qf&&(t||null)}function Yx(e){return e.charAt(0).toUpperCase()+e.slice(1)}function ed(e,t){return Zf(t)?e.prefix+":"+Yx(e.localName):e.name}function Kx(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 Xx(e,t,n){const i=tn(e,t.xmlns),r=`${t[i.prefix]||i.prefix}:${i.localName}`,o=tn(r);var a=n.getPackage(o.prefix);return Kx(o,a)}function Fi(e){return new Error(e)}function bi(e){return e.$descriptor}function Zx(e){D(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw Fi("expected element");var n=this.elementsById,i=bi(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 Fi("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function Io(){}Io.prototype.handleEnd=function(){},Io.prototype.handleText=function(){},Io.prototype.handleNode=function(){};function Au(){}Au.prototype=Object.create(Io.prototype),Au.prototype.handleNode=function(){return this};function Yr(){}Yr.prototype=Object.create(Io.prototype),Yr.prototype.handleText=function(e){this.body=(this.body||"")+e};function No(e,t){this.property=e,this.context=t}No.prototype=Object.create(Yr.prototype),No.prototype.handleNode=function(e){if(this.element)throw Fi("expected no sub nodes");return this.element=this.createReference(e),this},No.prototype.handleEnd=function(){this.element.id=this.body},No.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function Tu(e,t){this.element=t,this.propertyDesc=e}Tu.prototype=Object.create(Yr.prototype),Tu.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=wu(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function Ya(){}Ya.prototype=Object.create(Yr.prototype),Ya.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 un(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}un.prototype=Object.create(Ya.prototype),un.prototype.addReference=function(e){this.context.addReference(e)},un.prototype.handleText=function(e){var t=this.element,n=bi(t),i=n.bodyProperty;if(!i)throw Fi("unexpected body text <"+e+">");Yr.prototype.handleText.call(this,e)},un.prototype.handleEnd=function(){var e=this.body,t=this.element,n=bi(t),i=n.bodyProperty;i&&e!==void 0&&(e=wu(i.type,e),t.set(i.name,e))},un.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=bi(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=wu(l.type,c):u==="xmlns"?u=":"+u:(s=tn(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},un.prototype.getPropertyForNode=function(e){var t=e.name,n=tn(t),i=this.type,r=this.model,o=bi(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const u=qx(s);if(u){const l=e.attributes[u];if(l){const p=Xx(l,e.ns,r),f=r.getType(p);return D({},s,{effectiveType:bi(f).name})}}return s}var c=r.getPackage(n.prefix);if(c){const u=ed(n,c),l=r.getType(u);if(s=rt(o.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&l.hasType(p.type)}),s)return D({},s,{effectiveType:bi(l).name})}else if(s=rt(o.properties,function(u){return!u.isReference&&!u.isAttribute&&u.type==="Element"}),s)return s;throw Fi("unrecognized element <"+n.name+">")},un.prototype.toString=function(){return"ElementDescriptor["+bi(this.type).name+"]"},un.prototype.valueHandler=function(e,t){return new Tu(e,t)},un.prototype.referenceHandler=function(e){return new No(e,this.context)},un.prototype.handler=function(e){return e==="Element"?new Kr(this.model,e,this.context):new un(this.model,e,this.context)},un.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,Gf(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?(D(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function Mu(e,t,n){un.call(this,e,t,n)}Mu.prototype=Object.create(un.prototype),Mu.prototype.createElement=function(e){var t=e.name,n=tn(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&ed(n,o)||t;if(!r.hasType(a))throw Fi("unexpected element <"+e.originalName+">");return un.prototype.createElement.call(this,e)};function Kr(e,t,n){this.model=e,this.context=n}Kr.prototype=Object.create(Ya.prototype),Kr.prototype.createElement=function(e){var t=e.name,n=tn(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},Kr.prototype.handleChild=function(e){var t=new Kr(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},Kr.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function ku(e){e instanceof Nn&&(e={model:e}),D(this,{lax:!1},e)}ku.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof un?(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 Zx(D({},t,{rootHandler:i})),s=new Xf({proxy:!0}),c=Qx();i.context=a,c.push(i);function u(w,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 z="unparsable content "+(N?N+" ":"")+`detected
2
+ line: `+F+`
3
+ column: `+H+`
4
+ nested error: `+w.message;if(L)return a.addWarning({message:z,error:w}),!0;throw Fi(z)}function l(w,T){return u(w,T,!0)}function p(){var w=a.elementsById,T=a.references,L,A;for(L=0;A=T[L];L++){var F=A.element,H=w[A.id],N=bi(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 z=F.get(N.name),ce=z.indexOf(A);ce===-1&&(ce=z.length),H?z[ce]=H:z.splice(ce,1)}else F.set(N.name,H)}}function f(){c.pop().handleEnd()}var d=/^<\?xml /i,h=/ encoding="([^"]+)"/i,m=/^utf-8$/i;function g(w){if(d.test(w)){var T=h.exec(w),L=T&&T[1];!L||m.test(L)||a.addWarning({message:"unsupported document encoding <"+L+">, falling back to UTF-8"})}}function R(w,T){var L=c.peek();try{c.push(L.handleNode(w))}catch(A){u(A,T,o)&&c.push(new Au)}}function E(w,T){try{c.peek().handleText(w)}catch(L){l(L,T)}}function x(w,T){w.trim()&&E(w,T)}var b=r.getPackages().reduce(function(w,T){return w[T.uri]=T.prefix,w},Object.entries(Pu).reduce(function(w,[T,L]){return w[L]=T,w},r.config&&r.config.nsMap||{}));return s.ns(b).on("openTag",function(w,T,L,A){var F=w.attrs||{},H=Object.keys(F).reduce(function(z,ce){var Be=T(F[ce]);return z[ce]=Be,z},{}),N={name:w.name,originalName:w.originalName,attributes:H,ns:w.ns};R(N,A)}).on("question",g).on("closeTag",f).on("cdata",E).on("text",function(w,T,L){x(T(w),L)}).on("error",u).on("warn",l),new Promise(function(w,T){var L;try{s.parse(e),p()}catch(z){L=z}var A=i.element;!L&&!A&&(L=Fi("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)):w({rootElement:A,elementsById:N,references:H,warnings:F})})},ku.prototype.handler=function(e){return new Mu(this.model,e)};function Qx(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var Jx=`<?xml version="1.0" encoding="UTF-8"?>
5
+ `,e0=/<|>|'|"|&|\n\r|\n/g,td=/<|>|&/g;function ii(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}ii.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},ii.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},ii.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},ii.prototype.add=function(e,t){this.uriMap[e.uri]=e,t?this.wellknown.push(e):this.custom.push(e),this.mapPrefix(e.prefix,e.uri)},ii.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},ii.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},ii.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},ii.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},ii.prototype.getUsed=function(e){var t=[].concat(this.wellknown,this.custom);return t.filter(n=>{var i=this.getNSKey(n);return this.used[i]})};function t0(e){return e.charAt(0).toLowerCase()+e.slice(1)}function n0(e,t){return Zf(t)?t0(e):e}function nd(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function id(e){return gn(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function i0(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 r0(e,t){return t.isGeneric?D({localName:t.ns.localName},e):D({localName:n0(t.ns.localName,t.$pkg)},e)}function o0(e,t){return D({localName:t.ns.localName},e)}function a0(e){var t=e.$descriptor;return Oe(t.properties,function(n){var i=n.name;if(n.isVirtual||!yn(e,i))return!1;var r=e[i];return r===n.default||r===null?!1:n.isMany?r.length:!0})}var s0={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},c0={"<":"lt",">":"gt","&":"amp"};function rd(e,t,n){return e=gn(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function u0(e){return rd(e,e0,s0)}function l0(e){return rd(e,td,c0)}function p0(e){return Oe(e,function(t){return t.isAttr})}function f0(e){return Oe(e,function(t){return!t.isAttr})}function Du(e){this.tagName=e}Du.prototype.build=function(e){return this.element=e,this},Du.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function Er(){}Er.prototype.serializeValue=Er.prototype.serializeTo=function(e){e.append(this.escape?l0(this.value):this.value)},Er.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(td)!==-1&&(this.escape=!0),this};function Ou(e){this.tagName=e}nd(Ou,Er),Ou.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function pt(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}pt.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=a0(e),this.parseAttributes(p0(r)),this.parseContainments(f0(r))),this.parseGenericAttributes(e,i),this},pt.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return r0(t,e)},pt.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return o0(t,e)},pt.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},pt.prototype.nsAttributeName=function(e){var t;if(gn(e)?t=tn(e):t=e.ns,e.inherited)return{localName:t.localName};var n=this.logNamespaceUsed(t);return this.getNamespaces().logUsed(n),this.isLocalNs(n)?{localName:t.localName}:D({localName:t.localName},n)},pt.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}))},pt.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new Er().build({type:"String"},t));var n=e.$children;n&&M(n,i=>{this.body.push(new pt(this).build(i))})},pt.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,r=tn(t),o;if(r.prefix==="xmlns"&&(o={prefix:r.localName,uri:n}),!r.prefix&&r.localName==="xmlns"&&(o={uri:n}),!o)return{name:t,value:n};if(i&&i.getPackage(n))this.logNamespace(o,!0,!0);else{var a=this.logNamespaceUsed(o,!0);this.getNamespaces().logUsed(a)}},pt.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},pt.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)}})},pt.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 Er().build(r,o[0]));else if(Gf(r.type))M(o,function(u){n.push(new Ou(t.addTagName(t.nsPropertyTagName(r))).build(r,u))});else if(a)M(o,function(u){n.push(new Du(t.addTagName(t.nsPropertyTagName(r))).build(u))});else{var c=Jf(r);M(o,function(u){var l;c?c===Qf?l=new pt(t,r):l=new Ka(t,r,c):l=new pt(t),n.push(l.build(u))})}})},pt.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new ii(i):t=i),t},pt.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},pt.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},pt.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)})},pt.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),id(e)},pt.prototype.addAttribute=function(e,t){var n=this.attrs;gn(t)&&(t=u0(t));var i=Ff(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)},pt.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=i0(n).concat(t)),M(t,function(i){e.append(" ").append(id(i.name)).append('="').append(i.value).append('"')})},pt.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==Er;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 Ka(e,t,n){pt.call(this,e,t),this.serialization=n}nd(Ka,pt),Ka.prototype.parseNsAttributes=function(e){var t=pt.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},Ka.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function d0(){this.value="",this.write=function(e){this.value+=e}}function h0(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=D({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new d0,o=new h0(r,e.format);e.preamble&&o.append(Jx);var a=new pt,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(g0(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function g0(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in Pu)n[i]=Pu[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 Xa(e,t){Nn.call(this,e,t)}Xa.prototype=Object.create(Nn.prototype),Xa.prototype.fromXML=function(e,t,n){gn(t)||(n=t,t="bpmn:Definitions");var i=new ku(D({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},Xa.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 y0="BPMN20",v0="http://www.omg.org/spec/BPMN/20100524/MODEL",_0="bpmn",b0=[],x0=[{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"}]}],E0=[{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"}]}],w0={tagAlias:"lowerCase",typePrefix:"t"},S0={name:y0,uri:v0,prefix:_0,associations:b0,types:x0,enumerations:E0,xml:w0},R0="BPMNDI",C0="http://www.omg.org/spec/BPMN/20100524/DI",P0="bpmndi",A0=[{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"]}],T0=[{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"}]}],M0=[],k0={name:R0,uri:C0,prefix:P0,types:A0,enumerations:T0,associations:M0},D0="DC",O0="http://www.omg.org/spec/DD/20100524/DC",L0="dc",I0=[{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}]}],N0=[],B0={name:D0,uri:O0,prefix:L0,types:I0,associations:N0},$0="DI",j0="http://www.omg.org/spec/DD/20100524/DI",F0="di",H0=[{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"}]}],z0=[],V0={tagAlias:"lowerCase"},G0={name:$0,uri:j0,prefix:F0,types:H0,associations:z0,xml:V0},W0="bpmn.io colors for BPMN",U0="http://bpmn.io/schema/bpmn/biocolor/1.0",q0="bioc",Y0=[{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"}]}],K0=[],X0=[],Z0={name:W0,uri:U0,prefix:q0,types:Y0,enumerations:K0,associations:X0},Q0="BPMN in Color",J0="http://www.omg.org/spec/BPMN/non-normative/color/1.0",eE="color",tE=[{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"}]}],nE=[],iE=[],rE={name:Q0,uri:J0,prefix:eE,types:tE,enumerations:nE,associations:iE};const oE={bpmn:S0,bpmndi:k0,dc:B0,di:G0,bioc:Z0,color:rE};function od(e,t){const n=D({},oE,e);return new Xa(n,t)}const aE={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"}},sE="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",ad="i18n",Za={[ad]:aE,[gu]:If};function sd(){return od(Za)}const cd=sd();async function Lu(e){const{rootElement:t,warnings:n}=await cd.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function cE(e){const{xml:t}=await cd.toXML(e,{format:!0});return t}function Iu(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const Qa=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),uE=1,lE=2;function Hi(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}`}}const ud=20,ld=1;function _n(e){const t=[];for(let n=0;n+1<e.waypoints.length;n++){const i=e.waypoints[n],r=e.waypoints[n+1];Math.abs(i.y-r.y)<.5&&Math.abs(i.x-r.x)>=.5?t.push({axis:"h",at:i.y,lo:Math.min(i.x,r.x),hi:Math.max(i.x,r.x),dir:r.x>i.x?1:-1}):Math.abs(i.x-r.x)<.5&&Math.abs(i.y-r.y)>=.5&&t.push({axis:"v",at:i.x,lo:Math.min(i.y,r.y),hi:Math.max(i.y,r.y),dir:r.y>i.y?1:-1})}return t}function Ja(e,t){let n=null;const i=e.type!==t.type;for(const r of _n(e))for(const o of _n(t)){if(r.axis!==o.axis||Math.abs(r.at-o.at)>ld)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>=ud&&(!n||s>n.length)&&(n={axis:r.axis,length:s,kind:a})}return n}function pd(e,t){const n=Ja(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function pE(e,t){let n=0;for(const i of t)i.id!==e.id&&pd(e,i)&&n++;return n}function Bo(e,t){let n=0;for(const i of t)i.id!==e.id&&Ja(e,i)&&n++;return n}const fd=15,dd=20;function fE(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-dd||t.at>n[1]+dd)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 Nu=20;function es(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>ld)continue;const r=Math.max(e.lo,i.lo),o=Math.min(e.hi,i.hi);o-r<ud||n.push([r-Nu,o+Nu])}return n}function ts(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of _n(e)){const o=fE(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of es(r,_n(a)))if(Math.min(c,o[1])>Math.max(s,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const dE=1,hE=(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 mE(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 hd(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 gE=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,$o=1;function jo(e,t){const n=e.x+$o,i=e.x+e.width-$o,r=e.y+$o,o=e.y+e.height-$o;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 Bu(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 md(e,t){const n=e.label;if(!n)return null;if(_n(e).some(i=>jo(n,i)))return e.id;for(const i of[...t.edges].filter(r=>r.id!==e.id).sort((r,o)=>r.id.localeCompare(o.id)))if(_n(i).some(r=>jo(n,r)))return i.id;for(const i of t.shapes.filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(Bu(i).some(r=>jo(n,r)))return i.id;return null}function ri(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(mE(e.waypoints[o],e.waypoints[o+1],r,lE)){i.push(r);break}}return i}function yE(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 gd=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function ns(e,t){let n=0;for(const i of t){if(i.id===e.id||gd(e,i))continue;let r=!1;for(let o=0;o+1<e.waypoints.length&&!r;o++)for(let a=0;a+1<i.waypoints.length&&!r;a++)yE(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function wr(e,t){let n=0;for(const i of t)i.id===e.id||gd(e,i)||ns(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function yd(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++)ns(n[i],[n[r]])>0&&(t+=n[i].type===n[r].type?2:1);return t}function $u(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(ns(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]}`))}const zi=e=>e.shapes.filter(t=>!t.container);function vE(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 ju(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 Vi(e){const t=[],n=e.shapes.filter(a=>!a.container);for(const a of e.edges)for(const s of ri(a,n))t.push({kind:"edge-crosses-shape",edge:a.id,shape:s.id});const i=n.filter(a=>!a.attached);for(let a=0;a<i.length;a++)for(let s=a+1;s<i.length;s++){const c=i[a],u=i[s];if(!hd(c,u,uE))continue;const l=c.id<u.id?[c.id,u.id]:[u.id,c.id];t.push({kind:"shape-overlap",shapes:l,identical:gE(c,u)})}for(let a=0;a<e.edges.length;a++)for(let s=a+1;s<e.edges.length;s++){const c=e.edges[a],u=e.edges[s],l=Ja(c,u);if(!l)continue;const p=c.id<u.id?[c.id,u.id]:[u.id,c.id];t.push({kind:l.kind==="opposite"?"edge-overlap-opposite":"edge-overlap-mixed",edges:p,axis:l.axis,length:Math.round(l.length)})}for(const a of e.edges){if(!a.label)continue;const s=ts(a,e.edges);s&&t.push({kind:"label-on-shared-segment",edge:a.id,other:s.other,axis:s.axis})}for(const a of e.edges){if(!a.label)continue;const s=md(a,e);s&&t.push({kind:"label-over-line",edge:a.id,line:s})}const r=ju(e);for(const a of n)if(a.type==="bpmn:TextAnnotation")for(const{owner:s,rect:c}of r)s!==a.id&&hd(a,c,$o)&&t.push({kind:"annotation-over-label",annotation:a.id,label:s});const o=new Map(e.shapes.map(a=>[a.id,a]));for(const a of n){const s=a.parent??vE(a,e,o);if(!s)continue;const c=o.get(s);!c||!c.container||hE(c,a,dE)||t.push({kind:"shape-outside-container",shape:a.id,container:c.id})}return t.sort((a,s)=>Hi(a).localeCompare(Hi(s)))}const xt=e=>typeof e=="object"&&e!==null?e:void 0,yt=e=>typeof e=="number"?e:0,Sr=e=>{const t=xt(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function _E(e){const t=xt(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=Sr(o);a&&n.push(a)}}return n}function bE(e,t){const n=xt(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const r=Sr(n);return r?t.get(r):void 0}if(Qa.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return Sr(n)}function vd(e){var o,a,s,c,u;const t=[],n=[],i=((o=xt(e))==null?void 0:o.diagrams)??[],r=new Map;for(const l of((a=xt(e))==null?void 0:a.rootElements)??[]){const p=xt(l);if((p==null?void 0:p.$type)==="bpmn:Collaboration")for(const f of p.participants??[]){const d=xt(f),h=Sr(d),m=Sr(d==null?void 0:d.processRef);h&&m&&r.set(m,h)}}for(const l of i){const p=xt((s=xt(l))==null?void 0:s.plane),f=(p==null?void 0:p.planeElement)??[];for(const d of f){const h=xt(d);if(!h)continue;const m=xt(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:"",E=xt(h.bounds);if(E){const b=h.isExpanded===!1,w=xt((c=xt(h.label))==null?void 0:c.bounds);t.push({id:g,type:R,x:yt(E.x),y:yt(E.y),width:yt(E.width),height:yt(E.height),container:Qa.has(R)&&!b,attached:(m==null?void 0:m.attachedToRef)!==void 0,...m?{parent:bE(m,r)}:{},...w?{label:{x:yt(w.x),y:yt(w.y),width:yt(w.width),height:yt(w.height)}}:{}});continue}const x=h.waypoint;if(Array.isArray(x)){const b=xt((u=xt(h.label))==null?void 0:u.bounds);n.push({id:g,type:R,waypoints:x.map(w=>{var T,L;return{x:yt((T=xt(w))==null?void 0:T.x),y:yt((L=xt(w))==null?void 0:L.y)}}),endpoints:_E(m),...b?{label:{x:yt(b.x),y:yt(b.y),width:yt(b.width),height:yt(b.height)}}:{}})}}}return{shapes:t,edges:n}}function _d(e){return Vi(vd(e))}async function xE(e){const{definitions:t,warnings:n}=await Lu(e);return{findings:_d(t),warnings:n}}function ln(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=xt(r.label);n.push({id:r.id,type:o,waypoints:a.map(d=>({x:yt(d.x),y:yt(d.y)})),endpoints:[Sr(r.source),Sr(r.target)].filter(d=>!!d),...f&&typeof f.x=="number"?{label:{x:f.x,y:yt(f.y),width:yt(f.width),height:yt(f.height)}}:{}});continue}if(typeof r.x!="number"||typeof r.y!="number")continue;const s=xt(r.businessObject),c=xt(r.label);let u=xt(r.parent);for(;u&&u.type==="bpmn:Lane";)u=xt(u.parent);const l=typeof(u==null?void 0:u.type)=="string"?u.type:"",p=u&&Qa.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:yt(r.width),height:yt(r.height),container:Qa.has(o)&&r.collapsed!==!0,attached:(s==null?void 0:s.attachedToRef)!==void 0,...p!==void 0?{parent:p}:{},...c&&typeof c.x=="number"?{label:{x:c.x,y:yt(c.y),width:yt(c.width),height:yt(c.height)}}:{}})}return{shapes:t,edges:n}}const EE={"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 wE(e,t){const n=EE[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function bd(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function xd(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 wE(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&bd(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?bd(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 Ed=20,SE=4,zt=(e,t)=>Math.abs(e-t)<.5;function wd(e,t,n,i=Ed){if(zt(e.y,t.y)&&!zt(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(zt(e.x,t.x)&&!zt(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 Sd(e,t,n=Ed){if(e.length!==4)return null;const[i,r,o,a]=e;if(zt(i.y,r.y)&&zt(r.x,o.x)&&zt(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(zt(i.x,r.x)&&zt(r.y,o.y)&&zt(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 Rd(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 Cd=30,RE=[0,-25,25,-40,40];function CE(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+Cd:s-Cd,u=a?i.y+i.height:i.y,l=n.x+n.width/2,p=i.x+i.width/2;return RE.map(f=>[{x:l,y:s},{x:l,y:c},{x:p+f,y:c},{x:p+f,y:u}])}const PE=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],is=(e,t,n)=>ri({...e,waypoints:t},n).length;function Pd(e,t,n,i){let r=[...e.waypoints],o=is(e,r,t);if(o===0)return null;let a=!1;for(const p of Rd(e,t))if(is(e,p,t)===0)return p;const s=(i??[]).filter(p=>p.id!==e.id).flatMap(_n),c=p=>_n({...e,waypoints:p}).some(f=>es(f,s).length>0),u=CE(e,t).filter(p=>is(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<SE&&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)||ri({...e,waypoints:[h,m]},[g]).length===0)continue;const R=wd(h,m,g),E=R?R.map(b=>PE(r,d,b)):Sd(r,g)??[];if(!E.length)continue;const x=[...E].sort((b,w)=>Number(l(w))-Number(l(b)));for(const b of x){const w=is(e,b,t);if(w<o){r=b,o=w,f=!0,a=!0;break}}if(f)break}}if(!f)break}return a&&o===0?r:null}function Ad(e,t){const{elementRegistry:n}=e,i=e.modeling,r=ln(n),o=zi(r),a=Vi(r).filter(c=>c.kind==="edge-crosses-shape"&&!t.has(Hi(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=Pd(u,o,f,r.edges);d&&i.updateWaypoints(l,d)}}const AE=10;function Td(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 Md(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(z=>z.type==="bpmn:Participant"&&z.container),i=t.shapes.find(z=>z.id===e.endpoints[0]),r=t.shapes.find(z=>z.id===e.endpoints[1]);if(!i||!r)return null;const o=Td(i,n),a=Td(r,n);if(!o||!a||o.id===a.id)return null;const s=a.y>o.y,c=s?o:a,u=s?a:o,l=n.filter(z=>z.id!==o.id&&z.id!==a.id&&z.y>=c.y+c.height&&z.y+z.height<=u.y).sort((z,ce)=>z.y-ce.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],E=e.waypoints[e.waypoints.length-1],x=zi(t),b=t.edges.filter(z=>z.id!==e.id),w=wr(e,b),T=ri(e,x).length;if(w===0&&T===0)return null;const L=Math.min(...l.map(z=>z.x)),A=Math.max(...l.map(z=>z.x+z.width)),F=(R.x+E.x)/2,H=z=>z.filter((ce,Be)=>Be===0||!(zt(ce.x,z[Be-1].x)&&zt(ce.y,z[Be-1].y)));let N;for(let z=L;z<=A;z+=AE){const ce=H([R,{x:R.x,y:m},{x:z,y:m},{x:z,y:g},{x:E.x,y:g},E]),Be={...e,waypoints:ce};if(ri(Be,x).length>0)continue;const it=wr(Be,b),X=Math.abs(z-F);(!N||it<N.cross||it===N.cross&&X<N.detour)&&(N={pts:ce,cross:it,detour:X})}return N&&(T>0?N.cross<=w:N.cross<w)?N.pts:null}function kd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=ln(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=ln(n),s=a.edges.find(l=>l.id===o.id);if(!s)continue;const c=Md(s,a);if(!c)continue;const u=n.get(o.id);u&&i.updateWaypoints(u,c)}}const Xr=[25,-25,40,-40],rs=35;function Dd(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-rs:n.y+n.height+rs,p=[];for(const E of[0,...Xr]){if(Math.abs(E)>=i.width/2-5)continue;const x=o+E;p.push({pts:[{x:n.x,y:r},{x,y:r},{x,y:c}],cost:Math.abs(E)});for(const b of[0,...Xr]){if(Math.abs(b)>=n.width/2-5)continue;const w=a+b;p.push({pts:[{x:w,y:u},{x:w,y:l},{x,y:l},{x,y:c}],cost:Math.abs(E)+Math.abs(b)})}}const f=50,d=i.y+i.height/2,h=s?n.y+n.height:n.y;for(const E of[0,...Xr]){if(Math.abs(E)>=n.width/2-5)continue;const x=a+E;p.push({pts:[{x,y:h},{x,y:d},{x:i.x+i.width,y:d}],cost:f+Math.abs(E)})}const m=60,g=s?i.y+i.height:i.y,R=s?i.y+i.height+rs:i.y-rs;for(const E of[0,...Xr]){if(Math.abs(E)>=i.width/2-5)continue;const x=o+E;for(const b of[0,...Xr]){if(Math.abs(b)>=n.width/2-5)continue;const w=a+b;p.push({pts:[{x:w,y:h},{x:w,y:R},{x,y:R},{x,y:g}],cost:m+Math.abs(E)+Math.abs(b)})}}return p}const os=30;function Od(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],r=e[n+1],o=zt(i.y,r.y)&&!zt(i.x,r.x),a=zt(i.x,r.x)&&!zt(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)<os||Math.abs(i.y-(s.y+s.height))<os)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)<os||Math.abs(i.x-(s.x+s.width))<os)return!0}}return!1}const as=40;function TE(e,t,n){let i=0;for(const r of t){if(r.container||n.includes(r.id))continue;const o=r.x-as,a=r.x+r.width+as,s=r.y-as,c=r.y+r.height+as;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 Ld(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(f=>f.container);if(!Od(e.waypoints,n))return null;const i=new Map(t.shapes.map(f=>[f.id,f])),r=zi(t),o=t.edges.filter(f=>f.id!==e.id),a=Bo(e,o),s=wr(e,o),c=f=>TE(f,t.shapes,e.endpoints)+(Od(f,n)?1:0),u=c(e.waypoints),l=f=>f.reduce((d,h,m)=>m?d+Math.abs(h.x-f[m-1].x)+Math.abs(h.y-f[m-1].y):0,0);let p;for(const{pts:f,cost:d}of Dd(e,i)){const h={...e,waypoints:f};if(ri(h,r).length>0||Bo(h,o)>a||wr(h,o)>s)continue;const m=c(f);if(m>=u)continue;const g=l(f);(!p||m<p.sc||m===p.sc&&(d<p.cost||d===p.cost&&g<p.len))&&(p={pts:f,sc:m,cost:d,len:g})}return(p==null?void 0:p.pts)??null}function Id(e,t){const{elementRegistry:n}=e,i=e.modeling,r=ln(n).edges.filter(o=>o.type==="bpmn:SequenceFlow"&&!t.has(o.id)).map(o=>o.id).sort();for(const o of r){const a=ln(n),s=a.edges.find(l=>l.id===o);if(!s)continue;const c=Ld(s,a);if(!c)continue;const u=n.get(o);u&&i.updateWaypoints(u,c)}}function ME(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=zt(n[0].x,n[1].x)&&!zt(n[0].y,n[1].y),s=zt(n[n.length-1].x,n[n.length-2].x)&&!zt(n[n.length-1].y,n[n.length-2].y);for(const c of Xr){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 Nd(e,t){const n=new Map(t.shapes.map(l=>[l.id,l])),i=zi(t),r=t.edges.filter(l=>l.id!==e.id),o=Bo(e,r);if(o===0)return null;const a=wr(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=[...Dd(e,n),...ME(e,n)];for(const{pts:l,cost:p}of u){const f={...e,waypoints:l};if(ri(f,i).length>0)continue;const d=Bo(f,r),h=wr(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 Bd(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=ln(i),a=Vi(o).filter(l=>(l.kind==="edge-overlap-opposite"||l.kind==="edge-overlap-mixed")&&!t.has(Hi(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=ln(i),f=p.edges.find(m=>m.id===l);if(!f)continue;const d=Nd(f,p);if(!d)continue;const h=i.get(l);h&&r.updateWaypoints(h,d)}}const kE=10,DE=(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 $d(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!ts(e,i))return null;const r=zi(t),o=i.flatMap(_n);for(const a of _n(e)){let s=[[a.lo,a.hi]];for(const[d,h]of es(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(([E,x])=>x>E)});const c=a.axis==="h"?n.width:n.height,u=s.find(([d,h])=>h-d>=c+kE*2);if(!u)continue;const l=(u[0]+u[1])/2,p=a.axis==="h"?{x:l,y:a.at-fd}:{x:a.at+Zr+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(!ts({...e,label:f},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&DE(f,d)))return f}return null}const Zr=8;function jd(e,t){const n=e.label;if(!n)return null;const i=_n(e);if(!i.length)return null;const r=n.x+n.width/2,o=n.y+n.height/2,a=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(_n),...t.shapes.filter(f=>f.container).flatMap(Bu)],u=f=>!c.some(d=>jo(f,d));if(u(n))return null;const l=(s.axis==="v"?n.height:n.width)+Zr,p=[0,-l,l,-2*l,2*l];if(s.axis==="v")for(const f of[s.at+Zr,s.at-Zr-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-Zr-n.height,s.at+Zr])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 Fd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=ln(n);for(const o of r.edges){if(!o.label||t.has(o.id))continue;const a=jd(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 Hd(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=ln(i),a=Vi(o).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(Hi(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=$d(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})}}const OE=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,zd=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),Vd={"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}]},ss=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Fu=e=>typeof e=="string"&&e!=="";function LE(e){const t=[];function n(i,r,o,a){if(a===null){Fu(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!ss(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)Fu(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{if(!ss(i)||!Fu(i.kind)||!(i.kind in Vd)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const o of Vd[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(!ss(u))break;u=u[p]}if(!ss(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 Gd(e,t){const n=LE(e);if(n.length>0)return n;const i=[],r=new Map,o=new Map;function a(f,d,h){if(!OE.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:E,condition:x}=f.flow,b=u(d,g,"source",["flowNode"]),w=u(d,R,"target",["flowNode"]);b&&w&&c(g)!==c(R)&&i.push({kind:"flow-cross-pool",opIndex:d,id:m}),E!==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,E=u(d,g,"source",["flowNode","participant"]),x=u(d,R,"target",["flowNode","participant"]);if(E&&x){const b=c(g),w=c(R);b!==void 0&&b===w&&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(E=>E===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"),E=u(d,g,"target");if(R&&E){const x=new Set([R,E]);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,E=u(d,g,"source"),x=u(d,R,"target");E&&x&&E!=="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&&zd.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(E=>E.id);for(const E of m)g.includes(E)||i.push({kind:"lane-shrink-unsupported",opIndex:d,participant:f.id,lane:E});for(const E of g)t.categoryOf(E)!==void 0&&!m.includes(E)&&i.push({kind:"id-duplicate",opIndex:d,id:E});const R=g.filter(E=>m.includes(E));R.length===m.length&&R.some((E,x)=>E!==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),E=f.source??(R==null?void 0:R.source),x=f.target??(R==null?void 0:R.target);m&&g&&E!==void 0&&x!==void 0&&new Set([c(E),c(x),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&&zd.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 Qr={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},IE=/[ᄀ-ᇿ -〿぀-ヿ㐀-鿿가-힯＀-⦆]/;function NE(e){const t=Qr;return IE.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 Fo(e,t){let n=0;for(const i of e)n+=t*NE(i);return n}function Wd(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&BE(e),$E(e),jE(e),FE(e)}function BE(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:Fo(r,o),fontBoundingBoxAscent:o*Qr.ascentEm,fontBoundingBoxDescent:o*Qr.descentEm,actualBoundingBoxAscent:o*Qr.ascentEm,actualBoundingBoxDescent:o*Qr.descentEm}}};t.getContext=()=>n}function $E(e){if(e.SVGMatrix)return;class t{constructor(){Vr(this,"a",1);Vr(this,"b",0);Vr(this,"c",0);Vr(this,"d",1);Vr(this,"e",0);Vr(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 jE(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 FE(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:Fo(n,12),height:14}})}function Ud(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 cs(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const Hu={"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 qt(e,t){return e.filter(n=>n.kind===t)}function qd(e,t){var ux,lx,px,fx,dx;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=qt(e,"participant.add"),h=qt(e,"node.add"),m=qt(e,"sequenceFlow.add"),g=qt(e,"messageFlow.add"),R=qt(e,"dataStore.add"),E=qt(e,"dataAssociation.add"),x=qt(e,"annotation.add"),b=qt(e,"group.add"),w=new Map(h.map(S=>[S.node.id,S])),T=(S,P,O)=>{var Re;const V=S.businessObject,G=(((Re=V.extensionElements)==null?void 0:Re.values)??[]).filter(J=>J.$type!==P),j=O?[...G,i.create(P,O)]:G;if(!j.length){V.extensionElements&&n.updateProperties(S,{extensionElements:void 0});return}const Z=i.create("bpmn:ExtensionElements",{values:j});j.forEach(J=>{J.$parent=Z}),n.updateProperties(S,{extensionElements:Z})},L=S=>({anchor:S.anchor,side:S.side,...S.offset!==void 0?{offset:S.offset}:{}});for(const S of qt(e,"element.remove")){const P=l(S.id);P&&n.removeElements([P])}const A=S=>o.filter(P=>{var O;return P.type==="bpmn:Lane"&&((O=f(P))==null?void 0:O.id)===S}).sort((P,O)=>P.y-O.y);for(const S of qt(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 O=A(S.id);if(!O.length){n.splitLane(P,S.lanes.length),A(S.id).forEach((G,j)=>{const Z=S.lanes[j];Z&&n.updateProperties(G,{id:Z.id,name:Z.name})});continue}const V=new Set(O.map(G=>G.id));S.lanes.forEach((G,j)=>{if(V.has(G.id)){n.updateProperties(p(G.id),{name:G.name});return}const Z=j===0?n.addLane(A(S.id)[0],"top"):n.addLane(p(S.lanes[j-1].id),"bottom");n.updateProperties(Z,{id:G.id,name:G.name})})}const F=150,H=80,N=90,z=180,ce=new Set;for(const S of d){ce.add(`pool:${S.participant.id}`);for(const P of S.participant.lanes??[])ce.add(P.id)}const Be=new Map;for(const S of h){const P=S.node.lane??`pool:${S.node.participant??""}`;let O=Be.get(P);O||Be.set(P,O=new Set([0])),S.band!==void 0&&O.add(S.band)}const it=new Map;for(const[S,P]of Be){if(!ce.has(S))continue;const O=[...P].sort((j,Z)=>j-Z),V=O.map((j,Z)=>Z===0?0:Z%2===1?Math.ceil(Z/2):-(Z/2)),G=Math.min(...V);it.set(S,new Map(O.map((j,Z)=>[j,V[Z]-G])))}{const S=new Map;for(const P of d)(P.participant.lanes??[]).forEach((O,V)=>S.set(O.id,V));for(const[P,O]of it){if(!S.has(P)||O.size<2)continue;const V=S.get(P),G=O.get(0)??0,j=new Set;for(const $e of h){if($e.node.lane!==P||($e.band??0)!==0||!$e.node.type.endsWith("Gateway"))continue;const Ce={in:new Set,out:new Set,cross:new Set};for(const _e of m){const ot=_e.flow.source===$e.node.id;if(!ot&&_e.flow.target!==$e.node.id)continue;const Ut=w.get(ot?_e.flow.target:_e.flow.source);if(!Ut||Ut.node.participant!==$e.node.participant||!Ut.node.lane)continue;let Kn,sn=!1;if(Ut.node.lane!==P){const In=S.get(Ut.node.lane);if(In===void 0)continue;Kn=In>V?"down":"up",sn=!0}else{const In=O.get(Ut.band??0)??G;Kn=In>G?"down":In<G?"up":void 0}Kn&&(Ce[ot?"out":"in"].add(Kn),sn&&Ce.cross.add(Kn))}for(const _e of["up","down"])Ce.in.has(_e)&&Ce.out.has(_e)&&Ce.cross.has(_e)&&j.add(_e)}if(j.size!==1)continue;const[Z]=j,Re=Math.max(...O.values()),J=Z==="down"?Re:0;if(G===J)continue;const be=[...O.entries()].filter(([$e])=>$e!==0).sort(($e,Ce)=>$e[1]-Ce[1]),Ke=[...Array(Re+1).keys()].filter($e=>$e!==J),ct=new Map([[0,J]]);be.forEach(([$e],Ce)=>ct.set($e,Ke[Ce])),it.set(P,ct)}}const X=S=>{var P;return(((P=Be.get(S))==null?void 0:P.size)??0)>1},ae=S=>S.band??(S.node.lane||!X(`pool:${S.node.participant??""}`)?void 0:0),me=new Map,se=S=>me.get(S.node.id)??ae(S),pe=new Set,ee=new Set;{const S=new Map;for(const V of m)S.set(V.flow.target,(S.get(V.flow.target)??0)+1);const P=V=>{const G=[],j=new Set([V]),Z=[V];for(;Z.length;){const Re=Z.shift();G.push(Re);for(const J of m)J.flow.source!==Re||j.has(J.flow.target)||(S.get(J.flow.target)??0)!==1||(j.add(J.flow.target),Z.push(J.flow.target))}return G},O=(V,G)=>{var j;return((j=it.get(V))==null?void 0:j.get(G))??G};for(const V of h){if(!V.node.type.endsWith("Gateway"))continue;const G=V.node.lane??`pool:${V.node.participant??""}`,j=it.get(G);if(!j||j.size<2)continue;const Z=se(V);if(Z===void 0||O(G,Z)!==O(G,0))continue;const Re=O(G,Z),J=m.filter(_e=>_e.flow.source===V.node.id).map(_e=>w.get(_e.flow.target)).filter(_e=>!!_e&&(_e.node.lane??`pool:${_e.node.participant??""}`)===G),be=J.filter(_e=>{const ot=se(_e);return ot!==void 0&&O(G,ot)===Re&&(S.get(_e.node.id)??0)===1}),Ke=J.some(_e=>{const ot=se(_e);return ot!==void 0&&O(G,ot)>Re});if(be.length!==1||!Ke)continue;const ct=new Set(J.flatMap(_e=>P(_e.node.id)));if(!m.some(_e=>_e.flow.target===V.node.id&&ct.has(_e.flow.source)))continue;const Ce=new Map;for(const[_e,ot]of j)Ce.set(_e,ot+1);Ce.set(-1,0),it.set(G,Ce);for(const _e of P(be[0].node.id))w.has(_e)&&(me.set(_e,-1),ee.add(_e));pe.add(V.node.id)}}const $=(S,P)=>{var O;return((O=it.get(S))==null?void 0:O.get(P))??P},B=new Map;for(const[S,P]of Be){let O=0;for(const V of P)O=Math.max(O,$(S,V));B.set(S,O)}const U=S=>z+F*S,Pe=d.map((S,P)=>({op:S,declared:P}));Pe.sort((S,P)=>{const O=S.op.order??Number.POSITIVE_INFINITY,V=P.op.order??Number.POSITIVE_INFINITY;return O!==V?O-V:S.declared-P.declared});let wt=80;for(const S of o.getAll())S.parent===u()&&"height"in S&&typeof S.y=="number"&&(wt=Math.max(wt,S.y+S.height+60));for(const{op:S}of Pe){const P=S.participant,O=h.filter($e=>$e.node.participant===P.id).length,V=((ux=P.lanes)==null?void 0:ux.length)??0,G=Math.max(1200,O*160+300),j=(P.lanes??[]).map($e=>U(B.get($e.id)??0)),Z=j.reduce(($e,Ce)=>$e+Ce,0);V&&Z<300&&(j[V-1]+=300-Z);const Re=Math.max(300,F*((B.get(`pool:${P.id}`)??0)+1)),J=P.blackBox||O+V===0?120:V?Math.max(300,Z):Re,be=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:J,isExpanded:!0}),Ke=n.createShape(be,{x:100+G/2,y:wt+J/2},u()),ct=P.lanes??[];if(ct.length&&n.splitLane(Ke,ct.length),ct.length){const $e=o.filter(Ce=>{var _e;return Ce.type==="bpmn:Lane"&&((_e=f(Ce))==null?void 0:_e.id)===P.id}).sort((Ce,_e)=>Ce.y-_e.y);if($e.forEach((Ce,_e)=>{const ot=ct[_e];ot&&n.updateProperties(Ce,{id:ot.id,name:ot.name})}),j.some(Ce=>Ce!==Ke.height/V)){let Ce=Ke.y;$e.forEach((_e,ot)=>{const Ut=j[ot];n.resizeShape(_e,{x:_e.x,y:Ce,width:_e.width,height:Ut}),Ce+=Ut})}}wt=Ke.y+Ke.height+60}const C=S=>{var V;const P=w.get(S);if(P)return P.node.participant??"";const O=l(S);return O?O.type==="bpmn:Participant"?O.id:((V=f(O))==null?void 0:V.id)??"":""},_=new Map,y=S=>{let P=_.get(S);return P||_.set(S,P={nodes:[],flows:[]}),P};for(const S of h)y(S.node.participant??"").nodes.push(S);for(const S of m)y(C(S.flow.source)).flows.push(S);const k=S=>{var P;return i.create("bpmn:SequenceFlow",{id:S.id,name:S.name??((P=S.condition)==null?void 0:P.label)})},I=(S,P)=>r.createShape({type:cs(S.type),businessObject:i.create(cs(S.type),{id:S.id,name:S.name,...P!==void 0?{"bwl:band":P}:{}})}),W=[...Pe.map(({op:S})=>S.participant.id).filter(S=>_.has(S)),...[..._.keys()].filter(S=>!d.some(P=>P.participant.id===S))],oe=S=>S.endsWith("Gateway");for(const S of W){const P=_.get(S),O=S?p(S):void 0,V=O?O.x+150:250;let G=O?O.y+80:120;const j=(ne,de,ue)=>{const Ze=u().children.filter(Ue=>!("waypoints"in Ue&&Ue.waypoints)&&Ue.id!==de&&typeof Ue.y=="number"&&Ue.y>=ne);Ze.length&&n.moveElements(Ze,{x:0,y:ue})},Z=(ne,de)=>{if(ne){const Te=p(ne),qe=U(de);if(Te.height>=qe)return;const fe=qe-Te.height,Ge=f(Te),Fe=Ge?Ge.y+Ge.height:Te.y+Te.height;n.resizeLane(Te,{x:Te.x,y:Te.y,width:Te.width,height:qe},!1),j(Fe,Ge==null?void 0:Ge.id,fe);return}if(!O)return;const ue=F*(de+1);if(O.height>=ue)return;const Ze=ue-O.height,Ue=O.y+O.height;n.resizeShape(O,{x:O.x,y:O.y,width:O.width,height:ue}),j(Ue,O.id,Ze)},Re=(ne,de,ue)=>{if(ne){const Ze=p(ne);return Ze.y+Math.min(Ze.height/2,N)+$(ne,de??0)*F}return de!==void 0&&O?O.y+H+$(`pool:${S}`,de)*F:ue},J=(ne,de,ue)=>{if(ne){const Ze=p(ne);return Ze.y+Math.min(Ze.height/2,N)+de*F}return O?O.y+H+de*F:ue},be=ne=>ne.participant?p(ne.participant):u(),Ke=30,ct=(ne,de,ue,Ze)=>{const Ue=ue-de.width/2,Te=Ze-de.height/2;return(ne.children??[]).find(qe=>!("waypoints"in qe&&qe.waypoints)&&qe.type!=="bpmn:Lane"&&qe.type!=="label"&&typeof qe.x=="number"&&Ue<qe.x+qe.width+Ke&&Ue+de.width+Ke>qe.x&&Te<qe.y+qe.height&&Te+de.height>qe.y)},$e=(ne,de,ue,Ze,Ue,Te)=>{const qe=ue!==void 0||Ze!==void 0,fe=$(ue??`pool:${S}`,Ze??0);if(qe)for(let Ye=0;Ye<4;Ye++){const bt=J(ue,fe+Ye,Te);if(!ct(ne,de,Ue,bt))return Z(ue,fe+Ye),{x:Ue,y:bt}}const Ge=Re(ue,Ze,Te);qe&&Z(ue,fe);let Fe=Ue;for(let Ye=0;Ye<64;Ye++){const bt=ct(ne,de,Fe,Ge);if(!bt)break;Fe=bt.x+bt.width+130+de.width/2}return{x:Fe,y:Ge}},Ce=new Set(P.flows.map(ne=>ne.flow.target)),_e=new Map;for(const ne of P.nodes){if(Ce.has(ne.node.id))continue;const de=I(ne.node,ne.band),ue=ae(ne),Ze=ne.node.lane?`${ne.node.lane}|${ue??""}`:ue!==void 0?`band:${ue}`:"",Ue=be(ne.node),Te=$e(Ue,de,ne.node.lane,ue,_e.get(Ze)??V,G);n.createShape(de,Te,Ue),_e.set(Ze,Te.x+de.width+130),!ne.node.lane&&ue===void 0&&(G+=160)}const ot=new Set,Ut=new Map,Kn=new Map,sn=new Map;if(S&&ce.has(`pool:${S}`)){const ne=new Map;for(const fe of P.flows)ne.set(fe.flow.target,(ne.get(fe.flow.target)??0)+1);const de=fe=>Re(fe.node.lane,se(fe),Number.NaN),ue=new Set,Ze=fe=>{var Ye;const Ge=(Ye=w.get(fe))==null?void 0:Ye.node.participant;if(Ge)return l(Ge);const Fe=l(fe);if(Fe)return Fe.type==="bpmn:Participant"?Fe:f(Fe)},Ue=fe=>{const Ge=[],Fe=new Set([fe]),Ye=[fe];for(;Ye.length;){const bt=Ye.shift(),ut=w.get(bt);ut&&Ge.push(ut);for(const De of P.flows)De.flow.source!==bt||Fe.has(De.flow.target)||(ne.get(De.flow.target)??0)!==1||(Fe.add(De.flow.target),Ye.push(De.flow.target))}return Ge},Te=fe=>{if(!O)return;const Ge=new Set(fe.map(bt=>bt.node.id));let Fe=!1,Ye=!1;for(const bt of g){if(!Ge.has(bt.flow.source))continue;const ut=Ze(bt.flow.target);!ut||ut.id===O.id||(ut.y<O.y?Fe=!0:Ye=!0)}return Fe&&!Ye?"up":Ye&&!Fe?"down":void 0};for(const fe of P.nodes){if(!oe(fe.node.type))continue;const Ge=Re(fe.node.lane,ae(fe),Number.NaN);if(Number.isNaN(Ge))continue;const Fe=[];for(const De of P.flows){if(De.flow.source!==fe.node.id)continue;const Xe=w.get(De.flow.target);if(!Xe||Xe.node.lane!==fe.node.lane||(ne.get(Xe.node.id)??0)!==1)continue;const lt=ae(Xe);if(lt===void 0)continue;const cn=Re(Xe.node.lane,lt,Number.NaN);if(Number.isNaN(cn))continue;const hu=Ue(Xe.node.id),mu=Te(hu);mu&&Fe.push({subtree:hu,band:lt,row:cn,dir:mu})}if(!Fe.some(De=>De.dir==="up")||!Fe.some(De=>De.dir==="down")||!Fe.some(De=>De.dir==="up"&&Fe.some(Xe=>Xe.dir==="down"&&Xe.row<De.row)))continue;const bt=[...Fe].sort((De,Xe)=>De.row-Xe.row);[...Fe.filter(De=>De.dir==="up"),...Fe.filter(De=>De.dir==="down")].sort((De,Xe)=>De.dir===Xe.dir?De.row-Xe.row:De.dir==="up"?-1:1).forEach((De,Xe)=>{const lt=bt[Xe].band;if(lt!==De.band){ue.add(fe.node.id);for(const cn of De.subtree)ae(cn)===De.band&&me.set(cn.node.id,lt)}})}for(const fe of P.nodes){if(!oe(fe.node.type))continue;const Ge=de(fe);if(Number.isNaN(Ge)||x.some(De=>{var Xe,lt;return(((Xe=De.placement)==null?void 0:Xe.anchor)??(De.association?De.association.source===De.annotation.id?De.association.target:De.association.source:void 0))===fe.node.id&&((lt=De.placement)==null?void 0:lt.side.startsWith("bottom"))}))continue;let Ye,bt=!1,ut;for(const De of P.flows){if(De.flow.source!==fe.node.id)continue;const Xe=w.get(De.flow.target);if(!Xe||!Xe.node.lane&&ae(Xe)===void 0)continue;const lt=de(Xe);Number.isNaN(lt)||(Math.abs(lt-Ge)<.5&&(bt=!0),lt>Ge?!Ye||lt>Ye.row?Ye={id:Xe.node.id,row:lt,count:1}:lt===Ye.row&&Ye.count++:lt<Ge&&Xe.node.lane===fe.node.lane&&(!ut||lt>ut.row?ut={op:Xe,row:lt,count:1}:lt===ut.row&&ut.count++))}Ye&&Ye.count===1&&(ne.get(Ye.id)??0)===1&&!ue.has(fe.node.id)&&ot.add(Ye.id),!bt&&ut&&ut.count===1&&(ne.get(ut.op.node.id)??0)===1&&!pe.has(fe.node.id)&&Ut.set(ut.op.node.id,{lane:fe.node.lane,band:se(fe)})}const qe=new Map;for(const fe of g)qe.set(fe.flow.target,[...qe.get(fe.flow.target)??[],fe]);for(const fe of P.nodes){const Ge=qe.get(fe.node.id);if(!Ge||Ge.length!==1||!ne.get(fe.node.id)||!fe.node.lane&&ae(fe)===void 0||ee.has(fe.node.id))continue;const Fe=(lx=w.get(Ge[0].flow.source))==null?void 0:lx.node.participant,Ye=Fe?l(Fe):void 0;if(!Ye||!O||Ye.id===O.id)continue;const bt=fe.node.lane??`pool:${S}`,ut=it.get(bt);if(!ut)continue;const De=ut.get(0)??0,Xe=(ut.get(se(fe)??0)??De)-De;if(Xe===0)continue;const lt=Ye.y<O.y;if(lt&&Xe<0||!lt&&Xe>0)continue;let cn;for(const[hu,mu]of ut){const Va=mu-De;(lt&&Va<0&&(!cn||Va<cn.row)||!lt&&Va>0&&(!cn||Va>cn.row))&&(cn={band:hu,row:Va})}cn&&Kn.set(fe.node.id,{lane:fe.node.lane,band:cn.band})}}const In=new Set;let du=0;for(;du++<P.nodes.length+2;){for(let ue=0;ue<P.nodes.length+P.flows.length+2;ue++){let Ze=!1;for(const Ue of P.flows){const Te=Ue.flow;if(In.has(Te.id))continue;const qe=l(Te.source);if(!qe)continue;const fe=l(Te.target),Ge=w.get(Te.target);if(!fe&&Ge){const Fe=I(Ge.node,Ge.band),Ye=se(Ge);if(Ge.node.lane||Ye!==void 0){const bt=be(Ge.node),ut=qe,De=ut.x+(sn.get(Te.source)??0)+ut.width+130,Xe=Ut.get(Te.target)??Kn.get(Te.target),lt=$e(bt,Fe,Xe?Xe.lane:Ge.node.lane,Xe?Xe.band:Ye,ot.has(Te.target)?ut.x+ut.width/2:De,Number.NaN),cn=n.createShape(Fe,lt,bt);ot.has(Te.target)&&sn.set(Te.target,De-(cn.x+cn.width/2)),n.connect(qe,cn,{type:"bpmn:SequenceFlow",businessObject:k(Te)})}else s.append(qe,Fe,{connection:{type:"bpmn:SequenceFlow",businessObject:k(Te)}})}else if(fe)n.connect(qe,fe,{type:"bpmn:SequenceFlow",businessObject:k(Te)});else continue;In.add(Te.id),Ze=!0}if(!Ze)break}const ne=P.nodes.filter(ue=>!l(ue.node.id));if(!ne.length)break;const de=ne[0];{const ue=I(de.node,de.band),Ze=be(de.node),Ue=ae(de);n.createShape(ue,$e(Ze,ue,de.node.lane,Ue,V,G),Ze),!de.node.lane&&Ue===void 0&&(G+=160)}}}const Ae=40,je=(S,P=()=>!0)=>{const O=l(S);if(!O)return[];const V=[O],G=new Set([S]);for(let j=0;j<V.length;j++){const Z=V[j].id;for(const Re of m){const J=Re.flow.target;if(Re.flow.source!==Z||G.has(J)||!w.has(J))continue;G.add(J);const be=l(J);be&&P(be)&&V.push(be)}}return V};for(const S of qt(e,"sequenceFlow.update")){if(S.target===void 0)continue;const P=w.get(S.target);if(!P)continue;const O=l(S.target),V=l(S.id);if(!O||!V)continue;const G=S.source!==void 0?l(S.source):V.source,j=V.target;if(!G||!j||j.id===O.id)continue;const Z=je(S.target),Re=new Set(Z.map(Ce=>Ce.id)),J=Math.min(...Z.map(Ce=>Ce.x)),be=Math.max(...Z.map(Ce=>Ce.x+Ce.width)),Ke=G.x+G.width,ct=be-J+Ae*2-(j.x-Ke);if(ct>0){const Ce=f(O),_e=(Ce==null?void 0:Ce.children)??[],ot=sn=>sn.type==="bpmn:Lane",Ut=_e.filter(sn=>!("waypoints"in sn&&sn.waypoints)&&!ot(sn)&&!Re.has(sn.id)&&sn.x>=j.x),Kn=Ce?[Ce,..._e.filter(sn=>ot(sn))]:[];Ut.length&&n.createSpace(Ut,Kn,{x:ct,y:0},"e",j.x-1)}const $e=P.node.lane||P.band!==void 0?O.y+O.height/2:G.y+G.height/2;n.moveElements(Z,{x:Ke+Ae-J,y:$e-(O.y+O.height/2)})}const _t=(S,P)=>{const O=P.target===S,V=p(P.source),G=p(P.target),j=O?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(V,G,P.id?{type:j,businessObject:i.create(j,{id:P.id})}:{type:j})};for(const S of R){const P=S.associations??[],O=P.map(j=>j.source===S.dataStore.id?j.target:j.source).map(l).find(Boolean),V=O?f(O)??u():u(),G=O?{x:O.x+O.width/2,y:O.y+O.height+110}:{x:200,y:wt+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:S.dataStore.id,name:S.dataStore.name})},G,V);for(const j of P)_t(S.dataStore.id,j)}for(const S of E){const O=p(S.association.target).type==="bpmn:DataStoreReference"?S.association.target:S.association.source;_t(O,S.association)}const Je=100,kt=S=>{for(const P of d){if(!P.participant.blackBox)continue;const O=l(P.participant.id);if(!O)continue;const V=[];for(const j of g){const Z=j.flow.source===P.participant.id?j.flow.target:j.flow.target===P.participant.id?j.flow.source:void 0,Re=Z?l(Z):void 0;Re&&typeof Re.x=="number"&&Re.type!=="bpmn:Participant"&&V.push(Re)}if(!V.length)continue;const G=Math.max(...V.map(j=>j.x+j.width/2))+Je;if(G>O.x+O.width&&n.resizeShape(O,{x:O.x,y:O.y,width:G-O.x,height:O.height}),!!S)for(const j of g){const Z=l(j.flow.id),Re=j.flow.source===P.participant.id?j.flow.target:j.flow.target===P.participant.id?j.flow.source:void 0,J=Re?l(Re):void 0;if(!Z||!J||J.type==="bpmn:Participant")continue;const be=J.x+J.width/2;if(be<O.x+10||be>O.x+O.width-10)continue;const Ke=O.y>J.y,ct=Ke?J.y+J.height:J.y,$e=Ke?O.y:O.y+O.height,Ce=j.flow.source===P.participant.id?[{x:be,y:$e},{x:be,y:ct}]:[{x:be,y:ct},{x:be,y:$e}],_e=ln(o),ot={..._e.edges.find(Ut=>Ut.id===j.flow.id),waypoints:Ce};ri(ot,zi(_e)).length||n.updateWaypoints(Z,Ce)}}};kt(!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 Wt=100,an=30,at=4,$t=S=>!("waypoints"in S&&S.waypoints)&&S.type!=="bpmn:Lane"&&S.type!=="label"&&typeof S.x=="number",jt=()=>{const S=ln(o);return{bad:Vi(S).filter(P=>P.kind==="edge-crosses-shape"||P.kind==="edge-overlap-opposite"||P.kind==="edge-overlap-mixed").length,crossings:yd(S),straight:S.edges.filter(P=>P.type==="bpmn:MessageFlow"&&P.waypoints.length===2).length}},zr=S=>{const P=ln(o),O=P.edges.find(V=>V.id===S);return!!O&&ri(O,zi(P)).length>0},An=(S,P,O)=>{const V=new Set(S.map(be=>be.id)),G=(P.children??[]).filter($t).filter(be=>!V.has(be.id));if(S.some(be=>G.some(Ke=>be.x+O<Ke.x+Ke.width+an&&be.x+O+be.width+an>Ke.x&&be.y<Ke.y+Ke.height&&be.y+be.height>Ke.y)))return null;const Z=P.width;n.moveElements(S,{x:O,y:0});const J=Math.max(...S.map(be=>be.x+be.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:-O,y:0}),J>0&&n.resizeShape(P,{x:P.x,y:P.y,width:Z,height:P.height})}},Jn=(S,P)=>P.bad>S.bad||P.crossings>S.crossings&&P.straight<=S.straight,Ln=(S,P,O,V=()=>!0)=>{const G=jt(),j=An(S,P,O);if(!j)return!1;const Z=jt();return Jn(G,Z)||!V()?(j(),!1):!0},Dt=S=>{var O;const P=(O=w.get(S))==null?void 0:O.node.participant;return!!P&&ce.has(`pool:${P}`)},ei=new Map;for(const S of g){if(!Dt(S.flow.target))continue;const P=ei.get(S.flow.target)??[];P.push(S),ei.set(S.flow.target,P)}const Do=[...ei.keys()],Tn=new Set(m.map(S=>S.flow.target)),Ve=S=>Pe.findIndex(({op:P})=>P.participant.id===S);Do.sort((S,P)=>{var G,j;const O=Tn.has(S)?1:0,V=Tn.has(P)?1:0;return O!==V?O-V:Ve((G=w.get(S))==null?void 0:G.node.participant)-Ve((j=w.get(P))==null?void 0:j.node.participant)});const We=S=>S.x+S.width/2,ix=S=>{let P;for(const O of ei.get(S)??[]){const V=l(O.flow.source);if(!V)continue;const G=We(V);(!P||G>P.cx)&&(P={op:O,cx:G})}return P==null?void 0:P.op},PD=S=>{const P=ix(S),O=l(S),V=P?l(P.flow.source):void 0;return O&&V?We(V)-We(O):void 0},AD=S=>{const P=PD(S);return P!==void 0&&Math.abs(P)<Wt},Df=S=>{const P=ix(S);if(!P)return null;const O=l(S),V=l(P.flow.source);if(!O||!V)return null;const G=We(V)-We(O);if(G>=Wt){const j=p(w.get(S).node.participant);return{subtree:je(S,Z=>Z.x>=O.x),pool:j,dx:G}}if(-G>=Wt&&Dt(P.flow.source)){const j=p(w.get(P.flow.source).node.participant);return{subtree:je(P.flow.source,Z=>Z.x>=V.x&&!AD(Z.id)),pool:j,dx:-G}}return null},rx=()=>Do.map(S=>({id:S,plan:Df(S)})).filter(S=>!!S.plan).sort((S,P)=>Math.min(...S.plan.subtree.map(O=>O.x))-Math.min(...P.plan.subtree.map(O=>O.x))).map(S=>S.id);for(let S=0;S<3;S++){const P=jt(),O=[];for(const G of rx()){const j=Df(G);if(!j)continue;const Z=An(j.subtree,j.pool,j.dx);Z&&O.push(Z)}if(!O.length)break;if(!Jn(P,jt()))continue;for(const G of O.reverse())G();let V=!1;for(const G of rx()){const j=Df(G);j&&Ln(j.subtree,j.pool,j.dx)&&(V=!0)}if(!V)break}for(const S of Do.flatMap(P=>ei.get(P)??[])){if(!zr(S.flow.id))continue;const P=l(S.flow.target);if(!P)continue;const O=p(w.get(S.flow.target).node.participant),V=je(S.flow.target,j=>j.x>=P.x),G=P.width+130;for(let j=1;j<=at&&!Ln(V,O,G*j,()=>!zr(S.flow.id));j++);}{const P=V=>V.y+V.height/2,O=[];for(const[V,G]of w){const j=G.node.participant;if(!j||!ce.has(`pool:${j}`))continue;const Z=m.filter(be=>be.flow.target===V);if(Z.length!==1)continue;const Re=l(Z[0].flow.source),J=l(V);!Re||!J||!w.has(Re.id)||Math.abs(P(Re)-P(J))>1||J.x-(Re.x+Re.width)<=131||O.push({id:V,pred:Re,node:J})}O.sort((V,G)=>V.node.x-G.node.x);for(const{id:V}of O){const G=w.get(V),j=l(V),Z=l(m.find(Ce=>Ce.flow.target===V).flow.source);if(!j||!Z)continue;const Re=j.x-(Z.x+Z.width);if(Re<=131)continue;const J=p(G.node.participant),be=je(V,Ce=>Ce.x>=j.x),Ke=jt(),ct=An(be,J,-(Re-130));if(!ct)continue;const $e=jt();($e.bad>Ke.bad||$e.crossings>=Ke.crossings)&&ct()}}kt(!0);let ox=0;for(const S of b){const P=(S.group.members??[]).map(l).filter(j=>!!j),O=40;let V;if(P.length){const j=Math.min(...P.map(be=>be.x))-O,Z=Math.min(...P.map(be=>be.y))-O,Re=Math.max(...P.map(be=>be.x+be.width))+O,J=Math.max(...P.map(be=>be.y+be.height))+O;V={x:j,y:Z,width:Re-j,height:J-Z}}else V={x:300+ox*350,y:40,width:300,height:200},ox++;const G=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:S.group.id}),width:V.width,height:V.height},{x:V.x+V.width/2,y:V.y+V.height/2},u());S.group.name&&n.updateLabel(G,S.group.name),(px=S.group.members)!=null&&px.length&&T(G,"bwl:Members",{refs:S.group.members.join(" ")})}const ax=S=>{const P=S.waypoints;if(P!=null&&P.length){const V=P[Math.floor((P.length-1)/2)];return{x:V.x,y:V.y,width:0,height:0}}const O=S;return{x:O.x,y:O.y,width:O.width,height:O.height}};let za=0;const sx=12,cx=14,TD=15,MD=300,kD=S=>{const P=S.split(`
7
+ `),O=Math.max(...P.map(j=>Fo(j,sx))),V=Math.max(100,Math.min(MD,Math.ceil(O)+cx)),G=P.reduce((j,Z)=>j+Math.max(1,Math.ceil((Fo(Z,sx)+cx)/V)),0);return{width:V,height:Math.max(30,G*TD+10)}},Qt=10;for(const S of x){const P=S.association,O=((fx=S.placement)==null?void 0:fx.anchor)??(P?P.source===S.annotation.id?P.target:P.source:void 0),V=O?l(O):void 0,G=V?ax(V):void 0,j=kD(S.annotation.text??"");let Z;if(G&&S.placement){const[Ke,ct]=Hu[S.placement.side],$e=S.placement.offset??50;Z={x:G.x+G.width/2+Ke*(G.width/2+j.width/2+$e),y:G.y+G.height/2+ct*(G.height/2+j.height/2+$e)}}else G?(Z={x:G.x+G.width/2+180+za%3*260,y:G.y-110-za%2*95},za++):(Z={x:300+za*260,y:60},za++);const Re=V?f(V)??u():u(),J=Re;if(G&&typeof J.x=="number"&&typeof J.width=="number"&&J.type==="bpmn:Participant"){const Ke=(ne,de)=>{const[ue,Ze]=Hu[ne];let Ue={x:G.x+G.width/2+ue*(G.width/2+j.width/2+de),y:G.y+G.height/2+Ze*(G.height/2+j.height/2+de)};const Te=J.x+Qt+j.width/2,qe=J.x+J.width-Qt-j.width/2,fe=J.y+Qt+j.height/2,Ge=J.y+J.height-Qt-j.height/2,Fe={x:Math.min(qe,Math.max(Te,Ue.x)),y:Math.min(Ge,Math.max(fe,Ue.y))};return(Fe.x!==Ue.x||Fe.y!==Ue.y)&&(Ue=Math.abs(Fe.x-(G.x+G.width/2))<(G.width+j.width)/2+Qt&&Math.abs(Fe.y-(G.y+G.height/2))<(G.height+j.height)/2+Qt?{x:G.x+G.width+Qt+j.width/2,y:Fe.y}:Fe),Ue},ct=(J.children??[]).filter(ne=>!("waypoints"in ne&&ne.waypoints)&&ne.type!=="bpmn:Lane"&&ne.type!=="label"&&typeof ne.x=="number"),$e=ln(o),Ce=$e.edges.flatMap(_n),_e=ju($e).map(ne=>ne.rect),ot=ne=>({x0:ne.x-j.width/2-Qt,x1:ne.x+j.width/2+Qt,y0:ne.y-j.height/2-Qt,y1:ne.y+j.height/2+Qt}),Ut=ne=>{const de=ot(ne);return ct.some(ue=>de.x0<ue.x+ue.width&&de.x1>ue.x&&de.y0<ue.y+ue.height&&de.y1>ue.y)},Kn=ne=>{const de=ot(ne);return Ce.some(ue=>ue.axis==="h"?ue.at>de.y0&&ue.at<de.y1&&ue.lo<de.x1&&ue.hi>de.x0:ue.at>de.x0&&ue.at<de.x1&&ue.lo<de.y1&&ue.hi>de.y0)},sn=ne=>{const de=ot(ne);return _e.some(ue=>de.x0<ue.x+ue.width&&de.x1>ue.x&&de.y0<ue.y+ue.height&&de.y1>ue.y)},In=ne=>Ut(ne)||Kn(ne)||sn(ne),du=ne=>ne.x-j.width/2>=J.x&&ne.x+j.width/2<=J.x+J.width&&ne.y-j.height/2>=J.y&&ne.y+j.height/2<=J.y+J.height;if(S.placement){const ne=Te=>Te.startsWith("top")?Te.replace(/^top/,"bottom"):Te.replace(/^bottom/,"top"),de=Te=>Te.endsWith("left")?Te.replace(/left$/,"right"):Te.replace(/right$/,"left"),ue=S.placement.side,Ze=[ue,ne(ue),de(ue),ne(de(ue)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],Ue=S.placement.offset??50;if(Z=Ke(ue,Ue),In(Z)){const Te=new Set;for(const qe of Ze){if(Te.has(qe))continue;Te.add(qe);const fe=Ke(qe,Ue);if(du(fe)&&!In(fe)){Z=fe;break}}}}else{const ne=J.x+Qt+j.width/2,de=J.x+J.width-Qt-j.width/2,ue=J.y+Qt+j.height/2,Ze=J.y+J.height-Qt-j.height/2;if(Z={x:Math.min(de,Math.max(ne,Z.x)),y:Math.min(Ze,Math.max(ue,Z.y))},In(Z)){const Ue=(G.width+j.width)/2+Qt,qe=[{x:Z.x+Ue,y:Z.y},{x:Z.x-Ue,y:Z.y},{x:Z.x,y:Z.y-j.height-Qt},{x:Z.x,y:Z.y+j.height+Qt}].filter(du).find(fe=>!In(fe));qe&&(Z=qe)}}}const be=n.createShape({type:"bpmn:TextAnnotation",width:j.width,height:j.height,businessObject:i.create("bpmn:TextAnnotation",{id:S.annotation.id,text:S.annotation.text})},Z,Re);if(P){const Ke=ct=>ct===S.annotation.id?be:p(ct);n.connect(Ke(P.source),Ke(P.target),P.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:P.id})}:{type:"bpmn:Association"})}S.placement&&T(be,"bwl:Placement",L(S.placement))}for(const S of qt(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 qt(e,"node.update")){let P=p(S.id);if(S.type&&cs(S.type)!==P.type&&(P=c.replaceElement(P,{type:cs(S.type)})),S.name!==void 0&&n.updateProperties(P,{name:S.name??void 0}),S.lane){const O=p(S.lane),V=O.y+O.height/2-(P.y+P.height/2);V!==0&&n.moveElements([P],{x:0,y:V})}}for(const S of qt(e,"sequenceFlow.update")){const P=p(S.id);if(S.source!==void 0||S.target!==void 0){const O=P,V=S.source!==void 0?p(S.source):O.source,G=S.target!==void 0?p(S.target):O.target,j=Z=>({x:Z.x+Z.width/2,y:Z.y+Z.height/2});n.reconnect(O,V,G,[j(V),j(G)])}S.name!==void 0&&n.updateProperties(P,{name:S.name??void 0}),S.condition!==void 0&&n.updateProperties(P,{name:((dx=S.condition)==null?void 0:dx.label)??void 0})}for(const S of qt(e,"messageFlow.update"))S.name!==void 0&&n.updateProperties(p(S.id),{name:S.name??void 0});for(const S of qt(e,"dataStore.update"))S.name!==void 0&&n.updateProperties(p(S.id),{name:S.name??void 0});for(const S of qt(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 O=ax(p(S.placement.anchor)),[V,G]=Hu[S.placement.side],j=S.placement.offset??50,Z=O.x+O.width/2+V*(O.width/2+P.width/2+j),Re=O.y+O.height/2+G*(O.height/2+P.height/2+j);n.moveElements([P],{x:Z-(P.x+P.width/2),y:Re-(P.y+P.height/2)}),T(P,"bwl:Placement",L(S.placement))}}for(const S of qt(e,"group.update")){const P=p(S.id);if(S.name!==void 0&&n.updateLabel(P,S.name??""),S.members){const O=S.members.map(l).filter(V=>!!V);if(O.length){const G=Math.min(...O.map(J=>J.x))-40,j=Math.min(...O.map(J=>J.y))-40,Z=Math.max(...O.map(J=>J.x+J.width))+40,Re=Math.max(...O.map(J=>J.y+J.height))+40;n.resizeShape(P,{x:G,y:j,width:Z-G,height:Re-j})}T(P,"bwl:Members",{refs:S.members.join(" ")})}}}function Yd(e,t,n=qd){const i=Ud(e),r=Gd(t,xd(i.elementRegistry)),o={edgeCrossings:{before:0,after:0}};if(r.length)return{ok:!1,issues:r,findings:[],stats:o};const a=ln(i.elementRegistry),s=new Set(Vi(a).map(Hi)),c=new Set(a.edges.map(d=>d.id)),u=$u(a).length,l=e.get("commandStack");try{Bf(l,()=>{n(t,i),kd(i,c),Ad(i,s),Bd(i,s,c),Id(i,c),Hd(i,s,c),Fd(i,c)})}catch(d){return{ok:!1,issues:[{kind:"lower-failed",message:d instanceof Error?d.message:String(d)}],findings:[],stats:o}}const p=ln(i.elementRegistry),f=Vi(p).filter(d=>!s.has(Hi(d)));return{ok:!0,issues:[],findings:f,stats:{edgeCrossings:{before:u,after:$u(p).length}}}}function HE(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function zE(e,t){return typeof e.get=="function"?e.get(t):e[t]}function Kd(e,t){const n=zE(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Xd(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function VE(e){return typeof e=="string"&&yu.includes(e)}function oi(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function Zd(e){const t=e.rootElements??[],n=t.find(X=>X.$type==="bpmn:Collaboration"),i=new Map(t.filter(X=>X.$type==="bpmn:Process").map(X=>[X.id,X])),r=[],o=[],a=[],s=[],c=[],u=[],l={poolOrders:{},bands:{},placements:{}},p=[],f=[],d=[],h=[],m=[],g=[],R=new Set,E=new Set,x=X=>{X&&R.add(X)},b=X=>{R.add(X),E.add(X)},w=X=>{const ae=Xd(X,"bwl:Placement");if(!ae)return;const me=typeof ae.anchor=="string"?ae.anchor:void 0;if(!me||!VE(ae.side))return;const se=typeof ae.offset=="number"?ae.offset:void 0;m.push({owner:X.id,anchor:me,side:ae.side,...se!==void 0?{offset:se}:{}})},T=X=>{const ae=Xd(X,"bwl:Members"),me=typeof(ae==null?void 0:ae.refs)=="string"?ae.refs.split(/\s+/).filter(Boolean):[];me.length&&g.push({owner:X.id,refs:me})},L=X=>{var ae;for(const me of X)switch(x(me.id),me.$type){case"bpmn:TextAnnotation":b(me.id),s.push({id:me.id,text:typeof me.text=="string"?me.text:""}),w(me);break;case"bpmn:Association":d.push({id:me.id,type:me.$type,source:oi(me.sourceRef),target:oi(me.targetRef)});break;case"bpmn:Group":{b(me.id);const se=(ae=me.categoryValueRef)==null?void 0:ae.value;c.push({id:me.id,...typeof se=="string"&&se?{name:se}:{}}),T(me);break}default:u.push({id:me.id,type:me.$type,reason:"type-outside-mvp"})}},A=(X,ae)=>{const me=X.flowElements??[],se=(X.laneSets??[]).flatMap(ee=>ee.lanes??[]),pe=new Map;for(const ee of se){x(ee.id);for(const $ of ee.flowNodeRef??[]){const B=oi($);B&&pe.set(B,ee.id)}}for(const ee of me){if(x(ee.id),ee.$type==="bpmn:SequenceFlow"){p.push({id:ee.id,source:oi(ee.sourceRef),target:oi(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 $=HE(ee.$type);if(!Of($)){u.push({id:ee.id,type:ee.$type,reason:"type-outside-mvp"});continue}b(ee.id),o.push({id:ee.id,type:$,...ee.name?{name:ee.name}:{},...ae?{participant:ae}:{},...pe.has(ee.id)?{lane:pe.get(ee.id)}:{}});const B=Kd(ee,"bwl:band");B!==void 0&&(l.bands[ee.id]=B);for(const U of ee.dataOutputAssociations??[])x(U.id),h.push({id:U.id,type:U.$type,source:ee.id,target:oi(U.targetRef)});for(const U of ee.dataInputAssociations??[])x(U.id),h.push({id:U.id,type:U.$type,source:oi((U.sourceRef??[])[0]),target:ee.id})}L(X.artifacts??[])};if(n){const X=new Set;for(const ae of n.participants??[]){b(ae.id);const me=oi(ae.processRef);me&&X.add(me);const se=me?i.get(me):void 0,pe=((se==null?void 0:se.laneSets)??[]).flatMap(U=>U.lanes??[]),ee=pe.map(U=>({id:U.id,...U.name?{name:U.name}:{}}));for(const U of ee)b(U.id);const $=!se||(se.flowElements??[]).length===0&&pe.length===0&&(se.artifacts??[]).length===0;r.push({id:ae.id,...ae.name?{name:ae.name}:{},...$?{blackBox:!0}:{},...ee.length?{lanes:ee}:{}});const B=Kd(ae,"bwl:poolOrder");B!==void 0&&(l.poolOrders[ae.id]=B),se&&A(se,ae.id)}for(const ae of n.messageFlows??[])x(ae.id),f.push({id:ae.id,source:oi(ae.sourceRef),target:oi(ae.targetRef),...typeof ae.name=="string"&&ae.name?{name:ae.name}:{}});L(n.artifacts??[]);for(const[ae,me]of i)!X.has(ae)&&(me.flowElements??[]).length>0&&u.push({id:ae,type:me.$type,reason:"unreachable-process"})}else for(const X of i.values())A(X);const F=[],H=[],N=[],z=[],ce=(X,ae)=>!!X&&!!ae&&E.has(X)&&E.has(ae);for(const X of p){if(!ce(X.source,X.target)){u.push({id:X.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}F.push({id:X.id,source:X.source,target:X.target,...X.name?{name:X.name}:{}}),E.add(X.id)}for(const X of f){if(!ce(X.source,X.target)){u.push({id:X.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}H.push({id:X.id,source:X.source,target:X.target,...X.name?{name:X.name}:{}}),E.add(X.id)}for(const X of h){if(!ce(X.source,X.target)){u.push({id:X.id??"",type:X.type,reason:"endpoint-outside-mvp"});continue}z.push({...X.id?{id:X.id}:{},source:X.source,target:X.target}),X.id&&E.add(X.id)}for(const X of d){if(!ce(X.source,X.target)){u.push({id:X.id??"",type:X.type,reason:"endpoint-outside-mvp"});continue}N.push({...X.id?{id:X.id}:{},source:X.source,target:X.target})}const Be=new Map(c.map(X=>[X.id,X]));for(const{owner:X,refs:ae}of g){const me=ae.filter(pe=>R.has(pe)),se=Be.get(X);se&&me.length&&(se.members=me)}for(const X of m)R.has(X.anchor)&&(l.placements[X.owner]={anchor:X.anchor,side:X.side,...X.offset!==void 0?{offset:X.offset}:{}});return{definition:{...r.length?{participants:r}:{},nodes:o,sequenceFlows:F,...H.length?{messageFlows:H}:{},...a.length?{dataStores:a}:{},...z.length?{dataAssociations:z}:{},...s.length?{annotations:s}:{},...N.length?{associations:N}:{},...c.length?{groups:c}:{}},hints:l,omitted:u}}async function GE(e){const{definitions:t,warnings:n}=await Lu(e);return{...Zd(t),warnings:n}}function WE(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function Qd(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=Yd(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 UE=Symbol("bpmn-editor");function qE(){const e=St.ref(!1),t=St.ref(!0),n=St.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 Qd(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:Iu(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 YE(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var zu={exports:{}},Jd;function KE(){if(Jd)return zu.exports;Jd=1;var e=zu.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},zu.exports}var XE=KE(),ZE=YE(XE);function ai(e){if(!(this instanceof ai))return new ai(e);e=e||[128,36,1],this._seed=e.length?ZE.rack(e[0],e[1],e[2]):e}ai.prototype.next=function(e){return this._seed(e||!0)},ai.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},ai.prototype.claim=function(e,t){this._seed.set(e,t||!0)},ai.prototype.assigned=function(e){return this._seed.get(e)||!1},ai.prototype.unclaim=function(e){delete this._seed.hats[e]},ai.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const Lt={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};Lt.td=Lt.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],Lt.option=Lt.optgroup=[1,'<select multiple="multiple">',"</select>"],Lt.thead=Lt.tbody=Lt.colgroup=Lt.caption=Lt.tfoot=[1,"<table>","</table>"],Lt.polyline=Lt.ellipse=Lt.polygon=Lt.circle=Lt.text=Lt.line=Lt.path=Lt.rect=Lt.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function st(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(Lt,i)?Lt[i]:Lt._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 QE(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 pn(e,...t){const n=e.style;return M(t,function(i){i&&M(i,function(r,o){n[o]=r})}),e}function nn(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const JE=Object.prototype.toString;function ft(e){return new Gi(e)}function Gi(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Gi.prototype.add=function(e){return this.list.add(e),this},Gi.prototype.remove=function(e){return JE.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Gi.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},Gi.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Gi.prototype.array=function(){return Array.from(this.list)},Gi.prototype.has=Gi.prototype.contains=function(e){return this.list.contains(e)};function us(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Rr(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function ew(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ls={},eh;function tw(){if(eh)return ls;eh=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return ls.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},ls.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},ls}var th=tw(),nw=ew(th),Ee=QE({__proto__:null,default:nw},[th]),nh=["focus","blur"];function iw(e,t,n,i,r){return nh.indexOf(n)!==-1&&(r=!0),Ee.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=Rr(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function rw(e,t,n,i){return nh.indexOf(t)!==-1&&(i=!0),Ee.unbind(e,t,n,i)}var bn={bind:iw,unbind:rw};function Vu(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function Qe(e,t){return t=t||document,t.querySelector(e)}function ps(e,t){return t=t||document,t.querySelectorAll(e)}function si(e){e.parentNode&&e.parentNode.removeChild(e)}function ow(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function aw(e,t){return t.appendChild(ow(e,t))}function we(e,t){return aw(t,e),e}var Gu=2,ih={"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":Gu,"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":Gu,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function sw(e,t){return ih[t]?e.style[t]:e.getAttributeNS(null,t)}function rh(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=ih[i];r?(r===Gu&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function cw(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)rh(e,r,t[r])}function re(e,t,n){if(typeof t=="string")if(n!==void 0)rh(e,t,n);else return sw(e,t);else cw(e,t);return e}const uw=Object.prototype.toString;function Ne(e){return new Wi(e)}function Wi(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Wi.prototype.add=function(e){return this.list.add(e),this},Wi.prototype.remove=function(e){return uw.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Wi.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},Wi.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Wi.prototype.array=function(){return Array.from(this.list)},Wi.prototype.has=Wi.prototype.contains=function(e){return this.list.contains(e)};function fs(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function oh(e){return e.cloneNode(!0)}var Wu={svg:"http://www.w3.org/2000/svg"},ah='<svg xmlns="'+Wu.svg+'"';function lw(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(Wu.svg)===-1&&(e=ah+e.substring(4)):(e=ah+">"+e+"</svg>",t=!0);var n=pw(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function pw(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function le(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=lw(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(Wu.svg,e),t&&re(n,t),n}var Uu=null;function sh(){return Uu===null&&(Uu=le("svg")),Uu}function ch(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function fw(e,t,n,i,r,o){var a=sh().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return ch(a,e);case 6:return ch(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function Ho(e){return sh().createSVGTransform()}var uh=/([&<>]{1})/g,dw=/([&<>\n\r"]{1})/g,hw={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function qu(e,t){function n(i,r){return hw[r]||r}return e.replace(t,n)}function lh(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(qu(e.textContent,uh));break;case 1:if(t.push("<",e.tagName),e.hasAttributes())for(r=e.attributes,n=0,i=r.length;n<i;++n)o=r.item(n),t.push(" ",o.name,'="',qu(o.value,dw),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)lh(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",qu(e.nodeValue,uh),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function mw(e){for(var t=e.firstChild,n=[];t;)lh(t,n),t=t.nextSibling;return n.join("")}function ph(e,t){return mw(e)}function It(e){var t=e.parentNode;return t&&t.removeChild(e),e}function gw(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function yw(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(gw(e,i))}function zo(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),yw(n,t)),n.consolidate()}const vw=/^class[ {]/;function _w(e){return vw.test(e.toString())}function Yu(e){return Array.isArray(e)}function Ku(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function ds(...e){e.length===1&&Yu(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const bw=/constructor\s*[^(]*\(\s*([^)]*)\)/m,xw=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,Ew=/\/\*([^*]*)\*\//m;function ww(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(_w(e)?bw:xw);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(Ew);return(r&&r[1]||i).trim()})||[]}function fh(e,t){const n=t||{get:function(x,b){if(i.push(x),b===!1)return null;throw s(`No provider for "${x}"!`)}},i=[],r=this._providers=Object.create(n._providers||null),o=this._instances=Object.create(null),a=o.injector=this,s=function(x){const b=i.join(" -> ");return i.length=0,new Error(b?`${x} (Resolving: ${b})`:x)};function c(x,b){if(!r[x]&&x.includes(".")){const w=x.split(".");let T=c(w.shift());for(;w.length;)T=T[w.shift()];return T}if(Ku(o,x))return o[x];if(Ku(r,x)){if(i.indexOf(x)!==-1)throw i.push(x),s("Cannot resolve circular dependency!");return i.push(x),o[x]=r[x][0](r[x][1]),i.pop(),o[x]}return n.get(x,b)}function u(x,b){if(typeof b>"u"&&(b={}),typeof x!="function")if(Yu(x))x=ds(x.slice());else throw s(`Cannot invoke "${x}". Expected a function!`);const T=(x.$inject||ww(x)).map(L=>Ku(b,L)?b[L]:c(L));return{fn:x,dependencies:T}}function l(x){const{fn:b,dependencies:w}=u(x),T=Function.prototype.bind.call(b,null,...w);return new T}function p(x,b,w){const{fn:T,dependencies:L}=u(x,w);return T.apply(b,L)}function f(x){return ds(b=>x.get(b))}function d(x,b){if(b&&b.length){const w=Object.create(null),T=Object.create(null),L=[],A=[],F=[];let H,N,z,ce;for(let Be in r)H=r[Be],b.indexOf(Be)!==-1&&(H[2]==="private"?(N=L.indexOf(H[3]),N===-1?(z=H[3].createChild([],b),ce=f(z),L.push(H[3]),A.push(z),F.push(ce),w[Be]=[ce,Be,"private",z]):w[Be]=[F[N],Be,"private",A[N]]):w[Be]=[H[2],H[1]],T[Be]=!0),(H[2]==="factory"||H[2]==="type")&&H[1].$scope&&b.forEach(it=>{H[1].$scope.indexOf(it)!==-1&&(w[Be]=[H[2],H[1]],T[it]=!0)});b.forEach(Be=>{if(!T[Be])throw new Error('No provider for "'+Be+'". Cannot use provider from the parent!')}),x.unshift(w)}return new fh(x,a)}const h={factory:p,type:l,value:function(x){return x}};function m(x,b){const w=x.__init__||[];return function(){w.forEach(T=>{typeof T=="string"?b.get(T):b.invoke(T)})}}function g(x){const b=x.__exports__;if(b){const w=x.__modules__,T=Object.keys(x).reduce((N,z)=>(z!=="__exports__"&&z!=="__modules__"&&z!=="__init__"&&z!=="__depends__"&&(N[z]=x[z]),N),Object.create(null)),L=(w||[]).concat(T),A=d(L),F=ds(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(w){if(w==="__init__"||w==="__depends__")return;const T=x[w];if(T[2]==="private"){r[w]=T;return}const L=T[0],A=T[1];r[w]=[h[L],Sw(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 E(x){const b=x.reduce(R,[]).map(g);let w=!1;return function(){w||(w=!0,b.forEach(T=>T()))}}this.get=c,this.invoke=p,this.instantiate=l,this.createChild=d,this.init=E(e)}function Sw(e,t){return e!=="value"&&Yu(t)&&(t=ds(t.slice())),t}var Rw=1e3;function xi(e,t){var n=this;t=t||Rw,e.on(["render.shape","render.connection"],t,function(i,r){var o=i.type,a=r.element,s=r.gfx,c=r.attrs;if(n.canRender(a))return o==="render.shape"?n.drawShape(s,a,c):n.drawConnection(s,a,c)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(i,r){if(n.canRender(r))return i.type==="render.getShapePath"?n.getShapePath(r):n.getConnectionPath(r)})}xi.prototype.canRender=function(e){},xi.prototype.drawShape=function(e,t){},xi.prototype.drawConnection=function(e,t){},xi.prototype.getShapePath=function(e){},xi.prototype.getConnectionPath=function(e){};function Cr(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function Cw(e){return["M",e.x,e.y]}function Xu(e){return["L",e.x,e.y]}function Pw(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function Aw(e,t){const n=e.length,i=[Cw(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(Xu(a));continue}const c=Math.min(t,Zu(a.x-o.x,a.y-o.y),Zu(s.x-a.x,s.y-a.y));if(!c){i.push(Xu(a));continue}const u=hs(a,o,c),l=hs(a,o,c*.5),p=hs(a,s,c),f=hs(a,s,c*.5);i.push(Xu(u)),i.push(Pw(l,f,p))}return i}function hs(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=Zu(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function Zu(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Vo(e,t,n){xe(t)&&(n=t,t=null),t||(t={});const i=le("path",t);return xe(n)&&(i.dataset.cornerRadius=String(n)),Qu(i,e)}function Qu(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return re(e,{d:Cr(Aw(t,n))}),e}function ms(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 Pr(e,t,n){n=n||0,ge(e)||(e=[e]),M(e,function(i,r){var o=t(i,r,n);ge(o)&&o.length&&Pr(o,t,n+1)})}function Ju(e,t,n){var i=new Set,r=new Set;return Pr(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 Go(e,t){return Ju(e)}function Tw(e,t,n){vr(t)&&(t=!0),Ft(t)&&(n=t,t=!0),n=n||{};var i=Wo(n.allShapes),r=Wo(n.allConnections),o=Wo(n.enclosedElements),a=Wo(n.enclosedConnections),s=Wo(n.topLevel,t&&Ur(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 Pr(e,u),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function Rt(e,t){t=!!t,ge(e)||(e=[e]);var n,i,r,o;return M(e,function(a){var s=a;a.waypoints&&!t&&(s=Rt(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 Jr(e,t){var n={};return M(e,function(i){var r=i;r.waypoints&&(r=Rt(r)),!xe(t.y)&&r.x>t.x&&(n[i.id]=i),!xe(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(xe(t.width)&&xe(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!xe(t.width)||!xe(t.height))&&(n[i.id]=i)}),n}function dh(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function hh(e){return!!(e&&e.isFrame)}function Wo(e,t){return D({},e||{},t||{})}var Mw=1;function Ui(e,t){xi.call(this,e,Mw),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(Ui,xi),Ui.prototype.canRender=function(){return!0},Ui.prototype.drawShape=function(t,n,i){var r=le("rect");return re(r,{x:0,y:0,width:n.width||0,height:n.height||0}),hh(n)?re(r,D({},this.FRAME_STYLE,i||{})):re(r,D({},this.SHAPE_STYLE,i||{})),we(t,r),r},Ui.prototype.drawConnection=function(t,n,i){var r=Vo(n.waypoints,D({},this.CONNECTION_STYLE,i||{}));return we(t,r),r},Ui.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 Cr(a)},Ui.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 Cr(o)},Ui.$inject=["eventBus","styles"];function kw(){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 D(o,{class:n})},this.style=function(n,i){!ge(n)&&!i&&(i=n,n=[]);var r=vn(n,function(o,a){return D(o,e[a]||{})},{});return i?D(r,i):r},this.computeStyle=function(n,i,r){return ge(i)||(r=i,i=[]),t.style(i||[],D({},r,n||{}))}}const Dw={__init__:["defaultRenderer"],defaultRenderer:["type",Ui],styles:["type",kw]};function vt(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function Et(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 el(e,t){return!e||!t?-1:e.indexOf(t)}function Uo(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function tl(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=Uo(e,t);return Math.abs(r/o)<=i}var Ow=2;function Ei(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(Lw(r,n))return o;return!1}function Lw(e,t){const n=t[0];return _r(t,function(i){return Math.abs(n[e]-i[e])<=Ow})}function mh(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 nl(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var Iw=/,?([a-z]),?/gi,gh=parseFloat,Ct=Math,qi=Ct.PI,ci=Ct.min,ui=Ct.max,yh=Ct.pow,Yi=Ct.abs,Nw=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,Bw=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,vh=Array.isArray||function(e){return e instanceof Array};function $w(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function jw(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 Fw(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 $w(r,i)?(jw(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function Hw(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(Nw,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(Bw,function(c,u){u&&a.push(+u)}),s=="m"&&a.length>2&&(n.push([r,...a.splice(0,2)]),s="l",r=r=="m"?"l":"L");a.length>=t[s]&&(n.push([r,...a.splice(0,t[s])]),!!t[s]););}),n.toString=rl,n}function zw(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 Vw(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 il(e,t,n,i){return arguments.length===1&&(t=e.y,n=e.width,i=e.height,e=e.x),{x:e,y:t,width:n,height:i,x2:e+n,y2:t+i}}function rl(){return this.join(",").replace(Iw,"$1")}function Gw(e){for(var t=new Array(e.length),n=0,i=e.length;n<i;n++)for(var r=e[n],o=t[n]=new Array(r.length),a=0,s=r.length;a<s;a++)o[a]=r[a];return t.toString=rl,t}function _h(e,t,n,i,r,o,a,s,c){var u=1-c,l=yh(u,3),p=yh(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:gs(h),y:gs(m)}}function bh(e){var t=Xw(...e);return il(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function Ki(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function Ww(e,t){return e=il(e),t=il(t),Ki(t,e.x,e.y)||Ki(t,e.x2,e.y)||Ki(t,e.x,e.y2)||Ki(t,e.x2,e.y2)||Ki(e,t.x,t.y)||Ki(e,t.x2,t.y)||Ki(e,t.x,t.y2)||Ki(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 xh(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 Eh(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=xh(m,e,n,r,a),R=xh(m,t,i,o,s),E=g*g+R*R;d+=f[h]*Ct.sqrt(E)}return u*d}function Uw(e,t,n,i,r,o,a,s){if(!(ui(e,n)<ci(r,a)||ci(e,n)>ui(r,a)||ui(t,i)<ci(o,s)||ci(t,i)>ui(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=gs(c/l),f=gs(u/l),d=+p.toFixed(2),h=+f.toFixed(2);if(!(d<+ci(e,n).toFixed(2)||d>+ui(e,n).toFixed(2)||d<+ci(r,a).toFixed(2)||d>+ui(r,a).toFixed(2)||h<+ci(t,i).toFixed(2)||h>+ui(t,i).toFixed(2)||h<+ci(o,s).toFixed(2)||h>+ui(o,s).toFixed(2)))return{x:p,y:f}}}}function gs(e){return Math.round(e*1e11)/1e11}function qw(e,t,n){var i=bh(e),r=bh(t);if(!Ww(i,r))return[];var o=Eh(...e),a=Eh(...t),s=Sh(e)?1:~~(o/5)||1,c=Sh(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=_h(...e,d/s);u[d]={x:m.x,y:m.y,t:d/s}}for(d=0;d<c+1;d++)m=_h(...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],E=l[h],x=l[h+1],b=Yi(R.x-g.x)<.01?"y":"x",w=Yi(x.x-E.x)<.01?"y":"x",T=Uw(g.x,g.y,R.x,R.y,E.x,E.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+Yi((T[b]-g[b])/(R[b]-g[b]))*(R.t-g.t),F=E.t+Yi((T[w]-E[w])/(x[w]-E[w]))*(x.t-E.t);A>=0&&A<=1&&F>=0&&F<=1&&f.push({x:T.x,y:T.y,t1:A,t2:F})}}return f}function wh(e,t,n){e=Ph(e),t=Ph(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,E=t.length;R<E;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=qw(p,f);{for(var w=0,T=b.length;w<T;w++)b[w].segment1=h,b[w].segment2=R,b[w].bez1=p,b[w].bez2=f;d=d.concat(b)}}}}}return d}function Yw(e){return vh(e)&&vh(e[0])}function Kw(e){if(zw(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=rl,t}function Sh(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function ys(e,t,n,i){return[e,t,n,i,n,i]}function Rh(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 Ch(e,t,n,i,r,o,a,s,c,u){var l=qi*120/180,p=qi/180*(+r||0),f=[],d,h=Fw(function(C,_,y){var k=C*Ct.cos(y)-_*Ct.sin(y),I=C*Ct.sin(y)+_*Ct.cos(y);return{x:k,y:I}});if(u)L=u[0],A=u[1],w=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=Ct.sqrt(R),n=R*n,i=R*i);var E=n*n,x=i*i,b=(o==a?-1:1)*Ct.sqrt(Yi((E*x-E*g*g-x*m*m)/(E*g*g+x*m*m))),w=b*n*g/i+(e+s)/2,T=b*-i*m/n+(t+c)/2,L=Ct.asin(((t-T)/i).toFixed(9)),A=Ct.asin(((c-T)/i).toFixed(9));L=e<w?qi-L:L,A=s<w?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(Yi(F)>l){var H=A,N=s,z=c;A=L+l*(a&&A>L?1:-1),s=w+n*Ct.cos(A),c=T+i*Ct.sin(A),f=Ch(s,c,n,i,r,0,a,N,z,[A,H,w,T])}F=A-L;var ce=Ct.cos(L),Be=Ct.sin(L),it=Ct.cos(A),X=Ct.sin(A),ae=Ct.tan(F/4),me=4/3*n*ae,se=4/3*i*ae,pe=[e,t],ee=[e+me*Be,t-se*ce],$=[s+me*X,c-se*it],B=[s,c];if(ee[0]=2*pe[0]-ee[0],ee[1]=2*pe[1]-ee[1],u)return[ee,$,B].concat(f);f=[ee,$,B].concat(f).join().split(",");for(var U=[],Pe=0,wt=f.length;Pe<wt;Pe++)U[Pe]=Pe%2?h(f[Pe-1],f[Pe],p).y:h(f[Pe],f[Pe+1],p).x;return U}function Xw(e,t,n,i,r,o,a,s){for(var c=[],u=[[],[]],l,p,f,d,h,m,g,R,E=0;E<2;++E){if(E==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),Yi(l)<1e-12){if(Yi(p)<1e-12)continue;d=-f/p,0<d&&d<1&&c.push(d);continue}g=p*p-4*f*l,R=Ct.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 x=c.length,b=x,w;x--;)d=c[x],w=1-d,u[0][x]=w*w*w*e+3*w*w*d*n+3*w*d*d*r+d*d*d*a,u[1][x]=w*w*w*t+3*w*w*d*i+3*w*d*d*o+d*d*d*s;return u[0][b]=e,u[1][b]=t,u[0][b+1]=a,u[1][b+1]=s,u[0].length=u[1].length=b+2,{x0:ci(...u[0]),y0:ci(...u[1]),x1:ui(...u[0]),y1:ui(...u[1])}}function Ph(e){if(Yw(e)||(e=Hw(e)),Vw(e))return e;for(var t=Gw(Kw(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",...Ch(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",...Rh(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",...Rh(d.x,d.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...ys(d.x,d.y,f[1],f[2])];break;case"H":f=["C",...ys(d.x,d.y,f[1],d.y)];break;case"V":f=["C",...ys(d.x,d.y,d.x,f[1])];break;case"Z":f=["C",...ys(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=gh(l[p-4])||n.x,n.by=gh(l[p-3])||n.y}return t}function et(e){return Ft(e)&&yn(e,"waypoints")}function Me(e){return Ft(e)&&yn(e,"labelTarget")}function Zw(e){return Ft(e)&&Gr(e.parent)}function Ah(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function wi(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function he(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function vs(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function Qw(e){return wi({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function Jw(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=n1(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 ye(e){return et(e)?Jw(e):Qw(e)}function Yt(e,t,n){n=n||0,Ft(n)||(n={x:n,y:n});var i=he(e),r=he(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 qo(e,t,n){var i=e1(e,t);return i.length===1||i.length===2&&Uo(i[0],i[1])<1?wi(i[0]):i.length>1?(i=ti(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),wi(i[n?0:i.length-1])):null}function e1(e,t){return wh(e,t)}function t1(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],Uo(n,r)===0||tl(i,r,n)?e.splice(t,1):t++;return e}function n1(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function _s(e,t){return Math.round(e*t)/t}function Th(e){return xe(e)?e+"px":e}function i1(e){for(;e.parent;)e=e.parent;return e}function r1(e){e=D({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),pn(n,{position:"relative",overflow:"hidden",width:Th(e.width),height:Th(e.height)}),t.appendChild(n),n}function Mh(e,t,n){const i=le("g");Ne(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const o1="base",kh=0,a1=1,s1={shape:["x","y","width","height"],connection:["waypoints"]};function ve(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||{})}ve.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],ve.prototype._init=function(e){const t=this._eventBus,n=this._container=r1(e),i=this._svg=le("svg");re(i,{width:"100%",height:"100%"}),nn(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")}),we(n,i);const r=this._viewport=Mh(i,"viewport");e.deferUpdate&&(this._viewboxChanged=xu(this._viewboxChanged,300)),this._restoreFocus=xu(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)},ve.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},ve.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},ve.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=dh(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},ve.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},ve.prototype.restoreFocus=function(){this._restoreFocus()},ve.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},ve.prototype.isFocused=function(){return this._focused},ve.prototype.getDefaultLayer=function(){return this.getLayer(o1,kh)},ve.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},ve.prototype._getChildIndex=function(e){return vn(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},ve.prototype._createLayer=function(e,t){typeof t>"u"&&(t=a1);const n=this._getChildIndex(t);return{group:Mh(this._viewport,"layer-"+e,n),index:t,visible:!0}},ve.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},ve.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&&(It(n),t.visible=!1),n},ve.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],It(t.group))},ve.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},ve.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(i1(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},ve.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},ve.prototype._findPlaneForRoot=function(e){return rt(this._planes,function(t){return t.rootElement===e})},ve.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},ve.prototype._resolveElements=function(e){return ge(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},ve.prototype.getContainer=function(){return this._container},ve.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),Ne(r).add(t)):(e.markers.delete(t),Ne(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},ve.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},ve.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},ve.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},ve.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},ve.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},ve.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,kh);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},ve.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},ve.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},ve.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)},ve.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})},ve.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})},ve.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=s1[e];if(!_r(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},ve.prototype._setParent=function(e,t,n){Et(t.children,e,n),e.parent=t},ve.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},ve.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},ve.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},ve.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),vt(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},ve.prototype.removeShape=function(e){return this._removeElement(e,"shape")},ve.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},ve.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},ve.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},ve.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},ve.prototype.viewbox=function(e){if(e===void 0&&this._cachedViewbox)return structuredClone(this._cachedViewbox);const t=this._viewport,n=this.getSize();let i,r,o,a,s,c,u;if(e)this._changeViewbox(function(){s=Math.min(n.width/e.width,n.height/e.height);const l=this._svg.createSVGMatrix().scale(s).translate(-e.x,-e.y);zo(t,l)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=zo(t),r=a?a.matrix:fw(),s=_s(r.a,1e3),c=_s(-r.e||0,1e3),u=_s(-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},ve.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=D({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Dh(t,n)}),{x:n.e,y:n.f}},ve.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=Rt(o),s=he(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=he(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})},ve.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)}),_s(i.a,1e3)};function Dh(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}ve.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},ve.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=D(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),Dh(this._viewport,l),l},ve.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},ve.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}},ve.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var eo="data-element-id";function kn(e){this._elements={},this._eventBus=e}kn.$inject=["eventBus"],kn.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),re(t,eo,i),n&&re(n,eo,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},kn.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(re(i.gfx,eo,""),i.secondaryGfx&&re(i.secondaryGfx,eo,""),delete t[n])},kn.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)},kn.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,eo,i),t},kn.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&re(e,eo);var n=this._elements[t];return n&&n.element},kn.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},kn.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}},kn.prototype.getAll=function(){return this.filter(function(e){return e})},kn.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)})},kn.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},kn.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 u1(e){return e.__refs_collection===!0}function l1(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function Oh(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 p1(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 Bn(e,t){if(!(this instanceof Bn))return new Bn(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Bn.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?Oh(this,t,e):p1(this,t,e)},Bn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return u1(n)||Oh(this,t,e),n},Bn.prototype.ensureBound=function(e,t){l1(e,t)||this.bind(e,t)},Bn.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Bn.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var ol=new Bn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Lh=new Bn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Ih=new Bn({name:"attachers",collection:!0},{name:"host"}),Nh=new Bn({name:"outgoing",collection:!0},{name:"source"}),Bh=new Bn({name:"incoming",collection:!0},{name:"target"});function to(){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)}}),ol.bind(this,"parent"),Lh.bind(this,"labels"),Nh.bind(this,"outgoing"),Bh.bind(this,"incoming")}function Yo(){to.call(this),ol.bind(this,"children"),Ih.bind(this,"host"),Ih.bind(this,"attachers")}ie(Yo,to);function $h(){to.call(this),ol.bind(this,"children")}ie($h,Yo);function jh(){Yo.call(this),Lh.bind(this,"labelTarget")}ie(jh,Yo);function Fh(){to.call(this),Nh.bind(this,"source"),Bh.bind(this,"target")}ie(Fh,to);var f1={connection:Fh,shape:Yo,label:jh,root:$h};function d1(e,t){var n=f1[e];if(!n)throw new Error("unknown type: <"+e+">");return D(new n,t)}function h1(e){return e instanceof to}function Si(){this._uid=12}Si.prototype.createRoot=function(e){return this.create("root",e)},Si.prototype.createLabel=function(e){return this.create("label",e)},Si.prototype.createShape=function(e){return this.create("shape",e)},Si.prototype.createConnection=function(e){return this.create("connection",e)},Si.prototype.create=function(e,t){return t=D({},t||{}),t.id||(t.id=e+"_"+this._uid++),d1(e,t)};var bs="__fn",Hh=1e3,m1=Array.prototype.slice;function xn(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}xn.prototype.on=function(e,t,n,i){if(e=ge(e)?e:[e],Ht(t)&&(i=n,n=t,t=Hh),!xe(t))throw new Error("priority must be a number");var r=n;i&&(r=dn(n,i),r[bs]=n[bs]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},xn.prototype.once=function(e,t,n,i){var r=this;if(Ht(t)&&(i=n,n=t,t=Hh),!xe(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[bs]=n,this.on(e,t,o)},xn.prototype.off=function(e,t){e=ge(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},xn.prototype.createEvent=function(e){var t=new Ko;return t.init(e),t},xn.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 Ko?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}},xn.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},xn.prototype._destroy=function(){this._listeners={}},xn.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},xn.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=g1(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},xn.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},xn.prototype._getListeners=function(e){return this._listeners[e]},xn.prototype._setListeners=function(e,t){this._listeners[e]=t},xn.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[bs]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function Ko(){}Ko.prototype.stopPropagation=function(){this.cancelBubble=!0},Ko.prototype.preventDefault=function(){this.defaultPrevented=!0},Ko.prototype.init=function(e){D(this,e||{})};function g1(e,t){return e.apply(null,t)}function Ar(e){return e.childNodes[0]}function y1(e){return e.parentNode.childNodes[1]}function xs(e,t,n,i,r){var o=Ho();o.setTranslate(t,n);var a=Ho();a.setRotate(i||0,0,0);var s=Ho();s.setScale(1,1),zo(e,[o,a,s])}function Kt(e,t,n){var i=Ho();i.setTranslate(t,n),zo(e,i)}function zh(e,t){var n=Ho();n.setRotate(t,0,0),zo(e,n)}function Dn(e,t){this._eventBus=e,this._elementRegistry=t}Dn.$inject=["eventBus","elementRegistry"],Dn.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=y1(t),n||(n=le("g"),Ne(n).add("djs-children"),we(t.parentNode,n))):n=t,n},Dn.prototype._clear=function(e){var t=Ar(e);return us(t),t},Dn.prototype._createContainer=function(e,t,n,i){var r=le("g");Ne(r).add("djs-group"),typeof n<"u"?v1(r,t,t.childNodes[n]):we(t,r);var o=le("g");Ne(o).add("djs-element"),Ne(o).add("djs-"+e),i&&Ne(o).add("djs-frame"),we(r,o);var a=le("g");return Ne(a).add("djs-visual"),we(o,a),o},Dn.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,hh(t))},Dn.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=vn(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)})}})},Dn.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},Dn.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},Dn.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},Dn.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},Dn.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),Kt(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")}},Dn.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);It(t.parentNode)};function v1(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const _1={__depends__:[Dw],__init__:["canvas"],canvas:["type",ve],elementRegistry:["type",kn],elementFactory:["type",Si],eventBus:["type",xn],graphicsFactory:["type",Dn]};function b1(e){var t=new fh(e);return t.init(),t}function x1(e){e=e||{};var t={config:["value",e]},n=[t,_1].concat(e.modules||[]);return b1(n)}function Xi(e,t){this._injector=t||x1(e),this.get("eventBus").fire("diagram.init")}Xi.prototype.get=function(e,t){return this._injector.get(e,t)},Xi.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},Xi.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},Xi.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function rn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function hn(e,t){return e.$instanceOf(t)}function E1(e){return rt(e.rootElements,function(t){return hn(t,"bpmn:Process")||hn(t,"bpmn:Collaboration")})}function w1(e){var t={},n=[],i={};function r($,B){return function(U){$(U,B)}}function o($){t[$.id]=$}function a($){return t[$.id]}function s($,B){var U=$.gfx;if(U)throw new Error(`already rendered ${rn($)}`);return e.element($,i[$.id],B)}function c($,B){return e.root($,i[$.id],B)}function u($,B){try{var U=i[$.id]&&s($,B);return o($),U}catch(Pe){l(Pe.message,{element:$,error:Pe}),console.error(`failed to import ${rn($)}`,Pe)}}function l($,B){e.error($,B)}var p=this.registerDi=function(B){var U=B.bpmnElement;U?i[U.id]?l(`multiple DI elements defined for ${rn(U)}`,{element:U}):i[U.id]=B:l(`no bpmnElement referenced in ${rn(B)}`,{element:B})};function f($){d($.plane)}function d($){p($),M($.planeElement,h)}function h($){p($)}this.handleDefinitions=function(B,U){var Pe=B.diagrams;if(U&&Pe.indexOf(U)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!U&&Pe&&Pe.length&&(U=Pe[0]),!U)throw new Error("no diagram to display");i={},f(U);var wt=U.plane;if(!wt)throw new Error(`no plane for ${rn(U)}`);var C=wt.bpmnElement;if(!C)if(C=E1(B),C)l(`correcting missing bpmnElement on ${rn(wt)} to ${rn(C)}`),wt.bpmnElement=C,p(wt);else throw new Error("no process or collaboration to display");var _=c(C,wt);if(hn(C,"bpmn:Process")||hn(C,"bpmn:SubProcess"))g(C,_);else if(hn(C,"bpmn:Collaboration"))pe(C,_),R(B.rootElements,_);else throw new Error(`unsupported bpmnElement for ${rn(wt)}: ${rn(C)}`);m(n)};var m=this.handleDeferred=function(){for(var B;n.length;)B=n.shift(),B()};function g($,B){ae($,B),F($.ioSpecification,B),A($.artifacts,B),o($)}function R($,B){var U=Oe($,function(Pe){return!a(Pe)&&hn(Pe,"bpmn:Process")&&Pe.laneSets});U.forEach(r(g,B))}function E($,B){u($,B)}function x($,B){M($,r(E,B))}function b($,B){u($,B)}function w($,B){u($,B)}function T($,B){u($,B)}function L($,B){u($,B)}function A($,B){M($,function(U){hn(U,"bpmn:Association")?n.push(function(){L(U,B)}):L(U,B)})}function F($,B){$&&(M($.dataInputs,r(w,B)),M($.dataOutputs,r(T,B)))}var H=this.handleSubProcess=function(B,U){ae(B,U),A(B.artifacts,U)};function N($,B){var U=u($,B);hn($,"bpmn:SubProcess")&&H($,U||B),hn($,"bpmn:Activity")&&F($.ioSpecification,B),n.push(function(){M($.dataInputAssociations,r(b,B)),M($.dataOutputAssociations,r(b,B))})}function z($,B){u($,B)}function ce($,B){u($,B)}function Be($,B){n.push(function(){var U=u($,B);$.childLaneSet&&it($.childLaneSet,U||B),ee($)})}function it($,B){M($.lanes,r(Be,B))}function X($,B){M($,r(it,B))}function ae($,B){me($.flowElements,B),$.laneSets&&X($.laneSets,B)}function me($,B){M($,function(U){hn(U,"bpmn:SequenceFlow")?n.push(function(){z(U,B)}):hn(U,"bpmn:BoundaryEvent")?n.unshift(function(){N(U,B)}):hn(U,"bpmn:FlowNode")?N(U,B):hn(U,"bpmn:DataObject")||(hn(U,"bpmn:DataStoreReference")||hn(U,"bpmn:DataObjectReference")?ce(U,B):l(`unrecognized flowElement ${rn(U)} in context ${rn(B&&B.businessObject)}`,{element:U,context:B}))})}function se($,B){var U=u($,B),Pe=$.processRef;Pe&&g(Pe,U||B)}function pe($,B){M($.participants,r(se,B)),n.push(function(){x($.messageFlows,B)}),A($.artifacts,B)}function ee($){M($.flowNodeRef,function(B){var U=B.get("lanes");U&&U.push($)})}}function v(e,t){var n=K(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function ke(e,t){return Bi(t,function(n){return v(e,n)})}function K(e){return e&&e.businessObject||e}function He(e){return e&&e.di}function S1(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 w1(p);l=l||u.diagrams&&u.diagrams[0];var d=R1(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 R1(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!v(n,"bpmn:Process")&&!v(n,"bpmn:Collaboration")&&(i=C1(n));var r;v(i,"bpmn:Collaboration")?r=i:r=rt(e.rootElements,function(u){if(v(u,"bpmn:Collaboration"))return rt(u.participants,function(l){return l.processRef===i})});var o=[i];r&&(o=en(r.participants,function(u){return u.processRef}),o.push(r));var a=Vh(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 Vh(e){var t=[];return M(e,function(n){n&&(t.push(n),t=t.concat(Vh(n.flowElements)))}),t}function C1(e){for(var t=e;t;){if(v(t,"bpmn:Process"))return t;t=t.$parent}}var P1='<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>',Gh=P1,Wh={verticalAlign:"middle"},Uh={color:"#404040"},A1={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},T1={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},M1={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">'+Gh+'</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>',li;function D1(){li=st(k1),pn(li,A1),pn(Qe("svg",li),Wh),pn(Qe(".backdrop",li),T1),pn(Qe(".notice",li),M1),pn(Qe(".link",li),Uh,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function O1(){li||(D1(),bn.bind(li,".backdrop","click",function(e){document.body.removeChild(li)})),document.body.appendChild(li)}const Es=5,qh="djs-outline-hidden";function dt(e){e=D({},I1,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),B1(this._container)}ie(dt,Xi),dt.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||[]),ws(s,o),s=L1(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},dt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},dt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw ws(o,[]),o}if(typeof t=="string"&&(i=N1(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw ws(o,[]),o}try{this.clear()}catch(o){throw ws(o,[]),o}const{warnings:r}=await S1(this,n,i);return{warnings:r}},dt.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},dt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=Qe(":scope > defs",i._svg),a=ph(r),s=o?"<defs>"+ph(o)+"</defs>":"",c=i.getContainer();ft(c).add(qh);let u;try{u=r.getBBox()}finally{ft(c).remove(qh)}const l=u.x-Es,p=u.y-Es,f=u.width+Es*2,d=u.height+Es*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">'+s+a+"</svg>"}catch(i){n=i}if(this._emit("saveSVG.done",{error:n,svg:t}),n)throw n;return{svg:t}},pt.prototype._setDefinitions=function(e){this._definitions=e},pt.prototype.getModules=function(){return this._modules},pt.prototype.clear=function(){this.getDefinitions()&&Ki.prototype.clear.call(this)},pt.prototype.destroy=function(){Ki.prototype.destroy.call(this),ai(this._container)},pt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},pt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},pt.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),typeof e=="string"&&(e=Xe(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},pt.prototype.getDefinitions=function(){return this._definitions},pt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},pt.prototype._init=function(e,t,n){const i=n.modules||this.getModules(n),r=n.additionalModules||[],o=[{bpmnjs:["value",this],moddle:["value",t]}],a=[].concat(o,i,r),s=D(ni(n,["additionalModules"]),{canvas:D({},n.canvas,{container:e}),modules:a});Ki.call(this,s),n&&n.container&&this.attachTo(n.container)},pt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},pt.prototype._createContainer=function(e){const t=rt('<div class="bjs-container"></div>');return ln(t,{width:Hh(e.width),height:Hh(e.height),position:e.position}),t},pt.prototype._createModdle=function(e){const t=D({},this._moddleExtensions,e.moddleExtensions);return new td(t)},pt.prototype._modules=[];function ys(e,t){return e.warnings=t,e}function C1(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 P1={width:"100%",height:"100%",position:"relative"};function Hh(e){return e+(_e(e)?"px":"")}function A1(e,t){return t&&it(e.diagrams,function(n){return n.id===t})||null}function T1(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Bh+"</a>",i=rt(n);ln(Xe("svg",i),$h),ln(i,jh,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),be.bind(i,"click",function(r){R1(),r.preventDefault()})}function eo(e){pt.call(this,e),this.on("import.parse.complete",function(t){t.error||this._collectIds(t.definitions,t.elementsById)},this),this.on("diagram.destroy",function(){this.get("moddle").ids.clear()},this)}ie(eo,pt),eo.prototype._createModdle=function(e){var t=pt.prototype._createModdle.call(this,e);return t.ids=new oi([32,36,1]),t},eo.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 Oe(e,t){return y(e,"bpmn:CallActivity")?!1:y(e,"bpmn:SubProcess")?(t=t||Be(e),t&&y(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):y(e,"bpmn:Participant")?!!K(e).processRef:!0}function Ht(e){if(!(!y(e,"bpmn:Participant")&&!y(e,"bpmn:Lane"))){var t=Be(e).isHorizontal;return t===void 0?!0:t}}function M1(e){return e&&K(e).isInterrupting!==!1}function tn(e){return e&&!!K(e).triggeredByEvent}function to(e,t){var n=K(e).eventDefinitions;return Ni(n,function(i){return y(i,t)})}function k1(e){return to(e,"bpmn:ErrorEventDefinition")}function D1(e){return to(e,"bpmn:EscalationEventDefinition")}function O1(e){return to(e,"bpmn:CompensateEventDefinition")}var Pr={width:90,height:20},zh=15;function Xi(e){return y(e,"bpmn:Event")||y(e,"bpmn:Gateway")||y(e,"bpmn:DataStoreReference")||y(e,"bpmn:DataObjectReference")||y(e,"bpmn:DataInput")||y(e,"bpmn:DataOutput")||y(e,"bpmn:SequenceFlow")||y(e,"bpmn:MessageFlow")||y(e,"bpmn:Group")}function _s(e){return Re(e.label)}function L1(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=I1(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-=zh:a+=zh,{x:a,y:s}}function I1(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 il(e){return e.waypoints?L1(e.waypoints):y(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Pr.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Pr.height/2}}function N1(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(Pr.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=il(t),i=Pr),D({x:n.x-i.width/2,y:n.y-i.height/2},i)}function Vh(e){if(y(e,"bpmn:FlowElement")||y(e,"bpmn:Participant")||y(e,"bpmn:Lane")||y(e,"bpmn:SequenceFlow")||y(e,"bpmn:MessageFlow")||y(e,"bpmn:DataInput")||y(e,"bpmn:DataOutput"))return"name";if(y(e,"bpmn:TextAnnotation"))return"text";if(y(e,"bpmn:Group"))return"categoryValueRef"}function B1(e){var t=e.categoryValueRef;return t&&t.value||""}function Dn(e){var t=e.businessObject,n=Vh(t);if(n)return n==="categoryValueRef"?B1(t):t[n]||""}function $1(e,t){var n=e.businessObject,i=Vh(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function j1(e){return Re(e)&&Xi(e.labelTarget)}var no=7;function Gh(e){let t=[];return M(e.incoming,n=>{y(n,"bpmn:Association")&&y(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),M(e.outgoing,n=>{y(n,"bpmn:Association")&&y(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function qo(e){const t=new Map;return M(Xu(e),n=>{M(Gh(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 rl="hsl(225, 10%, 15%)",F1="white";function li(e,t){return Ni(e.eventDefinitions,function(n){return n.$type===t})}function H1(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function z1(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function Me(e,t,n){var i=Be(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||F1}function ee(e,t,n){var i=Be(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||rl}function Yo(e,t,n,i){var r=Be(e),o=r.get("label");return i||o&&o.get("color:color")||t||ee(e,n)}function Wh(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 Sr(r)}function ol(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 Sr(a)}function V1(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 Sr(s)}function G1(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 Sr(o)}function Ko(e,t={}){return{width:$n(e,t),height:En(e,t)}}function $n(e,t={}){return vn(t,"width")?t.width:e.width}function En(e,t={}){return vn(t,"height")?t.height:e.height}var W1=new oi,U1=10,bs=3,q1=1.5,xs=10,Y1=4,io=.95,K1=1,X1=.25;function Ar(e,t,n,i,r,o,a){bi.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:rl,strokeWidth:2,fill:"white"})}function p(C){return n.computeStyle(C,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:rl,strokeWidth:2})}function f(C,_){var{ref:v={x:0,y:0},scale:k=1,element:L,parentGfx:V=r._svg}=_,te=pe("marker",{id:C,viewBox:"0 0 20 20",refX:v.x,refY:v.y,markerWidth:20*k,markerHeight:20*k,orient:"auto"});xe(te,L);var we=Xe(":scope > defs",V);we||(we=pe("defs"),xe(V,we)),xe(we,te)}function d(C,_,v,k){var L=W1.nextPrefixed("marker-");return h(C,L,_,v,k),"url(#"+L+")"}function h(C,_,v,k,L){if(v==="sequenceflow-end"){var V=pe("path",{d:"M 1 5 L 11 10 L 1 15 Z",...l({fill:L,stroke:L,strokeWidth:1})});f(_,{element:V,ref:{x:11,y:10},scale:.5,parentGfx:C})}if(v==="messageflow-start"){var te=pe("circle",{cx:6,cy:6,r:3.5,...l({fill:k,stroke:L,strokeWidth:1,strokeDasharray:[1e4,1]})});f(_,{element:te,ref:{x:6,y:6},parentGfx:C})}if(v==="messageflow-end"){var we=pe("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...l({fill:k,stroke:L,strokeWidth:1,strokeDasharray:[1e4,1]})});f(_,{element:we,ref:{x:8.5,y:5},parentGfx:C})}if(v==="association-start"){var je=pe("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:L,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(_,{element:je,ref:{x:1,y:10},scale:.5,parentGfx:C})}if(v==="association-end"){var vt=pe("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:L,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(_,{element:vt,ref:{x:11,y:10},scale:.5,parentGfx:C})}if(v==="conditional-flow-marker"){var Ze=pe("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...l({fill:k,stroke:L})});f(_,{element:Ze,ref:{x:-1,y:10},scale:.5,parentGfx:C})}if(v==="conditional-default-flow-marker"){var $t=pe("path",{d:"M 6 4 L 10 16",...l({stroke:L,fill:"none"})});f(_,{element:$t,ref:{x:0,y:10},scale:.5,parentGfx:C})}}function m(C,_,v,k,L={}){jt(k)&&(L=k,k=0),k=k||0,L=l(L);var V=_/2,te=v/2,we=pe("circle",{cx:V,cy:te,r:Math.round((_+v)/4-k),...L});return xe(C,we),we}function g(C,_,v,k,L,V){jt(L)&&(V=L,L=0),L=L||0,V=l(V);var te=pe("rect",{x:L,y:L,width:_-L*2,height:v-L*2,rx:k,ry:k,...V});return xe(C,te),te}function S(C,_,v,k){var L=_/2,V=v/2,te=[{x:L,y:0},{x:_,y:V},{x:L,y:v},{x:0,y:V}],we=te.map(function(vt){return vt.x+","+vt.y}).join(" ");k=l(k);var je=pe("polygon",{...k,points:we});return xe(C,je),je}function E(C,_,v,k){v=p(v);var L=Fo(_,v,k);return xe(C,L),L}function x(C,_,v){return E(C,_,v,5)}function b(C,_,v){v=p(v);var k=pe("path",{...v,d:_});return xe(C,k),k}function w(C,_,v,k){return b(_,v,D({"data-marker":C},k))}function T(C){return xt[C]}function O(C){return function(_,v,k){return T(C)(_,v,k)}}var P={"bpmn:MessageEventDefinition":function(C,_,v={},k){var L=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.235,my:.315}}),V=k?ee(_,c,v.stroke):Me(_,s,v.fill),te=k?Me(_,s,v.fill):ee(_,c,v.stroke),we=b(C,L,{fill:V,stroke:te,strokeWidth:1});return we},"bpmn:TimerEventDefinition":function(C,_,v={}){var k=v.width||_.width,L=v.height||_.height,V=v.width?1:2,te=m(C,k,L,.2*L,{fill:Me(_,s,v.fill),stroke:ee(_,c,v.stroke),strokeWidth:V}),we=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:k,containerHeight:L,position:{mx:.5,my:.5}});b(C,we,{stroke:ee(_,c,v.stroke),strokeWidth:V});for(var je=0;je<12;je++){var vt=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:k,containerHeight:L,position:{mx:.5,my:.5}}),Ze=k/2,$t=L/2;b(C,vt,{strokeWidth:1,stroke:ee(_,c,v.stroke),transform:"rotate("+je*30+","+$t+","+Ze+")"})}return te},"bpmn:EscalationEventDefinition":function(C,_,v={},k){var L=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.5,my:.2}}),V=k?ee(_,c,v.stroke):Me(_,s,v.fill);return b(C,L,{fill:V,stroke:ee(_,c,v.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(C,_,v={}){var k=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.5,my:.222}});return b(C,k,{fill:Me(_,s,v.fill),stroke:ee(_,c,v.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(C,_,v={},k){var L=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.57,my:.263}}),V=k?ee(_,c,v.stroke):Me(_,s,v.fill);return b(C,L,{fill:V,stroke:ee(_,c,v.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(C,_,v={},k){var L=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.2,my:.722}}),V=k?ee(_,c,v.stroke):Me(_,s,v.fill);return b(C,L,{fill:V,stroke:ee(_,c,v.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(C,_,v={},k){var L=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.638,my:-.055}}),V=k?ee(_,c,v.stroke):"none",te=b(C,L,{fill:V,stroke:ee(_,c,v.stroke),strokeWidth:1});return Ih(te,45),te},"bpmn:CompensateEventDefinition":function(C,_,v={},k){var L=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.22,my:.5}}),V=k?ee(_,c,v.stroke):Me(_,s,v.fill);return b(C,L,{fill:V,stroke:ee(_,c,v.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(C,_,v={},k){var L=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.5,my:.2}}),V=k?ee(_,c,v.stroke):Me(_,s,v.fill);return b(C,L,{strokeWidth:1,fill:V,stroke:ee(_,c,v.stroke)})},"bpmn:MultipleEventDefinition":function(C,_,v={},k){var L=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.211,my:.36}}),V=k?ee(_,c,v.stroke):Me(_,s,v.fill);return b(C,L,{fill:V,stroke:ee(_,c,v.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(C,_,v={}){var k=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.458,my:.194}});return b(C,k,{fill:Me(_,s,v.fill),stroke:ee(_,c,v.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(C,_,v={}){var k=m(C,_.width,_.height,8,{fill:ee(_,c,v.stroke),stroke:ee(_,c,v.stroke),strokeWidth:4});return k}};function j(C,_,v={},k){var L=K(C),V=H1(L),te=k||C;return L.get("eventDefinitions")&&L.get("eventDefinitions").length>1?L.get("parallelMultiple")?P["bpmn:ParallelMultipleEventDefinition"](_,te,v,V):P["bpmn:MultipleEventDefinition"](_,te,v,V):li(L,"bpmn:MessageEventDefinition")?P["bpmn:MessageEventDefinition"](_,te,v,V):li(L,"bpmn:TimerEventDefinition")?P["bpmn:TimerEventDefinition"](_,te,v,V):li(L,"bpmn:ConditionalEventDefinition")?P["bpmn:ConditionalEventDefinition"](_,te,v,V):li(L,"bpmn:SignalEventDefinition")?P["bpmn:SignalEventDefinition"](_,te,v,V):li(L,"bpmn:EscalationEventDefinition")?P["bpmn:EscalationEventDefinition"](_,te,v,V):li(L,"bpmn:LinkEventDefinition")?P["bpmn:LinkEventDefinition"](_,te,v,V):li(L,"bpmn:ErrorEventDefinition")?P["bpmn:ErrorEventDefinition"](_,te,v,V):li(L,"bpmn:CancelEventDefinition")?P["bpmn:CancelEventDefinition"](_,te,v,V):li(L,"bpmn:CompensateEventDefinition")?P["bpmn:CompensateEventDefinition"](_,te,v,V):li(L,"bpmn:TerminateEventDefinition")?P["bpmn:TerminateEventDefinition"](_,te,v,V):null}var F={ParticipantMultiplicityMarker:function(C,_,v={}){var k=$n(_,v),L=En(_,v),V=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:k,containerHeight:L,position:{mx:(k/2-6)/k,my:(L-15)/L}});w("participant-multiplicity",C,V,{strokeWidth:2,fill:Me(_,s,v.fill),stroke:ee(_,c,v.stroke)})},SubProcessMarker:function(C,_,v={}){var k=g(C,14,14,0,{strokeWidth:1,fill:Me(_,s,v.fill),stroke:ee(_,c,v.stroke)});Ut(k,_.width/2-7.5,_.height-20);var L=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}});w("sub-process",C,L,{fill:Me(_,s,v.fill),stroke:ee(_,c,v.stroke)})},ParallelMarker:function(C,_,v){var k=$n(_,v),L=En(_,v),V=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:k,containerHeight:L,position:{mx:(k/2+v.parallel)/k,my:(L-20)/L}});w("parallel",C,V,{fill:Me(_,s,v.fill),stroke:ee(_,c,v.stroke)})},SequentialMarker:function(C,_,v){var k=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2+v.seq)/_.width,my:(_.height-19)/_.height}});w("sequential",C,k,{fill:Me(_,s,v.fill),stroke:ee(_,c,v.stroke)})},CompensationMarker:function(C,_,v){var k=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2+v.compensation)/_.width,my:(_.height-13)/_.height}});w("compensation",C,k,{strokeWidth:1,fill:Me(_,s,v.fill),stroke:ee(_,c,v.stroke)})},LoopMarker:function(C,_,v){var k=$n(_,v),L=En(_,v),V=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:k,containerHeight:L,position:{mx:(k/2+v.loop)/k,my:(L-7)/L}});w("loop",C,V,{strokeWidth:1.5,fill:"none",stroke:ee(_,c,v.stroke),strokeMiterlimit:.5})},AdhocMarker:function(C,_,v){var k=$n(_,v),L=En(_,v),V=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:k,containerHeight:L,position:{mx:(k/2+v.adhoc)/k,my:(L-15)/L}});w("adhoc",C,V,{strokeWidth:1,fill:ee(_,c,v.stroke),stroke:ee(_,c,v.stroke)})}};function I(C,_,v,k){F[C](_,v,k)}function H(C,_,v=[],k={}){k={fill:k.fill,stroke:k.stroke,width:$n(_,k),height:En(_,k)};var L=K(_),V=v.includes("SubProcessMarker");V?k={...k,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:k={...k,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},L.get("isForCompensation")&&v.push("CompensationMarker"),y(L,"bpmn:AdHocSubProcess")&&(v.push("AdhocMarker"),V||D(k,{compensation:k.compensation-18}));var te=L.get("loopCharacteristics"),we=te&&te.get("isSequential");te&&(D(k,{compensation:k.compensation-18}),v.includes("AdhocMarker")&&D(k,{seq:-23,loop:-18,parallel:-24}),we===void 0&&v.push("LoopMarker"),we===!1&&v.push("ParallelMarker"),we===!0&&v.push("SequentialMarker")),v.includes("CompensationMarker")&&v.length===1&&D(k,{compensation:-8}),M(v,function(je){I(je,C,_,k)})}function ae(C,_,v={}){v=D({size:{width:100}},v);var k=o.createText(_||"",v);return Le(k).add("djs-label"),xe(C,k),k}function Ie(C,_,v,k={}){var L=K(_),V=Ko({x:_.x,y:_.y,width:_.width,height:_.height},k);return ae(C,L.name,{align:v,box:V,padding:7,style:{fill:Yo(_,u,c,k.stroke)}})}function ot(C,_,v={}){var k={width:_.width,height:_.height,x:_.width/2+_.x,y:_.height/2+_.y};return ae(C,Dn(_),{box:k,style:D({},o.getExternalStyle(),{fill:Yo(_,u,c,v.stroke)})})}function X(C,_,v,k={}){var L=Ht(v),V=ae(C,_,{box:{height:30,width:L?En(v,k):$n(v,k)},align:"center-middle",style:{fill:Yo(v,u,c,k.stroke)}});if(L){var te=-1*En(v,k);gs(V,0,-te,270)}}function oe(C,_,v={}){var{width:k,height:L}=Ko(_,v);return g(C,k,L,xs,{...v,fill:Me(_,s,v.fill),fillOpacity:io,stroke:ee(_,c,v.stroke)})}function me(C,_,v={}){var k=K(_),L=Me(_,s,v.fill),V=ee(_,c,v.stroke);return(k.get("associationDirection")==="One"||k.get("associationDirection")==="Both")&&(v.markerEnd=d(C,"association-end",L,V)),k.get("associationDirection")==="Both"&&(v.markerStart=d(C,"association-start",L,V)),v=$e(v,["markerStart","markerEnd"]),x(C,_.waypoints,{...v,stroke:V,strokeDasharray:"0, 5"})}function se(C,_,v={}){var k=Me(_,s,v.fill),L=ee(_,c,v.stroke),V=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}}),te=b(C,V,{fill:k,fillOpacity:io,stroke:L}),we=K(_);if(z1(we)){var je=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.33,my:(_.height-18)/_.height}});b(C,je,{strokeWidth:2,fill:k,stroke:L})}return te}function le(C,_,v={}){return m(C,_.width,_.height,{fillOpacity:io,...v,fill:Me(_,s,v.fill),stroke:ee(_,c,v.stroke)})}function J(C,_,v={}){return S(C,_.width,_.height,{fill:Me(_,s,v.fill),fillOpacity:io,stroke:ee(_,c,v.stroke)})}function $(C,_,v={}){var k=g(C,$n(_,v),En(_,v),0,{fill:Me(_,s,v.fill),fillOpacity:v.fillOpacity||io,stroke:ee(_,c,v.stroke),strokeWidth:1.5}),L=K(_);if(y(L,"bpmn:Lane")){var V=L.get("name");X(C,V,_,v)}return k}function B(C,_,v={}){var k=oe(C,_,v),L=Oe(_);if(tn(_)&&(re(k,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!L)){var V=K(_).flowElements||[],te=V.filter(we=>y(we,"bpmn:StartEvent"));te.length===1&&G(te[0],C,v,_)}return Ie(C,_,L?"center-top":"center-middle",v),L?H(C,_,void 0,v):H(C,_,["SubProcessMarker"],v),k}function G(C,_,v,k){var L=22,V={fill:Me(k,s,v.fill),stroke:ee(k,c,v.stroke),width:L,height:L},te=K(C).isInterrupting,we=te?0:3,je=te?1:1.2,vt=20,Ze=(L-vt)/2,$t="translate("+Ze+","+Ze+")";m(_,vt,vt,{fill:V.fill,stroke:V.stroke,strokeWidth:je,strokeDasharray:we,transform:$t}),j(C,_,V,k)}function Pe(C,_,v={}){var k=oe(C,_,v);return Ie(C,_,"center-middle",v),H(C,_,void 0,v),k}var xt=this.handlers={"bpmn:AdHocSubProcess":function(C,_,v={}){return Oe(_)?v=$e(v,["fill","stroke","width","height"]):v=$e(v,["fill","stroke"]),B(C,_,v)},"bpmn:Association":function(C,_,v={}){return v=$e(v,["fill","stroke"]),me(C,_,v)},"bpmn:BoundaryEvent":function(C,_,v={}){var{renderIcon:k=!0}=v;v=$e(v,["fill","stroke"]);var L=K(_),V=L.get("cancelActivity");v={strokeWidth:1.5,fill:Me(_,s,v.fill),fillOpacity:K1,stroke:ee(_,c,v.stroke)},V||(v.strokeDasharray="6");var te=le(C,_,v);return m(C,_.width,_.height,bs,{...v,fill:"none"}),k&&j(_,C,v),te},"bpmn:BusinessRuleTask":function(C,_,v={}){v=$e(v,["fill","stroke"]);var k=Pe(C,_,v),L=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),V=b(C,L);re(V,{fill:Me(_,s,v.fill),stroke:ee(_,c,v.stroke),strokeWidth:1});var te=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),we=b(C,te);return re(we,{fill:ee(_,c,v.stroke),stroke:ee(_,c,v.stroke),strokeWidth:1}),k},"bpmn:CallActivity":function(C,_,v={}){return v=$e(v,["fill","stroke"]),B(C,_,{strokeWidth:5,...v})},"bpmn:ComplexGateway":function(C,_,v={}){v=$e(v,["fill","stroke"]);var k=J(C,_,v),L=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:_.width,containerHeight:_.height,position:{mx:.46,my:.26}});return b(C,L,{fill:ee(_,c,v.stroke),stroke:ee(_,c,v.stroke),strokeWidth:1}),k},"bpmn:DataInput":function(C,_,v={}){v=$e(v,["fill","stroke"]);var k=i.getRawPath("DATA_ARROW"),L=se(C,_,v);return b(C,k,{fill:"none",stroke:ee(_,c,v.stroke),strokeWidth:1}),L},"bpmn:DataInputAssociation":function(C,_,v={}){return v=$e(v,["fill","stroke"]),me(C,_,{...v,markerEnd:d(C,"association-end",Me(_,s,v.fill),ee(_,c,v.stroke))})},"bpmn:DataObject":function(C,_,v={}){return v=$e(v,["fill","stroke"]),se(C,_,v)},"bpmn:DataObjectReference":O("bpmn:DataObject"),"bpmn:DataOutput":function(C,_,v={}){v=$e(v,["fill","stroke"]);var k=i.getRawPath("DATA_ARROW"),L=se(C,_,v);return b(C,k,{strokeWidth:1,fill:ee(_,c,v.stroke),stroke:ee(_,c,v.stroke)}),L},"bpmn:DataOutputAssociation":function(C,_,v={}){return v=$e(v,["fill","stroke"]),me(C,_,{...v,markerEnd:d(C,"association-end",Me(_,s,v.fill),ee(_,c,v.stroke))})},"bpmn:DataStoreReference":function(C,_,v={}){v=$e(v,["fill","stroke"]);var k=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:0,my:.133}});return b(C,k,{fill:Me(_,s,v.fill),fillOpacity:io,stroke:ee(_,c,v.stroke),strokeWidth:2})},"bpmn:EndEvent":function(C,_,v={}){var{renderIcon:k=!0}=v;v=$e(v,["fill","stroke"]);var L=le(C,_,{...v,strokeWidth:4});return k&&j(_,C,v),L},"bpmn:EventBasedGateway":function(C,_,v={}){v=$e(v,["fill","stroke"]);var k=K(_),L=J(C,_,v);m(C,_.width,_.height,_.height*.2,{fill:Me(_,"none",v.fill),stroke:ee(_,c,v.stroke),strokeWidth:1});var V=k.get("eventGatewayType"),te=!!k.get("instantiate");function we(){var vt=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:_.width,containerHeight:_.height,position:{mx:.36,my:.44}});b(C,vt,{fill:"none",stroke:ee(_,c,v.stroke),strokeWidth:2})}if(V==="Parallel"){var je=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}});b(C,je,{fill:"none",stroke:ee(_,c,v.stroke),strokeWidth:1})}else V==="Exclusive"&&(te||m(C,_.width,_.height,_.height*.26,{fill:"none",stroke:ee(_,c,v.stroke),strokeWidth:1}),we());return L},"bpmn:ExclusiveGateway":function(C,_,v={}){v=$e(v,["fill","stroke"]);var k=J(C,_,v),L=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:_.width,containerHeight:_.height,position:{mx:.32,my:.3}}),V=Be(_);return V.get("isMarkerVisible")&&b(C,L,{fill:ee(_,c,v.stroke),stroke:ee(_,c,v.stroke),strokeWidth:1}),k},"bpmn:Gateway":function(C,_,v={}){return v=$e(v,["fill","stroke"]),J(C,_,v)},"bpmn:Group":function(C,_,v={}){return v=$e(v,["fill","stroke","width","height"]),g(C,_.width,_.height,xs,{stroke:ee(_,c,v.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:$n(_,v),height:En(_,v)})},"bpmn:InclusiveGateway":function(C,_,v={}){v=$e(v,["fill","stroke"]);var k=J(C,_,v);return m(C,_.width,_.height,_.height*.24,{fill:Me(_,s,v.fill),stroke:ee(_,c,v.stroke),strokeWidth:2.5}),k},"bpmn:IntermediateEvent":function(C,_,v={}){var{renderIcon:k=!0}=v;v=$e(v,["fill","stroke"]);var L=le(C,_,{...v,strokeWidth:1.5});return m(C,_.width,_.height,bs,{fill:"none",stroke:ee(_,c,v.stroke),strokeWidth:1.5}),k&&j(_,C,v),L},"bpmn:IntermediateCatchEvent":O("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":O("bpmn:IntermediateEvent"),"bpmn:Lane":function(C,_,v={}){return v=$e(v,["fill","stroke","width","height"]),$(C,_,{...v,fillOpacity:X1})},"bpmn:ManualTask":function(C,_,v={}){v=$e(v,["fill","stroke"]);var k=Pe(C,_,v),L=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return b(C,L,{fill:Me(_,s,v.fill),stroke:ee(_,c,v.stroke),strokeWidth:.5}),k},"bpmn:MessageFlow":function(C,_,v={}){v=$e(v,["fill","stroke"]);var k=K(_),L=Be(_),V=Me(_,s,v.fill),te=ee(_,c,v.stroke),we=x(C,_.waypoints,{markerEnd:d(C,"messageflow-end",V,te),markerStart:d(C,"messageflow-start",V,te),stroke:te,strokeDasharray:"10, 11",strokeWidth:1.5});if(k.get("messageRef")){var je=we.getPointAtLength(we.getTotalLength()/2),vt=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:je.x,y:je.y}}),Ze={strokeWidth:1};L.get("messageVisibleKind")==="initiating"?(Ze.fill=V,Ze.stroke=te):(Ze.fill=te,Ze.stroke=V);var $t=b(C,vt,Ze),Mt=k.get("messageRef"),nn=Mt.get("name"),tt=ae(C,nn,{align:"center-top",fitBox:!0,style:{fill:te}}),kt=$t.getBBox(),rn=tt.getBBox(),Fr=je.x-rn.width/2,fn=je.y+kt.height/2+U1;gs(tt,Fr,fn,0)}return we},"bpmn:ParallelGateway":function(C,_,v={}){v=$e(v,["fill","stroke"]);var k=J(C,_,v),L=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:_.width,containerHeight:_.height,position:{mx:.46,my:.2}});return b(C,L,{fill:ee(_,c,v.stroke),stroke:ee(_,c,v.stroke),strokeWidth:1}),k},"bpmn:Participant":function(C,_,v={}){v=$e(v,["fill","stroke","width","height"]);var k=$(C,_,v),L=Oe(_),V=Ht(_),te=K(_),we=te.get("name");if(L){var je=V?[{x:30,y:0},{x:30,y:En(_,v)}]:[{x:0,y:30},{x:$n(_,v),y:30}];E(C,je,{stroke:ee(_,c,v.stroke),strokeWidth:q1}),X(C,we,_,v)}else{var vt=Ko(_,v);V||(vt.height=$n(_,v),vt.width=En(_,v));var Ze=ae(C,we,{box:vt,align:"center-middle",style:{fill:Yo(_,u,c,v.stroke)}});if(!V){var $t=-1*En(_,v);gs(Ze,0,-$t,270)}}return te.get("participantMultiplicity")&&I("ParticipantMultiplicityMarker",C,_,v),k},"bpmn:ReceiveTask":function(C,_,v={}){v=$e(v,["fill","stroke"]);var k=K(_),L=Pe(C,_,v),V;return k.get("instantiate")?(m(C,28,28,20*.22,{fill:Me(_,s,v.fill),stroke:ee(_,c,v.stroke),strokeWidth:1}),V=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):V=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),b(C,V,{fill:Me(_,s,v.fill),stroke:ee(_,c,v.stroke),strokeWidth:1}),L},"bpmn:ScriptTask":function(C,_,v={}){v=$e(v,["fill","stroke"]);var k=Pe(C,_,v),L=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return b(C,L,{fill:Me(_,s,v.fill),stroke:ee(_,c,v.stroke),strokeWidth:1}),k},"bpmn:SendTask":function(C,_,v={}){v=$e(v,["fill","stroke"]);var k=Pe(C,_,v),L=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return b(C,L,{fill:ee(_,c,v.stroke),stroke:Me(_,s,v.fill),strokeWidth:1}),k},"bpmn:SequenceFlow":function(C,_,v={}){v=$e(v,["fill","stroke"]);var k=Me(_,s,v.fill),L=ee(_,c,v.stroke),V=x(C,_.waypoints,{markerEnd:d(C,"sequenceflow-end",k,L),stroke:L}),te=K(_),{source:we}=_;if(we){var je=K(we);te.get("conditionExpression")&&y(je,"bpmn:Activity")&&re(V,{markerStart:d(C,"conditional-flow-marker",k,L)}),je.get("default")&&(y(je,"bpmn:Gateway")||y(je,"bpmn:Activity"))&&je.get("default")===te&&re(V,{markerStart:d(C,"conditional-default-flow-marker",k,L)})}return V},"bpmn:ServiceTask":function(C,_,v={}){v=$e(v,["fill","stroke"]);var k=Pe(C,_,v);m(C,10,10,{fill:Me(_,s,v.fill),stroke:"none",transform:"translate(6, 6)"});var L=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});b(C,L,{fill:Me(_,s,v.fill),stroke:ee(_,c,v.stroke),strokeWidth:1}),m(C,10,10,{fill:Me(_,s,v.fill),stroke:"none",transform:"translate(11, 10)"});var V=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return b(C,V,{fill:Me(_,s,v.fill),stroke:ee(_,c,v.stroke),strokeWidth:1}),k},"bpmn:StartEvent":function(C,_,v={}){var{renderIcon:k=!0}=v;v=$e(v,["fill","stroke"]);var L=K(_);L.get("isInterrupting")||(v={...v,strokeDasharray:"6"});var V=le(C,_,v);return k&&j(_,C,v),V},"bpmn:SubProcess":function(C,_,v={}){return Oe(_)?v=$e(v,["fill","stroke","width","height"]):v=$e(v,["fill","stroke"]),B(C,_,v)},"bpmn:Task":function(C,_,v={}){return v=$e(v,["fill","stroke"]),Pe(C,_,v)},"bpmn:TextAnnotation":function(C,_,v={}){v=$e(v,["fill","stroke"]);var{width:k,height:L}=Ko(_,v),V=g(C,k,L,0,0,{fill:"none",stroke:"none"}),te=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:k,containerHeight:L,position:{mx:0,my:0}});b(C,te,{stroke:ee(_,c,v.stroke)});var we=K(_),je=we.get("text")||"";return ae(C,je,{align:"left-top",box:Ko(_,v),padding:no,style:{fill:Yo(_,u,c,v.stroke)}}),V},"bpmn:Transaction":function(C,_,v={}){Oe(_)?v=$e(v,["fill","stroke","width","height"]):v=$e(v,["fill","stroke"]);var k=B(C,_,{strokeWidth:1.5,...v}),L=n.style(["no-fill","no-events"],{stroke:ee(_,c,v.stroke),strokeWidth:1.5}),V=Oe(_);return V||(v={}),g(C,$n(_,v),En(_,v),xs-bs,bs,L),k},"bpmn:UserTask":function(C,_,v={}){v=$e(v,["fill","stroke"]);var k=Pe(C,_,v),L=15,V=12,te=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:L,y:V}});b(C,te,{fill:Me(_,s,v.fill),stroke:ee(_,c,v.stroke),strokeWidth:.5});var we=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:L,y:V}});b(C,we,{fill:Me(_,s,v.fill),stroke:ee(_,c,v.stroke),strokeWidth:.5});var je=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:L,y:V}});return b(C,je,{fill:ee(_,c,v.stroke),stroke:ee(_,c,v.stroke),strokeWidth:.5}),k},label:function(C,_,v={}){return ot(C,_,v)}};this._drawPath=b,this._renderer=T}ie(Ar,bi),Ar.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Ar.prototype.canRender=function(e){return y(e,"bpmn:BaseElement")},Ar.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Ar.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Ar.prototype.getShapePath=function(e){return Re(e)?ol(e,Y1):y(e,"bpmn:Event")?Wh(e):y(e,"bpmn:Activity")?ol(e,xs):y(e,"bpmn:Gateway")?V1(e):G1(e)};function $e(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var Z1=0,Q1={width:150,height:50};function J1(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function eS(e){return jt(e)?D({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var al=null;function tS(){return al||(al=document.createElement("canvas").getContext("2d")),al}function nS(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(Uh(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function Uh(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function iS(e,t){var n=tS();if(!n)return{width:0,height:0};n.font=nS(t),"letterSpacing"in n&&(n.letterSpacing=Uh(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 rS(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=iS(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return oS(e,r,i,o);r=sS(r,o.width,t)}}function oS(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 qh="­";function aS(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===qh)&&r.pop();break}var a=r[r.length-1];return a&&a===qh&&(r[r.length-1]="-"),r.join("")}function sS(e,t,n){var i=Math.max(e.length*(n/t),1),r=aS(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function Es(e){this._config=D({},{size:Q1,padding:Z1,style:{},align:"center-top"},e||{})}Es.prototype.createText=function(e,t){return this.layoutText(e,t).element},Es.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Es.prototype.layoutText=function(e,t){for(var n=D({},this._config.size,t.box),i=D({},this._config.style,t.style),r=J1(t.align||this._config.align),o=eS(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=cS(i),c=e.split(/\u00AD?\r?\n/),u=[],l=n.width-o.left-o.right;c.length;)u.push(rS(c,l,i));r.vertical==="middle"&&(o.top=o.bottom=0);var p=yn(u,function(g,S,E){return g+(s||S.height)},0)+o.top+o.bottom,f=yn(u,function(g,S,E){return S.width>g?S.width:g},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-p)/2),d-=(s||u[0].height)/4;var h=pe("text");re(h,i),M(u,function(g){var S;switch(d+=s||g.height,r.horizontal){case"left":S=o.left;break;case"right":S=(a?f:l)-o.right-g.width;break;default:S=Math.max(((a?f:l)-g.width)/2+o.left,0)}var E=pe("tspan");re(E,{x:S,y:d}),E.textContent=g.text,xe(h,E)});var m={width:f,height:p};return{dimensions:m,element:h}};function cS(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var uS=12,lS=1.2,pS=40;function Yh(e){var t=D({fontFamily:"Arial, sans-serif",fontSize:uS,fontWeight:"normal",lineHeight:lS},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=D({},t,{fontSize:n},e&&e.externalStyle||{}),r=new Es({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Pr.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:no});return{x:a.x,y:a.y,width:a.width,height:Math.max(pS,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,D({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}Yh.$inject=["config.textRenderer"];function fS(){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=gS(i.d,{mx:r,my:o,e:a});return p}}var dS=/\{([^{}]+)\}/g,hS=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function mS(e,t,n){var i=n;return t.replace(hS,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 gS(e,t){return String(e).replace(dS,function(n,i){return mS(n,i,t)})}const vS={__init__:["bpmnRenderer"],bpmnRenderer:["type",Ar],textRenderer:["type",Yh],pathMap:["type",fS]};function yS(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const Xo={translate:["value",yS]};function ws(e,t,n){return D({id:e.id,type:e.$type,businessObject:e,di:t},n)}function _S(e,t,n){var i=e.waypoint;return!i||i.length<2?[ve(t),ve(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function Kh(e,t,n){return new Error(`element ${en(t)} referenced by ${en(e)}#${n} not yet drawn`)}function Si(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}Si.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],Si.prototype.add=function(e,t,n){var i,r,o;if(y(t,"bpmndi:BPMNPlane")){var a=y(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(ws(e,t,a)),this._canvas.addRootElement(i)}else if(y(t,"bpmndi:BPMNShape")){var s=!Oe(e,t),c=xS(e);r=n&&(n.hidden||n.collapsed);var u=t.bounds;i=this._elementFactory.createShape(ws(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})),y(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),y(e,"bpmn:Lane")&&(o=0),y(e,"bpmn:DataStoreReference")&&(bS(n,ve(u))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else if(y(t,"bpmndi:BPMNEdge")){var l=this._getSource(e),p=this._getTarget(e);r=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(ws(e,t,{hidden:r,source:l,target:p,waypoints:_S(t,l,p)})),y(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${en(t)} for element ${en(e)}`);return Xi(e)&&Dn(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},Si.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${en(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw Kh(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},Si.prototype.addLabel=function(e,t,n){var i,r,o;return i=N1(t,n),r=Dn(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(ws(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!Dn(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)},Si.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?Kh(e,i,t+"Ref"):new Error(`${en(e)}#${t} Ref not specified`)},Si.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},Si.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},Si.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function bS(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 xS(e){return y(e,"bpmn:Group")}const Xh={__depends__:[vS,{__depends__:[Xo],bpmnImporter:["type",Si]}]};function Zo(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Qn(e,t){return{x:e.x-t.x,y:e.y-t.y}}function sl(e){return Math.log(e)/Math.log(10)}var ES=1e3;function U(e){this._eventBus=e}U.$inject=["eventBus"];function wS(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}U.prototype.on=function(e,t,n,i,r,o){if((Ft(t)||_e(t))&&(o=r,r=i,i=n,n=t,t=null),Ft(n)&&(o=r,r=i,i=n,n=ES),jt(r)&&(o=r,r=!1),!Ft(i))throw new Error("handlerFn must be a function");ge(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?wS(i,o):i,o)})},U.prototype.canExecute=Ri("canExecute"),U.prototype.preExecute=Ri("preExecute"),U.prototype.preExecuted=Ri("preExecuted"),U.prototype.execute=Ri("execute"),U.prototype.executed=Ri("executed"),U.prototype.postExecute=Ri("postExecute"),U.prototype.postExecuted=Ri("postExecuted"),U.prototype.revert=Ri("revert"),U.prototype.reverted=Ri("reverted");function Ri(e){return function(n,i,r,o,a){(Ft(n)||_e(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var cl=["top","bottom","left","right"],Ss=10;function ul(e,t){U.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(_s(r)&&!Qe(r)){var o=CS(r);o&&i(r,o)}}function i(r,o){var a=ve(r),s=r.label,c=ve(s);if(s.parent){var u=de(r),l;switch(o){case"top":l={x:a.x,y:u.top-Ss-s.height/2};break;case"left":l={x:u.left-Ss-s.width/2,y:a.y};break;case"bottom":l={x:a.x,y:u.bottom+Ss+s.height/2};break;case"right":l={x:u.right+Ss+s.width/2,y:a.y};break}var p=Qn(l,c);t.moveShape(s,p)}}}ie(ul,U),ul.$inject=["eventBus","modeling"];function SS(e){var t=e.host,n=ve(e),i=Wt(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=cl.filter(function(a){return r.indexOf(a)===-1});return o}function RS(e){var t=ve(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 Zh(t,i)});return n}function CS(e){var t=ve(e.label),n=ve(e),i=Zh(n,t);if(PS(i)){var r=RS(e);if(e.host){var o=SS(e);r=r.concat(o)}var a=cl.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?Wt(e.label,e)!=="intersect"?void 0:i:a[0]}}function Zh(e,t){return Wt(t,e,5)}function PS(e){return cl.indexOf(e)!==-1}function ll(e){U.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(y(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(ll,U),ll.$inject=["eventBus"];var AS=1500;function pl(e,t,n){e.invoke(U,this),this.preExecute("elements.delete",AS,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=Te(r,u=>y(u,"bpmn:Participant")||y(u,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(u=>y(u,"bpmn:Artifact"))),c=new Set;return M(o,u=>{const l=new Set(Vr(Zr(Array.from(s),St(u))));c=c.union(l),s=s.difference(l)}),Array.from(c)}}ie(pl,U),pl.$inject=["injector","eventBus","canvas"];function fl(e,t){e.invoke(U,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=Te(r.incoming.concat(r.outgoing),function(a){return y(a,"bpmn:Association")});M(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}ie(fl,U),fl.$inject=["injector","modeling"];function ro(e,t){for(gn(t)&&(t=[t]);e=e.parent;)if(Ce(e,t))return e;return null}function Qh(e,t){var n=ro(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=ro(e,i),n)return Ht(n);if(Ce(e,i))return Ht(e);var r;for(r=K(e);r&&!y(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find(function(a){var s=K(a);return s&&s.get("processRef")===r});return o?Ht(o):!0}var Jh=500;function Rs(e,t){t.invoke(U,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Jh,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return em(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",Jh,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];em(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}Rs.$inject=["bpmnReplace","injector"],ie(Rs,U),Rs.prototype._replaceShape=function(e,t){var n=TS(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function TS(e){var t=K(e),n=t.eventDefinitions;return n&&n[0]}function em(e,t){return!Re(e)&&Ce(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function dl(e,t){U.call(this,e);function n(i){return Te(i.attachers,function(r){return y(r,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var r=i.context.source,o=i.context.target,a=n(o);y(r,"bpmn:EventBasedGateway")&&y(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var r=i.context.oldSource,o=i.context.newSource;y(r,"bpmn:Gateway")&&y(o,"bpmn:EventBasedGateway")&&M(o.outgoing,function(a){var s=a.target,c=n(s);y(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}dl.$inject=["eventBus","modeling"],ie(dl,U);function tm(e){return e.create("bpmn:Category")}function MS(e){return e.create("bpmn:CategoryValue")}function nm(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=MS(e)),n.$parent||(n.$parent=tm(e)),n}function kS(e,t,n){return bt(t.get("categoryValue"),e),e.$parent=t,bt(n.get("rootElements"),t),t.$parent=n,e}function DS(e){var t=e.$parent;return t&&(gt(t.get("categoryValue"),e),e.$parent=null),e}function OS(e){var t=e.$parent;return t&&(gt(t.get("rootElements"),e),e.$parent=null),e}var LS=500;function hl(e,t,n){n.invoke(U,this);function i(c){return t.filter(function(u){return y(u,"bpmn:Group")&&!u.labelTarget}).map(K).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&&kS(c,u,e.getDefinitions())}function s(c,u,l){u&&!o(u,l)&&OS(u),c&&!r(c,l)&&DS(c)}this.executed(["shape.create","label.create"],function(c){var u=c.labelTarget||c.shape;!y(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;!y(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,K(u))},!0),this.executed(["shape.move","shape.resize"],LS,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,K(u))},!0),this.executed("group.updateRefs",function(c){im(c).forEach(function(u){a(u.categoryValue,u.category)})},!0),this.reverted("group.updateRefs",function(c){im(c).forEach(function(u){s(u.categoryValue,u.category,K(u.groupShape))})},!0),this.executed("shape.delete",function(c){var u=c.shape;!y(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,K(u))},!0),this.reverted("shape.delete",function(c){var u=c.shape;!y(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0)}hl.$inject=["bpmnjs","elementRegistry","injector"],ie(hl,U);function im(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function ml(e,t,n){U.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 S=g.source,E=g.target;oo(S)&&Qo(E)&&l(E)}function r(g){const S=g.connection,E=g.source,x=g.target;oo(E)&&Cs(x)&&(u(x),f(E,[S]))}function o(g){const S=g.newTarget,E=g.oldSource,x=g.oldTarget;if(x!==S){const b=E;Qo(x)&&l(x),oo(b)&&Cs(S)&&u(S)}}function a(g){const{element:S}=g;Qo(S)?(p(S),d(S)):Cs(S)&&h(S)}function s(g){const{newData:S,oldShape:E}=g;if(oo(g.oldShape)&&S.eventDefinitionType!=="bpmn:CompensateEventDefinition"||S.type!=="bpmn:BoundaryEvent"){const x=E.outgoing.find(({target:b})=>Qo(b));x&&x.target&&(g._connectionTarget=x.target)}else if(!oo(g.oldShape)&&S.eventDefinitionType==="bpmn:CompensateEventDefinition"&&S.type==="bpmn:BoundaryEvent"){const x=E.outgoing.find(({target:b})=>Cs(b));x&&x.target&&(g._connectionTarget=x.target),m(E)}}function c(g){const{_connectionTarget:S,newShape:E}=g;S&&t.connect(E,S)}function u(g){t.updateProperties(g,{isForCompensation:!0})}function l(g){t.updateProperties(g,{isForCompensation:void 0})}function p(g){for(const S of g.incoming)n.canConnect(S.source,g)||t.removeConnection(S);for(const S of g.outgoing)n.canConnect(g,S.target)||t.removeConnection(S)}function f(g,S){g.outgoing.filter(b=>y(b,"bpmn:Association")).filter(b=>Qo(b.target)&&!S.includes(b)).forEach(b=>t.removeConnection(b))}function d(g){const S=g.attachers.slice();S.length&&t.removeElements(S)}function h(g){const S=g.incoming.filter(E=>oo(E.source));t.removeElements(S)}function m(g){const S=g.outgoing.filter(E=>y(E,"bpmn:SequenceFlow"));t.removeElements(S)}}ie(ml,U),ml.$inject=["eventBus","modeling","bpmnRules"];function Qo(e){const t=K(e);return t&&t.get("isForCompensation")}function oo(e){return e&&y(e,"bpmn:BoundaryEvent")&&to(e,"bpmn:CompensateEventDefinition")}function Cs(e){return e&&y(e,"bpmn:Activity")&&!tn(e)}function gl(e){e.invoke(U,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,r=n.shape;y(i,"bpmn:Lane")&&!y(r,"bpmn:Lane")&&(n.parent=ro(i,"bpmn:Participant"))})}gl.$inject=["injector"],ie(gl,U);function vl(e,t){U.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,r=i.shape;if(y(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}})}vl.$inject=["eventBus","bpmnFactory"],ie(vl,U);var yl=20,_l=20,rm=30,Ps=2e3;function bl(e,t,n){U.call(this,t),t.on(["create.start","shape.move.start"],Ps,function(r){var o=r.context,a=o.shape,s=e.getRootElement();if(!(!y(a,"bpmn:Participant")||!y(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(p){return!y(p,"bpmn:Group")&&!Re(p)&&!Qe(p)});if(c.length){var u=St(c),l=IS(a,u);D(a,l),o.createConstraints=NS(a,u)}}}),t.on("create.start",Ps,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}y(a,"bpmn:Participant")&&y(s,"bpmn:Process")&&(t.on("element.hover",Ps,u),t.once("create.cleanup",function(){t.off("element.hover",u)}))});function i(){var r=e.getRootElement();return y(r,"bpmn:Collaboration")?r:n.makeCollaboration()}this.preExecute("elements.create",Ps,function(r){var o=r.elements,a=r.parent,s=BS(o),c;s&&y(a,"bpmn:Process")&&(r.parent=i(),c=r.hints=r.hints||{},c.participant=s,c.process=a,c.processRef=K(s).get("processRef"))},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;y(a,"bpmn:Participant")&&y(o,"bpmn:Process")&&(r.parent=i(),r.process=o,r.processRef=K(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)&&K(s).set("processRef",K(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)&&K(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)}bl.$inject=["canvas","eventBus","modeling"],ie(bl,U);function IS(e,t){t={width:t.width+yl*2+rm,height:t.height+_l*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 NS(e,t){return t=de(t),{bottom:t.top+e.height/2-_l,left:t.right-e.width/2+yl,top:t.bottom-e.height/2+_l,right:t.left+e.width/2-yl-rm}}function BS(e){return it(e,function(t){return y(t,"bpmn:Participant")})}var om="__targetRef_placeholder";function xl(e,t){U.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],am(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],am(o));function n(a,s,c){var u=a.get("dataInputAssociations");return it(u,function(l){return l!==c&&l.targetRef===s})}function i(a,s){var c=a.get("properties"),u=it(c,function(l){return l.name===om});return!u&&s&&(u=t.create("bpmn:Property",{name:om}),bt(c,u)),u}function r(a,s){var c=i(a);c&&(n(a,c,s)||gt(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,S;m&&m!==p&&r(m,u),d&&d!==p&&r(d,u),p?(S=i(p,!0),g.targetRef=S):g.targetRef=null}}xl.$inject=["eventBus","bpmnFactory"],ie(xl,U);function am(e){return function(t){var n=t.context,i=n.connection;if(y(i,"bpmn:DataInputAssociation"))return e(t)}}function As(e){this._bpmnUpdater=e}As.$inject=["bpmnUpdater"],As.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),[]},As.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 El(e,t,n,i){U.call(this,i),t.registerHandler("dataStore.updateContainment",As);function r(){return n.filter(function(s){return y(s,"bpmn:Participant")&&K(s).processRef})[0]}function o(s){return s.children.filter(function(c){return y(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:Be(s),newSemanticParent:l.processRef||l,newDiParent:Be(c)})}}this.preExecute("shape.create",function(s){var c=s.context,u=c.shape;y(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 y(p,"bpmn:DataStoreReference")});l.length&&(c.hints||(c.hints={}),c.hints.autoResize=u.filter(function(p){return!y(p,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,u=c.shape,l=u.parent;y(u,"bpmn:DataStoreReference")&&u.type!=="label"&&y(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(!y(l,"bpmn:Collaboration")&&y(u,"bpmn:DataStoreReference")&&u.type!=="label"&&y(p,"bpmn:Collaboration")){var f=y(l,"bpmn:Participant")?l:jS(l,"bpmn:Participant");a(u,f)}}),this.postExecute("shape.delete",function(s){var c=s.context,u=c.shape,l=e.getRootElement();Ce(u,["bpmn:Participant","bpmn:SubProcess"])&&y(l,"bpmn:Collaboration")&&o(l).filter(function(p){return $S(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){y(l,"bpmn:Process")&&a(f,l)})})}El.$inject=["canvas","commandStack","elementRegistry","eventBus"],ie(El,U);function $S(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 jS(e,t){for(;e.parent;){if(y(e.parent,t))return e.parent;e=e.parent}}var Ts=Math.max,Ms=Math.min,FS=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 HS(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 zS(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 ks(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return _e(r)&&(i=(/top|left/.test(e)?Ms:Ts)(i,r)),_e(o)&&(i=(/top|left/.test(e)?Ts:Ms)(i,o)),i}function VS(e,t){if(!t)return e;var n=de(e);return ds({top:ks("top",n,t),right:ks("right",n,t),bottom:ks("bottom",n,t),left:ks("left",n,t)})}function GS(e,t,n,i){var r=de(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?de(i):o,s={top:Ms(o.top,a.top),left:Ms(o.left,a.left),bottom:Ts(o.bottom,a.bottom),right:Ts(o.right,a.right)};return ds(s)}function Jo(e,t){return typeof e<"u"?e:FS}function WS(e,t){var n,i,r,o;return typeof t=="object"?(n=Jo(t.left),i=Jo(t.right),r=Jo(t.top),o=Jo(t.bottom)):n=i=r=o=Jo(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function US(e){return!(e.waypoints||e.type==="label")}function cm(e,t){var n;if(e.length===void 0?n=Te(e.children,US):n=e,n.length)return WS(St(n),t)}var Zi=Math.abs;function qS(e,t){return sm(de(t),de(e))}var YS=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],jn=30;function Ds(e,t){return t=t||[],e.children.filter(function(n){y(n,"bpmn:Lane")&&(Ds(n,t),t.push(n))}),t}function Qi(e){return e.children.filter(function(t){return y(t,"bpmn:Lane")})}function Fn(e){return ro(e,YS)||e}function KS(e,t){var n=Fn(e),i=y(n,"bpmn:Process")?[]:[n],r=Ds(n,i),o=de(e),a=de(t),s=qS(e,t),c=[],u=Ht(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=de(l);s.top&&(Zi(m.bottom-o.top)<10&&(d=a.top-m.bottom),Zi(m.top-o.top)<5&&(p=a.top-m.top)),s.left&&(Zi(m.right-o.left)<10&&(f=a.left-m.right),Zi(m.left-o.left)<5&&(h=a.left-m.left)),s.bottom&&(Zi(m.top-o.bottom)<10&&(p=a.bottom-m.top),Zi(m.bottom-o.bottom)<5&&(d=a.bottom-m.bottom)),s.right&&(Zi(m.left-o.right)<10&&(h=a.right-m.left),Zi(m.right-o.right)<5&&(f=a.right-m.right)),(p||f||d||h)&&c.push({shape:l,newBounds:zS(l,{top:p,right:f,bottom:d,left:h})})}}),c}var XS=500;function wl(e,t){U.call(this,e);function n(i,r){var o=Ht(i),a=Qi(r),s=[],c=[],u=[],l=[];if(Rr(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",XS,function(i){var r=i.context,o=r.hints,a=r.shape,s=r.oldParent;y(a,"bpmn:Lane")&&(o&&o.nested||n(a,s))})}wl.$inject=["eventBus","spaceTool"],ie(wl,U);var um=500;function Os(e,t){t.invoke(U,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",um,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return lm(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",um,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;lm(a,QS(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}Os.$inject=["bpmnReplace","injector"],ie(Os,U),Os.prototype._replaceShape=function(e){var t=ZS(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function ZS(e){var t=K(e),n=t.eventDefinitions;return n&&n[0]}function lm(e,t){return!Re(e)&&y(e,"bpmn:BoundaryEvent")&&!t}function QS(e,t){return e.indexOf(t)!==-1}var Ls=Math.round,JS=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 tR(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var pm=10;function nR(e,t){var n,i;for(n=0;i=e[n];n++)if(Vo(i,t)<=pm)return{point:e[n],bendpoint:!0,index:n};return null}function iR(e,t){var n=gh(eR(t,pm),tR(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=JS(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:Ls(i.x+r.x)/2,y:Ls(i.y+r.y)/2},index:i.segment2}:{point:{x:Ls(i.x),y:Ls(i.y)},index:i.segment2}:null}function Sl(e,t){return nR(e,t)||iR(e,t)}function Rl(e,t,n){U.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(),S;_e(a.width)?S=ve(a):S=a;var E=Sl(s,S);if(E){if(c=s.slice(0,E.index),u=s.slice(E.index+(E.bendpoint?1:0)),!c.length||!u.length)return;l=E.bendpoint?s[E.index]:S,(c.length===1||!fm(r,c[c.length-1]))&&c.push(dm(l)),(u.length===1||!fm(r,u[0]))&&u.unshift(dm(l))}p=o.source,f=o.target,t.canConnect(p,r,o)&&(n.reconnectEnd(o,r,c||S),d=o),t.canConnect(r,f,o)&&(d?h=n.connect(r,f,{type:o.type,waypoints:u}):(n.reconnectStart(o,r,u||S),h=o));var x=[].concat(d&&Te(g,function(b){return b.source===d.source})||[],h&&Te(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,s=r.delta,c=a[0];if(!(!c||!o)){o&&o.waypoints&&(r.newParent=o=o.parent);var u=ve(c),l={x:u.x+s.x,y:u.y+s.y},p=it(o.children,function(f){var d=t.canInsert(a,f);return d&&Sl(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(Rl,U),Rl.$inject=["eventBus","bpmnRules","modeling"];function fm(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 dm(e){return D({},e)}function Cl(e,t){U.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)&&ao(r)){var c=[];y(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(u=>u!==r&&ao(u)):c=a.incoming.filter(u=>u!==r&&ao(u)&&y(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(y(r,"bpmn:EventBasedGateway")){var o=r.outgoing.filter(ao).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(ao).forEach(function(s){const c=a.incoming.filter(ao).filter(function(u){return u.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}Cl.$inject=["eventBus","modeling"],ie(Cl,U);function ao(e){return y(e,"bpmn:SequenceFlow")}var Is=1500,hm=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"],Is,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;y(a,"bpmn:Lane")&&!Ce(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Fn(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||Ce(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"],Is,function(i){var r=i.hover;y(r,"bpmn:Lane")&&(i.hover=Fn(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Is,function(i){var r=i.context,o=i.hover,a=r.type;y(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Fn(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Is,function(i){var r=i.context,o=r.start;y(o,"bpmn:Lane")&&(r.start=Fn(o)||o)}),t.on("shape.move.start",hm,function(i){var r=i.shape;y(r,"bpmn:Lane")&&(i.shape=Fn(r)||r)}),t.on("spaceTool.move",hm,function(i){var r=i.hover;r&&y(r,"bpmn:Lane")&&(i.hover=Fn(r))})}mm.$inject=["elementRegistry","eventBus","canvas"];var gm=770;function Pl(e,t,n,i){n.invoke(U,this);function r(s,c){var u=K(s),l=c.categoryValue||u.categoryValueRef;l||(l=nm(e,u));var p=c.category||l.$parent||tm(e);u.categoryValueRef=l,l.$parent=p,c.categoryValue=l,c.category=p}function o(s,c){var u=K(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;y(u,"bpmn:Group")&&r(u,c)}),this.revert("label.create",function(s){var c=s.context,u=c.labelTarget;y(u,"bpmn:Group")&&o(u,c)}),this.execute("shape.delete",function(s){var c=s.context,u=c.shape,l=K(u);if(!(!y(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(!(!y(u,"bpmn:Group")||u.labelTarget)){var l=c.category,p=c.categoryValue,f=K(u);p&&(f.categoryValueRef=p,p.$parent=l)}}),this.execute("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!y(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!K(u).categoryValueRef&&!c.categoryValue||r(u,c)}),this.reverted("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!y(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!K(u).categoryValueRef&&!c.categoryValue||o(u,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!y(u,"bpmn:Group")||u.labelTarget||K(u).categoryValueRef||r(u,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!y(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",gm,function(s){var c=s.descriptor,u=s.element;if(!(!y(u,"bpmn:Group")||u.labelTarget)){var l=K(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",gm,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})}Pl.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],ie(Pl,U);function Al(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 vm(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=Al(i,r,o,a),u=Al(i,r,o,s),l;c&&u?ym(c,o)>ym(u,o)?l=u:l=c:l=c||u,i.original=l}function n(i){var r=i.waypoints;t(r[0],r[1],ve(i.source)),t(r[r.length-1],r[r.length-2],ve(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}vm.$inject=["eventBus"];function ym(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Tl(e){U.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=K(i),o=Be(i);if(Ce(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}Tl.$inject=["eventBus"],ie(Tl,U);function _m(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 rR(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 oR(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 Ml(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=oR([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 xm(e,t){var n=Ml(e,t),i={x:n.x-e.x,y:n.y-e.y};return _m(i)}function ea(e,t){return _m({x:e.x-t.x,y:e.y-t.y})}var Em=Math.sqrt,wm=Math.min,aR=Math.max,Sm=Math.abs;function Rm(e){return Math.pow(e,2)}function ta(e,t){return Em(Rm(e.x-t.x)+Rm(e.y-t.y))}function sR(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],Pm(i,r)?u=[i]:(o=ta(e,i),a=ta(e,r),c=wm(o,a),u=cR(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:Pm(i,u[0])?n:n+1}),u.length===2&&(s=lR(u[0],u[1]),l={type:"segment",position:s,segmentIndex:n,relativeLocation:ta(i,s)/ta(i,r)}),p=ta(l.position,e),(!d||f>p)&&(d=l,f=p)}return d}function cR(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=Em(d),m=-p+h,g=-p-h,S={x:e.x-r*m,y:e.y-o*m};if(d===0)return[S];var E={x:e.x-r*g,y:e.y-o*g};return[S,E].filter(function(x){return uR(x,e,t)})}function uR(e,t,n){return Cm(e.x,t.x,n.x)&&Cm(e.y,t.y,n.y)}function Cm(e,t,n){return e>=wm(t,n)-Ns&&e<=aR(t,n)+Ns}function lR(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Ns=.1;function Pm(e,t){return Sm(e.x-t.x)<=Ns&&Sm(e.y-t.y)<=Ns}function pR(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=Tm(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 Am(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=sR(e,n),c=s.segmentIndex,u=pR(n,t,s,i);if(u<0||u>t.length-2||u===null)return a;var l=Mm(n,c),p=Mm(t,u),f=s.position,d=dR(l,f),h=fR(l,p);if(s.type==="bendpoint"){var m=t.length-n.length,g=s.bendpointIndex,S=n[g];if(t.indexOf(S)!==-1)return a;if(m===0){var E=t[g];return r=E.x-s.position.x,o=E.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=Tm(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=rR({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:Ei(x),delta:Ei({x:r,y:o})}}function Tm(e,t){var n=ea(e[t-1],e[t]),i=ea(e[t],e[t+1]),r=n/(n+i);return r}function fR(e,t){var n=bm(e),i=bm(t);return i-n}function Mm(e,t){return[e[t],e[t+1]]}function dR(e,t){var n=ea(e[0],e[1]),i=ea(e[0],t);return n===0?0:i/n}function hR(e,t,n,i){var r=ve(e);return Am(r,t,n,i).delta}function na(e,t,n){var i=Zo(t),r=Zo(n),o=Qn(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return Ei({x:r.x+a.x,y:r.y+a.y})}function km(e,t,n){var i=Zo(e),r=Zo(t),o=Zo(n),a=Qn(e,i),s=Qn(i,r),c=mR(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 Ei({x:l.x+a.x-e.x,y:l.y+a.y-e.y})}function mR(e,t,n){var i=de(t),r=de(n);if(gR(i,r))return null;var o=Wt(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=Wt(n,s),c!==o?null:a}function gR(e,t){return vR(e,t)||yR(e,t)}function vR(e,t){return e.right!==t.right&&e.left!==t.left}function yR(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var Dm="name",Om="text";function kl(e,t,n,i){U.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{K(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var s=a.context,c=s.element,u=s.properties;if(Dm in u&&t.updateLabel(c,u[Dm]),Om in u&&y(c,"bpmn:TextAnnotation")){var l=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},u[Om]||"");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;Re(u)||!Xi(u)||Dn(u)&&t.updateLabel(u,Dn(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=D({},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),hR(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=K(c);l&&Xi(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(!(!Re(c)||u.autoResize)){var l=s.newBounds,p=i.getDimensions(Dn(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(_s(c)){var p=c.label,f=ve(p),d=xR(l),h=bR(f,d),m=_R(h,l,u);t.moveShape(p,m)}})}ie(kl,U),kl.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function _R(e,t,n){var i=na(e,t,n);return Ei(Qn(i,e))}function bR(e,t){if(t.length){var n=ER(e,t);return Ml(e,n)}}function xR(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 ER(e,t){var n=t.map(function(r){return{line:r,distance:xm(e,r)}}),i=ti(n,"distance");return i[0].line}function wR(e,t,n,i){return Am(e,t,n,i).point}function Dl(e,t){U.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=D({},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),wR(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(Dl,U),Dl.$inject=["eventBus","modeling"];function Bs(e,t,n){var i=js(e),r=Im(i,t),o=i[0];return r.length?r[r.length-1]:na(o.original||o,n,t)}function $s(e,t,n){var i=js(e),r=Im(i,t),o=i[i.length-1];return r.length?r[0]:na(o.original||o,n,t)}function Ol(e,t,n){var i=js(e),r=Lm(t,n),o=i[0];return na(o.original||o,r,t)}function Ll(e,t,n){var i=js(e),r=Lm(t,n),o=i[i.length-1];return na(o.original||o,r,t)}function Lm(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function js(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Im(e,t){var n=Zt(e,RR);return Te(n,function(i){return SR(i,t)})}function SR(e,t){return Wt(t,e,1)==="intersect"}function RR(e){return e.original||e}function Il(e,t){U.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(CR(i,r)){var o=PR(i);o.incoming.forEach(function(a){var s=$s(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=Bs(a,r,i);t.reconnectStart(a,r,s)})}},!0)}Il.$inject=["eventBus","modeling"],ie(Il,U);function CR(e,t){return y(e,"bpmn:Participant")&&Oe(e)&&y(t,"bpmn:Participant")&&!Oe(t)}function PR(e){var t=Ho([e]),n=[],i=[];return t.forEach(function(r){r!==e&&(r.incoming.forEach(function(o){y(o,"bpmn:MessageFlow")&&n.push(o)}),r.outgoing.forEach(function(o){y(o,"bpmn:MessageFlow")&&i.push(o)}))},[]),{incoming:n,outgoing:i}}const AR=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Nm(e){const t=K(e);if(!y(t,"bpmn:BoundaryEvent")&&!(y(t,"bpmn:StartEvent")&&tn(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:AR.some(i=>y(n[0],i))}function Bm(e){return y(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Nl(e,t){e.invoke(U,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!Nm(r))return;const a=Bm(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=K(i).get(a),u=K(r).get(a);c!==u&&t.updateProperties(r,{[a]:c})})}Nl.$inject=["injector","modeling"],ie(Nl,U);function Bl(e,t){U.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=Be(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}ie(Bl,U),Bl.$inject=["eventBus","modeling"];function $l(e,t,n){U.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(!(!y(o,"bpmn:SequenceFlow")||!y(a,"bpmn:SequenceFlow"))&&t.canConnect(o.source,a.target,o)){var s=TR(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}ie($l,U),$l.$inject=["eventBus","bpmnRules","modeling"];function so(e){return e.original||e}function TR(e,t){var n=Al(so(e[e.length-2]),so(e[e.length-1]),so(t[1]),so(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[so(e[0]),so(t[t.length-1])]}function jl(e,t){U.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,r=i.parent;y(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)}jl.$inject=["eventBus","modeling"],ie(jl,U);function Fl(e,t,n,i){U.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;y(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(u,l)||(d=!0),n.canConnectMessageFlow(u,l)&&(f="bpmn:MessageFlow")),y(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=it(p.outgoing,Wr({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(Fl,U),Fl.$inject=["eventBus","modeling","bpmnRules","injector"];function Fs(e,t,n,i,r,o){i.invoke(U,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=yn(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){tn(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(Fs,U),Fs.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)},Fs.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var MR=1500,kR={width:140,height:120},Hl={width:300,height:60},zl={width:60,height:300},Hs={width:300,height:150},zs={width:150,height:300},$m={width:140,height:120},jm={width:100,height:40};function Fm(e){e.on("resize.start",MR,function(t){var n=t.context,i=n.shape,r=n.direction,o=n.balanced;(y(i,"bpmn:Lane")||y(i,"bpmn:Participant"))&&(n.resizeConstraints=NR(i,r,o)),y(i,"bpmn:SubProcess")&&Oe(i)&&(n.minDimensions=$m),y(i,"bpmn:TextAnnotation")&&(n.minDimensions=jm)})}Fm.$inject=["eventBus"];var Ji=Math.abs,DR=Math.min,OR=Math.max;function Hm(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function co(e,t,n){return Hm(e,t,n,DR)}function uo(e,t,n){return Hm(e,t,n,OR)}var LR={top:20,left:50,right:20,bottom:20},IR={top:50,left:20,right:20,bottom:20};function NR(e,t,n){var i=Fn(e),r=!0,o=!0,a=Ds(i,[i]),s=de(e),c={},u={},l=Ht(e),p=l?Hl:zl;/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=de(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&&Ji(s.top-m.bottom)<10&&uo(c,"top",m.top+p.height),Ji(s.top-m.top)<5&&co(u,"top",m.bottom-p.height)),/e/.test(t)&&(n&&Ji(s.right-m.left)<10&&co(c,"right",m.right-p.width),Ji(s.right-m.right)<5&&uo(u,"right",m.left+p.width)),/s/.test(t)&&(n&&Ji(s.bottom-m.top)<10&&co(c,"bottom",m.bottom-p.height),Ji(s.bottom-m.bottom)<5&&uo(u,"bottom",m.top+p.height)),/w/.test(t)&&(n&&Ji(s.left-m.right)<10&&uo(c,"left",m.left+p.width),Ji(s.left-m.left)<5&&co(u,"left",m.right-p.width))});var f=i.children.filter(function(h){return!h.hidden&&!h.waypoints&&(y(h,"bpmn:FlowElement")||y(h,"bpmn:Artifact"))}),d=l?LR:IR;return f.forEach(function(h){var m=de(h);/n/.test(t)&&(!l||r)&&co(u,"top",m.top-d.top),/e/.test(t)&&(l||o)&&uo(u,"right",m.right+d.right),/s/.test(t)&&(!l||o)&&uo(u,"bottom",m.bottom+d.bottom),/w/.test(t)&&(l||r)&&co(u,"left",m.left-d.left)}),{min:u,max:c}}function zm(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function lo(e){return e.originalEvent||e.srcEvent}function Vl(e){zm(e),zm(lo(e))}function Tr(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 Vm(){return/mac/i.test(navigator.platform)}function Gm(e,t){return(lo(e)||e).button===t}function er(e){return Gm(e,0)}function BR(e){return Gm(e,1)}function ia(e){var t=lo(e)||e;return er(e)?Vm()?t.metaKey:t.ctrlKey:!1}function Vs(e){var t=lo(e)||e;return er(e)&&t.shiftKey}var Wm=1001;function Um(e,t){e.on("resize.start",Wm+500,function(n){var i=n.context,r=i.shape;(y(r,"bpmn:Lane")||y(r,"bpmn:Participant"))&&(i.balanced=!ia(n))}),e.on("resize.end",Wm,function(n){var i=n.context,r=i.shape,o=i.canExecute,a=i.newBounds;if(y(r,"bpmn:Lane")||y(r,"bpmn:Participant"))return o&&(a=xh(a),t.resizeLane(r,a,i.balanced)),!1})}Um.$inject=["eventBus","modeling"];var $R=500;function Gl(e,t,n,i,r){n.invoke(U,this);function o(l){return Ce(l,["bpmn:ReceiveTask","bpmn:SendTask"])||jR(l,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(l){var p=e.getDefinitions(),f=p.get("rootElements");return!!it(f,Wr({id:l.id}))}function s(l){if(y(l,"bpmn:ErrorEventDefinition"))return"errorRef";if(y(l,"bpmn:EscalationEventDefinition"))return"escalationRef";if(y(l,"bpmn:MessageEventDefinition"))return"messageRef";if(y(l,"bpmn:SignalEventDefinition"))return"signalRef"}function c(l){if(Ce(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(Ce(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=K(p),d=c(f),h;d&&!a(d)&&(h=e.getDefinitions().get("rootElements"),bt(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");gt(f,p)}},!0),t.on("copyPaste.copyElement",function(l){var p=l.descriptor,f=l.element;if(!(f.labelTarget||!o(f))){var d=K(f),h=c(d);h&&(p.referencedRootElement=h)}}),t.on("copyPaste.pasteElement",$R,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)})}Gl.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],ie(Gl,U);function jR(e,t){return ge(t)||(t=[t]),Ni(t,function(n){return to(e,n)})}var qm=Math.max;function Ym(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;y(a,"bpmn:Participant")&&(o[s]=HR(a,i,r)),y(a,"bpmn:Lane")&&(o[s]=Ht(a)?Hl:zl),y(a,"bpmn:SubProcess")&&Oe(a)&&(o[s]=$m),y(a,"bpmn:TextAnnotation")&&(o[s]=jm),y(a,"bpmn:Group")&&(o[s]=kR)}),o})}Ym.$inject=["eventBus"];function FR(e){return e==="x"}function HR(e,t,n){var i=Ht(e);if(!GR(e))return i?Hs:zs;var r=FR(t),o={};return r?i?o=Hs:o={width:VR(e,n,r),height:zs.height}:i?o={width:Hs.width,height:zR(e,n,r)}:o=zs,o}function zR(e,t,n){var i;return i=WR(e,t,n),qm(Hs.height,i)}function VR(e,t,n){var i;return i=UR(e,t,n),qm(zs.width,i)}function GR(e){return!!Qi(e).length}function WR(e,t,n){var i=Qi(e),r;return r=Wl(i,t,n),e.height-r.height+Hl.height}function UR(e,t,n){var i=Qi(e),r;return r=Wl(i,t,n),e.width-r.width+zl.width}function Wl(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=Qi(r),o.length?Wl(o,t,n):r}var Km="_plane";function Xm(e){var t=e.id;return qR(t)}function pi(e){var t=e.id;return y(e,"bpmn:SubProcess")?Zm(t):t}function Mr(e){return Zm(e)}function Gs(e){var t=Be(e);return y(t,"bpmndi:BPMNPlane")}function Zm(e){return e+Km}function qR(e){return e.replace(new RegExp(Km+"$"),"")}var Qm=400,YR=600,Jm={x:180,y:160};function Ci(e,t,n,i,r,o,a){U.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 y(p,"bpmn:SubProcess")&&!Oe(p)}function u(p){var f=p.shape,d=p.newRootElement,h=K(f);d=s._addDiagram(d||h),p.newRootElement=e.addRootElement(d)}function l(p){var f=p.shape,d=K(f);s._removeDiagram(d);var h=p.newRootElement=a.get(pi(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(pi(d));if(!(!h||!d.children||!d.children.length)){var m=eg(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;!y(f,"bpmn:SubProcess")||!Oe(f)||M(qo([f]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(p){var f=p.shape;if(c(f)){var d=a.get(pi(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(pi(f)))},!0),this.postExecuted("shape.replace",function(p){var f=p.newShape,d=p.oldRoot,h=e.findRoot(pi(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(y(f,"bpmn:SubProcess")){var d=p.properties,h=p.oldProperties,m=h.id,g=d.id;if(m!==g){if(Gs(f)){a.updateId(f,Mr(g)),a.updateId(m,g);return}var S=a.get(Mr(m));S&&a.updateId(Mr(m),Mr(g))}}},!0),this.reverted("element.updateProperties",function(p){var f=p.element;if(y(f,"bpmn:SubProcess")){var d=p.properties,h=p.oldProperties,m=h.id,g=d.id;if(m!==g){if(Gs(f)){a.updateId(f,Mr(m)),a.updateId(g,m);return}var S=a.get(Mr(g));S&&a.updateId(S,Mr(m))}}},!0),t.on("element.changed",function(p){var f=p.element;if(Gs(f)){var d=f,h=a.get(Xm(d));!h||h===d||t.fire("element.changed",{element:h})}}),this.executed("shape.toggleCollapse",Qm,function(p){var f=p.shape;y(f,"bpmn:SubProcess")&&(Oe(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",Qm,function(p){var f=p.shape;y(f,"bpmn:SubProcess")&&(Oe(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",YR,function(p){var f=p.shape;if(y(f,"bpmn:SubProcess")){var d=p.newRootElement;if(d)if(Oe(f))s._moveChildrenToShape(d.children.slice(),f),M(qo(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=eg(f);s._moveChildrenToShape(h,d)}}},!0),t.on("copyPaste.createTree",function(p){var f=p.element,d=p.children;if(c(f)){var h=pi(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=y(Be(m),"bpmndi:BPMNPlane");if(g){var S=Xm(m),E=it(h,function(x){return x.id===S});E&&(f.parent=E.id)}}),t.on("copyPaste.pasteElement",function(p){var f=p.descriptor;f.parent&&(c(f.parent)||f.parent.hidden)&&(f.hidden=!0)})}ie(Ci,U),Ci.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=St(i),o;if(!t.x)o={x:Jm.x-r.x,y:Jm.y-r.y};else{var a=ve(t),s=ve(r);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}},Ci.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(Gh(e).map(i=>i.annotation));n.size&&M(qo(e.children),i=>{n.has(i.annotation)&&M(i.associations,r=>{t.removeConnection(r)})})},Ci.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},Ci.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},Ci.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:pi(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},Ci.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=it(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},Ci.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function KR(e){var t=[];return M(qo(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function eg(e){return e.children.slice().concat(KR(e.children)).concat(XR(e))}function XR(e){return Xu(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function Ul(e,t){e.invoke(U,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,r=n.context.newShape;if(!(!y(r,"bpmn:SubProcess")||y(r,"bpmn:AdHocSubProcess")||!(y(i,"bpmn:Task")||y(i,"bpmn:CallActivity"))||!Oe(r))){var o=ZR(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}Ul.$inject=["injector","modeling"],ie(Ul,U);function ZR(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function ql(e,t){U.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;y(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&&y(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(!(!y(r,"bpmn:TextAnnotation")||o.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,Dn(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(ql,U),ql.$inject=["eventBus","textRenderer"];function Yl(e,t){U.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(Oe(i))return;var r=Ho(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||y(a,"bpmn:Association")&&(y(a.source,"bpmn:TextAnnotation")||y(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,ve(i)):t.reconnectStart(a,i,ve(i)))}},!0)}ie(Yl,U),Yl.$inject=["eventBus","modeling"];var Kl=500;function Xl(e,t,n){U.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=QR(c).concat([a]),p=cm(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"],Kl,function(a){var s=a.context,c=s.shape;y(c,"bpmn:SubProcess")&&(c.collapsed?Be(c).isExpanded=!1:(i(c.children),Be(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],Kl,function(a){var s=a.context,c=s.shape;c.collapsed?Be(c).isExpanded=!1:Be(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],Kl,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(Xl,U),Xl.$inject=["eventBus","elementFactory","modeling"];function QR(e){return e.filter(function(t){return!t.hidden})}function Zl(e,t,n,i){t.invoke(U,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;Re(a)||(y(a,"bpmn:Participant")&&Oe(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;y(r,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}ie(Zl,U),Zl.$inject=["canvas","injector","moddle","modeling"];function Ql(e,t){U.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;JR(r,o)&&t.updateProperties(o,{default:null})})}ie(Ql,U),Ql.$inject=["eventBus","modeling"];function JR(e,t){if(!y(e,"bpmn:SequenceFlow"))return!1;var n=K(t),i=K(e);return n.get("default")===i}var eC=500,tC=5e3,tg=["shape.create","shape.delete","shape.move","shape.resize"],ng=[...tg,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function Jl(e,t){U.call(this,e);var n;function i(){return n=n||new nC,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(ng,tC,function(){i()}),this.postExecuted(ng,eC,function(){o()}),this.preExecute(tg,function(a){var s=a.context,c=s.shape,u=r();!c||c.labelTarget||(y(c,"bpmn:Lane")&&u.addLane(c),y(c,"bpmn:FlowNode")&&u.addFlowNode(c))})}Jl.$inject=["eventBus","modeling"],ie(Jl,U);function nC(){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 iC=500,rC=5e3,ig=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],rg=[...ig,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function ep(e,t){U.call(this,e);var n;function i(){return n=n||new oC,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(rg,rC,function(){i()}),this.postExecuted(rg,iC,function(){o()}),this.preExecute(ig,function(a){var s=a.context.connection||a.context.shape,c=r();!s||s.labelTarget||(y(s,"bpmn:FlowElement")&&c.addFlowElement(s),y(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;y(s,"bpmn:Group")&&r().addGroup(s)})}ep.$inject=["eventBus","modeling"],ie(ep,U);function oC(){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 tp(e,t){U.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)aC(o)&&!cC(o)&&t.updateProperties(o,{isForCompensation:void 0})})}ie(tp,U),tp.$inject=["eventBus","modeling"];function aC(e){const t=K(e);return t&&t.isForCompensation}function sC(e){return e&&y(e,"bpmn:BoundaryEvent")&&to(e,"bpmn:CompensateEventDefinition")}function cC(e){return e.incoming.filter(n=>sC(n.source)).length>0}const uC={__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",ul],appendBehavior:["type",ll],associationBehavior:["type",fl],attachEventBehavior:["type",Rs],artifactBehavior:["type",pl],boundaryEventBehavior:["type",dl],categoryRootElementReferenceBehavior:["type",hl],compensateBoundaryEventBehaviour:["type",ml],createBehavior:["type",gl],createDataObjectBehavior:["type",vl],createParticipantBehavior:["type",bl],dataInputAssociationBehavior:["type",xl],dataStoreBehavior:["type",El],deleteLaneBehavior:["type",wl],detachEventBehavior:["type",Os],dropOnFlowBehavior:["type",Rl],eventBasedGatewayBehavior:["type",Cl],fixHoverBehavior:["type",mm],groupBehavior:["type",Pl],importDockingFix:["type",vm],isHorizontalFix:["type",Tl],labelBehavior:["type",kl],layoutConnectionBehavior:["type",Dl],messageFlowBehavior:["type",Il],nonInterruptingBehavior:["type",Nl],removeElementBehavior:["type",$l],removeEmbeddedLabelBoundsBehavior:["type",Bl],removeParticipantBehavior:["type",jl],replaceConnectionBehavior:["type",Fl],replaceElementBehaviour:["type",Fs],resizeBehavior:["type",Fm],resizeLaneBehavior:["type",Um],rootElementReferenceBehavior:["type",Gl],spaceToolBehavior:["type",Ym],subProcessPlaneBehavior:["type",Ci],subProcessStartEventBehavior:["type",Ul],textAnnotationBehavior:["type",ql],toggleCollapseConnectionBehaviour:["type",Yl],toggleElementCollapseBehaviour:["type",Xl],unclaimIdBehavior:["type",Zl],unsetDefaultFlowBehavior:["type",Ql],updateFlowNodeRefsBehavior:["type",Jl],updateCategoryValueRefsBehavior:["type",ep],setCompensationActivityAfterPasteBehavior:["type",tp]};function np(e){this._commandStack=e.get("commandStack",!1)}np.$inject=["injector"],np.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const fi={__init__:["rules"],rules:["type",np]};function Hn(e){U.call(this,e),this.init()}Hn.$inject=["eventBus"],ie(Hn,U),Hn.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)})},Hn.prototype.init=function(){};function og(e,t){var n=Wt(e,t,-15);return n!=="intersect"?n:null}function qt(e){Hn.call(this,e)}ie(qt,Hn),qt.$inject=["eventBus"],qt.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return lC(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 Us(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return Us(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 yg(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return Qe(i)&&!qs(t,i)?!1:yr(t,function(r){return Qe(r)?Us(r.source,r.target,r):r.host?ra(r,r.host,null,n):ap(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 fg(a)&&!n.includes(a.host)})?!1:ra(n,t,null,i)||gg(n,t,i)||vg(n,t)||qs(n,t)}),this.addRule("shape.create",function(e){return ap(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return ra(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return wg(n,t)})},qt.prototype.canConnectMessageFlow=xg,qt.prototype.canConnectSequenceFlow=Eg,qt.prototype.canConnectDataAssociation=sp,qt.prototype.canConnectAssociation=_g,qt.prototype.canConnectCompensationAssociation=bg,qt.prototype.canMove=vg,qt.prototype.canAttach=ra,qt.prototype.canReplace=gg,qt.prototype.canDrop=po,qt.prototype.canInsert=qs,qt.prototype.canCreate=ap,qt.prototype.canConnect=Us,qt.prototype.canResize=yg,qt.prototype.canCopy=wg;function lC(e){return ip(e)?null:Ce(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function ip(e){return!e||Re(e)}function ag(e){do{if(y(e,"bpmn:Process"))return K(e);if(y(e,"bpmn:Participant"))return K(e).processRef||K(e)}while(e=e.parent)}function rp(e){return y(e,"bpmn:TextAnnotation")}function op(e){return y(e,"bpmn:Group")&&!e.labelTarget}function sg(e){return y(e,"bpmn:BoundaryEvent")&&di(e,"bpmn:CompensateEventDefinition")}function Ws(e){return K(e).isForCompensation}function pC(e,t){var n=ag(e),i=ag(t);return n===i}function fC(e){return y(e,"bpmn:InteractionNode")&&!y(e,"bpmn:BoundaryEvent")&&(!y(e,"bpmn:Event")||y(e,"bpmn:ThrowEvent")&&lg(e,"bpmn:MessageEventDefinition"))}function dC(e){return y(e,"bpmn:InteractionNode")&&!Ws(e)&&(!y(e,"bpmn:Event")||y(e,"bpmn:CatchEvent")&&lg(e,"bpmn:MessageEventDefinition"))&&!(y(e,"bpmn:BoundaryEvent")&&!di(e,"bpmn:MessageEventDefinition"))}function cg(e){for(var t=e;t=t.parent;){if(y(t,"bpmn:FlowElementsContainer"))return K(t);if(y(t,"bpmn:Participant"))return K(t).processRef}return null}function ug(e,t){var n=cg(e),i=cg(t);return n===i}function di(e,t){var n=K(e);return!!it(n.eventDefinitions||[],function(i){return y(i,t)})}function lg(e,t){var n=K(e);return(n.eventDefinitions||[]).every(function(i){return y(i,t)})}function hC(e){return y(e,"bpmn:FlowNode")&&!y(e,"bpmn:EndEvent")&&!tn(e)&&!(y(e,"bpmn:IntermediateThrowEvent")&&di(e,"bpmn:LinkEventDefinition"))&&!sg(e)&&!Ws(e)}function mC(e){return y(e,"bpmn:FlowNode")&&!y(e,"bpmn:StartEvent")&&!y(e,"bpmn:BoundaryEvent")&&!tn(e)&&!(y(e,"bpmn:IntermediateCatchEvent")&&di(e,"bpmn:LinkEventDefinition"))&&!Ws(e)}function gC(e){return y(e,"bpmn:ReceiveTask")||y(e,"bpmn:IntermediateCatchEvent")&&(di(e,"bpmn:MessageEventDefinition")||di(e,"bpmn:TimerEventDefinition")||di(e,"bpmn:ConditionalEventDefinition")||di(e,"bpmn:SignalEventDefinition"))}function vC(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function pg(e,t){var n=vC(t);return n.indexOf(e)!==-1}function Us(e,t,n){if(ip(e)||ip(t))return null;if(!y(n,"bpmn:DataAssociation")){if(xg(e,t))return{type:"bpmn:MessageFlow"};if(Eg(e,t))return{type:"bpmn:SequenceFlow"}}var i=sp(e,t);return i||(bg(e,t)?{type:"bpmn:Association",associationDirection:"One"}:_g(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function po(e,t){return Re(e)||op(e)?!0:y(t,"bpmn:Participant")&&!Oe(t)?!1:y(e,"bpmn:Participant")?y(t,"bpmn:Process")||y(t,"bpmn:Collaboration"):Ce(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:y(e,"bpmn:Lane")?y(t,"bpmn:Participant")||y(t,"bpmn:Lane"):y(e,"bpmn:BoundaryEvent")&&!yC(e)?!1:y(e,"bpmn:FlowElement")&&!y(e,"bpmn:DataStoreReference")?y(t,"bpmn:FlowElementsContainer")?Oe(t):Ce(t,["bpmn:Participant","bpmn:Lane"]):y(e,"bpmn:DataStoreReference")&&y(t,"bpmn:Collaboration")?Ni(K(t).get("participants"),function(n){return!!n.get("processRef")}):Ce(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?Ce(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):y(e,"bpmn:MessageFlow")?y(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function yC(e){return K(e).cancelActivity&&(dg(e)||hg(e))}function fg(e){return!Re(e)&&y(e,"bpmn:BoundaryEvent")}function _C(e){return y(e,"bpmn:Lane")}function bC(e){return fg(e)||y(e,"bpmn:IntermediateThrowEvent")&&dg(e)?!0:y(e,"bpmn:IntermediateCatchEvent")&&hg(e)}function dg(e){var t=K(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function hg(e){return mg(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function mg(e,t){return t.some(function(n){return di(e,n)})}function xC(e){return y(e,"bpmn:ReceiveTask")&&it(e.incoming,function(t){return y(t.source,"bpmn:EventBasedGateway")})}function ra(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return Re(r)||!bC(r)||tn(t)||!y(t,"bpmn:Activity")||Ws(t)||i&&!og(i,t)||xC(t)?!1:"attach"}function gg(e,t,n){if(!t)return!1;var i={replacements:[]};return M(e,function(r){tn(t)||y(r,"bpmn:StartEvent")&&r.type!=="label"&&po(r,t)&&(M1(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(k1(r)||D1(r)||O1(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),mg(r,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&y(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"})),y(t,"bpmn:Transaction")||di(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(y(r,"bpmn:EndEvent")&&po(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),y(r,"bpmn:BoundaryEvent")&&ra(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function vg(e,t){return Ni(e,_C)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return po(n,t)})}function ap(e,t,n,i){return t?Re(e)||op(e)?!0:po(e,t)||qs(e,t):!1}function yg(e,t,n){return y(e,"bpmn:SubProcess")?Oe(e)&&(!t||t.width>=100&&t.height>=80):y(e,"bpmn:Lane")||y(e,"bpmn:Participant")?!0:rp(e)?n?n==="e"||n==="w":!0:op(e)?!0:Re(e)?n?n==="e"||n==="w":!0:!1}function EC(e,t){var n=rp(e),i=rp(t);return(n||i)&&n!==i}function _g(e,t){return pg(t,e)||pg(e,t)?!1:EC(e,t)?!0:!!sp(e,t)}function bg(e,t){return ug(e,t)&&sg(e)&&y(t,"bpmn:Activity")&&!SC(t,e)&&!tn(t)}function xg(e,t){return Rg(e)&&!Rg(t)?!1:fC(e)&&dC(t)&&!pC(e,t)}function Eg(e,t){return hC(e)&&mC(t)&&ug(e,t)&&!(y(e,"bpmn:EventBasedGateway")&&!gC(t))}function sp(e,t){return Ce(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Ce(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:Ce(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Ce(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function qs(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:Ce(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!Re(t)&&y(e,"bpmn:FlowNode")&&!y(e,"bpmn:BoundaryEvent")&&po(e,t.parent)}function cp(e,t){return e&&t&&e.indexOf(t)!==-1}function wg(e,t){return Re(t)?!0:!(y(t,"bpmn:Lane")&&!cp(e,t.parent)||y(t,"bpmn:MessageFlow")&&!wC(e,t))}function wC(e,t){var n=Sg(t.source),i=Sg(t.target);return cp(e,n)&&cp(e,i)}function Sg(e){for(;e;e=e.parent)if(y(e,"bpmn:Participant"))return e;return null}function Rg(e){return ro(e,"bpmn:Process")||ro(e,"bpmn:Collaboration")}function SC(e,t){return e.attachers.includes(t)}const RC={__depends__:[fi],__init__:["bpmnRules"],bpmnRules:["type",qt]};var CC=2e3;function Cg(e,t){e.on("saveXML.start",CC,n);function n(){var i=t.getRootElements();M(i,function(r){var o=Be(r),a,s;a=Ho([r]),a=Te(a,function(c){return c!==r&&!c.labelTarget}),s=Zt(a,Be),o.set("planeElement",s)})}}Cg.$inject=["eventBus","canvas"];const PC={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Cg]};function Ys(e){U.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)})}Ys.prototype.getOrdering=function(e,t){return null},ie(Ys,U);function up(e,t){Ys.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=it(n,function(c){return Ce(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&&!Ce(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||y(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=Nf(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}}}up.$inject=["eventBus","canvas"],ie(up,Ys);const AC={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",up]};function oa(){}oa.prototype.get=function(){return this._data},oa.prototype.set=function(e){this._data=e},oa.prototype.clear=function(){var e=this._data;return delete this._data,e},oa.prototype.isEmpty=function(){return!this._data};const TC={clipboard:["type",oa]};var Pg=1500;function Ag(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",Pg,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",Pg,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=Tr(a),c=document.elementFromPoint(s.x,s.y),MC(c)}}Ag.$inject=["elementRegistry","eventBus","injector"];function MC(e){return wr(e,"svg, .djs-element",!0)}const kC={__init__:["hoverFix"],hoverFix:["type",Ag]};function DC(e){return!0}function Ks(e){return er(e)||BR(e)}var Tg=500;function Mg(e,t,n){var i=this;function r(P,j,F){if(!s(P,j)){var I,H,ae;F?H=t.getGraphics(F):(I=j.delegateTarget||j.target,I&&(H=I,F=t.get(H))),!(!H||!F)&&(ae=e.fire(P,{element:F,gfx:H,originalEvent:j}),ae===!1&&(j.stopPropagation(),j.preventDefault()))}}var o={};function a(P){return o[P]}function s(P,j){var F=u[P]||er;return!F(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":DC,"element.mousedown":Ks,"element.mouseup":Ks,"element.click":Ks,"element.dblclick":Ks};function l(P,j,F){var I=c[P];if(!I)throw new Error("unmapped DOM event name <"+P+">");return r(I,j,F)}var p="svg, .djs-element";function f(P,j,F,I){var H=o[F]=function(ae){r(F,ae)};I&&(u[F]=I),H.$delegate=bn.bind(P,p,j,H)}function d(P,j,F){var I=a(F);I&&bn.unbind(P,j,I.$delegate)}function h(P){M(c,function(j,F){f(P,F,j)})}function m(P){M(c,function(j,F){d(P,F,j)})}e.on("canvas.destroy",function(P){m(P.svg)}),e.on("canvas.init",function(P){h(P.svg)}),e.on(["shape.added","connection.added"],function(P){var j=P.element,F=P.gfx;e.fire("interactionEvents.createHit",{element:j,gfx:F})}),e.on(["shape.changed","connection.changed"],Tg,function(P){var j=P.element,F=P.gfx;e.fire("interactionEvents.updateHit",{element:j,gfx:F})}),e.on("interactionEvents.createHit",Tg,function(P){var j=P.element,F=P.gfx;i.createDefaultHit(j,F)}),e.on("interactionEvents.updateHit",function(P){var j=P.element,F=P.gfx;i.updateDefaultHit(j,F)});var g=w("djs-hit djs-hit-stroke"),S=w("djs-hit djs-hit-click-stroke"),E=w("djs-hit djs-hit-all"),x=w("djs-hit djs-hit-no-move"),b={all:E,"click-stroke":S,stroke:g,"no-move":x};function w(P,j){return j=D({stroke:"white",strokeWidth:15},j||{}),n.cls(P,["no-fill","no-border"],j)}function T(P,j){var F=b[j];if(!F)throw new Error("invalid hit type <"+j+">");return re(P,F),P}function O(P,j){xe(P,j)}this.removeHits=function(P){var j=as(".djs-hit",P);M(j,It)},this.createDefaultHit=function(P,j){var F=P.waypoints,I=P.isFrame,H;return F?this.createWaypointsHit(j,F):(H=I?"stroke":"all",this.createBoxHit(j,H,{width:P.width,height:P.height}))},this.createWaypointsHit=function(P,j){var F=Fo(j);return T(F,"stroke"),O(P,F),F},this.createBoxHit=function(P,j,F){F=D({x:0,y:0},F);var I=pe("rect");return T(I,j),re(I,F),O(P,I),I},this.updateDefaultHit=function(P,j){var F=Xe(".djs-hit",j);if(F)return P.waypoints?Ku(F,P.waypoints):re(F,{width:P.width,height:P.height}),F},this.fire=r,this.triggerMouseEvent=l,this.mouseHandler=a,this.registerEvent=f,this.unregisterEvent=d}Mg.$inject=["eventBus","elementRegistry","styles"];const Xs={__init__:["interactionEvents"],interactionEvents:["type",Mg]};function fo(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)})}fo.$inject=["eventBus","canvas"],fo.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()})}},fo.prototype.get=function(){return Array.from(this._selectedElements)},fo.prototype.isSelected=function(e){return this._selectedElements.has(e)},fo.prototype.select=function(e,t){var n=this.get();ge(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 kg="hover",Dg="selected";function Og(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,kg)}),t.on("element.out",function(r){i(r.element,kg)}),t.on("selection.changed",function(r){function o(u){i(u,Dg)}function a(u){n(u,Dg)}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)})}Og.$inject=["canvas","eventBus"];function Lg(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;ge(u)?t.select(u):t.select(s.filter(OC))}}),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=it(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(er(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=Vs(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}Lg.$inject=["eventBus","selection","canvas","elementRegistry"];function OC(e){return!e.hidden}const zn={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Xs],selection:["type",fo],selectionVisuals:["type",Og],selectionBehavior:["type",Lg]};var LC=/^djs-cursor-.*$/;function Zs(e){var t=lt(document.body);t.removeMatching(LC),e&&t.add("djs-cursor-"+e)}function Ig(){Zs(null)}var IC=5e3;function Ng(e,t){t=t||"element.click";function n(){return!1}return e.once(t,IC,n),function(){e.off(t,n)}}var NC=["c","C"],BC=["v","V"],$C=["d","D"],jC=["x","X"],FC=["y","Y"],Bg=["z","Z"];function HC(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function wn(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function Nt(e,t){return e=ge(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function lp(e){return e.shiftKey}function zC(e){return wn(e)&&Nt(NC,e)}function VC(e){return wn(e)&&Nt(BC,e)}function GC(e){return wn(e)&&Nt($C,e)}function WC(e){return wn(e)&&Nt(jC,e)}function UC(e){return wn(e)&&!lp(e)&&Nt(Bg,e)}function qC(e){return wn(e)&&(Nt(FC,e)||Nt(Bg,e)&&lp(e))}var ho=Math.round,$g="djs-drag-active";function kr(e){e.preventDefault()}function YC(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function KC(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function jg(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(x){var b=t.viewbox(),w=t._container.getBoundingClientRect();return{x:b.x+(x.x-w.left)/b.scale,y:b.y+(x.y-w.top)/b.scale}}function s(x,b){b=b||o;var w=e.createEvent(D({},b.payload,b.data,{isTouch:b.isTouch}));return e.fire("drag."+x,w)===!1?!1:e.fire(b.prefix+"."+x,w)}function c(x){var b=x.filter(function(w){return i.get(w.id)});b.length&&n.select(b)}function u(x,b){var w=o.payload,T=o.displacement,O=o.globalStart,P=Tr(x),j=Qn(P,O),F=o.localStart,I=a(P),H=Qn(I,F);if(!o.active&&(b||KC(j)>o.threshold)){if(D(w,{x:ho(F.x+T.x),y:ho(F.y+T.y),dx:0,dy:0},{originalEvent:x}),s("start")===!1)return g();o.active=!0,o.keepSelection||(w.previousSelection=n.get(),n.select(null)),o.cursor&&Zs(o.cursor),t.addMarker(t.getRootElement(),$g)}Vl(x),o.active&&(D(w,{x:ho(I.x+T.x),y:ho(I.y+T.y),dx:ho(H.x),dy:ho(H.y)},{originalEvent:x}),s("move"))}function l(x){var b,w=!0;o.active&&(x&&(o.payload.originalEvent=x,Vl(x)),w=s("end")),w===!1&&s("rejected"),b=S(w!==!0),s("ended",b)}function p(x){Nt("Escape",x)&&(kr(x),g())}function f(x){var b;o.active&&(b=Ng(e),setTimeout(b,400),kr(x)),l(x)}function d(x){u(x)}function h(x){var b=o.payload;b.hoverGfx=x.gfx,b.hover=x.element,s("hover")}function m(x){s("out");var b=o.payload;b.hoverGfx=null,b.hover=null}function g(x){var b;if(o){var w=o.active;w&&s("cancel"),b=S(x),w&&s("canceled",b)}}function S(x){var b,w;s("cleanup"),Ig(),o.trapClick?w=f:w=l,be.unbind(document,"mousemove",u),be.unbind(document,"dragstart",kr),be.unbind(document,"selectstart",kr),be.unbind(document,"mousedown",w,!0),be.unbind(document,"mouseup",w,!0),be.unbind(document,"keyup",p),be.unbind(document,"touchstart",d,!0),be.unbind(document,"touchcancel",g,!0),be.unbind(document,"touchmove",u,!0),be.unbind(document,"touchend",l,!0),e.off("element.hover",h),e.off("element.out",m),t.removeMarker(t.getRootElement(),$g);var T=o.payload.previousSelection;return x!==!1&&T&&!n.get().length&&c(T),b=o,o=null,b}function E(x,b,w,T){o&&g(!1),typeof b=="string"&&(T=w,w=b,b=null),T=D({},r,T||{});var O=T.data||{},P,j,F,I,H;if(T.trapClick?I=f:I=l,x?(P=lo(x)||x,j=Tr(x),Vl(x),P.type==="dragstart"&&kr(P)):(P=null,j={x:0,y:0}),F=a(j),b||(b=F),H=YC(P),o=D({prefix:w,data:O,payload:{},globalStart:j,displacement:Qn(b,F),localStart:F,isTouch:H},T),T.manual||(H?(be.bind(document,"touchstart",d,!0),be.bind(document,"touchcancel",g,!0),be.bind(document,"touchmove",u,!0),be.bind(document,"touchend",l,!0)):(be.bind(document,"mousemove",u),be.bind(document,"dragstart",kr),be.bind(document,"selectstart",kr),be.bind(document,"mousedown",I,!0),be.bind(document,"mouseup",I,!0)),be.bind(document,"keyup",p),e.on("element.hover",h),e.on("element.out",m)),s("init")===!1)return g(),!1;T.autoActivate&&u(x,!0)}e.on("diagram.destroy",g),this.init=E,this.move=u,this.hover=h,this.out=m,this.end=l,this.cancel=g,this.context=function(){return o},this.setOptions=function(x){D(r,x)}}jg.$inject=["eventBus","canvas","selection","elementRegistry"];const Pi={__depends__:[kC,zn],dragging:["type",jg]};function mo(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}mo.prototype.next=function(){return this._prefix+ ++this._counter};const XC=new mo("ps");var ZC=["marker-start","marker-mid","marker-end"],QC=["circle","ellipse","line","path","polygon","polyline","path","rect"];function tr(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}tr.$inject=["elementRegistry","eventBus","canvas","styles"],tr.prototype.cleanUp=function(){console.warn("PreviewSupport#cleanUp is deprecated and will be removed in future versions. You do not need to manually clean up previews anymore. cf. https://github.com/bpmn-io/diagram-js/pull/906")},tr.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},tr.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=Qd(n);return this._cloneMarkers(Cr(r),i),re(r,this._styles.cls(i,[])),xe(t,r),re(r,"data-preview-support-element-id",e.id),r},tr.prototype.addFrame=function(e,t){var n=pe("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return xe(t,n),re(n,"data-preview-support-element-id",e.id),n},tr.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),nP(e)&&ZC.forEach(function(r){if(re(e,r)){var o=JC(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},tr.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,XC.next()].join("-"),a=Xe("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||Qd(n);s.id=o,Le(s).add(r);var c=Xe(":scope > defs",e);c||(c=pe("defs"),xe(e,c)),xe(c,s);var u=tP(s.id);re(t,i,u)};function JC(e,t,n){var i=eP(re(e,t));return Xe("marker#"+i,n||document)}function eP(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function tP(e){return"url(#"+e+")"}function nP(e){return QC.indexOf(e.nodeName)!==-1}const go={__init__:["previewSupport"],previewSupport:["type",tr]};var iP="drop-ok",Fg="drop-not-ok",Hg="attach-ok",zg="new-parent",Vg="create",rP=2e3;function Gg(e,t,n,i,r){function o(c,u,l,p,f){if(!u)return!1;c=Te(c,function(E){var x=E.labelTarget;return!E.parent&&!(Re(E)&&c.indexOf(x)!==-1)});var d=it(c,function(E){return!Qe(E)}),h=!1,m=!1,g=!1;Ug(c)&&(h=r.allowed("shape.attach",{position:l,shape:d,target:u})),h||(Ug(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 S=f.connectionTarget;return g||h?(d&&p&&(m=r.allowed("connection.create",{source:S===p?d:p,target:S===p?p:d,hints:{targetParent:u,targetAttach:h}})),{attach:h,connect:m}):g===null||h===null?null:!1}function a(c,u){[Hg,iP,Fg,zg].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}Wg(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,Hg):a(p,m?zg:Fg))}),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,S=u.hints||{};if(h===!1||!d)return!1;Wg(c);var E={x:c.x,y:c.y};g?p=i.appendShape(l,p,E,d,{attach:m,connection:g===!0?{}:g,connectionTarget:S.connectionTarget}):(f=i.createElements(f,E,d,D({},S,{attach:m})),p=it(f,function(x){return!Qe(x)})),D(u,{elements:f,shape:p}),D(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===Vg&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],rP,function(){n.off("elements.changed",s)})}),this.start=function(c,u,l){ge(u)||(u=[u]);var p=it(u,function(h){return!Qe(h)});if(p){l=D({elements:u,hints:{},shape:p},l||{}),M(u,function(h){_e(h.x)||(h.x=0),_e(h.y)||(h.y=0)});var f=Te(u,function(h){return!h.hidden}),d=St(f);M(u,function(h){Qe(h)&&(h.waypoints=Zt(h.waypoints,function(m){return{x:m.x-d.x-d.width/2,y:m.y-d.y-d.height/2}})),D(h,{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2})}),t.init(c,Vg,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:u,context:l}})}}}Gg.$inject=["canvas","dragging","eventBus","modeling","rules"];function Wg(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 Ug(e){return e&&e.length===1&&!Qe(e[0])}var oP=750;function qg(e,t,n,i,r){function o(a){var s=pe("g");re(s,r.cls("djs-drag-group",["no-events"]));var c=pe("g");return a.forEach(function(u){var l;u.hidden||(u.waypoints?(l=n._createContainer("connection",c),n.drawConnection(Cr(l),u)):(l=n._createContainer("shape",c),n.drawShape(Cr(l),u),Ut(l,u.x,u.y)),i.addDragger(u,s,l))}),s}t.on("create.move",oP,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(),xe(p,l)),Ut(l,a.x,a.y)):It(l)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&It(c)})}qg.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const Qs={__depends__:[Pi,go,fi,zn],__init__:["create","createPreview"],create:["type",Gg],createPreview:["type",qg]};function pp(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)})}pp.$inject=["eventBus"],pp.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||aP(0,0)};function aP(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 aa={__init__:["mouse"],mouse:["type",pp]};var Yg=2e3;function Sn(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),sP(l)&&(u.priority=2,u.host=l.host.id),Qe(l)&&(u.priority=3,u.source=l.source.id,u.target=l.target.id,u.waypoints=cP(l)),Re(l)&&(u.priority=4,u.labelTarget=l.labelTarget.id),M(["x","y","width","height"],function(f){_e(l[f])&&(u[f]=l[f])}),u.hidden=l.hidden,u.collapsed=l.collapsed}),r.on("copyPaste.elementsCopied",Yg,function(c){var u;((u=c.hints)==null?void 0:u.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",Yg,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var u=c.hints;D(u,{createElementsBehavior:!1})})}Sn.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],Sn.prototype.copy=function(e,t={}){var n,i;return ge(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(ge(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},Sn.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})}}},Sn.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},Sn.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},Sn.prototype._getElementIdsFromTree=function(e){var t={};return M(e,function(n){M(n,function(i){i.id&&(t[i.id]=!0)})}),t},Sn.prototype._paste=function(e,t,n,i){M(e,function(o){_e(o.x)||(o.x=0),_e(o.y)||(o.y=0)});var r=St(e);return M(e,function(o){Qe(o)&&(o.waypoints=Zt(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),D(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,D({},i))},Sn.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return M(e,function(o,a){o=ti(o,"priority"),M(o,function(s){var c=D({},ni(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var u;if(Qe(c)){c.source=i[s.source],c.target=i[s.target],u=i[s.id]=t.createConnection(c),r.push(u);return}if(Re(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},Sn.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(ni(e,["id"]));return t},Sn.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(ni(e,["id"]));return t},Sn.prototype.createShape=function(e){var t=this._elementFactory.createShape(ni(e,["id"]));return t},Sn.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(Qe(e)&&(!n.has(e.source)||!n.has(e.target))||Re(e)&&!n.has(e.labelTarget))},Sn.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=ls(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}Rr(a,function(p,f,d){if(Re(p))return;M(p.labels,function(g){c(g,d)});function h(g){g&&g.length&&M(g,function(S){M(S.labels,function(E){c(E,d)}),c(S,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=Zt(r,function(p){return p.element});var l=new Set(e);return r=Zt(r,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:l}),p}),r=ti(r,function(p){return p.descriptor.priority}),e=Zt(r,function(p){return p.element}),M(r,function(p){var f=p.depth;if(!n.hasRelations(p.element,e,l)){Xg(p.element,e),l.delete(p.element);return}if(!s(p.element,e)){Xg(p.element,e),l.delete(p.element);return}i[f]||(i[f]=[]),i[f].push(p.descriptor)}),i};function sP(e){return!!e.host}function cP(e){return Zt(e.waypoints,function(t){return t=Kg(t),t.original&&(t.original=Kg(t.original)),t})}function Kg(e){return D({},e)}function Xg(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const uP={__depends__:[TC,Qs,aa,fi],__init__:["copyPaste"],copyPaste:["type",Sn]};function fp(e,t,n){ge(n)||(n=[n]),M(n,function(i){vr(e[i])||(t[i]=e[i])})}var dp=750;function Zg(e,t,n){function i(c,u){var l=e.create(c.$type);return n.copyElement(c,l,null,u)}t.on("copyPaste.copyElement",dp,function(c){var u=c.descriptor,l=c.element,p=K(l);if(Re(l))return u;var f=u.businessObject=i(p,!0),d=u.di=i(Be(l),!0);d.bpmnElement=f,fp(f,u,"name"),fp(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=K(c);return c.default&&(l[c.default]={element:p,property:"default"}),c.host&&(K(c).attachedToRef=K(u[c.host])),ni(l,yn(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(Re(l)){l.businessObject=K(u[l.labelTarget]),l.di=Be(u[l.labelTarget]);return}p=l.businessObject=i(p),f=l.di=i(f),f.bpmnElement=p,fp(l,p,["isExpanded","name"]),l.type=p.$type}),t.on("copyPaste.copyElement",dp,function(c){var u=c.descriptor,l=c.element;if(y(l,"bpmn:Participant")){var p=K(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;y(u,"bpmn:SubProcess")&&M(qo(l),p=>{l.push(p.annotation)})}),t.on("copyPaste.pasteElement",dp,function(c){var u=c.cache,l=c.descriptor;a(u,s(l,u,o(u)))})}Zg.$inject=["bpmnFactory","eventBus","moddleCopy"];const lP=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],pP=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function sa(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 ti(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=jt(r)&&r.$descriptor;if(a&&pP.includes(a))return o;if(a&&lP.includes(a)||a&&s&&!it(s.properties,Wr({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:r}=i;if(y(r,"bpmn:ExtensionElements")&&(!r.values||!r.values.length))return!1})}sa.$inject=["eventBus","bpmnFactory","moddle"],sa.prototype.copyElement=function(e,t,n,i=!1){n&&!ge(n)&&(n=[n]),n=n||hp(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(ge(r)&&(n=r),M(n,o=>{let a;vn(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!Ot(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},sa.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 jt(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):ge(e)?yn(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):jt(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},sa.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 hp(e,t){return yn(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const Qg={__depends__:[uP],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",Zg],moddleCopy:["type",sa]};var Jg=Math.round;function mp(e,t){this._modeling=e,this._eventBus=t}mp.$inject=["modeling","eventBus"],mp.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=Jg(s+o/2),l=Jg(c+a/2),p=i.replaceShape(e,D({},t,{x:u,y:l,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:p,hints:n}),p};function ev(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}ev.$inject=["selection","eventBus"];const fP={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",ev],replace:["type",mp]};function dP(e,t,n){ge(n)||(n=[n]),M(n,function(i){vr(e[i])||(t[i]=e[i])})}var hP=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function mP(e,t){var n=e&&vn(e,"collapsed")?e.collapsed:!Oe(e),i;return t&&(vn(t,"collapsed")||vn(t,"isExpanded"))?i=vn(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function tv(e,t,n,i,r,o){function a(s,c,u){u=u||{};var l=c.type,p=s.businessObject;if(Js(p)&&(l==="bpmn:SubProcess"||l==="bpmn:AdHocSubProcess")&&mP(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),dP(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var h=hp(p.$descriptor),m=hp(f.$descriptor,!0),g=gP(h,m);D(f,Zn(c,hP));var S=Te(g,function(b){return b==="eventDefinitions"?nv(s,c.eventDefinitionType):b==="loopCharacteristics"?!tn(f):vn(f,b)||b==="processRef"&&c.isExpanded===!1||b==="triggeredByEvent"?!1:b==="isForCompensation"?!tn(f):!0});if(f=n.copyElement(p,f,S),c.eventDefinitionType&&(nv(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),y(p,"bpmn:Activity")){if(Js(p))d.isExpanded=Oe(s);else if(c&&vn(c,"isExpanded")){d.isExpanded=c.isExpanded;var E=t.getDefaultSize(f,{isExpanded:d.isExpanded});d.width=E.width,d.height=E.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}Oe(s)&&!y(p,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(Js(p)&&!Js(f)&&(u.moveChildren=!1),y(p,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):u.moveChildren=!1;var x=Ht(s);Be(s).isHorizontal||(Be(d).isHorizontal=x),d.width=x?s.width:t.getDefaultSize(d).width,d.height=x?t.getDefaultSize(d).height:s.height}return o.allowed("shape.resize",{shape:f})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),f.name=p.name,Ce(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&Ce(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(f.default=p.default),c.host&&!y(p,"bpmn:BoundaryEvent")&&y(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}tv.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function Js(e){return y(e,"bpmn:SubProcess")}function nv(e,t){var n=K(e);return t&&n.get("eventDefinitions").some(function(i){return y(i,t)})}function gP(e,t){return e.filter(function(n){return t.includes(n)})}const iv={__depends__:[Qg,fP,zn],bpmnReplace:["type",tv]};var vP=250;function Dr(e){this._eventBus=e,this._tools=[],this._active=null}Dr.$inject=["eventBus"],Dr.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)},Dr.prototype.isActive=function(e){return e&&this._active===e},Dr.prototype.length=function(e){return this._tools.length},Dr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Dr.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&&(yP(r)||this.setActive(null))},this)};function yP(e){var t=e.originalEvent&&e.originalEvent.target;return t&&wr(t,'.group[data-group="tools"]')}const ec={__depends__:[Pi],__init__:["toolManager"],toolManager:["type",Dr]};function _P(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 bP(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 xP(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 gp=Math.abs,EP=Math.round,Ai={x:"width",y:"height"},rv="crosshair",nr={n:"top",w:"left",s:"bottom",e:"right"},wP=1500,tc={n:"s",w:"e",s:"n",e:"w"},nc=20;function Vn(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",wP,function(c){var u=c.context,l=u.initialized;l||(l=u.initialized=s.init(c,u)),l&&av(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){av(c);var m={x:0,y:0};m[l]=EP(c["d"+l]),s.makeSpace(f,d,m,p,h),n.once("spaceTool.ended",function(g){s.activateSelection(g.originalEvent,!0,!0)})}})}Vn.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Vn.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:rv,data:{context:{reactivate:n}},trapClick:!1})},Vn.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:rv,data:{context:{}}})},Vn.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},Vn.prototype.init=function(e,t){var n=gp(e.dx)>gp(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(gp(i)<5)return!1;i<0&&(i*=-1),ia(e)&&(i*=-1);var o=_P(n,i),a=this._canvas.getRootElement();!Vs(e)&&e.hover&&(a=e.hover);var s=[...Ho(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=SP(c,n,o,r,u);return D(t,c,{axis:n,direction:o,spaceToolConstraints:l,start:r}),Zs("resize-"+(n==="x"?"ew":"ns")),!0},Vn.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||Re(d))){if(Qe(d)){l.push(d);return}var h=d[t],m=h+d[Ai[t]];if(RP(d)&&(n>0&&ve(d)[t]>i||n<0&&ve(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}},Vn.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Vn.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function ov(e){return{top:e.top-nc,right:e.right+nc,bottom:e.bottom+nc,left:e.left-nc}}function av(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;_e(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),_e(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),_e(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),_e(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function SP(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=de(f),g=Te(h,function(H){return!Qe(H)&&!Re(H)&&!l.has(H)&&!p.has(H)}),S=Te(h,function(H){return!Qe(H)&&!Re(H)&&l.has(H)}),E,x,b,w=[],T=[],O,P,j,F;g.length&&(x=ov(de(St(g))),E=i-m[nr[n]]+x[nr[n]],n==="n"?s.bottom=u=_e(u)?Math.min(u,E):E:n==="w"?s.right=u=_e(u)?Math.min(u,E):E:n==="s"?s.top=c=_e(c)?Math.max(c,E):E:n==="e"&&(s.left=c=_e(c)?Math.max(c,E):E)),S.length&&(b=ov(de(St(S))),E=i-b[nr[tc[n]]]+m[nr[tc[n]]],n==="n"?s.bottom=u=_e(u)?Math.min(u,E):E:n==="w"?s.right=u=_e(u)?Math.min(u,E):E:n==="s"?s.top=c=_e(c)?Math.max(c,E):E:n==="e"&&(s.left=c=_e(c)?Math.max(c,E):E)),d&&d.length&&(d.forEach(function(H){l.has(H)?w.push(H):T.push(H)}),w.length&&(O=de(St(w.map(ve))),P=m[nr[tc[n]]]-(O[nr[tc[n]]]-i)),T.length&&(j=de(St(T.map(ve))),F=j[nr[n]]-(m[nr[n]]-i)),n==="n"?(E=Math.min(P||1/0,F||1/0),s.bottom=u=_e(u)?Math.min(u,E):E):n==="w"?(E=Math.min(P||1/0,F||1/0),s.right=u=_e(u)?Math.min(u,E):E):n==="s"?(E=Math.max(P||-1/0,F||-1/0),s.top=c=_e(c)?Math.max(c,E):E):n==="e"&&(E=Math.max(P||-1/0,F||-1/0),s.left=c=_e(c)?Math.max(c,E):E));var I=r&&r[f.id];I&&(n==="n"?(E=i+f[Ai[t]]-I[Ai[t]],s.bottom=u=_e(u)?Math.min(u,E):E):n==="w"?(E=i+f[Ai[t]]-I[Ai[t]],s.right=u=_e(u)?Math.min(u,E):E):n==="s"?(E=i-f[Ai[t]]+I[Ai[t]],s.top=c=_e(c)?Math.max(c,E):E):n==="e"&&(E=i-f[Ai[t]]+I[Ai[t]],s.left=c=_e(c)?Math.max(c,E):E))}),s}}function RP(e){return!!e.host}var vp="djs-dragging",sv="djs-resizing",CP=250,ic=Math.max;function cv(e,t,n,i,r){function o(a,s){M(a,function(c){r.addDragger(c,s),n.addMarker(c,vp)})}e.on("spaceTool.selection.start",function(a){var s=n.getLayer("space"),c=a.context,u={x:"M 0,-10000 L 0,10000",y:"M -10000,0 L 10000,0"},l=pe("g");re(l,i.cls("djs-crosshair-group",["no-events"])),xe(s,l);var p=pe("path");re(p,"d",u.x),Le(p).add("djs-crosshair"),xe(l,p);var f=pe("path");re(f,"d",u.y),Le(f).add("djs-crosshair"),xe(l,f),c.crosshairGroup=l}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;Ut(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&It(c)}),e.on("spaceTool.move",CP,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=pe("path"),re(c,"d","M0,0 L0,0"),Le(c).add("djs-crosshair"),xe(f,c),s.line=c;var d=pe("g");re(d,i.cls("djs-drag-group",["no-events"])),xe(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(O){m.has(O)||!Qe(O)||!h.has(O.target)||(m.add(O),g.push(O))})}),o(g,d),s.dragGroup=d}if(!s.frameGroup){var S=pe("g");re(S,i.cls("djs-frame-group",["no-events"])),xe(n.getActiveLayer(),S);var E=[];M(p,function(T){var O=r.addFrame(T,S),P=O.getBBox();E.push({element:O,initialBounds:P}),n.addMarker(T,sv)}),s.frameGroup=S,s.frames=E}var x={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};re(c,{d:x[u]});var b={x:"y",y:"x"},w={x:a.dx,y:a.dy};w[b[s.axis]]=0,Ut(s.dragGroup,w.x,w.y),M(s.frames,function(T){var O=T.element,P=T.initialBounds,j,F;s.direction==="e"?re(O,{width:ic(P.width+w.x,5)}):(j=ic(P.width-w.x,5),re(O,{width:j,x:P.x+P.width-j})),s.direction==="s"?re(O,{height:ic(P.height+w.y,5)}):(F=ic(P.height-w.y,5),re(O,{height:F,y:P.y+P.height-F}))})}}),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,vp)}),M(u,function(h){n.removeMarker(h,vp)}),f&&(It(p),It(f)),M(l,function(h){n.removeMarker(h,sv)}),d&&It(d)})}cv.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const PP={__init__:["spaceToolPreview"],__depends__:[Pi,fi,ec,go,aa],spaceTool:["type",Vn],spaceToolPreview:["type",cv]};function rc(e,t){e.invoke(Vn,this),this._canvas=t}rc.$inject=["injector","canvas"],ie(rc,Vn),rc.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=Vr(Zr(r.children.filter(u=>y(u,"bpmn:Artifact")),St(o))));const s=[...e,...a];var c=Vn.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(u){return!(y(u,"bpmn:TextAnnotation")||AP(u)&&(t==="y"&&Ht(u)||t==="x"&&!Ht(u)))}),c};function AP(e){return y(e,"bpmn:Participant")&&!K(e).processRef}const uv={__depends__:[PP],spaceTool:["type",rc]};function ft(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)}ft.$inject=["eventBus","injector"],ft.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()},ft.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},ft.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},ft.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()}},ft.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()}},ft.prototype.register=function(e,t){this._setHandler(e,t)},ft.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)},ft.prototype.canUndo=function(){return!!this._getUndoAction()},ft.prototype.canRedo=function(){return!!this._getRedoAction()},ft.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},ft.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},ft.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)})},ft.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},ft.prototype._createId=function(){return this._uid++},ft.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},ft.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()},ft.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)},ft.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:Bf("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},ft.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=ge(e)?e:[e],t.dirty=t.dirty.concat(e))},ft.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},ft.prototype._revertedAction=function(e){this._stackIdx--},ft.prototype._getHandler=function(e){return this._handlerMap[e]},ft.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 TP={commandStack:["type",ft]};function ir(e,t){if(typeof t!="function")throw new Error("removeFn iterator must be a function");if(!e)return[];for(var n;n=e[0];)t(n);return e}var MP=250,lv=1400;function yp(e,t,n){U.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",lv,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=pv(a),o.validatedShapes=pv(s)}),i&&t.on("shape.move.start",MP,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",lv,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;ir(a.labels,function(s){n.removeShape(s,{nested:!0})})}),this.execute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.labelTarget;s&&(o.labelTargetIndex=Zu(s.labels,a),o.labelTarget=s,a.labelTarget=null)}),this.revert("shape.delete",function(r){var o=r.context,a=o.shape,s=o.labelTarget,c=o.labelTargetIndex;s&&(bt(s.labels,a,c),a.labelTarget=s)})}ie(yp,U),yp.$inject=["injector","eventBus","modeling"];function pv(e){var t=new Set(e);return Te(e,function(n){return!t.has(n.labelTarget)})}const kP={__init__:["labelSupport"],labelSupport:["type",yp]};var DP=251,fv=1401,dv="attach-ok";function _p(e,t,n,i,r){U.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",fv,function(a){var s=a.context,c=s.shapes,u=s.validatedShapes;s.shapes=OP(c),s.validatedShapes=LP(u)}),o&&t.on("shape.move.start",DP,function(a){var s=a.context,c=s.shapes,u=bp(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,dv),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(l,dv)}))}}),this.preExecuted("elements.move",fv,function(a){var s=a.context,c=s.closure,u=s.shapes,l=bp(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=Te(c,function(p){var f=p.host;return IP(p)&&!NP(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;ir(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=km(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=km(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;ir(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}ie(_p,U),_p.$inject=["injector","eventBus","canvas","rules","modeling"];function bp(e){return hu(Zt(e,function(t){return t.attachers||[]}))}function OP(e){var t=bp(e);return Cx("id",e,t)}function LP(e){var t=Gr(e,"id");return Te(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function IP(e){return!!e.host}function NP(e,t){return e.indexOf(t)!==-1}const BP={__depends__:[fi],__init__:["attachSupport"],attachSupport:["type",_p]};function hv(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(ah(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)})}hv.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const xp={__init__:["changeSupport"],changeSupport:["type",hv]};function Gn(e){this._model=e}Gn.$inject=["moddle"],Gn.prototype._needsId=function(e){return Ce(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"])},Gn.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;y(e,"bpmn:Activity")?t="Activity":y(e,"bpmn:Event")?t="Event":y(e,"bpmn:Gateway")?t="Gateway":Ce(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))},Gn.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Gn.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Gn.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",D({bpmnElement:e,bounds:this.createDiBounds()},t))},Gn.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Gn.prototype.createDiWaypoints=function(e){var t=this;return Zt(e,function(n){return t.createDiWaypoint(n)})},Gn.prototype.createDiWaypoint=function(e){return this.create("dc:Point",Zn(e,["x","y"]))},Gn.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",D({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Gn.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",D({bpmnElement:e},t))};function Rn(e,t,n){U.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"],Cn(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Cn(a));function s(d){var h=d.context,m=h.oldRoot,g=m.children;M(g,function(S){y(S,"bpmn:BaseElement")&&i.updateParent(S)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var h=d.context.shape;y(h,"bpmn:BaseElement")&&i.updateBounds(h)}this.executed(["shape.move","shape.create","shape.resize"],Cn(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],Cn(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"],Cn(u)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],Cn(u));function l(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],Cn(l)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],Cn(l)),this.executed("connection.reconnect",Cn(function(d){var h=d.context,m=h.connection,g=h.oldSource,S=h.newSource,E=K(m),x=K(g),b=K(S);E.conditionExpression&&!Ce(b,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(h.oldConditionExpression=E.conditionExpression,delete E.conditionExpression),g!==S&&x.default===E&&(h.oldDefault=x.default,delete x.default)})),this.reverted("connection.reconnect",Cn(function(d){var h=d.context,m=h.connection,g=h.oldSource,S=h.newSource,E=K(m),x=K(g),b=K(S);h.oldConditionExpression&&(E.conditionExpression=h.oldConditionExpression),h.oldDefault&&(x.default=h.oldDefault,delete b.default)}));function p(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],Cn(p)),this.reverted(["element.updateAttachment"],Cn(p)),this.executed("element.updateLabel",Cn(f)),this.reverted("element.updateLabel",Cn(f));function f(d){const{element:h}=d.context,m=Dn(h),g=Be(h),S=g&&g.get("label");Xi(h)||Gs(h)||(m&&!S?g.set("label",t.create("bpmndi:BPMNLabel")):!m&&S&&g.set("label",void 0))}}ie(Rn,U),Rn.$inject=["eventBus","bpmnFactory","connectionDocking"],Rn.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},Rn.prototype.updateParent=function(e,t){if(!Re(e)&&!(y(e,"bpmn:DataStoreReference")&&e.parent&&y(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=Be(e),o=n&&n.businessObject,a=Be(n);y(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),y(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),y(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(i,o),y(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},Rn.prototype.updateBounds=function(e){var t=Be(e),n=jP(e);if(n){var i=Qn(n,t.get("bounds"));D(n,{x:e.x+i.x,y:e.y+i.y})}var r=Re(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),D(o,{x:e.x,y:e.y,width:e.width,height:e.height})},Rn.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;y(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),gt(i,e)),y(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),bt(r,e))}},Rn.prototype.updateDiConnection=function(e,t,n){var i=Be(e),r=Be(t),o=Be(n);i.sourceElement&&i.sourceElement.bpmnElement!==K(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==K(n)&&(i.targetElement=n&&o)},Rn.prototype.updateDiParent=function(e,t){if(t&&!y(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(gt(n,e),e.$parent=null)}};function $P(e){for(;e&&!y(e,"bpmn:Definitions");)e=e.$parent;return e}Rn.prototype.getLaneSet=function(e){var t,n;return y(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(y(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)},Rn.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((y(e,"bpmn:DataInput")||y(e,"bpmn:DataOutput"))&&(y(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(y(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(y(e,"bpmn:FlowElement")){if(t){if(y(t,"bpmn:Participant"))t=t.processRef;else if(y(t,"bpmn:Lane"))do t=t.$parent.$parent;while(y(t,"bpmn:Lane"))}i="flowElements"}else if(y(e,"bpmn:Artifact")){for(;t&&!y(t,"bpmn:Process")&&!y(t,"bpmn:SubProcess")&&!y(t,"bpmn:Collaboration");)if(y(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(y(e,"bpmn:MessageFlow"))i="messageFlows";else if(y(e,"bpmn:Participant")){i="participants";var r=e.processRef,o;r&&(o=$P(e.$parent||t),e.$parent&&(gt(o.get("rootElements"),r),r.$parent=null),t&&(bt(o.get("rootElements"),r),r.$parent=o))}else y(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":y(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),gt(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);gt(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},Rn.prototype.updateConnectionWaypoints=function(e){var t=Be(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},Rn.prototype.updateConnection=function(e){var t=e.connection,n=K(t),i=t.source,r=K(i),o=t.target,a=K(t.target),s;if(y(n,"bpmn:DataAssociation"))y(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=r,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):y(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||r,this.updateSemanticParent(n,r,s),n.targetRef=a);else{var c=y(n,"bpmn:SequenceFlow");n.sourceRef!==r&&(c&&(gt(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(gt(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)},Rn.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function Cn(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;y(i,"bpmn:BaseElement")&&e(t)}}function jP(e){if(y(e,"bpmn:Activity")){var t=Be(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function rr(e,t){wi.call(this),this._bpmnFactory=e,this._moddle=t}ie(rr,wi),rr.$inject=["bpmnFactory","moddle"],rr.prototype._baseCreate=wi.prototype.create,rr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,D({type:"label",di:n},Pr,t))}return this.createElement(e,t)},rr.prototype.createElement=function(e,t){t=D({},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(!HP(r)){var o=D({},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)}y(i,"bpmn:Group")&&(t=D({isFrame:!0},t)),t=FP(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Ep(r,t,"isExpanded")),Ce(i,["bpmn:Lane","bpmn:Participant"])&&(t=Ep(r,t,"isHorizontal")),y(i,"bpmn:SubProcess")&&(t.collapsed=!Oe(i,r)),y(i,"bpmn:ExclusiveGateway")&&(vn(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),Ot(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),Ot(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=D({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},rr.prototype.getDefaultSize=function(e,t){var n=K(e);if(t=t||Be(e),y(n,"bpmn:SubProcess"))return Oe(n,t)?{width:350,height:200}:{width:100,height:80};if(y(n,"bpmn:Task"))return{width:100,height:80};if(y(n,"bpmn:Gateway"))return{width:50,height:50};if(y(n,"bpmn:Event"))return{width:36,height:36};if(y(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return Oe(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return y(n,"bpmn:Lane")?{width:400,height:100}:y(n,"bpmn:DataObjectReference")?{width:36,height:50}:y(n,"bpmn:DataStoreReference")?{width:50,height:50}:y(n,"bpmn:TextAnnotation")?{width:100,height:40}:y(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},rr.prototype.createParticipantShape=function(e){return jt(e)||(e={isExpanded:e}),e=D({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function FP(e,t,n){return M(n,function(i){t=Ep(e,t,i)}),t}function Ep(e,t,n){return t[n]===void 0?t:(e[n]=t[n],ni(t,[n]))}function HP(e){return Ce(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function oc(e,t){this._modeling=e,this._canvas=t}oc.$inject=["modeling","canvas"],oc.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;M(n,function(r){var o={x:0,y:0};Ot(i.left)?o.x=i.left-r.x:Ot(i.right)?o.x=i.right-r.width-r.x:Ot(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:Ot(i.top)?o.y=i.top-r.y:Ot(i.bottom)?o.y=i.bottom-r.height-r.y:Ot(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},oc.prototype.postExecute=function(e){};function ac(e){this._modeling=e}ac.$inject=["modeling"],ac.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},ac.prototype.postExecute=function(e){var t=e.hints||{};zP(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 zP(e,t){return Ni(e.outgoing,function(n){return n.target===t})}function sc(e,t){this._canvas=e,this._layouter=t}sc.$inject=["canvas","layouter"],sc.prototype.execute=function(e){var t=e.connection,n=e.source,i=e.target,r=e.parent,o=e.parentIndex,a=e.hints;if(!n||!i)throw new Error("source and target required");if(!r)throw new Error("parent required");return t.source=n,t.target=i,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,a)),this._canvas.addConnection(t,r,o),t},sc.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var cc=Math.round;function wp(e){this._modeling=e}wp.$inject=["modeling"],wp.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){_e(p.x)||(p.x=0),_e(p.y)||(p.y=0)});var s=Te(t,function(p){return!p.hidden}),c=St(s);M(t,function(p){Qe(p)&&(p.waypoints=Zt(p.waypoints,function(f){return{x:cc(f.x-c.x-c.width/2+r.x),y:cc(f.y-c.y-c.height/2+r.y)}})),D(p,{x:cc(p.x-c.x-c.width/2+r.x),y:cc(p.y-c.y-c.height/2+r.y)})});var u=new Set(ls(t)),l={};M(t,function(p){if(Qe(p)){l[p.id]=_e(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=D({},o);u.has(p)||(f.autoResize=!1),Re(p)&&(f=ni(f,["attach"])),l[p.id]=_e(i)?a.createShape(p,Zn(p,["x","y","width","height"]),p.parent||n,i,f):a.createShape(p,Zn(p,["x","y","width","height"]),p.parent||n,f)}),e.elements=Vr(l)};var mv=Math.round;function or(e){this._canvas=e}or.$inject=["canvas"],or.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?D(t,n):D(t,{x:n.x-mv(t.width/2),y:n.y-mv(t.height/2)}),this._canvas.addShape(t,i,r),t},or.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function ca(e){or.call(this,e)}ie(ca,or),ca.$inject=["canvas"];var VP=or.prototype.execute;ca.prototype.execute=function(e){var t=e.shape;return WP(t),t.labelTarget=e.labelTarget,VP.call(this,e)};var GP=or.prototype.revert;ca.prototype.revert=function(e){return e.shape.labelTarget=null,GP.call(this,e)};function WP(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function ua(e,t){this._canvas=e,this._modeling=t}ua.$inject=["canvas","modeling"],ua.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;ir(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),ir(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},ua.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=Zu(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},ua.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,bt(n.children,t,i),this._canvas.addConnection(t,n),t};function Sp(e,t){this._modeling=e,this._elementRegistry=t}Sp.$inject=["modeling","elementRegistry"],Sp.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 la(e,t){this._canvas=e,this._modeling=t}la.$inject=["canvas","modeling"],la.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;ir(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),ir(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),ir(n.children,function(i){Qe(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},la.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=Zu(i.children,n),t.removeShape(n),n},la.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return bt(i.children,n,r),t.addShape(n,i),n};function uc(e){this._modeling=e}uc.$inject=["modeling"];var gv={x:"y",y:"x"};uc.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(g,S){g.range.min=Math.min(S[i],g.range.min),g.range.max=Math.max(S[i]+S[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,S){var E={y:0};E[i]=g-a(S),E[i]&&(E[gv[i]]=0,t.moveElements([S],E,S.parent))}var l=n[0],p=s(n),f=n[p],d,h,m=0;M(n,function(g,S){var E,x,b;if(g.elements.length<2){S&&S!==n.length-1&&(o(g,g.elements[0]),m+=c(g.range));return}E=ti(g.elements,i),x=E[0],S===p&&(x=E[s(E)]),b=a(x),g.range=null,M(E,function(w){if(u(b,w),g.range===null){g.range={min:w[i],max:w[i]+w[r]};return}o(g,w)}),S&&S!==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,S){var E={},x;g===l||g===f||(x=n[S-1],g.range.max=0,M(g.elements,function(b,w){E[gv[i]]=0,E[i]=x.range.max-b[i]+d,g.range.min!==b[i]&&(E[i]+=b[i]-g.range.min),E[i]&&t.moveElements([b],E,b.parent),g.range.max=Math.max(b[i]+b[r],w?g.range.max:0)}))})},uc.prototype.postExecute=function(e){};function lc(e,t){this._layouter=e,this._canvas=t}lc.$inject=["layouter","canvas"],lc.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return D(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},lc.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Rp(){}Rp.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=gt(o.children,t),bt(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},Rp.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return gt(n.children,t),bt(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 Cp(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Cp.prototype.add=function(e,t){return this.addAll([e],t)},Cp.prototype.addAll=function(e,t){var n=xw(e,!!t,this);return D(this,n),this};function pa(e){this._modeling=e}pa.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},pa.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&&Ol(p,p.source,t),connectionEnd:d&&Ll(p,p.target,t)})})},pa.prototype.getClosure=function(e){return new Cp().addAll(e,!0)};function pc(e){this._helper=new pa(e)}pc.$inject=["modeling"],pc.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},pc.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 Or(e){this._modeling=e,this._helper=new pa(e)}Or.$inject=["modeling"],Or.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=Zn(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=gt(o.children,t),bt(i.children,t,r),D(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Or.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:Ll(o,t,n)})}),M(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:Ol(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},Or.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return bt(n.children,t,i),D(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},Or.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Or.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function fa(e){this._modeling=e}fa.$inject=["modeling"],fa.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 ge(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},fa.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||vv(ge(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||vv(ge(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},fa.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 vv(e){return e.original||e}function Ti(e,t){this._modeling=e,this._rules=t}Ti.$inject=["modeling","rules"],Ti.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,$s(h,s,l),a)}),M(d,function(h){var m=h.target,g=c(s,m,h);g&&t.reconnectStart(h,s,Bs(h,s,l),a)})},Ti.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Ti.prototype.execute=function(e){},Ti.prototype.revert=function(e){},Ti.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},Ti.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},Ti.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function da(e){this._modeling=e}da.$inject=["modeling"],da.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},D(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},da.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:$s(o,n,i)})}),M(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:Bs(o,n,i)})}))},da.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return D(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function ar(e){this._modeling=e}ar.$inject=["modeling"],ar.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]=qP(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(bP(i,r),t,n,o,i,r,a)},ar.prototype.execute=function(){},ar.prototype.revert=function(){},ar.prototype.moveShapes=function(e,t){var n=this;M(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},ar.prototype.resizeShapes=function(e,t,n){var i=this;M(e,function(r){var o=xP(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},ar.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=UP(l),h=_v(n),m={},g=c.has(p)||u.has(p),S=c.has(f)||u.has(f);g&&S?(d=Zt(d,function(E){return bv(E,i,n)&&(E[h]=E[h]+t[h]),E.original&&bv(E.original,i,n)&&(E.original[h]=E.original[h]+t[h]),E}),s._modeling.updateWaypoints(l,d,{labelBehavior:!1})):(g||S)&&(c.has(p)?m.connectionStart=Ol(l,p,t):c.has(f)?m.connectionEnd=Ll(l,f,t):u.has(p)?m.connectionStart=Bs(l,p,a[p.id]):u.has(f)&&(m.connectionEnd=$s(l,f,a[f.id])),s._modeling.layoutConnection(l,m))})};function yv(e){return D({},e)}function UP(e){return Zt(e.waypoints,function(t){return t=yv(t),t.original&&(t.original=yv(t.original)),t})}function _v(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function bv(e,t,n){var i=_v(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function qP(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function fc(e){this._modeling=e}fc.$inject=["modeling"],fc.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=xv(n),t.collapsed=!t.collapsed;var i=Ev(n,t.collapsed);return[t].concat(i)},fc.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=wv(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function xv(e){var t={};return M(e,function(n){t[n.id]=n.hidden,n.children&&(t=D({},t,xv(n.children)))}),t}function Ev(e,t){var n=[];return M(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(Ev(i.children,i.collapsed||t)))}),n}function wv(e,t){var n=[];return M(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(wv(i.children,t)))}),n}function dc(e){this._modeling=e}dc.$inject=["modeling"],dc.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Sv(i,t),Rv(n,t),t.host=n,t},dc.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,Sv(n,t),Rv(i,t,r),t};function Sv(e,t){return gt(e&&e.attachers,t)}function Rv(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),bt(i,t,n)}}function Pp(){}Pp.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},Pp.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function Je(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}Je.$inject=["eventBus","elementFactory","commandStack"],Je.prototype.getHandlers=function(){return{"shape.append":ac,"shape.create":or,"shape.delete":la,"shape.move":Or,"shape.resize":da,"shape.replace":Ti,"shape.toggleCollapse":fc,spaceTool:ar,"label.create":ca,"connection.create":sc,"connection.delete":ua,"connection.move":Rp,"connection.layout":lc,"connection.updateWaypoints":Pp,"connection.reconnect":fa,"elements.create":wp,"elements.move":pc,"elements.delete":Sp,"elements.distribute":uc,"elements.align":oc,"element.updateAttachment":dc}},Je.prototype.registerHandlers=function(e){M(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},Je.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)},Je.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},Je.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)},Je.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)},Je.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},Je.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},Je.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},Je.prototype.createElements=function(e,t,n,i,r){ge(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},Je.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},Je.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},Je.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},Je.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},Je.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},Je.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},Je.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},Je.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},Je.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},Je.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)},Je.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},Je.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)},Je.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,D(i,{docking:"source"}))},Je.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,D(i,{docking:"target"}))},Je.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},Je.prototype._create=function(e,t){return a1(t)?t:this._elementFactory.create(e,t)},Je.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function ha(e){this._elementRegistry=e}ha.$inject=["elementRegistry"],ha.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||YP(n,za(i));return Cv(n,i),e.oldProperties=o,e.changed=r,r},ha.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return Cv(n,t),i},ha.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return y(e,"bpmn:DataObject")?KP(e,t):[]};function YP(e,t){return yn(t,function(n,i){return n[i]=e.get(i),n},{})}function Cv(e,t){M(t,function(n,i){e.set(i,n)})}function KP(e,t){return t.filter(function(n){return y(n,"bpmn:DataObjectReference")&&K(n).dataObjectRef===e})}var ma="default",Mi="id",Pv="di",XP={width:0,height:0};function ga(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}ga.$inject=["elementRegistry","moddle","modeling","textRenderer"],ga.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=tA(e.properties),s=e.oldProperties||ZP(t,a);return Av(a,o)&&(r.unclaim(o[Mi]),i.updateId(t,a[Mi]),r.claim(a[Mi],o)),ma in a&&(a[ma]&&n.push(i.get(a[ma].id)),o[ma]&&n.push(i.get(o[ma].id))),Tv(t,a),e.oldProperties=s,e.changed=n,n},ga.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&K(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,XP)}},ga.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 Tv(t,i),Av(n,r)&&(a.unclaim(n[Mi]),o.updateId(t,i[Mi]),a.claim(i[Mi],r)),e.changed};function Av(e,t){return Mi in e&&e[Mi]!==t[Mi]}function ZP(e,t){var n=za(t),i=e.businessObject,r=Be(e);return yn(n,function(o,a){return a!==Pv?o[a]=i.get(a):o[a]=QP(r,za(t.di)),o},{})}function QP(e,t){return yn(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function Tv(e,t){var n=e.businessObject,i=Be(e);M(t,function(r,o){o!==Pv?n.set(o,r):i&&JP(i,r)})}function JP(e,t){M(t,function(n,i){e.set(i,n)})}var eA=["default"];function tA(e){var t=D({},e);return eA.forEach(function(n){n in e&&(t[n]=K(t[n]))}),t}function hc(e,t){this._canvas=e,this._modeling=t}hc.$inject=["canvas","modeling"],hc.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=Be(r);return t.setRootElement(n),t.removeRootElement(r),bt(a.rootElements,i),i.$parent=a,gt(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},hc.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=Be(n);return t.setRootElement(r),t.removeRootElement(n),gt(a.rootElements,i),i.$parent=null,bt(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function Ap(e,t){this._modeling=e,this._spaceTool=t}Ap.$inject=["modeling","spaceTool"],Ap.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=Fn(i),a=o===i,s=a?i:i.parent,c=Qi(s),u=Ht(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+jn,y:i.y,width:i.width-jn,height:i.height}:{x:i.x,y:i.y+jn,width:i.width,height:i.height-jn};n.createShape({type:"bpmn:Lane",isHorizontal:u},l,s)}var p=[];Rr(o,function(b){return p.push(b),b.label&&p.push(b.label),b===i?[]:Te(b.children,function(w){return w!==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 S=t.calculateAdjustments(p,g,f,h),E=u?{x:0,y:f}:{x:f,y:0};t.makeSpace(S.movingShapes,S.resizingShapes,E,m,h);var x=u?{x:i.x+(a?jn:0),y:d-(r==="top"?120:0),width:i.width-(a?jn:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?jn:0),width:120,height:i.height-(a?jn:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:u},x,s)};function Tp(e){this._modeling=e}Tp.$inject=["modeling"],Tp.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=Qi(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=Ht(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+jn,y:n.y+f*c,width:n.width-jn,height:u}:{x:n.x+f*c,y:n.y+jn,width:u,height:n.height-jn},f<o?t.resizeShape(r[f],l):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,l,n))};function va(e,t){this._modeling=e,this._spaceTool=t}va.$inject=["modeling","spaceTool"],va.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},va.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=KS(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},va.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=de(e),r=de(t),o=sm(r,i),a=Fn(e),s=[],c=[];Rr(a,function(h){return s.push(h),(y(h,"bpmn:Lane")||y(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 ya="flowNodeRef",Mp="lanes";function mc(){}mc.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(l,p){var f=de(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=Fn(l);return r[p.id]||(r[p.id]=Ds(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=Fn(l);if(!(!p||n.indexOf(p)!==-1)){var f=p.children.filter(function(d){return y(d,"bpmn:FlowNode")});f.forEach(s),n.push(p)}}),e.forEach(s),o.forEach(function(l){var p=l.businessObject,f=p.get(Mp),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(ya).forEach(function(f){i.push({flowNode:f,remove:[p],add:[]})})}),i},mc.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(Mp);n.remove.forEach(function(o){gt(r,o),gt(o.get(ya),i)}),n.add.forEach(function(o){bt(r,o),bt(o.get(ya),i)})}),[]},mc.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(Mp);n.add.forEach(function(o){gt(r,o),gt(o.get(ya),i)}),n.remove.forEach(function(o){bt(r,o),bt(o.get(ya),i)})}),[]};var kp="categoryValueRef";function _a(e,t){this._bpmnFactory=e,this._elementRegistry=t}_a.$inject=["bpmnFactory","elementRegistry"],_a.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,r=new Map,o=[],a=new Map;function s(E,x,b){if(x){var w=a.get(E);w||(w={},a.set(E,w)),!(b&&w.present)&&(!b&&w.past||(b?w.present={categoryValue:x,root:Dp(E)}:w.past={categoryValue:x}))}}function c(E){r.set(E,K(E))}function u(){n.filter(function(E){return y(E,"bpmn:FlowElement")&&!Re(E)&&E.parent}).forEach(c)}function l(E){var x=K(E),b=x.get("categoryValueRef");return b||(b=nm(i,x),o.push(nA(E,b))),b}function p(E){return E.reduce(function(x,b){var w=Dp(b),T=x.get(w);return T||(T=[],x.set(w,T)),T.push(b),x},new Map)}e=Array.from(e||[]);var f=p(e);t.length&&u(),e.forEach(c),n.filter(function(E){return y(E,"bpmn:Group")&&!Re(E)&&E.parent}).forEach(function(E){var x=K(E).get("categoryValueRef");if(!x){var b=Dp(E),w=f.get(b)||[],T=Zr(w,E),O=Object.keys(T).length>0;O&&(x=l(E))}s(E,x,!0)}),t.forEach(function(E){s(E.groupShape,E.categoryValue,!1)}),o.length&&u();var d=Array.from(r.keys()),h=Array.from(a.values()).reduce(function(E,x){return x.present&&E.add(x.present.categoryValue),x.past&&E.add(x.past.categoryValue),E},new Set),m=new Map,g=p(d);a.forEach(function(E,x){var b=E.present;if(b){var w=g.get(b.root)||[],T=Zr(w,x);w.forEach(function(O){if(T[O.id]){var P=m.get(O);P||(P=new Set,m.set(O,P)),P.add(b.categoryValue)}})}});var S=d.reduce(function(E,x){var b=r.get(x),w=b.get(kp),T=new Set(w),O=m.get(x)||new Set,P=Array.from(O).filter(function(F){return!T.has(F)}),j=w.filter(function(F){return h.has(F)&&!O.has(F)});return(P.length||j.length)&&E.push({businessObject:b,categoryValuesToAdd:P,categoryValuesToRemove:j}),E},[]);return{flowElements:S,groups:o}},_a.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),iA(t.groups),oA(t.flowElements),[]},_a.prototype.revert=function(e){var t=e.updates;return aA(t.flowElements),rA(t.groups),[]};function nA(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function iA(e){e.forEach(function(t){K(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function rA(e){e.forEach(function(t){K(t.groupShape).categoryValueRef=null})}function oA(e){e.forEach(function(t){var n=t.businessObject,i=n.get(kp);t.categoryValuesToRemove.forEach(function(r){gt(i,r)}),t.categoryValuesToAdd.forEach(function(r){bt(i,r,!0)})})}function aA(e){e.forEach(function(t){var n=t.businessObject,i=n.get(kp);t.categoryValuesToAdd.forEach(function(r){gt(i,r)}),t.categoryValuesToRemove.forEach(function(r){bt(i,r,!0)})})}function Dp(e){for(;e.parent;)e=e.parent;return e}function gc(e){this._moddle=e}gc.$inject=["moddle"],gc.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),[]},gc.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 sA={fill:void 0,stroke:void 0};function Op(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(gn(t)){var n=cA(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}Op.$inject=["commandStack"],Op.prototype.postExecute=function(e){var t=e.elements,n=e.colors||sA,i=this,r={};"fill"in n&&D(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&D(r,{"border-color":this._normalizeColor(n.stroke)}),M(t,function(o){var a=Qe(o)?Zn(r,["border-color"]):r,s=Be(o);if(uA(a),Re(o)){if(!s||!y(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:s.label,properties:{color:r["border-color"]}})}else{if(!Ce(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function cA(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 uA(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var lA={width:0,height:0};function Mv(e,t,n){function i(c,u){var l=c.label||c,p=c.labelTarget||c;return $1(l,u),[l,p]}function r(c){var u=c.element,l=u.businessObject,p=c.newLabel;if(!Re(u)&&Xi(u)&&!_s(u)&&!kv(p)){var f=7,d=il(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=Dn(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(!(!Re(l)&&!y(l,"bpmn:TextAnnotation"))){if(Re(l)&&kv(p)){d.removeShape!==!1&&e.removeShape(l,{unsetLabel:!1});return}var h=Dn(u);typeof f>"u"&&(f=t.getExternalLabelBounds(l,h)),f&&e.resizeShape(l,f,lA)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}Mv.$inject=["modeling","textRenderer","bpmnFactory"];function kv(e){return!e||!e.trim()}function Yt(e,t,n,i){Je.call(this,e,t,n),this._bpmnRules=i}ie(Yt,Je),Yt.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],Yt.prototype.getHandlers=function(){var e=Je.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=ha,e["element.updateProperties"]=ga,e["canvas.updateRoot"]=hc,e["lane.add"]=Ap,e["lane.resize"]=va,e["lane.split"]=Tp,e["lane.updateRefs"]=mc,e["group.updateRefs"]=_a,e["id.updateClaim"]=gc,e["element.setColor"]=Op,e["element.updateLabel"]=Mv,e},Yt.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},Yt.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)},Yt.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},Yt.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},Yt.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},Yt.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},Yt.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},Yt.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Yt.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Yt.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},Yt.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},Yt.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},Yt.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},Yt.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function Dv(){}Dv.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||ve(t.source||e.source),t.connectionEnd||ve(t.target||e.target)]};var vc=20,pA=5,yc=Math.round,Ov=20,fA={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function dA(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function hA(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function Lv(e,t,n){var i=Wt(t,e,pA),r=n.split(":")[0],o=yc((t.x-e.x)/2+e.x),a=yc((t.y-e.y)/2+e.y),s,c,u=hA(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=dA(i,r),c=l?"h:v":"v:h",p?l?(f=a===e.y,s={x:e.x+vc*(/l/.test(r)?-1:1),y:f?a+vc:a}):(f=o===e.x,s={x:f?o+vc:o,y:e.y+vc*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:Lp(e,s,c).concat(s),directions:c,turnNextDirections:f}}function mA(e,t,n){return Lv(e,t,n)}function gA(e,t,n){var i=Lv(t,e,Iv(n));return{waypoints:i.waypoints.slice().reverse(),directions:Iv(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=Lp(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function Iv(e){return e.split(":").reverse().join(":")}function yA(e,t,n){var i=yc((t.x-e.x)/2+e.x),r=yc((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 Lp(e,t,n){if(n=n||"h:h",!PA(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Bv(n)){var i=mA(e,t,n),r=gA(e,t,n),o=vA(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return yA(e,t,n)}function _A(e,t,n){var i=Lp(e,t,n);return i.unshift(e),i.push(t),jv(i)}function bA(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=Sx(o,"straight")[0]||"h:h",s=fA[a]||0,c=Wt(e,t,s),u=CA(c,a);n=n||ve(e),i=i||ve(t);var l=u.split(":"),p=$v(n,e,l[0],AA(c)),f=$v(i,t,l[1],c);return _A(p,f,u)}function xA(e,t,n,i,r,o){ge(n)&&(r=n,o=i,n=ve(e),i=ve(t)),o=D({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&wA(e,t,n,i,o),c||(c=o.connectionEnd&&RA(t,e,i,r),c)||(c=o.connectionStart&&SA(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:bA(e,t,n,i,o)}function EA(e,t,n){return e>=t&&e<=n}function Nv(e,t,n){var i={x:"width",y:"height"};return EA(t[e],n[e],n[e]+n[i[e]])}function wA(e,t,n,i,r){var o={},a,s;return s=Wt(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?Nv(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:Nv(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 SA(e,t,n,i){return Ip(e,t,n,i)}function RA(e,t,n,i){var r=i.slice().reverse();return r=Ip(e,t,n,r),r?r.reverse():null}function Ip(e,t,n,i){function r(l){return l.length<3?!0:l.length>4?!1:!!it(l,function(p,f){var d=l[f-1];return d&&Vo(p,d)<3})}function o(l,p,f){var d=xi(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(ch(l[d],p,Ov)||ch(l[d],f,Ov))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=Ip(e,t,n,u)),c&&xi(c)?null:c}function CA(e,t){if(Bv(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 PA(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Bv(e){return e&&/t|r|b|l/.test(e)}function AA(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 $v(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 jv(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return Qu(r,o,n,0)||t.push(n),t},[])}var TA=-10,MA=40,kA={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},DA={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},Np={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},ba={top:"t",right:"r",bottom:"b",left:"l"};function _c(e){this._elementRegistry=e}ie(_c,Dv),_c.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=Fv(r&&r[0],n)),a||(a=Fv(r&&r[r.length-1],i)),(y(e,"bpmn:Association")||y(e,"bpmn:DataAssociation"))&&r&&!Hv(n,i))return[].concat([o],r.slice(1,-1),[a]);var l=Qh(n,s)?kA:DA;return y(e,"bpmn:MessageFlow")?c=LA(n,i,l):(y(e,"bpmn:SequenceFlow")||Hv(n,i))&&(n===i?c={preferredLayouts:FA(n,e,l)}:y(n,"bpmn:BoundaryEvent")?c={preferredLayouts:HA(n,i,a,l)}:xa(n)||xa(i)?c={preferredLayouts:l.subProcess,preserveDocking:NA(n)}:y(n,"bpmn:Gateway")?c={preferredLayouts:l.fromGateway}:y(i,"bpmn:Gateway")?c={preferredLayouts:l.toGateway}:c={preferredLayouts:l.default}),c&&(c=D(c,t),u=jv(xA(n,i,o,a,r,c))),u||[o,a]};function OA(e){var t=e.host;return Wt(ve(e),t,TA)}function LA(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:IA(e,t)}}function IA(e,t){return y(t,"bpmn:Participant")?"source":y(e,"bpmn:Participant")?"target":xa(t)?"source":xa(e)||y(t,"bpmn:Event")?"target":y(e,"bpmn:Event")?"source":null}function NA(e){return xa(e)?"target":"source"}function Fv(e,t){return e?e.original||e:ve(t)}function Hv(e,t){return y(t,"bpmn:Activity")&&y(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function xa(e){return y(e,"bpmn:SubProcess")&&Oe(e)}function Lr(e,t){return e===t}function BA(e,t){return t.indexOf(e)!==-1}function vo(e){var t=/right|left/.exec(e);return t&&t[0]}function yo(e){var t=/top|bottom/.exec(e);return t&&t[0]}function zv(e,t){return Np[e]===t}function $A(e,t){var n=vo(e),i=Np[n];return t.indexOf(i)!==-1}function jA(e,t){var n=yo(e),i=Np[n];return t.indexOf(i)!==-1}function Vv(e){return e==="right"||e==="left"}function FA(e,t,n){var i=t.waypoints,r=i&&i.length&&Wt(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function HA(e,t,n,i){var r=ve(e),o=ve(t),a=OA(e),s,c,u=Lr(e.host,t),l=BA(a,["top","right","bottom","left"]),p=Wt(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?zA(a,l,e,t,n,i):(s=VA(a,p,l,i.isHorizontal),c=GA(a,p,l,i.isHorizontal),[s+":"+c])}function zA(e,t,n,i,r,o){var a=t?e:o.isHorizontal?yo(e):vo(e),s=ba[a],c;return t?Vv(e)?c=Gv("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=Gv("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function Gv(e,t,n,i){var r=MA;return!(Bp(e,i,n,r)||Bp(e,i,{x:n.x+n.width,y:n.y+n.height},r)||Bp(e,i,ve(t),r))}function Bp(e,t,n,i){return Math.abs(t[e]-n[e])<i}function VA(e,t,n,i){if(n)return ba[e];var r=yo(e),o=vo(e),a=yo(t),s=vo(t);if(i){if(Lr(r,a)||zv(o,s))return ba[r]}else if(Lr(o,s)||zv(r,a))return ba[o];return ba[i?o:r]}function GA(e,t,n,i){if(n)return Vv(e)?$A(e,t)||Lr(e,t)?"h":"v":jA(e,t)||Lr(e,t)?"v":"h";var r=yo(e),o=vo(e),a=yo(t),s=vo(t);return a&&!s?"v":s&&!a?"h":i?Lr(r,a)?"h":"v":Lr(o,s)?"v":"h"}_c.$inject=["elementRegistry"];function Wv(e){return D({original:e.point.original||e.point},e.actual)}function sr(e,t){this._elementRegistry=e,this._graphicsFactory=t}sr.$inject=["elementRegistry","graphicsFactory"],sr.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(Wv(i)),o.push(Wv(r)),o},sr.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}},sr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return Go(i,r,n)},sr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},sr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},sr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const $p={__init__:["modeling","bpmnUpdater"],__depends__:[uC,RC,PC,AC,iv,TP,kP,BP,zn,xp,uv],bpmnFactory:["type",Gn],bpmnUpdater:["type",Rn],elementFactory:["type",rr],modeling:["type",Yt],layouter:["type",_c],connectionDocking:["type",sr]};var WA=10,Uv=50,UA=250;function jp(e,t,n,i){for(var r;r=qA(e,n,t);)n=i(t,n,r);return n}function Fp(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 qA(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=KA(e);return it(r,function(o){if(o===n)return!1;var a=Wt(o,i,WA);return a==="intersect"})}function YA(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||UA,c=t.reference||"start";o||(o=QA);function u(h,m){return r==="n"?c==="start"?de(h).top-de(m).bottom:c==="center"?de(h).top-ve(m).y:de(h).top-de(m).top:r==="w"?c==="start"?de(h).left-de(m).right:c==="center"?de(h).left-ve(m).x:de(h).left-de(m).left:r==="s"?c==="start"?de(m).top-de(h).bottom:c==="center"?ve(m).y-de(h).bottom:de(m).bottom-de(h).bottom:c==="start"?de(m).left-de(h).right:c==="center"?ve(m).x-de(h).right:de(m).right-de(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=yn(f,function(h,m){var g=m.distance,S=m.weight;return g<0||g>s||(h[String(g)]||(h[String(g)]=0),h[String(g)]+=1*S,(!h.distance||h[h.distance]<h[String(g)])&&(h.distance=g)),h},{});return d.distance||i}function KA(e){var t=Hp(e);return e.host&&(t=t.concat(Hp(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(Hp(i))},[]))),t}function Hp(e){return ZA(e).concat(XA(e))}function XA(e){return e.incoming.map(function(t){return t.source})}function ZA(e){return e.outgoing.map(function(t){return t.target})}function QA(){return!0}var JA=100;function qv(e,t,n){e.on("autoPlace",JA,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}),s=t.appendShape(i,r,a,i.parent,o);return e.fire("autoPlace.end",{source:i,shape:s}),s}}qv.$inject=["eventBus","modeling","canvas"];function eT(e,t,n){n||(n={});var i=n.defaultDistance||Uv,r=ve(e),o=de(e);return{x:o.right+i+t.width/2,y:r.y}}function Yv(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}Yv.$inject=["eventBus","selection"];const tT={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",qv],autoPlaceSelectionBehavior:["type",Yv]};function Kv(e,t,n){var i=Qh(e,n);if(y(t,"bpmn:TextAnnotation"))return iT(e,t,i);if(Ce(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return rT(e,t,i);if(y(t,"bpmn:FlowNode"))return nT(e,t,i)}function nT(e,t,n){var i=de(e),r=ve(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=YA(e,{filter:function(d){return y(d,"bpmn:SequenceFlow")},direction:o.directionHint}),s=30,c=o.minDistance,u=o.baseOrientation;y(e,"bpmn:BoundaryEvent")&&(u=Wt(e,e.host,-25),u.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var l=n?{x:i.right+a+t.width/2,y:r.y+Xv(u,c,o)}:{x:r.x+Xv(u,c,o),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},f=n?{y:p}:{x:p};return jp(e,t,l,Fp(f))}function Xv(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function iT(e,t,n){var i=de(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};Qe(e)&&(r=ve(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 jp(e,t,r,Fp(a))}function rT(e,t,n){var i=de(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 jp(e,t,r,Fp(a))}function Zv(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return Kv(r,i,t)})}Zv.$inject=["eventBus","elementRegistry"];const bc={__depends__:[tT],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",Zv]},Qv=[Xh,Xo,$p,bc];function oT(e={}){$d(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new eo({container:t,moddleExtensions:e.moddleExtensions??Ka,additionalModules:[...Qv,...e.additionalModules??[]]})}var aT=new mo("ov"),sT=500;function Vt(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=aT,this._overlayDefaults=D({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=cT(n.getContainer()),this._init()}Vt.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Vt.prototype.get=function(e){if(gn(e)&&(e={id:e}),gn(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?Te(t.overlays,Wr({type:e.type})):t.overlays.slice():[]}else return e.type?Te(this._overlays,Wr({type:e.type})):e.id?this._overlays[e.id]:null},Vt.prototype.add=function(e,t,n){if(jt(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=D({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},Vt.prototype.remove=function(e){var t=this.get(e)||[];ge(t)||(t=[t]);var n=this;M(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(ai(i.html),ai(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)}})},Vt.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Vt.prototype.show=function(){xc(this._overlayRoot)},Vt.prototype.hide=function(){xc(this._overlayRoot,!1)},Vt.prototype.clear=function(){this._overlays={},this._overlayContainers=[],rs(this._overlayRoot)},Vt.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=St(t);i=o.x,r=o.y}Jv(n,i,r),Jt(e.html,"data-container-id",t.id)},Vt.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=St(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=St(i).height:s=i.height,o=t.bottom*-1+s}Jv(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Vt.prototype._createOverlayContainer=function(e){var t=rt('<div class="djs-overlays" />');ln(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},Vt.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";ey(this._overlayRoot,n)},Vt.prototype._getOverlayContainer=function(e,t){var n=it(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},Vt.prototype._addOverlay=function(e){var t=e.id,n=e.element,i=e.html,r,o;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),gn(i)&&(i=rt(i)),o=this._getOverlayContainer(n),r=rt('<div class="djs-overlay" data-overlay-id="'+t+'">'),ln(r,{position:"absolute"}),r.appendChild(i),e.type&&lt(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();xc(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())},Vt.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&&(Ot(r)&&r>t.scale||Ot(o)&&o<t.scale))&&(c=!1),xc(a,c),this._updateOverlayScale(e,t)},Vt.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),Ot(i)&&t.scale<i&&(a=(1/t.scale||1)*i),Ot(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),Ot(a)&&(s="scale("+a+","+a+")"),ey(o,s)},Vt.prototype._updateOverlaysVisibilty=function(e){var t=this;M(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},Vt.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){ai(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",sT,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&&lt(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 cT(e){var t=rt('<div class="djs-overlay-container" />');return ln(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function Jv(e,t,n){ln(e,{left:t+"px",top:n+"px"})}function xc(e,t){e.style.display=t===!1?"none":""}function ey(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Ec={__init__:["overlays"],overlays:["type",Vt]};function zp(e,t){t.invoke(U,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(zp,U),zp.$inject=["canvas","injector"];const uT={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",zp]};function Ea(e){return CSS.escape(e)}var lT={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function ty(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return lT[t]})}var pT="bjs-breadcrumbs-shown";function ny(e,t,n){var i=rt('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=lt(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var u=c.element,l=K(u),p=it(a,function(f){return f===l});p&&s()});function s(c){c&&(a=fT(c));var u=a.flatMap(function(p){var f=n.findRoot(pi(p))||n.findRoot(p.id);if(!f&&y(p,"bpmn:Process")){var d=t.find(function(g){var S=K(g);return S&&S.get("processRef")===p});f=d&&n.findRoot(d.id)}if(!f)return[];var h=ty(p.name||p.id),m=rt('<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(pT,l),u.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}ny.$inject=["eventBus","elementRegistry","canvas"];function fT(e){for(var t=K(e),n=[],i=t;i;i=i.$parent)(y(i,"bpmn:SubProcess")||y(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function iy(e,t){var n=null,i=new dT;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,!(!y(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})}iy.$inject=["eventBus","canvas"];function dT(){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 ry={x:180,y:160};function Ir(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}Ir.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)})}},Ir.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;y(a,"bpmn:SubProcess")&&!o.isExpanded&&n.push(a),mT(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},Ir.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=hT(e),i={x:n.x-ry.x,y:n.y-ry.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)})},Ir.prototype._moveToDiPlane=function(e,t){var n=oy(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},Ir.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},Ir.$inject=["eventBus","moddle"];function oy(e){return y(e,"bpmndi:BPMNDiagram")?e:oy(e.$parent)}function hT(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=de(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),ds(t)}function mT(e,t){var n=e.$parent;return!(!y(n,"bpmn:SubProcess")||n===t.bpmnElement||Ce(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var wc=250,gT='<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 cr(e,t,n,i,r){U.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",wc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",wc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],wc,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"],wc,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(cr,U),cr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},cr.prototype._canDrillDown=function(e){var t=this._canvas;return y(e,"bpmn:SubProcess")&&t.findRoot(pi(e))},cr.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=K(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;lt(i.html).toggle(vT,!r)}},cr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=K(e),r=n.get({element:e,type:"drilldown"});r.length&&this._removeOverlay(e);var o=rt('<button type="button" class="bjs-drilldown">'+gT+"</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(pi(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},cr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},cr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const yT={__depends__:[Ec,xp,uT],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",ny],drilldownCentering:["type",iy],drilldownOverlayBehavior:["type",cr],subprocessCompatibility:["type",Ir]};function ur(e){pt.call(this,e)}ie(ur,pt),ur.prototype._modules=[Xh,yT,Ec,zn,Xo],ur.prototype._moddleExtensions={};var Sc="keyboard.keydown",_T="keyboard.keyup",bT=1e3,ay="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 pn(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(ay));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}pn.$inject=["config.keyboard","eventBus"],pn.prototype._keydownHandler=function(e){this._keyHandler(e,Sc)},pn.prototype._keyupHandler=function(e){this._keyHandler(e,_T)},pn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Sc,i),n&&e.preventDefault()}},pn.prototype._isEventIgnored=function(e){return!1},pn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(ay)),this.unbind(),e=this._node=this._target,be.bind(e,"keydown",this._keydownHandler),be.bind(e,"keyup",this._keyupHandler),this._fire("bind")},pn.prototype.getBinding=function(){return this._node},pn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),be.unbind(e,"keydown",this._keydownHandler),be.unbind(e,"keyup",this._keyupHandler)),this._node=null},pn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},pn.prototype.addListener=function(e,t,n){Ft(e)&&(n=t,t=e,e=bT),this._eventBus.on(n||Sc,e,t)},pn.prototype.removeListener=function(e,t){this._eventBus.off(t||Sc,e)},pn.prototype.hasModifier=HC,pn.prototype.isCmd=wn,pn.prototype.isShift=lp,pn.prototype.isKey=Nt;var xT=500;function _o(e,t){var n=this;e.on("editorActions.init",xT,function(i){var r=i.editorActions;n.registerBindings(t,r)})}_o.$inject=["eventBus","keyboard"],_o.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(UC(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(qC(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(zC(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(VC(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(GC(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(WC(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Nt(["+","Add","="],r)&&wn(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Nt(["-","Subtract"],r)&&wn(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(Nt("0",r)&&wn(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(Nt(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const Vp={__init__:["keyboard","keyboardBindings"],keyboard:["type",pn],keyboardBindings:["type",_o]};var ET={moveSpeed:50,moveSpeedAccelerated:200};function sy(e,t,n){var i=this;this._config=D({},ET,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})}}sy.$inject=["config.keyboardMove","keyboard","canvas"];const cy={__depends__:[Vp],__init__:["keyboardMove"],keyboardMove:["type",sy]};var wT=15;function uy(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=Tr(s),p=Qn(l,c);if(!n.dragging&&ST(p)>wT&&(n.dragging=!0,u===0&&Ng(e),Zs("grab")),n.dragging){var f=n.last||n.start;p=Qn(l,f),t.scroll({dx:p.x,dy:p.y}),n.last=l}s.preventDefault()}function o(s){be.unbind(document,"mousemove",r),be.unbind(document,"mouseup",o),n=null,Ig()}function a(s){if(!wr(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:Tr(s)},be.bind(document,"mousemove",r),be.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}uy.$inject=["eventBus","canvas"];function ST(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const ly={__init__:["moveCanvas"],moveCanvas:["type",uy]};function py(e,t){var n=sl(e.min),i=sl(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function RT(e,t){return Math.max(e.min,Math.min(e.max,t))}var CT=Math.sign||function(e){return e>=0?1:-1},Gp={min:.2,max:4},fy=10,PT=.1,AT=.75;function hi(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=dn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||AT;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}hi.$inject=["config.zoomScroll","eventBus","canvas"],hi.prototype.scroll=function(t){this._canvas.scroll(t)},hi.prototype.reset=function(){this._canvas.zoom("fit-viewport")},hi.prototype.zoom=function(t,n){var i=py(Gp,fy*2);this._totalDelta+=t,Math.abs(this._totalDelta)>PT&&(this._zoom(t,n,i),this._totalDelta=0)},hi.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||Vm()&&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))*CT(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)}},hi.prototype.stepZoom=function(t,n){var i=py(Gp,fy);this._zoom(t,n,i)},hi.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=sl(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(RT(Gp,s),t)},hi.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&be[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},hi.prototype._init=function(e){this.toggle(e)};const dy={__init__:["zoomScroll"],zoomScroll:["type",hi]};function wa(e){ur.call(this,e)}ie(wa,ur),wa.prototype._navigationModules=[cy,ly,dy],wa.prototype._modules=[].concat(ur.prototype._modules,wa.prototype._navigationModules);function Wp(e){return e&&e[e.length-1]}function hy(e){return e.y}function my(e){return e.x}var TT={left:my,center:my,right:function(e){return e.x+e.width},top:hy,middle:hy,bottom:function(e){return e.y+e.height}};function bo(e,t){this._modeling=e,this._rules=t}bo.$inject=["modeling","rules"],bo.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}},bo.prototype._isType=function(e,t){return t.indexOf(e)!==-1},bo.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=Wp(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=ti(a,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return o[e]=Wp(c).center,o;u=t[0],t=ti(t,function(f){return f[i]+f[r]}),l=Wp(t),o[e]=p(u,l)}return o},bo.prototype.trigger=function(e,t){var n=this._modeling,i,r=Te(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),ge(i)&&(r=i),!(r.length<2||!i)){var o=TT[t],a=ti(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const MT={__init__:["alignElements"],alignElements:["type",bo]},kT=new mo;function xo(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}xo.$inject=["eventBus"],xo.prototype.schedule=function(e,t=kT.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},xo.prototype._schedule=function(e,t){const n=DT();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}},xo.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},xo.prototype._cancel=function(e){clearTimeout(e.executionId)};function DT(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const OT={scheduler:["type",xo]};var LT="djs-element-hidden",Rc=".entry",IT=1e3,gy=8,NT=300;function Ct(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}Ct.$inject=["canvas","elementRegistry","eventBus","scheduler"],Ct.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=ge(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=ge(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},Ct.prototype._createContainer=function(){var e=rt('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},Ct.prototype.registerProvider=function(e,t){t||(t=e,e=IT),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},Ct.prototype.getEntries=function(e){var t=this._getProviders(),n=ge(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return M(t,function(r){if(Ft(r[n])){var o=r[n](e);Ft(o)?i=o(i):M(o,function(a,s){i[s]=a})}}),i},Ct.prototype.trigger=function(e,t,n){var i=this,r,o,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(r=Jt(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},NT);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,o,n)},Ct.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(Ft(s)){if(t==="click")return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},Ct.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))}},Ct.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Ct.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=rt(r.html||'<div class="entry" draggable="true"></div>'),c;Jt(s,"data-action",o),c=Xe("[data-group="+Ea(a)+"]",n),c||(c=rt('<div class="group"></div>'),Jt(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&BT(s,r.className),r.title&&Jt(s,"title",r.title),r.imageUrl&&(i=rt("<img>"),Jt(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),lt(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},Ct.prototype._createHtml=function(e){var t=this,n=rt('<div class="djs-context-pad"></div>');return bn.bind(n,Rc,"click",function(i){t.trigger("click",i)}),bn.bind(n,Rc,"dragstart",function(i){t.trigger("dragstart",i)}),bn.bind(n,Rc,"mouseover",function(i){t.trigger("mouseover",i)}),bn.bind(n,Rc,"mouseout",function(i){t.trigger("mouseout",i)}),be.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},Ct.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()&&jT(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},Ct.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},Ct.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return ge(e)!==ge(n)?!1:ge(e)?e.length===n.length&&yr(e,function(i){return n.includes(i)}):n===e},Ct.prototype.isShown=function(){return this.isOpen()&&lt(this._current.html).has("open")},Ct.prototype.show=function(){this.isOpen()&&(lt(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},Ct.prototype.hide=function(){this.isOpen()&&(lt(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},Ct.prototype._getPosition=function(e){if(!ge(e)&&Qe(e)){var t=this._canvas.viewbox(),n=$T(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+gy*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+gy*this._canvas.zoom(),top:s.top-a.top}},Ct.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")},Ct.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=ge(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,LT)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},Ct.prototype._getTargetBounds=function(e){var t=this,n=ge(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 BT(e,t){var n=lt(e);t=ge(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function $T(e){return e.waypoints[e.waypoints.length-1]}function jT(e,t){return e=ge(e)?e:[e],t=ge(t)?t:[t],e.length===t.length&&yr(e,function(n){return t.includes(n)})}const vy={__depends__:[Xs,OT,Ec],contextPad:["type",Ct]};var Cc,dt,yy,lr,_y,by,xy,Up,Pc,Sa,Ey,qp,Yp,Kp,Ac={},Tc=[],FT=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Mc=Array.isArray;function ki(e,t){for(var n in t)e[n]=t[n];return e}function Xp(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function wy(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?Cc.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 kc(e,a,i,r,null)}function kc(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??++yy,__i:-1,__u:0};return r==null&&dt.vnode!=null&&dt.vnode(o),o}function Dc(e){return e.children}function Oc(e,t){this.props=e,this.context=t}function Nr(e,t){if(t==null)return e.__?Nr(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"?Nr(e):null}function HT(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=ki({},t);o.__v=t.__v+1,dt.vnode&&dt.vnode(o),Zp(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??Nr(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,ky(i,o,r),t.__e=t.__=null,o.__e!=n&&Sy(o)}}function Sy(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}),Sy(e)}function Ry(e){(!e.__d&&(e.__d=!0)&&lr.push(e)&&!Lc.__r++||_y!=dt.debounceRendering)&&((_y=dt.debounceRendering)||by)(Lc)}function Lc(){try{for(var e,t=1;lr.length;)lr.length>t&&lr.sort(xy),e=lr.shift(),t=lr.length,HT(e)}finally{lr.length=Lc.__r=0}}function Cy(e,t,n,i,r,o,a,s,c,u,l){var p,f,d,h,m,g,S=i&&i.__k||Tc,E=t.length;for(c=zT(n,t,S,c,E),p=0;p<E;p++)(d=n.__k[p])!=null&&(f=d.__i!=-1&&S[d.__i]||Ac,d.__i=p,g=Zp(e,d,f,r,o,a,s,c,u,l),h=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&Qp(f.ref,null,d),l.push(d.ref,d.__c||h,d)),m==null&&h!=null&&(m=h),4&d.__u?(c=Py(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 zT(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]=kc(null,a,null,null,null):Mc(a)?a=e.__k[o]=kc(Dc,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=kc(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=VT(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=Nr(s)),Oy(s,s));return i}function Py(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=Py(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Nr(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function VT(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 Ay(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||FT.test(t)?n:n+"px"}function Ic(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||Ay(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||Ay(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(Ey,"$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[Sa]=i[Sa]:(n[Sa]=qp,e.addEventListener(t,o?Kp:Yp,o)):e.removeEventListener(t,o?Kp:Yp,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 Ty(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Pc]==null)t[Pc]=qp++;else if(t[Pc]<n[Sa])return;return n(dt.event?dt.event(t):t)}}}function Zp(e,t,n,i,r,o,a,s,c,u){var l,p,f,d,h,m,g,S,E,x,b,w,T,O,P,j,F=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(l=dt.__b)&&l(t);e:if(typeof F=="function"){p=a.length;try{if(E=t.props,x=F.prototype&&F.prototype.render,b=(l=F.contextType)&&i[l.__c],w=l?b?b.props.value:l.__:i,n.__c?S=(f=t.__c=n.__c).__=f.__E:(x?t.__c=f=new F(E,w):(t.__c=f=new Oc(E,w),f.constructor=F,f.render=WT),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&&F.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=ki({},f.__s)),ki(f.__s,F.getDerivedStateFromProps(E,f.__s))),h=f.props,m=f.state,f.__v=t,d)x&&F.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),x&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(x&&F.getDerivedStateFromProps==null&&E!==h&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(E,w),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(E,f.__s,w)===!1){t.__v!=n.__v&&(f.props=E,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(I){I&&(I.__=t)}),Tc.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&a.push(f),s=Nr(n);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(E,f.__s,w),x&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(h,m,g)})}if(f.context=w,f.props=E,f.__P=e,f.__e=!1,T=dt.__r,O=0,x)f.state=f.__s,f.__d=!1,T&&T(t),l=f.render(f.props,f.state,f.context),Tc.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&&++O<25);f.state=f.__s,f.getChildContext!=null&&(i=ki(ki({},i),f.getChildContext())),x&&!d&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(h,m)),P=l!=null&&l.type===Dc&&l.key==null?Dy(l.props.children):l,s=Cy(e,Mc(P)?P:[P],t,n,i,r,o,a,s,c,u),f.base=t.__e,t.__u&=-161,f.__h.length&&a.push(f),S&&(f.__E=f.__=null)}catch(I){if(a.length=p,t.__v=null,c||o!=null){if(I.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;o!=null&&(o[o.indexOf(s)]=null),t.__e=s}else if(o!=null)for(j=o.length;j--;)Xp(o[j])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),I.then||My(t),dt.__e(I,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=GT(n.__e,t,n,i,r,o,a,c,u);return(l=dt.diffed)&&l(t),128&t.__u?void 0:s}function My(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(My))}function ky(e,t,n){for(var i=0;i<n.length;i++)Qp(n[i],n[++i],n[++i]);dt.__c&&dt.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){dt.__e(o,r.__v)}})}function Dy(e){return typeof e!="object"||e==null||e.__b>0?e:Mc(e)?e.map(Dy):e.constructor!==void 0?null:ki({},e)}function GT(e,t,n,i,r,o,a,s,c){var u,l,p,f,d,h,m,g=n.props||Ac,S=t.props,E=t.type;if(E=="svg"?r="http://www.w3.org/2000/svg":E=="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==!!E&&(E?d.localName==E:d.nodeType==3)){e=d,o[u]=null;break}}if(e==null){if(E==null)return document.createTextNode(S);e=document.createElementNS(r,E,S.is&&S),s&&(dt.__m&&dt.__m(t,o),s=!1),o=null}if(E==null)g===S||s&&e.data==S||(e.data=S);else{if(o=E=="textarea"&&S.defaultValue!=null?null:o&&Cc.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 S||u=="value"&&"defaultValue"in S||u=="checked"&&"defaultChecked"in S||Ic(e,u,null,d,r);for(u in S)d=S[u],u=="children"?f=d:u=="dangerouslySetInnerHTML"?l=d:u=="value"?h=d:u=="checked"?m=d:s&&typeof d!="function"||g[u]===d||Ic(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=""),Cy(t.type=="template"?e.content:e,Mc(f)?f:[f],t,n,i,E=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&Nr(n,0),s,c),o!=null)for(u=o.length;u--;)Xp(o[u]);s&&E!="textarea"||(u="value",E=="progress"&&h==null?e.removeAttribute("value"):h!=null&&(h!==e[u]||E=="progress"&&!h||E=="option"&&h!=g[u])&&Ic(e,u,h,g[u],r),u="checked",m!=null&&m!=e[u]&&Ic(e,u,m,g[u],r))}return e}function Qp(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){dt.__e(r,n)}}function Oy(e,t,n){var i,r;if(dt.unmount&&dt.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||Qp(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){dt.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&Oy(i[r],t,n||typeof e.type!="function");n||Xp(e.__e),e.__c=e.__=e.__e=void 0}function WT(e,t,n){return this.constructor(e,n)}function Ly(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),dt.__&&dt.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],Zp(t,e=t.__k=wy(Dc,null,[e]),r||Ac,Ac,t.namespaceURI,r?null:t.firstChild?Cc.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),ky(o,e,a),e.props.children=null}Cc=Tc.slice,dt={__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}},yy=0,Oc.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=ki({},this.state),typeof e=="function"&&(e=e(ki({},n),this.props)),e&&ki(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Ry(this))},Oc.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Ry(this))},Oc.prototype.render=Dc,lr=[],by=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,xy=function(e,t){return e.__v.__b-t.__v.__b},Lc.__r=0,Up=Math.random().toString(8),Pc="__d"+Up,Sa="__a"+Up,Ey=/(PointerCapture)$|Capture$/i,qp=0,Yp=Ty(!1),Kp=Ty(!0);var Iy=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,Iy(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},Ny=new Map;function UT(e){var t=Ny.get(this);return t||(t=new Map,Ny.set(this,t)),(t=Iy(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 et=UT.bind(wy),Eo,Pt,Jp,By,Ra=0,$y=[],Bt=dt,jy=Bt.__b,Fy=Bt.__r,Hy=Bt.diffed,zy=Bt.__c,Vy=Bt.unmount,Gy=Bt.__;function Nc(e,t){Bt.__h&&Bt.__h(Pt,e,Ra||t),Ra=0;var n=Pt.__H||(Pt.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function ef(e){return Ra=1,qT(Uy,e)}function qT(e,t,n){var i=Nc(Eo++,2);if(i.t=e,!i.__c&&(i.__=[Uy(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=Pt,!Pt.__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};Pt.__f=!0;var o=Pt.shouldComponentUpdate,a=Pt.componentWillUpdate;Pt.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)},Pt.shouldComponentUpdate=r}return i.__N||i.__}function Bc(e,t){var n=Nc(Eo++,3);!Bt.__s&&rf(n.__H,t)&&(n.__=e,n.u=t,Pt.__H.__h.push(n))}function tf(e,t){var n=Nc(Eo++,4);!Bt.__s&&rf(n.__H,t)&&(n.__=e,n.u=t,Pt.__h.push(n))}function $c(e){return Ra=5,Di(function(){return{current:e}},[])}function Di(e,t){var n=Nc(Eo++,7);return rf(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Ca(e,t){return Ra=8,Di(function(){return e},t)}function YT(){for(var e;e=$y.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(jc),t.__h.some(nf),t.__h=[]}catch(n){t.__h=[],Bt.__e(n,e.__v)}}}Bt.__b=function(e){Pt=null,jy&&jy(e)},Bt.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Gy&&Gy(e,t)},Bt.__r=function(e){Fy&&Fy(e),Eo=0;var t=(Pt=e.__c).__H;t&&(Jp===Pt?(t.__h=[],Pt.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(jc),t.__h.some(nf),t.__h=[],Eo=0)),Jp=Pt},Bt.diffed=function(e){Hy&&Hy(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&($y.push(t)!==1&&By===Bt.requestAnimationFrame||((By=Bt.requestAnimationFrame)||KT)(YT)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),Jp=Pt=null},Bt.__c=function(e,t){t.some(function(n){try{n.__h.some(jc),n.__h=n.__h.filter(function(i){return!i.__||nf(i)})}catch(i){t.some(function(r){r.__h&&(r.__h=[])}),t=[],Bt.__e(i,n.__v)}}),zy&&zy(e,t)},Bt.unmount=function(e){Vy&&Vy(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{jc(i)}catch(r){t=r}}),n.__H=void 0,t&&Bt.__e(t,n.__v))};var Wy=typeof requestAnimationFrame=="function";function KT(e){var t,n=function(){clearTimeout(i),Wy&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);Wy&&(t=requestAnimationFrame(n))}function jc(e){var t=Pt,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),Pt=t}function nf(e){var t=Pt;e.__c=e.__(),Pt=t}function rf(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function Uy(e,t){return typeof t=="function"?t(e):t}function XT(e){const{navigationStack:t,setNavigationStack:n}=e,i=Di(()=>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 et`
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}},dt.prototype._setDefinitions=function(e){this._definitions=e},dt.prototype.getModules=function(){return this._modules},dt.prototype.clear=function(){this.getDefinitions()&&Xi.prototype.clear.call(this)},dt.prototype.destroy=function(){Xi.prototype.destroy.call(this),si(this._container)},dt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},dt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},dt.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=Qe(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},dt.prototype.getDefinitions=function(){return this._definitions},dt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},dt.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=D(ni(n,["additionalModules"]),{canvas:D({},n.canvas,{container:e}),modules:a});Xi.call(this,s),n&&n.container&&this.attachTo(n.container)},dt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},dt.prototype._createContainer=function(e){const t=st('<div class="bjs-container"></div>');return pn(t,{width:Yh(e.width),height:Yh(e.height),position:e.position}),t},dt.prototype._createModdle=function(e){const t=D({},this._moddleExtensions,e.moddleExtensions);return new od(t)},dt.prototype._modules=[];function ws(e,t){return e.warnings=t,e}function L1(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 I1={width:"100%",height:"100%",position:"relative"};function Yh(e){return e+(xe(e)?"px":"")}function N1(e,t){return t&&rt(e.diagrams,function(n){return n.id===t})||null}function B1(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Gh+"</a>",i=st(n);pn(Qe("svg",i),Wh),pn(i,Uh,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),Ee.bind(i,"click",function(r){O1(),r.preventDefault()})}function no(e){dt.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(no,dt),no.prototype._createModdle=function(e){var t=dt.prototype._createModdle.call(this,e);return t.ids=new ai([32,36,1]),t},no.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 Ie(e,t){return v(e,"bpmn:CallActivity")?!1:v(e,"bpmn:SubProcess")?(t=t||He(e),t&&v(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):v(e,"bpmn:Participant")?!!K(e).processRef:!0}function Vt(e){if(!(!v(e,"bpmn:Participant")&&!v(e,"bpmn:Lane"))){var t=He(e).isHorizontal;return t===void 0?!0:t}}function $1(e){return e&&K(e).isInterrupting!==!1}function on(e){return e&&!!K(e).triggeredByEvent}function io(e,t){var n=K(e).eventDefinitions;return Bi(n,function(i){return v(i,t)})}function j1(e){return io(e,"bpmn:ErrorEventDefinition")}function F1(e){return io(e,"bpmn:EscalationEventDefinition")}function H1(e){return io(e,"bpmn:CompensateEventDefinition")}var Tr={width:90,height:20},Kh=15;function Zi(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 Ss(e){return Me(e.label)}function z1(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=V1(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-=Kh:a+=Kh,{x:a,y:s}}function V1(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)];return{x:n.x+(i.x-n.x)/2,y:n.y+(i.y-n.y)/2}}function al(e){return e.waypoints?z1(e.waypoints):v(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Tr.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Tr.height/2}}function G1(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(Tr.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=al(t),i=Tr),D({x:n.x-i.width/2,y:n.y-i.height/2},i)}function Xh(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 W1(e){var t=e.categoryValueRef;return t&&t.value||""}function On(e){var t=e.businessObject,n=Xh(t);if(n)return n==="categoryValueRef"?W1(t):t[n]||""}function U1(e,t){var n=e.businessObject,i=Xh(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function q1(e){return Me(e)&&Zi(e.labelTarget)}var ro=7;function Zh(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 Xo(e){const t=new Map;return M(Ju(e),n=>{M(Zh(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 sl="hsl(225, 10%, 15%)",Y1="white";function pi(e,t){return Bi(e.eventDefinitions,function(n){return n.$type===t})}function K1(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function X1(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function Le(e,t,n){var i=He(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||Y1}function te(e,t,n){var i=He(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||sl}function Zo(e,t,n,i){var r=He(e),o=r.get("label");return i||o&&o.get("color:color")||t||te(e,n)}function Qh(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 Cr(r)}function cl(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 Cr(a)}function Z1(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 Cr(s)}function Q1(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 Cr(o)}function Qo(e,t={}){return{width:$n(e,t),height:En(e,t)}}function $n(e,t={}){return yn(t,"width")?t.width:e.width}function En(e,t={}){return yn(t,"height")?t.height:e.height}var J1=new ai,eS=10,Rs=3,tS=1.5,Cs=10,nS=4,oo=.95,iS=1,rS=.25;function Mr(e,t,n,i,r,o,a){xi.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:sl,strokeWidth:2,fill:"white"})}function p(C){return n.computeStyle(C,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:sl,strokeWidth:2})}function f(C,_){var{ref:y={x:0,y:0},scale:k=1,element:I,parentGfx:W=r._svg}=_,oe=le("marker",{id:C,viewBox:"0 0 20 20",refX:y.x,refY:y.y,markerWidth:20*k,markerHeight:20*k,orient:"auto"});we(oe,I);var Ae=Qe(":scope > defs",W);Ae||(Ae=le("defs"),we(W,Ae)),we(Ae,oe)}function d(C,_,y,k){var I=J1.nextPrefixed("marker-");return h(C,I,_,y,k),"url(#"+I+")"}function h(C,_,y,k,I){if(y==="sequenceflow-end"){var W=le("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=le("circle",{cx:6,cy:6,r:3.5,...l({fill:k,stroke:I,strokeWidth:1,strokeDasharray:[1e4,1]})});f(_,{element:oe,ref:{x:6,y:6},parentGfx:C})}if(y==="messageflow-end"){var Ae=le("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...l({fill:k,stroke:I,strokeWidth:1,strokeDasharray:[1e4,1]})});f(_,{element:Ae,ref:{x:8.5,y:5},parentGfx:C})}if(y==="association-start"){var je=le("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:I,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(_,{element:je,ref:{x:1,y:10},scale:.5,parentGfx:C})}if(y==="association-end"){var _t=le("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:I,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(_,{element:_t,ref:{x:11,y:10},scale:.5,parentGfx:C})}if(y==="conditional-flow-marker"){var Je=le("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...l({fill:k,stroke:I})});f(_,{element:Je,ref:{x:-1,y:10},scale:.5,parentGfx:C})}if(y==="conditional-default-flow-marker"){var kt=le("path",{d:"M 6 4 L 10 16",...l({stroke:I,fill:"none"})});f(_,{element:kt,ref:{x:0,y:10},scale:.5,parentGfx:C})}}function m(C,_,y,k,I={}){Ft(k)&&(I=k,k=0),k=k||0,I=l(I);var W=_/2,oe=y/2,Ae=le("circle",{cx:W,cy:oe,r:Math.round((_+y)/4-k),...I});return we(C,Ae),Ae}function g(C,_,y,k,I,W){Ft(I)&&(W=I,I=0),I=I||0,W=l(W);var oe=le("rect",{x:I,y:I,width:_-I*2,height:y-I*2,rx:k,ry:k,...W});return we(C,oe),oe}function R(C,_,y,k){var I=_/2,W=y/2,oe=[{x:I,y:0},{x:_,y:W},{x:I,y},{x:0,y:W}],Ae=oe.map(function(_t){return _t.x+","+_t.y}).join(" ");k=l(k);var je=le("polygon",{...k,points:Ae});return we(C,je),je}function E(C,_,y,k){y=p(y);var I=Vo(_,y,k);return we(C,I),I}function x(C,_,y){return E(C,_,y,5)}function b(C,_,y){y=p(y);var k=le("path",{...y,d:_});return we(C,k),k}function w(C,_,y,k){return b(_,y,D({"data-marker":C},k))}function T(C){return wt[C]}function L(C){return function(_,y,k){return T(C)(_,y,k)}}var A={"bpmn:MessageEventDefinition":function(C,_,y={},k){var I=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.235,my:.315}}),W=k?te(_,c,y.stroke):Le(_,s,y.fill),oe=k?Le(_,s,y.fill):te(_,c,y.stroke),Ae=b(C,I,{fill:W,stroke:oe,strokeWidth:1});return Ae},"bpmn:TimerEventDefinition":function(C,_,y={}){var k=y.width||_.width,I=y.height||_.height,W=y.width?1:2,oe=m(C,k,I,.2*I,{fill:Le(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:W}),Ae=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:k,containerHeight:I,position:{mx:.5,my:.5}});b(C,Ae,{stroke:te(_,c,y.stroke),strokeWidth:W});for(var je=0;je<12;je++){var _t=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:k,containerHeight:I,position:{mx:.5,my:.5}}),Je=k/2,kt=I/2;b(C,_t,{strokeWidth:1,stroke:te(_,c,y.stroke),transform:"rotate("+je*30+","+kt+","+Je+")"})}return oe},"bpmn:EscalationEventDefinition":function(C,_,y={},k){var I=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.5,my:.2}}),W=k?te(_,c,y.stroke):Le(_,s,y.fill);return b(C,I,{fill:W,stroke:te(_,c,y.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(C,_,y={}){var k=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.5,my:.222}});return b(C,k,{fill:Le(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(C,_,y={},k){var I=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.57,my:.263}}),W=k?te(_,c,y.stroke):Le(_,s,y.fill);return b(C,I,{fill:W,stroke:te(_,c,y.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(C,_,y={},k){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=k?te(_,c,y.stroke):Le(_,s,y.fill);return b(C,I,{fill:W,stroke:te(_,c,y.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(C,_,y={},k){var I=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.638,my:-.055}}),W=k?te(_,c,y.stroke):"none",oe=b(C,I,{fill:W,stroke:te(_,c,y.stroke),strokeWidth:1});return zh(oe,45),oe},"bpmn:CompensateEventDefinition":function(C,_,y={},k){var I=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.22,my:.5}}),W=k?te(_,c,y.stroke):Le(_,s,y.fill);return b(C,I,{fill:W,stroke:te(_,c,y.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(C,_,y={},k){var I=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.5,my:.2}}),W=k?te(_,c,y.stroke):Le(_,s,y.fill);return b(C,I,{strokeWidth:1,fill:W,stroke:te(_,c,y.stroke)})},"bpmn:MultipleEventDefinition":function(C,_,y={},k){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=k?te(_,c,y.stroke):Le(_,s,y.fill);return b(C,I,{fill:W,stroke:te(_,c,y.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(C,_,y={}){var k=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,k,{fill:Le(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(C,_,y={}){var k=m(C,_.width,_.height,8,{fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke),strokeWidth:4});return k}};function F(C,_,y={},k){var I=K(C),W=K1(I),oe=k||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):pi(I,"bpmn:MessageEventDefinition")?A["bpmn:MessageEventDefinition"](_,oe,y,W):pi(I,"bpmn:TimerEventDefinition")?A["bpmn:TimerEventDefinition"](_,oe,y,W):pi(I,"bpmn:ConditionalEventDefinition")?A["bpmn:ConditionalEventDefinition"](_,oe,y,W):pi(I,"bpmn:SignalEventDefinition")?A["bpmn:SignalEventDefinition"](_,oe,y,W):pi(I,"bpmn:EscalationEventDefinition")?A["bpmn:EscalationEventDefinition"](_,oe,y,W):pi(I,"bpmn:LinkEventDefinition")?A["bpmn:LinkEventDefinition"](_,oe,y,W):pi(I,"bpmn:ErrorEventDefinition")?A["bpmn:ErrorEventDefinition"](_,oe,y,W):pi(I,"bpmn:CancelEventDefinition")?A["bpmn:CancelEventDefinition"](_,oe,y,W):pi(I,"bpmn:CompensateEventDefinition")?A["bpmn:CompensateEventDefinition"](_,oe,y,W):pi(I,"bpmn:TerminateEventDefinition")?A["bpmn:TerminateEventDefinition"](_,oe,y,W):null}var H={ParticipantMultiplicityMarker:function(C,_,y={}){var k=$n(_,y),I=En(_,y),W=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:k,containerHeight:I,position:{mx:(k/2-6)/k,my:(I-15)/I}});w("participant-multiplicity",C,W,{strokeWidth:2,fill:Le(_,s,y.fill),stroke:te(_,c,y.stroke)})},SubProcessMarker:function(C,_,y={}){var k=g(C,14,14,0,{strokeWidth:1,fill:Le(_,s,y.fill),stroke:te(_,c,y.stroke)});Kt(k,_.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}});w("sub-process",C,I,{fill:Le(_,s,y.fill),stroke:te(_,c,y.stroke)})},ParallelMarker:function(C,_,y){var k=$n(_,y),I=En(_,y),W=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:k,containerHeight:I,position:{mx:(k/2+y.parallel)/k,my:(I-20)/I}});w("parallel",C,W,{fill:Le(_,s,y.fill),stroke:te(_,c,y.stroke)})},SequentialMarker:function(C,_,y){var k=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2+y.seq)/_.width,my:(_.height-19)/_.height}});w("sequential",C,k,{fill:Le(_,s,y.fill),stroke:te(_,c,y.stroke)})},CompensationMarker:function(C,_,y){var k=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2+y.compensation)/_.width,my:(_.height-13)/_.height}});w("compensation",C,k,{strokeWidth:1,fill:Le(_,s,y.fill),stroke:te(_,c,y.stroke)})},LoopMarker:function(C,_,y){var k=$n(_,y),I=En(_,y),W=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:k,containerHeight:I,position:{mx:(k/2+y.loop)/k,my:(I-7)/I}});w("loop",C,W,{strokeWidth:1.5,fill:"none",stroke:te(_,c,y.stroke),strokeMiterlimit:.5})},AdhocMarker:function(C,_,y){var k=$n(_,y),I=En(_,y),W=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:k,containerHeight:I,position:{mx:(k/2+y.adhoc)/k,my:(I-15)/I}});w("adhoc",C,W,{strokeWidth:1,fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke)})}};function N(C,_,y,k){H[C](_,y,k)}function z(C,_,y=[],k={}){k={fill:k.fill,stroke:k.stroke,width:$n(_,k),height:En(_,k)};var I=K(_),W=y.includes("SubProcessMarker");W?k={...k,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:k={...k,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},I.get("isForCompensation")&&y.push("CompensationMarker"),v(I,"bpmn:AdHocSubProcess")&&(y.push("AdhocMarker"),W||D(k,{compensation:k.compensation-18}));var oe=I.get("loopCharacteristics"),Ae=oe&&oe.get("isSequential");oe&&(D(k,{compensation:k.compensation-18}),y.includes("AdhocMarker")&&D(k,{seq:-23,loop:-18,parallel:-24}),Ae===void 0&&y.push("LoopMarker"),Ae===!1&&y.push("ParallelMarker"),Ae===!0&&y.push("SequentialMarker")),y.includes("CompensationMarker")&&y.length===1&&D(k,{compensation:-8}),M(y,function(je){N(je,C,_,k)})}function ce(C,_,y={}){y=D({size:{width:100}},y);var k=o.createText(_||"",y);return Ne(k).add("djs-label"),we(C,k),k}function Be(C,_,y,k={}){var I=K(_),W=Qo({x:_.x,y:_.y,width:_.width,height:_.height},k);return ce(C,I.name,{align:y,box:W,padding:7,style:{fill:Zo(_,u,c,k.stroke)}})}function it(C,_,y={}){var k={width:_.width,height:_.height,x:_.width/2+_.x,y:_.height/2+_.y};return ce(C,On(_),{box:k,style:D({},o.getExternalStyle(),{fill:Zo(_,u,c,y.stroke)})})}function X(C,_,y,k={}){var I=Vt(y),W=ce(C,_,{box:{height:30,width:I?En(y,k):$n(y,k)},align:"center-middle",style:{fill:Zo(y,u,c,k.stroke)}});if(I){var oe=-1*En(y,k);xs(W,0,-oe,270)}}function ae(C,_,y={}){var{width:k,height:I}=Qo(_,y);return g(C,k,I,Cs,{...y,fill:Le(_,s,y.fill),fillOpacity:oo,stroke:te(_,c,y.stroke)})}function me(C,_,y={}){var k=K(_),I=Le(_,s,y.fill),W=te(_,c,y.stroke);return(k.get("associationDirection")==="One"||k.get("associationDirection")==="Both")&&(y.markerEnd=d(C,"association-end",I,W)),k.get("associationDirection")==="Both"&&(y.markerStart=d(C,"association-start",I,W)),y=ze(y,["markerStart","markerEnd"]),x(C,_.waypoints,{...y,stroke:W,strokeDasharray:"0, 5"})}function se(C,_,y={}){var k=Le(_,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=b(C,W,{fill:k,fillOpacity:oo,stroke:I}),Ae=K(_);if(X1(Ae)){var je=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.33,my:(_.height-18)/_.height}});b(C,je,{strokeWidth:2,fill:k,stroke:I})}return oe}function pe(C,_,y={}){return m(C,_.width,_.height,{fillOpacity:oo,...y,fill:Le(_,s,y.fill),stroke:te(_,c,y.stroke)})}function ee(C,_,y={}){return R(C,_.width,_.height,{fill:Le(_,s,y.fill),fillOpacity:oo,stroke:te(_,c,y.stroke)})}function $(C,_,y={}){var k=g(C,$n(_,y),En(_,y),0,{fill:Le(_,s,y.fill),fillOpacity:y.fillOpacity||oo,stroke:te(_,c,y.stroke),strokeWidth:1.5}),I=K(_);if(v(I,"bpmn:Lane")){var W=I.get("name");X(C,W,_,y)}return k}function B(C,_,y={}){var k=ae(C,_,y),I=Ie(_);if(on(_)&&(re(k,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!I)){var W=K(_).flowElements||[],oe=W.filter(Ae=>v(Ae,"bpmn:StartEvent"));oe.length===1&&U(oe[0],C,y,_)}return Be(C,_,I?"center-top":"center-middle",y),I?z(C,_,void 0,y):z(C,_,["SubProcessMarker"],y),k}function U(C,_,y,k){var I=22,W={fill:Le(k,s,y.fill),stroke:te(k,c,y.stroke),width:I,height:I},oe=K(C).isInterrupting,Ae=oe?0:3,je=oe?1:1.2,_t=20,Je=(I-_t)/2,kt="translate("+Je+","+Je+")";m(_,_t,_t,{fill:W.fill,stroke:W.stroke,strokeWidth:je,strokeDasharray:Ae,transform:kt}),F(C,_,W,k)}function Pe(C,_,y={}){var k=ae(C,_,y);return Be(C,_,"center-middle",y),z(C,_,void 0,y),k}var wt=this.handlers={"bpmn:AdHocSubProcess":function(C,_,y={}){return Ie(_)?y=ze(y,["fill","stroke","width","height"]):y=ze(y,["fill","stroke"]),B(C,_,y)},"bpmn:Association":function(C,_,y={}){return y=ze(y,["fill","stroke"]),me(C,_,y)},"bpmn:BoundaryEvent":function(C,_,y={}){var{renderIcon:k=!0}=y;y=ze(y,["fill","stroke"]);var I=K(_),W=I.get("cancelActivity");y={strokeWidth:1.5,fill:Le(_,s,y.fill),fillOpacity:iS,stroke:te(_,c,y.stroke)},W||(y.strokeDasharray="6");var oe=pe(C,_,y);return m(C,_.width,_.height,Rs,{...y,fill:"none"}),k&&F(_,C,y),oe},"bpmn:BusinessRuleTask":function(C,_,y={}){y=ze(y,["fill","stroke"]);var k=Pe(C,_,y),I=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),W=b(C,I);re(W,{fill:Le(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1});var oe=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),Ae=b(C,oe);return re(Ae,{fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke),strokeWidth:1}),k},"bpmn:CallActivity":function(C,_,y={}){return y=ze(y,["fill","stroke"]),B(C,_,{strokeWidth:5,...y})},"bpmn:ComplexGateway":function(C,_,y={}){y=ze(y,["fill","stroke"]);var k=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(_,c,y.stroke),stroke:te(_,c,y.stroke),strokeWidth:1}),k},"bpmn:DataInput":function(C,_,y={}){y=ze(y,["fill","stroke"]);var k=i.getRawPath("DATA_ARROW"),I=se(C,_,y);return b(C,k,{fill:"none",stroke:te(_,c,y.stroke),strokeWidth:1}),I},"bpmn:DataInputAssociation":function(C,_,y={}){return y=ze(y,["fill","stroke"]),me(C,_,{...y,markerEnd:d(C,"association-end",Le(_,s,y.fill),te(_,c,y.stroke))})},"bpmn:DataObject":function(C,_,y={}){return y=ze(y,["fill","stroke"]),se(C,_,y)},"bpmn:DataObjectReference":L("bpmn:DataObject"),"bpmn:DataOutput":function(C,_,y={}){y=ze(y,["fill","stroke"]);var k=i.getRawPath("DATA_ARROW"),I=se(C,_,y);return b(C,k,{strokeWidth:1,fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke)}),I},"bpmn:DataOutputAssociation":function(C,_,y={}){return y=ze(y,["fill","stroke"]),me(C,_,{...y,markerEnd:d(C,"association-end",Le(_,s,y.fill),te(_,c,y.stroke))})},"bpmn:DataStoreReference":function(C,_,y={}){y=ze(y,["fill","stroke"]);var k=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:0,my:.133}});return b(C,k,{fill:Le(_,s,y.fill),fillOpacity:oo,stroke:te(_,c,y.stroke),strokeWidth:2})},"bpmn:EndEvent":function(C,_,y={}){var{renderIcon:k=!0}=y;y=ze(y,["fill","stroke"]);var I=pe(C,_,{...y,strokeWidth:4});return k&&F(_,C,y),I},"bpmn:EventBasedGateway":function(C,_,y={}){y=ze(y,["fill","stroke"]);var k=K(_),I=ee(C,_,y);m(C,_.width,_.height,_.height*.2,{fill:Le(_,"none",y.fill),stroke:te(_,c,y.stroke),strokeWidth:1});var W=k.get("eventGatewayType"),oe=!!k.get("instantiate");function Ae(){var _t=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:_.width,containerHeight:_.height,position:{mx:.36,my:.44}});b(C,_t,{fill:"none",stroke:te(_,c,y.stroke),strokeWidth:2})}if(W==="Parallel"){var je=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}});b(C,je,{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}),Ae());return I},"bpmn:ExclusiveGateway":function(C,_,y={}){y=ze(y,["fill","stroke"]);var k=ee(C,_,y),I=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:_.width,containerHeight:_.height,position:{mx:.32,my:.3}}),W=He(_);return W.get("isMarkerVisible")&&b(C,I,{fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke),strokeWidth:1}),k},"bpmn:Gateway":function(C,_,y={}){return y=ze(y,["fill","stroke"]),ee(C,_,y)},"bpmn:Group":function(C,_,y={}){return y=ze(y,["fill","stroke","width","height"]),g(C,_.width,_.height,Cs,{stroke:te(_,c,y.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:$n(_,y),height:En(_,y)})},"bpmn:InclusiveGateway":function(C,_,y={}){y=ze(y,["fill","stroke"]);var k=ee(C,_,y);return m(C,_.width,_.height,_.height*.24,{fill:Le(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:2.5}),k},"bpmn:IntermediateEvent":function(C,_,y={}){var{renderIcon:k=!0}=y;y=ze(y,["fill","stroke"]);var I=pe(C,_,{...y,strokeWidth:1.5});return m(C,_.width,_.height,Rs,{fill:"none",stroke:te(_,c,y.stroke),strokeWidth:1.5}),k&&F(_,C,y),I},"bpmn:IntermediateCatchEvent":L("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":L("bpmn:IntermediateEvent"),"bpmn:Lane":function(C,_,y={}){return y=ze(y,["fill","stroke","width","height"]),$(C,_,{...y,fillOpacity:rS})},"bpmn:ManualTask":function(C,_,y={}){y=ze(y,["fill","stroke"]);var k=Pe(C,_,y),I=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return b(C,I,{fill:Le(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:.5}),k},"bpmn:MessageFlow":function(C,_,y={}){y=ze(y,["fill","stroke"]);var k=K(_),I=He(_),W=Le(_,s,y.fill),oe=te(_,c,y.stroke),Ae=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(k.get("messageRef")){var je=Ae.getPointAtLength(Ae.getTotalLength()/2),_t=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:je.x,y:je.y}}),Je={strokeWidth:1};I.get("messageVisibleKind")==="initiating"?(Je.fill=W,Je.stroke=oe):(Je.fill=oe,Je.stroke=W);var kt=b(C,_t,Je),Wt=k.get("messageRef"),an=Wt.get("name"),at=ce(C,an,{align:"center-top",fitBox:!0,style:{fill:oe}}),$t=kt.getBBox(),jt=at.getBBox(),zr=je.x-jt.width/2,An=je.y+$t.height/2+eS;xs(at,zr,An,0)}return Ae},"bpmn:ParallelGateway":function(C,_,y={}){y=ze(y,["fill","stroke"]);var k=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(_,c,y.stroke),stroke:te(_,c,y.stroke),strokeWidth:1}),k},"bpmn:Participant":function(C,_,y={}){y=ze(y,["fill","stroke","width","height"]);var k=$(C,_,y),I=Ie(_),W=Vt(_),oe=K(_),Ae=oe.get("name");if(I){var je=W?[{x:30,y:0},{x:30,y:En(_,y)}]:[{x:0,y:30},{x:$n(_,y),y:30}];E(C,je,{stroke:te(_,c,y.stroke),strokeWidth:tS}),X(C,Ae,_,y)}else{var _t=Qo(_,y);W||(_t.height=$n(_,y),_t.width=En(_,y));var Je=ce(C,Ae,{box:_t,align:"center-middle",style:{fill:Zo(_,u,c,y.stroke)}});if(!W){var kt=-1*En(_,y);xs(Je,0,-kt,270)}}return oe.get("participantMultiplicity")&&N("ParticipantMultiplicityMarker",C,_,y),k},"bpmn:ReceiveTask":function(C,_,y={}){y=ze(y,["fill","stroke"]);var k=K(_),I=Pe(C,_,y),W;return k.get("instantiate")?(m(C,28,28,20*.22,{fill:Le(_,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}}),b(C,W,{fill:Le(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1}),I},"bpmn:ScriptTask":function(C,_,y={}){y=ze(y,["fill","stroke"]);var k=Pe(C,_,y),I=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return b(C,I,{fill:Le(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1}),k},"bpmn:SendTask":function(C,_,y={}){y=ze(y,["fill","stroke"]);var k=Pe(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(_,c,y.stroke),stroke:Le(_,s,y.fill),strokeWidth:1}),k},"bpmn:SequenceFlow":function(C,_,y={}){y=ze(y,["fill","stroke"]);var k=Le(_,s,y.fill),I=te(_,c,y.stroke),W=x(C,_.waypoints,{markerEnd:d(C,"sequenceflow-end",k,I),stroke:I}),oe=K(_),{source:Ae}=_;if(Ae){var je=K(Ae);oe.get("conditionExpression")&&v(je,"bpmn:Activity")&&re(W,{markerStart:d(C,"conditional-flow-marker",k,I)}),je.get("default")&&(v(je,"bpmn:Gateway")||v(je,"bpmn:Activity"))&&je.get("default")===oe&&re(W,{markerStart:d(C,"conditional-default-flow-marker",k,I)})}return W},"bpmn:ServiceTask":function(C,_,y={}){y=ze(y,["fill","stroke"]);var k=Pe(C,_,y);m(C,10,10,{fill:Le(_,s,y.fill),stroke:"none",transform:"translate(6, 6)"});var I=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});b(C,I,{fill:Le(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1}),m(C,10,10,{fill:Le(_,s,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:Le(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1}),k},"bpmn:StartEvent":function(C,_,y={}){var{renderIcon:k=!0}=y;y=ze(y,["fill","stroke"]);var I=K(_);I.get("isInterrupting")||(y={...y,strokeDasharray:"6"});var W=pe(C,_,y);return k&&F(_,C,y),W},"bpmn:SubProcess":function(C,_,y={}){return Ie(_)?y=ze(y,["fill","stroke","width","height"]):y=ze(y,["fill","stroke"]),B(C,_,y)},"bpmn:Task":function(C,_,y={}){return y=ze(y,["fill","stroke"]),Pe(C,_,y)},"bpmn:TextAnnotation":function(C,_,y={}){y=ze(y,["fill","stroke"]);var{width:k,height:I}=Qo(_,y),W=g(C,k,I,0,0,{fill:"none",stroke:"none"}),oe=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:k,containerHeight:I,position:{mx:0,my:0}});b(C,oe,{stroke:te(_,c,y.stroke)});var Ae=K(_),je=Ae.get("text")||"";return ce(C,je,{align:"left-top",box:Qo(_,y),padding:ro,style:{fill:Zo(_,u,c,y.stroke)}}),W},"bpmn:Transaction":function(C,_,y={}){Ie(_)?y=ze(y,["fill","stroke","width","height"]):y=ze(y,["fill","stroke"]);var k=B(C,_,{strokeWidth:1.5,...y}),I=n.style(["no-fill","no-events"],{stroke:te(_,c,y.stroke),strokeWidth:1.5}),W=Ie(_);return W||(y={}),g(C,$n(_,y),En(_,y),Cs-Rs,Rs,I),k},"bpmn:UserTask":function(C,_,y={}){y=ze(y,["fill","stroke"]);var k=Pe(C,_,y),I=15,W=12,oe=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:I,y:W}});b(C,oe,{fill:Le(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:.5});var Ae=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:I,y:W}});b(C,Ae,{fill:Le(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:.5});var je=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:I,y:W}});return b(C,je,{fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke),strokeWidth:.5}),k},label:function(C,_,y={}){return it(C,_,y)}};this._drawPath=b,this._renderer=T}ie(Mr,xi),Mr.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Mr.prototype.canRender=function(e){return v(e,"bpmn:BaseElement")},Mr.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Mr.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Mr.prototype.getShapePath=function(e){return Me(e)?cl(e,nS):v(e,"bpmn:Event")?Qh(e):v(e,"bpmn:Activity")?cl(e,Cs):v(e,"bpmn:Gateway")?Z1(e):Q1(e)};function ze(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var oS=0,aS={width:150,height:50};function sS(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function cS(e){return Ft(e)?D({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var ul=null;function uS(){return ul||(ul=document.createElement("canvas").getContext("2d")),ul}function lS(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(Jh(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function Jh(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function pS(e,t){var n=uS();if(!n)return{width:0,height:0};n.font=lS(t),"letterSpacing"in n&&(n.letterSpacing=Jh(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 fS(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=pS(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return dS(e,r,i,o);r=mS(r,o.width,t)}}function dS(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 em="­";function hS(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===em)&&r.pop();break}var a=r[r.length-1];return a&&a===em&&(r[r.length-1]="-"),r.join("")}function mS(e,t,n){var i=Math.max(e.length*(n/t),1),r=hS(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function Ps(e){this._config=D({},{size:aS,padding:oS,style:{},align:"center-top"},e||{})}Ps.prototype.createText=function(e,t){return this.layoutText(e,t).element},Ps.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Ps.prototype.layoutText=function(e,t){for(var n=D({},this._config.size,t.box),i=D({},this._config.style,t.style),r=sS(t.align||this._config.align),o=cS(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=gS(i),c=e.split(/\u00AD?\r?\n/),u=[],l=n.width-o.left-o.right;c.length;)u.push(fS(c,l,i));r.vertical==="middle"&&(o.top=o.bottom=0);var p=vn(u,function(g,R,E){return g+(s||R.height)},0)+o.top+o.bottom,f=vn(u,function(g,R,E){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=le("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 E=le("tspan");re(E,{x:R,y:d}),E.textContent=g.text,we(h,E)});var m={width:f,height:p};return{dimensions:m,element:h}};function gS(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var yS=12,vS=1.2,_S=40;function tm(e){var t=D({fontFamily:"Arial, sans-serif",fontSize:yS,fontWeight:"normal",lineHeight:vS},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=D({},t,{fontSize:n},e&&e.externalStyle||{}),r=new Ps({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Tr.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:ro});return{x:a.x,y:a.y,width:a.width,height:Math.max(_S,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,D({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}tm.$inject=["config.textRenderer"];function bS(){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=SS(i.d,{mx:r,my:o,e:a});return p}}var xS=/\{([^{}]+)\}/g,ES=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function wS(e,t,n){var i=n;return t.replace(ES,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 SS(e,t){return String(e).replace(xS,function(n,i){return wS(n,i,t)})}const RS={__init__:["bpmnRenderer"],bpmnRenderer:["type",Mr],textRenderer:["type",tm],pathMap:["type",bS]};function CS(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const Jo={translate:["value",CS]};function As(e,t,n){return D({id:e.id,type:e.$type,businessObject:e,di:t},n)}function PS(e,t,n){var i=e.waypoint;return!i||i.length<2?[ye(t),ye(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function nm(e,t,n){return new Error(`element ${rn(t)} referenced by ${rn(e)}#${n} not yet drawn`)}function Ri(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}Ri.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],Ri.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(As(e,t,a)),this._canvas.addRootElement(i)}else if(v(t,"bpmndi:BPMNShape")){var s=!Ie(e,t),c=TS(e);r=n&&(n.hidden||n.collapsed);var u=t.bounds;i=this._elementFactory.createShape(As(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")&&(AS(n,ye(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(As(e,t,{hidden:r,source:l,target:p,waypoints:PS(t,l,p)})),v(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${rn(t)} for element ${rn(e)}`);return Zi(e)&&On(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},Ri.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${rn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw nm(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},Ri.prototype.addLabel=function(e,t,n){var i,r,o;return i=G1(t,n),r=On(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(As(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!On(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)},Ri.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?nm(e,i,t+"Ref"):new Error(`${rn(e)}#${t} Ref not specified`)},Ri.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},Ri.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},Ri.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function AS(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 TS(e){return v(e,"bpmn:Group")}const im={__depends__:[RS,{__depends__:[Jo],bpmnImporter:["type",Ri]}]};function ea(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Zn(e,t){return{x:e.x-t.x,y:e.y-t.y}}function ll(e){return Math.log(e)/Math.log(10)}var MS=1e3;function Y(e){this._eventBus=e}Y.$inject=["eventBus"];function kS(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}Y.prototype.on=function(e,t,n,i,r,o){if((Ht(t)||xe(t))&&(o=r,r=i,i=n,n=t,t=null),Ht(n)&&(o=r,r=i,i=n,n=MS),Ft(r)&&(o=r,r=!1),!Ht(i))throw new Error("handlerFn must be a function");ge(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)})},Y.prototype.canExecute=Ci("canExecute"),Y.prototype.preExecute=Ci("preExecute"),Y.prototype.preExecuted=Ci("preExecuted"),Y.prototype.execute=Ci("execute"),Y.prototype.executed=Ci("executed"),Y.prototype.postExecute=Ci("postExecute"),Y.prototype.postExecuted=Ci("postExecuted"),Y.prototype.revert=Ci("revert"),Y.prototype.reverted=Ci("reverted");function Ci(e){return function(n,i,r,o,a){(Ht(n)||xe(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var pl=["top","bottom","left","right"],Ts=10;function fl(e,t){Y.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(Ss(r)&&!et(r)){var o=LS(r);o&&i(r,o)}}function i(r,o){var a=ye(r),s=r.label,c=ye(s);if(s.parent){var u=he(r),l;switch(o){case"top":l={x:a.x,y:u.top-Ts-s.height/2};break;case"left":l={x:u.left-Ts-s.width/2,y:a.y};break;case"bottom":l={x:a.x,y:u.bottom+Ts+s.height/2};break;case"right":l={x:u.right+Ts+s.width/2,y:a.y};break}var p=Zn(l,c);t.moveShape(s,p)}}}ie(fl,Y),fl.$inject=["eventBus","modeling"];function DS(e){var t=e.host,n=ye(e),i=Yt(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=pl.filter(function(a){return r.indexOf(a)===-1});return o}function OS(e){var t=ye(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 rm(t,i)});return n}function LS(e){var t=ye(e.label),n=ye(e),i=rm(n,t);if(IS(i)){var r=OS(e);if(e.host){var o=DS(e);r=r.concat(o)}var a=pl.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?Yt(e.label,e)!=="intersect"?void 0:i:a[0]}}function rm(e,t){return Yt(t,e,5)}function IS(e){return pl.indexOf(e)!==-1}function dl(e){Y.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(dl,Y),dl.$inject=["eventBus"];var NS=1500;function hl(e,t,n){e.invoke(Y,this),this.preExecute("elements.delete",NS,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(Wr(Jr(Array.from(s),Rt(u))));c=c.union(l),s=s.difference(l)}),Array.from(c)}}ie(hl,Y),hl.$inject=["injector","eventBus","canvas"];function ml(e,t){e.invoke(Y,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(ml,Y),ml.$inject=["injector","modeling"];function ao(e,t){for(gn(t)&&(t=[t]);e=e.parent;)if(ke(e,t))return e;return null}function om(e,t){var n=ao(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=ao(e,i),n)return Vt(n);if(ke(e,i))return Vt(e);var r;for(r=K(e);r&&!v(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find(function(a){var s=K(a);return s&&s.get("processRef")===r});return o?Vt(o):!0}var am=500;function Ms(e,t){t.invoke(Y,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",am,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return sm(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",am,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];sm(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}Ms.$inject=["bpmnReplace","injector"],ie(Ms,Y),Ms.prototype._replaceShape=function(e,t){var n=BS(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function BS(e){var t=K(e),n=t.eventDefinitions;return n&&n[0]}function sm(e,t){return!Me(e)&&ke(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function gl(e,t){Y.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)})})}gl.$inject=["eventBus","modeling"],ie(gl,Y);function cm(e){return e.create("bpmn:Category")}function $S(e){return e.create("bpmn:CategoryValue")}function um(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=$S(e)),n.$parent||(n.$parent=cm(e)),n}function jS(e,t,n){return Et(t.get("categoryValue"),e),e.$parent=t,Et(n.get("rootElements"),t),t.$parent=n,e}function FS(e){var t=e.$parent;return t&&(vt(t.get("categoryValue"),e),e.$parent=null),e}function HS(e){var t=e.$parent;return t&&(vt(t.get("rootElements"),e),e.$parent=null),e}var zS=500;function yl(e,t,n){n.invoke(Y,this);function i(c){return t.filter(function(u){return v(u,"bpmn:Group")&&!u.labelTarget}).map(K).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&&jS(c,u,e.getDefinitions())}function s(c,u,l){u&&!o(u,l)&&HS(u),c&&!r(c,l)&&FS(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,K(u))},!0),this.executed(["shape.move","shape.resize"],zS,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,K(u))},!0),this.executed("group.updateRefs",function(c){lm(c).forEach(function(u){a(u.categoryValue,u.category)})},!0),this.reverted("group.updateRefs",function(c){lm(c).forEach(function(u){s(u.categoryValue,u.category,K(u.groupShape))})},!0),this.executed("shape.delete",function(c){var u=c.shape;!v(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,K(u))},!0),this.reverted("shape.delete",function(c){var u=c.shape;!v(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0)}yl.$inject=["bpmnjs","elementRegistry","injector"],ie(yl,Y);function lm(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function vl(e,t,n){Y.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,E=g.target;so(R)&&ta(E)&&l(E)}function r(g){const R=g.connection,E=g.source,x=g.target;so(E)&&ks(x)&&(u(x),f(E,[R]))}function o(g){const R=g.newTarget,E=g.oldSource,x=g.oldTarget;if(x!==R){const b=E;ta(x)&&l(x),so(b)&&ks(R)&&u(R)}}function a(g){const{element:R}=g;ta(R)?(p(R),d(R)):ks(R)&&h(R)}function s(g){const{newData:R,oldShape:E}=g;if(so(g.oldShape)&&R.eventDefinitionType!=="bpmn:CompensateEventDefinition"||R.type!=="bpmn:BoundaryEvent"){const x=E.outgoing.find(({target:b})=>ta(b));x&&x.target&&(g._connectionTarget=x.target)}else if(!so(g.oldShape)&&R.eventDefinitionType==="bpmn:CompensateEventDefinition"&&R.type==="bpmn:BoundaryEvent"){const x=E.outgoing.find(({target:b})=>ks(b));x&&x.target&&(g._connectionTarget=x.target),m(E)}}function c(g){const{_connectionTarget:R,newShape:E}=g;R&&t.connect(E,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=>ta(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(E=>so(E.source));t.removeElements(R)}function m(g){const R=g.outgoing.filter(E=>v(E,"bpmn:SequenceFlow"));t.removeElements(R)}}ie(vl,Y),vl.$inject=["eventBus","modeling","bpmnRules"];function ta(e){const t=K(e);return t&&t.get("isForCompensation")}function so(e){return e&&v(e,"bpmn:BoundaryEvent")&&io(e,"bpmn:CompensateEventDefinition")}function ks(e){return e&&v(e,"bpmn:Activity")&&!on(e)}function _l(e){e.invoke(Y,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=ao(i,"bpmn:Participant"))})}_l.$inject=["injector"],ie(_l,Y);function bl(e,t){Y.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}})}bl.$inject=["eventBus","bpmnFactory"],ie(bl,Y);var xl=20,El=20,pm=30,Ds=2e3;function wl(e,t,n){Y.call(this,t),t.on(["create.start","shape.move.start"],Ds,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)&&!et(p)});if(c.length){var u=Rt(c),l=VS(a,u);D(a,l),o.createConstraints=GS(a,u)}}}),t.on("create.start",Ds,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",Ds,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",Ds,function(r){var o=r.elements,a=r.parent,s=WS(o),c;s&&v(a,"bpmn:Process")&&(r.parent=i(),c=r.hints=r.hints||{},c.participant=s,c.process=a,c.processRef=K(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=K(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)&&K(s).set("processRef",K(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)&&K(c).set("processRef",s)},!0),this.postExecute("shape.create",function(r){var o=r.hints||{},a=r.process||r.hints.process,s=r.shape,c=o.participant;if(a){var u=a.children.slice();c?s===c&&n.moveElements(u,{x:0,y:0},c):n.moveElements(u,{x:0,y:0},s)}},!0)}wl.$inject=["canvas","eventBus","modeling"],ie(wl,Y);function VS(e,t){t={width:t.width+xl*2+pm,height:t.height+El*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 GS(e,t){return t=he(t),{bottom:t.top+e.height/2-El,left:t.right-e.width/2+xl,top:t.bottom-e.height/2+El,right:t.left+e.width/2-xl-pm}}function WS(e){return rt(e,function(t){return v(t,"bpmn:Participant")})}var fm="__targetRef_placeholder";function Sl(e,t){Y.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],dm(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],dm(o));function n(a,s,c){var u=a.get("dataInputAssociations");return rt(u,function(l){return l!==c&&l.targetRef===s})}function i(a,s){var c=a.get("properties"),u=rt(c,function(l){return l.name===fm});return!u&&s&&(u=t.create("bpmn:Property",{name:fm}),Et(c,u)),u}function r(a,s){var c=i(a);c&&(n(a,c,s)||vt(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}}Sl.$inject=["eventBus","bpmnFactory"],ie(Sl,Y);function dm(e){return function(t){var n=t.context,i=n.connection;if(v(i,"bpmn:DataInputAssociation"))return e(t)}}function Os(e){this._bpmnUpdater=e}Os.$inject=["bpmnUpdater"],Os.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),[]},Os.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 Rl(e,t,n,i){Y.call(this,i),t.registerHandler("dataStore.updateContainment",Os);function r(){return n.filter(function(s){return v(s,"bpmn:Participant")&&K(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:He(s),newSemanticParent:l.processRef||l,newDiParent:He(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:qS(l,"bpmn:Participant");a(u,f)}}),this.postExecute("shape.delete",function(s){var c=s.context,u=c.shape,l=e.getRootElement();ke(u,["bpmn:Participant","bpmn:SubProcess"])&&v(l,"bpmn:Collaboration")&&o(l).filter(function(p){return US(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)})})}Rl.$inject=["canvas","commandStack","elementRegistry","eventBus"],ie(Rl,Y);function US(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 qS(e,t){for(;e.parent;){if(v(e.parent,t))return e.parent;e=e.parent}}var Ls=Math.max,Is=Math.min,YS=20;function hm(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function KS(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 XS(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 Ns(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return xe(r)&&(i=(/top|left/.test(e)?Is:Ls)(i,r)),xe(o)&&(i=(/top|left/.test(e)?Ls:Is)(i,o)),i}function ZS(e,t){if(!t)return e;var n=he(e);return vs({top:Ns("top",n,t),right:Ns("right",n,t),bottom:Ns("bottom",n,t),left:Ns("left",n,t)})}function QS(e,t,n,i){var r=he(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?he(i):o,s={top:Is(o.top,a.top),left:Is(o.left,a.left),bottom:Ls(o.bottom,a.bottom),right:Ls(o.right,a.right)};return vs(s)}function na(e,t){return typeof e<"u"?e:YS}function JS(e,t){var n,i,r,o;return typeof t=="object"?(n=na(t.left),i=na(t.right),r=na(t.top),o=na(t.bottom)):n=i=r=o=na(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function eR(e){return!(e.waypoints||e.type==="label")}function mm(e,t){var n;if(e.length===void 0?n=Oe(e.children,eR):n=e,n.length)return JS(Rt(n),t)}var Qi=Math.abs;function tR(e,t){return hm(he(t),he(e))}var nR=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],jn=30;function Bs(e,t){return t=t||[],e.children.filter(function(n){v(n,"bpmn:Lane")&&(Bs(n,t),t.push(n))}),t}function Ji(e){return e.children.filter(function(t){return v(t,"bpmn:Lane")})}function Fn(e){return ao(e,nR)||e}function iR(e,t){var n=Fn(e),i=v(n,"bpmn:Process")?[]:[n],r=Bs(n,i),o=he(e),a=he(t),s=tR(e,t),c=[],u=Vt(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=he(l);s.top&&(Qi(m.bottom-o.top)<10&&(d=a.top-m.bottom),Qi(m.top-o.top)<5&&(p=a.top-m.top)),s.left&&(Qi(m.right-o.left)<10&&(f=a.left-m.right),Qi(m.left-o.left)<5&&(h=a.left-m.left)),s.bottom&&(Qi(m.top-o.bottom)<10&&(p=a.bottom-m.top),Qi(m.bottom-o.bottom)<5&&(d=a.bottom-m.bottom)),s.right&&(Qi(m.left-o.right)<10&&(h=a.right-m.left),Qi(m.right-o.right)<5&&(f=a.right-m.right)),(p||f||d||h)&&c.push({shape:l,newBounds:XS(l,{top:p,right:f,bottom:d,left:h})})}}),c}var rR=500;function Cl(e,t){Y.call(this,e);function n(i,r){var o=Vt(i),a=Ji(r),s=[],c=[],u=[],l=[];if(Pr(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",rR,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))})}Cl.$inject=["eventBus","spaceTool"],ie(Cl,Y);var gm=500;function $s(e,t){t.invoke(Y,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",gm,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return ym(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",gm,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;ym(a,aR(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}$s.$inject=["bpmnReplace","injector"],ie($s,Y),$s.prototype._replaceShape=function(e){var t=oR(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function oR(e){var t=K(e),n=t.eventDefinitions;return n&&n[0]}function ym(e,t){return!Me(e)&&v(e,"bpmn:BoundaryEvent")&&!t}function aR(e,t){return e.indexOf(t)!==-1}var js=Math.round,sR=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 uR(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var vm=10;function lR(e,t){var n,i;for(n=0;i=e[n];n++)if(Uo(i,t)<=vm)return{point:e[n],bendpoint:!0,index:n};return null}function pR(e,t){var n=wh(cR(t,vm),uR(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=sR(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:js(i.x+r.x)/2,y:js(i.y+r.y)/2},index:i.segment2}:{point:{x:js(i.x),y:js(i.y)},index:i.segment2}:null}function Pl(e,t){return lR(e,t)||pR(e,t)}function Al(e,t,n){Y.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;xe(a.width)?R=ye(a):R=a;var E=Pl(s,R);if(E){if(c=s.slice(0,E.index),u=s.slice(E.index+(E.bendpoint?1:0)),!c.length||!u.length)return;l=E.bendpoint?s[E.index]:R,(c.length===1||!_m(r,c[c.length-1]))&&c.push(bm(l)),(u.length===1||!_m(r,u[0]))&&u.unshift(bm(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 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,s=r.delta,c=a[0];if(!(!c||!o)){o&&o.waypoints&&(r.newParent=o=o.parent);var u=ye(c),l={x:u.x+s.x,y:u.y+s.y},p=rt(o.children,function(f){var d=t.canInsert(a,f);return d&&Pl(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(Al,Y),Al.$inject=["eventBus","bpmnRules","modeling"];function _m(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 bm(e){return D({},e)}function Tl(e,t){Y.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)&&co(r)){var c=[];v(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(u=>u!==r&&co(u)):c=a.incoming.filter(u=>u!==r&&co(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(co).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(co).forEach(function(s){const c=a.incoming.filter(co).filter(function(u){return u.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}Tl.$inject=["eventBus","modeling"],ie(Tl,Y);function co(e){return v(e,"bpmn:SequenceFlow")}var Fs=1500,xm=2e3;function Em(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"],Fs,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;v(a,"bpmn:Lane")&&!ke(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Fn(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||ke(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"],Fs,function(i){var r=i.hover;v(r,"bpmn:Lane")&&(i.hover=Fn(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Fs,function(i){var r=i.context,o=i.hover,a=r.type;v(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Fn(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Fs,function(i){var r=i.context,o=r.start;v(o,"bpmn:Lane")&&(r.start=Fn(o)||o)}),t.on("shape.move.start",xm,function(i){var r=i.shape;v(r,"bpmn:Lane")&&(i.shape=Fn(r)||r)}),t.on("spaceTool.move",xm,function(i){var r=i.hover;r&&v(r,"bpmn:Lane")&&(i.hover=Fn(r))})}Em.$inject=["elementRegistry","eventBus","canvas"];var wm=770;function Ml(e,t,n,i){n.invoke(Y,this);function r(s,c){var u=K(s),l=c.categoryValue||u.categoryValueRef;l||(l=um(e,u));var p=c.category||l.$parent||cm(e);u.categoryValueRef=l,l.$parent=p,c.categoryValue=l,c.category=p}function o(s,c){var u=K(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=K(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=K(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&&!K(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&&!K(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||K(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",wm,function(s){var c=s.descriptor,u=s.element;if(!(!v(u,"bpmn:Group")||u.labelTarget)){var l=K(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",wm,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})}Ml.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],ie(Ml,Y);function kl(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 Sm(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=kl(i,r,o,a),u=kl(i,r,o,s),l;c&&u?Rm(c,o)>Rm(u,o)?l=u:l=c:l=c||u,i.original=l}function n(i){var r=i.waypoints;t(r[0],r[1],ye(i.source)),t(r[r.length-1],r[r.length-2],ye(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}Sm.$inject=["eventBus"];function Rm(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Dl(e){Y.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=K(i),o=He(i);if(ke(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}Dl.$inject=["eventBus"],ie(Dl,Y);function Cm(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Pm(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function fR(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 dR(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 Ol(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=dR([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 Am(e,t){var n=Ol(e,t),i={x:n.x-e.x,y:n.y-e.y};return Cm(i)}function ia(e,t){return Cm({x:e.x-t.x,y:e.y-t.y})}var Tm=Math.sqrt,Mm=Math.min,hR=Math.max,km=Math.abs;function Dm(e){return Math.pow(e,2)}function ra(e,t){return Tm(Dm(e.x-t.x)+Dm(e.y-t.y))}function mR(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],Lm(i,r)?u=[i]:(o=ra(e,i),a=ra(e,r),c=Mm(o,a),u=gR(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:Lm(i,u[0])?n:n+1}),u.length===2&&(s=vR(u[0],u[1]),l={type:"segment",position:s,segmentIndex:n,relativeLocation:ra(i,s)/ra(i,r)}),p=ra(l.position,e),(!d||f>p)&&(d=l,f=p)}return d}function gR(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=Tm(d),m=-p+h,g=-p-h,R={x:e.x-r*m,y:e.y-o*m};if(d===0)return[R];var E={x:e.x-r*g,y:e.y-o*g};return[R,E].filter(function(x){return yR(x,e,t)})}function yR(e,t,n){return Om(e.x,t.x,n.x)&&Om(e.y,t.y,n.y)}function Om(e,t,n){return e>=Mm(t,n)-Hs&&e<=hR(t,n)+Hs}function vR(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Hs=.1;function Lm(e,t){return km(e.x-t.x)<=Hs&&km(e.y-t.y)<=Hs}function _R(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=Nm(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 Im(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=mR(e,n),c=s.segmentIndex,u=_R(n,t,s,i);if(u<0||u>t.length-2||u===null)return a;var l=Bm(n,c),p=Bm(t,u),f=s.position,d=xR(l,f),h=bR(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 E=t[g];return r=E.x-s.position.x,o=E.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=Nm(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=fR({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:wi(x),delta:wi({x:r,y:o})}}function Nm(e,t){var n=ia(e[t-1],e[t]),i=ia(e[t],e[t+1]),r=n/(n+i);return r}function bR(e,t){var n=Pm(e),i=Pm(t);return i-n}function Bm(e,t){return[e[t],e[t+1]]}function xR(e,t){var n=ia(e[0],e[1]),i=ia(e[0],t);return n===0?0:i/n}function ER(e,t,n,i){var r=ye(e);return Im(r,t,n,i).delta}function oa(e,t,n){var i=ea(t),r=ea(n),o=Zn(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return wi({x:r.x+a.x,y:r.y+a.y})}function $m(e,t,n){var i=ea(e),r=ea(t),o=ea(n),a=Zn(e,i),s=Zn(i,r),c=wR(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 wi({x:l.x+a.x-e.x,y:l.y+a.y-e.y})}function wR(e,t,n){var i=he(t),r=he(n);if(SR(i,r))return null;var o=Yt(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=Yt(n,s),c!==o?null:a}function SR(e,t){return RR(e,t)||CR(e,t)}function RR(e,t){return e.right!==t.right&&e.left!==t.left}function CR(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var jm="name",Fm="text";function Ll(e,t,n,i){Y.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{K(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var s=a.context,c=s.element,u=s.properties;if(jm in u&&t.updateLabel(c,u[jm]),Fm in u&&v(c,"bpmn:TextAnnotation")){var l=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},u[Fm]||"");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)||!Zi(u)||On(u)&&t.updateLabel(u,On(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=D({},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),ER(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=K(c);l&&Zi(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(On(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(Ss(c)){var p=c.label,f=ye(p),d=TR(l),h=AR(f,d),m=PR(h,l,u);t.moveShape(p,m)}})}ie(Ll,Y),Ll.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function PR(e,t,n){var i=oa(e,t,n);return wi(Zn(i,e))}function AR(e,t){if(t.length){var n=MR(e,t);return Ol(e,n)}}function TR(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 MR(e,t){var n=t.map(function(r){return{line:r,distance:Am(e,r)}}),i=ti(n,"distance");return i[0].line}function kR(e,t,n,i){return Im(e,t,n,i).point}function Il(e,t){Y.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=D({},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(Il,Y),Il.$inject=["eventBus","modeling"];function zs(e,t,n){var i=Gs(e),r=zm(i,t),o=i[0];return r.length?r[r.length-1]:oa(o.original||o,n,t)}function Vs(e,t,n){var i=Gs(e),r=zm(i,t),o=i[i.length-1];return r.length?r[0]:oa(o.original||o,n,t)}function Nl(e,t,n){var i=Gs(e),r=Hm(t,n),o=i[0];return oa(o.original||o,r,t)}function Bl(e,t,n){var i=Gs(e),r=Hm(t,n),o=i[i.length-1];return oa(o.original||o,r,t)}function Hm(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Gs(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function zm(e,t){var n=en(e,OR);return Oe(n,function(i){return DR(i,t)})}function DR(e,t){return Yt(t,e,1)==="intersect"}function OR(e){return e.original||e}function $l(e,t){Y.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(LR(i,r)){var o=IR(i);o.incoming.forEach(function(a){var s=Vs(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=zs(a,r,i);t.reconnectStart(a,r,s)})}},!0)}$l.$inject=["eventBus","modeling"],ie($l,Y);function LR(e,t){return v(e,"bpmn:Participant")&&Ie(e)&&v(t,"bpmn:Participant")&&!Ie(t)}function IR(e){var t=Go([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 NR=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Vm(e){const t=K(e);if(!v(t,"bpmn:BoundaryEvent")&&!(v(t,"bpmn:StartEvent")&&on(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:NR.some(i=>v(n[0],i))}function Gm(e){return v(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function jl(e,t){e.invoke(Y,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!Vm(r))return;const a=Gm(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=K(i).get(a),u=K(r).get(a);c!==u&&t.updateProperties(r,{[a]:c})})}jl.$inject=["injector","modeling"],ie(jl,Y);function Fl(e,t){Y.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=He(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}ie(Fl,Y),Fl.$inject=["eventBus","modeling"];function Hl(e,t,n){Y.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=BR(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}ie(Hl,Y),Hl.$inject=["eventBus","bpmnRules","modeling"];function uo(e){return e.original||e}function BR(e,t){var n=kl(uo(e[e.length-2]),uo(e[e.length-1]),uo(t[1]),uo(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[uo(e[0]),uo(t[t.length-1])]}function zl(e,t){Y.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)}zl.$inject=["eventBus","modeling"],ie(zl,Y);function Vl(e,t,n,i){Y.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=rt(p.outgoing,qr({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(Vl,Y),Vl.$inject=["eventBus","modeling","bpmnRules","injector"];function Ws(e,t,n,i,r,o){i.invoke(Y,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=vn(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){on(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(Ws,Y),Ws.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)},Ws.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var $R=1500,jR={width:140,height:120},Gl={width:300,height:60},Wl={width:60,height:300},Us={width:300,height:150},qs={width:150,height:300},Wm={width:140,height:120},Um={width:100,height:40};function qm(e){e.on("resize.start",$R,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=GR(i,r,o)),v(i,"bpmn:SubProcess")&&Ie(i)&&(n.minDimensions=Wm),v(i,"bpmn:TextAnnotation")&&(n.minDimensions=Um)})}qm.$inject=["eventBus"];var er=Math.abs,FR=Math.min,HR=Math.max;function Ym(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function lo(e,t,n){return Ym(e,t,n,FR)}function po(e,t,n){return Ym(e,t,n,HR)}var zR={top:20,left:50,right:20,bottom:20},VR={top:50,left:20,right:20,bottom:20};function GR(e,t,n){var i=Fn(e),r=!0,o=!0,a=Bs(i,[i]),s=he(e),c={},u={},l=Vt(e),p=l?Gl:Wl;/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=he(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&&er(s.top-m.bottom)<10&&po(c,"top",m.top+p.height),er(s.top-m.top)<5&&lo(u,"top",m.bottom-p.height)),/e/.test(t)&&(n&&er(s.right-m.left)<10&&lo(c,"right",m.right-p.width),er(s.right-m.right)<5&&po(u,"right",m.left+p.width)),/s/.test(t)&&(n&&er(s.bottom-m.top)<10&&lo(c,"bottom",m.bottom-p.height),er(s.bottom-m.bottom)<5&&po(u,"bottom",m.top+p.height)),/w/.test(t)&&(n&&er(s.left-m.right)<10&&po(c,"left",m.left+p.width),er(s.left-m.left)<5&&lo(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?zR:VR;return f.forEach(function(h){var m=he(h);/n/.test(t)&&(!l||r)&&lo(u,"top",m.top-d.top),/e/.test(t)&&(l||o)&&po(u,"right",m.right+d.right),/s/.test(t)&&(!l||o)&&po(u,"bottom",m.bottom+d.bottom),/w/.test(t)&&(l||r)&&lo(u,"left",m.left-d.left)}),{min:u,max:c}}function Km(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function fo(e){return e.originalEvent||e.srcEvent}function Ul(e){Km(e),Km(fo(e))}function kr(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 Xm(){return/mac/i.test(navigator.platform)}function Zm(e,t){return(fo(e)||e).button===t}function tr(e){return Zm(e,0)}function WR(e){return Zm(e,1)}function aa(e){var t=fo(e)||e;return tr(e)?Xm()?t.metaKey:t.ctrlKey:!1}function Ys(e){var t=fo(e)||e;return tr(e)&&t.shiftKey}var Qm=1001;function Jm(e,t){e.on("resize.start",Qm+500,function(n){var i=n.context,r=i.shape;(v(r,"bpmn:Lane")||v(r,"bpmn:Participant"))&&(i.balanced=!aa(n))}),e.on("resize.end",Qm,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=Ah(a),t.resizeLane(r,a,i.balanced)),!1})}Jm.$inject=["eventBus","modeling"];var UR=500;function ql(e,t,n,i,r){n.invoke(Y,this);function o(l){return ke(l,["bpmn:ReceiveTask","bpmn:SendTask"])||qR(l,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(l){var p=e.getDefinitions(),f=p.get("rootElements");return!!rt(f,qr({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(ke(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(ke(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=K(p),d=c(f),h;d&&!a(d)&&(h=e.getDefinitions().get("rootElements"),Et(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");vt(f,p)}},!0),t.on("copyPaste.copyElement",function(l){var p=l.descriptor,f=l.element;if(!(f.labelTarget||!o(f))){var d=K(f),h=c(d);h&&(p.referencedRootElement=h)}}),t.on("copyPaste.pasteElement",UR,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,Y);function qR(e,t){return ge(t)||(t=[t]),Bi(t,function(n){return io(e,n)})}var eg=Math.max;function tg(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]=KR(a,i,r)),v(a,"bpmn:Lane")&&(o[s]=Vt(a)?Gl:Wl),v(a,"bpmn:SubProcess")&&Ie(a)&&(o[s]=Wm),v(a,"bpmn:TextAnnotation")&&(o[s]=Um),v(a,"bpmn:Group")&&(o[s]=jR)}),o})}tg.$inject=["eventBus"];function YR(e){return e==="x"}function KR(e,t,n){var i=Vt(e);if(!QR(e))return i?Us:qs;var r=YR(t),o={};return r?i?o=Us:o={width:ZR(e,n,r),height:qs.height}:i?o={width:Us.width,height:XR(e,n,r)}:o=qs,o}function XR(e,t,n){var i;return i=JR(e,t,n),eg(Us.height,i)}function ZR(e,t,n){var i;return i=eC(e,t,n),eg(qs.width,i)}function QR(e){return!!Ji(e).length}function JR(e,t,n){var i=Ji(e),r;return r=Yl(i,t,n),e.height-r.height+Gl.height}function eC(e,t,n){var i=Ji(e),r;return r=Yl(i,t,n),e.width-r.width+Wl.width}function Yl(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=Ji(r),o.length?Yl(o,t,n):r}var ng="_plane";function ig(e){var t=e.id;return tC(t)}function fi(e){var t=e.id;return v(e,"bpmn:SubProcess")?rg(t):t}function Dr(e){return rg(e)}function Ks(e){var t=He(e);return v(t,"bpmndi:BPMNPlane")}function rg(e){return e+ng}function tC(e){return e.replace(new RegExp(ng+"$"),"")}var og=400,nC=600,ag={x:180,y:160};function Pi(e,t,n,i,r,o,a){Y.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")&&!Ie(p)}function u(p){var f=p.shape,d=p.newRootElement,h=K(f);d=s._addDiagram(d||h),p.newRootElement=e.addRootElement(d)}function l(p){var f=p.shape,d=K(f);s._removeDiagram(d);var h=p.newRootElement=a.get(fi(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(fi(d));if(!(!h||!d.children||!d.children.length)){var m=sg(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")||!Ie(f)||M(Xo([f]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(p){var f=p.shape;if(c(f)){var d=a.get(fi(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(fi(f)))},!0),this.postExecuted("shape.replace",function(p){var f=p.newShape,d=p.oldRoot,h=e.findRoot(fi(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(Ks(f)){a.updateId(f,Dr(g)),a.updateId(m,g);return}var R=a.get(Dr(m));R&&a.updateId(Dr(m),Dr(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(Ks(f)){a.updateId(f,Dr(m)),a.updateId(g,m);return}var R=a.get(Dr(g));R&&a.updateId(R,Dr(m))}}},!0),t.on("element.changed",function(p){var f=p.element;if(Ks(f)){var d=f,h=a.get(ig(d));!h||h===d||t.fire("element.changed",{element:h})}}),this.executed("shape.toggleCollapse",og,function(p){var f=p.shape;v(f,"bpmn:SubProcess")&&(Ie(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",og,function(p){var f=p.shape;v(f,"bpmn:SubProcess")&&(Ie(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",nC,function(p){var f=p.shape;if(v(f,"bpmn:SubProcess")){var d=p.newRootElement;if(d)if(Ie(f))s._moveChildrenToShape(d.children.slice(),f),M(Xo(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=sg(f);s._moveChildrenToShape(h,d)}}},!0),t.on("copyPaste.createTree",function(p){var f=p.element,d=p.children;if(c(f)){var h=fi(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(He(m),"bpmndi:BPMNPlane");if(g){var R=ig(m),E=rt(h,function(x){return x.id===R});E&&(f.parent=E.id)}}),t.on("copyPaste.pasteElement",function(p){var f=p.descriptor;f.parent&&(c(f.parent)||f.parent.hidden)&&(f.hidden=!0)})}ie(Pi,Y),Pi.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=Rt(i),o;if(!t.x)o={x:ag.x-r.x,y:ag.y-r.y};else{var a=ye(t),s=ye(r);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}},Pi.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(Zh(e).map(i=>i.annotation));n.size&&M(Xo(e.children),i=>{n.has(i.annotation)&&M(i.associations,r=>{t.removeConnection(r)})})},Pi.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},Pi.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},Pi.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:fi(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},Pi.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=rt(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},Pi.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function iC(e){var t=[];return M(Xo(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function sg(e){return e.children.slice().concat(iC(e.children)).concat(rC(e))}function rC(e){return Ju(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function Kl(e,t){e.invoke(Y,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"))||!Ie(r))){var o=oC(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}Kl.$inject=["injector","modeling"],ie(Kl,Y);function oC(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function Xl(e,t){Y.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,On(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(Xl,Y),Xl.$inject=["eventBus","textRenderer"];function Zl(e,t){Y.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(Ie(i))return;var r=Go(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,ye(i)):t.reconnectStart(a,i,ye(i)))}},!0)}ie(Zl,Y),Zl.$inject=["eventBus","modeling"];var Ql=500;function Jl(e,t,n){Y.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=aC(c).concat([a]),p=mm(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"],Ql,function(a){var s=a.context,c=s.shape;v(c,"bpmn:SubProcess")&&(c.collapsed?He(c).isExpanded=!1:(i(c.children),He(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],Ql,function(a){var s=a.context,c=s.shape;c.collapsed?He(c).isExpanded=!1:He(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],Ql,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(Jl,Y),Jl.$inject=["eventBus","elementFactory","modeling"];function aC(e){return e.filter(function(t){return!t.hidden})}function ep(e,t,n,i){t.invoke(Y,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;Me(a)||(v(a,"bpmn:Participant")&&Ie(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(ep,Y),ep.$inject=["canvas","injector","moddle","modeling"];function tp(e,t){Y.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;sC(r,o)&&t.updateProperties(o,{default:null})})}ie(tp,Y),tp.$inject=["eventBus","modeling"];function sC(e,t){if(!v(e,"bpmn:SequenceFlow"))return!1;var n=K(t),i=K(e);return n.get("default")===i}var cC=500,uC=5e3,cg=["shape.create","shape.delete","shape.move","shape.resize"],ug=[...cg,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function np(e,t){Y.call(this,e);var n;function i(){return n=n||new lC,n.enter(),n}function r(){if(!n)throw new Error("out of bounds release");return n}function o(){if(!n)throw new Error("out of bounds release");var a=n.leave();return a&&(t.updateLaneRefs(n.flowNodes,n.lanes),n=null),a}this.preExecute(ug,uC,function(){i()}),this.postExecuted(ug,cC,function(){o()}),this.preExecute(cg,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))})}np.$inject=["eventBus","modeling"],ie(np,Y);function lC(){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 pC=500,fC=5e3,lg=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],pg=[...lg,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function ip(e,t){Y.call(this,e);var n;function i(){return n=n||new dC,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(pg,fC,function(){i()}),this.postExecuted(pg,pC,function(){o()}),this.preExecute(lg,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)})}ip.$inject=["eventBus","modeling"],ie(ip,Y);function dC(){this.affectedFlowElements=new Set,this.affectedGroupEntries=new Map,this.counter=0,this.addFlowElement=function(e){this.affectedFlowElements.add(e)},this.addGroup=function(e){this.affectedGroupEntries.has(e)||this.affectedGroupEntries.set(e,{categoryValue:e.businessObject.categoryValueRef,groupShape:e})},this.enter=function(){this.counter++},this.leave=function(){return this.counter--,!this.counter}}function rp(e,t){Y.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)hC(o)&&!gC(o)&&t.updateProperties(o,{isForCompensation:void 0})})}ie(rp,Y),rp.$inject=["eventBus","modeling"];function hC(e){const t=K(e);return t&&t.isForCompensation}function mC(e){return e&&v(e,"bpmn:BoundaryEvent")&&io(e,"bpmn:CompensateEventDefinition")}function gC(e){return e.incoming.filter(n=>mC(n.source)).length>0}const yC={__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",fl],appendBehavior:["type",dl],associationBehavior:["type",ml],attachEventBehavior:["type",Ms],artifactBehavior:["type",hl],boundaryEventBehavior:["type",gl],categoryRootElementReferenceBehavior:["type",yl],compensateBoundaryEventBehaviour:["type",vl],createBehavior:["type",_l],createDataObjectBehavior:["type",bl],createParticipantBehavior:["type",wl],dataInputAssociationBehavior:["type",Sl],dataStoreBehavior:["type",Rl],deleteLaneBehavior:["type",Cl],detachEventBehavior:["type",$s],dropOnFlowBehavior:["type",Al],eventBasedGatewayBehavior:["type",Tl],fixHoverBehavior:["type",Em],groupBehavior:["type",Ml],importDockingFix:["type",Sm],isHorizontalFix:["type",Dl],labelBehavior:["type",Ll],layoutConnectionBehavior:["type",Il],messageFlowBehavior:["type",$l],nonInterruptingBehavior:["type",jl],removeElementBehavior:["type",Hl],removeEmbeddedLabelBoundsBehavior:["type",Fl],removeParticipantBehavior:["type",zl],replaceConnectionBehavior:["type",Vl],replaceElementBehaviour:["type",Ws],resizeBehavior:["type",qm],resizeLaneBehavior:["type",Jm],rootElementReferenceBehavior:["type",ql],spaceToolBehavior:["type",tg],subProcessPlaneBehavior:["type",Pi],subProcessStartEventBehavior:["type",Kl],textAnnotationBehavior:["type",Xl],toggleCollapseConnectionBehaviour:["type",Zl],toggleElementCollapseBehaviour:["type",Jl],unclaimIdBehavior:["type",ep],unsetDefaultFlowBehavior:["type",tp],updateFlowNodeRefsBehavior:["type",np],updateCategoryValueRefsBehavior:["type",ip],setCompensationActivityAfterPasteBehavior:["type",rp]};function op(e){this._commandStack=e.get("commandStack",!1)}op.$inject=["injector"],op.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const di={__init__:["rules"],rules:["type",op]};function Hn(e){Y.call(this,e),this.init()}Hn.$inject=["eventBus"],ie(Hn,Y),Hn.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)})},Hn.prototype.init=function(){};function fg(e,t){var n=Yt(e,t,-15);return n!=="intersect"?n:null}function Xt(e){Hn.call(this,e)}ie(Xt,Hn),Xt.$inject=["eventBus"],Xt.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return vC(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 Zs(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return Zs(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 Rg(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return et(i)&&!Qs(t,i)?!1:_r(t,function(r){return et(r)?Zs(r.source,r.target,r):r.host?sa(r,r.host,null,n):up(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 _g(a)&&!n.includes(a.host)})?!1:sa(n,t,null,i)||wg(n,t,i)||Sg(n,t)||Qs(n,t)}),this.addRule("shape.create",function(e){return up(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return sa(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return Mg(n,t)})},Xt.prototype.canConnectMessageFlow=Ag,Xt.prototype.canConnectSequenceFlow=Tg,Xt.prototype.canConnectDataAssociation=lp,Xt.prototype.canConnectAssociation=Cg,Xt.prototype.canConnectCompensationAssociation=Pg,Xt.prototype.canMove=Sg,Xt.prototype.canAttach=sa,Xt.prototype.canReplace=wg,Xt.prototype.canDrop=ho,Xt.prototype.canInsert=Qs,Xt.prototype.canCreate=up,Xt.prototype.canConnect=Zs,Xt.prototype.canResize=Rg,Xt.prototype.canCopy=Mg;function vC(e){return ap(e)?null:ke(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function ap(e){return!e||Me(e)}function dg(e){do{if(v(e,"bpmn:Process"))return K(e);if(v(e,"bpmn:Participant"))return K(e).processRef||K(e)}while(e=e.parent)}function sp(e){return v(e,"bpmn:TextAnnotation")}function cp(e){return v(e,"bpmn:Group")&&!e.labelTarget}function hg(e){return v(e,"bpmn:BoundaryEvent")&&hi(e,"bpmn:CompensateEventDefinition")}function Xs(e){return K(e).isForCompensation}function _C(e,t){var n=dg(e),i=dg(t);return n===i}function bC(e){return v(e,"bpmn:InteractionNode")&&!v(e,"bpmn:BoundaryEvent")&&(!v(e,"bpmn:Event")||v(e,"bpmn:ThrowEvent")&&yg(e,"bpmn:MessageEventDefinition"))}function xC(e){return v(e,"bpmn:InteractionNode")&&!Xs(e)&&(!v(e,"bpmn:Event")||v(e,"bpmn:CatchEvent")&&yg(e,"bpmn:MessageEventDefinition"))&&!(v(e,"bpmn:BoundaryEvent")&&!hi(e,"bpmn:MessageEventDefinition"))}function mg(e){for(var t=e;t=t.parent;){if(v(t,"bpmn:FlowElementsContainer"))return K(t);if(v(t,"bpmn:Participant"))return K(t).processRef}return null}function gg(e,t){var n=mg(e),i=mg(t);return n===i}function hi(e,t){var n=K(e);return!!rt(n.eventDefinitions||[],function(i){return v(i,t)})}function yg(e,t){var n=K(e);return(n.eventDefinitions||[]).every(function(i){return v(i,t)})}function EC(e){return v(e,"bpmn:FlowNode")&&!v(e,"bpmn:EndEvent")&&!on(e)&&!(v(e,"bpmn:IntermediateThrowEvent")&&hi(e,"bpmn:LinkEventDefinition"))&&!hg(e)&&!Xs(e)}function wC(e){return v(e,"bpmn:FlowNode")&&!v(e,"bpmn:StartEvent")&&!v(e,"bpmn:BoundaryEvent")&&!on(e)&&!(v(e,"bpmn:IntermediateCatchEvent")&&hi(e,"bpmn:LinkEventDefinition"))&&!Xs(e)}function SC(e){return v(e,"bpmn:ReceiveTask")||v(e,"bpmn:IntermediateCatchEvent")&&(hi(e,"bpmn:MessageEventDefinition")||hi(e,"bpmn:TimerEventDefinition")||hi(e,"bpmn:ConditionalEventDefinition")||hi(e,"bpmn:SignalEventDefinition"))}function RC(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function vg(e,t){var n=RC(t);return n.indexOf(e)!==-1}function Zs(e,t,n){if(ap(e)||ap(t))return null;if(!v(n,"bpmn:DataAssociation")){if(Ag(e,t))return{type:"bpmn:MessageFlow"};if(Tg(e,t))return{type:"bpmn:SequenceFlow"}}var i=lp(e,t);return i||(Pg(e,t)?{type:"bpmn:Association",associationDirection:"One"}:Cg(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function ho(e,t){return Me(e)||cp(e)?!0:v(t,"bpmn:Participant")&&!Ie(t)?!1:v(e,"bpmn:Participant")?v(t,"bpmn:Process")||v(t,"bpmn:Collaboration"):ke(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")&&!CC(e)?!1:v(e,"bpmn:FlowElement")&&!v(e,"bpmn:DataStoreReference")?v(t,"bpmn:FlowElementsContainer")?Ie(t):ke(t,["bpmn:Participant","bpmn:Lane"]):v(e,"bpmn:DataStoreReference")&&v(t,"bpmn:Collaboration")?Bi(K(t).get("participants"),function(n){return!!n.get("processRef")}):ke(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?ke(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 CC(e){return K(e).cancelActivity&&(bg(e)||xg(e))}function _g(e){return!Me(e)&&v(e,"bpmn:BoundaryEvent")}function PC(e){return v(e,"bpmn:Lane")}function AC(e){return _g(e)||v(e,"bpmn:IntermediateThrowEvent")&&bg(e)?!0:v(e,"bpmn:IntermediateCatchEvent")&&xg(e)}function bg(e){var t=K(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function xg(e){return Eg(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Eg(e,t){return t.some(function(n){return hi(e,n)})}function TC(e){return v(e,"bpmn:ReceiveTask")&&rt(e.incoming,function(t){return v(t.source,"bpmn:EventBasedGateway")})}function sa(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return Me(r)||!AC(r)||on(t)||!v(t,"bpmn:Activity")||Xs(t)||i&&!fg(i,t)||TC(t)?!1:"attach"}function wg(e,t,n){if(!t)return!1;var i={replacements:[]};return M(e,function(r){on(t)||v(r,"bpmn:StartEvent")&&r.type!=="label"&&ho(r,t)&&($1(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(j1(r)||F1(r)||H1(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),Eg(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")||hi(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(v(r,"bpmn:EndEvent")&&ho(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),v(r,"bpmn:BoundaryEvent")&&sa(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function Sg(e,t){return Bi(e,PC)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return ho(n,t)})}function up(e,t,n,i){return t?Me(e)||cp(e)?!0:ho(e,t)||Qs(e,t):!1}function Rg(e,t,n){return v(e,"bpmn:SubProcess")?Ie(e)&&(!t||t.width>=100&&t.height>=80):v(e,"bpmn:Lane")||v(e,"bpmn:Participant")?!0:sp(e)?n?n==="e"||n==="w":!0:cp(e)?!0:Me(e)?n?n==="e"||n==="w":!0:!1}function MC(e,t){var n=sp(e),i=sp(t);return(n||i)&&n!==i}function Cg(e,t){return vg(t,e)||vg(e,t)?!1:MC(e,t)?!0:!!lp(e,t)}function Pg(e,t){return gg(e,t)&&hg(e)&&v(t,"bpmn:Activity")&&!DC(t,e)&&!on(t)}function Ag(e,t){return Dg(e)&&!Dg(t)?!1:bC(e)&&xC(t)&&!_C(e,t)}function Tg(e,t){return EC(e)&&wC(t)&&gg(e,t)&&!(v(e,"bpmn:EventBasedGateway")&&!SC(t))}function lp(e,t){return ke(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&ke(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:ke(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&ke(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function Qs(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:ke(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!Me(t)&&v(e,"bpmn:FlowNode")&&!v(e,"bpmn:BoundaryEvent")&&ho(e,t.parent)}function pp(e,t){return e&&t&&e.indexOf(t)!==-1}function Mg(e,t){return Me(t)?!0:!(v(t,"bpmn:Lane")&&!pp(e,t.parent)||v(t,"bpmn:MessageFlow")&&!kC(e,t))}function kC(e,t){var n=kg(t.source),i=kg(t.target);return pp(e,n)&&pp(e,i)}function kg(e){for(;e;e=e.parent)if(v(e,"bpmn:Participant"))return e;return null}function Dg(e){return ao(e,"bpmn:Process")||ao(e,"bpmn:Collaboration")}function DC(e,t){return e.attachers.includes(t)}const OC={__depends__:[di],__init__:["bpmnRules"],bpmnRules:["type",Xt]};var LC=2e3;function Og(e,t){e.on("saveXML.start",LC,n);function n(){var i=t.getRootElements();M(i,function(r){var o=He(r),a,s;a=Go([r]),a=Oe(a,function(c){return c!==r&&!c.labelTarget}),s=en(a,He),o.set("planeElement",s)})}}Og.$inject=["eventBus","canvas"];const IC={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Og]};function Js(e){Y.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)})}Js.prototype.getOrdering=function(e,t){return null},ie(Js,Y);function fp(e,t){Js.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=rt(n,function(c){return ke(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&&!ke(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=Ff(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}}}fp.$inject=["eventBus","canvas"],ie(fp,Js);const NC={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",fp]};function ca(){}ca.prototype.get=function(){return this._data},ca.prototype.set=function(e){this._data=e},ca.prototype.clear=function(){var e=this._data;return delete this._data,e},ca.prototype.isEmpty=function(){return!this._data};const BC={clipboard:["type",ca]};var Lg=1500;function Ig(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",Lg,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",Lg,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=kr(a),c=document.elementFromPoint(s.x,s.y),$C(c)}}Ig.$inject=["elementRegistry","eventBus","injector"];function $C(e){return Rr(e,"svg, .djs-element",!0)}const jC={__init__:["hoverFix"],hoverFix:["type",Ig]};function FC(e){return!0}function ec(e){return tr(e)||WR(e)}var Ng=500;function Bg(e,t,n){var i=this;function r(A,F,H){if(!s(A,F)){var N,z,ce;H?z=t.getGraphics(H):(N=F.delegateTarget||F.target,N&&(z=N,H=t.get(z))),!(!z||!H)&&(ce=e.fire(A,{element:H,gfx:z,originalEvent:F}),ce===!1&&(F.stopPropagation(),F.preventDefault()))}}var o={};function a(A){return o[A]}function s(A,F){var H=u[A]||tr;return!H(F)}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":FC,"element.mousedown":ec,"element.mouseup":ec,"element.click":ec,"element.dblclick":ec};function l(A,F,H){var N=c[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 z=o[H]=function(ce){r(H,ce)};N&&(u[H]=N),z.$delegate=bn.bind(A,p,F,z)}function d(A,F,H){var N=a(H);N&&bn.unbind(A,F,N.$delegate)}function h(A){M(c,function(F,H){f(A,H,F)})}function m(A){M(c,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"],Ng,function(A){var F=A.element,H=A.gfx;e.fire("interactionEvents.updateHit",{element:F,gfx:H})}),e.on("interactionEvents.createHit",Ng,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=w("djs-hit djs-hit-stroke"),R=w("djs-hit djs-hit-click-stroke"),E=w("djs-hit djs-hit-all"),x=w("djs-hit djs-hit-no-move"),b={all:E,"click-stroke":R,stroke:g,"no-move":x};function w(A,F){return F=D({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){we(A,F)}this.removeHits=function(A){var F=ps(".djs-hit",A);M(F,It)},this.createDefaultHit=function(A,F){var H=A.waypoints,N=A.isFrame,z;return H?this.createWaypointsHit(F,H):(z=N?"stroke":"all",this.createBoxHit(F,z,{width:A.width,height:A.height}))},this.createWaypointsHit=function(A,F){var H=Vo(F);return T(H,"stroke"),L(A,H),H},this.createBoxHit=function(A,F,H){H=D({x:0,y:0},H);var N=le("rect");return T(N,F),re(N,H),L(A,N),N},this.updateDefaultHit=function(A,F){var H=Qe(".djs-hit",F);if(H)return A.waypoints?Qu(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}Bg.$inject=["eventBus","elementRegistry","styles"];const tc={__init__:["interactionEvents"],interactionEvents:["type",Bg]};function mo(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)})}mo.$inject=["eventBus","canvas"],mo.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()})}},mo.prototype.get=function(){return Array.from(this._selectedElements)},mo.prototype.isSelected=function(e){return this._selectedElements.has(e)},mo.prototype.select=function(e,t){var n=this.get();ge(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 $g="hover",jg="selected";function Fg(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,$g)}),t.on("element.out",function(r){i(r.element,$g)}),t.on("selection.changed",function(r){function o(u){i(u,jg)}function a(u){n(u,jg)}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)})}Fg.$inject=["canvas","eventBus"];function Hg(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;ge(u)?t.select(u):t.select(s.filter(HC))}}),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=rt(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(tr(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=Ys(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}Hg.$inject=["eventBus","selection","canvas","elementRegistry"];function HC(e){return!e.hidden}const zn={__init__:["selectionVisuals","selectionBehavior"],__depends__:[tc],selection:["type",mo],selectionVisuals:["type",Fg],selectionBehavior:["type",Hg]};var zC=/^djs-cursor-.*$/;function nc(e){var t=ft(document.body);t.removeMatching(zC),e&&t.add("djs-cursor-"+e)}function zg(){nc(null)}var VC=5e3;function Vg(e,t){t=t||"element.click";function n(){return!1}return e.once(t,VC,n),function(){e.off(t,n)}}var GC=["c","C"],WC=["v","V"],UC=["d","D"],qC=["x","X"],YC=["y","Y"],Gg=["z","Z"];function KC(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function wn(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function Nt(e,t){return e=ge(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function dp(e){return e.shiftKey}function XC(e){return wn(e)&&Nt(GC,e)}function ZC(e){return wn(e)&&Nt(WC,e)}function QC(e){return wn(e)&&Nt(UC,e)}function JC(e){return wn(e)&&Nt(qC,e)}function eP(e){return wn(e)&&!dp(e)&&Nt(Gg,e)}function tP(e){return wn(e)&&(Nt(YC,e)||Nt(Gg,e)&&dp(e))}var go=Math.round,Wg="djs-drag-active";function Or(e){e.preventDefault()}function nP(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function iP(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Ug(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(x){var b=t.viewbox(),w=t._container.getBoundingClientRect();return{x:b.x+(x.x-w.left)/b.scale,y:b.y+(x.y-w.top)/b.scale}}function s(x,b){b=b||o;var w=e.createEvent(D({},b.payload,b.data,{isTouch:b.isTouch}));return e.fire("drag."+x,w)===!1?!1:e.fire(b.prefix+"."+x,w)}function c(x){var b=x.filter(function(w){return i.get(w.id)});b.length&&n.select(b)}function u(x,b){var w=o.payload,T=o.displacement,L=o.globalStart,A=kr(x),F=Zn(A,L),H=o.localStart,N=a(A),z=Zn(N,H);if(!o.active&&(b||iP(F)>o.threshold)){if(D(w,{x:go(H.x+T.x),y:go(H.y+T.y),dx:0,dy:0},{originalEvent:x}),s("start")===!1)return g();o.active=!0,o.keepSelection||(w.previousSelection=n.get(),n.select(null)),o.cursor&&nc(o.cursor),t.addMarker(t.getRootElement(),Wg)}Ul(x),o.active&&(D(w,{x:go(N.x+T.x),y:go(N.y+T.y),dx:go(z.x),dy:go(z.y)},{originalEvent:x}),s("move"))}function l(x){var b,w=!0;o.active&&(x&&(o.payload.originalEvent=x,Ul(x)),w=s("end")),w===!1&&s("rejected"),b=R(w!==!0),s("ended",b)}function p(x){Nt("Escape",x)&&(Or(x),g())}function f(x){var b;o.active&&(b=Vg(e),setTimeout(b,400),Or(x)),l(x)}function d(x){u(x)}function h(x){var b=o.payload;b.hoverGfx=x.gfx,b.hover=x.element,s("hover")}function m(x){s("out");var b=o.payload;b.hoverGfx=null,b.hover=null}function g(x){var b;if(o){var w=o.active;w&&s("cancel"),b=R(x),w&&s("canceled",b)}}function R(x){var b,w;s("cleanup"),zg(),o.trapClick?w=f:w=l,Ee.unbind(document,"mousemove",u),Ee.unbind(document,"dragstart",Or),Ee.unbind(document,"selectstart",Or),Ee.unbind(document,"mousedown",w,!0),Ee.unbind(document,"mouseup",w,!0),Ee.unbind(document,"keyup",p),Ee.unbind(document,"touchstart",d,!0),Ee.unbind(document,"touchcancel",g,!0),Ee.unbind(document,"touchmove",u,!0),Ee.unbind(document,"touchend",l,!0),e.off("element.hover",h),e.off("element.out",m),t.removeMarker(t.getRootElement(),Wg);var T=o.payload.previousSelection;return x!==!1&&T&&!n.get().length&&c(T),b=o,o=null,b}function E(x,b,w,T){o&&g(!1),typeof b=="string"&&(T=w,w=b,b=null),T=D({},r,T||{});var L=T.data||{},A,F,H,N,z;if(T.trapClick?N=f:N=l,x?(A=fo(x)||x,F=kr(x),Ul(x),A.type==="dragstart"&&Or(A)):(A=null,F={x:0,y:0}),H=a(F),b||(b=H),z=nP(A),o=D({prefix:w,data:L,payload:{},globalStart:F,displacement:Zn(b,H),localStart:H,isTouch:z},T),T.manual||(z?(Ee.bind(document,"touchstart",d,!0),Ee.bind(document,"touchcancel",g,!0),Ee.bind(document,"touchmove",u,!0),Ee.bind(document,"touchend",l,!0)):(Ee.bind(document,"mousemove",u),Ee.bind(document,"dragstart",Or),Ee.bind(document,"selectstart",Or),Ee.bind(document,"mousedown",N,!0),Ee.bind(document,"mouseup",N,!0)),Ee.bind(document,"keyup",p),e.on("element.hover",h),e.on("element.out",m)),s("init")===!1)return g(),!1;T.autoActivate&&u(x,!0)}e.on("diagram.destroy",g),this.init=E,this.move=u,this.hover=h,this.out=m,this.end=l,this.cancel=g,this.context=function(){return o},this.setOptions=function(x){D(r,x)}}Ug.$inject=["eventBus","canvas","selection","elementRegistry"];const Ai={__depends__:[jC,zn],dragging:["type",Ug]};function yo(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}yo.prototype.next=function(){return this._prefix+ ++this._counter};const rP=new yo("ps");var oP=["marker-start","marker-mid","marker-end"],aP=["circle","ellipse","line","path","polygon","polyline","path","rect"];function nr(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}nr.$inject=["elementRegistry","eventBus","canvas","styles"],nr.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")},nr.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},nr.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=oh(n);return this._cloneMarkers(Ar(r),i),re(r,this._styles.cls(i,[])),we(t,r),re(r,"data-preview-support-element-id",e.id),r},nr.prototype.addFrame=function(e,t){var n=le("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return we(t,n),re(n,"data-preview-support-element-id",e.id),n},nr.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),lP(e)&&oP.forEach(function(r){if(re(e,r)){var o=sP(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},nr.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,rP.next()].join("-"),a=Qe("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||oh(n);s.id=o,Ne(s).add(r);var c=Qe(":scope > defs",e);c||(c=le("defs"),we(e,c)),we(c,s);var u=uP(s.id);re(t,i,u)};function sP(e,t,n){var i=cP(re(e,t));return Qe("marker#"+i,n||document)}function cP(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function uP(e){return"url(#"+e+")"}function lP(e){return aP.indexOf(e.nodeName)!==-1}const vo={__init__:["previewSupport"],previewSupport:["type",nr]};var pP="drop-ok",qg="drop-not-ok",Yg="attach-ok",Kg="new-parent",Xg="create",fP=2e3;function Zg(e,t,n,i,r){function o(c,u,l,p,f){if(!u)return!1;c=Oe(c,function(E){var x=E.labelTarget;return!E.parent&&!(Me(E)&&c.indexOf(x)!==-1)});var d=rt(c,function(E){return!et(E)}),h=!1,m=!1,g=!1;Jg(c)&&(h=r.allowed("shape.attach",{position:l,shape:d,target:u})),h||(Jg(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){[Yg,pP,qg,Kg].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}Qg(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,Yg):a(p,m?Kg:qg))}),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;Qg(c);var E={x:c.x,y:c.y};g?p=i.appendShape(l,p,E,d,{attach:m,connection:g===!0?{}:g,connectionTarget:R.connectionTarget}):(f=i.createElements(f,E,d,D({},R,{attach:m})),p=rt(f,function(x){return!et(x)})),D(u,{elements:f,shape:p}),D(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===Xg&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],fP,function(){n.off("elements.changed",s)})}),this.start=function(c,u,l){ge(u)||(u=[u]);var p=rt(u,function(h){return!et(h)});if(p){l=D({elements:u,hints:{},shape:p},l||{}),M(u,function(h){xe(h.x)||(h.x=0),xe(h.y)||(h.y=0)});var f=Oe(u,function(h){return!h.hidden}),d=Rt(f);M(u,function(h){et(h)&&(h.waypoints=en(h.waypoints,function(m){return{x:m.x-d.x-d.width/2,y:m.y-d.y-d.height/2}})),D(h,{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2})}),t.init(c,Xg,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:u,context:l}})}}}Zg.$inject=["canvas","dragging","eventBus","modeling","rules"];function Qg(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 Jg(e){return e&&e.length===1&&!et(e[0])}var dP=750;function ey(e,t,n,i,r){function o(a){var s=le("g");re(s,r.cls("djs-drag-group",["no-events"]));var c=le("g");return a.forEach(function(u){var l;u.hidden||(u.waypoints?(l=n._createContainer("connection",c),n.drawConnection(Ar(l),u)):(l=n._createContainer("shape",c),n.drawShape(Ar(l),u),Kt(l,u.x,u.y)),i.addDragger(u,s,l))}),s}t.on("create.move",dP,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(),we(p,l)),Kt(l,a.x,a.y)):It(l)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&It(c)})}ey.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const ic={__depends__:[Ai,vo,di,zn],__init__:["create","createPreview"],create:["type",Zg],createPreview:["type",ey]};function hp(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)})}hp.$inject=["eventBus"],hp.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||hP(0,0)};function hP(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 ua={__init__:["mouse"],mouse:["type",hp]};var ty=2e3;function Sn(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),mP(l)&&(u.priority=2,u.host=l.host.id),et(l)&&(u.priority=3,u.source=l.source.id,u.target=l.target.id,u.waypoints=gP(l)),Me(l)&&(u.priority=4,u.labelTarget=l.labelTarget.id),M(["x","y","width","height"],function(f){xe(l[f])&&(u[f]=l[f])}),u.hidden=l.hidden,u.collapsed=l.collapsed}),r.on("copyPaste.elementsCopied",ty,function(c){var u;((u=c.hints)==null?void 0:u.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",ty,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var u=c.hints;D(u,{createElementsBehavior:!1})})}Sn.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],Sn.prototype.copy=function(e,t={}){var n,i;return ge(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(ge(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},Sn.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})}}},Sn.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},Sn.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},Sn.prototype._getElementIdsFromTree=function(e){var t={};return M(e,function(n){M(n,function(i){i.id&&(t[i.id]=!0)})}),t},Sn.prototype._paste=function(e,t,n,i){M(e,function(o){xe(o.x)||(o.x=0),xe(o.y)||(o.y=0)});var r=Rt(e);return M(e,function(o){et(o)&&(o.waypoints=en(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),D(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,D({},i))},Sn.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return M(e,function(o,a){o=ti(o,"priority"),M(o,function(s){var c=D({},ni(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var u;if(et(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},Sn.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(ni(e,["id"]));return t},Sn.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(ni(e,["id"]));return t},Sn.prototype.createShape=function(e){var t=this._elementFactory.createShape(ni(e,["id"]));return t},Sn.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(et(e)&&(!n.has(e.source)||!n.has(e.target))||Me(e)&&!n.has(e.labelTarget))},Sn.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=ms(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}Pr(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(E){c(E,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=en(r,function(p){return p.element});var l=new Set(e);return r=en(r,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:l}),p}),r=ti(r,function(p){return p.descriptor.priority}),e=en(r,function(p){return p.element}),M(r,function(p){var f=p.depth;if(!n.hasRelations(p.element,e,l)){iy(p.element,e),l.delete(p.element);return}if(!s(p.element,e)){iy(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 gP(e){return en(e.waypoints,function(t){return t=ny(t),t.original&&(t.original=ny(t.original)),t})}function ny(e){return D({},e)}function iy(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const yP={__depends__:[BC,ic,ua,di],__init__:["copyPaste"],copyPaste:["type",Sn]};function mp(e,t,n){ge(n)||(n=[n]),M(n,function(i){vr(e[i])||(t[i]=e[i])})}var gp=750;function ry(e,t,n){function i(c,u){var l=e.create(c.$type);return n.copyElement(c,l,null,u)}t.on("copyPaste.copyElement",gp,function(c){var u=c.descriptor,l=c.element,p=K(l);if(Me(l))return u;var f=u.businessObject=i(p,!0),d=u.di=i(He(l),!0);d.bpmnElement=f,mp(f,u,"name"),mp(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=K(c);return c.default&&(l[c.default]={element:p,property:"default"}),c.host&&(K(c).attachedToRef=K(u[c.host])),ni(l,vn(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=K(u[l.labelTarget]),l.di=He(u[l.labelTarget]);return}p=l.businessObject=i(p),f=l.di=i(f),f.bpmnElement=p,mp(l,p,["isExpanded","name"]),l.type=p.$type}),t.on("copyPaste.copyElement",gp,function(c){var u=c.descriptor,l=c.element;if(v(l,"bpmn:Participant")){var p=K(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(Xo(l),p=>{l.push(p.annotation)})}),t.on("copyPaste.pasteElement",gp,function(c){var u=c.cache,l=c.descriptor;a(u,s(l,u,o(u)))})}ry.$inject=["bpmnFactory","eventBus","moddleCopy"];const vP=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],_P=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function la(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 ti(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=Ft(r)&&r.$descriptor;if(a&&_P.includes(a))return o;if(a&&vP.includes(a)||a&&s&&!rt(s.properties,qr({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})}la.$inject=["eventBus","bpmnFactory","moddle"],la.prototype.copyElement=function(e,t,n,i=!1){n&&!ge(n)&&(n=[n]),n=n||yp(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(ge(r)&&(n=r),M(n,o=>{let a;yn(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!Ot(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},la.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 Ft(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):ge(e)?vn(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):Ft(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},la.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 yp(e,t){return vn(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const oy={__depends__:[yP],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",ry],moddleCopy:["type",la]};var ay=Math.round;function vp(e,t){this._modeling=e,this._eventBus=t}vp.$inject=["modeling","eventBus"],vp.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=ay(s+o/2),l=ay(c+a/2),p=i.replaceShape(e,D({},t,{x:u,y:l,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:p,hints:n}),p};function sy(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}sy.$inject=["selection","eventBus"];const bP={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",sy],replace:["type",vp]};function xP(e,t,n){ge(n)||(n=[n]),M(n,function(i){vr(e[i])||(t[i]=e[i])})}var EP=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function wP(e,t){var n=e&&yn(e,"collapsed")?e.collapsed:!Ie(e),i;return t&&(yn(t,"collapsed")||yn(t,"isExpanded"))?i=yn(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function cy(e,t,n,i,r,o){function a(s,c,u){u=u||{};var l=c.type,p=s.businessObject;if(rc(p)&&(l==="bpmn:SubProcess"||l==="bpmn:AdHocSubProcess")&&wP(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),xP(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var h=yp(p.$descriptor),m=yp(f.$descriptor,!0),g=SP(h,m);D(f,Xn(c,EP));var R=Oe(g,function(b){return b==="eventDefinitions"?uy(s,c.eventDefinitionType):b==="loopCharacteristics"?!on(f):yn(f,b)||b==="processRef"&&c.isExpanded===!1||b==="triggeredByEvent"?!1:b==="isForCompensation"?!on(f):!0});if(f=n.copyElement(p,f,R),c.eventDefinitionType&&(uy(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),v(p,"bpmn:Activity")){if(rc(p))d.isExpanded=Ie(s);else if(c&&yn(c,"isExpanded")){d.isExpanded=c.isExpanded;var E=t.getDefaultSize(f,{isExpanded:d.isExpanded});d.width=E.width,d.height=E.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}Ie(s)&&!v(p,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(rc(p)&&!rc(f)&&(u.moveChildren=!1),v(p,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):u.moveChildren=!1;var x=Vt(s);He(s).isHorizontal||(He(d).isHorizontal=x),d.width=x?s.width:t.getDefaultSize(d).width,d.height=x?t.getDefaultSize(d).height:s.height}return o.allowed("shape.resize",{shape:f})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),f.name=p.name,ke(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&ke(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}cy.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function rc(e){return v(e,"bpmn:SubProcess")}function uy(e,t){var n=K(e);return t&&n.get("eventDefinitions").some(function(i){return v(i,t)})}function SP(e,t){return e.filter(function(n){return t.includes(n)})}const ly={__depends__:[oy,bP,zn],bpmnReplace:["type",cy]};var RP=250;function Lr(e){this._eventBus=e,this._tools=[],this._active=null}Lr.$inject=["eventBus"],Lr.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)},Lr.prototype.isActive=function(e){return e&&this._active===e},Lr.prototype.length=function(e){return this._tools.length},Lr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Lr.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,RP,function(r){this._active&&(CP(r)||this.setActive(null))},this)};function CP(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Rr(t,'.group[data-group="tools"]')}const oc={__depends__:[Ai],__init__:["toolManager"],toolManager:["type",Lr]};function PP(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 AP(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 TP(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 _p=Math.abs,MP=Math.round,Ti={x:"width",y:"height"},py="crosshair",ir={n:"top",w:"left",s:"bottom",e:"right"},kP=1500,ac={n:"s",w:"e",s:"n",e:"w"},sc=20;function Vn(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&&dy(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){dy(c);var m={x:0,y:0};m[l]=MP(c["d"+l]),s.makeSpace(f,d,m,p,h),n.once("spaceTool.ended",function(g){s.activateSelection(g.originalEvent,!0,!0)})}})}Vn.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Vn.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:py,data:{context:{reactivate:n}},trapClick:!1})},Vn.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:py,data:{context:{}}})},Vn.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},Vn.prototype.init=function(e,t){var n=_p(e.dx)>_p(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(_p(i)<5)return!1;i<0&&(i*=-1),aa(e)&&(i*=-1);var o=PP(n,i),a=this._canvas.getRootElement();!Ys(e)&&e.hover&&(a=e.hover);var s=[...Go(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=DP(c,n,o,r,u);return D(t,c,{axis:n,direction:o,spaceToolConstraints:l,start:r}),nc("resize-"+(n==="x"?"ew":"ns")),!0},Vn.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(et(d)){l.push(d);return}var h=d[t],m=h+d[Ti[t]];if(OP(d)&&(n>0&&ye(d)[t]>i||n<0&&ye(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}},Vn.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Vn.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function fy(e){return{top:e.top-sc,right:e.right+sc,bottom:e.bottom+sc,left:e.left-sc}}function dy(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;xe(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),xe(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),xe(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),xe(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function DP(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=he(f),g=Oe(h,function(z){return!et(z)&&!Me(z)&&!l.has(z)&&!p.has(z)}),R=Oe(h,function(z){return!et(z)&&!Me(z)&&l.has(z)}),E,x,b,w=[],T=[],L,A,F,H;g.length&&(x=fy(he(Rt(g))),E=i-m[ir[n]]+x[ir[n]],n==="n"?s.bottom=u=xe(u)?Math.min(u,E):E:n==="w"?s.right=u=xe(u)?Math.min(u,E):E:n==="s"?s.top=c=xe(c)?Math.max(c,E):E:n==="e"&&(s.left=c=xe(c)?Math.max(c,E):E)),R.length&&(b=fy(he(Rt(R))),E=i-b[ir[ac[n]]]+m[ir[ac[n]]],n==="n"?s.bottom=u=xe(u)?Math.min(u,E):E:n==="w"?s.right=u=xe(u)?Math.min(u,E):E:n==="s"?s.top=c=xe(c)?Math.max(c,E):E:n==="e"&&(s.left=c=xe(c)?Math.max(c,E):E)),d&&d.length&&(d.forEach(function(z){l.has(z)?w.push(z):T.push(z)}),w.length&&(L=he(Rt(w.map(ye))),A=m[ir[ac[n]]]-(L[ir[ac[n]]]-i)),T.length&&(F=he(Rt(T.map(ye))),H=F[ir[n]]-(m[ir[n]]-i)),n==="n"?(E=Math.min(A||1/0,H||1/0),s.bottom=u=xe(u)?Math.min(u,E):E):n==="w"?(E=Math.min(A||1/0,H||1/0),s.right=u=xe(u)?Math.min(u,E):E):n==="s"?(E=Math.max(A||-1/0,H||-1/0),s.top=c=xe(c)?Math.max(c,E):E):n==="e"&&(E=Math.max(A||-1/0,H||-1/0),s.left=c=xe(c)?Math.max(c,E):E));var N=r&&r[f.id];N&&(n==="n"?(E=i+f[Ti[t]]-N[Ti[t]],s.bottom=u=xe(u)?Math.min(u,E):E):n==="w"?(E=i+f[Ti[t]]-N[Ti[t]],s.right=u=xe(u)?Math.min(u,E):E):n==="s"?(E=i-f[Ti[t]]+N[Ti[t]],s.top=c=xe(c)?Math.max(c,E):E):n==="e"&&(E=i-f[Ti[t]]+N[Ti[t]],s.left=c=xe(c)?Math.max(c,E):E))}),s}}function OP(e){return!!e.host}var bp="djs-dragging",hy="djs-resizing",LP=250,cc=Math.max;function my(e,t,n,i,r){function o(a,s){M(a,function(c){r.addDragger(c,s),n.addMarker(c,bp)})}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=le("g");re(l,i.cls("djs-crosshair-group",["no-events"])),we(s,l);var p=le("path");re(p,"d",u.x),Ne(p).add("djs-crosshair"),we(l,p);var f=le("path");re(f,"d",u.y),Ne(f).add("djs-crosshair"),we(l,f),c.crosshairGroup=l}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;Kt(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&It(c)}),e.on("spaceTool.move",LP,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=le("path"),re(c,"d","M0,0 L0,0"),Ne(c).add("djs-crosshair"),we(f,c),s.line=c;var d=le("g");re(d,i.cls("djs-drag-group",["no-events"])),we(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)||!et(L)||!h.has(L.target)||(m.add(L),g.push(L))})}),o(g,d),s.dragGroup=d}if(!s.frameGroup){var R=le("g");re(R,i.cls("djs-frame-group",["no-events"])),we(n.getActiveLayer(),R);var E=[];M(p,function(T){var L=r.addFrame(T,R),A=L.getBBox();E.push({element:L,initialBounds:A}),n.addMarker(T,hy)}),s.frameGroup=R,s.frames=E}var x={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};re(c,{d:x[u]});var b={x:"y",y:"x"},w={x:a.dx,y:a.dy};w[b[s.axis]]=0,Kt(s.dragGroup,w.x,w.y),M(s.frames,function(T){var L=T.element,A=T.initialBounds,F,H;s.direction==="e"?re(L,{width:cc(A.width+w.x,5)}):(F=cc(A.width-w.x,5),re(L,{width:F,x:A.x+A.width-F})),s.direction==="s"?re(L,{height:cc(A.height+w.y,5)}):(H=cc(A.height-w.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,bp)}),M(u,function(h){n.removeMarker(h,bp)}),f&&(It(p),It(f)),M(l,function(h){n.removeMarker(h,hy)}),d&&It(d)})}my.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const IP={__init__:["spaceToolPreview"],__depends__:[Ai,di,oc,vo,ua],spaceTool:["type",Vn],spaceToolPreview:["type",my]};function uc(e,t){e.invoke(Vn,this),this._canvas=t}uc.$inject=["injector","canvas"],ie(uc,Vn),uc.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=Wr(Jr(r.children.filter(u=>v(u,"bpmn:Artifact")),Rt(o))));const s=[...e,...a];var c=Vn.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(u){return!(v(u,"bpmn:TextAnnotation")||NP(u)&&(t==="y"&&Vt(u)||t==="x"&&!Vt(u)))}),c};function NP(e){return v(e,"bpmn:Participant")&&!K(e).processRef}const gy={__depends__:[IP],spaceTool:["type",uc]};function ht(e,t){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[],trigger:null},this._injector=t,this._eventBus=e,this._uid=1,e.on(["diagram.destroy","diagram.clear"],function(){this.clear(!1)},this)}ht.$inject=["eventBus","injector"],ht.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";const n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction()},ht.prototype.canExecute=function(e,t){const n={command:e,context:t},i=this._getHandler(e);let r=this._fire(e,"canExecute",n);if(r===void 0){if(!i)return!1;i.canExecute&&(r=i.canExecute(t))}return r},ht.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},ht.prototype.undo=function(){let e=this._getUndoAction(),t;if(e){for(this._currentExecution.trigger="undo",this._pushAction(e);e&&(this._internalUndo(e),t=this._getUndoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},ht.prototype.redo=function(){let e=this._getRedoAction(),t;if(e){for(this._currentExecution.trigger="redo",this._pushAction(e);e&&(this._internalExecute(e,!0),t=this._getRedoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},ht.prototype.register=function(e,t){this._setHandler(e,t)},ht.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");const n=this._injector.instantiate(t);this.register(e,n)},ht.prototype.canUndo=function(){return!!this._getUndoAction()},ht.prototype.canRedo=function(){return!!this._getRedoAction()},ht.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},ht.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},ht.prototype._internalUndo=function(e){const t=e.command,n=e.context,i=this._getHandler(t);this._atomicDo(()=>{this._fire(t,"revert",e),i.revert&&this._markDirty(i.revert(n)),this._revertedAction(e),this._fire(t,"reverted",e)})},ht.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const i=t?[e+"."+t,t]:[e];let r;n=this._eventBus.createEvent(n);for(const o of i)if(r=this._eventBus.fire("commandStack."+o,n),n.cancelBubble)break;return r},ht.prototype._createId=function(){return this._uid++},ht.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},ht.prototype._internalExecute=function(e,t){const n=e.command,i=e.context,r=this._getHandler(n);if(!r)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),r.preExecute&&r.preExecute(i),this._fire(n,"preExecuted",e)),this._atomicDo(()=>{this._fire(n,"execute",e),r.execute&&this._markDirty(r.execute(i)),this._executedAction(e,t),this._fire(n,"executed",e)}),t||(this._fire(n,"postExecute",e),r.postExecute&&r.postExecute(i),this._fire(n,"postExecuted",e)),this._popAction()},ht.prototype._pushAction=function(e){const t=this._currentExecution,n=t.actions,i=n[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=i&&i.id||this._createId()),n.push(e)},ht.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,n=e.actions,i=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:Hf("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},ht.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=ge(e)?e:[e],t.dirty=t.dirty.concat(e))},ht.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},ht.prototype._revertedAction=function(e){this._stackIdx--},ht.prototype._getHandler=function(e){return this._handlerMap[e]},ht.prototype._setHandler=function(e,t){if(!e||!t)throw new Error("command and handler required");if(this._handlerMap[e])throw new Error("overriding handler for command <"+e+">");this._handlerMap[e]=t};const BP={commandStack:["type",ht]};function rr(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 $P=250,yy=1400;function xp(e,t,n){Y.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",yy,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=vy(a),o.validatedShapes=vy(s)}),i&&t.on("shape.move.start",$P,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",yy,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;rr(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=el(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&&(Et(s.labels,a,c),a.labelTarget=s)})}ie(xp,Y),xp.$inject=["injector","eventBus","modeling"];function vy(e){var t=new Set(e);return Oe(e,function(n){return!t.has(n.labelTarget)})}const jP={__init__:["labelSupport"],labelSupport:["type",xp]};var FP=251,_y=1401,by="attach-ok";function Ep(e,t,n,i,r){Y.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",_y,function(a){var s=a.context,c=s.shapes,u=s.validatedShapes;s.shapes=HP(c),s.validatedShapes=zP(u)}),o&&t.on("shape.move.start",FP,function(a){var s=a.context,c=s.shapes,u=wp(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,by),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(l,by)}))}}),this.preExecuted("elements.move",_y,function(a){var s=a.context,c=s.closure,u=s.shapes,l=wp(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 VP(p)&&!GP(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;rr(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=$m(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=$m(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;rr(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}ie(Ep,Y),Ep.$inject=["injector","eventBus","canvas","rules","modeling"];function wp(e){return _u(en(e,function(t){return t.attachers||[]}))}function HP(e){var t=wp(e);return Lx("id",e,t)}function zP(e){var t=Ur(e,"id");return Oe(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function VP(e){return!!e.host}function GP(e,t){return e.indexOf(t)!==-1}const WP={__depends__:[di],__init__:["attachSupport"],attachSupport:["type",Ep]};function xy(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(dh(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)})}xy.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const Sp={__init__:["changeSupport"],changeSupport:["type",xy]};function Gn(e){this._model=e}Gn.$inject=["moddle"],Gn.prototype._needsId=function(e){return ke(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"])},Gn.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":ke(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))},Gn.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Gn.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Gn.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",D({bpmnElement:e,bounds:this.createDiBounds()},t))},Gn.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Gn.prototype.createDiWaypoints=function(e){var t=this;return en(e,function(n){return t.createDiWaypoint(n)})},Gn.prototype.createDiWaypoint=function(e){return this.create("dc:Point",Xn(e,["x","y"]))},Gn.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",D({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Gn.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",D({bpmnElement:e},t))};function Rn(e,t,n){Y.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"],Cn(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Cn(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"],Cn(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],Cn(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"],Cn(u)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],Cn(u));function l(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],Cn(l)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],Cn(l)),this.executed("connection.reconnect",Cn(function(d){var h=d.context,m=h.connection,g=h.oldSource,R=h.newSource,E=K(m),x=K(g),b=K(R);E.conditionExpression&&!ke(b,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(h.oldConditionExpression=E.conditionExpression,delete E.conditionExpression),g!==R&&x.default===E&&(h.oldDefault=x.default,delete x.default)})),this.reverted("connection.reconnect",Cn(function(d){var h=d.context,m=h.connection,g=h.oldSource,R=h.newSource,E=K(m),x=K(g),b=K(R);h.oldConditionExpression&&(E.conditionExpression=h.oldConditionExpression),h.oldDefault&&(x.default=h.oldDefault,delete b.default)}));function p(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],Cn(p)),this.reverted(["element.updateAttachment"],Cn(p)),this.executed("element.updateLabel",Cn(f)),this.reverted("element.updateLabel",Cn(f));function f(d){const{element:h}=d.context,m=On(h),g=He(h),R=g&&g.get("label");Zi(h)||Ks(h)||(m&&!R?g.set("label",t.create("bpmndi:BPMNLabel")):!m&&R&&g.set("label",void 0))}}ie(Rn,Y),Rn.$inject=["eventBus","bpmnFactory","connectionDocking"],Rn.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},Rn.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=He(e),o=n&&n.businessObject,a=He(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)}},Rn.prototype.updateBounds=function(e){var t=He(e),n=qP(e);if(n){var i=Zn(n,t.get("bounds"));D(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)),D(o,{x:e.x,y:e.y,width:e.width,height:e.height})},Rn.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;v(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),vt(i,e)),v(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),Et(r,e))}},Rn.prototype.updateDiConnection=function(e,t,n){var i=He(e),r=He(t),o=He(n);i.sourceElement&&i.sourceElement.bpmnElement!==K(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==K(n)&&(i.targetElement=n&&o)},Rn.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):(vt(n,e),e.$parent=null)}};function UP(e){for(;e&&!v(e,"bpmn:Definitions");)e=e.$parent;return e}Rn.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)},Rn.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=UP(e.$parent||t),e.$parent&&(vt(o.get("rootElements"),r),r.$parent=null),t&&(Et(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),vt(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);vt(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},Rn.prototype.updateConnectionWaypoints=function(e){var t=He(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},Rn.prototype.updateConnection=function(e){var t=e.connection,n=K(t),i=t.source,r=K(i),o=t.target,a=K(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&&(vt(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(vt(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)},Rn.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function Cn(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;v(i,"bpmn:BaseElement")&&e(t)}}function qP(e){if(v(e,"bpmn:Activity")){var t=He(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function or(e,t){Si.call(this),this._bpmnFactory=e,this._moddle=t}ie(or,Si),or.$inject=["bpmnFactory","moddle"],or.prototype._baseCreate=Si.prototype.create,or.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,D({type:"label",di:n},Tr,t))}return this.createElement(e,t)},or.prototype.createElement=function(e,t){t=D({},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(!KP(r)){var o=D({},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=D({isFrame:!0},t)),t=YP(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Rp(r,t,"isExpanded")),ke(i,["bpmn:Lane","bpmn:Participant"])&&(t=Rp(r,t,"isHorizontal")),v(i,"bpmn:SubProcess")&&(t.collapsed=!Ie(i,r)),v(i,"bpmn:ExclusiveGateway")&&(yn(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),Ot(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),Ot(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=D({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},or.prototype.getDefaultSize=function(e,t){var n=K(e);if(t=t||He(e),v(n,"bpmn:SubProcess"))return Ie(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 Ie(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}},or.prototype.createParticipantShape=function(e){return Ft(e)||(e={isExpanded:e}),e=D({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function YP(e,t,n){return M(n,function(i){t=Rp(e,t,i)}),t}function Rp(e,t,n){return t[n]===void 0?t:(e[n]=t[n],ni(t,[n]))}function KP(e){return ke(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function lc(e,t){this._modeling=e,this._canvas=t}lc.$inject=["modeling","canvas"],lc.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;M(n,function(r){var o={x:0,y:0};Ot(i.left)?o.x=i.left-r.x:Ot(i.right)?o.x=i.right-r.width-r.x:Ot(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:Ot(i.top)?o.y=i.top-r.y:Ot(i.bottom)?o.y=i.bottom-r.height-r.y:Ot(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},lc.prototype.postExecute=function(e){};function pc(e){this._modeling=e}pc.$inject=["modeling"],pc.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},pc.prototype.postExecute=function(e){var t=e.hints||{};XP(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 XP(e,t){return Bi(e.outgoing,function(n){return n.target===t})}function fc(e,t){this._canvas=e,this._layouter=t}fc.$inject=["canvas","layouter"],fc.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},fc.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var dc=Math.round;function Cp(e){this._modeling=e}Cp.$inject=["modeling"],Cp.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){xe(p.x)||(p.x=0),xe(p.y)||(p.y=0)});var s=Oe(t,function(p){return!p.hidden}),c=Rt(s);M(t,function(p){et(p)&&(p.waypoints=en(p.waypoints,function(f){return{x:dc(f.x-c.x-c.width/2+r.x),y:dc(f.y-c.y-c.height/2+r.y)}})),D(p,{x:dc(p.x-c.x-c.width/2+r.x),y:dc(p.y-c.y-c.height/2+r.y)})});var u=new Set(ms(t)),l={};M(t,function(p){if(et(p)){l[p.id]=xe(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=D({},o);u.has(p)||(f.autoResize=!1),Me(p)&&(f=ni(f,["attach"])),l[p.id]=xe(i)?a.createShape(p,Xn(p,["x","y","width","height"]),p.parent||n,i,f):a.createShape(p,Xn(p,["x","y","width","height"]),p.parent||n,f)}),e.elements=Wr(l)};var Ey=Math.round;function ar(e){this._canvas=e}ar.$inject=["canvas"],ar.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?D(t,n):D(t,{x:n.x-Ey(t.width/2),y:n.y-Ey(t.height/2)}),this._canvas.addShape(t,i,r),t},ar.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function pa(e){ar.call(this,e)}ie(pa,ar),pa.$inject=["canvas"];var ZP=ar.prototype.execute;pa.prototype.execute=function(e){var t=e.shape;return JP(t),t.labelTarget=e.labelTarget,ZP.call(this,e)};var QP=ar.prototype.revert;pa.prototype.revert=function(e){return e.shape.labelTarget=null,QP.call(this,e)};function JP(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function fa(e,t){this._canvas=e,this._modeling=t}fa.$inject=["canvas","modeling"],fa.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;rr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),rr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},fa.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=el(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},fa.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,Et(n.children,t,i),this._canvas.addConnection(t,n),t};function Pp(e,t){this._modeling=e,this._elementRegistry=t}Pp.$inject=["modeling","elementRegistry"],Pp.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 da(e,t){this._canvas=e,this._modeling=t}da.$inject=["canvas","modeling"],da.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;rr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),rr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),rr(n.children,function(i){et(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},da.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=el(i.children,n),t.removeShape(n),n},da.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return Et(i.children,n,r),t.addShape(n,i),n};function hc(e){this._modeling=e}hc.$inject=["modeling"];var wy={x:"y",y:"x"};hc.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 E={y:0};E[i]=g-a(R),E[i]&&(E[wy[i]]=0,t.moveElements([R],E,R.parent))}var l=n[0],p=s(n),f=n[p],d,h,m=0;M(n,function(g,R){var E,x,b;if(g.elements.length<2){R&&R!==n.length-1&&(o(g,g.elements[0]),m+=c(g.range));return}E=ti(g.elements,i),x=E[0],R===p&&(x=E[s(E)]),b=a(x),g.range=null,M(E,function(w){if(u(b,w),g.range===null){g.range={min:w[i],max:w[i]+w[r]};return}o(g,w)}),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 E={},x;g===l||g===f||(x=n[R-1],g.range.max=0,M(g.elements,function(b,w){E[wy[i]]=0,E[i]=x.range.max-b[i]+d,g.range.min!==b[i]&&(E[i]+=b[i]-g.range.min),E[i]&&t.moveElements([b],E,b.parent),g.range.max=Math.max(b[i]+b[r],w?g.range.max:0)}))})},hc.prototype.postExecute=function(e){};function mc(e,t){this._layouter=e,this._canvas=t}mc.$inject=["layouter","canvas"],mc.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return D(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},mc.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Ap(){}Ap.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=vt(o.children,t),Et(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},Ap.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return vt(n.children,t),Et(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 Tp(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Tp.prototype.add=function(e,t){return this.addAll([e],t)},Tp.prototype.addAll=function(e,t){var n=Tw(e,!!t,this);return D(this,n),this};function ha(e){this._modeling=e}ha.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},ha.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&&Nl(p,p.source,t),connectionEnd:d&&Bl(p,p.target,t)})})},ha.prototype.getClosure=function(e){return new Tp().addAll(e,!0)};function gc(e){this._helper=new ha(e)}gc.$inject=["modeling"],gc.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},gc.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 Ir(e){this._modeling=e,this._helper=new ha(e)}Ir.$inject=["modeling"],Ir.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=Xn(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=vt(o.children,t),Et(i.children,t,r),D(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Ir.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:Bl(o,t,n)})}),M(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:Nl(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},Ir.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return Et(n.children,t,i),D(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},Ir.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Ir.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function ma(e){this._modeling=e}ma.$inject=["modeling"],ma.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 ge(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},ma.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||Sy(ge(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||Sy(ge(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},ma.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 Sy(e){return e.original||e}function Mi(e,t){this._modeling=e,this._rules=t}Mi.$inject=["modeling","rules"],Mi.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,Vs(h,s,l),a)}),M(d,function(h){var m=h.target,g=c(s,m,h);g&&t.reconnectStart(h,s,zs(h,s,l),a)})},Mi.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Mi.prototype.execute=function(e){},Mi.prototype.revert=function(e){},Mi.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},Mi.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},Mi.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function ga(e){this._modeling=e}ga.$inject=["modeling"],ga.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},D(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},ga.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:Vs(o,n,i)})}),M(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:zs(o,n,i)})}))},ga.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return D(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function sr(e){this._modeling=e}sr.$inject=["modeling"],sr.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,r=e.resizingShapes,o=e.start,a={};this.moveShapes(i,t),M(r,function(s){a[s.id]=tA(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(AP(i,r),t,n,o,i,r,a)},sr.prototype.execute=function(){},sr.prototype.revert=function(){},sr.prototype.moveShapes=function(e,t){var n=this;M(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},sr.prototype.resizeShapes=function(e,t,n){var i=this;M(e,function(r){var o=TP(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},sr.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=eA(l),h=Cy(n),m={},g=c.has(p)||u.has(p),R=c.has(f)||u.has(f);g&&R?(d=en(d,function(E){return Py(E,i,n)&&(E[h]=E[h]+t[h]),E.original&&Py(E.original,i,n)&&(E.original[h]=E.original[h]+t[h]),E}),s._modeling.updateWaypoints(l,d,{labelBehavior:!1})):(g||R)&&(c.has(p)?m.connectionStart=Nl(l,p,t):c.has(f)?m.connectionEnd=Bl(l,f,t):u.has(p)?m.connectionStart=zs(l,p,a[p.id]):u.has(f)&&(m.connectionEnd=Vs(l,f,a[f.id])),s._modeling.layoutConnection(l,m))})};function Ry(e){return D({},e)}function eA(e){return en(e.waypoints,function(t){return t=Ry(t),t.original&&(t.original=Ry(t.original)),t})}function Cy(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function Py(e,t,n){var i=Cy(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function tA(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function yc(e){this._modeling=e}yc.$inject=["modeling"],yc.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=Ay(n),t.collapsed=!t.collapsed;var i=Ty(n,t.collapsed);return[t].concat(i)},yc.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=My(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function Ay(e){var t={};return M(e,function(n){t[n.id]=n.hidden,n.children&&(t=D({},t,Ay(n.children)))}),t}function Ty(e,t){var n=[];return M(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(Ty(i.children,i.collapsed||t)))}),n}function My(e,t){var n=[];return M(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(My(i.children,t)))}),n}function vc(e){this._modeling=e}vc.$inject=["modeling"],vc.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=ky(i,t),Dy(n,t),t.host=n,t},vc.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,ky(n,t),Dy(i,t,r),t};function ky(e,t){return vt(e&&e.attachers,t)}function Dy(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),Et(i,t,n)}}function Mp(){}Mp.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},Mp.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function tt(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}tt.$inject=["eventBus","elementFactory","commandStack"],tt.prototype.getHandlers=function(){return{"shape.append":pc,"shape.create":ar,"shape.delete":da,"shape.move":Ir,"shape.resize":ga,"shape.replace":Mi,"shape.toggleCollapse":yc,spaceTool:sr,"label.create":pa,"connection.create":fc,"connection.delete":fa,"connection.move":Ap,"connection.layout":mc,"connection.updateWaypoints":Mp,"connection.reconnect":ma,"elements.create":Cp,"elements.move":gc,"elements.delete":Pp,"elements.distribute":hc,"elements.align":lc,"element.updateAttachment":vc}},tt.prototype.registerHandlers=function(e){M(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},tt.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)},tt.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},tt.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)},tt.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)},tt.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},tt.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},tt.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},tt.prototype.createElements=function(e,t,n,i,r){ge(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},tt.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},tt.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},tt.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},tt.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},tt.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},tt.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},tt.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},tt.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},tt.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},tt.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)},tt.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},tt.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)},tt.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,D(i,{docking:"source"}))},tt.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,D(i,{docking:"target"}))},tt.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},tt.prototype._create=function(e,t){return h1(t)?t:this._elementFactory.create(e,t)},tt.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function ya(e){this._elementRegistry=e}ya.$inject=["elementRegistry"],ya.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||nA(n,Ga(i));return Oy(n,i),e.oldProperties=o,e.changed=r,r},ya.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return Oy(n,t),i},ya.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return v(e,"bpmn:DataObject")?iA(e,t):[]};function nA(e,t){return vn(t,function(n,i){return n[i]=e.get(i),n},{})}function Oy(e,t){M(t,function(n,i){e.set(i,n)})}function iA(e,t){return t.filter(function(n){return v(n,"bpmn:DataObjectReference")&&K(n).dataObjectRef===e})}var va="default",ki="id",Ly="di",rA={width:0,height:0};function _a(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}_a.$inject=["elementRegistry","moddle","modeling","textRenderer"],_a.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=uA(e.properties),s=e.oldProperties||oA(t,a);return Iy(a,o)&&(r.unclaim(o[ki]),i.updateId(t,a[ki]),r.claim(a[ki],o)),va in a&&(a[va]&&n.push(i.get(a[va].id)),o[va]&&n.push(i.get(o[va].id))),Ny(t,a),e.oldProperties=s,e.changed=n,n},_a.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&K(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,rA)}},_a.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 Ny(t,i),Iy(n,r)&&(a.unclaim(n[ki]),o.updateId(t,i[ki]),a.claim(i[ki],r)),e.changed};function Iy(e,t){return ki in e&&e[ki]!==t[ki]}function oA(e,t){var n=Ga(t),i=e.businessObject,r=He(e);return vn(n,function(o,a){return a!==Ly?o[a]=i.get(a):o[a]=aA(r,Ga(t.di)),o},{})}function aA(e,t){return vn(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function Ny(e,t){var n=e.businessObject,i=He(e);M(t,function(r,o){o!==Ly?n.set(o,r):i&&sA(i,r)})}function sA(e,t){M(t,function(n,i){e.set(i,n)})}var cA=["default"];function uA(e){var t=D({},e);return cA.forEach(function(n){n in e&&(t[n]=K(t[n]))}),t}function _c(e,t){this._canvas=e,this._modeling=t}_c.$inject=["canvas","modeling"],_c.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=He(r);return t.setRootElement(n),t.removeRootElement(r),Et(a.rootElements,i),i.$parent=a,vt(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},_c.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=He(n);return t.setRootElement(r),t.removeRootElement(n),vt(a.rootElements,i),i.$parent=null,Et(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function kp(e,t){this._modeling=e,this._spaceTool=t}kp.$inject=["modeling","spaceTool"],kp.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=Fn(i),a=o===i,s=a?i:i.parent,c=Ji(s),u=Vt(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+jn,y:i.y,width:i.width-jn,height:i.height}:{x:i.x,y:i.y+jn,width:i.width,height:i.height-jn};n.createShape({type:"bpmn:Lane",isHorizontal:u},l,s)}var p=[];Pr(o,function(b){return p.push(b),b.label&&p.push(b.label),b===i?[]:Oe(b.children,function(w){return w!==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),E=u?{x:0,y:f}:{x:f,y:0};t.makeSpace(R.movingShapes,R.resizingShapes,E,m,h);var x=u?{x:i.x+(a?jn:0),y:d-(r==="top"?120:0),width:i.width-(a?jn:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?jn:0),width:120,height:i.height-(a?jn:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:u},x,s)};function Dp(e){this._modeling=e}Dp.$inject=["modeling"],Dp.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=Ji(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=Vt(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+jn,y:n.y+f*c,width:n.width-jn,height:u}:{x:n.x+f*c,y:n.y+jn,width:u,height:n.height-jn},f<o?t.resizeShape(r[f],l):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,l,n))};function ba(e,t){this._modeling=e,this._spaceTool=t}ba.$inject=["modeling","spaceTool"],ba.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},ba.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=iR(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},ba.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=he(e),r=he(t),o=hm(r,i),a=Fn(e),s=[],c=[];Pr(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 xa="flowNodeRef",Op="lanes";function bc(){}bc.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(l,p){var f=he(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=Fn(l);return r[p.id]||(r[p.id]=Bs(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=Fn(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(Op),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(xa).forEach(function(f){i.push({flowNode:f,remove:[p],add:[]})})}),i},bc.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(Op);n.remove.forEach(function(o){vt(r,o),vt(o.get(xa),i)}),n.add.forEach(function(o){Et(r,o),Et(o.get(xa),i)})}),[]},bc.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(Op);n.add.forEach(function(o){vt(r,o),vt(o.get(xa),i)}),n.remove.forEach(function(o){Et(r,o),Et(o.get(xa),i)})}),[]};var Lp="categoryValueRef";function Ea(e,t){this._bpmnFactory=e,this._elementRegistry=t}Ea.$inject=["bpmnFactory","elementRegistry"],Ea.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,r=new Map,o=[],a=new Map;function s(E,x,b){if(x){var w=a.get(E);w||(w={},a.set(E,w)),!(b&&w.present)&&(!b&&w.past||(b?w.present={categoryValue:x,root:Ip(E)}:w.past={categoryValue:x}))}}function c(E){r.set(E,K(E))}function u(){n.filter(function(E){return v(E,"bpmn:FlowElement")&&!Me(E)&&E.parent}).forEach(c)}function l(E){var x=K(E),b=x.get("categoryValueRef");return b||(b=um(i,x),o.push(lA(E,b))),b}function p(E){return E.reduce(function(x,b){var w=Ip(b),T=x.get(w);return T||(T=[],x.set(w,T)),T.push(b),x},new Map)}e=Array.from(e||[]);var f=p(e);t.length&&u(),e.forEach(c),n.filter(function(E){return v(E,"bpmn:Group")&&!Me(E)&&E.parent}).forEach(function(E){var x=K(E).get("categoryValueRef");if(!x){var b=Ip(E),w=f.get(b)||[],T=Jr(w,E),L=Object.keys(T).length>0;L&&(x=l(E))}s(E,x,!0)}),t.forEach(function(E){s(E.groupShape,E.categoryValue,!1)}),o.length&&u();var d=Array.from(r.keys()),h=Array.from(a.values()).reduce(function(E,x){return x.present&&E.add(x.present.categoryValue),x.past&&E.add(x.past.categoryValue),E},new Set),m=new Map,g=p(d);a.forEach(function(E,x){var b=E.present;if(b){var w=g.get(b.root)||[],T=Jr(w,x);w.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(E,x){var b=r.get(x),w=b.get(Lp),T=new Set(w),L=m.get(x)||new Set,A=Array.from(L).filter(function(H){return!T.has(H)}),F=w.filter(function(H){return h.has(H)&&!L.has(H)});return(A.length||F.length)&&E.push({businessObject:b,categoryValuesToAdd:A,categoryValuesToRemove:F}),E},[]);return{flowElements:R,groups:o}},Ea.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),pA(t.groups),dA(t.flowElements),[]},Ea.prototype.revert=function(e){var t=e.updates;return hA(t.flowElements),fA(t.groups),[]};function lA(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function pA(e){e.forEach(function(t){K(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function fA(e){e.forEach(function(t){K(t.groupShape).categoryValueRef=null})}function dA(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Lp);t.categoryValuesToRemove.forEach(function(r){vt(i,r)}),t.categoryValuesToAdd.forEach(function(r){Et(i,r,!0)})})}function hA(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Lp);t.categoryValuesToAdd.forEach(function(r){vt(i,r)}),t.categoryValuesToRemove.forEach(function(r){Et(i,r,!0)})})}function Ip(e){for(;e.parent;)e=e.parent;return e}function xc(e){this._moddle=e}xc.$inject=["moddle"],xc.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),[]},xc.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 Np(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(gn(t)){var n=gA(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}Np.$inject=["commandStack"],Np.prototype.postExecute=function(e){var t=e.elements,n=e.colors||mA,i=this,r={};"fill"in n&&D(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&D(r,{"border-color":this._normalizeColor(n.stroke)}),M(t,function(o){var a=et(o)?Xn(r,["border-color"]):r,s=He(o);if(yA(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(!ke(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function gA(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 yA(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var vA={width:0,height:0};function By(e,t,n){function i(c,u){var l=c.label||c,p=c.labelTarget||c;return U1(l,u),[l,p]}function r(c){var u=c.element,l=u.businessObject,p=c.newLabel;if(!Me(u)&&Zi(u)&&!Ss(u)&&!$y(p)){var f=7,d=al(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=On(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)&&$y(p)){d.removeShape!==!1&&e.removeShape(l,{unsetLabel:!1});return}var h=On(u);typeof f>"u"&&(f=t.getExternalLabelBounds(l,h)),f&&e.resizeShape(l,f,vA)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}By.$inject=["modeling","textRenderer","bpmnFactory"];function $y(e){return!e||!e.trim()}function Zt(e,t,n,i){tt.call(this,e,t,n),this._bpmnRules=i}ie(Zt,tt),Zt.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],Zt.prototype.getHandlers=function(){var e=tt.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=ya,e["element.updateProperties"]=_a,e["canvas.updateRoot"]=_c,e["lane.add"]=kp,e["lane.resize"]=ba,e["lane.split"]=Dp,e["lane.updateRefs"]=bc,e["group.updateRefs"]=Ea,e["id.updateClaim"]=xc,e["element.setColor"]=Np,e["element.updateLabel"]=By,e},Zt.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},Zt.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)},Zt.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},Zt.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},Zt.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},Zt.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},Zt.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},Zt.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Zt.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Zt.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},Zt.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},Zt.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},Zt.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},Zt.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function jy(){}jy.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||ye(t.source||e.source),t.connectionEnd||ye(t.target||e.target)]};var Ec=20,_A=5,wc=Math.round,Fy=20,bA={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function xA(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function EA(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function Hy(e,t,n){var i=Yt(t,e,_A),r=n.split(":")[0],o=wc((t.x-e.x)/2+e.x),a=wc((t.y-e.y)/2+e.y),s,c,u=EA(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=xA(i,r),c=l?"h:v":"v:h",p?l?(f=a===e.y,s={x:e.x+Ec*(/l/.test(r)?-1:1),y:f?a+Ec:a}):(f=o===e.x,s={x:f?o+Ec:o,y:e.y+Ec*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:Bp(e,s,c).concat(s),directions:c,turnNextDirections:f}}function wA(e,t,n){return Hy(e,t,n)}function SA(e,t,n){var i=Hy(t,e,zy(n));return{waypoints:i.waypoints.slice().reverse(),directions:zy(i.directions),turnNextDirections:i.turnNextDirections}}function RA(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=Bp(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function zy(e){return e.split(":").reverse().join(":")}function CA(e,t,n){var i=wc((t.x-e.x)/2+e.x),r=wc((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 Bp(e,t,n){if(n=n||"h:h",!IA(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Gy(n)){var i=wA(e,t,n),r=SA(e,t,n),o=RA(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return CA(e,t,n)}function PA(e,t,n){var i=Bp(e,t,n);return i.unshift(e),i.push(t),Uy(i)}function AA(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=Dx(o,"straight")[0]||"h:h",s=bA[a]||0,c=Yt(e,t,s),u=LA(c,a);n=n||ye(e),i=i||ye(t);var l=u.split(":"),p=Wy(n,e,l[0],NA(c)),f=Wy(i,t,l[1],c);return PA(p,f,u)}function TA(e,t,n,i,r,o){ge(n)&&(r=n,o=i,n=ye(e),i=ye(t)),o=D({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&&OA(t,e,i,r),c)||(c=o.connectionStart&&DA(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:AA(e,t,n,i,o)}function MA(e,t,n){return e>=t&&e<=n}function Vy(e,t,n){var i={x:"width",y:"height"};return MA(t[e],n[e],n[e]+n[i[e]])}function kA(e,t,n,i,r){var o={},a,s;return s=Yt(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?Vy(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:Vy(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 DA(e,t,n,i){return $p(e,t,n,i)}function OA(e,t,n,i){var r=i.slice().reverse();return r=$p(e,t,n,r),r?r.reverse():null}function $p(e,t,n,i){function r(l){return l.length<3?!0:l.length>4?!1:!!rt(l,function(p,f){var d=l[f-1];return d&&Uo(p,d)<3})}function o(l,p,f){var d=Ei(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(mh(l[d],p,Fy)||mh(l[d],f,Fy))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=$p(e,t,n,u)),c&&Ei(c)?null:c}function LA(e,t){if(Gy(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 IA(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Gy(e){return e&&/t|r|b|l/.test(e)}function NA(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 Wy(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 Uy(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return tl(r,o,n,0)||t.push(n),t},[])}var BA=-10,$A=40,jA={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},FA={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},jp={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},wa={top:"t",right:"r",bottom:"b",left:"l"};function Sc(e){this._elementRegistry=e}ie(Sc,jy),Sc.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=qy(r&&r[0],n)),a||(a=qy(r&&r[r.length-1],i)),(v(e,"bpmn:Association")||v(e,"bpmn:DataAssociation"))&&r&&!Yy(n,i))return[].concat([o],r.slice(1,-1),[a]);var l=om(n,s)?jA:FA;return v(e,"bpmn:MessageFlow")?c=zA(n,i,l):(v(e,"bpmn:SequenceFlow")||Yy(n,i))&&(n===i?c={preferredLayouts:YA(n,e,l)}:v(n,"bpmn:BoundaryEvent")?c={preferredLayouts:KA(n,i,a,l)}:Sa(n)||Sa(i)?c={preferredLayouts:l.subProcess,preserveDocking:GA(n)}:v(n,"bpmn:Gateway")?c={preferredLayouts:l.fromGateway}:v(i,"bpmn:Gateway")?c={preferredLayouts:l.toGateway}:c={preferredLayouts:l.default}),c&&(c=D(c,t),u=Uy(TA(n,i,o,a,r,c))),u||[o,a]};function HA(e){var t=e.host;return Yt(ye(e),t,BA)}function zA(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:VA(e,t)}}function VA(e,t){return v(t,"bpmn:Participant")?"source":v(e,"bpmn:Participant")?"target":Sa(t)?"source":Sa(e)||v(t,"bpmn:Event")?"target":v(e,"bpmn:Event")?"source":null}function GA(e){return Sa(e)?"target":"source"}function qy(e,t){return e?e.original||e:ye(t)}function Yy(e,t){return v(t,"bpmn:Activity")&&v(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Sa(e){return v(e,"bpmn:SubProcess")&&Ie(e)}function Nr(e,t){return e===t}function WA(e,t){return t.indexOf(e)!==-1}function _o(e){var t=/right|left/.exec(e);return t&&t[0]}function bo(e){var t=/top|bottom/.exec(e);return t&&t[0]}function Ky(e,t){return jp[e]===t}function UA(e,t){var n=_o(e),i=jp[n];return t.indexOf(i)!==-1}function qA(e,t){var n=bo(e),i=jp[n];return t.indexOf(i)!==-1}function Xy(e){return e==="right"||e==="left"}function YA(e,t,n){var i=t.waypoints,r=i&&i.length&&Yt(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function KA(e,t,n,i){var r=ye(e),o=ye(t),a=HA(e),s,c,u=Nr(e.host,t),l=WA(a,["top","right","bottom","left"]),p=Yt(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?XA(a,l,e,t,n,i):(s=ZA(a,p,l,i.isHorizontal),c=QA(a,p,l,i.isHorizontal),[s+":"+c])}function XA(e,t,n,i,r,o){var a=t?e:o.isHorizontal?bo(e):_o(e),s=wa[a],c;return t?Xy(e)?c=Zy("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=Zy("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function Zy(e,t,n,i){var r=$A;return!(Fp(e,i,n,r)||Fp(e,i,{x:n.x+n.width,y:n.y+n.height},r)||Fp(e,i,ye(t),r))}function Fp(e,t,n,i){return Math.abs(t[e]-n[e])<i}function ZA(e,t,n,i){if(n)return wa[e];var r=bo(e),o=_o(e),a=bo(t),s=_o(t);if(i){if(Nr(r,a)||Ky(o,s))return wa[r]}else if(Nr(o,s)||Ky(r,a))return wa[o];return wa[i?o:r]}function QA(e,t,n,i){if(n)return Xy(e)?UA(e,t)||Nr(e,t)?"h":"v":qA(e,t)||Nr(e,t)?"v":"h";var r=bo(e),o=_o(e),a=bo(t),s=_o(t);return a&&!s?"v":s&&!a?"h":i?Nr(r,a)?"h":"v":Nr(o,s)?"v":"h"}Sc.$inject=["elementRegistry"];function Qy(e){return D({original:e.point.original||e.point},e.actual)}function cr(e,t){this._elementRegistry=e,this._graphicsFactory=t}cr.$inject=["elementRegistry","graphicsFactory"],cr.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(Qy(i)),o.push(Qy(r)),o},cr.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}},cr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return qo(i,r,n)},cr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},cr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},cr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const Hp={__init__:["modeling","bpmnUpdater"],__depends__:[yC,OC,IC,NC,ly,BP,jP,WP,zn,Sp,gy],bpmnFactory:["type",Gn],bpmnUpdater:["type",Rn],elementFactory:["type",or],modeling:["type",Zt],layouter:["type",Sc],connectionDocking:["type",cr]};var JA=10,Jy=50,eT=250;function zp(e,t,n,i){for(var r;r=tT(e,n,t);)n=i(t,n,r);return n}function Vp(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 tT(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=iT(e);return rt(r,function(o){if(o===n)return!1;var a=Yt(o,i,JA);return a==="intersect"})}function nT(e,t){t||(t={});function n(h){return h.source===e?1:-1}var i=t.defaultDistance||Jy,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||eT,c=t.reference||"start";o||(o=aT);function u(h,m){return r==="n"?c==="start"?he(h).top-he(m).bottom:c==="center"?he(h).top-ye(m).y:he(h).top-he(m).top:r==="w"?c==="start"?he(h).left-he(m).right:c==="center"?he(h).left-ye(m).x:he(h).left-he(m).left:r==="s"?c==="start"?he(m).top-he(h).bottom:c==="center"?ye(m).y-he(h).bottom:he(m).bottom-he(h).bottom:c==="start"?he(m).left-he(h).right:c==="center"?ye(m).x-he(h).right:he(m).right-he(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=vn(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 iT(e){var t=Gp(e);return e.host&&(t=t.concat(Gp(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(Gp(i))},[]))),t}function Gp(e){return oT(e).concat(rT(e))}function rT(e){return e.incoming.map(function(t){return t.source})}function oT(e){return e.outgoing.map(function(t){return t.target})}function aT(){return!0}var sT=100;function ev(e,t,n){e.on("autoPlace",sT,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}}ev.$inject=["eventBus","modeling","canvas"];function cT(e,t,n){n||(n={});var i=n.defaultDistance||Jy,r=ye(e),o=he(e);return{x:o.right+i+t.width/2,y:r.y}}function tv(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}tv.$inject=["eventBus","selection"];const uT={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",ev],autoPlaceSelectionBehavior:["type",tv]};function nv(e,t,n){var i=om(e,n);if(v(t,"bpmn:TextAnnotation"))return pT(e,t,i);if(ke(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return fT(e,t,i);if(v(t,"bpmn:FlowNode"))return lT(e,t,i)}function lT(e,t,n){var i=he(e),r=ye(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=nT(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=Yt(e,e.host,-25),u.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var l=n?{x:i.right+a+t.width/2,y:r.y+iv(u,c,o)}:{x:r.x+iv(u,c,o),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},f=n?{y:p}:{x:p};return zp(e,t,l,Vp(f))}function iv(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function pT(e,t,n){var i=he(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};et(e)&&(r=ye(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 zp(e,t,r,Vp(a))}function fT(e,t,n){var i=he(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 zp(e,t,r,Vp(a))}function rv(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return nv(r,i,t)})}rv.$inject=["eventBus","elementRegistry"];const Rc={__depends__:[uT],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",rv]},ov=[im,Jo,Hp,Rc];function dT(e={}){Wd(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new no({container:t,moddleExtensions:e.moddleExtensions??Za,additionalModules:[...ov,...e.additionalModules??[]]})}var hT=new yo("ov"),mT=500;function Gt(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=hT,this._overlayDefaults=D({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=gT(n.getContainer()),this._init()}Gt.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Gt.prototype.get=function(e){if(gn(e)&&(e={id:e}),gn(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?Oe(t.overlays,qr({type:e.type})):t.overlays.slice():[]}else return e.type?Oe(this._overlays,qr({type:e.type})):e.id?this._overlays[e.id]:null},Gt.prototype.add=function(e,t,n){if(Ft(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=D({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},Gt.prototype.remove=function(e){var t=this.get(e)||[];ge(t)||(t=[t]);var n=this;M(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(si(i.html),si(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)}})},Gt.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Gt.prototype.show=function(){Cc(this._overlayRoot)},Gt.prototype.hide=function(){Cc(this._overlayRoot,!1)},Gt.prototype.clear=function(){this._overlays={},this._overlayContainers=[],us(this._overlayRoot)},Gt.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=Rt(t);i=o.x,r=o.y}av(n,i,r),nn(e.html,"data-container-id",t.id)},Gt.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=Rt(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=Rt(i).height:s=i.height,o=t.bottom*-1+s}av(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Gt.prototype._createOverlayContainer=function(e){var t=st('<div class="djs-overlays" />');pn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},Gt.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";sv(this._overlayRoot,n)},Gt.prototype._getOverlayContainer=function(e,t){var n=rt(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},Gt.prototype._addOverlay=function(e){var t=e.id,n=e.element,i=e.html,r,o;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),gn(i)&&(i=st(i)),o=this._getOverlayContainer(n),r=st('<div class="djs-overlay" data-overlay-id="'+t+'">'),pn(r,{position:"absolute"}),r.appendChild(i),e.type&&ft(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();Cc(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())},Gt.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&&(Ot(r)&&r>t.scale||Ot(o)&&o<t.scale))&&(c=!1),Cc(a,c),this._updateOverlayScale(e,t)},Gt.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),Ot(i)&&t.scale<i&&(a=(1/t.scale||1)*i),Ot(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),Ot(a)&&(s="scale("+a+","+a+")"),sv(o,s)},Gt.prototype._updateOverlaysVisibilty=function(e){var t=this;M(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},Gt.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){si(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,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&&ft(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 gT(e){var t=st('<div class="djs-overlay-container" />');return pn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function av(e,t,n){pn(e,{left:t+"px",top:n+"px"})}function Cc(e,t){e.style.display=t===!1?"none":""}function sv(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Pc={__init__:["overlays"],overlays:["type",Gt]};function Wp(e,t){t.invoke(Y,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(Wp,Y),Wp.$inject=["canvas","injector"];const yT={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",Wp]};function Ra(e){return CSS.escape(e)}var vT={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function cv(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return vT[t]})}var _T="bjs-breadcrumbs-shown";function uv(e,t,n){var i=st('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=ft(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var u=c.element,l=K(u),p=rt(a,function(f){return f===l});p&&s()});function s(c){c&&(a=bT(c));var u=a.flatMap(function(p){var f=n.findRoot(fi(p))||n.findRoot(p.id);if(!f&&v(p,"bpmn:Process")){var d=t.find(function(g){var R=K(g);return R&&R.get("processRef")===p});f=d&&n.findRoot(d.id)}if(!f)return[];var h=cv(p.name||p.id),m=st('<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(_T,l),u.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}uv.$inject=["eventBus","elementRegistry","canvas"];function bT(e){for(var t=K(e),n=[],i=t;i;i=i.$parent)(v(i,"bpmn:SubProcess")||v(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function lv(e,t){var n=null,i=new xT;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})}lv.$inject=["eventBus","canvas"];function xT(){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 pv={x:180,y:160};function Br(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}Br.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)})}},Br.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),wT(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},Br.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=ET(e),i={x:n.x-pv.x,y:n.y-pv.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)})},Br.prototype._moveToDiPlane=function(e,t){var n=fv(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},Br.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},Br.$inject=["eventBus","moddle"];function fv(e){return v(e,"bpmndi:BPMNDiagram")?e:fv(e.$parent)}function ET(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=he(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),vs(t)}function wT(e,t){var n=e.$parent;return!(!v(n,"bpmn:SubProcess")||n===t.bpmnElement||ke(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var Ac=250,ST='<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>',RT="bjs-drilldown-empty";function ur(e,t,n,i,r){Y.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",Ac,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",Ac,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],Ac,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"],Ac,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(ur,Y),ur.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},ur.prototype._canDrillDown=function(e){var t=this._canvas;return v(e,"bpmn:SubProcess")&&t.findRoot(fi(e))},ur.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=K(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;ft(i.html).toggle(RT,!r)}},ur.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=K(e),r=n.get({element:e,type:"drilldown"});r.length&&this._removeOverlay(e);var o=st('<button type="button" class="bjs-drilldown">'+ST+"</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(fi(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},ur.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},ur.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const CT={__depends__:[Pc,Sp,yT],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",uv],drilldownCentering:["type",lv],drilldownOverlayBehavior:["type",ur],subprocessCompatibility:["type",Br]};function lr(e){dt.call(this,e)}ie(lr,dt),lr.prototype._modules=[im,CT,Pc,zn,Jo],lr.prototype._moddleExtensions={};var Tc="keyboard.keydown",PT="keyboard.keyup",AT=1e3,dv="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 fn(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(dv));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}fn.$inject=["config.keyboard","eventBus"],fn.prototype._keydownHandler=function(e){this._keyHandler(e,Tc)},fn.prototype._keyupHandler=function(e){this._keyHandler(e,PT)},fn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Tc,i),n&&e.preventDefault()}},fn.prototype._isEventIgnored=function(e){return!1},fn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(dv)),this.unbind(),e=this._node=this._target,Ee.bind(e,"keydown",this._keydownHandler),Ee.bind(e,"keyup",this._keyupHandler),this._fire("bind")},fn.prototype.getBinding=function(){return this._node},fn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),Ee.unbind(e,"keydown",this._keydownHandler),Ee.unbind(e,"keyup",this._keyupHandler)),this._node=null},fn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},fn.prototype.addListener=function(e,t,n){Ht(e)&&(n=t,t=e,e=AT),this._eventBus.on(n||Tc,e,t)},fn.prototype.removeListener=function(e,t){this._eventBus.off(t||Tc,e)},fn.prototype.hasModifier=KC,fn.prototype.isCmd=wn,fn.prototype.isShift=dp,fn.prototype.isKey=Nt;var TT=500;function xo(e,t){var n=this;e.on("editorActions.init",TT,function(i){var r=i.editorActions;n.registerBindings(t,r)})}xo.$inject=["eventBus","keyboard"],xo.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(eP(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(tP(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(XC(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(ZC(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(QC(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(JC(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Nt(["+","Add","="],r)&&wn(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Nt(["-","Subtract"],r)&&wn(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(Nt("0",r)&&wn(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(Nt(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const Up={__init__:["keyboard","keyboardBindings"],keyboard:["type",fn],keyboardBindings:["type",xo]};var MT={moveSpeed:50,moveSpeedAccelerated:200};function hv(e,t,n){var i=this;this._config=D({},MT,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})}}hv.$inject=["config.keyboardMove","keyboard","canvas"];const mv={__depends__:[Up],__init__:["keyboardMove"],keyboardMove:["type",hv]};var kT=15;function gv(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=kr(s),p=Zn(l,c);if(!n.dragging&&DT(p)>kT&&(n.dragging=!0,u===0&&Vg(e),nc("grab")),n.dragging){var f=n.last||n.start;p=Zn(l,f),t.scroll({dx:p.x,dy:p.y}),n.last=l}s.preventDefault()}function o(s){Ee.unbind(document,"mousemove",r),Ee.unbind(document,"mouseup",o),n=null,zg()}function a(s){if(!Rr(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:kr(s)},Ee.bind(document,"mousemove",r),Ee.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}gv.$inject=["eventBus","canvas"];function DT(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const yv={__init__:["moveCanvas"],moveCanvas:["type",gv]};function vv(e,t){var n=ll(e.min),i=ll(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function OT(e,t){return Math.max(e.min,Math.min(e.max,t))}var LT=Math.sign||function(e){return e>=0?1:-1},qp={min:.2,max:4},_v=10,IT=.1,NT=.75;function mi(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=dn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||NT;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}mi.$inject=["config.zoomScroll","eventBus","canvas"],mi.prototype.scroll=function(t){this._canvas.scroll(t)},mi.prototype.reset=function(){this._canvas.zoom("fit-viewport")},mi.prototype.zoom=function(t,n){var i=vv(qp,_v*2);this._totalDelta+=t,Math.abs(this._totalDelta)>IT&&(this._zoom(t,n,i),this._totalDelta=0)},mi.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||Xm()&&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))*LT(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)}},mi.prototype.stepZoom=function(t,n){var i=vv(qp,_v);this._zoom(t,n,i)},mi.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=ll(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(OT(qp,s),t)},mi.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&Ee[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},mi.prototype._init=function(e){this.toggle(e)};const bv={__init__:["zoomScroll"],zoomScroll:["type",mi]};function Ca(e){lr.call(this,e)}ie(Ca,lr),Ca.prototype._navigationModules=[mv,yv,bv],Ca.prototype._modules=[].concat(lr.prototype._modules,Ca.prototype._navigationModules);function Yp(e){return e&&e[e.length-1]}function xv(e){return e.y}function Ev(e){return e.x}var BT={left:Ev,center:Ev,right:function(e){return e.x+e.width},top:xv,middle:xv,bottom:function(e){return e.y+e.height}};function Eo(e,t){this._modeling=e,this._rules=t}Eo.$inject=["modeling","rules"],Eo.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}},Eo.prototype._isType=function(e,t){return t.indexOf(e)!==-1},Eo.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=Yp(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=ti(a,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return o[e]=Yp(c).center,o;u=t[0],t=ti(t,function(f){return f[i]+f[r]}),l=Yp(t),o[e]=p(u,l)}return o},Eo.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}),ge(i)&&(r=i),!(r.length<2||!i)){var o=BT[t],a=ti(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const $T={__init__:["alignElements"],alignElements:["type",Eo]},jT=new yo;function wo(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}wo.$inject=["eventBus"],wo.prototype.schedule=function(e,t=jT.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},wo.prototype._schedule=function(e,t){const n=FT();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}},wo.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},wo.prototype._cancel=function(e){clearTimeout(e.executionId)};function FT(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const HT={scheduler:["type",wo]};var zT="djs-element-hidden",Mc=".entry",VT=1e3,wv=8,GT=300;function Pt(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}Pt.$inject=["canvas","elementRegistry","eventBus","scheduler"],Pt.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=ge(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=ge(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},Pt.prototype._createContainer=function(){var e=st('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},Pt.prototype.registerProvider=function(e,t){t||(t=e,e=VT),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},Pt.prototype.getEntries=function(e){var t=this._getProviders(),n=ge(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return M(t,function(r){if(Ht(r[n])){var o=r[n](e);Ht(o)?i=o(i):M(o,function(a,s){i[s]=a})}}),i},Pt.prototype.trigger=function(e,t,n){var i=this,r,o,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(r=nn(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},GT);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,o,n)},Pt.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(Ht(s)){if(t==="click")return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},Pt.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))}},Pt.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Pt.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=st(r.html||'<div class="entry" draggable="true"></div>'),c;nn(s,"data-action",o),c=Qe("[data-group="+Ra(a)+"]",n),c||(c=st('<div class="group"></div>'),nn(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&WT(s,r.className),r.title&&nn(s,"title",r.title),r.imageUrl&&(i=st("<img>"),nn(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),ft(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},Pt.prototype._createHtml=function(e){var t=this,n=st('<div class="djs-context-pad"></div>');return bn.bind(n,Mc,"click",function(i){t.trigger("click",i)}),bn.bind(n,Mc,"dragstart",function(i){t.trigger("dragstart",i)}),bn.bind(n,Mc,"mouseover",function(i){t.trigger("mouseover",i)}),bn.bind(n,Mc,"mouseout",function(i){t.trigger("mouseout",i)}),Ee.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},Pt.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()&&qT(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},Pt.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},Pt.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return ge(e)!==ge(n)?!1:ge(e)?e.length===n.length&&_r(e,function(i){return n.includes(i)}):n===e},Pt.prototype.isShown=function(){return this.isOpen()&&ft(this._current.html).has("open")},Pt.prototype.show=function(){this.isOpen()&&(ft(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},Pt.prototype.hide=function(){this.isOpen()&&(ft(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},Pt.prototype._getPosition=function(e){if(!ge(e)&&et(e)){var t=this._canvas.viewbox(),n=UT(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+wv*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+wv*this._canvas.zoom(),top:s.top-a.top}},Pt.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")},Pt.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=ge(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,zT)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},Pt.prototype._getTargetBounds=function(e){var t=this,n=ge(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 WT(e,t){var n=ft(e);t=ge(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function UT(e){return e.waypoints[e.waypoints.length-1]}function qT(e,t){return e=ge(e)?e:[e],t=ge(t)?t:[t],e.length===t.length&&_r(e,function(n){return t.includes(n)})}const Sv={__depends__:[tc,HT,Pc],contextPad:["type",Pt]};var kc,mt,Rv,pr,Cv,Pv,Av,Kp,Dc,Pa,Tv,Xp,Zp,Qp,Oc={},Lc=[],YT=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ic=Array.isArray;function Di(e,t){for(var n in t)e[n]=t[n];return e}function Jp(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Mv(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?kc.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 Nc(e,a,i,r,null)}function Nc(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??++Rv,__i:-1,__u:0};return r==null&&mt.vnode!=null&&mt.vnode(o),o}function Bc(e){return e.children}function $c(e,t){this.props=e,this.context=t}function $r(e,t){if(t==null)return e.__?$r(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"?$r(e):null}function KT(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=Di({},t);o.__v=t.__v+1,mt.vnode&&mt.vnode(o),ef(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??$r(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,$v(i,o,r),t.__e=t.__=null,o.__e!=n&&kv(o)}}function kv(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}),kv(e)}function Dv(e){(!e.__d&&(e.__d=!0)&&pr.push(e)&&!jc.__r++||Cv!=mt.debounceRendering)&&((Cv=mt.debounceRendering)||Pv)(jc)}function jc(){try{for(var e,t=1;pr.length;)pr.length>t&&pr.sort(Av),e=pr.shift(),t=pr.length,KT(e)}finally{pr.length=jc.__r=0}}function Ov(e,t,n,i,r,o,a,s,c,u,l){var p,f,d,h,m,g,R=i&&i.__k||Lc,E=t.length;for(c=XT(n,t,R,c,E),p=0;p<E;p++)(d=n.__k[p])!=null&&(f=d.__i!=-1&&R[d.__i]||Oc,d.__i=p,g=ef(e,d,f,r,o,a,s,c,u,l),h=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&tf(f.ref,null,d),l.push(d.ref,d.__c||h,d)),m==null&&h!=null&&(m=h),4&d.__u?(c=Lv(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 XT(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]=Nc(null,a,null,null,null):Ic(a)?a=e.__k[o]=Nc(Bc,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=Nc(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=ZT(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=$r(s)),Fv(s,s));return i}function Lv(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=Lv(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=$r(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function ZT(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 Iv(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||YT.test(t)?n:n+"px"}function Fc(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||Iv(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||Iv(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(Tv,"$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[Pa]=i[Pa]:(n[Pa]=Xp,e.addEventListener(t,o?Qp:Zp,o)):e.removeEventListener(t,o?Qp:Zp,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 Nv(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Dc]==null)t[Dc]=Xp++;else if(t[Dc]<n[Pa])return;return n(mt.event?mt.event(t):t)}}}function ef(e,t,n,i,r,o,a,s,c,u){var l,p,f,d,h,m,g,R,E,x,b,w,T,L,A,F,H=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(l=mt.__b)&&l(t);e:if(typeof H=="function"){p=a.length;try{if(E=t.props,x=H.prototype&&H.prototype.render,b=(l=H.contextType)&&i[l.__c],w=l?b?b.props.value:l.__:i,n.__c?R=(f=t.__c=n.__c).__=f.__E:(x?t.__c=f=new H(E,w):(t.__c=f=new $c(E,w),f.constructor=H,f.render=JT),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=Di({},f.__s)),Di(f.__s,H.getDerivedStateFromProps(E,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&&E!==h&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(E,w),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(E,f.__s,w)===!1){t.__v!=n.__v&&(f.props=E,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(N){N&&(N.__=t)}),Lc.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&a.push(f),s=$r(n);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(E,f.__s,w),x&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(h,m,g)})}if(f.context=w,f.props=E,f.__P=e,f.__e=!1,T=mt.__r,L=0,x)f.state=f.__s,f.__d=!1,T&&T(t),l=f.render(f.props,f.state,f.context),Lc.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=Di(Di({},i),f.getChildContext())),x&&!d&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(h,m)),A=l!=null&&l.type===Bc&&l.key==null?jv(l.props.children):l,s=Ov(e,Ic(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(F=o.length;F--;)Jp(o[F])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),N.then||Bv(t),mt.__e(N,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=QT(n.__e,t,n,i,r,o,a,c,u);return(l=mt.diffed)&&l(t),128&t.__u?void 0:s}function Bv(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Bv))}function $v(e,t,n){for(var i=0;i<n.length;i++)tf(n[i],n[++i],n[++i]);mt.__c&&mt.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){mt.__e(o,r.__v)}})}function jv(e){return typeof e!="object"||e==null||e.__b>0?e:Ic(e)?e.map(jv):e.constructor!==void 0?null:Di({},e)}function QT(e,t,n,i,r,o,a,s,c){var u,l,p,f,d,h,m,g=n.props||Oc,R=t.props,E=t.type;if(E=="svg"?r="http://www.w3.org/2000/svg":E=="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==!!E&&(E?d.localName==E:d.nodeType==3)){e=d,o[u]=null;break}}if(e==null){if(E==null)return document.createTextNode(R);e=document.createElementNS(r,E,R.is&&R),s&&(mt.__m&&mt.__m(t,o),s=!1),o=null}if(E==null)g===R||s&&e.data==R||(e.data=R);else{if(o=E=="textarea"&&R.defaultValue!=null?null:o&&kc.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||Fc(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||Fc(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=""),Ov(t.type=="template"?e.content:e,Ic(f)?f:[f],t,n,i,E=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&$r(n,0),s,c),o!=null)for(u=o.length;u--;)Jp(o[u]);s&&E!="textarea"||(u="value",E=="progress"&&h==null?e.removeAttribute("value"):h!=null&&(h!==e[u]||E=="progress"&&!h||E=="option"&&h!=g[u])&&Fc(e,u,h,g[u],r),u="checked",m!=null&&m!=e[u]&&Fc(e,u,m,g[u],r))}return e}function tf(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){mt.__e(r,n)}}function Fv(e,t,n){var i,r;if(mt.unmount&&mt.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||tf(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){mt.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&Fv(i[r],t,n||typeof e.type!="function");n||Jp(e.__e),e.__c=e.__=e.__e=void 0}function JT(e,t,n){return this.constructor(e,n)}function Hv(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),mt.__&&mt.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],ef(t,e=t.__k=Mv(Bc,null,[e]),r||Oc,Oc,t.namespaceURI,r?null:t.firstChild?kc.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),$v(o,e,a),e.props.children=null}kc=Lc.slice,mt={__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}},Rv=0,$c.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Di({},this.state),typeof e=="function"&&(e=e(Di({},n),this.props)),e&&Di(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Dv(this))},$c.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Dv(this))},$c.prototype.render=Bc,pr=[],Pv=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Av=function(e,t){return e.__v.__b-t.__v.__b},jc.__r=0,Kp=Math.random().toString(8),Dc="__d"+Kp,Pa="__a"+Kp,Tv=/(PointerCapture)$|Capture$/i,Xp=0,Zp=Nv(!1),Qp=Nv(!0);var zv=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,zv(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},Vv=new Map;function eM(e){var t=Vv.get(this);return t||(t=new Map,Vv.set(this,t)),(t=zv(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 nt=eM.bind(Mv),So,At,nf,Gv,Aa=0,Wv=[],Bt=mt,Uv=Bt.__b,qv=Bt.__r,Yv=Bt.diffed,Kv=Bt.__c,Xv=Bt.unmount,Zv=Bt.__;function Hc(e,t){Bt.__h&&Bt.__h(At,e,Aa||t),Aa=0;var n=At.__H||(At.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function rf(e){return Aa=1,tM(Jv,e)}function tM(e,t,n){var i=Hc(So++,2);if(i.t=e,!i.__c&&(i.__=[Jv(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=At,!At.__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};At.__f=!0;var o=At.shouldComponentUpdate,a=At.componentWillUpdate;At.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)},At.shouldComponentUpdate=r}return i.__N||i.__}function zc(e,t){var n=Hc(So++,3);!Bt.__s&&sf(n.__H,t)&&(n.__=e,n.u=t,At.__H.__h.push(n))}function of(e,t){var n=Hc(So++,4);!Bt.__s&&sf(n.__H,t)&&(n.__=e,n.u=t,At.__h.push(n))}function Vc(e){return Aa=5,Oi(function(){return{current:e}},[])}function Oi(e,t){var n=Hc(So++,7);return sf(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Ta(e,t){return Aa=8,Oi(function(){return e},t)}function nM(){for(var e;e=Wv.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Gc),t.__h.some(af),t.__h=[]}catch(n){t.__h=[],Bt.__e(n,e.__v)}}}Bt.__b=function(e){At=null,Uv&&Uv(e)},Bt.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Zv&&Zv(e,t)},Bt.__r=function(e){qv&&qv(e),So=0;var t=(At=e.__c).__H;t&&(nf===At?(t.__h=[],At.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(Gc),t.__h.some(af),t.__h=[],So=0)),nf=At},Bt.diffed=function(e){Yv&&Yv(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Wv.push(t)!==1&&Gv===Bt.requestAnimationFrame||((Gv=Bt.requestAnimationFrame)||iM)(nM)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),nf=At=null},Bt.__c=function(e,t){t.some(function(n){try{n.__h.some(Gc),n.__h=n.__h.filter(function(i){return!i.__||af(i)})}catch(i){t.some(function(r){r.__h&&(r.__h=[])}),t=[],Bt.__e(i,n.__v)}}),Kv&&Kv(e,t)},Bt.unmount=function(e){Xv&&Xv(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{Gc(i)}catch(r){t=r}}),n.__H=void 0,t&&Bt.__e(t,n.__v))};var Qv=typeof requestAnimationFrame=="function";function iM(e){var t,n=function(){clearTimeout(i),Qv&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);Qv&&(t=requestAnimationFrame(n))}function Gc(e){var t=At,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),At=t}function af(e){var t=At;e.__c=e.__(),At=t}function sf(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function Jv(e,t){return typeof t=="function"?t(e):t}function rM(e){const{navigationStack:t,setNavigationStack:n}=e,i=Oi(()=>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 nt`
12
12
  <div class="djs-popup-breadcrumbs">
13
- ${r&&et`
13
+ ${r&&nt`
14
14
  <button
15
15
  type="button"
16
16
  class="djs-popup-breadcrumbs-item djs-popup-breadcrumbs-item--back"
@@ -23,7 +23,7 @@
23
23
  </svg>
24
24
  </button>
25
25
  `}
26
- ${i.map((a,s)=>et`
26
+ ${i.map((a,s)=>nt`
27
27
  <button
28
28
  key=${s}
29
29
  type="button"
@@ -35,22 +35,22 @@
35
35
  </button>
36
36
  <span class="djs-popup-breadcrumbs-item--separator" aria-hidden="true"></span>
37
37
  `)}
38
- ${o&&et`
38
+ ${o&&nt`
39
39
  <span class="djs-popup-breadcrumbs-item djs-popup-breadcrumbs-item--current" title=${o}>
40
40
  ${o}
41
41
  </span>
42
42
  `}
43
43
  </div>
44
- `}function qy(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=qy(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function Fc(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=qy(e))&&(i&&(i+=" "),i+=t);return i}function ZT(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:r,title:o}=e,a=Di(()=>QT(t),[t]),s=u=>u.action&&!u.disabled,c=(u,l)=>{if(s(l))return n(u,l)};return et`
44
+ `}function e_(e){var t,n,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=e_(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function Wc(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=e_(e))&&(i&&(i+=" "),i+=t);return i}function oM(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:r,title:o}=e,a=Oi(()=>aM(t),[t]),s=u=>u.action&&!u.disabled,c=(u,l)=>{if(s(l))return n(u,l)};return nt`
45
45
  <div class="djs-popup-header">
46
46
  <h3 class="djs-popup-title" title=${o}>${o}</h3>
47
- ${a.map(u=>et`
47
+ ${a.map(u=>nt`
48
48
  <ul key=${u.id} class="djs-popup-header-group" data-header-group=${u.id}>
49
49
 
50
- ${u.entries.map(l=>et`
50
+ ${u.entries.map(l=>nt`
51
51
  <li key=${l.id}>
52
52
  <${s(l)?"button":"span"}
53
- class=${JT(l,l===i)}
53
+ class=${sM(l,l===i)}
54
54
  onClick=${p=>c(p,l)}
55
55
  title=${l.title||l.label}
56
56
  data-id=${l.id}
@@ -60,8 +60,8 @@
60
60
  onFocus=${()=>s(l)&&r(l)}
61
61
  onBlur=${()=>s(l)&&r(null)}
62
62
  >
63
- ${l.imageUrl&&et`<img class="djs-popup-entry-icon" src=${l.imageUrl} alt="" />`||l.imageHtml&&et`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:l.imageHtml}} />`}
64
- ${l.label?et`
63
+ ${l.imageUrl&&nt`<img class="djs-popup-entry-icon" src=${l.imageUrl} alt="" />`||l.imageHtml&&nt`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:l.imageHtml}} />`}
64
+ ${l.label?nt`
65
65
  <span class="djs-popup-label">${l.label}</span>
66
66
  `:null}
67
67
  </${l.action?"button":"span"}>
@@ -70,11 +70,11 @@
70
70
  </ul>
71
71
  `)}
72
72
  </div>
73
- `}function QT(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 JT(e,t){return Fc("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function Yy(e,t){return`${e}-entry-${t.id}`}function eM(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 et`
73
+ `}function aM(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 sM(e,t){return Wc("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function t_(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 nt`
74
74
  <li
75
- class=${Fc("entry",{selected:i,disabled:n.disabled})}
75
+ class=${Wc("entry",{selected:i,disabled:n.disabled})}
76
76
  data-id=${n.id}
77
- id=${Yy(t,n)}
77
+ id=${t_(t,n)}
78
78
  role="option"
79
79
  aria-selected=${i||void 0}
80
80
  aria-haspopup=${n.entries?"true":void 0}
@@ -88,17 +88,17 @@
88
88
  >
89
89
  <div class="djs-popup-entry-content">
90
90
  <span
91
- class=${Fc("djs-popup-entry-name",n.className)}
91
+ class=${Wc("djs-popup-entry-name",n.className)}
92
92
  >
93
- ${n.imageUrl&&et`<img class="djs-popup-entry-icon" src=${n.imageUrl} alt="" />`||n.imageHtml&&et`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:n.imageHtml}} />`}
93
+ ${n.imageUrl&&nt`<img class="djs-popup-entry-icon" src=${n.imageUrl} alt="" />`||n.imageHtml&&nt`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:n.imageHtml}} />`}
94
94
 
95
- ${n.label?et`
95
+ ${n.label?nt`
96
96
  <span class="djs-popup-label">
97
97
  ${n.label}
98
98
  </span>
99
99
  `:null}
100
100
 
101
- ${n.documentationRef&&et`
101
+ ${n.documentationRef&&nt`
102
102
  <a
103
103
  class="djs-popup-entry-docs"
104
104
  href=${n.documentationRef}
@@ -115,7 +115,7 @@
115
115
  </a>
116
116
  `}
117
117
  </span>
118
- ${n.description&&et`
118
+ ${n.description&&nt`
119
119
  <span
120
120
  class="djs-popup-entry-description"
121
121
  >
@@ -123,7 +123,7 @@
123
123
  </span>
124
124
  `}
125
125
  </div>
126
- ${n.entries&&et`
126
+ ${n.entries&&nt`
127
127
  <div class="djs-popup-entry-chevron" aria-hidden="true">
128
128
  <svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
129
129
  <path fill-rule="evenodd" clip-rule="evenodd" d="M3.96967 1.46967C4.26256 1.17678 4.73744 1.17678 5.03033 1.46967L9.03033 5.46967C9.32322 5.76256 9.32322 6.23744 9.03033 6.53033L5.03033 10.5303C4.73744 10.8232 4.26256 10.8232 3.96967 10.5303C3.67678 10.2374 3.67678 9.76256 3.96967 9.46967L7.43934 6L3.96967 2.53033C3.67678 2.23744 3.67678 1.76256 3.96967 1.46967Z" fill="currentColor"/>
@@ -131,7 +131,7 @@
131
131
  </div>
132
132
  `}
133
133
  </li>
134
- `}function tM(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:r,idPrefix:o,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:u,...l}=e,p=$c();tf(()=>{if(!r||!r.current)return;const m=p.current;if(!m)return;const g=m.querySelector(".selected");g&&nM(g)},[t]);const f=()=>{r.current=!1},d=m=>{r.current||n(m)},h=()=>{r.current||n(null)};return et`
134
+ `}function uM(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:r,idPrefix:o,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:u,...l}=e,p=Vc();of(()=>{if(!r||!r.current)return;const m=p.current;if(!m)return;const g=m.querySelector(".selected");g&&lM(g)},[t]);const f=()=>{r.current=!1},d=m=>{r.current||n(m)},h=()=>{r.current||n(null)};return nt`
135
135
  <div
136
136
  class="djs-popup-results"
137
137
  ref=${p}
@@ -142,9 +142,9 @@
142
142
  aria-activedescendant=${u}
143
143
  onMouseMove=${f}
144
144
  >
145
- ${i.map(m=>et`
146
- ${m.name&&et`
147
- <div key=${m.id} id=${Ky(o,m)} class="entry-header" title=${m.name}>
145
+ ${i.map(m=>nt`
146
+ ${m.name&&nt`
147
+ <div key=${m.id} id=${n_(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?Ky(o,m):void 0}
155
+ aria-labelledby=${m.name?n_(o,m):void 0}
156
156
  >
157
- ${m.entries.map(g=>et`
158
- <${eM}
157
+ ${m.entries.map(g=>nt`
158
+ <${cM}
159
159
  key=${g.id}
160
160
  idPrefix=${o}
161
161
  entry=${g}
@@ -168,8 +168,8 @@
168
168
  </ul>
169
169
  `)}
170
170
  </div>
171
- `}function Ky(e,t){return`${e}-group-${t.id}`}function nM(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const iM=new mo("djs-popup");function rM(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]=ef([]);Bc(()=>{g([])},[f]);const[S,E]=ef(""),x=S.trim().length>0,b=Di(()=>sM(f),[f]),w=Di(()=>Ot(u)?b.length>5:!1,[u,b]),T=Di(()=>{const $=m.length?m[m.length-1].entries:f;return w?x?p(b.filter(({searchable:B})=>B!==!1),S,{keys:["label","search","description"]}).map(({item:B})=>B):$.filter(({rank:B=0})=>B>=0):$},[w,x,b,S,p,m,f]),O=Di(()=>x?T.length?[{id:"default",entries:T}]:[]:cM(T),[T,x]),[P,j]=ef(T[0]),F=$c(null),I=$c(!1),H=Di(()=>iM.next(),[]),ae=`${H}-results`,Ie=P&&Yy(H,P);Bc(()=>{const $=F.current;$&&T.includes($)?j($):j(T[0]),F.current=null},[T]);const ot=Ca($=>{const B=aM(O);let Pe=B.indexOf(P)+$;Pe<0&&(Pe=B.length-1),Pe>=B.length&&(Pe=0),I.current=!0,j(B[Pe])},[O,P]),X=Ca($=>{$>0&&P&&P.entries&&(I.current=!0,g(B=>[...B,P])),$<0&&m.length>0&&(I.current=!0,F.current=m[m.length+$],g(B=>B.slice(0,$)))},[P,m]),oe=Ca(($,B,G)=>{if(!(!B||B.disabled))return B.entries?($.preventDefault(),X(1)):n($,B,G)},[n,X]),me=Ca($=>{if($.key==="Enter"&&P){const B=$.target;return!!wr(B,"a, button",!0)||P.disabled?void 0:oe($,P)}if($.key==="Backspace"){const B=$.target;if(!(Fu(B,"input")&&B.value!==""))return X(-1),$.preventDefault()}if($.key==="ArrowUp")return ot(-1),$.preventDefault();if($.key==="ArrowDown")return ot(1),$.preventDefault();if($.key==="ArrowRight")return X(1),$.preventDefault();if($.key==="ArrowLeft")return X(-1),$.preventDefault()},[P,ot,X,oe]),se=Ca($=>{Fu($.target,"input")&&E(()=>$.target.value)},[E]);Bc(()=>(d(),()=>{h()}),[]);const le=!x&&m.length>0,J=(a||r.length>0)&&!le;return et`
172
- <${Xy}
171
+ `}function n_(e,t){return`${e}-group-${t.id}`}function lM(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const pM=new yo("djs-popup");function fM(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]=rf([]);zc(()=>{g([])},[f]);const[R,E]=rf(""),x=R.trim().length>0,b=Oi(()=>mM(f),[f]),w=Oi(()=>Ot(u)?b.length>5:!1,[u,b]),T=Oi(()=>{const $=m.length?m[m.length-1].entries:f;return w?x?p(b.filter(({searchable:B})=>B!==!1),R,{keys:["label","search","description"]}).map(({item:B})=>B):$.filter(({rank:B=0})=>B>=0):$},[w,x,b,R,p,m,f]),L=Oi(()=>x?T.length?[{id:"default",entries:T}]:[]:gM(T),[T,x]),[A,F]=rf(T[0]),H=Vc(null),N=Vc(!1),z=Oi(()=>pM.next(),[]),ce=`${z}-results`,Be=A&&t_(z,A);zc(()=>{const $=H.current;$&&T.includes($)?F($):F(T[0]),H.current=null},[T]);const it=Ta($=>{const B=hM(L);let Pe=B.indexOf(A)+$;Pe<0&&(Pe=B.length-1),Pe>=B.length&&(Pe=0),N.current=!0,F(B[Pe])},[L,A]),X=Ta($=>{$>0&&A&&A.entries&&(N.current=!0,g(B=>[...B,A])),$<0&&m.length>0&&(N.current=!0,H.current=m[m.length+$],g(B=>B.slice(0,$)))},[A,m]),ae=Ta(($,B,U)=>{if(!(!B||B.disabled))return B.entries?($.preventDefault(),X(1)):n($,B,U)},[n,X]),me=Ta($=>{if($.key==="Enter"&&A){const B=$.target;return!!Rr(B,"a, button",!0)||A.disabled?void 0:ae($,A)}if($.key==="Backspace"){const B=$.target;if(!(Vu(B,"input")&&B.value!==""))return X(-1),$.preventDefault()}if($.key==="ArrowUp")return it(-1),$.preventDefault();if($.key==="ArrowDown")return it(1),$.preventDefault();if($.key==="ArrowRight")return X(1),$.preventDefault();if($.key==="ArrowLeft")return X(-1),$.preventDefault()},[A,it,X,ae]),se=Ta($=>{Vu($.target,"input")&&E(()=>$.target.value)},[E]);zc(()=>(d(),()=>{h()}),[]);const pe=!x&&m.length>0,ee=(a||r.length>0)&&!pe;return nt`
172
+ <${i_}
173
173
  onClose=${t}
174
174
  onKeyup=${se}
175
175
  onKeydown=${me}
@@ -179,25 +179,25 @@
179
179
  scale=${c}
180
180
  navigationStack=${m}
181
181
  >
182
- ${J&&et`
183
- <${ZT}
182
+ ${ee&&nt`
183
+ <${oM}
184
184
  headerEntries=${r}
185
185
  onSelect=${n}
186
- selectedEntry=${P}
187
- setSelectedEntry=${j}
186
+ selectedEntry=${A}
187
+ setSelectedEntry=${F}
188
188
  title=${a}
189
189
  />
190
190
  `}
191
- ${le&&et`
192
- <${XT}
191
+ ${pe&&nt`
192
+ <${rM}
193
193
  navigationStack=${m}
194
194
  setNavigationStack=${g}
195
195
  />
196
196
  `}
197
- ${f.length>0&&et`
197
+ ${f.length>0&&nt`
198
198
  <div class="djs-popup-body">
199
199
 
200
- ${w&&et`
200
+ ${w&&nt`
201
201
  <div class="djs-popup-search">
202
202
  <svg class="djs-popup-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
203
203
  <path fill-rule="evenodd" clip-rule="evenodd" d="M9.0325 8.5H9.625L13.3675 12.25L12.25 13.3675L8.5 9.625V9.0325L8.2975 8.8225C7.4425 9.5575 6.3325 10 5.125 10C2.4325 10 0.25 7.8175 0.25 5.125C0.25 2.4325 2.4325 0.25 5.125 0.25C7.8175 0.25 10 2.4325 10 5.125C10 6.3325 9.5575 7.4425 8.8225 8.2975L9.0325 8.5ZM1.75 5.125C1.75 6.9925 3.2575 8.5 5.125 8.5C6.9925 8.5 8.5 6.9925 8.5 5.125C8.5 3.2575 6.9925 1.75 5.125 1.75C3.2575 1.75 1.75 3.2575 1.75 5.125Z" fill="#22242A"/>
@@ -208,39 +208,39 @@
208
208
  role="combobox"
209
209
  aria-label="${a||"Search"}"
210
210
  aria-expanded="true"
211
- aria-controls=${ae}
212
- aria-activedescendant=${Ie||void 0}
211
+ aria-controls=${ce}
212
+ aria-activedescendant=${Be||void 0}
213
213
  aria-autocomplete="list"
214
214
  />
215
215
  </div>
216
216
  `}
217
217
 
218
- ${x&&et`
218
+ ${x&&nt`
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
- <${tM}
225
- groupedEntries=${O}
226
- selectedEntry=${P}
227
- setSelectedEntry=${j}
228
- keyboardSelection=${I}
229
- onAction=${oe}
230
- idPrefix=${H}
231
- id=${ae}
224
+ <${uM}
225
+ groupedEntries=${L}
226
+ selectedEntry=${A}
227
+ setSelectedEntry=${F}
228
+ keyboardSelection=${N}
229
+ onAction=${ae}
230
+ idPrefix=${z}
231
+ id=${ce}
232
232
  ariaLabel=${a||"Results"}
233
233
  tabIndex=${w?-1:0}
234
- ariaActivedescendant=${w?void 0:Ie||void 0}
234
+ ariaActivedescendant=${w?void 0:Be||void 0}
235
235
  />
236
236
 
237
- ${P&&P.documentationRef&&et`
237
+ ${A&&A.documentationRef&&nt`
238
238
  <div class="djs-popup-footer">
239
239
  <a
240
240
  class="djs-popup-footer-docs"
241
- href=${P.documentationRef}
241
+ href=${A.documentationRef}
242
242
  onClick=${$=>$.stopPropagation()}
243
- aria-label=${P.label?`Open entry documentation for ${P.label}`:"Open entry documentation"}
243
+ aria-label=${A.label?`Open entry documentation for ${A.label}`:"Open entry documentation"}
244
244
  target="_blank"
245
245
  rel="noopener"
246
246
  >
@@ -254,14 +254,14 @@
254
254
  `}
255
255
  </div>
256
256
  `}
257
- ${l&&T.length===0&&et`
258
- <div class="djs-popup-no-results">${Ft(l)?l(S):l}</div>
257
+ ${l&&T.length===0&&nt`
258
+ <div class="djs-popup-no-results">${Ht(l)?l(R):l}</div>
259
259
  `}
260
- </${Xy}>
261
- `}function Xy(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,navigationStack:a,position:s}=e,c=$c();return tf(()=>{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]),tf(()=>{const u=c.current;if(!u)return;(u.querySelector("input")||u.querySelector('[role="listbox"]')||u).focus()},[a]),Bc(()=>{const u=p=>{if(p.key==="Escape")return p.preventDefault(),t()},l=p=>{if(!wr(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)}},[]),et`
260
+ </${i_}>
261
+ `}function i_(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,navigationStack:a,position:s}=e,c=Vc();return of(()=>{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]),of(()=>{const u=c.current;if(!u)return;(u.querySelector("input")||u.querySelector('[role="listbox"]')||u).focus()},[a]),zc(()=>{const u=p=>{if(p.key==="Escape")return p.preventDefault(),t()},l=p=>{if(!Rr(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)}},[]),nt`
262
262
  <div
263
- class=${Fc("djs-popup",r)}
264
- style=${oM(e)}
263
+ class=${Wc("djs-popup",r)}
264
+ style=${dM(e)}
265
265
  onKeydown=${n}
266
266
  onKeyup=${i}
267
267
  ref=${c}
@@ -269,8 +269,8 @@
269
269
  >
270
270
  ${o}
271
271
  </div>
272
- `}function oM(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:Ot(t)?n:void 0,maxWidth:Ot(t)?"unset":void 0,"transform-origin":"top left"}}function aM(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function sM(e){const t=[];function n(i){i.forEach(r=>{if(r.entries){n(r.entries);return}t.push(r)})}return n(e),t}function cM(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 uM="data-id",Zy=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],lM=1e3;function ht(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var r=Ot(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()})}ht.$inject=["config.popupMenu","eventBus","canvas","search"],ht.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:r,options:o}=this._current,a=Qy(n),s=Object.entries(i).map(([f,d])=>({id:f,...d})),c=e&&(f=>this._ensureVisible(f,e)),u=this._updateScale(this._current.container);Ly(et`
273
- <${rM}
272
+ `}function dM(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:Ot(t)?n:void 0,maxWidth:Ot(t)?"unset":void 0,"transform-origin":"top left"}}function hM(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 gM(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 yM="data-id",r_=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],vM=1e3;function gt(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var r=Ot(e&&e.scale)?e.scale:{min:1,max:1};this._config={scale:r},t.on("diagram.destroy",()=>{this.close()}),t.on("element.changed",o=>{const a=this.isOpen()&&this._current.target;o.element===a&&this.refresh()})}gt.$inject=["config.popupMenu","eventBus","canvas","search"],gt.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:r,options:o}=this._current,a=o_(n),s=Object.entries(i).map(([f,d])=>({id:f,...d})),c=e&&(f=>this._ensureVisible(f,e)),u=this._updateScale(this._current.container);Hv(nt`
273
+ <${fM}
274
274
  onClose=${f=>this.close(f)}
275
275
  onSelect=${(f,d,h)=>this.trigger(f,d,h)}
276
276
  position=${c}
@@ -284,7 +284,7 @@
284
284
  searchFn=${this._search}
285
285
  ...${{...o}}
286
286
  />
287
- `,this._current.container)},ht.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()},ht.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()},ht.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)}},ht.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},ht.prototype.reset=function(){const e=this._current.container;Ly(null,e),ai(e)},ht.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},ht.prototype._onOpened=function(){this._emit("opened")},ht.prototype._onClosed=function(){this._emit("closed")},ht.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=rt(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},ht.prototype._bindAutoClose=function(){this._eventBus.once(Zy,this.close,this)},ht.prototype._unbindAutoClose=function(){this._eventBus.off(Zy,this.close,this)},ht.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),Ot(n)&&e<n&&(r=n),Ot(i)&&e>i&&(r=i)),r},ht.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}},ht.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},ht.prototype.registerProvider=function(e,t,n){n||(n=t,t=lM),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},ht.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},ht.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]=ni(o,["id"])});return}var r=i.getPopupMenuEntries(e);Ft(r)?n=r(n):M(r,function(o,a){n[a]=o})}),n},ht.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]=ni(o,["id"])});return}var r=i.getPopupMenuHeaderEntries(e);Ft(r)?n=r(n):M(r,function(o,a){n[a]=o})}),n},ht.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>Ft(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},ht.prototype.isOpen=function(){return!!this._current},ht.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let r=wr(e.delegateTarget||e.target,".entry",!0),o=Jt(r,uM);t={id:o,...this._getEntry(o)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(Ft(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},ht.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 Qy(e,t=[]){return Object.entries(e).map(([n,i])=>{const r={id:n,...i};return r.entries?r.entries=Qy(r.entries,[...t,...Jy(r.search)]):t.length&&(r.search=[...t,...Jy(r.search)]),r})}function Jy(e){return e?ge(e)?e:[e]:[]}function pM(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=fM(o,r,i);return a?{item:o,tokens:a}:[]}).sort(dM(i))}function fM(e,t,n){const{matchedWords:i,tokens:r}=n.reduce((o,a)=>{const s=e[a],{tokens:c,matchedWords:u}=ge(s)?s.reduce((l,p)=>{const{tokens:f,matchedWords:d}=r_(p,t);return{tokens:[...l.tokens,f],matchedWords:{...l.matchedWords,...d}}},{matchedWords:{},tokens:[]}):r_(s,t);return{tokens:{...o.tokens,[a]:c},matchedWords:{...o.matchedWords,...u}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:r}function dM(e){return(t,n)=>{let i=0,r=1;for(const o of e){const a=hM(t.tokens[o],n.tokens[o]);if(a!==0){i+=a*r,r*=e_;continue}const s=mM(t.item[o],n.item[o]);if(s!==0){i+=s*r,r*=e_;continue}}return i}}function hM(e,t){return t_(t)-t_(e)}const e_=.5,wo={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function t_(e){const t=e.reduce((s,c)=>s+n_(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 n_(e){if(ge(e))return Math.max(...e.map(n_));const t=Math.log(e.value.length);return e.match?(e.start?e.end?wo.FULL:e.wordEnd?wo.START_FULL_WORD:wo.START_WORD_PART:e.wordStart?wo.WORD_START:wo.WORD_PART)*t:wo.NO_MATCH*t}function i_(e=""){return ge(e)?e.join(", "):e}function mM(e,t){return i_(e).localeCompare(i_(t))}function r_(e,t){var u;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map(gM),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)),S=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:S,start:d,end:h,all:m});const E=m?t:[l];for(const x of E)i[x.toLowerCase()]=!0;c=s.index+l.length}return c<e.length&&n.push({value:e.slice(c),index:c}),{tokens:n,matchedWords:i}}function gM(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const o_={search:["value",pM]},of={__depends__:[o_],__init__:["popupMenu"],popupMenu:["type",ht]};var a_={align:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 2000">
287
+ `,this._current.container)},gt.prototype.open=function(e,t,n,i){if(!e)throw new Error("target is missing");if(!t)throw new Error("providers for <"+t+"> not found");if(!n)throw new Error("position is missing");var r=this._eventBus.fire("popupMenu.open.allowed",{target:e,providerId:t});if(r===!1)return;this.isOpen()&&this.close();const{entries:o,headerEntries:a,emptyPlaceholder:s}=this._getContext(e,t);this._current={position:n,providerId:t,target:e,entries:o,headerEntries:a,emptyPlaceholder:s,container:this._createContainer({provider:t}),options:i},this._emit("open"),this._bindAutoClose(),this._render()},gt.prototype.refresh=function(){if(!this.isOpen())return;const{target:e,providerId:t}=this._current,{entries:n,headerEntries:i,emptyPlaceholder:r}=this._getContext(e,t);this._current={...this._current,entries:n,headerEntries:i,emptyPlaceholder:r},this._emit("refresh"),this._render()},gt.prototype._getContext=function(e,t){const n=this._getProviders(t);if(!n||!n.length)throw new Error("provider for <"+t+"> not found");const i=this._getEntries(e,n),r=this._getHeaderEntries(e,n),o=this._getEmptyPlaceholder(n);return{entries:i,headerEntries:r,emptyPlaceholder:o,empty:!(Object.keys(i).length||Object.keys(r).length)}},gt.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},gt.prototype.reset=function(){const e=this._current.container;Hv(null,e),si(e)},gt.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},gt.prototype._onOpened=function(){this._emit("opened")},gt.prototype._onClosed=function(){this._emit("closed")},gt.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=st(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},gt.prototype._bindAutoClose=function(){this._eventBus.once(r_,this.close,this)},gt.prototype._unbindAutoClose=function(){this._eventBus.off(r_,this.close,this)},gt.prototype._updateScale=function(){var e=this._canvas.zoom(),t=this._config.scale,n,i,r=e;return t!==!0&&(t===!1?(n=1,i=1):(n=t.min,i=t.max),Ot(n)&&e<n&&(r=n),Ot(i)&&e>i&&(r=i)),r},gt.prototype._ensureVisible=function(e,t){var n=document.documentElement.getBoundingClientRect(),i=e.getBoundingClientRect(),r={},o=t.x,a=t.y;return t.x+i.width>n.width&&(r.x=!0),t.y+i.height>n.height&&(r.y=!0),r.x&&r.y?(o=t.x-i.width,a=t.y-i.height):r.x?(o=t.x-i.width,a=t.y):r.y&&t.y<i.height?(o=t.x,a=10):r.y&&(o=t.x,a=t.y-i.height),t.y<n.top&&(a=t.y+i.height),{x:o,y:a}},gt.prototype.isEmpty=function(e,t){if(!e)throw new Error("target is missing");if(!t)throw new Error("provider ID is missing");const n=this._getProviders(t);return!n||!n.length?!0:this._getContext(e,t).empty},gt.prototype.registerProvider=function(e,t,n){n||(n=t,t=vM),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},gt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},gt.prototype._getEntries=function(e,t){var n={};return 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]=ni(o,["id"])});return}var r=i.getPopupMenuEntries(e);Ht(r)?n=r(n):M(r,function(o,a){n[a]=o})}),n},gt.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]=ni(o,["id"])});return}var r=i.getPopupMenuHeaderEntries(e);Ht(r)?n=r(n):M(r,function(o,a){n[a]=o})}),n},gt.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>Ht(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},gt.prototype.isOpen=function(){return!!this._current},gt.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let r=Rr(e.delegateTarget||e.target,".entry",!0),o=nn(r,yM);t={id:o,...this._getEntry(o)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(Ht(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},gt.prototype._getEntry=function(e){var t=this._current.entries[e]||this._current.headerEntries[e];if(!t)throw new Error("entry not found");return t};function o_(e,t=[]){return Object.entries(e).map(([n,i])=>{const r={id:n,...i};return r.entries?r.entries=o_(r.entries,[...t,...a_(r.search)]):t.length&&(r.search=[...t,...a_(r.search)]),r})}function a_(e){return e?ge(e)?e:[e]:[]}function _M(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=bM(o,r,i);return a?{item:o,tokens:a}:[]}).sort(xM(i))}function bM(e,t,n){const{matchedWords:i,tokens:r}=n.reduce((o,a)=>{const s=e[a],{tokens:c,matchedWords:u}=ge(s)?s.reduce((l,p)=>{const{tokens:f,matchedWords:d}=p_(p,t);return{tokens:[...l.tokens,f],matchedWords:{...l.matchedWords,...d}}},{matchedWords:{},tokens:[]}):p_(s,t);return{tokens:{...o.tokens,[a]:c},matchedWords:{...o.matchedWords,...u}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:r}function xM(e){return(t,n)=>{let i=0,r=1;for(const o of e){const a=EM(t.tokens[o],n.tokens[o]);if(a!==0){i+=a*r,r*=s_;continue}const s=wM(t.item[o],n.item[o]);if(s!==0){i+=s*r,r*=s_;continue}}return i}}function EM(e,t){return c_(t)-c_(e)}const s_=.5,Ro={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function c_(e){const t=e.reduce((s,c)=>s+u_(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 u_(e){if(ge(e))return Math.max(...e.map(u_));const t=Math.log(e.value.length);return e.match?(e.start?e.end?Ro.FULL:e.wordEnd?Ro.START_FULL_WORD:Ro.START_WORD_PART:e.wordStart?Ro.WORD_START:Ro.WORD_PART)*t:Ro.NO_MATCH*t}function l_(e=""){return ge(e)?e.join(", "):e}function wM(e,t){return l_(e).localeCompare(l_(t))}function p_(e,t){var u;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map(SM),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 E=m?t:[l];for(const x of E)i[x.toLowerCase()]=!0;c=s.index+l.length}return c<e.length&&n.push({value:e.slice(c),index:c}),{tokens:n,matchedWords:i}}function SM(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const f_={search:["value",_M]},cf={__depends__:[f_],__init__:["popupMenu"],popupMenu:["type",gt]};var d_={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>`},vM=900;function So(e,t,n,i){e.registerProvider(vM,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}So.$inject=["contextPad","popupMenu","translate","canvas"],So.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&D(t,this._getEntries(e)),t},So.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},So.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${a_.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);D(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},So.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 yM=["left","center","right","top","middle","bottom"];function Pa(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}Pa.$inject=["popupMenu","alignElements","translate","rules"],Pa.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&D(t,this._getEntries(e)),t},Pa.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Pa.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return M(yM,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:a_[o],action:function(){t.trigger(e,o),i.close()}}}),r};function Hc(e){Hn.call(this,e)}Hc.$inject=["eventBus"],ie(Hc,Hn),Hc.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=Te(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=ls(n),n.length<2?!1:n})};const _M={__depends__:[MT,vy,of],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",So],alignElementsMenuProvider:["type",Pa],bpmnAlignElements:["type",Hc]};function Oi(e,t,n,i){U.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=hu(Vr(a.closure.topLevel)),c=a.hints,u=c?c.autoResize:!0;if(u!==!1){var l=Gr(s,function(p){return p.parent.id});M(l,function(p,f){ge(u)&&(p=p.filter(function(d){return it(u,Wr({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)})}Oi.$inject=["eventBus","elementRegistry","modeling","rules"],ie(Oi,U),Oi.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=de(St(e)),o=de(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),ds(D({},o,a))},Oi.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(bM(i,t)){var r=xM(Zn(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},Oi.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Oi.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Oi.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function bM(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function xM(e,t){var n="";return e=de(e),t=de(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 zc(e){e.invoke(Oi,this)}zc.$inject=["injector"],ie(zc,Oi),zc.prototype.resize=function(e,t,n){y(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function Aa(e){Hn.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}Aa.$inject=["eventBus"],ie(Aa,Hn),Aa.prototype.canResize=function(e,t){return!1};function Vc(e,t){Aa.call(this,e),this._modeling=t}ie(Vc,Aa),Vc.$inject=["eventBus","modeling"],Vc.prototype.canResize=function(e,t){if(y(t.di,"bpmndi:BPMNPlane")||!y(t,"bpmn:Participant")&&!y(t,"bpmn:Lane")&&!y(t,"bpmn:SubProcess"))return!1;var n=!0;return M(e,function(i){if(y(i,"bpmn:Lane")||Re(i)){n=!1;return}}),n};const EM={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",zc],bpmnAutoResizeProvider:["type",Vc]};function Ro(e,t,n){this._canvas=n,this._opts=D({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()})}Ro.$inject=["config.autoScroll","eventBus","canvas"],Ro.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++)wM(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 wM(e,t,n){return t<e&&e<n}Ro.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Ro.prototype.setOptions=function(e){this._opts=D({},this._opts,e)},Ro.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Tr(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const SM={__depends__:[Pi],__init__:["autoScroll"],autoScroll:["type",Ro]};var s_="djs-bendpoint",c_="djs-segment-dragger";function RM(e,t){var n=Tr(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 af(e,t,n){var i=RM(e,n),r=Sl(t,i);return r}function sf(e,t){var n=pe("g");Le(n).add(s_),xe(e,n);var i=pe("circle");re(i,{cx:0,cy:0,r:4}),Le(i).add("djs-visual"),xe(n,i);var r=pe("circle");return re(r,{cx:0,cy:0,r:10}),Le(r).add("djs-hit"),xe(n,r),t&&Le(n).add(t),n}function CM(e,t,n,i){var r=pe("g");xe(e,r);var o=18,a=6,s=11,c=AM(t,n,i),u=a+s,l=pe("rect");re(l,{x:-o/2,y:-a/2,width:o,height:a}),Le(l).add("djs-visual"),xe(r,l);var p=pe("rect");return re(p,{x:-c/2,y:-u/2,width:c,height:u}),Le(p).add("djs-hit"),xe(r,p),Ih(r,i==="v"?90:0),r}function u_(e,t,n){var i=pe("g"),r=Ju(t,n),o=xi(t,n);return xe(e,i),CM(i,t,n,o),Le(i).add(c_),Le(i).add(o==="h"?"horizontal":"vertical"),Ut(i,r.x,r.y),i}function cf(e){return Math.abs(Math.round(e*2/3))}function PM(e,t){var n=TM(e,t);return Ml(e,n)}function AM(e,t,n){var i=t.x-e.x,r=t.y-e.y;return cf(n==="h"?i:r)}function TM(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=xm(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function l_(e,t,n,i,r){function o(x,b,w){var T=x.index,O=x.point,P,j,F,I,H,ae;return T<=0||x.bendpoint?!1:(P=b[T-1],j=b[T],F=Ju(P,j),I=xi(P,j),H=Math.abs(O.x-F.x),ae=Math.abs(O.y-F.y),I&&H<=w&&ae<=w)}function a(x,b){var w=x.waypoints,T,O,P,j;return b.index<=0||b.bendpoint||(T={start:w[b.index-1],end:w[b.index]},O=xi(T.start,T.end),!O)?null:(O==="h"?P=T.end.x-T.start.x:P=T.end.y-T.start.y,j=cf(P)/2,j)}function s(x,b){var w=b.waypoints,T=af(t,w,x),O;if(T){O=a(b,T);var P;if(o(T,w,O)?P=r.start(x,b,T.index):P=i.start(x,b,T.index,!T.bendpoint),P!==!1)return!0}}function c(x,b,w){be.bind(x,b,function(T){n.triggerMouseEvent(b,T,w),T.stopPropagation()})}function u(x,b){var w=t.getLayer("overlays"),T=Xe('.djs-bendpoints[data-element-id="'+Ea(x.id)+'"]',w);return!T&&b&&(T=pe("g"),re(T,{"data-element-id":x.id}),Le(T).add("djs-bendpoints"),xe(w,T),c(T,"mousedown",x),c(T,"click",x),c(T,"dblclick",x)),T}function l(x,b){return Xe('.djs-segment-dragger[data-segment-idx="'+x+'"]',b)}function p(x,b){b.waypoints.forEach(function(w,T){var O=sf(x);xe(x,O),Ut(O,w.x,w.y)}),sf(x,"floating")}function f(x,b){for(var w=b.waypoints,T,O,P,j=1;j<w.length;j++)T=w[j-1],O=w[j],xi(T,O)&&(P=u_(x,T,O),re(P,{"data-segment-idx":j}),c(P,"mousemove",b))}function d(x){M(as("."+s_,x),function(b){It(b)})}function h(x){M(as("."+c_,x),function(b){It(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 S(x,b){var w=Xe(".floating",x),T=b.point;w&&(Ut(w,T.x,T.y),Le(w).add("positioned"))}function E(x,b,w){var T=l(b.index,x),O=w[b.index-1],P=w[b.index],j=b.point,F=Ju(O,P),I=xi(O,P),H,ae;T&&(H=MM(T),ae={x:j.x-F.x,y:j.y-F.y},I==="v"&&(ae={x:ae.y,y:ae.x}),Ut(H,ae.x,ae.y))}e.on("connection.changed",function(x){g(x.element)}),e.on("connection.remove",function(x){var b=u(x.element);b&&It(b)}),e.on("element.marker.update",function(x){var b=x.element,w;b.waypoints&&(w=m(b),x.add?Le(w).add(x.marker):Le(w).remove(x.marker))}),e.on("element.mousemove",function(x){var b=x.element,w=b.waypoints,T,O;if(w){if(T=u(b,!0),O=af(t,w,x.originalEvent),!O)return;S(T,O),O.bendpoint||E(T,O,w)}}),e.on("element.mousedown",function(x){if(er(x)){var b=x.originalEvent,w=x.element;if(w.waypoints)return s(b,w)}}),e.on("selection.changed",function(x){var b=x.newSelection,w=b[0];w&&w.waypoints&&m(w)}),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 w=u(b);if(w){var T=Xe(".floating",w);T&&Le(T).remove("positioned")}}}),e.on("element.updateId",function(x){var b=x.element,w=x.newId;if(b.waypoints){var T=u(b);T&&re(T,{"data-element-id":w})}}),this.addHandles=m,this.updateHandles=g,this.getBendpointsContainer=u,this.getSegmentDragger=l}l_.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function MM(e){return Xe(".djs-visual",e)}var p_=Math.round,Br="reconnectStart",$r="reconnectEnd",Ta="updateWaypoints";function uf(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=Br:!u&&c===d.length-1?h=$r:h=Ta;var m=h===Ta?"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===Ta?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(h,{connection:c,source:f===Br?p:u,target:f===$r?p:l}),d){s.source=f===Br?p:u,s.target=f===$r?p:l;return}d===!1&&(d=s.allowed=r.allowed(h,{connection:c,source:f===$r?p:l,target:f===Br?p:u})),d&&(s.source=f===$r?p:l,s.target=f===Br?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!==Ta&&(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||{},S={x:p_(a.x),y:p_(a.y)};if(!c)return!1;m===Ta?(p?f.splice(u,0,S):f[u]=S,g.bendpointMove={insert:p,bendpointIndex:u},f=this.cropWaypoints(l,f),o.updateWaypoints(l,qw(f),g)):(m===Br?(g.docking="source",Gc(s)&&(g.docking="target",g.newWaypoints=f.reverse())):m===$r&&(g.docking="target",Gc(s)&&(g.docking="source",g.newWaypoints=f.reverse())),o.reconnect(l,d,h,S,g))},this)}uf.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],uf.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 Gc(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===Br)return t&&i&&t===i&&n!==i;if(r===$r)return t&&n&&t===n&&n!==i}var kM="reconnectStart",DM="reconnectEnd",f_="updateWaypoints",Ma="connect-ok",Wc="connect-not-ok",d_="connect-hover",h_="djs-updating",m_="djs-dragging",g_=1100;function v_(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=sf(i.getLayer("overlays"));Le(f).add("djs-dragging"),i.addMarker(c,m_),i.addMarker(c,h_)}),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,d_),u===f_)return;s?(i.removeMarker(c,Wc),i.addMarker(c,Ma)):s===!1&&(i.removeMarker(c,Ma),i.addMarker(c,Wc))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],g_,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,d_),i.removeMarker(s,c?Ma:Wc))}),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},S=a.hints||{},E={};r&&(S.connectionStart&&(E.connectionStart=S.connectionStart),S.connectionEnd&&(E.connectionEnd=S.connectionEnd),p===kM?Gc(a)?(E.connectionEnd=E.connectionEnd||g,E.source=h,E.target=l||d,m=m.reverse()):(E.connectionStart=E.connectionStart||g,E.source=l||d,E.target=h):p===DM?Gc(a)?(E.connectionStart=E.connectionStart||g,E.source=l||h,E.target=d,m=m.reverse()):(E.connectionEnd=E.connectionEnd||g,E.source=d,E.target=l||h):(E.noCropping=!0,E.noLayout=!0,m[c]=g),p===f_&&(m=e.cropWaypoints(f,m)),E.waypoints=m,r.drawPreview(a,s,E)),Ut(u,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],g_,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,u=a.hover,l=a.target,p=a.waypoints;s.waypoints=p,It(c),i.removeMarker(s,h_),i.removeMarker(s,m_),u&&(i.removeMarker(u,Ma),i.removeMarker(u,l?Ma:Wc)),r&&r.cleanUp(a)})}v_.$inject=["bendpointMove","injector","eventBus","canvas"];var y_="connect-hover",__="djs-updating";function b_(e,t,n){return lf(e,t,e[t]+n)}function lf(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function OM(e,t,n,i){var r=Math.max(t[i],n[i]),o=Math.min(t[i],n[i]),a=20,s=Math.min(Math.max(o+a,e[i]),r-a);return lf(t,i,s)}function x_(e){return e==="x"?"y":"x"}function E_(e,t,n){var i,r;return e.original?e.original:(i=ve(t),r=x_(n),lf(e,r,i[r]))}function w_(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,S=d,E=f.waypoints,x=E[g],b=E[S],w=af(n,E,p),T,O,P;if(T=xi(x,b),!!T)return O=T==="v"?"x":"y",g===0&&(x=E_(x,f.source,O)),S===E.length-1&&(b=E_(b,f.target,O)),w?P=w.point:P={x:(x.x+b.x)/2,y:(x.y+b.y)/2},h={connection:f,segmentStartIndex:g,segmentEndIndex:S,segmentStart:x,segmentEnd:b,axis:O,dragPosition:P},i.init(p,P,"connectionSegment.move",{cursor:O==="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],S=p.segmentEndIndex+f,E=h[S],x=x_(p.axis),b=OM(d,g,E,x);Ut(p.draggerGfx,b.x,b.y)}function l(p,f){var d=0,h=p.filter(function(m,g){return Qu(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=u_(h,f.segmentStart,f.segmentEnd),Le(f.draggerGfx).add("djs-dragging"),n.addMarker(d,__)}),t.on("connectionSegment.move.move",function(p){var f=p.context,d=f.connection,h=f.segmentStartIndex,m=f.segmentEndIndex,g=f.segmentStart,S=f.segmentEnd,E=f.axis,x=f.originalWaypoints.slice(),b=b_(g,E,p["d"+E]),w=b_(S,E,p["d"+E]),T=x.length,O=0;x[h]=b,x[m]=w;var P,j;h<2&&(P=Wt(d.source,b),h===1?P==="intersect"&&(x.shift(),x[0]=b,O--):P!=="intersect"&&(x.unshift(g),O++)),m>T-3&&(j=Wt(d.target,w),m===T-2?j==="intersect"&&(x.pop(),x[x.length-1]=w):j!=="intersect"&&x.push(S)),f.newWaypoints=d.waypoints=s(d,x),u(f,O,p),f.newSegmentStartIndex=h+O,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,y_)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,y_)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,d=f.connection;f.draggerGfx&&It(f.draggerGfx),n.removeMarker(d,__)}),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(w){return{original:w.original,x:Math.round(w.x),y:Math.round(w.y)}});var g=l(h,m),S=g.waypoints,E=s(d,S),x=g.segmentOffset,b={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:m+x}};o.updateWaypoints(d,E,b)})}w_.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var LM=Math.abs,S_=Math.round;function IM(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],LM(r-e)<=n)return r}function R_(e){return{x:e.x,y:e.y}}function C_(e){return{x:e.x+e.width,y:e.y+e.height}}function Wn(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:S_(e.x+e.width/2),y:S_(e.y+e.height/2)}}function Co(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function At(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 P_(e){return e.children||[]}var NM=Math.abs,A_=Math.round,pf=10;function T_(e){function t(o,a){if(ge(o)){for(var s=o.length;s--;)if(NM(o[s]-a)<=pf)return o[s]}else{o=+o;var c=a%o;if(c<pf)return a-c;if(c>o-pf)return a-c+o}return a}function n(o,a){if(o.waypoints)return PM(a,o);if(o.width)return{x:A_(o.width/2+o.x),y:A_(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;D(o,{dx:o.dx-p,dy:o.dy-f,x:u,y:l}),(p||a.vertical.indexOf(s)!==-1)&&At(o,"x",u),(f||a.horizontal.indexOf(c)!==-1)&&At(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);!Qe(s)||!c||!c.x||!c.y||(At(o,"x",c.x),At(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;D(o,{dx:o.dx-h,dy:o.dy-m,x:o.x-h,y:o.y-m}),(h||s.vertical.indexOf(l)!==-1)&&At(o,"x",f),(m||s.horizontal.indexOf(p)!==-1)&&At(o,"y",d)}})}T_.$inject=["eventBus"];const BM={__depends__:[Pi,fi],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",l_],bendpointMove:["type",uf],bendpointMovePreview:["type",v_],connectionSegmentMove:["type",w_],bendpointSnapping:["type",T_]};function M_(e,t,n,i){function r(a,s){return i.allowed("connection.create",{source:a,target:s})}function o(a,s){return r(s,a)}e.on("connect.hover",function(a){var s=a.context,c=s.start,u=a.hover,l;if(s.hover=u,l=s.canExecute=r(c,u),!zr(l)){if(l!==!1){s.source=c,s.target=u;return}l=s.canExecute=o(c,u),!zr(l)&&l!==!1&&(s.source=u,s.target=c)}}),e.on(["connect.out","connect.cleanup"],function(a){var s=a.context;s.hover=null,s.source=null,s.target=null,s.canExecute=!1}),e.on("connect.end",function(a){var s=a.context,c=s.canExecute,u=s.connectionStart,l={x:a.x,y:a.y},p=s.source,f=s.target;if(!c)return!1;var d=null,h={connectionStart:ff(s)?l:u,connectionEnd:ff(s)?u:l};jt(c)&&(d=c),s.connection=n.connect(p,f,d,h)}),this.start=function(a,s,c,u){jt(c)||(u=c,c=ve(s)),t.init(a,"connect",{autoActivate:u,data:{shape:s,context:{start:s,connectionStart:c}}})}}M_.$inject=["eventBus","dragging","modeling","rules"];function ff(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var $M=1100,jM=900,k_="connect-ok",D_="connect-not-ok";function O_(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",function(r){var o=r.context,a=o.canExecute,s=o.hover,c=o.source,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;ff(o)&&(h=d,m=f),i.drawPreview(o,a,{source:c||u,target:p||s,connectionStart:h,connectionEnd:m})}),t.on("connect.hover",jM,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?k_:D_)}),t.on(["connect.out","connect.cleanup"],$M,function(r){var o=r.hover;o&&(n.removeMarker(o,k_),n.removeMarker(o,D_))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}O_.$inject=["injector","eventBus","canvas"];const df={__depends__:[zn,fi,Pi],__init__:["connectPreview"],connect:["type",M_],connectPreview:["type",O_]};var FM="djs-dragger";function Li(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)}Li.$inject=["injector","canvas","graphicsFactory","elementFactory"],Li.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()),ss(i),r||(r=e.getConnection=HM(function(m,g,S){return h.getConnection(m,g,S)})),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?ve(o):c,a?ve(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)"})},Li.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||ve(n),o=t.connectionEnd||ve(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);xe(e,s)},Li.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&&Go(o,s,!0)||e,t=i&&Go(a,s,!1)||t,[e,t]},Li.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&It(e.connectionPreviewGfx)},Li.prototype.getConnection=function(e){var t=zM(e);return this._elementFactory.createConnection(t)},Li.prototype.createConnectionPreviewGfx=function(){var e=pe("g");return re(e,{pointerEvents:"none"}),Le(e).add(FM),xe(this._canvas.getActiveLayer(),e),e},Li.prototype.createNoopConnection=function(e,t){return Fo([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function HM(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 zM(e){return jt(e)?e:{}}const VM={__init__:["connectionPreview"],connectionPreview:["type",Li]},Uc="complex-preview";class L_{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(Uc);n.filter(s=>!GM(s)).forEach(s=>{let c;Qe(s)?(c=this._graphicsFactory._createContainer("connection",pe("g")),this._graphicsFactory.drawConnection(Cr(c),s)):(c=this._graphicsFactory._createContainer("shape",pe("g")),this._graphicsFactory.drawShape(Cr(c),s),Ut(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);Qe(s)?Ut(u,c.x,c.y):Ut(u,s.x+c.x,s.y+c.y)}),r.forEach(s=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"])}),o.forEach(({shape:s,bounds:c})=>{this._canvas.addMarker(s,"djs-hidden"),this._markers.push([s,"djs-hidden"]),this._previewSupport.addDragger(s,a,void 0,"djs-dragging");const u=this._graphicsFactory._createContainer("shape",pe("g"));this._graphicsFactory.drawShape(Cr(u),s,{width:c.width,height:c.height}),Ut(u,c.x,c.y),this._previewSupport.addDragger(s,a,u)})}cleanUp(){ss(this._canvas.getLayer(Uc)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(Uc)}hide(){this._canvas.hideLayer(Uc)}}L_.$inject=["canvas","graphicsFactory","previewSupport"];function GM(e){return e.hidden}const WM={__depends__:[go],__init__:["complexPreview"],complexPreview:["type",L_]},I_=Math.round;function qc(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}qc.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(D({type:t},n)),l=a.fire("autoPlace",{source:e,shape:u});if(!l)return;D(u,{x:l.x-I_(u.width/2),y:l.y-I_(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=>!zr(d))})},qc.prototype.cleanUp=function(){this._complexPreview.cleanUp()},qc.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const UM={__depends__:[bc,WM,$p],__init__:["appendPreview"],appendPreview:["type",qc]};var N_=Math.min,B_=Math.max;function hf(e){e.preventDefault()}function ka(e){e.stopPropagation()}function qM(e){return e.nodeType===Node.TEXT_NODE}function YM(e){return[].slice.call(e)}function Jn(e){this.container=e.container,this.parent=rt('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=Xe("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=dn(this.autoResize,this),this.handlePaste=dn(this.handlePaste,this)}Jn.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=Zn(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);D(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=Zn(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return D(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},u),i.centerVertically&&D(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},u),a.innerText=n,be.bind(a,"keydown",this.keyHandler),be.bind(a,"mousedown",ka),be.bind(a,"paste",r.handlePaste),be.bind(a,"focusout",this.focusoutHandler),i.autoResize&&be.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},Jn.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)}},Jn.prototype.insertText=function(e){e=KM(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},Jn.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=YM(a.childNodes),c,u;if(qM(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&&ai(h)}),c=n,u=r+e.length}c&&u!==void 0&&setTimeout(function(){self.setSelection(c,u)})},Jn.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})}},Jn.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=rt('<div class="djs-direct-editing-resize-handle"></div>');var s,c,u,l,p=function(h){hf(h),ka(h),s=h.clientX,c=h.clientY;var m=t.getBoundingClientRect();u=m.width,l=m.height,be.bind(document,"mousemove",f),be.bind(document,"mouseup",d)},f=function(h){hf(h),ka(h);var m=N_(B_(u+h.clientX-s,i),o),g=N_(B_(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){hf(h),ka(h),be.unbind(document,"mousemove",f,!1),be.unbind(document,"mouseup",d,!1)};be.bind(n,"mousedown",p)}D(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)},Jn.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),be.unbind(t,"keydown",this.keyHandler),be.unbind(t,"mousedown",ka),be.unbind(t,"input",this.autoResize),be.unbind(t,"paste",this.handlePaste),be.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),ai(n)),ai(e)},Jn.prototype.getValue=function(){return this.content.innerText.trim()},Jn.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},Jn.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 KM(e){return e.replace(/\r\n|\r|\n/g,`
316
- `)}function Pn(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new Jn({container:t.getContainer(),keyHandler:dn(this._handleKey,this),resizeHandler:dn(this._handleResize,this),focusoutHandler:dn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}Pn.$inject=["eventBus","canvas"],Pn.prototype.registerProvider=function(e){this._providers.push(e)},Pn.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},Pn.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},Pn.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},Pn.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},Pn.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},Pn.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()}},Pn.prototype.getValue=function(){return this._textbox.getValue()},Pn.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()},Pn.prototype._handleResize=function(e){this._fire("resize",e)},Pn.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},Pn.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=it(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 $_={__depends__:[Xs],__init__:["directEditing"],directEditing:["type",Pn]};function XM(e){return function(t){var n=t.target,i=K(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===Oe(e);return!o||!a||!s||!c}}const ZM={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 W(e,t={}){var n=ZM[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var QM=[W("none-start-event",{actionName:"replace-with-none-start"}),W("none-intermediate-throwing"),W("none-end-event",{actionName:"replace-with-none-end"}),W("message-start"),W("timer-start"),W("conditional-start"),W("signal-start")],JM=[W("none-start-event",{actionName:"replace-with-none-start"}),W("none-intermediate-throwing"),W("none-end-event",{actionName:"replace-with-none-end"})],e2=[W("none-start-event",{actionName:"replace-with-none-start"}),W("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),W("none-end-event",{actionName:"replace-with-none-end"}),W("message-intermediate-catch"),W("message-intermediate-throw"),W("timer-intermediate-catch"),W("escalation-intermediate-throw"),W("conditional-intermediate-catch"),W("link-intermediate-catch"),W("link-intermediate-throw"),W("compensation-intermediate-throw"),W("signal-intermediate-catch"),W("signal-intermediate-throw")],t2=[W("none-start-event",{actionName:"replace-with-none-start"}),W("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),W("none-end-event",{actionName:"replace-with-none-end"}),W("message-end"),W("escalation-end"),W("error-end"),W("cancel-end"),W("compensation-end"),W("signal-end"),W("terminate-end")],n2=[W("exclusive-gateway"),W("parallel-gateway"),W("inclusive-gateway"),W("complex-gateway"),W("event-based-gateway")],i2=[W("transaction"),W("event-subprocess"),W("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),W("collapsed-subprocess")],r2=[W("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),W("transaction"),W("event-subprocess"),W("collapsed-ad-hoc-subprocess")],j_=[W("transaction"),W("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),W("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),W("event-subprocess")],o2=j_,F_=[W("task"),W("user-task"),W("service-task"),W("send-task"),W("receive-task"),W("manual-task"),W("rule-task"),W("script-task"),W("call-activity"),W("collapsed-subprocess"),W("expanded-subprocess"),W("collapsed-ad-hoc-subprocess"),W("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],a2=[W("data-store-reference")],s2=[W("data-object-reference")],c2=[W("message-boundary"),W("timer-boundary"),W("escalation-boundary"),W("conditional-boundary"),W("error-boundary"),W("cancel-boundary"),W("signal-boundary"),W("compensation-boundary"),W("non-interrupting-message-boundary"),W("non-interrupting-timer-boundary"),W("non-interrupting-escalation-boundary"),W("non-interrupting-conditional-boundary"),W("non-interrupting-signal-boundary")],u2=[W("message-start"),W("timer-start"),W("conditional-start"),W("signal-start"),W("error-start"),W("escalation-start"),W("compensation-start"),W("non-interrupting-message-start"),W("non-interrupting-timer-start"),W("non-interrupting-conditional-start"),W("non-interrupting-signal-start"),W("non-interrupting-escalation-start")],l2=[{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"}],p2=[W("expanded-pool"),W("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],f2={"bpmn:MessageEventDefinition":[W("message-start"),W("message-intermediate-catch"),W("message-intermediate-throw"),W("message-end")],"bpmn:TimerEventDefinition":[W("timer-start"),W("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[W("conditional-start"),W("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[W("signal-start"),W("signal-intermediate-catch"),W("signal-intermediate-throw"),W("signal-end")],"bpmn:ErrorEventDefinition":[W("error-start"),W("error-end")],"bpmn:EscalationEventDefinition":[W("escalation-start"),W("escalation-intermediate-throw"),W("escalation-end")],"bpmn:CompensateEventDefinition":[W("compensation-start"),W("compensation-intermediate-throw"),W("compensation-end")]};const H_={"start-event-non-interrupting":`
315
+ </svg>`},RM=900;function Co(e,t,n,i){e.registerProvider(RM,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}Co.$inject=["contextPad","popupMenu","translate","canvas"],Co.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&D(t,this._getEntries(e)),t},Co.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Co.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${d_.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);D(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},Co.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 CM=["left","center","right","top","middle","bottom"];function Ma(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}Ma.$inject=["popupMenu","alignElements","translate","rules"],Ma.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&D(t,this._getEntries(e)),t},Ma.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Ma.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return M(CM,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:d_[o],action:function(){t.trigger(e,o),i.close()}}}),r};function Uc(e){Hn.call(this,e)}Uc.$inject=["eventBus"],ie(Uc,Hn),Uc.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=ms(n),n.length<2?!1:n})};const PM={__depends__:[$T,Sv,cf],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Co],alignElementsMenuProvider:["type",Ma],bpmnAlignElements:["type",Uc]};function Li(e,t,n,i){Y.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=_u(Wr(a.closure.topLevel)),c=a.hints,u=c?c.autoResize:!0;if(u!==!1){var l=Ur(s,function(p){return p.parent.id});M(l,function(p,f){ge(u)&&(p=p.filter(function(d){return rt(u,qr({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)})}Li.$inject=["eventBus","elementRegistry","modeling","rules"],ie(Li,Y),Li.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=he(Rt(e)),o=he(t),a={};return r.top-o.top<i.top&&(a.top=r.top-n.top),r.left-o.left<i.left&&(a.left=r.left-n.left),o.right-r.right<i.right&&(a.right=r.right+n.right),o.bottom-r.bottom<i.bottom&&(a.bottom=r.bottom+n.bottom),vs(D({},o,a))},Li.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(AM(i,t)){var r=TM(Xn(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},Li.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Li.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Li.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function AM(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function TM(e,t){var n="";return e=he(e),t=he(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 qc(e){e.invoke(Li,this)}qc.$inject=["injector"],ie(qc,Li),qc.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 ka(e){Hn.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}ka.$inject=["eventBus"],ie(ka,Hn),ka.prototype.canResize=function(e,t){return!1};function Yc(e,t){ka.call(this,e),this._modeling=t}ie(Yc,ka),Yc.$inject=["eventBus","modeling"],Yc.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 MM={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",qc],bpmnAutoResizeProvider:["type",Yc]};function Po(e,t,n){this._canvas=n,this._opts=D({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()})}Po.$inject=["config.autoScroll","eventBus","canvas"],Po.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}Po.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Po.prototype.setOptions=function(e){this._opts=D({},this._opts,e)},Po.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=kr(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const DM={__depends__:[Ai],__init__:["autoScroll"],autoScroll:["type",Po]};var h_="djs-bendpoint",m_="djs-segment-dragger";function OM(e,t){var n=kr(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 uf(e,t,n){var i=OM(e,n),r=Pl(t,i);return r}function lf(e,t){var n=le("g");Ne(n).add(h_),we(e,n);var i=le("circle");re(i,{cx:0,cy:0,r:4}),Ne(i).add("djs-visual"),we(n,i);var r=le("circle");return re(r,{cx:0,cy:0,r:10}),Ne(r).add("djs-hit"),we(n,r),t&&Ne(n).add(t),n}function LM(e,t,n,i){var r=le("g");we(e,r);var o=18,a=6,s=11,c=NM(t,n,i),u=a+s,l=le("rect");re(l,{x:-o/2,y:-a/2,width:o,height:a}),Ne(l).add("djs-visual"),we(r,l);var p=le("rect");return re(p,{x:-c/2,y:-u/2,width:c,height:u}),Ne(p).add("djs-hit"),we(r,p),zh(r,i==="v"?90:0),r}function g_(e,t,n){var i=le("g"),r=nl(t,n),o=Ei(t,n);return we(e,i),LM(i,t,n,o),Ne(i).add(m_),Ne(i).add(o==="h"?"horizontal":"vertical"),Kt(i,r.x,r.y),i}function pf(e){return Math.abs(Math.round(e*2/3))}function IM(e,t){var n=BM(e,t);return Ol(e,n)}function NM(e,t,n){var i=t.x-e.x,r=t.y-e.y;return pf(n==="h"?i:r)}function BM(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=Am(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function y_(e,t,n,i,r){function o(x,b,w){var T=x.index,L=x.point,A,F,H,N,z,ce;return T<=0||x.bendpoint?!1:(A=b[T-1],F=b[T],H=nl(A,F),N=Ei(A,F),z=Math.abs(L.x-H.x),ce=Math.abs(L.y-H.y),N&&z<=w&&ce<=w)}function a(x,b){var w=x.waypoints,T,L,A,F;return b.index<=0||b.bendpoint||(T={start:w[b.index-1],end:w[b.index]},L=Ei(T.start,T.end),!L)?null:(L==="h"?A=T.end.x-T.start.x:A=T.end.y-T.start.y,F=pf(A)/2,F)}function s(x,b){var w=b.waypoints,T=uf(t,w,x),L;if(T){L=a(b,T);var A;if(o(T,w,L)?A=r.start(x,b,T.index):A=i.start(x,b,T.index,!T.bendpoint),A!==!1)return!0}}function c(x,b,w){Ee.bind(x,b,function(T){n.triggerMouseEvent(b,T,w),T.stopPropagation()})}function u(x,b){var w=t.getLayer("overlays"),T=Qe('.djs-bendpoints[data-element-id="'+Ra(x.id)+'"]',w);return!T&&b&&(T=le("g"),re(T,{"data-element-id":x.id}),Ne(T).add("djs-bendpoints"),we(w,T),c(T,"mousedown",x),c(T,"click",x),c(T,"dblclick",x)),T}function l(x,b){return Qe('.djs-segment-dragger[data-segment-idx="'+x+'"]',b)}function p(x,b){b.waypoints.forEach(function(w,T){var L=lf(x);we(x,L),Kt(L,w.x,w.y)}),lf(x,"floating")}function f(x,b){for(var w=b.waypoints,T,L,A,F=1;F<w.length;F++)T=w[F-1],L=w[F],Ei(T,L)&&(A=g_(x,T,L),re(A,{"data-segment-idx":F}),c(A,"mousemove",b))}function d(x){M(ps("."+h_,x),function(b){It(b)})}function h(x){M(ps("."+m_,x),function(b){It(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 w=Qe(".floating",x),T=b.point;w&&(Kt(w,T.x,T.y),Ne(w).add("positioned"))}function E(x,b,w){var T=l(b.index,x),L=w[b.index-1],A=w[b.index],F=b.point,H=nl(L,A),N=Ei(L,A),z,ce;T&&(z=$M(T),ce={x:F.x-H.x,y:F.y-H.y},N==="v"&&(ce={x:ce.y,y:ce.x}),Kt(z,ce.x,ce.y))}e.on("connection.changed",function(x){g(x.element)}),e.on("connection.remove",function(x){var b=u(x.element);b&&It(b)}),e.on("element.marker.update",function(x){var b=x.element,w;b.waypoints&&(w=m(b),x.add?Ne(w).add(x.marker):Ne(w).remove(x.marker))}),e.on("element.mousemove",function(x){var b=x.element,w=b.waypoints,T,L;if(w){if(T=u(b,!0),L=uf(t,w,x.originalEvent),!L)return;R(T,L),L.bendpoint||E(T,L,w)}}),e.on("element.mousedown",function(x){if(tr(x)){var b=x.originalEvent,w=x.element;if(w.waypoints)return s(b,w)}}),e.on("selection.changed",function(x){var b=x.newSelection,w=b[0];w&&w.waypoints&&m(w)}),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 w=u(b);if(w){var T=Qe(".floating",w);T&&Ne(T).remove("positioned")}}}),e.on("element.updateId",function(x){var b=x.element,w=x.newId;if(b.waypoints){var T=u(b);T&&re(T,{"data-element-id":w})}}),this.addHandles=m,this.updateHandles=g,this.getBendpointsContainer=u,this.getSegmentDragger=l}y_.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function $M(e){return Qe(".djs-visual",e)}var v_=Math.round,jr="reconnectStart",Fr="reconnectEnd",Da="updateWaypoints";function ff(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=jr:!u&&c===d.length-1?h=Fr:h=Da;var m=h===Da?"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===Da?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(h,{connection:c,source:f===jr?p:u,target:f===Fr?p:l}),d){s.source=f===jr?p:u,s.target=f===Fr?p:l;return}d===!1&&(d=s.allowed=r.allowed(h,{connection:c,source:f===Fr?p:l,target:f===jr?p:u})),d&&(s.source=f===Fr?p:l,s.target=f===jr?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!==Da&&(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:v_(a.x),y:v_(a.y)};if(!c)return!1;m===Da?(p?f.splice(u,0,R):f[u]=R,g.bendpointMove={insert:p,bendpointIndex:u},f=this.cropWaypoints(l,f),o.updateWaypoints(l,t1(f),g)):(m===jr?(g.docking="source",Kc(s)&&(g.docking="target",g.newWaypoints=f.reverse())):m===Fr&&(g.docking="target",Kc(s)&&(g.docking="source",g.newWaypoints=f.reverse())),o.reconnect(l,d,h,R,g))},this)}ff.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],ff.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 Kc(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===jr)return t&&i&&t===i&&n!==i;if(r===Fr)return t&&n&&t===n&&n!==i}var jM="reconnectStart",FM="reconnectEnd",__="updateWaypoints",Oa="connect-ok",Xc="connect-not-ok",b_="connect-hover",x_="djs-updating",E_="djs-dragging",w_=1100;function S_(e,t,n,i){this._injector=t;var r=t.get("connectionPreview",!1);n.on("bendpoint.move.start",function(o){var a=o.context,s=a.bendpointIndex,c=a.connection,u=a.insert,l=c.waypoints,p=l.slice();a.waypoints=l,u&&p.splice(s,0,{x:o.x,y:o.y}),c.waypoints=p;var f=a.draggerGfx=lf(i.getLayer("overlays"));Ne(f).add("djs-dragging"),i.addMarker(c,E_),i.addMarker(c,x_)}),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,b_),u===__)return;s?(i.removeMarker(c,Xc),i.addMarker(c,Oa)):s===!1&&(i.removeMarker(c,Oa),i.addMarker(c,Xc))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],w_,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,b_),i.removeMarker(s,c?Oa:Xc))}),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||{},E={};r&&(R.connectionStart&&(E.connectionStart=R.connectionStart),R.connectionEnd&&(E.connectionEnd=R.connectionEnd),p===jM?Kc(a)?(E.connectionEnd=E.connectionEnd||g,E.source=h,E.target=l||d,m=m.reverse()):(E.connectionStart=E.connectionStart||g,E.source=l||d,E.target=h):p===FM?Kc(a)?(E.connectionStart=E.connectionStart||g,E.source=l||h,E.target=d,m=m.reverse()):(E.connectionEnd=E.connectionEnd||g,E.source=d,E.target=l||h):(E.noCropping=!0,E.noLayout=!0,m[c]=g),p===__&&(m=e.cropWaypoints(f,m)),E.waypoints=m,r.drawPreview(a,s,E)),Kt(u,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],w_,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,u=a.hover,l=a.target,p=a.waypoints;s.waypoints=p,It(c),i.removeMarker(s,x_),i.removeMarker(s,E_),u&&(i.removeMarker(u,Oa),i.removeMarker(u,l?Oa:Xc)),r&&r.cleanUp(a)})}S_.$inject=["bendpointMove","injector","eventBus","canvas"];var R_="connect-hover",C_="djs-updating";function P_(e,t,n){return df(e,t,e[t]+n)}function df(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function HM(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 df(t,i,s)}function A_(e){return e==="x"?"y":"x"}function T_(e,t,n){var i,r;return e.original?e.original:(i=ye(t),r=A_(n),df(e,r,i[r]))}function M_(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,E=f.waypoints,x=E[g],b=E[R],w=uf(n,E,p),T,L,A;if(T=Ei(x,b),!!T)return L=T==="v"?"x":"y",g===0&&(x=T_(x,f.source,L)),R===E.length-1&&(b=T_(b,f.target,L)),w?A=w.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 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,E=h[R],x=A_(p.axis),b=HM(d,g,E,x);Kt(p.draggerGfx,b.x,b.y)}function l(p,f){var d=0,h=p.filter(function(m,g){return tl(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=g_(h,f.segmentStart,f.segmentEnd),Ne(f.draggerGfx).add("djs-dragging"),n.addMarker(d,C_)}),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,E=f.axis,x=f.originalWaypoints.slice(),b=P_(g,E,p["d"+E]),w=P_(R,E,p["d"+E]),T=x.length,L=0;x[h]=b,x[m]=w;var A,F;h<2&&(A=Yt(d.source,b),h===1?A==="intersect"&&(x.shift(),x[0]=b,L--):A!=="intersect"&&(x.unshift(g),L++)),m>T-3&&(F=Yt(d.target,w),m===T-2?F==="intersect"&&(x.pop(),x[x.length-1]=w):F!=="intersect"&&x.push(R)),f.newWaypoints=d.waypoints=s(d,x),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,R_)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,R_)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,d=f.connection;f.draggerGfx&&It(f.draggerGfx),n.removeMarker(d,C_)}),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(w){return{original:w.original,x:Math.round(w.x),y:Math.round(w.y)}});var g=l(h,m),R=g.waypoints,E=s(d,R),x=g.segmentOffset,b={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:m+x}};o.updateWaypoints(d,E,b)})}M_.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var zM=Math.abs,k_=Math.round;function VM(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],zM(r-e)<=n)return r}function D_(e){return{x:e.x,y:e.y}}function O_(e){return{x:e.x+e.width,y:e.y+e.height}}function Wn(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:k_(e.x+e.width/2),y:k_(e.y+e.height/2)}}function Ao(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function Tt(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 L_(e){return e.children||[]}var GM=Math.abs,I_=Math.round,hf=10;function N_(e){function t(o,a){if(ge(o)){for(var s=o.length;s--;)if(GM(o[s]-a)<=hf)return o[s]}else{o=+o;var c=a%o;if(c<hf)return a-c;if(c>o-hf)return a-c+o}return a}function n(o,a){if(o.waypoints)return IM(a,o);if(o.width)return{x:I_(o.width/2+o.x),y:I_(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;D(o,{dx:o.dx-p,dy:o.dy-f,x:u,y:l}),(p||a.vertical.indexOf(s)!==-1)&&Tt(o,"x",u),(f||a.horizontal.indexOf(c)!==-1)&&Tt(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);!et(s)||!c||!c.x||!c.y||(Tt(o,"x",c.x),Tt(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;D(o,{dx:o.dx-h,dy:o.dy-m,x:o.x-h,y:o.y-m}),(h||s.vertical.indexOf(l)!==-1)&&Tt(o,"x",f),(m||s.horizontal.indexOf(p)!==-1)&&Tt(o,"y",d)}})}N_.$inject=["eventBus"];const WM={__depends__:[Ai,di],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",y_],bendpointMove:["type",ff],bendpointMovePreview:["type",S_],connectionSegmentMove:["type",M_],bendpointSnapping:["type",N_]};function B_(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),!Gr(l)){if(l!==!1){s.source=c,s.target=u;return}l=s.canExecute=o(c,u),!Gr(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:mf(s)?l:u,connectionEnd:mf(s)?u:l};Ft(c)&&(d=c),s.connection=n.connect(p,f,d,h)}),this.start=function(a,s,c,u){Ft(c)||(u=c,c=ye(s)),t.init(a,"connect",{autoActivate:u,data:{shape:s,context:{start:s,connectionStart:c}}})}}B_.$inject=["eventBus","dragging","modeling","rules"];function mf(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var UM=1100,qM=900,$_="connect-ok",j_="connect-not-ok";function F_(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;mf(o)&&(h=d,m=f),i.drawPreview(o,a,{source:c||u,target:p||s,connectionStart:h,connectionEnd:m})}),t.on("connect.hover",qM,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?$_:j_)}),t.on(["connect.out","connect.cleanup"],UM,function(r){var o=r.hover;o&&(n.removeMarker(o,$_),n.removeMarker(o,j_))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}F_.$inject=["injector","eventBus","canvas"];const gf={__depends__:[zn,di,Ai],__init__:["connectPreview"],connect:["type",B_],connectPreview:["type",F_]};var YM="djs-dragger";function Ii(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)}Ii.$inject=["injector","canvas","graphicsFactory","elementFactory"],Ii.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()),fs(i),r||(r=e.getConnection=KM(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?ye(o):c,a?ye(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)"})},Ii.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||ye(n),o=t.connectionEnd||ye(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);we(e,s)},Ii.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&&qo(o,s,!0)||e,t=i&&qo(a,s,!1)||t,[e,t]},Ii.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&It(e.connectionPreviewGfx)},Ii.prototype.getConnection=function(e){var t=XM(e);return this._elementFactory.createConnection(t)},Ii.prototype.createConnectionPreviewGfx=function(){var e=le("g");return re(e,{pointerEvents:"none"}),Ne(e).add(YM),we(this._canvas.getActiveLayer(),e),e},Ii.prototype.createNoopConnection=function(e,t){return Vo([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function KM(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 XM(e){return Ft(e)?e:{}}const ZM={__init__:["connectionPreview"],connectionPreview:["type",Ii]},Zc="complex-preview";class H_{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(Zc);n.filter(s=>!QM(s)).forEach(s=>{let c;et(s)?(c=this._graphicsFactory._createContainer("connection",le("g")),this._graphicsFactory.drawConnection(Ar(c),s)):(c=this._graphicsFactory._createContainer("shape",le("g")),this._graphicsFactory.drawShape(Ar(c),s),Kt(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);et(s)?Kt(u,c.x,c.y):Kt(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",le("g"));this._graphicsFactory.drawShape(Ar(u),s,{width:c.width,height:c.height}),Kt(u,c.x,c.y),this._previewSupport.addDragger(s,a,u)})}cleanUp(){fs(this._canvas.getLayer(Zc)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(Zc)}hide(){this._canvas.hideLayer(Zc)}}H_.$inject=["canvas","graphicsFactory","previewSupport"];function QM(e){return e.hidden}const JM={__depends__:[vo],__init__:["complexPreview"],complexPreview:["type",H_]},z_=Math.round;function Qc(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}Qc.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(D({type:t},n)),l=a.fire("autoPlace",{source:e,shape:u});if(!l)return;D(u,{x:l.x-z_(u.width/2),y:l.y-z_(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=>!Gr(d))})},Qc.prototype.cleanUp=function(){this._complexPreview.cleanUp()},Qc.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const e2={__depends__:[Rc,JM,Hp],__init__:["appendPreview"],appendPreview:["type",Qc]};var V_=Math.min,G_=Math.max;function yf(e){e.preventDefault()}function La(e){e.stopPropagation()}function t2(e){return e.nodeType===Node.TEXT_NODE}function n2(e){return[].slice.call(e)}function Qn(e){this.container=e.container,this.parent=st('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=Qe("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=dn(this.autoResize,this),this.handlePaste=dn(this.handlePaste,this)}Qn.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=Xn(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);D(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=Xn(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return D(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},u),i.centerVertically&&D(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},u),a.innerText=n,Ee.bind(a,"keydown",this.keyHandler),Ee.bind(a,"mousedown",La),Ee.bind(a,"paste",r.handlePaste),Ee.bind(a,"focusout",this.focusoutHandler),i.autoResize&&Ee.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},Qn.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)}},Qn.prototype.insertText=function(e){e=i2(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},Qn.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=n2(a.childNodes),c,u;if(t2(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&&si(h)}),c=n,u=r+e.length}c&&u!==void 0&&setTimeout(function(){self.setSelection(c,u)})},Qn.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})}},Qn.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=st('<div class="djs-direct-editing-resize-handle"></div>');var s,c,u,l,p=function(h){yf(h),La(h),s=h.clientX,c=h.clientY;var m=t.getBoundingClientRect();u=m.width,l=m.height,Ee.bind(document,"mousemove",f),Ee.bind(document,"mouseup",d)},f=function(h){yf(h),La(h);var m=V_(G_(u+h.clientX-s,i),o),g=V_(G_(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){yf(h),La(h),Ee.unbind(document,"mousemove",f,!1),Ee.unbind(document,"mouseup",d,!1)};Ee.bind(n,"mousedown",p)}D(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)},Qn.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),Ee.unbind(t,"keydown",this.keyHandler),Ee.unbind(t,"mousedown",La),Ee.unbind(t,"input",this.autoResize),Ee.unbind(t,"paste",this.handlePaste),Ee.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),si(n)),si(e)},Qn.prototype.getValue=function(){return this.content.innerText.trim()},Qn.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},Qn.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 i2(e){return e.replace(/\r\n|\r|\n/g,`
316
+ `)}function Pn(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new Qn({container:t.getContainer(),keyHandler:dn(this._handleKey,this),resizeHandler:dn(this._handleResize,this),focusoutHandler:dn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}Pn.$inject=["eventBus","canvas"],Pn.prototype.registerProvider=function(e){this._providers.push(e)},Pn.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},Pn.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},Pn.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},Pn.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},Pn.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},Pn.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()}},Pn.prototype.getValue=function(){return this._textbox.getValue()},Pn.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()},Pn.prototype._handleResize=function(e){this._fire("resize",e)},Pn.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},Pn.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=rt(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 W_={__depends__:[tc],__init__:["directEditing"],directEditing:["type",Pn]};function r2(e){return function(t){var n=t.target,i=K(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===Ie(e);return!o||!a||!s||!c}}const o2={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=o2[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var a2=[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")],s2=[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")],u2=[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")],l2=[q("exclusive-gateway"),q("parallel-gateway"),q("inclusive-gateway"),q("complex-gateway"),q("event-based-gateway")],p2=[q("transaction"),q("event-subprocess"),q("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),q("collapsed-subprocess")],f2=[q("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),q("transaction"),q("event-subprocess"),q("collapsed-ad-hoc-subprocess")],U_=[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")],d2=U_,q_=[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"})],h2=[q("data-store-reference")],m2=[q("data-object-reference")],g2=[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")],y2=[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")],v2=[{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"}],_2=[q("expanded-pool"),q("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],b2={"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 Y_={"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 Un(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()}Un.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Un.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Un.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],r,o=[];if(ge(e)||!n.allowed("shape.replace",{element:e}))return{};var a=XM(e);return y(t,"bpmn:DataObjectReference")?this._createEntries(e,a2):y(t,"bpmn:DataStoreReference")&&!y(e.parent,"bpmn:Collaboration")?this._createEntries(e,s2):(y(t,"bpmn:Event")&&!y(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=f2[r]||[],!tn(t.$parent)&&y(t.$parent,"bpmn:SubProcess")&&(i=Te(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),y(t,"bpmn:StartEvent")&&!y(t.$parent,"bpmn:SubProcess")?(o=Te(QM.concat(i),a),this._createEntries(e,o)):y(t,"bpmn:Participant")?(o=Te(p2,function(c){return Oe(e)!==c.target.isExpanded}),this._createEntries(e,o)):y(t,"bpmn:StartEvent")&&tn(t.$parent)?(o=Te(u2.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)):y(t,"bpmn:StartEvent")&&!tn(t.$parent)&&y(t.$parent,"bpmn:SubProcess")?(o=Te(JM.concat(i),a),this._createEntries(e,o)):y(t,"bpmn:EndEvent")?(o=Te(t2.concat(i),function(c){var u=c.target;return u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!y(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,o)):y(t,"bpmn:BoundaryEvent")?(o=Te(c2,function(c){var u=c.target;if(u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!y(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)):y(t,"bpmn:IntermediateCatchEvent")||y(t,"bpmn:IntermediateThrowEvent")?(o=Te(e2.concat(i),a),this._createEntries(e,o)):y(t,"bpmn:Gateway")?(o=Te(n2,a),this._createEntries(e,o)):y(t,"bpmn:Transaction")?(o=Te(j_,a),this._createEntries(e,o)):tn(t)&&Oe(e)?(o=Te(o2,a),this._createEntries(e,o)):y(t,"bpmn:AdHocSubProcess")&&Oe(e)?(o=Te(r2,a),this._createEntries(e,o)):y(t,"bpmn:SubProcess")&&Oe(e)?(o=Te(i2,a),this._createEntries(e,o)):y(t,"bpmn:SubProcess")&&!Oe(e)?(o=Te(F_,function(c){var u=c.target.type===e.type,l=c.target.isExpanded===!0;return u===l}),this._createEntries(e,o)):y(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,l2):y(t,"bpmn:FlowNode")?(o=Te(F_,a),this._createEntries(e,o)):{})},Un.prototype.getPopupMenuHeaderEntries=function(e){var t={};return y(e,"bpmn:Activity")&&!tn(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),y(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),y(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),Nm(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Un.prototype._createEntries=function(e,t){var n={},i=this;return M(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},Un.prototype._createSequenceFlowEntries=function(e,t){var n=K(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&&(y(n.sourceRef,"bpmn:ExclusiveGateway")||y(n.sourceRef,"bpmn:InclusiveGateway")||y(n.sourceRef,"bpmn:ComplexGateway")||y(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&&y(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:y(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e,{conditionExpression:void 0})})}),(y(n.sourceRef,"bpmn:ExclusiveGateway")||y(n.sourceRef,"bpmn:InclusiveGateway")||y(n.sourceRef,"bpmn:ComplexGateway")||y(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},Un.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}},Un.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&&y(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=K(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"}}}},Un.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}}},Un.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}}},Un.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=K(e),i=this,r=Bm(e),o=y(e,"bpmn:BoundaryEvent")?H_["intermediate-event-non-interrupting"]:H_["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 d2={__depends__:[of,iv,bc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Un]};function Da(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(!(!ia(d)||!i.isOpen(m))){var g=i.getEntries(m);g.replace&&g.replace.action.click(d,m)}}),n.on("contextPad.close",function(){f.cleanUp()})}Da.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Da.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&D(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},Da.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return ge(t)?yr(e,n=>t.includes(n)):t},Da.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])&&D(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:c("Delete"),action:{click:d}}}}function m(x){var b=5,w=t.getPad(x).html,T=w.getBoundingClientRect(),O={x:T.left,y:T.bottom+b};return O}function g(x,b,w,T){function O(F,I){var H=i.createShape(D({type:x},T));o.start(F,H,{source:I})}var P=s?function(F,I){var H=i.createShape(D({type:x},T));s.append(I,H)}:O,j=s?function(F,I){return u.create(I,x,T),()=>{u.cleanUp()}}:null;return{group:"model",className:b,title:w,action:{dragstart:O,click:P,hover:j}}}function S(x){return function(b,w){n.splitLane(w,x),t.open(w,!0)}}if(Ce(p,["bpmn:Lane","bpmn:Participant"])&&Oe(e)){var E=Qi(e);D(l,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(x,b){n.addLane(b,"top")}}}}),E.length<2&&((Ht(e)?e.height>=120:e.width>=120)&&D(l,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:S(2)}}}),(Ht(e)?e.height>=180:e.width>=180)&&D(l,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:S(3)}}})),D(l,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(x,b){n.addLane(b,"bottom")}}}})}return y(p,"bpmn:FlowNode")&&(y(p,"bpmn:EventBasedGateway")?D(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"})}):z_(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?D(l,{"append.compensation-activity":g("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!y(p,"bpmn:EndEvent")&&!p.isForCompensation&&!z_(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!tn(p)&&D(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")||D(l,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(x,b){var w=D(m(b),{cursor:{x:x.x,y:x.y}});a.open(b,"bpmn-replace",w,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),y(p,"bpmn:SequenceFlow")&&D(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),y(p,"bpmn:MessageFlow")&&D(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),Ce(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&D(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}}}),y(p,"bpmn:TextAnnotation")&&D(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:f,dragstart:f}}}),Ce(p,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&D(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:f,dragstart:f}}}),y(p,"bpmn:Group")&&D(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&D(l,h()),l};function z_(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 h2={__depends__:[UM,$_,vy,zn,df,Qs,d2],__init__:["contextPadProvider"],contextPadProvider:["type",Da]};var m2={horizontal:["x","width"],vertical:["y","height"]},V_=5;function Ii(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return ge(i)?i:i?n:[]})}Ii.$inject=["modeling","rules"],Ii.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},Ii.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},Ii.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},Ii.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=ti(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},Ii.prototype._setOrientation=function(e){var t=m2[e];this._axis=t[0],this._dimension=t[1]},Ii.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)},Ii.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+V_,max:t+n-V_}};const g2={__init__:["distributeElements"],distributeElements:["type",Ii]};function Yc(e){Hn.call(this,e)}Yc.$inject=["eventBus"],ie(Yc,Hn),Yc.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=Te(t,function(n){var i=Ce(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=ls(t),t.length<3?!1:t})};var G_={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
327
+ </svg>`};function Un(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()}Un.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Un.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Un.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],r,o=[];if(ge(e)||!n.allowed("shape.replace",{element:e}))return{};var a=r2(e);return v(t,"bpmn:DataObjectReference")?this._createEntries(e,h2):v(t,"bpmn:DataStoreReference")&&!v(e.parent,"bpmn:Collaboration")?this._createEntries(e,m2):(v(t,"bpmn:Event")&&!v(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=b2[r]||[],!on(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(a2.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:Participant")?(o=Oe(_2,function(c){return Ie(e)!==c.target.isExpanded}),this._createEntries(e,o)):v(t,"bpmn:StartEvent")&&on(t.$parent)?(o=Oe(y2.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")&&!on(t.$parent)&&v(t.$parent,"bpmn:SubProcess")?(o=Oe(s2.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:EndEvent")?(o=Oe(u2.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(g2,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(l2,a),this._createEntries(e,o)):v(t,"bpmn:Transaction")?(o=Oe(U_,a),this._createEntries(e,o)):on(t)&&Ie(e)?(o=Oe(d2,a),this._createEntries(e,o)):v(t,"bpmn:AdHocSubProcess")&&Ie(e)?(o=Oe(f2,a),this._createEntries(e,o)):v(t,"bpmn:SubProcess")&&Ie(e)?(o=Oe(p2,a),this._createEntries(e,o)):v(t,"bpmn:SubProcess")&&!Ie(e)?(o=Oe(q_,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,v2):v(t,"bpmn:FlowNode")?(o=Oe(q_,a),this._createEntries(e,o)):{})},Un.prototype.getPopupMenuHeaderEntries=function(e){var t={};return v(e,"bpmn:Activity")&&!on(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),v(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),v(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),Vm(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Un.prototype._createEntries=function(e,t){var n={},i=this;return M(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},Un.prototype._createSequenceFlowEntries=function(e,t){var n=K(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},Un.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}},Un.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=K(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"}}}},Un.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}}},Un.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}}},Un.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=K(e),i=this,r=Gm(e),o=v(e,"bpmn:BoundaryEvent")?Y_["intermediate-event-non-interrupting"]:Y_["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 x2={__depends__:[cf,ly,Rc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Un]};function Ia(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(!(!aa(d)||!i.isOpen(m))){var g=i.getEntries(m);g.replace&&g.replace.action.click(d,m)}}),n.on("contextPad.close",function(){f.cleanUp()})}Ia.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Ia.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&D(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},Ia.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return ge(t)?_r(e,n=>t.includes(n)):t},Ia.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])&&D(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:c("Delete"),action:{click:d}}}}function m(x){var b=5,w=t.getPad(x).html,T=w.getBoundingClientRect(),L={x:T.left,y:T.bottom+b};return L}function g(x,b,w,T){function L(H,N){var z=i.createShape(D({type:x},T));o.start(H,z,{source:N})}var A=s?function(H,N){var z=i.createShape(D({type:x},T));s.append(N,z)}:L,F=s?function(H,N){return u.create(N,x,T),()=>{u.cleanUp()}}:null;return{group:"model",className:b,title:w,action:{dragstart:L,click:A,hover:F}}}function R(x){return function(b,w){n.splitLane(w,x),t.open(w,!0)}}if(ke(p,["bpmn:Lane","bpmn:Participant"])&&Ie(e)){var E=Ji(e);D(l,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(x,b){n.addLane(b,"top")}}}}),E.length<2&&((Vt(e)?e.height>=120:e.width>=120)&&D(l,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:R(2)}}}),(Vt(e)?e.height>=180:e.width>=180)&&D(l,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:R(3)}}})),D(l,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(x,b){n.addLane(b,"bottom")}}}})}return v(p,"bpmn:FlowNode")&&(v(p,"bpmn:EventBasedGateway")?D(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"})}):K_(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?D(l,{"append.compensation-activity":g("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!v(p,"bpmn:EndEvent")&&!p.isForCompensation&&!K_(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!on(p)&&D(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")||D(l,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(x,b){var w=D(m(b),{cursor:{x:x.x,y:x.y}});a.open(b,"bpmn-replace",w,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),v(p,"bpmn:SequenceFlow")&&D(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),v(p,"bpmn:MessageFlow")&&D(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),ke(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&D(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")&&D(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:f,dragstart:f}}}),ke(p,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&D(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")&&D(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&D(l,h()),l};function K_(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 E2={__depends__:[e2,W_,Sv,zn,gf,ic,x2],__init__:["contextPadProvider"],contextPadProvider:["type",Ia]};var w2={horizontal:["x","width"],vertical:["y","height"]},X_=5;function Ni(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return ge(i)?i:i?n:[]})}Ni.$inject=["modeling","rules"],Ni.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},Ni.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},Ni.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},Ni.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=ti(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},Ni.prototype._setOrientation=function(e){var t=w2[e];this._axis=t[0],this._dimension=t[1]},Ni.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)},Ni.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+X_,max:t+n-X_}};const S2={__init__:["distributeElements"],distributeElements:["type",Ni]};function Jc(e){Hn.call(this,e)}Jc.$inject=["eventBus"],ie(Jc,Hn),Jc.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=Oe(t,function(n){var i=ke(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=ms(t),t.length<3?!1:t})};var Z_={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>`},v2=900;function Oa(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",v2,this)}Oa.$inject=["popupMenu","distributeElements","translate","rules"],Oa.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&D(t,this._getEntries(e)),t},Oa.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Oa.prototype._getEntries=function(e){var t=this._distributeElements,n=this._translate,i=this._popupMenu,r={"distribute-elements-horizontal":{group:"distribute",title:n("Distribute elements horizontally"),className:"bjs-align-elements-menu-entry",imageHtml:G_.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:G_.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const y2={__depends__:[of,g2],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",Yc],distributeElementsMenuProvider:["type",Oa]};var W_="is not a registered action",_2="is already registered";function qn(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}qn.$inject=["eventBus","injector"],qn.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=ge(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&&(ge(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)})},qn.prototype.trigger=function(e,t){if(!this._actions[e])throw mf(e,W_);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},qn.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)})},qn.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw mf(e,_2);this._actions[e]=t},qn.prototype.unregister=function(e){if(!this.isRegistered(e))throw mf(e,W_);this._actions[e]=void 0},qn.prototype.getActions=function(){return Object.keys(this._actions)},qn.prototype.isRegistered=function(e){return!!this._actions[e]};function mf(e,t){return new Error(e+" "+t)}const b2={__init__:["editorActions"],editorActions:["type",qn]};function Kc(e){e.invoke(qn,this)}ie(Kc,qn),Kc.$inject=["injector"],Kc.prototype._registerDefaultActions=function(e){qn.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=[],S=h.type;m.length&&(g=Te(m,function(E){return!y(E,"bpmn:Lane")}),u.trigger(g,S))}),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;y(h,"bpmn:Collaboration")?g=n.filter(function(S){return y(S.parent,"bpmn:Collaboration")}):g=n.filter(function(S){return S!==h&&!y(S.parent,"bpmn:SubProcess")}),m=St(g),f.moveElements(g,{x:-m.x,y:-m.y},h)}),i&&d&&this._registerAction("replaceElement",function(h){d.triggerEntry("replace","click",h)})};const x2={__depends__:[b2],editorActions:["type",Kc]};function U_(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;Ce(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}U_.$inject=["eventBus"];function jr(e,t){U.call(this,e),this._gridSnapping=t;var n=this;this.preExecute("shape.resize",function(i){var r=i.context,o=r.hints||{},a=o.autoResize;if(a){var s=r.shape,c=r.newBounds;gn(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}jr.$inject=["eventBus","gridSnapping","modeling"],ie(jr,U),jr.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},jr.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},jr.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),D(e,o),e},jr.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),D(e,o),e};var E2=2e3;function q_(e,t){e.on(["spaceTool.move","spaceTool.end"],E2,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)}})}q_.$inject=["eventBus","gridSnapping"];const w2={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",jr],gridSnappingSpaceToolBehavior:["type",q_]};var Xc=10;function gf(e,t,n){return n||(n="round"),Math[n](e/t)*t}var S2=1200,R2=800;function pr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",R2,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"],S2,function(o){var a=o.originalEvent;if(!(!r.active||a&&wn(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(u){var l={},p=P2(o,u,e);p&&(l.offset=p);var f=C2(o,u);f&&D(l,f),Co(o,u)||r.snapEvent(o,u,l)})}})}pr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);At(e,t,i)},pr.prototype.getGridSpacing=function(){return Xc},pr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=gf(e,Xc);var i,r;return t&&t.min&&(i=t.min,_e(i)&&(i=gf(i+n,Xc,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,_e(r)&&(r=gf(r+n,Xc,"floor"),e=Math.min(e,r))),e-=n,e},pr.prototype.isActive=function(){return this.active},pr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},pr.prototype.toggleActive=function(){this.setActive(!this.active)},pr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function C2(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&&(Zc(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&&(Zc(t)?K_(s)?a.x.max=c.left:a.x.min=c.right:Y_(s)?a.y.max=c.top:a.y.min=c.bottom),u&&(Zc(t)?K_(s)?a.x.min=u.left:a.x.max=u.right:Y_(s)?a.y.min=u.top:a.y.max=u.bottom),a[t]}function P2(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&_e(s[t])||(s||(s=o.snapOffset={}),_e(s[t])||(s[t]=0),!r)||(n.get(r.id)||(Zc(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 Zc(e){return e==="x"}function Y_(e){return e.indexOf("n")!==-1}function K_(e){return e.indexOf("w")!==-1}const A2={__depends__:[w2],__init__:["gridSnapping"],gridSnapping:["type",pr]};var T2=2e3;function X_(e,t,n){e.on("autoPlace",T2,function(i){var r=i.source,o=ve(r),a=i.shape,s=Kv(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],y(a,"bpmn:TextAnnotation")&&(M2(c)?u.offset=-a.width/2:u.offset=-a.height/2),s[c]=t.snapValue(s[c],u))}),s})}X_.$inject=["eventBus","gridSnapping","elementRegistry"];function M2(e){return e==="x"}var k2=1750;function Z_(e,t,n){t.on(["create.start","shape.move.start"],k2,function(i){var r=i.context,o=r.shape,a=e.getRootElement();if(!(!y(o,"bpmn:Participant")||!y(a,"bpmn:Process")||!a.children.length)){var s=r.createConstraints;s&&(o.width=n.snapValue(o.width,{min:o.width}),o.height=n.snapValue(o.height,{min:o.height}))}})}Z_.$inject=["canvas","eventBus","gridSnapping"];var D2=3e3;function Qc(e,t,n){U.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],D2,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||O2(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}Qc.$inject=["eventBus","gridSnapping","modeling"],ie(Qc,U),Qc.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=N2(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function O2(e){return e.length>3}function L2(e){return e==="h"}function I2(e){return e==="v"}function N2(e,t,n){var i=xi(t,n),r={};return L2(i)&&(r.y=e.snapValue(t.y)),I2(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=D({},t,r),n=D({},n,r)),[t,n]}const B2={__depends__:[A2,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",X_],gridSnappingParticipantBehavior:["type",Z_],gridSnappingLayoutConnectionBehavior:["type",Qc]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",U_]};var $2=30,Q_=30;function La(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var r=i.element,o=i.gfx;if(y(r,"bpmn:Lane"))return n._createParticipantHit(r,o);if(y(r,"bpmn:Participant"))return Oe(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(y(r,"bpmn:SubProcess"))return Oe(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}La.$inject=["eventBus","interactionEvents"],La.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},La.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=Ht(e)?{width:$2,height:e.height}:{width:e.width,height:Q_};return this._interactionEvents.createBoxHit(t,"all",n),!0},La.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:Q_}),!0};const j2={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",La]};function Jc(e){e.invoke(_o,this)}ie(Jc,_o),Jc.$inject=["injector"],Jc.prototype.registerBindings=function(e,t){_o.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 F2={__depends__:[Vp],__init__:["keyboardBindings"],keyboardBindings:["type",Jc]};var H2={moveSpeed:1,moveSpeedAccelerated:10},z2=1500,J_="left",eb="up",tb="right",nb="down",V2={ArrowLeft:J_,Left:J_,ArrowUp:eb,Up:eb,ArrowRight:tb,Right:tb,ArrowDown:nb,Down:nb},G2={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 ib(e,t,n,i,r){var o=this;this._config=D({},H2,e||{}),t.addListener(z2,function(a){var s=a.keyEvent,c=V2[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=G2[a](u),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,l)}}}ib.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const W2={__depends__:[Vp,zn],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",ib]};var rb=10;function Ia(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=HS(l,p,u),c.newBounds=VS(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:de(l)})}function s(c){var u=c.shape,l=c.canExecute,p=c.newBounds;if(l){if(p=xh(p),!U2(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)})}Ia.prototype.canResize=function(e){var t=this._rules,n=Zn(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Ia.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=D({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,ob(t,o),"resize",{autoActivate:!0,cursor:q2(o),data:{shape:t,context:r}})},Ia.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:rb,height:rb},r=cm(t,e.childrenBoxPadding),GS(n,t,i,r)},Ia.$inject=["eventBus","rules","modeling","dragging"];function U2(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function ob(e,t){var n=ve(e),i=de(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 q2(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 ab="djs-resizing",sb="resize-not-ok",Y2=500;function cb(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,ab)),s.width>5&&re(c,{x:s.x,width:s.width}),s.height>5&&re(c,{y:s.y,height:s.height}),o.canExecute?Le(c).remove(sb):Le(c).add(sb)}function r(o){var a=o.shape,s=o.frame;s&&It(o.frame),t.removeMarker(a,ab)}e.on("resize.move",Y2,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}cb.$inject=["eventBus","canvas","previewSupport"];var eu=-6,tu=8,nu=20,Na="djs-resizer",K2=["n","w","s","e","nw","ne","se","sw"];function fr(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,dn(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}fr.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){er(o)&&i.activate(o,e,n)}be.bind(t,"mousedown",r),be.bind(t,"touchstart",r)},fr.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=X2(i),a=pe("g");Le(a).add(Na),Le(a).add(Na+"-"+e.id),Le(a).add(Na+"-"+i),xe(r,a);var s=pe("rect");re(s,{x:-tu/2+o.x,y:-tu/2+o.y,width:tu,height:tu}),Le(s).add(Na+"-visual"),xe(a,s);var c=pe("rect");return re(c,{x:-nu/2+o.x,y:-nu/2+o.y,width:nu,height:nu}),Le(c).add(Na+"-hit"),xe(a,c),gs(a,t,n),a},fr.prototype.createResizer=function(e,t){var n=ob(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},fr.prototype.addResizer=function(e){var t=this;Qe(e)||M(K2,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},fr.prototype.removeResizers=function(){var e=this._getResizersParent();ss(e)},fr.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},fr.$inject=["eventBus","canvas","selection","resize"];function X2(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-eu:e.indexOf("w")!==-1&&(t.x=eu),e.indexOf("s")!==-1?t.y=-eu:e.indexOf("n")!==-1&&(t.y=eu),t}const ub={__depends__:[fi,Pi,go],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Ia],resizePreview:["type",cb],resizeHandles:["type",fr]};var Z2=2e3;function Ba(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"],Z2,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||Ce(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}Ba.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Ba.prototype.activate=function(e){var t=Dn(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);D(n,i);var r={},o=n.style||{};return D(o,{backgroundColor:null,border:null}),(Ce(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||lb(e))&&D(r,{centerVertically:!0}),Xi(e)&&(D(r,{resizable:!0,autoResize:!0}),D(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),y(e,"bpmn:TextAnnotation")&&(D(r,{resizable:!0,autoResize:!0}),D(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),D(n,{options:r,style:o}),n}},Ba.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(y(e,"bpmn:Lane")||ek(e)){var h=Ht(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};D(o,m),D(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(J2(e)){var g=Ht(e),S=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};D(o,S),D(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)"})}(Ce(e,["bpmn:Task","bpmn:CallActivity"])||lb(e))&&(D(o,{width:i.width,height:i.height}),D(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),Q2(e)&&(D(o,{width:i.width,x:i.x}),D(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var E=1,x=i.width+2*E;if(n.labelTarget&&(D(o,{width:x,height:i.height+2*E,x:i.x-E,y:i.y-E}),D(d,{fontSize:u+"px",lineHeight:l})),Xi(n)&&!_s(n)&&!Re(n)){var b=il(e),w=t.getAbsoluteBBox({x:b.x,y:b.y,width:0,height:0}),T=u,O=Pr.width*a+2*E;D(o,{width:O,height:T+2*E,x:w.x-O/2,y:w.y-T/2-E}),D(d,{fontSize:u+"px",lineHeight:l})}return y(e,"bpmn:TextAnnotation")&&(D(o,{width:i.width+2*E,height:i.height+2*E,x:i.x-E,y:i.y-E,minWidth:30*a,minHeight:10*a}),D(d,{textAlign:"left",paddingTop:no*a+"px",paddingBottom:no*a+"px",paddingLeft:no*a+"px",paddingRight:no*a+"px",fontSize:p+"px",lineHeight:f})),{bounds:o,style:d}},Ba.prototype.update=function(e,t,n,i){var r,o;y(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}),tk(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function lb(e){return y(e,"bpmn:SubProcess")&&!Oe(e)}function Q2(e){return y(e,"bpmn:SubProcess")&&Oe(e)}function J2(e){return y(e,"bpmn:Participant")&&!Oe(e)}function ek(e){return y(e,"bpmn:Participant")&&Oe(e)}function tk(e){return!e||!e.trim()}var pb="djs-element-hidden",fb="djs-label-hidden";function db(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,y(o,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(o),s=pe("g");var l=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:o.height,position:{mx:0,my:0}}),p=i.path=pe("path");re(p,{d:l,strokeWidth:2,stroke:nk(o)}),xe(s,p),xe(r,s),Ut(s,o.x,o.y)}y(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,pb):(y(o,"bpmn:Task")||y(o,"bpmn:CallActivity")||y(o,"bpmn:SubProcess")||y(o,"bpmn:Participant")||y(o,"bpmn:Lane"))&&t.addMarker(o,fb)}),e.on("directEditing.resize",function(c){if(y(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,pb),t.removeMarker(o,fb)),o=void 0,a=void 0,s&&(It(s),s=void 0)})}db.$inject=["eventBus","canvas","pathMap"];function nk(e,t){var n=Be(e);return n.get("stroke")||t||"black"}const ik={__depends__:[xp,ub,$_],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Ba],labelEditingPreview:["type",db]};var rk=500,ok=1e3;function mi(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){Vw(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"],rk,function(o){var a=o.element,s=o.gfx,c=Xe(".djs-outline",s);c&&i.updateOutline(a,c)})}mi.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=Xe(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),xe(t,n),this.updateOutline(e,n)),n},mi.prototype._createOutlineGfx=function(){var e=pe("rect");return re(e,D({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},mi.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},mi.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})},mi.prototype.updateConnectionOutline=function(e,t){var n=St(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})},mi.prototype.registerProvider=function(e,t){t||(t=e,e=ok),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},mi.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},mi.prototype.getOutline=function(e){var t,n=this._getProviders();return M(n,function(i){Ft(i.getOutline)&&(t=t||i.getOutline(e))}),t},mi.$inject=["eventBus","styles","elementRegistry"];var iu=6;function vf(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)})}vf.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");ss(t);var n=e.length>1,i=this._canvas.getContainer();if(Le(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=ak(St(e)),o=pe("rect");re(o,D({rx:3},r)),Le(o).add("djs-selection-outline"),xe(t,o)}},vf.$inject=["eventBus","canvas","selection"];function ak(e){return{x:e.x-iu,y:e.y-iu,width:e.width+iu*2,height:e.height+iu*2}}const yf={__depends__:[zn],__init__:["outline","multiSelectionOutline"],outline:["type",mi],multiSelectionOutline:["type",vf]},hb=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],mb={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},sk=15,ru=2;function gb(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=>Ce(h,hb));if(f.length===1){const h=f[0];Re(h)?a(h,h.labelTarget):(d=h.labels)!=null&&d.length&&a(h.labels[0],h)}if(f.length===2){const h=f.find(Re),m=f.find(g=>{var S;return(S=g.labels)==null?void 0:S.includes(h)});h&&m&&a(h,m)}}),e.on("shape.changed",function({element:p}){var f;!Ce(p,hb)||!l(p)||(Re(p)?a(p,p.labelTarget):(f=p.labels)!=null&&f.length&&a(p.labels[0],p))});function a(p,f){const d=Fo([ve(f),ve(p)],mb),h=d.getAttribute("d"),g=r.isSelected(p)?c(p):u(p),S=Go(g,h);if(!S)return;const x=r.isSelected(f)?c(f):u(f),b=Go(x,h)||ve(f);ea(b,S)<sk||(Ku(d,[b,S]),xe(o,d))}function s(){as(`.${mb.class}`,o).forEach(It)}function c(p){const f=i.getOutline(p);if(!f)return u(p);if(f.x){const d={x:p.x+dr(f,"x")-ru,y:p.y+dr(f,"y")-ru,width:dr(f,"width")+ru*2,height:dr(f,"height")+ru*2};return ol(d,dr(f,"rx"))}if(f.cx){const d=dr(f,"r"),h={x:p.x+dr(f,"cx")-d,y:p.y+dr(f,"cy")-d,width:d*2,height:d*2};return Wh(h)}}function u(p){return n.getShapePath(p)}function l(p){return r.isSelected(p)}}gb.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function dr(e,t){return parseFloat(re(e,t)||0)}const ck={__depends__:[zn,yf],__init__:["labelLink"],labelLink:["type",gb]};var uk=new mo("tt");function lk(e){var t=rt('<div class="djs-tooltip-container" />');return ln(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function pk(e,t,n){ln(e,{left:t+"px",top:n+"px"})}function _f(e,t){e.style.display=t===!1?"none":""}var vb="djs-tooltip",bf="."+vb;function mn(e,t){this._eventBus=e,this._canvas=t,this._ids=uk,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=lk(t.getContainer());var n=this;bn.bind(this._tooltipRoot,bf,"mousedown",function(i){i.stopPropagation()}),bn.bind(this._tooltipRoot,bf,"mouseover",function(i){n.trigger("mouseover",i)}),bn.bind(this._tooltipRoot,bf,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}mn.$inject=["eventBus","canvas"],mn.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=D({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},mn.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(Jt(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},mn.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},mn.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},mn.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)}},mn.prototype.remove=function(e){var t=this.get(e);t&&(ai(t.html),ai(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},mn.prototype.show=function(){_f(this._tooltipRoot)},mn.prototype.hide=function(){_f(this._tooltipRoot,!1)},mn.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},mn.prototype._addTooltip=function(e){var t=e.id,n=e.html,i,r=this._tooltipRoot;n.get&&n.constructor.prototype.jquery&&(n=n.get(0)),gn(n)&&(n=rt(n)),i=rt('<div data-tooltip-id="'+t+'" class="'+vb+'">'),ln(i,{position:"absolute"}),i.appendChild(n),e.type&&lt(i).add("djs-tooltip-"+e.type),e.className&&lt(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},mn.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;pk(n,t.x,t.y)},mn.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),_f(i,r))})},mn.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 fk={__init__:["tooltips"],tooltips:["type",mn]};var dk="flow elements must be children of pools/participants",hk="Data object must be placed within a pool/participant.";function yb(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;y(s,"bpmn:Collaboration")&&(y(a,"bpmn:FlowNode")?i(r,n(dk)):y(a,"bpmn:DataObjectReference")&&i(r,n(hk)))})}yb.$inject=["eventBus","tooltips","translate"];const mk={__depends__:[fk],__init__:["modelingFeedback"],modelingFeedback:["type",yb]};var gk=500,vk=1250,yk=1500,ou=Math.round;function _k(e){return{x:e.x+ou(e.width/2),y:e.y+ou(e.height/2)}}function _b(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",yk,function(s){var c=s.context,u=s.shape,l=i.get().slice();l.indexOf(u)===-1&&(l=[u]),l=bk(l),D(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",gk,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=ou(u.x),u.y=ou(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(er(s)){var c=lo(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,u,l){if(jt(u)&&(l=u,u=!1),!(c.waypoints||!c.parent)&&!Le(s.target).has("djs-hit-no-move")){var p=_k(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}_b.$inject=["eventBus","dragging","modeling","selection","rules"];function bk(e){var t=Gr(e,"id");return Te(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var bb=499,xf="djs-dragging",xb="drop-ok",Eb="drop-not-ok",wb="new-parent",Sb="attach-ok";function Rb(e,t,n,i){function r(c){var u=o(c),l=xk(u);return l}function o(c){var u=Ho(c),l=u.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),p=u.concat(l),f=[...new Set(p)];return f}function a(c,u){[Sb,xb,Eb,wb].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,xf),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=pe("g");re(d,n.cls("djs-drag-group",["no-events"]));var h=t.getActiveLayer();xe(h,d),u.dragGroup=d}f.forEach(function(m){i.addDragger(m,u.dragGroup)}),p?p=hu([p,o(l)]):p=o(l),M(p,function(m){t.addMarker(m,xf)}),u.allDraggedElements=p,u.differentParents=Ek(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,Sb):u.canExecute&&f&&p.id!==f.id?a(p,wb):a(p,u.canExecute?xb:Eb)),Ut(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,xf)}),p&&It(p)}),this.makeDraggable=s}Rb.$inject=["eventBus","canvas","styles","previewSupport"];function xk(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=Te(e,function(i){return Qe(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function Ek(e){return Rx(Gr(e,function(t){return t.parent&&t.parent.id}))!==1}const wk={__depends__:[Xs,zn,yf,fi,Pi,go],__init__:["move","movePreview"],move:["type",_b],movePreview:["type",Rb]};var Cb=".djs-palette-toggle",Pb=".entry",Sk=Cb+", "+Pb,Ef="djs-palette-",Rk="shown",wf="open",Ab="two-column",Ck=1e3;function Tt(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()})}Tt.$inject=["eventBus","canvas"],Tt.prototype.registerProvider=function(e,t){t||(t=e,e=Ck),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},Tt.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(Ak,{})},Tt.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},Tt.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=rt(Tt.HTML_MARKUP);n.appendChild(i),lt(n).add(Ef+Rk),bn.bind(i,Sk,"click",function(r){var o=r.delegateTarget;if(Fu(o,Cb))return e.toggle();e.trigger("click",r)}),be.bind(i,"mousedown",function(r){r.stopPropagation()}),bn.bind(i,Pb,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},Tt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},Tt.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,r,o=lt(n),a=lt(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(Ab,r),a.toggle(Ef+Ab,r),"open"in e&&(o.toggle(wf,e.open),a.toggle(Ef+wf,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},Tt.prototype._update=function(){var e=Xe(".djs-palette-entries",this._container),t=this._entries=this.getEntries();rs(e),M(t,function(n,i){var r=n.group||"default",o=Xe("[data-group="+Ea(r)+"]",e);o||(o=rt('<div class="group"></div>'),Jt(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=rt(a);if(o.appendChild(s),!n.separator&&(Jt(s,"data-action",i),n.title&&Jt(s,"title",n.title),n.className&&Pk(s,n.className),n.imageUrl)){var c=rt("<img>");Jt(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},Tt.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=Jt(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},Tt.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(Ft(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},Tt.prototype._layoutChanged=function(){this._toggleState({})},Tt.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},Tt.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},Tt.prototype.open=function(){this._toggleState({open:!0})},Tt.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Tt.prototype.isActiveTool=function(e){return e&&this._activeTool===e},Tt.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=Xe(".djs-palette-entries",this._container),this._toolsContainer=Xe("[data-group=tools]",t)),n=this._toolsContainer,M(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=lt(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},Tt.prototype.isOpen=function(){return lt(this._container).has(wf)},Tt.prototype._getParentContainer=function(){return this._canvas.getContainer()},Tt.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function Pk(e,t){var n=lt(e),i=ge(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function Ak(e,t){var n=t.getPaletteEntries();return Ft(n)?n(e):(M(n,function(i,r){e[r]=i}),e)}const Tk={__init__:["palette"],palette:["type",Tt]};var Tb="crosshair",Mb="selected",Mk="djs-dragging-active-lasso";function hr(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=pe("rect");re(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),xe(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,Mb);for(const g of h)m.has(g)||t.addMarker(g,Mb)}},remove:function(p){this.update(p),p.frame&&It(p.frame),u(!1)}};function u(p){Le(t.getContainer()).toggle(Mk,p)}function l(p){var f=i.getAll();return new Set(Vr(Zr(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=kb(p),f.add=Vs(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=kb(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(Vs(p))return s.activateLasso(p.originalEvent),!0})}hr.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],hr.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:Tb,data:{context:{}},keepSelection:!0})},hr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:Tb,data:{context:{}},keepSelection:!0})},hr.prototype._select=function(e){this._selection.select(e)},hr.prototype.select=function(e,t,n=[]){var i=Vr(Zr(e,t));this._select([...n,...i])},hr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},hr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function kb(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 kk={__depends__:[ec,aa],__init__:["lassoTool"],lassoTool:["type",hr]};var Sf=1500,Db="grab";function Po(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",Sf,function(c){if(ia(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(Sf,function(c){if(!(!Ob(c.keyEvent)||a.isActive())){var u=a._mouse.getLastMoveEvent();a.activateMove(u,!!u)}},"keyboard.keydown"),s&&s.addListener(Sf,function(c){!Ob(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!ia(c)&&l&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}Po.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Po.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:Db,data:{context:n||{}}})},Po.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:Db,data:{context:{reactivate:n}}})},Po.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Po.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function Ob(e){return Nt("Space",e)}const Dk={__depends__:[ec,aa],__init__:["handTool"],handTool:["type",Po]};var Lb="connect-ok",Ib="connect-not-ok";function Ao(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?Lb:Ib))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var u=c.context.startTarget,l=c.context.canStartConnect;u&&i.removeMarker(u,l?Lb:Ib)}),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})}Ao.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Ao.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Ao.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Ao.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Ao.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const Ok={__depends__:[df,fi,Pi,ec,aa],globalConnect:["type",Ao]};function Rf(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)}Rf.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],Rf.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(S){var E=n.createShape(D({type:p},m));t.start(S,E)}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 D(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 Lk={__depends__:[Tk,Qs,uv,kk,Dk,Ok,Xo],__init__:["paletteProvider"],paletteProvider:["type",Rf]};var Ik=250;function Cf(e,t,n,i,r){U.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);D(p,{x:f.x,y:f.y});var d=n.createShape(p);i.addShape(d,f.parent);var h=Xe('[data-element-id="'+Ea(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=Xe('[data-element-id="'+Ea(l)+'"]',s.dragGroup);p&&re(p,{display:"inline"}),u.remove(),c[l]&&delete c[l]})}e.on("shape.move.move",Ik,function(s){var c=s.context,u=c.canExecute;c.visualReplacements||(c.visualReplacements={}),u&&u.replacements?o(c):a(c)})}Cf.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],ie(Cf,U);const Nk={__depends__:[go],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Cf]};var Bk=1250,Pf=40,$k=20,jk=10,Nb=20,Bb=["x","y"],Fk=Math.abs;function $b(e){e.on(["connect.hover","connect.move","connect.end"],Bk,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&wn(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&Hk(t,o,Wk(o)),o&&Gk(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Wn(r),Ce(o,["bpmn:Event","bpmn:Gateway"])&&jb(t,Wn(o)),Ce(o,["bpmn:Task","bpmn:SubProcess"])&&zk(t,o),y(a,"bpmn:BoundaryEvent")&&s===a.host&&Vk(t)):Fb(i,"bpmn:MessageFlow")?(y(r,"bpmn:Event")&&(n.connectionStart=Wn(r)),y(o,"bpmn:Event")&&jb(t,Wn(o))):n.connectionStart=n.initialConnectionStart)})}$b.$inject=["eventBus"];function Hk(e,t,n){Bb.forEach(function(i){var r=Hb(i,t);e[i]<t[i]+n?At(e,i,t[i]+n):e[i]>t[i]+r-n&&At(e,i,t[i]+r-n)})}function zk(e,t){var n=Wn(t);Bb.forEach(function(i){Uk(e,t,i)&&At(e,i,n[i])})}function Vk(e){var t=e.context,n=t.source,i=t.target;if(!qk(t)){var r=Wn(n),o=Wt(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;Fk(c-r[s])<Pf&&(c>r[s]?u=r[s]+Pf:u=r[s]-Pf,At(e,s,u))})}}function jb(e,t){At(e,"x",t.x),At(e,"y",t.y)}function Fb(e,t){return e&&e.type===t}function Gk(e,t){return Ni(t,function(n){return Fb(e,n)})}function Hb(e,t){return e==="x"?t.width:t.height}function Wk(e){return y(e,"bpmn:Task")?jk:$k}function Uk(e,t,n){return e[n]>t[n]+Nb&&e[n]<t[n]+Hb(n,t)-Nb}function qk(e){var t=e.hover,n=e.source;return t&&n&&t===n}function mr(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}mr.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},mr.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},mr.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},mr.prototype.getSnapLocations=function(){return this._snapLocations},mr.prototype.setSnapLocations=function(e){this._snapLocations=e},mr.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new au,n.initDefaults(this._defaultSnaps)),n};function au(){this._snapValues={}}au.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)},au.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&IM(e[n],r[n],i)},au.prototype.initDefaults=function(e){var t=this;M(e||{},function(n,i){M(n,function(r){t.add(i,r)})})};var Yk=1250;function gi(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"],Yk,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&wn(r.originalEvent))&&!(Co(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()})}gi.$inject=["elementRegistry","eventBus","snapping"],gi.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new mr);var o;t.get(i.id)?o=Wn(i,e):o={x:e.x+Wn(i).x,y:e.y+Wn(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}),Re(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},gi.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return M(i,function(r){if(Re(r)){Re(t)&&e.add("mid",Wn(r));return}if(Qe(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",Wn(r))}),!_e(t.x)||!_e(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Wn(t)),e},gi.prototype.getSnapTargets=function(e,t){return P_(t).filter(function(n){return!Kk(n)})};function Kk(e){return!!e.hidden}var zb=1500;function To(e,t){t.invoke(gi,this),e.on(["create.move","create.end"],zb,Jk),e.on(["create.move","create.end","shape.move.move","shape.move.end"],zb,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!Co(n)&&Xk(n,o)})}ie(To,gi),To.$inject=["eventBus","injector"],To.prototype.initSnap=function(e){var t=gi.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",Gb(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",Gb(o,i,e))}),y(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},To.prototype.addSnapTargetPoints=function(e,t,n){gi.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);M(i,function(o){(Qk(o)||Zk([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",R_(o)),e.add("bottom-right",C_(o)))});var r=this._elementRegistry;return M(t.incoming,function(o){if(r.get(t.id)){Vb(i,o.source)||e.add("mid",ve(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)){Vb(i,o.target)||e.add("mid",ve(o.target));var a=o.waypoints[o.waypoints.length-1];e.add(o.id+"-docking",a.original||a)}}),y(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},To.prototype.getSnapTargets=function(e,t){return gi.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!y(n,"bpmn:Lane")})};function Xk(e,t){var n=de(t),i=og(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=ve(o),/top/.test(i)?At(e,"y",n.top-a.y):/bottom/.test(i)&&At(e,"y",n.bottom-a.y),/left/.test(i)?At(e,"x",n.left-a.x):/right/.test(i)&&At(e,"x",n.right-a.x)}function Zk(e,t){return e.every(function(n){return y(n,t)})}function Qk(e){return y(e,"bpmn:SubProcess")&&Oe(e)?!0:y(e,"bpmn:Participant")}function Jk(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)&&At(e,"x",e.x),(i&&i>=e.y||o&&o<=e.y)&&At(e,"y",e.y)}}function Vb(e,t){return e.indexOf(t)!==-1}function Gb(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 $a(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,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&wn(i.originalEvent))&&!Co(i)){var u=c.pointsForTarget(a);u.initialized||(u=n.addSnapTargetPoints(u,o,a,s),u.initialized=!0),iD(s)&&At(i,"x",i.x),rD(s)&&At(i,"y",i.y),t.snap(i,u)}}),e.on(["resize.cleanup"],function(){t.hide()})}$a.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new mr);var o=Wb(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},$a.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return M(r,function(o){e.add("corner",C_(o)),e.add("corner",R_(o))}),e.add("corner",Wb(t,i)),e},$a.$inject=["eventBus","snapping"],$a.prototype.getSnapTargets=function(e,t){return P_(t).filter(function(n){return!tD(n,e)&&!Qe(n)&&!nD(n)&&!Re(n)})};function Wb(e,t){var n=ve(e),i=de(e),r={x:n.x,y:n.y};return t.indexOf("n")!==-1?r.y=i.top:t.indexOf("s")!==-1&&(r.y=i.bottom),t.indexOf("e")!==-1?r.x=i.right:t.indexOf("w")!==-1&&(r.x=i.left),r}function tD(e,t){return e.host===t}function nD(e){return!!e.hidden}function iD(e){return e==="n"||e==="s"}function rD(e){return e==="e"||e==="w"}var oD=7,aD=1e3;function gr(e){this._canvas=e,this._asyncHide=gu(dn(this.hide,this),aD)}gr.$inject=["canvas"],gr.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:Co(e,"x"),y:Co(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,oD),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];jt(s)&&At(e,a,s.originValue)})},gr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=pe("path");return re(n,{d:"M0,0 L0,0"}),Le(n).add("djs-snap-line"),xe(t,n),{update:function(i){_e(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"})}}},gr.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},gr.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},gr.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},gr.prototype.hide=function(){M(this._snapLines,function(e){e.update()})};const sD={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",gi],resizeSnapping:["type",$a],snapping:["type",gr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",$b],createMoveSnapping:["type",To]};var Ub=300;function Ee(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=Xe(Ee.INPUT_SELECTOR,this._container),this._resultsContainer=Xe(Ee.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}Ee.$inject=["canvas","eventBus","selection","translate"],Ee.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:bn.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,Ee.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,Ee.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,Ee.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,Ee.INPUT_SELECTOR,"keydown",function(n){Nt("ArrowUp",n)&&n.preventDefault(),Nt("ArrowDown",n)&&n.preventDefault()}),t(this._container,Ee.INPUT_SELECTOR,"keyup",function(n){if(Nt("Escape",n))return e.close();if(Nt("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(Nt("ArrowUp",n))return e._scrollToDirection(!0);if(Nt("ArrowDown",n))return e._scrollToDirection();Nt(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},Ee.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){bn.unbind(e.el,e.type,e.listener)})},Ee.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=Xe(Ee.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},Ee.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},Ee.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)}},Ee.prototype._clearResults=function(){rs(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},Ee.prototype._getCurrentResult=function(){return Xe(Ee.RESULT_SELECTED_SELECTOR,this._resultsContainer)},Ee.prototype._createResultNode=function(e,t){var n=rt(Ee.RESULT_HTML);return e.primaryTokens.length>0&&qb(n,e.primaryTokens,Ee.RESULT_PRIMARY_HTML),qb(n,e.secondaryTokens,Ee.RESULT_SECONDARY_HTML),Jt(n,Ee.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},Ee.prototype.registerProvider=function(e){this._searchProvider=e},Ee.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,lt(this._canvas.getContainer()).add("djs-search-open"),lt(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},Ee.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,lt(this._canvas.getContainer()).remove("djs-search-open"),lt(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},Ee.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Ee.prototype.isOpen=function(){return this._open},Ee.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&lt(t).remove(Ee.RESULT_SELECTED_CLASS);var n=Jt(e,Ee.RESULT_ID_ATTRIBUTE),i=this._results[n].element;lt(e).add(Ee.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:Ub}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},Ee.prototype._select=function(e){var t=Jt(e,Ee.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:Ub}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},Ee.prototype._getBoxHtml=function(){const e=rt(Ee.BOX_HTML),t=Xe(Ee.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function qb(e,t,n){var i=cD(t),r=rt(n);r.innerHTML=i,e.appendChild(r)}function cD(e){var t="";return e.forEach(function(n){var i=ty(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+Ee.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}Ee.CONTAINER_SELECTOR=".djs-search-container",Ee.INPUT_SELECTOR=".djs-search-input input",Ee.RESULTS_CONTAINER_SELECTOR=".djs-search-results",Ee.RESULT_SELECTOR=".djs-search-result",Ee.RESULT_SELECTED_CLASS="djs-search-result-selected",Ee.RESULT_SELECTED_SELECTOR="."+Ee.RESULT_SELECTED_CLASS,Ee.RESULT_ID_ATTRIBUTE="data-result-id",Ee.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",Ee.BOX_HTML=`<div class="djs-search-container djs-scrollable">
335
+ </svg>`},R2=900;function Na(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",R2,this)}Na.$inject=["popupMenu","distributeElements","translate","rules"],Na.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&D(t,this._getEntries(e)),t},Na.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Na.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:Z_.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:Z_.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const C2={__depends__:[cf,S2],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",Jc],distributeElementsMenuProvider:["type",Na]};var Q_="is not a registered action",P2="is already registered";function qn(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}qn.$inject=["eventBus","injector"],qn.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=ge(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&&(ge(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)})},qn.prototype.trigger=function(e,t){if(!this._actions[e])throw vf(e,Q_);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},qn.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)})},qn.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw vf(e,P2);this._actions[e]=t},qn.prototype.unregister=function(e){if(!this.isRegistered(e))throw vf(e,Q_);this._actions[e]=void 0},qn.prototype.getActions=function(){return Object.keys(this._actions)},qn.prototype.isRegistered=function(e){return!!this._actions[e]};function vf(e,t){return new Error(e+" "+t)}const A2={__init__:["editorActions"],editorActions:["type",qn]};function eu(e){e.invoke(qn,this)}ie(eu,qn),eu.$inject=["injector"],eu.prototype._registerDefaultActions=function(e){qn.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(E){return!v(E,"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=Rt(g),f.moveElements(g,{x:-m.x,y:-m.y},h)}),i&&d&&this._registerAction("replaceElement",function(h){d.triggerEntry("replace","click",h)})};const T2={__depends__:[A2],editorActions:["type",eu]};function J_(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;ke(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}J_.$inject=["eventBus"];function Hr(e,t){Y.call(this,e),this._gridSnapping=t;var n=this;this.preExecute("shape.resize",function(i){var r=i.context,o=r.hints||{},a=o.autoResize;if(a){var s=r.shape,c=r.newBounds;gn(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}Hr.$inject=["eventBus","gridSnapping","modeling"],ie(Hr,Y),Hr.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},Hr.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},Hr.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),D(e,o),e},Hr.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),D(e,o),e};var M2=2e3;function eb(e,t){e.on(["spaceTool.move","spaceTool.end"],M2,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)}})}eb.$inject=["eventBus","gridSnapping"];const k2={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Hr],gridSnappingSpaceToolBehavior:["type",eb]};var tu=10;function _f(e,t,n){return n||(n="round"),Math[n](e/t)*t}var D2=1200,O2=800;function fr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",O2,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"],D2,function(o){var a=o.originalEvent;if(!(!r.active||a&&wn(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(u){var l={},p=I2(o,u,e);p&&(l.offset=p);var f=L2(o,u);f&&D(l,f),Ao(o,u)||r.snapEvent(o,u,l)})}})}fr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);Tt(e,t,i)},fr.prototype.getGridSpacing=function(){return tu},fr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=_f(e,tu);var i,r;return t&&t.min&&(i=t.min,xe(i)&&(i=_f(i+n,tu,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,xe(r)&&(r=_f(r+n,tu,"floor"),e=Math.min(e,r))),e-=n,e},fr.prototype.isActive=function(){return this.active},fr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},fr.prototype.toggleActive=function(){this.setActive(!this.active)},fr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function L2(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&&(nu(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&&(nu(t)?nb(s)?a.x.max=c.left:a.x.min=c.right:tb(s)?a.y.max=c.top:a.y.min=c.bottom),u&&(nu(t)?nb(s)?a.x.min=u.left:a.x.max=u.right:tb(s)?a.y.min=u.top:a.y.max=u.bottom),a[t]}function I2(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&xe(s[t])||(s||(s=o.snapOffset={}),xe(s[t])||(s[t]=0),!r)||(n.get(r.id)||(nu(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 nu(e){return e==="x"}function tb(e){return e.indexOf("n")!==-1}function nb(e){return e.indexOf("w")!==-1}const N2={__depends__:[k2],__init__:["gridSnapping"],gridSnapping:["type",fr]};var B2=2e3;function ib(e,t,n){e.on("autoPlace",B2,function(i){var r=i.source,o=ye(r),a=i.shape,s=nv(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")&&($2(c)?u.offset=-a.width/2:u.offset=-a.height/2),s[c]=t.snapValue(s[c],u))}),s})}ib.$inject=["eventBus","gridSnapping","elementRegistry"];function $2(e){return e==="x"}var j2=1750;function rb(e,t,n){t.on(["create.start","shape.move.start"],j2,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}))}})}rb.$inject=["canvas","eventBus","gridSnapping"];var F2=3e3;function iu(e,t,n){Y.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],F2,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||H2(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}iu.$inject=["eventBus","gridSnapping","modeling"],ie(iu,Y),iu.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=G2(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function H2(e){return e.length>3}function z2(e){return e==="h"}function V2(e){return e==="v"}function G2(e,t,n){var i=Ei(t,n),r={};return z2(i)&&(r.y=e.snapValue(t.y)),V2(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=D({},t,r),n=D({},n,r)),[t,n]}const W2={__depends__:[N2,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",ib],gridSnappingParticipantBehavior:["type",rb],gridSnappingLayoutConnectionBehavior:["type",iu]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",J_]};var U2=30,ob=30;function Ba(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 Ie(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(v(r,"bpmn:SubProcess"))return Ie(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}Ba.$inject=["eventBus","interactionEvents"],Ba.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Ba.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=Vt(e)?{width:U2,height:e.height}:{width:e.width,height:ob};return this._interactionEvents.createBoxHit(t,"all",n),!0},Ba.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:ob}),!0};const q2={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Ba]};function ru(e){e.invoke(xo,this)}ie(ru,xo),ru.$inject=["injector"],ru.prototype.registerBindings=function(e,t){xo.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 Y2={__depends__:[Up],__init__:["keyboardBindings"],keyboardBindings:["type",ru]};var K2={moveSpeed:1,moveSpeedAccelerated:10},X2=1500,ab="left",sb="up",cb="right",ub="down",Z2={ArrowLeft:ab,Left:ab,ArrowUp:sb,Up:sb,ArrowRight:cb,Right:cb,ArrowDown:ub,Down:ub},Q2={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 lb(e,t,n,i,r){var o=this;this._config=D({},K2,e||{}),t.addListener(X2,function(a){var s=a.keyEvent,c=Z2[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=Q2[a](u),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,l)}}}lb.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const J2={__depends__:[Up,zn],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",lb]};var pb=10;function $a(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=KS(l,p,u),c.newBounds=ZS(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:he(l)})}function s(c){var u=c.shape,l=c.canExecute,p=c.newBounds;if(l){if(p=Ah(p),!ek(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)})}$a.prototype.canResize=function(e){var t=this._rules,n=Xn(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},$a.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=D({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,fb(t,o),"resize",{autoActivate:!0,cursor:tk(o),data:{shape:t,context:r}})},$a.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:pb,height:pb},r=mm(t,e.childrenBoxPadding),QS(n,t,i,r)},$a.$inject=["eventBus","rules","modeling","dragging"];function ek(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function fb(e,t){var n=ye(e),i=he(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 tk(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 db="djs-resizing",hb="resize-not-ok",nk=500;function mb(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,db)),s.width>5&&re(c,{x:s.x,width:s.width}),s.height>5&&re(c,{y:s.y,height:s.height}),o.canExecute?Ne(c).remove(hb):Ne(c).add(hb)}function r(o){var a=o.shape,s=o.frame;s&&It(o.frame),t.removeMarker(a,db)}e.on("resize.move",nk,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}mb.$inject=["eventBus","canvas","previewSupport"];var ou=-6,au=8,su=20,ja="djs-resizer",ik=["n","w","s","e","nw","ne","se","sw"];function dr(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,dn(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}dr.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){tr(o)&&i.activate(o,e,n)}Ee.bind(t,"mousedown",r),Ee.bind(t,"touchstart",r)},dr.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=rk(i),a=le("g");Ne(a).add(ja),Ne(a).add(ja+"-"+e.id),Ne(a).add(ja+"-"+i),we(r,a);var s=le("rect");re(s,{x:-au/2+o.x,y:-au/2+o.y,width:au,height:au}),Ne(s).add(ja+"-visual"),we(a,s);var c=le("rect");return re(c,{x:-su/2+o.x,y:-su/2+o.y,width:su,height:su}),Ne(c).add(ja+"-hit"),we(a,c),xs(a,t,n),a},dr.prototype.createResizer=function(e,t){var n=fb(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},dr.prototype.addResizer=function(e){var t=this;et(e)||M(ik,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},dr.prototype.removeResizers=function(){var e=this._getResizersParent();fs(e)},dr.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},dr.$inject=["eventBus","canvas","selection","resize"];function rk(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-ou:e.indexOf("w")!==-1&&(t.x=ou),e.indexOf("s")!==-1?t.y=-ou:e.indexOf("n")!==-1&&(t.y=ou),t}const gb={__depends__:[di,Ai,vo],__init__:["resize","resizePreview","resizeHandles"],resize:["type",$a],resizePreview:["type",mb],resizeHandles:["type",dr]};var ok=2e3;function Fa(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"],ok,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||ke(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}Fa.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Fa.prototype.activate=function(e){var t=On(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);D(n,i);var r={},o=n.style||{};return D(o,{backgroundColor:null,border:null}),(ke(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||yb(e))&&D(r,{centerVertically:!0}),Zi(e)&&(D(r,{resizable:!0,autoResize:!0}),D(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),v(e,"bpmn:TextAnnotation")&&(D(r,{resizable:!0,autoResize:!0}),D(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),D(n,{options:r,style:o}),n}},Fa.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=Vt(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};D(o,m),D(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(sk(e)){var g=Vt(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};D(o,R),D(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)"})}(ke(e,["bpmn:Task","bpmn:CallActivity"])||yb(e))&&(D(o,{width:i.width,height:i.height}),D(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),ak(e)&&(D(o,{width:i.width,x:i.x}),D(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var E=1,x=i.width+2*E;if(n.labelTarget&&(D(o,{width:x,height:i.height+2*E,x:i.x-E,y:i.y-E}),D(d,{fontSize:u+"px",lineHeight:l})),Zi(n)&&!Ss(n)&&!Me(n)){var b=al(e),w=t.getAbsoluteBBox({x:b.x,y:b.y,width:0,height:0}),T=u,L=Tr.width*a+2*E;D(o,{width:L,height:T+2*E,x:w.x-L/2,y:w.y-T/2-E}),D(d,{fontSize:u+"px",lineHeight:l})}return v(e,"bpmn:TextAnnotation")&&(D(o,{width:i.width+2*E,height:i.height+2*E,x:i.x-E,y:i.y-E,minWidth:30*a,minHeight:10*a}),D(d,{textAlign:"left",paddingTop:ro*a+"px",paddingBottom:ro*a+"px",paddingLeft:ro*a+"px",paddingRight:ro*a+"px",fontSize:p+"px",lineHeight:f})),{bounds:o,style:d}},Fa.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}),uk(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function yb(e){return v(e,"bpmn:SubProcess")&&!Ie(e)}function ak(e){return v(e,"bpmn:SubProcess")&&Ie(e)}function sk(e){return v(e,"bpmn:Participant")&&!Ie(e)}function ck(e){return v(e,"bpmn:Participant")&&Ie(e)}function uk(e){return!e||!e.trim()}var vb="djs-element-hidden",_b="djs-label-hidden";function bb(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=le("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=le("path");re(p,{d:l,strokeWidth:2,stroke:lk(o)}),we(s,p),we(r,s),Kt(s,o.x,o.y)}v(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,vb):(v(o,"bpmn:Task")||v(o,"bpmn:CallActivity")||v(o,"bpmn:SubProcess")||v(o,"bpmn:Participant")||v(o,"bpmn:Lane"))&&t.addMarker(o,_b)}),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,vb),t.removeMarker(o,_b)),o=void 0,a=void 0,s&&(It(s),s=void 0)})}bb.$inject=["eventBus","canvas","pathMap"];function lk(e,t){var n=He(e);return n.get("stroke")||t||"black"}const pk={__depends__:[Sp,gb,W_],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Fa],labelEditingPreview:["type",bb]};var fk=500,dk=1e3;function gi(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){Zw(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"],fk,function(o){var a=o.element,s=o.gfx,c=Qe(".djs-outline",s);c&&i.updateOutline(a,c)})}gi.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=Qe(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),we(t,n),this.updateOutline(e,n)),n},gi.prototype._createOutlineGfx=function(){var e=le("rect");return re(e,D({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},gi.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},gi.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})},gi.prototype.updateConnectionOutline=function(e,t){var n=Rt(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})},gi.prototype.registerProvider=function(e,t){t||(t=e,e=dk),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},gi.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},gi.prototype.getOutline=function(e){var t,n=this._getProviders();return M(n,function(i){Ht(i.getOutline)&&(t=t||i.getOutline(e))}),t},gi.$inject=["eventBus","styles","elementRegistry"];var cu=6;function bf(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)})}bf.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");fs(t);var n=e.length>1,i=this._canvas.getContainer();if(Ne(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=hk(Rt(e)),o=le("rect");re(o,D({rx:3},r)),Ne(o).add("djs-selection-outline"),we(t,o)}},bf.$inject=["eventBus","canvas","selection"];function hk(e){return{x:e.x-cu,y:e.y-cu,width:e.width+cu*2,height:e.height+cu*2}}const xf={__depends__:[zn],__init__:["outline","multiSelectionOutline"],outline:["type",gi],multiSelectionOutline:["type",bf]},xb=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],Eb={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},mk=15,uu=2;function wb(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=>ke(h,xb));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;!ke(p,xb)||!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=Vo([ye(f),ye(p)],Eb),h=d.getAttribute("d"),g=r.isSelected(p)?c(p):u(p),R=qo(g,h);if(!R)return;const x=r.isSelected(f)?c(f):u(f),b=qo(x,h)||ye(f);ia(b,R)<mk||(Qu(d,[b,R]),we(o,d))}function s(){ps(`.${Eb.class}`,o).forEach(It)}function c(p){const f=i.getOutline(p);if(!f)return u(p);if(f.x){const d={x:p.x+hr(f,"x")-uu,y:p.y+hr(f,"y")-uu,width:hr(f,"width")+uu*2,height:hr(f,"height")+uu*2};return cl(d,hr(f,"rx"))}if(f.cx){const d=hr(f,"r"),h={x:p.x+hr(f,"cx")-d,y:p.y+hr(f,"cy")-d,width:d*2,height:d*2};return Qh(h)}}function u(p){return n.getShapePath(p)}function l(p){return r.isSelected(p)}}wb.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function hr(e,t){return parseFloat(re(e,t)||0)}const gk={__depends__:[zn,xf],__init__:["labelLink"],labelLink:["type",wb]};var yk=new yo("tt");function vk(e){var t=st('<div class="djs-tooltip-container" />');return pn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function _k(e,t,n){pn(e,{left:t+"px",top:n+"px"})}function Ef(e,t){e.style.display=t===!1?"none":""}var Sb="djs-tooltip",wf="."+Sb;function mn(e,t){this._eventBus=e,this._canvas=t,this._ids=yk,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=vk(t.getContainer());var n=this;bn.bind(this._tooltipRoot,wf,"mousedown",function(i){i.stopPropagation()}),bn.bind(this._tooltipRoot,wf,"mouseover",function(i){n.trigger("mouseover",i)}),bn.bind(this._tooltipRoot,wf,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}mn.$inject=["eventBus","canvas"],mn.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=D({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},mn.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(nn(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},mn.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},mn.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},mn.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)}},mn.prototype.remove=function(e){var t=this.get(e);t&&(si(t.html),si(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},mn.prototype.show=function(){Ef(this._tooltipRoot)},mn.prototype.hide=function(){Ef(this._tooltipRoot,!1)},mn.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},mn.prototype._addTooltip=function(e){var t=e.id,n=e.html,i,r=this._tooltipRoot;n.get&&n.constructor.prototype.jquery&&(n=n.get(0)),gn(n)&&(n=st(n)),i=st('<div data-tooltip-id="'+t+'" class="'+Sb+'">'),pn(i,{position:"absolute"}),i.appendChild(n),e.type&&ft(i).add("djs-tooltip-"+e.type),e.className&&ft(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},mn.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;_k(n,t.x,t.y)},mn.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),Ef(i,r))})},mn.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 bk={__init__:["tooltips"],tooltips:["type",mn]};var xk="flow elements must be children of pools/participants",Ek="Data object must be placed within a pool/participant.";function Rb(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(xk)):v(a,"bpmn:DataObjectReference")&&i(r,n(Ek)))})}Rb.$inject=["eventBus","tooltips","translate"];const wk={__depends__:[bk],__init__:["modelingFeedback"],modelingFeedback:["type",Rb]};var Sk=500,Rk=1250,Ck=1500,lu=Math.round;function Pk(e){return{x:e.x+lu(e.width/2),y:e.y+lu(e.height/2)}}function Cb(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",Ck,function(s){var c=s.context,u=s.shape,l=i.get().slice();l.indexOf(u)===-1&&(l=[u]),l=Ak(l),D(c,{shapes:l,validatedShapes:l,shape:u})}),e.on("shape.move.start",Rk,function(s){var c=s.context,u=c.validatedShapes,l;if(l=c.canExecute=o(u),!l)return!1}),e.on("shape.move.move",Sk,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=lu(u.x),u.y=lu(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(tr(s)){var c=fo(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,u,l){if(Ft(u)&&(l=u,u=!1),!(c.waypoints||!c.parent)&&!Ne(s.target).has("djs-hit-no-move")){var p=Pk(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}Cb.$inject=["eventBus","dragging","modeling","selection","rules"];function Ak(e){var t=Ur(e,"id");return Oe(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var Pb=499,Sf="djs-dragging",Ab="drop-ok",Tb="drop-not-ok",Mb="new-parent",kb="attach-ok";function Db(e,t,n,i){function r(c){var u=o(c),l=Tk(u);return l}function o(c){var u=Go(c),l=u.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),p=u.concat(l),f=[...new Set(p)];return f}function a(c,u){[kb,Ab,Tb,Mb].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,Sf),c.allDraggedElements?c.allDraggedElements.push(u):c.allDraggedElements=[u]}e.on("shape.move.start",Pb,function(c){var u=c.context,l=u.shapes,p=u.allDraggedElements,f=r(l);if(!u.dragGroup){var d=le("g");re(d,n.cls("djs-drag-group",["no-events"]));var h=t.getActiveLayer();we(h,d),u.dragGroup=d}f.forEach(function(m){i.addDragger(m,u.dragGroup)}),p?p=_u([p,o(l)]):p=o(l),M(p,function(m){t.addMarker(m,Sf)}),u.allDraggedElements=p,u.differentParents=Mk(l)}),e.on("shape.move.move",Pb,function(c){var u=c.context,l=u.dragGroup,p=u.target,f=u.shape.parent,d=u.canExecute;p&&(d==="attach"?a(p,kb):u.canExecute&&f&&p.id!==f.id?a(p,Mb):a(p,u.canExecute?Ab:Tb)),Kt(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,Sf)}),p&&It(p)}),this.makeDraggable=s}Db.$inject=["eventBus","canvas","styles","previewSupport"];function Tk(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=Oe(e,function(i){return et(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function Mk(e){return Ox(Ur(e,function(t){return t.parent&&t.parent.id}))!==1}const kk={__depends__:[tc,zn,xf,di,Ai,vo],__init__:["move","movePreview"],move:["type",Cb],movePreview:["type",Db]};var Ob=".djs-palette-toggle",Lb=".entry",Dk=Ob+", "+Lb,Rf="djs-palette-",Ok="shown",Cf="open",Ib="two-column",Lk=1e3;function Mt(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()})}Mt.$inject=["eventBus","canvas"],Mt.prototype.registerProvider=function(e,t){t||(t=e,e=Lk),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},Mt.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(Nk,{})},Mt.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},Mt.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=st(Mt.HTML_MARKUP);n.appendChild(i),ft(n).add(Rf+Ok),bn.bind(i,Dk,"click",function(r){var o=r.delegateTarget;if(Vu(o,Ob))return e.toggle();e.trigger("click",r)}),Ee.bind(i,"mousedown",function(r){r.stopPropagation()}),bn.bind(i,Lb,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},Mt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},Mt.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,r,o=ft(n),a=ft(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(Ib,r),a.toggle(Rf+Ib,r),"open"in e&&(o.toggle(Cf,e.open),a.toggle(Rf+Cf,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},Mt.prototype._update=function(){var e=Qe(".djs-palette-entries",this._container),t=this._entries=this.getEntries();us(e),M(t,function(n,i){var r=n.group||"default",o=Qe("[data-group="+Ra(r)+"]",e);o||(o=st('<div class="group"></div>'),nn(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=st(a);if(o.appendChild(s),!n.separator&&(nn(s,"data-action",i),n.title&&nn(s,"title",n.title),n.className&&Ik(s,n.className),n.imageUrl)){var c=st("<img>");nn(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},Mt.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=nn(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},Mt.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(Ht(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},Mt.prototype._layoutChanged=function(){this._toggleState({})},Mt.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},Mt.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},Mt.prototype.open=function(){this._toggleState({open:!0})},Mt.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Mt.prototype.isActiveTool=function(e){return e&&this._activeTool===e},Mt.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=Qe(".djs-palette-entries",this._container),this._toolsContainer=Qe("[data-group=tools]",t)),n=this._toolsContainer,M(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=ft(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},Mt.prototype.isOpen=function(){return ft(this._container).has(Cf)},Mt.prototype._getParentContainer=function(){return this._canvas.getContainer()},Mt.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function Ik(e,t){var n=ft(e),i=ge(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function Nk(e,t){var n=t.getPaletteEntries();return Ht(n)?n(e):(M(n,function(i,r){e[r]=i}),e)}const Bk={__init__:["palette"],palette:["type",Mt]};var Nb="crosshair",Bb="selected",$k="djs-dragging-active-lasso";function mr(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=le("rect");re(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),we(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,Bb);for(const g of h)m.has(g)||t.addMarker(g,Bb)}},remove:function(p){this.update(p),p.frame&&It(p.frame),u(!1)}};function u(p){Ne(t.getContainer()).toggle($k,p)}function l(p){var f=i.getAll();return new Set(Wr(Jr(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=$b(p),f.add=Ys(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=$b(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(Ys(p))return s.activateLasso(p.originalEvent),!0})}mr.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],mr.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:Nb,data:{context:{}},keepSelection:!0})},mr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:Nb,data:{context:{}},keepSelection:!0})},mr.prototype._select=function(e){this._selection.select(e)},mr.prototype.select=function(e,t,n=[]){var i=Wr(Jr(e,t));this._select([...n,...i])},mr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},mr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function $b(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 jk={__depends__:[oc,ua],__init__:["lassoTool"],lassoTool:["type",mr]};var Pf=1500,jb="grab";function To(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",Pf,function(c){if(aa(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(Pf,function(c){if(!(!Fb(c.keyEvent)||a.isActive())){var u=a._mouse.getLastMoveEvent();a.activateMove(u,!!u)}},"keyboard.keydown"),s&&s.addListener(Pf,function(c){!Fb(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!aa(c)&&l&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}To.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],To.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:jb,data:{context:n||{}}})},To.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:jb,data:{context:{reactivate:n}}})},To.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},To.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function Fb(e){return Nt("Space",e)}const Fk={__depends__:[oc,ua],__init__:["handTool"],handTool:["type",To]};var Hb="connect-ok",zb="connect-not-ok";function Mo(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?Hb:zb))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var u=c.context.startTarget,l=c.context.canStartConnect;u&&i.removeMarker(u,l?Hb:zb)}),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})}Mo.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Mo.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Mo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Mo.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Mo.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const Hk={__depends__:[gf,di,Ai,oc,ua],globalConnect:["type",Mo]};function Af(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)}Af.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],Af.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 E=n.createShape(D({type:p},m));t.start(R,E)}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 D(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 zk={__depends__:[Bk,ic,gy,jk,Fk,Hk,Jo],__init__:["paletteProvider"],paletteProvider:["type",Af]};var Vk=250;function Tf(e,t,n,i,r){Y.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);D(p,{x:f.x,y:f.y});var d=n.createShape(p);i.addShape(d,f.parent);var h=Qe('[data-element-id="'+Ra(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=Qe('[data-element-id="'+Ra(l)+'"]',s.dragGroup);p&&re(p,{display:"inline"}),u.remove(),c[l]&&delete c[l]})}e.on("shape.move.move",Vk,function(s){var c=s.context,u=c.canExecute;c.visualReplacements||(c.visualReplacements={}),u&&u.replacements?o(c):a(c)})}Tf.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],ie(Tf,Y);const Gk={__depends__:[vo],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Tf]};var Wk=1250,Mf=40,Uk=20,qk=10,Vb=20,Gb=["x","y"],Yk=Math.abs;function Wb(e){e.on(["connect.hover","connect.move","connect.end"],Wk,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&wn(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&Kk(t,o,Jk(o)),o&&Qk(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Wn(r),ke(o,["bpmn:Event","bpmn:Gateway"])&&Ub(t,Wn(o)),ke(o,["bpmn:Task","bpmn:SubProcess"])&&Xk(t,o),v(a,"bpmn:BoundaryEvent")&&s===a.host&&Zk(t)):qb(i,"bpmn:MessageFlow")?(v(r,"bpmn:Event")&&(n.connectionStart=Wn(r)),v(o,"bpmn:Event")&&Ub(t,Wn(o))):n.connectionStart=n.initialConnectionStart)})}Wb.$inject=["eventBus"];function Kk(e,t,n){Gb.forEach(function(i){var r=Yb(i,t);e[i]<t[i]+n?Tt(e,i,t[i]+n):e[i]>t[i]+r-n&&Tt(e,i,t[i]+r-n)})}function Xk(e,t){var n=Wn(t);Gb.forEach(function(i){eD(e,t,i)&&Tt(e,i,n[i])})}function Zk(e){var t=e.context,n=t.source,i=t.target;if(!tD(t)){var r=Wn(n),o=Yt(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;Yk(c-r[s])<Mf&&(c>r[s]?u=r[s]+Mf:u=r[s]-Mf,Tt(e,s,u))})}}function Ub(e,t){Tt(e,"x",t.x),Tt(e,"y",t.y)}function qb(e,t){return e&&e.type===t}function Qk(e,t){return Bi(t,function(n){return qb(e,n)})}function Yb(e,t){return e==="x"?t.width:t.height}function Jk(e){return v(e,"bpmn:Task")?qk:Uk}function eD(e,t,n){return e[n]>t[n]+Vb&&e[n]<t[n]+Yb(n,t)-Vb}function tD(e){var t=e.hover,n=e.source;return t&&n&&t===n}function gr(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}gr.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},gr.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},gr.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},gr.prototype.getSnapLocations=function(){return this._snapLocations},gr.prototype.setSnapLocations=function(e){this._snapLocations=e},gr.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new pu,n.initDefaults(this._defaultSnaps)),n};function pu(){this._snapValues={}}pu.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)},pu.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&VM(e[n],r[n],i)},pu.prototype.initDefaults=function(e){var t=this;M(e||{},function(n,i){M(n,function(r){t.add(i,r)})})};var nD=1250;function yi(e,t,n){var i=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],function(r){i.initSnap(r)}),t.on(["create.move","create.end","shape.move.move","shape.move.end"],nD,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&wn(r.originalEvent))&&!(Ao(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()})}yi.$inject=["elementRegistry","eventBus","snapping"],yi.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new gr);var o;t.get(i.id)?o=Wn(i,e):o={x:e.x+Wn(i).x,y:e.y+Wn(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},yi.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",Wn(r));return}if(et(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",Wn(r))}),!xe(t.x)||!xe(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Wn(t)),e},yi.prototype.getSnapTargets=function(e,t){return L_(t).filter(function(n){return!iD(n)})};function iD(e){return!!e.hidden}var Kb=1500;function ko(e,t){t.invoke(yi,this),e.on(["create.move","create.end"],Kb,sD),e.on(["create.move","create.end","shape.move.move","shape.move.end"],Kb,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!Ao(n)&&rD(n,o)})}ie(ko,yi),ko.$inject=["eventBus","injector"],ko.prototype.initSnap=function(e){var t=yi.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",Zb(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",Zb(o,i,e))}),v(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},ko.prototype.addSnapTargetPoints=function(e,t,n){yi.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);M(i,function(o){(aD(o)||oD([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",D_(o)),e.add("bottom-right",O_(o)))});var r=this._elementRegistry;return M(t.incoming,function(o){if(r.get(t.id)){Xb(i,o.source)||e.add("mid",ye(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)){Xb(i,o.target)||e.add("mid",ye(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},ko.prototype.getSnapTargets=function(e,t){return yi.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!v(n,"bpmn:Lane")})};function rD(e,t){var n=he(t),i=fg(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=ye(o),/top/.test(i)?Tt(e,"y",n.top-a.y):/bottom/.test(i)&&Tt(e,"y",n.bottom-a.y),/left/.test(i)?Tt(e,"x",n.left-a.x):/right/.test(i)&&Tt(e,"x",n.right-a.x)}function oD(e,t){return e.every(function(n){return v(n,t)})}function aD(e){return v(e,"bpmn:SubProcess")&&Ie(e)?!0:v(e,"bpmn:Participant")}function sD(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)&&Tt(e,"x",e.x),(i&&i>=e.y||o&&o<=e.y)&&Tt(e,"y",e.y)}}function Xb(e,t){return e.indexOf(t)!==-1}function Zb(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 Ha(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&&wn(i.originalEvent))&&!Ao(i)){var u=c.pointsForTarget(a);u.initialized||(u=n.addSnapTargetPoints(u,o,a,s),u.initialized=!0),pD(s)&&Tt(i,"x",i.x),fD(s)&&Tt(i,"y",i.y),t.snap(i,u)}}),e.on(["resize.cleanup"],function(){t.hide()})}Ha.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new gr);var o=Qb(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},Ha.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return M(r,function(o){e.add("corner",O_(o)),e.add("corner",D_(o))}),e.add("corner",Qb(t,i)),e},Ha.$inject=["eventBus","snapping"],Ha.prototype.getSnapTargets=function(e,t){return L_(t).filter(function(n){return!uD(n,e)&&!et(n)&&!lD(n)&&!Me(n)})};function Qb(e,t){var n=ye(e),i=he(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 uD(e,t){return e.host===t}function lD(e){return!!e.hidden}function pD(e){return e==="n"||e==="s"}function fD(e){return e==="e"||e==="w"}var dD=7,hD=1e3;function yr(e){this._canvas=e,this._asyncHide=xu(dn(this.hide,this),hD)}yr.$inject=["canvas"],yr.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:Ao(e,"x"),y:Ao(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,dD),l!==void 0&&(o[u]={value:l,originValue:l-s[u]}))}),o.x&&o.y)return!1}),this.showSnapLine("vertical",o.x&&o.x.value),this.showSnapLine("horizontal",o.y&&o.y.value),M(["x","y"],function(a){var s=o[a];Ft(s)&&Tt(e,a,s.originValue)})},yr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=le("path");return re(n,{d:"M0,0 L0,0"}),Ne(n).add("djs-snap-line"),we(t,n),{update:function(i){xe(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"})}}},yr.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},yr.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},yr.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},yr.prototype.hide=function(){M(this._snapLines,function(e){e.update()})};const mD={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",yi],resizeSnapping:["type",Ha],snapping:["type",yr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",Wb],createMoveSnapping:["type",ko]};var Jb=300;function Se(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=Qe(Se.INPUT_SELECTOR,this._container),this._resultsContainer=Qe(Se.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}Se.$inject=["canvas","eventBus","selection","translate"],Se.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:bn.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,Se.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,Se.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,Se.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,Se.INPUT_SELECTOR,"keydown",function(n){Nt("ArrowUp",n)&&n.preventDefault(),Nt("ArrowDown",n)&&n.preventDefault()}),t(this._container,Se.INPUT_SELECTOR,"keyup",function(n){if(Nt("Escape",n))return e.close();if(Nt("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(Nt("ArrowUp",n))return e._scrollToDirection(!0);if(Nt("ArrowDown",n))return e._scrollToDirection();Nt(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},Se.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){bn.unbind(e.el,e.type,e.listener)})},Se.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=Qe(Se.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},Se.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},Se.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)}},Se.prototype._clearResults=function(){us(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},Se.prototype._getCurrentResult=function(){return Qe(Se.RESULT_SELECTED_SELECTOR,this._resultsContainer)},Se.prototype._createResultNode=function(e,t){var n=st(Se.RESULT_HTML);return e.primaryTokens.length>0&&ex(n,e.primaryTokens,Se.RESULT_PRIMARY_HTML),ex(n,e.secondaryTokens,Se.RESULT_SECONDARY_HTML),nn(n,Se.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},Se.prototype.registerProvider=function(e){this._searchProvider=e},Se.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,ft(this._canvas.getContainer()).add("djs-search-open"),ft(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},Se.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,ft(this._canvas.getContainer()).remove("djs-search-open"),ft(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},Se.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Se.prototype.isOpen=function(){return this._open},Se.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&ft(t).remove(Se.RESULT_SELECTED_CLASS);var n=nn(e,Se.RESULT_ID_ATTRIBUTE),i=this._results[n].element;ft(e).add(Se.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:Jb}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},Se.prototype._select=function(e){var t=nn(e,Se.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:Jb}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},Se.prototype._getBoxHtml=function(){const e=st(Se.BOX_HTML),t=Qe(Se.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function ex(e,t,n){var i=gD(t),r=st(n);r.innerHTML=i,e.appendChild(r)}function gD(e){var t="";return e.forEach(function(n){var i=cv(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+Se.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}Se.CONTAINER_SELECTOR=".djs-search-container",Se.INPUT_SELECTOR=".djs-search-input input",Se.RESULTS_CONTAINER_SELECTOR=".djs-search-results",Se.RESULT_SELECTOR=".djs-search-result",Se.RESULT_SELECTED_CLASS="djs-search-result-selected",Se.RESULT_SELECTED_SELECTOR="."+Se.RESULT_SELECTED_CLASS,Se.RESULT_ID_ATTRIBUTE="data-result-id",Se.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",Se.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>`,Ee.RESULT_HTML='<div class="djs-search-result"></div>',Ee.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',Ee.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const uD={__depends__:[Xo,Ec,zn],searchPad:["type",Ee]};function Af(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}Af.$inject=["elementRegistry","searchPad","canvas","search"],Af.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!Re(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:Dn(i),id:i.id})),e,{keys:["label","id"]}).map(lD)};function lD(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const pD={__depends__:[uD,o_],__init__:["bpmnSearch"],bpmnSearch:["type",Af]},fD="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",dD="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",hD={width:36,height:50},mD={width:50,height:50};function Yb(e,t,n){return pe("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const Yn=5;function su(e,t){this._styles=t,e.registerProvider(this)}su.$inject=["outline","styles"],su.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(j1(e))return n=pe("rect"),re(n,D({x:-Yn,y:-Yn,rx:4,width:e.width+Yn*2,height:e.height+Yn*2},t)),n;if(!Re(e))return y(e,"bpmn:Gateway")?(n=pe("rect"),D(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),re(n,D({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):Ce(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=pe("rect"),re(n,D({x:-Yn,y:-Yn,rx:14,width:e.width+Yn*2,height:e.height+Yn*2},t))):y(e,"bpmn:EndEvent")?(n=pe("circle"),re(n,D({cx:e.width/2,cy:e.height/2,r:e.width/2+Yn+1},t))):y(e,"bpmn:Event")?(n=pe("circle"),re(n,D({cx:e.width/2,cy:e.height/2,r:e.width/2+Yn},t))):y(e,"bpmn:DataObjectReference")&&Kb(e,"bpmn:DataObjectReference")?n=Yb(fD,{x:-6,y:-6},t):y(e,"bpmn:DataStoreReference")&&Kb(e,"bpmn:DataStoreReference")&&(n=Yb(dD,{x:-6,y:-6},t)),n},su.prototype.updateOutline=function(e,t){if(!Re(e))return Ce(e,["bpmn:SubProcess","bpmn:Group"])?(re(t,{width:e.width+Yn*2,height:e.height+Yn*2}),!0):!!Ce(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function Kb(e,t){var n;return t==="bpmn:DataObjectReference"?n=hD:t==="bpmn:DataStoreReference"&&(n=mD),e.width===n.width&&e.height===n.height}const gD={__depends__:[yf],__init__:["outlineProvider"],outlineProvider:["type",su]};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 vi(e){eo.call(this,e)}ie(vi,eo),vi.Viewer=ur,vi.NavigatedViewer=wa,vi.prototype.createDiagram=function(){return this.importXML(vD)},vi.prototype._interactionModules=[cy,ly,dy],vi.prototype._modelingModules=[_M,bc,SM,EM,BM,df,VM,h2,Qg,Qs,y2,x2,B2,j2,F2,W2,ik,ck,$p,mk,wk,Lk,Nk,ub,sD,pD,gD],vi.prototype._modules=[].concat(ur.prototype._modules,vi.prototype._interactionModules,vi.prototype._modelingModules);const yD=((e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n})(wt.defineComponent({__name:"BpmnModelerView",props:{xml:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,r=n,o=wt.ref();let a;async function s(u){if(!a)throw new Error("modeler not mounted");try{const{warnings:l}=await a.importXML(u),p=Mu(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 wt.onMounted(async()=>{a=new vi({container:o.value,moddleExtensions:Ka}),i.xml&&await s(i.xml),r("ready")}),wt.watch(()=>i.xml,u=>{u&&a&&s(u)}),wt.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(u,l)=>(wt.openBlock(),wt.createElementBlock("div",{ref_key:"container",ref:o,class:"bpmn-modeler-view"},null,512))}}),[["__scopeId","data-v-a9b41c97"]]);Q.APPLY_BPMN_OPS_SCHEMA=xx,Q.BPMN_MODDLE_EXTENSIONS=Ka,Q.BWL_MODDLE_SCHEMA=kf,Q.BWL_NS=Mf,Q.BWL_PREFIX=pu,Q.BWL_SIDES=fu,Q.BpmnModelerView=yD,Q.EDITOR=$E,Q.FLOW_LABEL_INDENT=cd,Q.HEADLESS_BPMN_MODULES=Qv,Q.HEADLESS_TEXT_METRICS=Xr,Q.I18N_NS=J0,Q.I18N_PREFIX=nd,Q.LABEL_FORK_MARGIN=Du,Q.MVP_FLOW_NODE_TYPES=yi,Q.SYMBOLIC_OP_KINDS=Lf,Q.SYMBOLIC_OP_SCHEMA=If,Q.UNDO_EPISODE_COMMAND=du,Q.applyBpmnOpBatch=Wd,Q.applyBpmnOps=Hd,Q.approximateTextWidth=Bo,Q.auditBpmnGeometry=md,Q.auditBpmnGeometryXml=dE,Q.auditGeometry=zi,Q.auditTargetsOf=Yr,Q.axisSegmentsOf=_n,Q.buildBpmnOpBatch=BE,Q.buildRegistryIndex=vd,Q.containerBoundarySegments=Ou,Q.createBpmnEditorController=jE,Q.createBpmnModdle=id,Q.createHeadlessBpmnModeler=oT,Q.crossedShapesOf=Hi,Q.crossingCost=No,Q.describeProcess=Gd,Q.describeProcessXml=NE,Q.edgeCrossCount=es,Q.edgeCrossingPairsOf=Lu,Q.executeAsUndoEpisode=Of,Q.forwardThreePointCandidates=xd,Q.geometryFindingKey=Fi,Q.installHeadlessBpmnDom=$d,Q.isMvpFlowNodeType=Tf,Q.labelRectsOf=Iu,Q.lineCrossesLabel=Io,Q.lineThroughLabel=pd,Q.loadBpmnXml=Tu,Q.lowerOps=Fd,Q.oppositeOverlapCount=iE,Q.oppositeOverlapOf=sd,Q.planCrossPoolRoute=Cd,Q.planEdgeRepair=wd,Q.planLabelLineClearance=Dd,Q.planLabelPlacement=kd,Q.planMiddleSegmentShifts=bd,Q.planOppositeOverlapRepair=Td,Q.planSegmentDetours=_d,Q.repairIntroducedCrossings=Sd,Q.repairIntroducedLabelLines=Od,Q.repairIntroducedOppositeOverlaps=Md,Q.repairIntroducedSharedSegmentLabels=Ld,Q.rerouteIntroducedCrossPoolEdges=Pd,Q.resolverServicesOf=jd,Q.saveBpmnXml=eE,Q.sceneCrossingCost=dd,Q.sceneFromDefinitions=hd,Q.sceneFromRegistry=Tn,Q.sharedSegmentUnderLabel=Ja,Q.sharedSpansOf=Qa,Q.unreadableOverlapCount=ku,Q.unreadableOverlapOf=Za,Q.validateOps=Bd,Q.warningMessages=Mu,Object.defineProperty(Q,Symbol.toStringTag,{value:"Module"})}));
343
+ </div>`,Se.RESULT_HTML='<div class="djs-search-result"></div>',Se.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',Se.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const yD={__depends__:[Jo,Pc,zn],searchPad:["type",Se]};function kf(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}kf.$inject=["elementRegistry","searchPad","canvas","search"],kf.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:On(i),id:i.id})),e,{keys:["label","id"]}).map(vD)};function vD(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const _D={__depends__:[yD,f_],__init__:["bpmnSearch"],bpmnSearch:["type",kf]},bD="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",xD="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",ED={width:36,height:50},wD={width:50,height:50};function tx(e,t,n){return le("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const Yn=5;function fu(e,t){this._styles=t,e.registerProvider(this)}fu.$inject=["outline","styles"],fu.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(q1(e))return n=le("rect"),re(n,D({x:-Yn,y:-Yn,rx:4,width:e.width+Yn*2,height:e.height+Yn*2},t)),n;if(!Me(e))return v(e,"bpmn:Gateway")?(n=le("rect"),D(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),re(n,D({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):ke(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=le("rect"),re(n,D({x:-Yn,y:-Yn,rx:14,width:e.width+Yn*2,height:e.height+Yn*2},t))):v(e,"bpmn:EndEvent")?(n=le("circle"),re(n,D({cx:e.width/2,cy:e.height/2,r:e.width/2+Yn+1},t))):v(e,"bpmn:Event")?(n=le("circle"),re(n,D({cx:e.width/2,cy:e.height/2,r:e.width/2+Yn},t))):v(e,"bpmn:DataObjectReference")&&nx(e,"bpmn:DataObjectReference")?n=tx(bD,{x:-6,y:-6},t):v(e,"bpmn:DataStoreReference")&&nx(e,"bpmn:DataStoreReference")&&(n=tx(xD,{x:-6,y:-6},t)),n},fu.prototype.updateOutline=function(e,t){if(!Me(e))return ke(e,["bpmn:SubProcess","bpmn:Group"])?(re(t,{width:e.width+Yn*2,height:e.height+Yn*2}),!0):!!ke(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function nx(e,t){var n;return t==="bpmn:DataObjectReference"?n=ED:t==="bpmn:DataStoreReference"&&(n=wD),e.width===n.width&&e.height===n.height}const SD={__depends__:[xf],__init__:["outlineProvider"],outlineProvider:["type",fu]};var RD='<?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 vi(e){no.call(this,e)}ie(vi,no),vi.Viewer=lr,vi.NavigatedViewer=Ca,vi.prototype.createDiagram=function(){return this.importXML(RD)},vi.prototype._interactionModules=[mv,yv,bv],vi.prototype._modelingModules=[PM,Rc,DM,MM,WM,gf,ZM,E2,oy,ic,C2,T2,W2,q2,Y2,J2,pk,gk,Hp,wk,kk,zk,Gk,gb,mD,_D,SD],vi.prototype._modules=[].concat(lr.prototype._modules,vi.prototype._interactionModules,vi.prototype._modelingModules);const CD=((e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n})(St.defineComponent({__name:"BpmnModelerView",props:{xml:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,r=n,o=St.ref();let a;async function s(u){if(!a)throw new Error("modeler not mounted");try{const{warnings:l}=await a.importXML(u),p=Iu(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 St.onMounted(async()=>{a=new vi({container:o.value,moddleExtensions:Za}),i.xml&&await s(i.xml),r("ready")}),St.watch(()=>i.xml,u=>{u&&a&&s(u)}),St.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(u,l)=>(St.openBlock(),St.createElementBlock("div",{ref_key:"container",ref:o,class:"bpmn-modeler-view"},null,512))}}),[["__scopeId","data-v-a9b41c97"]]);Q.APPLY_BPMN_OPS_SCHEMA=Tx,Q.BPMN_MODDLE_EXTENSIONS=Za,Q.BWL_MODDLE_SCHEMA=If,Q.BWL_NS=Lf,Q.BWL_PREFIX=gu,Q.BWL_SIDES=yu,Q.BpmnModelerView=CD,Q.EDITOR=UE,Q.FLOW_LABEL_INDENT=fd,Q.HEADLESS_BPMN_MODULES=ov,Q.HEADLESS_TEXT_METRICS=Qr,Q.I18N_NS=sE,Q.I18N_PREFIX=ad,Q.LABEL_FORK_MARGIN=Nu,Q.MVP_FLOW_NODE_TYPES=_i,Q.SYMBOLIC_OP_KINDS=$f,Q.SYMBOLIC_OP_SCHEMA=jf,Q.UNDO_EPISODE_COMMAND=vu,Q.applyBpmnOpBatch=Qd,Q.applyBpmnOps=Yd,Q.approximateTextWidth=Fo,Q.auditBpmnGeometry=_d,Q.auditBpmnGeometryXml=xE,Q.auditGeometry=Vi,Q.auditTargetsOf=zi,Q.axisSegmentsOf=_n,Q.buildBpmnOpBatch=WE,Q.buildRegistryIndex=xd,Q.containerBoundarySegments=Bu,Q.createBpmnEditorController=qE,Q.createBpmnModdle=sd,Q.createHeadlessBpmnModeler=dT,Q.crossedShapesOf=ri,Q.crossingCost=wr,Q.describeProcess=Zd,Q.describeProcessXml=GE,Q.edgeCrossCount=ns,Q.edgeCrossingPairsOf=$u,Q.executeAsUndoEpisode=Bf,Q.forwardThreePointCandidates=Rd,Q.geometryFindingKey=Hi,Q.installHeadlessBpmnDom=Wd,Q.isMvpFlowNodeType=Of,Q.labelRectsOf=ju,Q.lineCrossesLabel=jo,Q.lineThroughLabel=md,Q.loadBpmnXml=Lu,Q.lowerOps=qd,Q.oppositeOverlapCount=pE,Q.oppositeOverlapOf=pd,Q.planBackEdgeBoundaryClearance=Ld,Q.planCrossPoolRoute=Md,Q.planEdgeRepair=Pd,Q.planLabelLineClearance=jd,Q.planLabelPlacement=$d,Q.planMiddleSegmentShifts=Sd,Q.planOppositeOverlapRepair=Nd,Q.planSegmentDetours=wd,Q.repairIntroducedBoundaryHugging=Id,Q.repairIntroducedCrossings=Ad,Q.repairIntroducedLabelLines=Fd,Q.repairIntroducedOppositeOverlaps=Bd,Q.repairIntroducedSharedSegmentLabels=Hd,Q.rerouteIntroducedCrossPoolEdges=kd,Q.resolverServicesOf=Ud,Q.saveBpmnXml=cE,Q.sceneCrossingCost=yd,Q.sceneFromDefinitions=vd,Q.sceneFromRegistry=ln,Q.sharedSegmentUnderLabel=ts,Q.sharedSpansOf=es,Q.unreadableOverlapCount=Bo,Q.unreadableOverlapOf=Ja,Q.validateOps=Gd,Q.warningMessages=Iu,Object.defineProperty(Q,Symbol.toStringTag,{value:"Module"})}));