@g1cloud/bpmn-modeler-next 5.0.0-alpha.20 → 5.0.0-alpha.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
(function(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 LD=Object.defineProperty;var ID=(Q,St,Ei)=>St in Q?LD(Q,St,{enumerable:!0,configurable:!0,writable:!0,value:Ei}):Q[St]=Ei;var qr=(Q,St,Ei)=>ID(Q,typeof St!="symbol"?St+"":St,Ei);const Ei=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway"];function Lf(e){return Ei.includes(e)}const If="http://g1project.net/spec/bpmn/bwl/1.0",yu="bwl",vu=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],Nf={name:"bwl-hints",uri:If,prefix:yu,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"}]}]},_u="bwl.undoEpisode",Bf=new WeakSet;function gx(e){Bf.has(e)||(e.register(_u,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),Bf.add(e))}function $f(e,t){gx(e);const n={run:t};if(e.execute(_u,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const jf=["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"],yx={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},vx={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},_x={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},bx={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다.",properties:{id:{type:"string"},type:{type:"string",enum:[...Ei]},name:{type:"string"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},xx={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},Ex={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},wx={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"}},required:["id","source","target"],additionalProperties:!1},Sx={type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},Rx={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},Cx={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},Px={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},Ax={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},Tx={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...vu]},offset:{type:"number"}},required:["anchor","side"],additionalProperties:!1};function tn(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const Mx={"participant.add":tn("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트(생략 시 op 순서가 곧 배치 순서).",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":tn("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":tn("node.add",{description:'플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 갈래 1, 2…) — 위/아래가 아니라 "주 흐름에서 몇 번째 갈래"다. 행 배치(어느 갈래가 위/아래인지)는 호스트가 정한다(대칭·메시지 방향). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.',properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer"}},required:["node"]}),"node.update":tn("node.update",{description:"노드 이름/레인/타입 갱신. lane = 레인 재배정(이동), type = 태스크·이벤트 타입 전환.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lane:{type:"string"},type:{type:"string",enum:[...Ei]}},required:["id"]}),"sequenceFlow.add":tn("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":tn("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":tn("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":tn("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataStore.add":tn("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":tn("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataAssociation.add":tn("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":tn("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":tn("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":tn("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":tn("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":tn("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"element.remove":tn("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},Ff={anyOf:jf.map(e=>Mx[e])},kx={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:vx,irParticipant:_x,irNode:bx,irFlowCondition:xx,irSequenceFlow:Ex,irMessageFlow:wx,irDataStore:Sx,irDataAssociation:Rx,irTextAnnotation:Cx,irAssociation:Px,irGroup:Ax,bwlPlacement:Tx,nullableString:yx,symbolicOp:Ff}};function bu(e){return Array.prototype.concat.apply([],e)}const Bo=Object.prototype.toString,Dx=Object.prototype.hasOwnProperty;function xr(e){return e===void 0}function Ot(e){return e!==void 0}function Yr(e){return e==null}function ge(e){return Bo.call(e)==="[object Array]"}function Ht(e){return Bo.call(e)==="[object Object]"}function xe(e){return Bo.call(e)==="[object Number]"}function zt(e){const t=Bo.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function vn(e){return Bo.call(e)==="[object String]"}function Ox(e){if(!ge(e))throw new Error("must supply array")}function _n(e,t){return!Yr(e)&&Dx.call(e,t)}function at(e,t){const n=Ya(t);let i;return M(e,function(r,o){if(n(r,o))return i=r,!1}),i}function Hf(e,t){const n=Ya(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=Ya(t);let i=[];return M(e,function(r,o){n(r,o)&&i.push(r)}),i}function M(e,t){let n,i;if(xr(e))return;const r=ge(e)?$x:Bx;for(let o in e)if(_n(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function Lx(e,t){if(xr(e))return[];Ox(e);const n=Ya(t);return e.filter(function(i,r){return!n(i,r)})}function bn(e,t,n){return M(e,function(i,r){n=t(n,i,r)}),n}function Er(e,t){return!!bn(e,function(n,i,r){return n&&t(i,r)},!0)}function Fi(e,t){return!!at(e,t)}function nn(e,t){let n=[];return M(e,function(i,r){n.push(t(i,r))}),n}function qa(e){return e&&Object.keys(e)||[]}function Ix(e){return qa(e).length}function Kr(e){return nn(e,t=>t)}function Xr(e,t,n={}){return t=xu(t),M(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function zf(e,...t){e=xu(e);let n={};return M(t,r=>Xr(r,e,n)),nn(n,function(r,o){return r[0]})}const Nx=zf;function ri(e,t){t=xu(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)}),nn(n,i=>i.v)}function Zr(e){return function(t){return Er(e,function(n,i){return t[i]===n})}}function xu(e){return zt(e)?e:t=>t[e]}function Ya(e){return zt(e)?e:t=>t===e}function Bx(e){return e}function $x(e){return Number(e)}function Eu(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 mn(e,t){return e.bind(t)}function D(e,...t){return Object.assign(e,...t)}function jx(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)&&Yr(s)&&(s=i[r]=isNaN(+a)?{}:[]),xr(a)?xr(n)?delete i[r]:i[r]=n:i=s}),e}function Jn(e,t){let n={},i=Object(e);return M(t,function(r){r in i&&(n[r]=e[r])}),n}function oi(e,t){let n={},i=Object(e);return M(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function wu(){}wu.prototype.get=function(e){return this.$model.properties.get(this,e)},wu.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function Vf(e,t){this.model=e,this.properties=t}Vf.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(wu.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,mn(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 Fx=D(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),Gf=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 Su(e,t){var n=Gf[e];return n?n(t):t}function Ru(e){return!!Fx[e]}function Wf(e){return!!Gf[e]}function rn(e,t){var n=e.split(/:/),i,r;if(n.length===1)i=e,r=t;else if(n.length===2)i=n[1],r=n[0];else throw new Error("expected <prefix:localName> or <localName>, got "+e);return e=(r?r+":":"")+i,{name:e,prefix:r,localName:i}}function Dn(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}Dn.prototype.build=function(){return Jn(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},Dn.prototype.addProperty=function(e,t,n){typeof t=="boolean"&&(n=t,t=void 0),this.addNamedProperty(e,n!==!1);var i=this.properties;t!==void 0?i.splice(t,0,e):i.push(e)},Dn.prototype.replaceProperty=function(e,t,n){var i=e.ns,r=this.properties,o=this.propertiesByName,a=e.name!==t.name;if(e.isId){if(!t.isId)throw new Error("property <"+t.ns.name+"> must be id property to refine <"+e.ns.name+">");this.setIdProperty(t,!1)}if(e.isBody){if(!t.isBody)throw new Error("property <"+t.ns.name+"> must be body property to refine <"+e.ns.name+">");this.setBodyProperty(t,!1)}var s=r.indexOf(e);if(s===-1)throw new Error("property <"+i.name+"> not found in property list");r.splice(s,1),this.addProperty(t,n?void 0:s,a),o[i.name]=o[i.localName]=t},Dn.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=rn(r[0],i),a=rn(r[1],o.prefix).name,s=this.propertiesByName[a];if(s)this.replaceProperty(s,e,n);else throw new Error("refined property <"+a+"> not found");delete e.redefines},Dn.prototype.addNamedProperty=function(e,t){var n=e.ns,i=this.propertiesByName;t&&(this.assertNotDefined(e,n.name),this.assertNotDefined(e,n.localName)),i[n.name]=i[n.localName]=e},Dn.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},Dn.prototype.setBodyProperty=function(e,t){if(t&&this.bodyProperty)throw new Error("body property defined multiple times (<"+this.bodyProperty.ns.name+">, <"+e.ns.name+">)");this.bodyProperty=e},Dn.prototype.setIdProperty=function(e,t){if(t&&this.idProperty)throw new Error("id property defined multiple times (<"+this.idProperty.ns.name+">, <"+e.ns.name+">)");this.idProperty=e},Dn.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},Dn.prototype.assertNotDefined=function(e,t){var n=e.name,i=this.propertiesByName[n];if(i)throw new Error("property <"+n+"> already defined; override of <"+i.definedBy.ns.name+"#"+i.ns.name+"> by <"+e.definedBy.ns.name+"#"+e.ns.name+"> not allowed without redefines")},Dn.prototype.hasProperty=function(e){return this.propertiesByName[e]},Dn.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(M(e.properties,mn(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 Hi(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,M(e,mn(this.registerPackage,this))}Hi.prototype.getPackage=function(e){return this.packageMap[e]},Hi.prototype.getPackages=function(){return this.packages},Hi.prototype.registerPackage=function(e){e=D({},e);var t=this.packageMap;Uf(t,e,"prefix"),Uf(t,e,"uri"),M(e.types,mn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Hi.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=rn(e.name,t.prefix),i=n.name,r=Object.create(null);M(e.properties,mn(function(o){var a=rn(o.name,n.prefix),s=a.name;Ru(o.type)||(o.type=rn(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,mn(function(o){var a=rn(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},Hi.prototype.mapTypes=function(e,t,n){var i=Ru(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,u){var l=rn(c,Ru(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)},Hi.prototype.getEffectiveDescriptor=function(e){var t=rn(e),n=new Dn(t);this.mapTypes(t,function(r,o){n.addTrait(r,o)});var i=n.build();return this.definePackage(i,i.allTypes[i.allTypes.length-1].$pkg),i},Hi.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function Uf(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function wr(e){this.model=e}wr.prototype.set=function(e,t,n){if(!vn(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;Hx(n)?i?delete e[r]:delete e.$attrs[Cu(t)]:i?r in e?e[r]=n:qf(e,i,n):e.$attrs[Cu(t)]=n},wr.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[Cu(t)];var i=n.name;return!e[i]&&n.isMany&&qf(e,n,[]),e[i]},wr.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)},wr.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},wr.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},wr.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 Hx(e){return typeof e>"u"}function qf(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Cu(e){return e.replace(/^:/,"")}function $n(e,t={}){this.properties=new wr(this),this.factory=new Vf(this,this.properties),this.registry=new Hi(e,this.properties),this.typeCache=Object.create(null),this.config=t}$n.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},$n.prototype.getType=function(e){var t=this.typeCache,n=vn(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},$n.prototype.createAny=function(e,t,n){var i=rn(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){jx(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){Ht(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},$n.prototype.getPackage=function(e){return this.registry.getPackage(e)},$n.prototype.getPackages=function(){return this.registry.getPackages()},$n.prototype.getElementDescriptor=function(e){return e.$descriptor},$n.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},$n.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},$n.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var Yf=String.fromCharCode,zx=Object.prototype.hasOwnProperty,Vx=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,$o={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys($o).forEach(function(e){$o[e.toUpperCase()]=$o[e]});function Gx(e,t,n,i){return i?zx.call($o,i)?$o[i]:"&"+i+";":Yf(t||parseInt(n,16))}function Sr(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(Vx,Gx):e}var Kf="non-whitespace outside of root node";function zi(e){return new Error(e)}function Wx(e){return"missing namespace for prefix <"+e+">"}function Ka(e){return{get:e,enumerable:!0}}function Ux(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var Xf=Symbol("nameCache");function Pu(e){return e+"$uri"}function qx(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[Pu(i)]=n;return t}function Xa(){return{line:0,column:0}}function Yx(e){throw e}function Zf(e){if(!this)return new Zf(e);var t=e&&e.proxy,n,i,r,o,a=Yx,s,c,u,l,p=Xa,f=!1,d=!1,h="",m=!1,g=!1,R=null,E=!1,x,b,w,T;function L(N){N instanceof Error||(N=zi(N)),R=N,a(N,p)}function A(N){s&&(N instanceof Error||(N=zi(N)),s(N,p))}this.on=function(N,z){if(typeof z!="function")throw zi("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 zi("unsupported event: "+N)}return this},this.ns=function(N){if(typeof N>"u"&&(N={}),typeof N!="object")throw zi("required args <nsMap={}>");var z=Object.create(null),ue;for(ue in N)z[ue]=N[ue];return g=!0,T=z,this};function F(){x=g?[]:null,b=g?qx(T):null,w=[],p=Xa,E=!1,R=null,d=!1,h=""}this.parse=function(N){if(typeof N!="string")throw zi("required args <xml=string>");if(f)throw zi("parse during stream; call end() first");return F(),H(N),p=Xa,E=!1,R},this.write=function(N){if(typeof N!="string")throw zi("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=Xa,E=!1,R},this.stop=function(){E=!0};function H(N,z=!1){var ue=null,je=null,tt,X=0,se=!1,fe=!1,oe=0,de=0,ee,$,B,U,Ae,wt,C,_,y,k="",I=0,W;function ae(nt,kt){var Ut=nt.indexOf(":");if(Ut===-1)return nt;var cn=b[nt.substring(0,Ut)];return cn?kt===cn?nt.substr(Ut+1):cn+nt.substr(Ut):(A(Wx(nt.substring(0,Ut))),null)}function Te(){if(W!==null)return W;var nt,kt,Ut=g&&b.xmlns,cn=g&&m?[]:null,ct=I,$t=k,jt=$t.length,Wr,Mn,ni,Nn,Dt,ii={},No=new Set,kn,Ue,Ye;e:for(;ct<jt;ct++)if(kn=!1,Ue=$t.charCodeAt(ct),!(Ue===32||Ue<14&&Ue>8)){for((Ue<65||Ue>122||Ue>90&&Ue<97)&&Ue!==95&&Ue!==58&&(A("illegal first char attribute name"),kn=!0),Ye=ct+1;Ye<jt;Ye++)if(Ue=$t.charCodeAt(Ye),!(Ue>96&&Ue<123||Ue>64&&Ue<91||Ue>47&&Ue<59||Ue===46||Ue===45||Ue===95)){if(Ue===32||Ue<14&&Ue>8){A("missing attribute value"),ct=Ye;continue e}if(Ue===61)break;A("illegal attribute name char"),kn=!0}if(Dt=$t.substring(ct,Ye),Dt==="xmlns:xmlns"&&(A("illegal declaration of xmlns"),kn=!0),Ue=$t.charCodeAt(Ye+1),Ue===34)Ye=$t.indexOf('"',ct=Ye+2),Ye===-1&&(Ye=$t.indexOf("'",ct),Ye!==-1&&(A("attribute value quote missmatch"),kn=!0));else if(Ue===39)Ye=$t.indexOf("'",ct=Ye+2),Ye===-1&&(Ye=$t.indexOf('"',ct),Ye!==-1&&(A("attribute value quote missmatch"),kn=!0));else for(A("missing attribute value quotes"),kn=!0,Ye=Ye+1;Ye<jt&&(Ue=$t.charCodeAt(Ye+1),!(Ue===32||Ue<14&&Ue>8));Ye++);for(Ye===-1&&(A("missing closing quotes"),Ye=jt,kn=!0),kn||(ni=$t.substring(ct,Ye)),ct=Ye;Ye+1<jt&&(Ue=$t.charCodeAt(Ye+1),!(Ue===32||Ue<14&&Ue>8));Ye++)ct===Ye&&(A("illegal character after attribute end"),kn=!0);if(ct=Ye+1,kn)continue e;if(No.has(Dt)){A("attribute <"+Dt+"> already defined");continue}if(No.add(Dt),!g){ii[Dt]=ni;continue}if(m){if(Mn=Dt==="xmlns"?"xmlns":Dt.charCodeAt(0)===120&&Dt.substr(0,6)==="xmlns:"?Dt.substr(6):null,Mn!==null){if(nt=Sr(ni),kt=Pu(Mn),Nn=T[nt],!Nn){if(Mn==="xmlns"||kt in b&&b[kt]!==nt)do Nn="ns"+X++;while(typeof b[Nn]<"u");else Nn=Mn;T[nt]=Nn}b[Mn]!==Nn&&(Wr||(b=Ux(b),Wr=!0),b[Mn]=Nn,Mn==="xmlns"&&(b[Pu(Nn)]=nt,Ut=Nn),b[kt]=nt),ii[Dt]=ni;continue}cn.push(Dt,ni);continue}Dt=ae(Dt,Ut),Dt!==null&&(ii[Dt]=ni)}if(m)for(ct=0,jt=cn.length;ct<jt;ct++)Dt=ae(cn[ct++],Ut),ni=cn[ct],Dt!==null&&(ii[Dt]=ni);return W=ii}function He(){for(var nt=/(\r\n|\r|\n)/g,kt=0,Ut=0,cn=0,ct=de,$t,jt;oe>=cn&&($t=nt.exec(N),!(!$t||(ct=$t[0].length+$t.index,ct>oe)));)kt+=1,cn=ct;return oe==-1?(Ut=ct,jt=N.substring(de)):de===0?jt=N.substring(de,oe):(Ut=oe-cn,jt=de==-1?N.substring(oe):N.substring(oe,de+1)),{data:jt,line:kt,column:Ut}}for(p=He,t&&(y=Object.create({},{name:Ka(function(){return C}),originalName:Ka(function(){return _}),attrs:Ka(Te),ns:Ka(function(){return b})}));de!==-1;){if(N.charCodeAt(de)===60?oe=de:oe=N.indexOf("<",de),oe===-1){if(z)return N.substring(de);if(w.length)return L("unexpected end of file");if(!d)return L("missing start tag");de<N.length&&N.substring(de).trim()&&A(Kf);return}if(d||(d=!0),de!==oe){if(w.length){if(n&&(n(N.substring(de,oe),Sr,p),E))return}else if(N.substring(de,oe).trim()&&(A(Kf),E))return}if(U=N.charCodeAt(oe+1),U===33){if(B=N.charCodeAt(oe+2),B===91&&N.substr(oe+3,6)==="CDATA["){if(de=N.indexOf("]]>",oe),de===-1)return z?N.substring(oe):L("unclosed cdata");if(o&&(o(N.substring(oe+9,de),p),E))return;de+=3;continue}if(B===45&&N.charCodeAt(oe+3)===45){if(de=N.indexOf("-->",oe),de===-1)return z?N.substring(oe):L("unclosed comment");if(c&&(c(N.substring(oe+4,de),Sr,p),E))return;de+=3;continue}}if(U===63){if(de=N.indexOf("?>",oe),de===-1)return z?N.substring(oe):L("unclosed question");if(u&&(u(N.substring(oe,de+2),p),E))return;de+=2;continue}for(ee=oe+1;;ee++){if(Ae=N.charCodeAt(ee),isNaN(Ae))return z?N.substring(oe):(de=-1,L("unclosed tag"));if(Ae===34)B=N.indexOf('"',ee+1),ee=B!==-1?B:ee;else if(Ae===39)B=N.indexOf("'",ee+1),ee=B!==-1?B:ee;else if(Ae===62){de=ee;break}}if(U===33){if(l&&(l(N.substring(oe,de+1),Sr,p),E))return;de+=1;continue}if(W={},U===47){if(se=!1,fe=!0,!w.length)return L("missing open tag");if(ee=C=w.pop(),B=oe+2+ee.length,N.substring(oe+2,B)!==ee)return L("closing tag mismatch");for(;B<de;B++)if(U=N.charCodeAt(B),!(U===32||U>8&&U<14))return L("close tag")}else{if(N.charCodeAt(de-1)===47?(ee=C=N.substring(oe+1,de-1),se=!0,fe=!0):(ee=C=N.substring(oe+1,de),se=!0,fe=!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")}fe||w.push(C)}if(g){tt=b,se&&(fe||x.push(tt),W===null&&(m=ee.indexOf("xmlns",B)!==-1)&&(I=B,k=ee,Te(),m=!1)),_=C,je!==b&&(ue=b[Xf],ue===void 0&&(ue=b[Xf]=Object.create(null)),je=b);var bt=ue[C];if(bt!==void 0)C=bt;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),ue[_]=C}}if(se&&(I=B,k=ee,i&&(t?i(y,Sr,fe,p):i(C,Te,Sr,fe,p),E)))return;if(fe){if(r&&(r(t?y:C,Sr,se,p),E))return;g&&(se?b=tt:b=x.pop())}de+=1}}}function Qf(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var Au={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},Jf="property";function ed(e){return e.xml&&e.xml.serialize}function Kx(e){const t=ed(e);return t!==Jf&&(t||null)}function Xx(e){return e.charAt(0).toUpperCase()+e.slice(1)}function td(e,t){return Qf(t)?e.prefix+":"+Xx(e.localName):e.name}function Zx(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 Qx(e,t,n){const i=rn(e,t.xmlns),r=`${t[i.prefix]||i.prefix}:${i.localName}`,o=rn(r);var a=n.getPackage(o.prefix);return Zx(o,a)}function Vi(e){return new Error(e)}function wi(e){return e.$descriptor}function Jx(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 Vi("expected element");var n=this.elementsById,i=wi(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 Vi("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function jo(){}jo.prototype.handleEnd=function(){},jo.prototype.handleText=function(){},jo.prototype.handleNode=function(){};function Tu(){}Tu.prototype=Object.create(jo.prototype),Tu.prototype.handleNode=function(){return this};function Qr(){}Qr.prototype=Object.create(jo.prototype),Qr.prototype.handleText=function(e){this.body=(this.body||"")+e};function Fo(e,t){this.property=e,this.context=t}Fo.prototype=Object.create(Qr.prototype),Fo.prototype.handleNode=function(e){if(this.element)throw Vi("expected no sub nodes");return this.element=this.createReference(e),this},Fo.prototype.handleEnd=function(){this.element.id=this.body},Fo.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function Mu(e,t){this.element=t,this.propertyDesc=e}Mu.prototype=Object.create(Qr.prototype),Mu.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Su(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function Za(){}Za.prototype=Object.create(Qr.prototype),Za.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 ln(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}ln.prototype=Object.create(Za.prototype),ln.prototype.addReference=function(e){this.context.addReference(e)},ln.prototype.handleText=function(e){var t=this.element,n=wi(t),i=n.bodyProperty;if(!i)throw Vi("unexpected body text <"+e+">");Qr.prototype.handleText.call(this,e)},ln.prototype.handleEnd=function(){var e=this.body,t=this.element,n=wi(t),i=n.bodyProperty;i&&e!==void 0&&(e=Su(i.type,e),t.set(i.name,e))},ln.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=wi(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=Su(l.type,c):u==="xmlns"?u=":"+u:(s=rn(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},ln.prototype.getPropertyForNode=function(e){var t=e.name,n=rn(t),i=this.type,r=this.model,o=wi(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const u=Kx(s);if(u){const l=e.attributes[u];if(l){const p=Qx(l,e.ns,r),f=r.getType(p);return D({},s,{effectiveType:wi(f).name})}}return s}var c=r.getPackage(n.prefix);if(c){const u=td(n,c),l=r.getType(u);if(s=at(o.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&l.hasType(p.type)}),s)return D({},s,{effectiveType:wi(l).name})}else if(s=at(o.properties,function(u){return!u.isReference&&!u.isAttribute&&u.type==="Element"}),s)return s;throw Vi("unrecognized element <"+n.name+">")},ln.prototype.toString=function(){return"ElementDescriptor["+wi(this.type).name+"]"},ln.prototype.valueHandler=function(e,t){return new Mu(e,t)},ln.prototype.referenceHandler=function(e){return new Fo(e,this.context)},ln.prototype.handler=function(e){return e==="Element"?new Jr(this.model,e,this.context):new ln(this.model,e,this.context)},ln.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,Wf(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 ku(e,t,n){ln.call(this,e,t,n)}ku.prototype=Object.create(ln.prototype),ku.prototype.createElement=function(e){var t=e.name,n=rn(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&td(n,o)||t;if(!r.hasType(a))throw Vi("unexpected element <"+e.originalName+">");return ln.prototype.createElement.call(this,e)};function Jr(e,t,n){this.model=e,this.context=n}Jr.prototype=Object.create(Za.prototype),Jr.prototype.createElement=function(e){var t=e.name,n=rn(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},Jr.prototype.handleChild=function(e){var t=new Jr(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},Jr.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function Du(e){e instanceof $n&&(e={model:e}),D(this,{lax:!1},e)}Du.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof ln?(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 Jx(D({},t,{rootHandler:i})),s=new Zf({proxy:!0}),c=e0();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
|
|
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 BD=Object.defineProperty;var $D=(Q,St,wi)=>St in Q?BD(Q,St,{enumerable:!0,configurable:!0,writable:!0,value:wi}):Q[St]=wi;var Kr=(Q,St,wi)=>$D(Q,typeof St!="symbol"?St+"":St,wi);const wi=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway"];function Lf(e){return wi.includes(e)}const If="http://g1project.net/spec/bpmn/bwl/1.0",_u="bwl",bu=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],Nf={name:"bwl-hints",uri:If,prefix:_u,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"}]}]},xu="bwl.undoEpisode",Bf=new WeakSet;function _x(e){Bf.has(e)||(e.register(xu,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),Bf.add(e))}function $f(e,t){_x(e);const n={run:t};if(e.execute(xu,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const jf=["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"],bx={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},xx={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},Ex={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},wx={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다.",properties:{id:{type:"string"},type:{type:"string",enum:[...wi]},name:{type:"string"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},Sx={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},Rx={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},Cx={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"}},required:["id","source","target"],additionalProperties:!1},Px={type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},Ax={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},Tx={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},Mx={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},kx={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},Dx={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...bu]},offset:{type:"number"}},required:["anchor","side"],additionalProperties:!1};function nn(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const Ox={"participant.add":nn("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트(생략 시 op 순서가 곧 배치 순서).",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":nn("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":nn("node.add",{description:'플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 갈래 1, 2…) — 위/아래가 아니라 "주 흐름에서 몇 번째 갈래"다. 행 배치(어느 갈래가 위/아래인지)는 호스트가 정한다(대칭·메시지 방향). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.',properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer"}},required:["node"]}),"node.update":nn("node.update",{description:"노드 이름/레인/타입 갱신. lane = 레인 재배정(이동), type = 태스크·이벤트 타입 전환.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lane:{type:"string"},type:{type:"string",enum:[...wi]}},required:["id"]}),"sequenceFlow.add":nn("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":nn("sequenceFlow.update",{description:"시퀀스 플로우 이름/조건/끝점 갱신. condition: null = 조건 제거. source/target = 끝점 재배선 — 중간 삽입은 기존 플로우를 지우지 말고 이것으로 한쪽 끝을 옮긴 뒤 새 플로우를 추가한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},condition:{description:"생략 = 보존, null = 제거.",anyOf:[{$ref:"#/$defs/irFlowCondition"},{type:"null"}]},source:{description:"새 출발 노드 id(생략 = 보존). 같은 배치에서 추가한 노드도 지목할 수 있다.",type:"string"},target:{description:"새 도착 노드 id(생략 = 보존). 같은 배치에서 추가한 노드도 지목할 수 있다.",type:"string"}},required:["id"]}),"messageFlow.add":nn("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":nn("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataStore.add":nn("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":nn("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataAssociation.add":nn("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":nn("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":nn("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":nn("annotation.update",{description:"주석 본문/방위 힌트 갱신. placement: null = 힌트 제거(휴리스틱 복귀). 주석 삭제는 element.remove.",properties:{id:{type:"string"},text:{type:"string"},placement:{description:"생략 = 보존, null = 힌트 제거.",anyOf:[{$ref:"#/$defs/bwlPlacement"},{type:"null"}]}},required:["id"]}),"group.add":nn("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":nn("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"element.remove":nn("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},Ff={anyOf:jf.map(e=>Ox[e])},Lx={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:xx,irParticipant:Ex,irNode:wx,irFlowCondition:Sx,irSequenceFlow:Rx,irMessageFlow:Cx,irDataStore:Px,irDataAssociation:Ax,irTextAnnotation:Tx,irAssociation:Mx,irGroup:kx,bwlPlacement:Dx,nullableString:bx,symbolicOp:Ff}};function Eu(e){return Array.prototype.concat.apply([],e)}const $o=Object.prototype.toString,Ix=Object.prototype.hasOwnProperty;function wr(e){return e===void 0}function Lt(e){return e!==void 0}function Xr(e){return e==null}function ge(e){return $o.call(e)==="[object Array]"}function zt(e){return $o.call(e)==="[object Object]"}function xe(e){return $o.call(e)==="[object Number]"}function Vt(e){const t=$o.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function _n(e){return $o.call(e)==="[object String]"}function Nx(e){if(!ge(e))throw new Error("must supply array")}function bn(e,t){return!Xr(e)&&Ix.call(e,t)}function at(e,t){const n=Ka(t);let i;return M(e,function(r,o){if(n(r,o))return i=r,!1}),i}function Hf(e,t){const n=Ka(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=Ka(t);let i=[];return M(e,function(r,o){n(r,o)&&i.push(r)}),i}function M(e,t){let n,i;if(wr(e))return;const r=ge(e)?Hx:Fx;for(let o in e)if(bn(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function Bx(e,t){if(wr(e))return[];Nx(e);const n=Ka(t);return e.filter(function(i,r){return!n(i,r)})}function xn(e,t,n){return M(e,function(i,r){n=t(n,i,r)}),n}function Sr(e,t){return!!xn(e,function(n,i,r){return n&&t(i,r)},!0)}function zi(e,t){return!!at(e,t)}function rn(e,t){let n=[];return M(e,function(i,r){n.push(t(i,r))}),n}function Ya(e){return e&&Object.keys(e)||[]}function $x(e){return Ya(e).length}function Zr(e){return rn(e,t=>t)}function Qr(e,t,n={}){return t=wu(t),M(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function zf(e,...t){e=wu(e);let n={};return M(t,r=>Qr(r,e,n)),rn(n,function(r,o){return r[0]})}const jx=zf;function oi(e,t){t=wu(t);let n=[];return M(e,function(i,r){let o=t(i,r),a={d:o,v:i};for(var s=0;s<n.length;s++){let{d:c}=n[s];if(o<c){n.splice(s,0,a);return}}n.push(a)}),rn(n,i=>i.v)}function Jr(e){return function(t){return Sr(e,function(n,i){return t[i]===n})}}function wu(e){return Vt(e)?e:t=>t[e]}function Ka(e){return Vt(e)?e:t=>t===e}function Fx(e){return e}function Hx(e){return Number(e)}function Su(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 gn(e,t){return e.bind(t)}function D(e,...t){return Object.assign(e,...t)}function zx(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];Lt(a)&&Xr(s)&&(s=i[r]=isNaN(+a)?{}:[]),wr(a)?wr(n)?delete i[r]:i[r]=n:i=s}),e}function ei(e,t){let n={},i=Object(e);return M(t,function(r){r in i&&(n[r]=e[r])}),n}function ai(e,t){let n={},i=Object(e);return M(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function Ru(){}Ru.prototype.get=function(e){return this.$model.properties.get(this,e)},Ru.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function Vf(e,t){this.model=e,this.properties=t}Vf.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Ru.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,gn(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 Vx=D(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),Gf=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 Cu(e,t){var n=Gf[e];return n?n(t):t}function Pu(e){return!!Vx[e]}function Wf(e){return!!Gf[e]}function on(e,t){var n=e.split(/:/),i,r;if(n.length===1)i=e,r=t;else if(n.length===2)i=n[1],r=n[0];else throw new Error("expected <prefix:localName> or <localName>, got "+e);return e=(r?r+":":"")+i,{name:e,prefix:r,localName:i}}function On(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}On.prototype.build=function(){return ei(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},On.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)},On.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},On.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=on(r[0],i),a=on(r[1],o.prefix).name,s=this.propertiesByName[a];if(s)this.replaceProperty(s,e,n);else throw new Error("refined property <"+a+"> not found");delete e.redefines},On.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},On.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},On.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},On.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},On.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},On.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")},On.prototype.hasProperty=function(e){return this.propertiesByName[e]},On.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,gn(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 Vi(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,M(e,gn(this.registerPackage,this))}Vi.prototype.getPackage=function(e){return this.packageMap[e]},Vi.prototype.getPackages=function(){return this.packages},Vi.prototype.registerPackage=function(e){e=D({},e);var t=this.packageMap;Uf(t,e,"prefix"),Uf(t,e,"uri"),M(e.types,gn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Vi.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=on(e.name,t.prefix),i=n.name,r=Object.create(null);M(e.properties,gn(function(o){var a=on(o.name,n.prefix),s=a.name;Pu(o.type)||(o.type=on(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,gn(function(o){var a=on(o,n.prefix),s=this.typeMap[a.name];s.traits=s.traits||[],s.traits.push(i)},this)),this.definePackage(e,t),this.typeMap[i]=e},Vi.prototype.mapTypes=function(e,t,n){var i=Pu(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,u){var l=on(c,Pu(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)},Vi.prototype.getEffectiveDescriptor=function(e){var t=on(e),n=new On(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},Vi.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function Uf(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function Rr(e){this.model=e}Rr.prototype.set=function(e,t,n){if(!_n(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;Gx(n)?i?delete e[r]:delete e.$attrs[Au(t)]:i?r in e?e[r]=n:qf(e,i,n):e.$attrs[Au(t)]=n},Rr.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[Au(t)];var i=n.name;return!e[i]&&n.isMany&&qf(e,n,[]),e[i]},Rr.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)},Rr.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Rr.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Rr.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 Gx(e){return typeof e>"u"}function qf(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Au(e){return e.replace(/^:/,"")}function jn(e,t={}){this.properties=new Rr(this),this.factory=new Vf(this,this.properties),this.registry=new Vi(e,this.properties),this.typeCache=Object.create(null),this.config=t}jn.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},jn.prototype.getType=function(e){var t=this.typeCache,n=_n(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},jn.prototype.createAny=function(e,t,n){var i=on(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){zx(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){zt(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},jn.prototype.getPackage=function(e){return this.registry.getPackage(e)},jn.prototype.getPackages=function(){return this.registry.getPackages()},jn.prototype.getElementDescriptor=function(e){return e.$descriptor},jn.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},jn.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},jn.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var Yf=String.fromCharCode,Wx=Object.prototype.hasOwnProperty,Ux=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,jo={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(jo).forEach(function(e){jo[e.toUpperCase()]=jo[e]});function qx(e,t,n,i){return i?Wx.call(jo,i)?jo[i]:"&"+i+";":Yf(t||parseInt(n,16))}function Cr(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(Ux,qx):e}var Kf="non-whitespace outside of root node";function Gi(e){return new Error(e)}function Yx(e){return"missing namespace for prefix <"+e+">"}function Xa(e){return{get:e,enumerable:!0}}function Kx(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var Xf=Symbol("nameCache");function Tu(e){return e+"$uri"}function Xx(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[Tu(i)]=n;return t}function Za(){return{line:0,column:0}}function Zx(e){throw e}function Zf(e){if(!this)return new Zf(e);var t=e&&e.proxy,n,i,r,o,a=Zx,s,c,u,l,p=Za,f=!1,d=!1,h="",m=!1,g=!1,S=null,E=!1,x,b,w,T;function L(N){N instanceof Error||(N=Gi(N)),S=N,a(N,p)}function A(N){s&&(N instanceof Error||(N=Gi(N)),s(N,p))}this.on=function(N,z){if(typeof z!="function")throw Gi("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 Gi("unsupported event: "+N)}return this},this.ns=function(N){if(typeof N>"u"&&(N={}),typeof N!="object")throw Gi("required args <nsMap={}>");var z=Object.create(null),ue;for(ue in N)z[ue]=N[ue];return g=!0,T=z,this};function F(){x=g?[]:null,b=g?Xx(T):null,w=[],p=Za,E=!1,S=null,d=!1,h=""}this.parse=function(N){if(typeof N!="string")throw Gi("required args <xml=string>");if(f)throw Gi("parse during stream; call end() first");return F(),H(N),p=Za,E=!1,S},this.write=function(N){if(typeof N!="string")throw Gi("required args <xml=string>");return f||(F(),f=!0),S||(h=H(h+N,!0)||""),this},this.end=function(){return f||F(),f=!1,S||H(h),h="",p=Za,E=!1,S},this.stop=function(){E=!0};function H(N,z=!1){var ue=null,je=null,tt,X=0,se=!1,fe=!1,oe=0,de=0,ee,$,B,U,Ae,wt,C,_,y,k="",I=0,W;function ae(nt,Dt){var Ut=nt.indexOf(":");if(Ut===-1)return nt;var un=b[nt.substring(0,Ut)];return un?Dt===un?nt.substr(Ut+1):un+nt.substr(Ut):(A(Yx(nt.substring(0,Ut))),null)}function Te(){if(W!==null)return W;var nt,Dt,Ut=g&&b.xmlns,un=g&&m?[]:null,ct=I,jt=k,Ft=jt.length,qr,kn,ii,Bn,Ot,ri={},Bo=new Set,Dn,Ue,Ye;e:for(;ct<Ft;ct++)if(Dn=!1,Ue=jt.charCodeAt(ct),!(Ue===32||Ue<14&&Ue>8)){for((Ue<65||Ue>122||Ue>90&&Ue<97)&&Ue!==95&&Ue!==58&&(A("illegal first char attribute name"),Dn=!0),Ye=ct+1;Ye<Ft;Ye++)if(Ue=jt.charCodeAt(Ye),!(Ue>96&&Ue<123||Ue>64&&Ue<91||Ue>47&&Ue<59||Ue===46||Ue===45||Ue===95)){if(Ue===32||Ue<14&&Ue>8){A("missing attribute value"),ct=Ye;continue e}if(Ue===61)break;A("illegal attribute name char"),Dn=!0}if(Ot=jt.substring(ct,Ye),Ot==="xmlns:xmlns"&&(A("illegal declaration of xmlns"),Dn=!0),Ue=jt.charCodeAt(Ye+1),Ue===34)Ye=jt.indexOf('"',ct=Ye+2),Ye===-1&&(Ye=jt.indexOf("'",ct),Ye!==-1&&(A("attribute value quote missmatch"),Dn=!0));else if(Ue===39)Ye=jt.indexOf("'",ct=Ye+2),Ye===-1&&(Ye=jt.indexOf('"',ct),Ye!==-1&&(A("attribute value quote missmatch"),Dn=!0));else for(A("missing attribute value quotes"),Dn=!0,Ye=Ye+1;Ye<Ft&&(Ue=jt.charCodeAt(Ye+1),!(Ue===32||Ue<14&&Ue>8));Ye++);for(Ye===-1&&(A("missing closing quotes"),Ye=Ft,Dn=!0),Dn||(ii=jt.substring(ct,Ye)),ct=Ye;Ye+1<Ft&&(Ue=jt.charCodeAt(Ye+1),!(Ue===32||Ue<14&&Ue>8));Ye++)ct===Ye&&(A("illegal character after attribute end"),Dn=!0);if(ct=Ye+1,Dn)continue e;if(Bo.has(Ot)){A("attribute <"+Ot+"> already defined");continue}if(Bo.add(Ot),!g){ri[Ot]=ii;continue}if(m){if(kn=Ot==="xmlns"?"xmlns":Ot.charCodeAt(0)===120&&Ot.substr(0,6)==="xmlns:"?Ot.substr(6):null,kn!==null){if(nt=Cr(ii),Dt=Tu(kn),Bn=T[nt],!Bn){if(kn==="xmlns"||Dt in b&&b[Dt]!==nt)do Bn="ns"+X++;while(typeof b[Bn]<"u");else Bn=kn;T[nt]=Bn}b[kn]!==Bn&&(qr||(b=Kx(b),qr=!0),b[kn]=Bn,kn==="xmlns"&&(b[Tu(Bn)]=nt,Ut=Bn),b[Dt]=nt),ri[Ot]=ii;continue}un.push(Ot,ii);continue}Ot=ae(Ot,Ut),Ot!==null&&(ri[Ot]=ii)}if(m)for(ct=0,Ft=un.length;ct<Ft;ct++)Ot=ae(un[ct++],Ut),ii=un[ct],Ot!==null&&(ri[Ot]=ii);return W=ri}function He(){for(var nt=/(\r\n|\r|\n)/g,Dt=0,Ut=0,un=0,ct=de,jt,Ft;oe>=un&&(jt=nt.exec(N),!(!jt||(ct=jt[0].length+jt.index,ct>oe)));)Dt+=1,un=ct;return oe==-1?(Ut=ct,Ft=N.substring(de)):de===0?Ft=N.substring(de,oe):(Ut=oe-un,Ft=de==-1?N.substring(oe):N.substring(oe,de+1)),{data:Ft,line:Dt,column:Ut}}for(p=He,t&&(y=Object.create({},{name:Xa(function(){return C}),originalName:Xa(function(){return _}),attrs:Xa(Te),ns:Xa(function(){return b})}));de!==-1;){if(N.charCodeAt(de)===60?oe=de:oe=N.indexOf("<",de),oe===-1){if(z)return N.substring(de);if(w.length)return L("unexpected end of file");if(!d)return L("missing start tag");de<N.length&&N.substring(de).trim()&&A(Kf);return}if(d||(d=!0),de!==oe){if(w.length){if(n&&(n(N.substring(de,oe),Cr,p),E))return}else if(N.substring(de,oe).trim()&&(A(Kf),E))return}if(U=N.charCodeAt(oe+1),U===33){if(B=N.charCodeAt(oe+2),B===91&&N.substr(oe+3,6)==="CDATA["){if(de=N.indexOf("]]>",oe),de===-1)return z?N.substring(oe):L("unclosed cdata");if(o&&(o(N.substring(oe+9,de),p),E))return;de+=3;continue}if(B===45&&N.charCodeAt(oe+3)===45){if(de=N.indexOf("-->",oe),de===-1)return z?N.substring(oe):L("unclosed comment");if(c&&(c(N.substring(oe+4,de),Cr,p),E))return;de+=3;continue}}if(U===63){if(de=N.indexOf("?>",oe),de===-1)return z?N.substring(oe):L("unclosed question");if(u&&(u(N.substring(oe,de+2),p),E))return;de+=2;continue}for(ee=oe+1;;ee++){if(Ae=N.charCodeAt(ee),isNaN(Ae))return z?N.substring(oe):(de=-1,L("unclosed tag"));if(Ae===34)B=N.indexOf('"',ee+1),ee=B!==-1?B:ee;else if(Ae===39)B=N.indexOf("'",ee+1),ee=B!==-1?B:ee;else if(Ae===62){de=ee;break}}if(U===33){if(l&&(l(N.substring(oe,de+1),Cr,p),E))return;de+=1;continue}if(W={},U===47){if(se=!1,fe=!0,!w.length)return L("missing open tag");if(ee=C=w.pop(),B=oe+2+ee.length,N.substring(oe+2,B)!==ee)return L("closing tag mismatch");for(;B<de;B++)if(U=N.charCodeAt(B),!(U===32||U>8&&U<14))return L("close tag")}else{if(N.charCodeAt(de-1)===47?(ee=C=N.substring(oe+1,de-1),se=!0,fe=!0):(ee=C=N.substring(oe+1,de),se=!0,fe=!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")}fe||w.push(C)}if(g){tt=b,se&&(fe||x.push(tt),W===null&&(m=ee.indexOf("xmlns",B)!==-1)&&(I=B,k=ee,Te(),m=!1)),_=C,je!==b&&(ue=b[Xf],ue===void 0&&(ue=b[Xf]=Object.create(null)),je=b);var bt=ue[C];if(bt!==void 0)C=bt;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),ue[_]=C}}if(se&&(I=B,k=ee,i&&(t?i(y,Cr,fe,p):i(C,Te,Cr,fe,p),E)))return;if(fe){if(r&&(r(t?y:C,Cr,se,p),E))return;g&&(se?b=tt:b=x.pop())}de+=1}}}function Qf(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var Mu={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},Jf="property";function ed(e){return e.xml&&e.xml.serialize}function Qx(e){const t=ed(e);return t!==Jf&&(t||null)}function Jx(e){return e.charAt(0).toUpperCase()+e.slice(1)}function td(e,t){return Qf(t)?e.prefix+":"+Jx(e.localName):e.name}function e0(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 t0(e,t,n){const i=on(e,t.xmlns),r=`${t[i.prefix]||i.prefix}:${i.localName}`,o=on(r);var a=n.getPackage(o.prefix);return e0(o,a)}function Wi(e){return new Error(e)}function Si(e){return e.$descriptor}function n0(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 Wi("expected element");var n=this.elementsById,i=Si(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 Wi("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function Fo(){}Fo.prototype.handleEnd=function(){},Fo.prototype.handleText=function(){},Fo.prototype.handleNode=function(){};function ku(){}ku.prototype=Object.create(Fo.prototype),ku.prototype.handleNode=function(){return this};function eo(){}eo.prototype=Object.create(Fo.prototype),eo.prototype.handleText=function(e){this.body=(this.body||"")+e};function Ho(e,t){this.property=e,this.context=t}Ho.prototype=Object.create(eo.prototype),Ho.prototype.handleNode=function(e){if(this.element)throw Wi("expected no sub nodes");return this.element=this.createReference(e),this},Ho.prototype.handleEnd=function(){this.element.id=this.body},Ho.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function Du(e,t){this.element=t,this.propertyDesc=e}Du.prototype=Object.create(eo.prototype),Du.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Cu(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function Qa(){}Qa.prototype=Object.create(eo.prototype),Qa.prototype.handleNode=function(e){var t=this,n=this.element;return n?t=this.handleChild(e):(n=this.element=this.createElement(e),this.context.addElement(n)),t};function pn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}pn.prototype=Object.create(Qa.prototype),pn.prototype.addReference=function(e){this.context.addReference(e)},pn.prototype.handleText=function(e){var t=this.element,n=Si(t),i=n.bodyProperty;if(!i)throw Wi("unexpected body text <"+e+">");eo.prototype.handleText.call(this,e)},pn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Si(t),i=n.bodyProperty;i&&e!==void 0&&(e=Cu(i.type,e),t.set(i.name,e))},pn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=Si(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=Cu(l.type,c):u==="xmlns"?u=":"+u:(s=on(u,i.ns.prefix),a.getPackage(s.prefix)&&r.addWarning({message:"unknown attribute <"+u+">",element:o,property:u,value:c})),o.set(u,c))}),o},pn.prototype.getPropertyForNode=function(e){var t=e.name,n=on(t),i=this.type,r=this.model,o=Si(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=t0(l,e.ns,r),f=r.getType(p);return D({},s,{effectiveType:Si(f).name})}}return s}var c=r.getPackage(n.prefix);if(c){const u=td(n,c),l=r.getType(u);if(s=at(o.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&l.hasType(p.type)}),s)return D({},s,{effectiveType:Si(l).name})}else if(s=at(o.properties,function(u){return!u.isReference&&!u.isAttribute&&u.type==="Element"}),s)return s;throw Wi("unrecognized element <"+n.name+">")},pn.prototype.toString=function(){return"ElementDescriptor["+Si(this.type).name+"]"},pn.prototype.valueHandler=function(e,t){return new Du(e,t)},pn.prototype.referenceHandler=function(e){return new Ho(e,this.context)},pn.prototype.handler=function(e){return e==="Element"?new to(this.model,e,this.context):new pn(this.model,e,this.context)},pn.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,Wf(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 Ou(e,t,n){pn.call(this,e,t,n)}Ou.prototype=Object.create(pn.prototype),Ou.prototype.createElement=function(e){var t=e.name,n=on(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&td(n,o)||t;if(!r.hasType(a))throw Wi("unexpected element <"+e.originalName+">");return pn.prototype.createElement.call(this,e)};function to(e,t,n){this.model=e,this.context=n}to.prototype=Object.create(Qa.prototype),to.prototype.createElement=function(e){var t=e.name,n=on(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},to.prototype.handleChild=function(e){var t=new to(this.model,"Element",this.context).handleNode(e),n=this.element,i=t.element,r;return i!==void 0&&(r=n.$children=n.$children||[],r.push(i),i.$parent=n),t},to.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function Lu(e){e instanceof jn&&(e={model:e}),D(this,{lax:!1},e)}Lu.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof pn?(i=t,t={}):typeof t=="string"?(i=this.handler(t),t={}):typeof i=="string"&&(i=this.handler(i));var r=this.model,o=this.lax,a=new n0(D({},t,{rootHandler:i})),s=new Zf({proxy:!0}),c=i0();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
2
|
line: `+F+`
|
|
3
3
|
column: `+H+`
|
|
4
|
-
nested error: `+w.message;if(L)return a.addWarning({message:z,error:w}),!0;throw
|
|
5
|
-
`,
|
|
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 y0(e){e=D({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new m0,o=new g0(r,e.format);e.preamble&&o.append(t0);var a=new pt,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(v0(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function v0(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in Au)n[i]=Au[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 Ja(e,t){$n.call(this,e,t)}Ja.prototype=Object.create($n.prototype),Ja.prototype.fromXML=function(e,t,n){vn(t)||(n=t,t="bpmn:Definitions");var i=new Du(D({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},Ja.prototype.toXML=function(e,t){var n=new y0(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var _0="BPMN20",b0="http://www.omg.org/spec/BPMN/20100524/MODEL",x0="bpmn",E0=[],w0=[{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"}]}],S0=[{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"}]}],R0={tagAlias:"lowerCase",typePrefix:"t"},C0={name:_0,uri:b0,prefix:x0,associations:E0,types:w0,enumerations:S0,xml:R0},P0="BPMNDI",A0="http://www.omg.org/spec/BPMN/20100524/DI",T0="bpmndi",M0=[{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"]}],k0=[{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"}]}],D0=[],O0={name:P0,uri:A0,prefix:T0,types:M0,enumerations:k0,associations:D0},L0="DC",I0="http://www.omg.org/spec/DD/20100524/DC",N0="dc",B0=[{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}]}],$0=[],j0={name:L0,uri:I0,prefix:N0,types:B0,associations:$0},F0="DI",H0="http://www.omg.org/spec/DD/20100524/DI",z0="di",V0=[{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"}]}],G0=[],W0={tagAlias:"lowerCase"},U0={name:F0,uri:H0,prefix:z0,types:V0,associations:G0,xml:W0},q0="bpmn.io colors for BPMN",Y0="http://bpmn.io/schema/bpmn/biocolor/1.0",K0="bioc",X0=[{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"}]}],Z0=[],Q0=[],J0={name:q0,uri:Y0,prefix:K0,types:X0,enumerations:Z0,associations:Q0},eE="BPMN in Color",tE="http://www.omg.org/spec/BPMN/non-normative/color/1.0",nE="color",iE=[{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"}]}],rE=[],oE=[],aE={name:eE,uri:tE,prefix:nE,types:iE,enumerations:rE,associations:oE};const sE={bpmn:C0,bpmndi:O0,dc:j0,di:U0,bioc:J0,color:aE};function ad(e,t){const n=D({},sE,e);return new Ja(n,t)}const cE={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"}},uE="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",sd="i18n",es={[sd]:cE,[yu]:Nf};function cd(){return ad(es)}const ud=cd();async function Iu(e){const{rootElement:t,warnings:n}=await ud.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function lE(e){const{xml:t}=await ud.toXML(e,{format:!0});return t}function Nu(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const ts=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),pE=1,fE=2;function Gi(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 ld=20,pd=1;function xn(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 ns(e,t){let n=null;const i=e.type!==t.type;for(const r of xn(e))for(const o of xn(t)){if(r.axis!==o.axis||Math.abs(r.at-o.at)>pd)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>=ld&&(!n||s>n.length)&&(n={axis:r.axis,length:s,kind:a})}return n}function fd(e,t){const n=ns(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function dE(e,t){let n=0;for(const i of t)i.id!==e.id&&fd(e,i)&&n++;return n}function Ho(e,t){let n=0;for(const i of t)i.id!==e.id&&ns(e,i)&&n++;return n}const dd=15,hd=20;function hE(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-hd||t.at>n[1]+hd)return null;const i=t.axis==="v"?[e.y,e.y+e.height]:[e.x,e.x+e.width],r=Math.max(i[0],t.lo),o=Math.min(i[1],t.hi);return o>r?[r,o]:null}const Bu=20;function is(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>pd)continue;const r=Math.max(e.lo,i.lo),o=Math.min(e.hi,i.hi);o-r<ld||n.push([r-Bu,o+Bu])}return n}function rs(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of xn(e)){const o=hE(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of is(r,xn(a)))if(Math.min(c,o[1])>Math.max(s,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const mE=1,gE=(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 yE(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 md(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 vE=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,zo=1;function Vo(e,t){const n=e.x+zo,i=e.x+e.width-zo,r=e.y+zo,o=e.y+e.height-zo;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 $u(e){return[{axis:"h",at:e.y,lo:e.x,hi:e.x+e.width,dir:1},{axis:"h",at:e.y+e.height,lo:e.x,hi:e.x+e.width,dir:1},{axis:"v",at:e.x,lo:e.y,hi:e.y+e.height,dir:1},{axis:"v",at:e.x+e.width,lo:e.y,hi:e.y+e.height,dir:1}]}function gd(e,t){const n=e.label;if(!n)return null;if(xn(e).some(i=>Vo(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(xn(i).some(r=>Vo(n,r)))return i.id;for(const i of t.shapes.filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if($u(i).some(r=>Vo(n,r)))return i.id;return null}function si(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(yE(e.waypoints[o],e.waypoints[o+1],r,fE)){i.push(r);break}}return i}function _E(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 yd=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function os(e,t){let n=0;for(const i of t){if(i.id===e.id||yd(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++)_E(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function Cr(e,t){let n=0;for(const i of t)i.id===e.id||yd(e,i)||os(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function vd(e){let t=0;const n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)os(n[i],[n[r]])>0&&(t+=n[i].type===n[r].type?2:1);return t}function ju(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(os(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 Wi=e=>e.shapes.filter(t=>!t.container);function bE(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 Fu(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 Ui(e){const t=[],n=e.shapes.filter(a=>!a.container);for(const a of e.edges)for(const s of si(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(!md(c,u,pE))continue;const l=c.id<u.id?[c.id,u.id]:[u.id,c.id];t.push({kind:"shape-overlap",shapes:l,identical:vE(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=ns(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=rs(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=gd(a,e);s&&t.push({kind:"label-over-line",edge:a.id,line:s})}const r=Fu(e);for(const a of n)if(a.type==="bpmn:TextAnnotation")for(const{owner:s,rect:c}of r)s!==a.id&&md(a,c,zo)&&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??bE(a,e,o);if(!s)continue;const c=o.get(s);!c||!c.container||gE(c,a,mE)||t.push({kind:"shape-outside-container",shape:a.id,container:c.id})}return t.sort((a,s)=>Gi(a).localeCompare(Gi(s)))}const xt=e=>typeof e=="object"&&e!==null?e:void 0,vt=e=>typeof e=="number"?e:0,Pr=e=>{const t=xt(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function xE(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=Pr(o);a&&n.push(a)}}return n}function EE(e,t){const n=xt(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const r=Pr(n);return r?t.get(r):void 0}if(ts.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return Pr(n)}function _d(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=Pr(d),m=Pr(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:vt(E.x),y:vt(E.y),width:vt(E.width),height:vt(E.height),container:ts.has(R)&&!b,attached:(m==null?void 0:m.attachedToRef)!==void 0,...m?{parent:EE(m,r)}:{},...w?{label:{x:vt(w.x),y:vt(w.y),width:vt(w.width),height:vt(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:vt((T=xt(w))==null?void 0:T.x),y:vt((L=xt(w))==null?void 0:L.y)}}),endpoints:xE(m),...b?{label:{x:vt(b.x),y:vt(b.y),width:vt(b.width),height:vt(b.height)}}:{}})}}}return{shapes:t,edges:n}}function bd(e){return Ui(_d(e))}async function wE(e){const{definitions:t,warnings:n}=await Iu(e);return{findings:bd(t),warnings:n}}function pn(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:vt(d.x),y:vt(d.y)})),endpoints:[Pr(r.source),Pr(r.target)].filter(d=>!!d),...f&&typeof f.x=="number"?{label:{x:f.x,y:vt(f.y),width:vt(f.width),height:vt(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&&ts.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:vt(r.width),height:vt(r.height),container:ts.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:vt(c.y),width:vt(c.width),height:vt(c.height)}}:{}})}return{shapes:t,edges:n}}const SE={"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 RE(e,t){const n=SE[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function xd(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function Ed(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 RE(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&xd(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?xd(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 wd=20,CE=4,Vt=(e,t)=>Math.abs(e-t)<.5;function Sd(e,t,n,i=wd){if(Vt(e.y,t.y)&&!Vt(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(Vt(e.x,t.x)&&!Vt(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 Rd(e,t,n=wd){if(e.length!==4)return null;const[i,r,o,a]=e;if(Vt(i.y,r.y)&&Vt(r.x,o.x)&&Vt(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(Vt(i.x,r.x)&&Vt(r.y,o.y)&&Vt(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 Cd(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 Pd=30,PE=[0,-25,25,-40,40];function AE(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+Pd:s-Pd,u=a?i.y+i.height:i.y,l=n.x+n.width/2,p=i.x+i.width/2;return PE.map(f=>[{x:l,y:s},{x:l,y:c},{x:p+f,y:c},{x:p+f,y:u}])}const TE=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],as=(e,t,n)=>si({...e,waypoints:t},n).length;function Ad(e,t,n,i){let r=[...e.waypoints],o=as(e,r,t);if(o===0)return null;let a=!1;for(const p of Cd(e,t))if(as(e,p,t)===0)return p;const s=(i??[]).filter(p=>p.id!==e.id).flatMap(xn),c=p=>xn({...e,waypoints:p}).some(f=>is(f,s).length>0),u=AE(e,t).filter(p=>as(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<CE&&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)||si({...e,waypoints:[h,m]},[g]).length===0)continue;const R=Sd(h,m,g),E=R?R.map(b=>TE(r,d,b)):Rd(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=as(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 Td(e,t){const{elementRegistry:n}=e,i=e.modeling,r=pn(n),o=Wi(r),a=Ui(r).filter(c=>c.kind==="edge-crosses-shape"&&!t.has(Gi(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=Ad(u,o,f,r.edges);d&&i.updateWaypoints(l,d)}}const ME=10;function Md(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 kd(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=Md(i,n),a=Md(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,ue)=>z.y-ue.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=Wi(t),b=t.edges.filter(z=>z.id!==e.id),w=Cr(e,b),T=si(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((ue,je)=>je===0||!(Vt(ue.x,z[je-1].x)&&Vt(ue.y,z[je-1].y)));let N;for(let z=L;z<=A;z+=ME){const ue=H([R,{x:R.x,y:m},{x:z,y:m},{x:z,y:g},{x:E.x,y:g},E]),je={...e,waypoints:ue};if(si(je,x).length>0)continue;const tt=Cr(je,b),X=Math.abs(z-F);(!N||tt<N.cross||tt===N.cross&&X<N.detour)&&(N={pts:ue,cross:tt,detour:X})}return N&&(T>0?N.cross<=w:N.cross<w)?N.pts:null}function Dd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=pn(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=pn(n),s=a.edges.find(l=>l.id===o.id);if(!s)continue;const c=kd(s,a);if(!c)continue;const u=n.get(o.id);u&&i.updateWaypoints(u,c)}}const eo=[25,-25,40,-40],ss=35;function Od(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-ss:n.y+n.height+ss,p=[];for(const E of[0,...eo]){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,...eo]){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,...eo]){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+ss:i.y-ss;for(const E of[0,...eo]){if(Math.abs(E)>=i.width/2-5)continue;const x=o+E;for(const b of[0,...eo]){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 cs=30;function Ld(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],r=e[n+1],o=Vt(i.y,r.y)&&!Vt(i.x,r.x),a=Vt(i.x,r.x)&&!Vt(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)<cs||Math.abs(i.y-(s.y+s.height))<cs)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)<cs||Math.abs(i.x-(s.x+s.width))<cs)return!0}}return!1}const us=40;function kE(e,t,n){let i=0;for(const r of t){if(r.container||n.includes(r.id))continue;const o=r.x-us,a=r.x+r.width+us,s=r.y-us,c=r.y+r.height+us;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 Id(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(f=>f.container);if(!Ld(e.waypoints,n))return null;const i=new Map(t.shapes.map(f=>[f.id,f])),r=Wi(t),o=t.edges.filter(f=>f.id!==e.id),a=Ho(e,o),s=Cr(e,o),c=f=>kE(f,t.shapes,e.endpoints)+(Ld(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 Od(e,i)){const h={...e,waypoints:f};if(si(h,r).length>0||Ho(h,o)>a||Cr(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 Nd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=pn(n).edges.filter(o=>o.type==="bpmn:SequenceFlow"&&!t.has(o.id)).map(o=>o.id).sort();for(const o of r){const a=pn(n),s=a.edges.find(l=>l.id===o);if(!s)continue;const c=Id(s,a);if(!c)continue;const u=n.get(o);u&&i.updateWaypoints(u,c)}}function DE(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=Vt(n[0].x,n[1].x)&&!Vt(n[0].y,n[1].y),s=Vt(n[n.length-1].x,n[n.length-2].x)&&!Vt(n[n.length-1].y,n[n.length-2].y);for(const c of eo){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 Bd(e,t){const n=new Map(t.shapes.map(l=>[l.id,l])),i=Wi(t),r=t.edges.filter(l=>l.id!==e.id),o=Ho(e,r);if(o===0)return null;const a=Cr(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=[...Od(e,n),...DE(e,n)];for(const{pts:l,cost:p}of u){const f={...e,waypoints:l};if(si(f,i).length>0)continue;const d=Ho(f,r),h=Cr(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 $d(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=pn(i),a=Ui(o).filter(l=>(l.kind==="edge-overlap-opposite"||l.kind==="edge-overlap-mixed")&&!t.has(Gi(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=pn(i),f=p.edges.find(m=>m.id===l);if(!f)continue;const d=Bd(f,p);if(!d)continue;const h=i.get(l);h&&r.updateWaypoints(h,d)}}const OE=10,LE=(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 jd(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!rs(e,i))return null;const r=Wi(t),o=i.flatMap(xn);for(const a of xn(e)){let s=[[a.lo,a.hi]];for(const[d,h]of is(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+OE*2);if(!u)continue;const l=(u[0]+u[1])/2,p=a.axis==="h"?{x:l,y:a.at-dd}:{x:a.at+to+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(!rs({...e,label:f},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&LE(f,d)))return f}return null}const to=8;function Fd(e,t){const n=e.label;if(!n)return null;const i=xn(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(xn),...t.shapes.filter(f=>f.container).flatMap($u)],u=f=>!c.some(d=>Vo(f,d));if(u(n))return null;const l=(s.axis==="v"?n.height:n.width)+to,p=[0,-l,l,-2*l,2*l];if(s.axis==="v")for(const f of[s.at+to,s.at-to-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-to-n.height,s.at+to])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 Hd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=pn(n);for(const o of r.edges){if(!o.label||t.has(o.id))continue;const a=Fd(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 zd(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=pn(i),a=Ui(o).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(Gi(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=jd(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 IE=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,Vd=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),Gd={"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}]},ls=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Hu=e=>typeof e=="string"&&e!=="";function NE(e){const t=[];function n(i,r,o,a){if(a===null){Hu(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!ls(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)Hu(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{if(!ls(i)||!Hu(i.kind)||!(i.kind in Gd)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const o of Gd[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(!ls(u))break;u=u[p]}if(!ls(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 Wd(e,t){const n=NE(e);if(n.length>0)return n;const i=[],r=new Map,o=new Map;function a(f,d,h){if(!IE.test(d)){i.push({kind:"id-invalid",opIndex:f,id:d});return}if(t.categoryOf(d)!==void 0||r.has(d)){i.push({kind:"id-duplicate",opIndex:f,id:d});return}r.set(d,{...h,opIndex:f})}e.forEach((f,d)=>{var h;switch(f.kind){case"participant.add":a(d,f.participant.id,{category:"participant",lanes:(f.participant.lanes??[]).map(m=>m.id)});for(const m of f.participant.lanes??[])a(d,m.id,{category:"lane"});break;case"node.add":a(d,f.node.id,{category:"flowNode",participant:f.node.participant});break;case"sequenceFlow.add":a(d,f.flow.id,{category:"sequenceFlow"});break;case"messageFlow.add":a(d,f.flow.id,{category:"messageFlow"});break;case"dataStore.add":a(d,f.dataStore.id,{category:"dataStore"});for(const m of f.associations??[])m.id&&a(d,m.id,{category:"dataAssociation"});break;case"dataAssociation.add":f.association.id&&a(d,f.association.id,{category:"dataAssociation"});break;case"association.add":f.association.id&&a(d,f.association.id,{category:"association"});break;case"annotation.add":a(d,f.annotation.id,{category:"annotation"}),(h=f.association)!=null&&h.id&&a(d,f.association.id,{category:"association"});break;case"group.add":a(d,f.group.id,{category:"group"});break;case"participant.update":if(f.lanes){o.set(f.id,f.lanes.map(m=>m.id));for(const m of f.lanes)t.categoryOf(m.id)===void 0&&a(d,m.id,{category:"lane"})}break}});const s=f=>{var d;return((d=r.get(f))==null?void 0:d.category)??t.categoryOf(f)},c=f=>{const d=r.get(f);return d?d.category==="participant"?f:d.participant:t.categoryOf(f)==="participant"?f:t.participantOf(f)};function u(f,d,h,m){const g=s(d);if(g===void 0){i.push({kind:"ref-missing",opIndex:f,ref:d,role:h});return}if(m&&!m.includes(g)){i.push({kind:"ref-category",opIndex:f,ref:d,role:h,expected:m.join("|"),actual:g});return}return g}const l=t.isCollaboration()||e.some(f=>f.kind==="participant.add");return e.forEach((f,d)=>{var h;switch(f.kind){case"participant.add":break;case"node.add":{const{participant:m,lane:g}=f.node;if(m===void 0){(l||g!==void 0)&&i.push({kind:"participant-required",opIndex:d,id:f.node.id});break}if(u(d,m,"participant",["participant"])===void 0)break;g!==void 0&&((((h=r.get(m))==null?void 0:h.lanes)??o.get(m)??t.lanesOf(m)).includes(g)||i.push({kind:"lane-unknown",opIndex:d,lane:g,participant:m}));break}case"sequenceFlow.add":{const{id:m,source:g,target:R,name: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&&Vd.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&&Vd.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 no={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},BE=/[ᄀ-ᇿ -〿-ヿ㐀-鿿가--⦆]/;function $E(e){const t=no;return BE.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 Go(e,t){let n=0;for(const i of e)n+=t*$E(i);return n}function Ud(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&jE(e),FE(e),HE(e),zE(e)}function jE(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:Go(r,o),fontBoundingBoxAscent:o*no.ascentEm,fontBoundingBoxDescent:o*no.descentEm,actualBoundingBoxAscent:o*no.ascentEm,actualBoundingBoxDescent:o*no.descentEm}}};t.getContext=()=>n}function FE(e){if(e.SVGMatrix)return;class t{constructor(){qr(this,"a",1);qr(this,"b",0);qr(this,"c",0);qr(this,"d",1);qr(this,"e",0);qr(this,"f",0)}static of(i,r,o,a,s,c){return Object.assign(new t,{a:i,b:r,c:o,d:a,e:s,f:c})}multiply(i){return t.of(this.a*i.a+this.c*i.b,this.b*i.a+this.d*i.b,this.a*i.c+this.c*i.d,this.b*i.c+this.d*i.d,this.a*i.e+this.c*i.f+this.e,this.b*i.e+this.d*i.f+this.f)}translate(i,r){return this.multiply(t.of(1,0,0,1,i,r))}scale(i,r=i){return this.multiply(t.of(i,0,0,r,0,0))}inverse(){const i=this.a*this.d-this.b*this.c;return t.of(this.d/i,-this.b/i,-this.c/i,this.a/i,(this.c*this.f-this.d*this.e)/i,(this.b*this.e-this.a*this.f)/i)}}e.SVGMatrix=t}function HE(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 zE(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:Go(n,12),height:14}})}function qd(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 ps(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const zu={"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 Kt(e,t){return e.filter(n=>n.kind===t)}function Yd(e,t){var lx,px,fx,dx,hx;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=Kt(e,"participant.add"),h=Kt(e,"node.add"),m=Kt(e,"sequenceFlow.add"),g=Kt(e,"messageFlow.add"),R=Kt(e,"dataStore.add"),E=Kt(e,"dataAssociation.add"),x=Kt(e,"annotation.add"),b=Kt(e,"group.add"),w=new Map(h.map(S=>[S.node.id,S])),T=(S,P,O)=>{var Ce;const V=S.businessObject,G=(((Ce=V.extensionElements)==null?void 0:Ce.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 Kt(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 Kt(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,ue=new Set;for(const S of d){ue.add(`pool:${S.participant.id}`);for(const P of S.participant.lanes??[])ue.add(P.id)}const je=new Map;for(const S of h){const P=S.node.lane??`pool:${S.node.participant??""}`;let O=je.get(P);O||je.set(P,O=new Set([0])),S.band!==void 0&&O.add(S.band)}const tt=new Map;for(const[S,P]of je){if(!ue.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);tt.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 tt){if(!S.has(P)||O.size<2)continue;const V=S.get(P),G=O.get(0)??0,j=new Set;for(const Fe of h){if(Fe.node.lane!==P||(Fe.band??0)!==0||!Fe.node.type.endsWith("Gateway"))continue;const Pe={in:new Set,out:new Set,cross:new Set};for(const _e of m){const st=_e.flow.source===Fe.node.id;if(!st&&_e.flow.target!==Fe.node.id)continue;const qt=w.get(st?_e.flow.target:_e.flow.source);if(!qt||qt.node.participant!==Fe.node.participant||!qt.node.lane)continue;let Zn,un=!1;if(qt.node.lane!==P){const Bn=S.get(qt.node.lane);if(Bn===void 0)continue;Zn=Bn>V?"down":"up",un=!0}else{const Bn=O.get(qt.band??0)??G;Zn=Bn>G?"down":Bn<G?"up":void 0}Zn&&(Pe[st?"out":"in"].add(Zn),un&&Pe.cross.add(Zn))}for(const _e of["up","down"])Pe.in.has(_e)&&Pe.out.has(_e)&&Pe.cross.has(_e)&&j.add(_e)}if(j.size!==1)continue;const[Z]=j,Ce=Math.max(...O.values()),J=Z==="down"?Ce:0;if(G===J)continue;const be=[...O.entries()].filter(([Fe])=>Fe!==0).sort((Fe,Pe)=>Fe[1]-Pe[1]),Ke=[...Array(Ce+1).keys()].filter(Fe=>Fe!==J),lt=new Map([[0,J]]);be.forEach(([Fe],Pe)=>lt.set(Fe,Ke[Pe])),tt.set(P,lt)}}const X=S=>{var P;return(((P=je.get(S))==null?void 0:P.size)??0)>1},se=S=>S.band??(S.node.lane||!X(`pool:${S.node.participant??""}`)?void 0:0),fe=new Map,oe=S=>fe.get(S.node.id)??se(S),de=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 Ce=Z.shift();G.push(Ce);for(const J of m)J.flow.source!==Ce||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=tt.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=tt.get(G);if(!j||j.size<2)continue;const Z=oe(V);if(Z===void 0||O(G,Z)!==O(G,0))continue;const Ce=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 st=oe(_e);return st!==void 0&&O(G,st)===Ce&&(S.get(_e.node.id)??0)===1}),Ke=J.some(_e=>{const st=oe(_e);return st!==void 0&&O(G,st)>Ce});if(be.length!==1||!Ke)continue;const lt=new Set(J.flatMap(_e=>P(_e.node.id)));if(!m.some(_e=>_e.flow.target===V.node.id&<.has(_e.flow.source)))continue;const Pe=new Map;for(const[_e,st]of j)Pe.set(_e,st+1);Pe.set(-1,0),tt.set(G,Pe);for(const _e of P(be[0].node.id))w.has(_e)&&(fe.set(_e,-1),ee.add(_e));de.add(V.node.id)}}const $=(S,P)=>{var O;return((O=tt.get(S))==null?void 0:O.get(P))??P},B=new Map;for(const[S,P]of je){let O=0;for(const V of P)O=Math.max(O,$(S,V));B.set(S,O)}const U=S=>z+F*S,Ae=d.map((S,P)=>({op:S,declared:P}));Ae.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 Ae){const P=S.participant,O=h.filter(Fe=>Fe.node.participant===P.id).length,V=((lx=P.lanes)==null?void 0:lx.length)??0,G=Math.max(1200,O*160+300),j=(P.lanes??[]).map(Fe=>U(B.get(Fe.id)??0)),Z=j.reduce((Fe,Pe)=>Fe+Pe,0);V&&Z<300&&(j[V-1]+=300-Z);const Ce=Math.max(300,F*((B.get(`pool:${P.id}`)??0)+1)),J=P.blackBox||O+V===0?120:V?Math.max(300,Z):Ce,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()),lt=P.lanes??[];if(lt.length&&n.splitLane(Ke,lt.length),lt.length){const Fe=o.filter(Pe=>{var _e;return Pe.type==="bpmn:Lane"&&((_e=f(Pe))==null?void 0:_e.id)===P.id}).sort((Pe,_e)=>Pe.y-_e.y);if(Fe.forEach((Pe,_e)=>{const st=lt[_e];st&&n.updateProperties(Pe,{id:st.id,name:st.name})}),j.some(Pe=>Pe!==Ke.height/V)){let Pe=Ke.y;Fe.forEach((_e,st)=>{const qt=j[st];n.resizeShape(_e,{x:_e.x,y:Pe,width:_e.width,height:qt}),Pe+=qt})}}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:ps(S.type),businessObject:i.create(ps(S.type),{id:S.id,name:S.name,...P!==void 0?{"bwl:band":P}:{}})}),W=[...Ae.map(({op:S})=>S.participant.id).filter(S=>_.has(S)),...[..._.keys()].filter(S=>!d.some(P=>P.participant.id===S))],ae=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,he,le)=>{const Ze=u().children.filter(qe=>!("waypoints"in qe&&qe.waypoints)&&qe.id!==he&&typeof qe.y=="number"&&qe.y>=ne);Ze.length&&n.moveElements(Ze,{x:0,y:le})},Z=(ne,he)=>{if(ne){const Me=p(ne),Xe=U(he);if(Me.height>=Xe)return;const Ft=Xe-Me.height,ce=f(Me),We=ce?ce.y+ce.height:Me.y+Me.height;n.resizeLane(Me,{x:Me.x,y:Me.y,width:Me.width,height:Xe},!1),j(We,ce==null?void 0:ce.id,Ft);return}if(!O)return;const le=F*(he+1);if(O.height>=le)return;const Ze=le-O.height,qe=O.y+O.height;n.resizeShape(O,{x:O.x,y:O.y,width:O.width,height:le}),j(qe,O.id,Ze)},Ce=(ne,he,le)=>{if(ne){const Ze=p(ne);return Ze.y+Math.min(Ze.height/2,N)+$(ne,he??0)*F}return he!==void 0&&O?O.y+H+$(`pool:${S}`,he)*F:le},J=(ne,he,le)=>{if(ne){const Ze=p(ne);return Ze.y+Math.min(Ze.height/2,N)+he*F}return O?O.y+H+he*F:le},be=ne=>ne.participant?p(ne.participant):u(),Ke=30,lt=(ne,he,le,Ze)=>{const qe=le-he.width/2,Me=Ze-he.height/2;return(ne.children??[]).find(Xe=>!("waypoints"in Xe&&Xe.waypoints)&&Xe.type!=="bpmn:Lane"&&Xe.type!=="label"&&typeof Xe.x=="number"&&qe<Xe.x+Xe.width+Ke&&qe+he.width+Ke>Xe.x&&Me<Xe.y+Xe.height&&Me+he.height>Xe.y)},Fe=(ne,he,le,Ze,qe,Me)=>{const Xe=le!==void 0||Ze!==void 0,Ft=$(le??`pool:${S}`,Ze??0);if(Xe)for(let Le=0;Le<4;Le++){const Ne=J(le,Ft+Le,Me);if(!lt(ne,he,qe,Ne))return Z(le,Ft+Le),{x:qe,y:Ne}}const ce=Ce(le,Ze,Me);Xe&&Z(le,Ft);let We=qe;for(let Le=0;Le<64;Le++){const Ne=lt(ne,he,We,ce);if(!Ne)break;We=Ne.x+Ne.width+130+he.width/2}return{x:We,y:ce}},Pe=new Set(P.flows.map(ne=>ne.flow.target)),_e=new Map;for(const ne of P.nodes){if(Pe.has(ne.node.id))continue;const he=I(ne.node,ne.band),le=se(ne),Ze=ne.node.lane?`${ne.node.lane}|${le??""}`:le!==void 0?`band:${le}`:"",qe=be(ne.node),Me=Fe(qe,he,ne.node.lane,le,_e.get(Ze)??V,G);n.createShape(he,Me,qe),_e.set(Ze,Me.x+he.width+130),!ne.node.lane&&le===void 0&&(G+=160)}const st=new Set,qt=new Map,Zn=new Map,un=new Map;if(S&&ue.has(`pool:${S}`)){const ne=new Map;for(const ce of P.flows)ne.set(ce.flow.target,(ne.get(ce.flow.target)??0)+1);const he=ce=>Ce(ce.node.lane,oe(ce),Number.NaN),le=new Set,Ze=ce=>{var Ne;const We=(Ne=w.get(ce))==null?void 0:Ne.node.participant;if(We)return l(We);const Le=l(ce);if(Le)return Le.type==="bpmn:Participant"?Le:f(Le)},qe=ce=>{const We=[],Le=new Set([ce]),Ne=[ce];for(;Ne.length;){const dt=Ne.shift(),Qe=w.get(dt);Qe&&We.push(Qe);for(const Ee of P.flows)Ee.flow.source!==dt||Le.has(Ee.flow.target)||(ne.get(Ee.flow.target)??0)!==1||(Le.add(Ee.flow.target),Ne.push(Ee.flow.target))}return We},Me=ce=>{if(!O)return;const We=new Set(ce.map(dt=>dt.node.id));let Le=!1,Ne=!1;for(const dt of g){if(!We.has(dt.flow.source))continue;const Qe=Ze(dt.flow.target);!Qe||Qe.id===O.id||(Qe.y<O.y?Le=!0:Ne=!0)}return Le&&!Ne?"up":Ne&&!Le?"down":void 0};for(const ce of P.nodes){if(!ae(ce.node.type))continue;const We=Ce(ce.node.lane,se(ce),Number.NaN);if(Number.isNaN(We))continue;const Le=[];for(const Ee of P.flows){if(Ee.flow.source!==ce.node.id)continue;const ze=w.get(Ee.flow.target);if(!ze||ze.node.lane!==ce.node.lane||(ne.get(ze.node.id)??0)!==1)continue;const Je=se(ze);if(Je===void 0)continue;const hn=Ce(ze.node.lane,Je,Number.NaN);if(Number.isNaN(hn))continue;const Ur=qe(ze.node.id),Yt=Me(Ur);Yt&&Le.push({subtree:Ur,band:Je,row:hn,dir:Yt})}if(!Le.some(Ee=>Ee.dir==="up")||!Le.some(Ee=>Ee.dir==="down")||!Le.some(Ee=>Ee.dir==="up"&&Le.some(ze=>ze.dir==="down"&&ze.row<Ee.row)))continue;const dt=[...Le].sort((Ee,ze)=>Ee.row-ze.row);[...Le.filter(Ee=>Ee.dir==="up"),...Le.filter(Ee=>Ee.dir==="down")].sort((Ee,ze)=>Ee.dir===ze.dir?Ee.row-ze.row:Ee.dir==="up"?-1:1).forEach((Ee,ze)=>{const Je=dt[ze].band;if(Je!==Ee.band){le.add(ce.node.id);for(const hn of Ee.subtree)se(hn)===Ee.band&&fe.set(hn.node.id,Je)}})}const Xe=ce=>{if(!O)return;const We=new Set(ce.map(dt=>dt.node.id));let Le=!1,Ne=!1;for(const dt of g){if(!We.has(dt.flow.target))continue;const Qe=Ze(dt.flow.source);!Qe||Qe.id===O.id||(Qe.y<O.y?Le=!0:Ne=!0)}return Le&&!Ne?"up":Ne&&!Le?"down":void 0};for(const ce of P.nodes){if(!ae(ce.node.type))continue;const We=ce.node.lane??`pool:${S}`,Le=tt.get(We);if(!Le||Le.size<2)continue;const Ne=Le.get(0);if(Ne===void 0)continue;const dt=Math.max(...Le.values()),Qe=Ne===dt&&Ne!==0?"down":void 0;if(!Qe)continue;const Ee=[];for(const Yt of P.flows){if(Yt.flow.source!==ce.node.id)continue;const Qn=w.get(Yt.flow.target);if(!Qn||Qn.node.lane!==ce.node.lane||(ne.get(Qn.node.id)??0)!==1)continue;const mx=oe(Qn);mx!==void 0&&Ee.push({t:Qn,subtree:qe(Qn.node.id),band:mx})}const ze=Ee.find(Yt=>(Le.get(Yt.band)??Yt.band)===Ne);if(!ze||Xe(ze.subtree)===Qe||Me(ze.subtree)===Qe)continue;const Je=Ee.find(Yt=>Yt!==ze&&Xe(Yt.subtree)===Qe);if(!Je)continue;const hn=ze.band,Ur=Je.band;for(const Yt of ze.subtree)oe(Yt)===hn&&fe.set(Yt.node.id,Ur);for(const Yt of Je.subtree)oe(Yt)===Ur&&fe.set(Yt.node.id,hn);le.add(ce.node.id)}for(const ce of P.nodes){if(!ae(ce.node.type))continue;const We=he(ce);if(Number.isNaN(We)||x.some(Ee=>{var ze,Je;return(((ze=Ee.placement)==null?void 0:ze.anchor)??(Ee.association?Ee.association.source===Ee.annotation.id?Ee.association.target:Ee.association.source:void 0))===ce.node.id&&((Je=Ee.placement)==null?void 0:Je.side.startsWith("bottom"))}))continue;let Ne,dt=!1,Qe;for(const Ee of P.flows){if(Ee.flow.source!==ce.node.id)continue;const ze=w.get(Ee.flow.target);if(!ze||!ze.node.lane&&se(ze)===void 0)continue;const Je=he(ze);Number.isNaN(Je)||(Math.abs(Je-We)<.5&&(dt=!0),Je>We?!Ne||Je>Ne.row?Ne={id:ze.node.id,row:Je,count:1}:Je===Ne.row&&Ne.count++:Je<We&&ze.node.lane===ce.node.lane&&(!Qe||Je>Qe.row?Qe={op:ze,row:Je,count:1}:Je===Qe.row&&Qe.count++))}Ne&&Ne.count===1&&(ne.get(Ne.id)??0)===1&&!le.has(ce.node.id)&&st.add(Ne.id),!dt&&Qe&&Qe.count===1&&(ne.get(Qe.op.node.id)??0)===1&&!de.has(ce.node.id)&&qt.set(Qe.op.node.id,{lane:ce.node.lane,band:oe(ce)})}const Ft=new Map;for(const ce of g)Ft.set(ce.flow.target,[...Ft.get(ce.flow.target)??[],ce]);for(const ce of P.nodes){const We=Ft.get(ce.node.id);if(!We||We.length!==1||!ne.get(ce.node.id)||!ce.node.lane&&se(ce)===void 0||ee.has(ce.node.id))continue;const Le=(px=w.get(We[0].flow.source))==null?void 0:px.node.participant,Ne=Le?l(Le):void 0;if(!Ne||!O||Ne.id===O.id)continue;const dt=ce.node.lane??`pool:${S}`,Qe=tt.get(dt);if(!Qe)continue;const Ee=Qe.get(0)??0,ze=(Qe.get(oe(ce)??0)??Ee)-Ee;if(ze===0)continue;const Je=Ne.y<O.y;if(Je&&ze<0||!Je&&ze>0)continue;let hn;for(const[Ur,Yt]of Qe){const Qn=Yt-Ee;(Je&&Qn<0&&(!hn||Qn<hn.row)||!Je&&Qn>0&&(!hn||Qn>hn.row))&&(hn={band:Ur,row:Qn})}hn&&Zn.set(ce.node.id,{lane:ce.node.lane,band:hn.band})}}const Bn=new Set;let gu=0;for(;gu++<P.nodes.length+2;){for(let le=0;le<P.nodes.length+P.flows.length+2;le++){let Ze=!1;for(const qe of P.flows){const Me=qe.flow;if(Bn.has(Me.id))continue;const Xe=l(Me.source);if(!Xe)continue;const Ft=l(Me.target),ce=w.get(Me.target);if(!Ft&&ce){const We=I(ce.node,ce.band),Le=oe(ce);if(ce.node.lane||Le!==void 0){const Ne=be(ce.node),dt=Xe,Qe=dt.x+(un.get(Me.source)??0)+dt.width+130,Ee=qt.get(Me.target)??Zn.get(Me.target),ze=Fe(Ne,We,Ee?Ee.lane:ce.node.lane,Ee?Ee.band:Le,st.has(Me.target)?dt.x+dt.width/2:Qe,Number.NaN),Je=n.createShape(We,ze,Ne);st.has(Me.target)&&un.set(Me.target,Qe-(Je.x+Je.width/2)),n.connect(Xe,Je,{type:"bpmn:SequenceFlow",businessObject:k(Me)})}else s.append(Xe,We,{connection:{type:"bpmn:SequenceFlow",businessObject:k(Me)}})}else if(Ft)n.connect(Xe,Ft,{type:"bpmn:SequenceFlow",businessObject:k(Me)});else continue;Bn.add(Me.id),Ze=!0}if(!Ze)break}const ne=P.nodes.filter(le=>!l(le.node.id));if(!ne.length)break;const he=ne[0];{const le=I(he.node,he.band),Ze=be(he.node),qe=se(he);n.createShape(le,Fe(Ze,le,he.node.lane,qe,V,G),Ze),!he.node.lane&&qe===void 0&&(G+=160)}}}const Te=40,He=(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 Ce of m){const J=Ce.flow.target;if(Ce.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 Kt(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=He(S.target),Ce=new Set(Z.map(Pe=>Pe.id)),J=Math.min(...Z.map(Pe=>Pe.x)),be=Math.max(...Z.map(Pe=>Pe.x+Pe.width)),Ke=G.x+G.width,lt=be-J+Te*2-(j.x-Ke);if(lt>0){const Pe=f(O),_e=(Pe==null?void 0:Pe.children)??[],st=un=>un.type==="bpmn:Lane",qt=_e.filter(un=>!("waypoints"in un&&un.waypoints)&&!st(un)&&!Ce.has(un.id)&&un.x>=j.x),Zn=Pe?[Pe,..._e.filter(un=>st(un))]:[];qt.length&&n.createSpace(qt,Zn,{x:lt,y:0},"e",j.x-1)}const Fe=P.node.lane||P.band!==void 0?O.y+O.height/2:G.y+G.height/2;n.moveElements(Z,{x:Ke+Te-J,y:Fe-(O.y+O.height/2)})}const bt=(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)bt(S.dataStore.id,j)}for(const S of E){const O=p(S.association.target).type==="bpmn:DataStoreReference"?S.association.target:S.association.source;bt(O,S.association)}const nt=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,Ce=Z?l(Z):void 0;Ce&&typeof Ce.x=="number"&&Ce.type!=="bpmn:Participant"&&V.push(Ce)}if(!V.length)continue;const G=Math.max(...V.map(j=>j.x+j.width/2))+nt;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),Ce=j.flow.source===P.participant.id?j.flow.target:j.flow.target===P.participant.id?j.flow.source:void 0,J=Ce?l(Ce):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,lt=Ke?J.y+J.height:J.y,Fe=Ke?O.y:O.y+O.height,Pe=j.flow.source===P.participant.id?[{x:be,y:Fe},{x:be,y:lt}]:[{x:be,y:lt},{x:be,y:Fe}],_e=pn(o),st={..._e.edges.find(qt=>qt.id===j.flow.id),waypoints:Pe};si(st,Wi(_e)).length||n.updateWaypoints(Z,Pe)}}};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 Ut=100,cn=30,ct=4,$t=S=>!("waypoints"in S&&S.waypoints)&&S.type!=="bpmn:Lane"&&S.type!=="label"&&typeof S.x=="number",jt=()=>{const S=pn(o);return{bad:Ui(S).filter(P=>P.kind==="edge-crosses-shape"||P.kind==="edge-overlap-opposite"||P.kind==="edge-overlap-mixed").length,crossings:vd(S),straight:S.edges.filter(P=>P.type==="bpmn:MessageFlow"&&P.waypoints.length===2).length}},Wr=S=>{const P=pn(o),O=P.edges.find(V=>V.id===S);return!!O&&si(O,Wi(P)).length>0},Mn=(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+cn&&be.x+O+be.width+cn>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})}},ni=(S,P)=>P.bad>S.bad||P.crossings>S.crossings&&P.straight<=S.straight,Nn=(S,P,O,V=()=>!0)=>{const G=jt(),j=Mn(S,P,O);if(!j)return!1;const Z=jt();return ni(G,Z)||!V()?(j(),!1):!0},Dt=S=>{var O;const P=(O=w.get(S))==null?void 0:O.node.participant;return!!P&&ue.has(`pool:${P}`)},ii=new Map;for(const S of g){if(!Dt(S.flow.target))continue;const P=ii.get(S.flow.target)??[];P.push(S),ii.set(S.flow.target,P)}const No=[...ii.keys()],kn=new Set(m.map(S=>S.flow.target)),Ue=S=>Ae.findIndex(({op:P})=>P.participant.id===S);No.sort((S,P)=>{var G,j;const O=kn.has(S)?1:0,V=kn.has(P)?1:0;return O!==V?O-V:Ue((G=w.get(S))==null?void 0:G.node.participant)-Ue((j=w.get(P))==null?void 0:j.node.participant)});const Ye=S=>S.x+S.width/2,rx=S=>{let P;for(const O of ii.get(S)??[]){const V=l(O.flow.source);if(!V)continue;const G=Ye(V);(!P||G>P.cx)&&(P={op:O,cx:G})}return P==null?void 0:P.op},TD=S=>{const P=rx(S),O=l(S),V=P?l(P.flow.source):void 0;return O&&V?Ye(V)-Ye(O):void 0},MD=S=>{const P=TD(S);return P!==void 0&&Math.abs(P)<Ut},Of=S=>{const P=rx(S);if(!P)return null;const O=l(S),V=l(P.flow.source);if(!O||!V)return null;const G=Ye(V)-Ye(O);if(G>=Ut){const j=p(w.get(S).node.participant);return{subtree:He(S,Z=>Z.x>=O.x),pool:j,dx:G}}if(-G>=Ut&&Dt(P.flow.source)){const j=p(w.get(P.flow.source).node.participant);return{subtree:He(P.flow.source,Z=>Z.x>=V.x&&!MD(Z.id)),pool:j,dx:-G}}return null},ox=()=>No.map(S=>({id:S,plan:Of(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 ox()){const j=Of(G);if(!j)continue;const Z=Mn(j.subtree,j.pool,j.dx);Z&&O.push(Z)}if(!O.length)break;if(!ni(P,jt()))continue;for(const G of O.reverse())G();let V=!1;for(const G of ox()){const j=Of(G);j&&Nn(j.subtree,j.pool,j.dx)&&(V=!0)}if(!V)break}for(const S of No.flatMap(P=>ii.get(P)??[])){if(!Wr(S.flow.id))continue;const P=l(S.flow.target);if(!P)continue;const O=p(w.get(S.flow.target).node.participant),V=He(S.flow.target,j=>j.x>=P.x),G=P.width+130;for(let j=1;j<=ct&&!Nn(V,O,G*j,()=>!Wr(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||!ue.has(`pool:${j}`))continue;const Z=m.filter(be=>be.flow.target===V);if(Z.length!==1)continue;const Ce=l(Z[0].flow.source),J=l(V);!Ce||!J||!w.has(Ce.id)||Math.abs(P(Ce)-P(J))>1||J.x-(Ce.x+Ce.width)<=131||O.push({id:V,pred:Ce,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(Pe=>Pe.flow.target===V).flow.source);if(!j||!Z)continue;const Ce=j.x-(Z.x+Z.width);if(Ce<=131)continue;const J=p(G.node.participant),be=He(V,Pe=>Pe.x>=j.x),Ke=jt(),lt=Mn(be,J,-(Ce-130));if(!lt)continue;const Fe=jt();(Fe.bad>Ke.bad||Fe.crossings>=Ke.crossings)&<()}}kt(!0);let ax=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,Ce=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:Ce-j,height:J-Z}}else V={x:300+ax*350,y:40,width:300,height:200},ax++;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),(fx=S.group.members)!=null&&fx.length&&T(G,"bwl:Members",{refs:S.group.members.join(" ")})}const sx=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 Ua=0;const cx=12,ux=14,kD=15,DD=300,OD=S=>{const P=S.split(`
|
|
7
|
-
`),O=Math.max(...P.map(j=>Go(j,cx))),V=Math.max(100,Math.min(DD,Math.ceil(O)+ux)),G=P.reduce((j,Z)=>j+Math.max(1,Math.ceil((Go(Z,cx)+ux)/V)),0);return{width:V,height:Math.max(30,G*kD+10)}},en=10;for(const S of x){const P=S.association,O=((dx=S.placement)==null?void 0:dx.anchor)??(P?P.source===S.annotation.id?P.target:P.source:void 0),V=O?l(O):void 0,G=V?sx(V):void 0,j=OD(S.annotation.text??"");let Z;if(G&&S.placement){const[Ke,lt]=zu[S.placement.side],Fe=S.placement.offset??50;Z={x:G.x+G.width/2+Ke*(G.width/2+j.width/2+Fe),y:G.y+G.height/2+lt*(G.height/2+j.height/2+Fe)}}else G?(Z={x:G.x+G.width/2+180+Ua%3*260,y:G.y-110-Ua%2*95},Ua++):(Z={x:300+Ua*260,y:60},Ua++);const Ce=V?f(V)??u():u(),J=Ce;if(G&&typeof J.x=="number"&&typeof J.width=="number"&&J.type==="bpmn:Participant"){const Ke=(ne,he)=>{const[le,Ze]=zu[ne];let qe={x:G.x+G.width/2+le*(G.width/2+j.width/2+he),y:G.y+G.height/2+Ze*(G.height/2+j.height/2+he)};const Me=J.x+en+j.width/2,Xe=J.x+J.width-en-j.width/2,Ft=J.y+en+j.height/2,ce=J.y+J.height-en-j.height/2,We={x:Math.min(Xe,Math.max(Me,qe.x)),y:Math.min(ce,Math.max(Ft,qe.y))};return(We.x!==qe.x||We.y!==qe.y)&&(qe=Math.abs(We.x-(G.x+G.width/2))<(G.width+j.width)/2+en&&Math.abs(We.y-(G.y+G.height/2))<(G.height+j.height)/2+en?{x:G.x+G.width+en+j.width/2,y:We.y}:We),qe},lt=(J.children??[]).filter(ne=>!("waypoints"in ne&&ne.waypoints)&&ne.type!=="bpmn:Lane"&&ne.type!=="label"&&typeof ne.x=="number"),Fe=pn(o),Pe=Fe.edges.flatMap(xn),_e=Fu(Fe).map(ne=>ne.rect),st=ne=>({x0:ne.x-j.width/2-en,x1:ne.x+j.width/2+en,y0:ne.y-j.height/2-en,y1:ne.y+j.height/2+en}),qt=ne=>{const he=st(ne);return lt.some(le=>he.x0<le.x+le.width&&he.x1>le.x&&he.y0<le.y+le.height&&he.y1>le.y)},Zn=ne=>{const he=st(ne);return Pe.some(le=>le.axis==="h"?le.at>he.y0&&le.at<he.y1&&le.lo<he.x1&&le.hi>he.x0:le.at>he.x0&&le.at<he.x1&&le.lo<he.y1&&le.hi>he.y0)},un=ne=>{const he=st(ne);return _e.some(le=>he.x0<le.x+le.width&&he.x1>le.x&&he.y0<le.y+le.height&&he.y1>le.y)},Bn=ne=>qt(ne)||Zn(ne)||un(ne),gu=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=Me=>Me.startsWith("top")?Me.replace(/^top/,"bottom"):Me.replace(/^bottom/,"top"),he=Me=>Me.endsWith("left")?Me.replace(/left$/,"right"):Me.replace(/right$/,"left"),le=S.placement.side,Ze=[le,ne(le),he(le),ne(he(le)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],qe=S.placement.offset??50;if(Z=Ke(le,qe),Bn(Z)){const Me=new Set;for(const Xe of Ze){if(Me.has(Xe))continue;Me.add(Xe);const Ft=Ke(Xe,qe);if(gu(Ft)&&!Bn(Ft)){Z=Ft;break}}}}else{const ne=J.x+en+j.width/2,he=J.x+J.width-en-j.width/2,le=J.y+en+j.height/2,Ze=J.y+J.height-en-j.height/2;if(Z={x:Math.min(he,Math.max(ne,Z.x)),y:Math.min(Ze,Math.max(le,Z.y))},Bn(Z)){const qe=(G.width+j.width)/2+en,Xe=[{x:Z.x+qe,y:Z.y},{x:Z.x-qe,y:Z.y},{x:Z.x,y:Z.y-j.height-en},{x:Z.x,y:Z.y+j.height+en}].filter(gu).find(Ft=>!Bn(Ft));Xe&&(Z=Xe)}}}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,Ce);if(P){const Ke=lt=>lt===S.annotation.id?be:p(lt);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 Kt(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 Kt(e,"node.update")){let P=p(S.id);if(S.type&&ps(S.type)!==P.type&&(P=c.replaceElement(P,{type:ps(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 Kt(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:((hx=S.condition)==null?void 0:hx.label)??void 0})}for(const S of Kt(e,"messageFlow.update"))S.name!==void 0&&n.updateProperties(p(S.id),{name:S.name??void 0});for(const S of Kt(e,"dataStore.update"))S.name!==void 0&&n.updateProperties(p(S.id),{name:S.name??void 0});for(const S of Kt(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=sx(p(S.placement.anchor)),[V,G]=zu[S.placement.side],j=S.placement.offset??50,Z=O.x+O.width/2+V*(O.width/2+P.width/2+j),Ce=O.y+O.height/2+G*(O.height/2+P.height/2+j);n.moveElements([P],{x:Z-(P.x+P.width/2),y:Ce-(P.y+P.height/2)}),T(P,"bwl:Placement",L(S.placement))}}for(const S of Kt(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,Ce=Math.max(...O.map(J=>J.y+J.height))+40;n.resizeShape(P,{x:G,y:j,width:Z-G,height:Ce-j})}T(P,"bwl:Members",{refs:S.members.join(" ")})}}}function Kd(e,t,n=Yd){const i=qd(e),r=Wd(t,Ed(i.elementRegistry)),o={edgeCrossings:{before:0,after:0}};if(r.length)return{ok:!1,issues:r,findings:[],stats:o};const a=pn(i.elementRegistry),s=new Set(Ui(a).map(Gi)),c=new Set(a.edges.map(d=>d.id)),u=ju(a).length,l=e.get("commandStack");try{$f(l,()=>{n(t,i),Dd(i,c),Td(i,s),$d(i,s,c),Nd(i,c),zd(i,s,c),Hd(i,c)})}catch(d){return{ok:!1,issues:[{kind:"lower-failed",message:d instanceof Error?d.message:String(d)}],findings:[],stats:o}}const p=pn(i.elementRegistry),f=Ui(p).filter(d=>!s.has(Gi(d)));return{ok:!0,issues:[],findings:f,stats:{edgeCrossings:{before:u,after:ju(p).length}}}}function VE(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function GE(e,t){return typeof e.get=="function"?e.get(t):e[t]}function Xd(e,t){const n=GE(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Zd(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function WE(e){return typeof e=="string"&&vu.includes(e)}function ci(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function Qd(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 se=Zd(X,"bwl:Placement");if(!se)return;const fe=typeof se.anchor=="string"?se.anchor:void 0;if(!fe||!WE(se.side))return;const oe=typeof se.offset=="number"?se.offset:void 0;m.push({owner:X.id,anchor:fe,side:se.side,...oe!==void 0?{offset:oe}:{}})},T=X=>{const se=Zd(X,"bwl:Members"),fe=typeof(se==null?void 0:se.refs)=="string"?se.refs.split(/\s+/).filter(Boolean):[];fe.length&&g.push({owner:X.id,refs:fe})},L=X=>{var se;for(const fe of X)switch(x(fe.id),fe.$type){case"bpmn:TextAnnotation":b(fe.id),s.push({id:fe.id,text:typeof fe.text=="string"?fe.text:""}),w(fe);break;case"bpmn:Association":d.push({id:fe.id,type:fe.$type,source:ci(fe.sourceRef),target:ci(fe.targetRef)});break;case"bpmn:Group":{b(fe.id);const oe=(se=fe.categoryValueRef)==null?void 0:se.value;c.push({id:fe.id,...typeof oe=="string"&&oe?{name:oe}:{}}),T(fe);break}default:u.push({id:fe.id,type:fe.$type,reason:"type-outside-mvp"})}},A=(X,se)=>{const fe=X.flowElements??[],oe=(X.laneSets??[]).flatMap(ee=>ee.lanes??[]),de=new Map;for(const ee of oe){x(ee.id);for(const $ of ee.flowNodeRef??[]){const B=ci($);B&&de.set(B,ee.id)}}for(const ee of fe){if(x(ee.id),ee.$type==="bpmn:SequenceFlow"){p.push({id:ee.id,source:ci(ee.sourceRef),target:ci(ee.targetRef),...typeof ee.name=="string"&&ee.name?{name:ee.name}:{}});continue}if(ee.$type==="bpmn:DataStoreReference"){b(ee.id),a.push({id:ee.id,...ee.name?{name:ee.name}:{}});continue}const $=VE(ee.$type);if(!Lf($)){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}:{},...se?{participant:se}:{},...de.has(ee.id)?{lane:de.get(ee.id)}:{}});const B=Xd(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:ci(U.targetRef)});for(const U of ee.dataInputAssociations??[])x(U.id),h.push({id:U.id,type:U.$type,source:ci((U.sourceRef??[])[0]),target:ee.id})}L(X.artifacts??[])};if(n){const X=new Set;for(const se of n.participants??[]){b(se.id);const fe=ci(se.processRef);fe&&X.add(fe);const oe=fe?i.get(fe):void 0,de=((oe==null?void 0:oe.laneSets)??[]).flatMap(U=>U.lanes??[]),ee=de.map(U=>({id:U.id,...U.name?{name:U.name}:{}}));for(const U of ee)b(U.id);const $=!oe||(oe.flowElements??[]).length===0&&de.length===0&&(oe.artifacts??[]).length===0;r.push({id:se.id,...se.name?{name:se.name}:{},...$?{blackBox:!0}:{},...ee.length?{lanes:ee}:{}});const B=Xd(se,"bwl:poolOrder");B!==void 0&&(l.poolOrders[se.id]=B),oe&&A(oe,se.id)}for(const se of n.messageFlows??[])x(se.id),f.push({id:se.id,source:ci(se.sourceRef),target:ci(se.targetRef),...typeof se.name=="string"&&se.name?{name:se.name}:{}});L(n.artifacts??[]);for(const[se,fe]of i)!X.has(se)&&(fe.flowElements??[]).length>0&&u.push({id:se,type:fe.$type,reason:"unreachable-process"})}else for(const X of i.values())A(X);const F=[],H=[],N=[],z=[],ue=(X,se)=>!!X&&!!se&&E.has(X)&&E.has(se);for(const X of p){if(!ue(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(!ue(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(!ue(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(!ue(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 je=new Map(c.map(X=>[X.id,X]));for(const{owner:X,refs:se}of g){const fe=se.filter(de=>R.has(de)),oe=je.get(X);oe&&fe.length&&(oe.members=fe)}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 UE(e){const{definitions:t,warnings:n}=await Iu(e);return{...Qd(t),warnings:n}}function qE(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function Jd(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=Kd(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 YE=Symbol("bpmn-editor");function KE(){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 Jd(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:Nu(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 XE(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Vu={exports:{}},eh;function ZE(){if(eh)return Vu.exports;eh=1;var e=Vu.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},Vu.exports}var QE=ZE(),JE=XE(QE);function ui(e){if(!(this instanceof ui))return new ui(e);e=e||[128,36,1],this._seed=e.length?JE.rack(e[0],e[1],e[2]):e}ui.prototype.next=function(e){return this._seed(e||!0)},ui.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},ui.prototype.claim=function(e,t){this._seed.set(e,t||!0)},ui.prototype.assigned=function(e){return this._seed.get(e)||!1},ui.prototype.unclaim=function(e){delete this._seed.hats[e]},ui.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const 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 ut(e,t=globalThis.document){var u;if(typeof e!="string")throw new TypeError("String expected");const n=/^<!--(.*?)-->$/s.exec(e);if(n)return t.createComment(n[1]);const i=(u=/<([\w:]+)/.exec(e))==null?void 0:u[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const l=t.createElement("html");l.innerHTML=e;const{lastChild:p}=l;return p.remove(),p}let[r,o,a]=Object.hasOwn(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 ew(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 fn(e,...t){const n=e.style;return M(t,function(i){i&&M(i,function(r,o){n[o]=r})}),e}function on(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const tw=Object.prototype.toString;function ft(e){return new qi(e)}function qi(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}qi.prototype.add=function(e){return this.list.add(e),this},qi.prototype.remove=function(e){return tw.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},qi.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},qi.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},qi.prototype.array=function(){return Array.from(this.list)},qi.prototype.has=qi.prototype.contains=function(e){return this.list.contains(e)};function fs(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Ar(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function nw(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ds={},th;function iw(){if(th)return ds;th=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return ds.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},ds.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},ds}var nh=iw(),rw=nw(nh),we=ew({__proto__:null,default:rw},[nh]),ih=["focus","blur"];function ow(e,t,n,i,r){return ih.indexOf(n)!==-1&&(r=!0),we.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=Ar(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function aw(e,t,n,i){return ih.indexOf(t)!==-1&&(i=!0),we.unbind(e,t,n,i)}var En={bind:ow,unbind:aw};function Gu(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function et(e,t){return t=t||document,t.querySelector(e)}function hs(e,t){return t=t||document,t.querySelectorAll(e)}function li(e){e.parentNode&&e.parentNode.removeChild(e)}function sw(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function cw(e,t){return t.appendChild(sw(e,t))}function Se(e,t){return cw(t,e),e}var Wu=2,rh={"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":Wu,"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":Wu,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function uw(e,t){return rh[t]?e.style[t]:e.getAttributeNS(null,t)}function oh(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=rh[i];r?(r===Wu&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function lw(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)oh(e,r,t[r])}function re(e,t,n){if(typeof t=="string")if(n!==void 0)oh(e,t,n);else return uw(e,t);else lw(e,t);return e}const pw=Object.prototype.toString;function $e(e){return new Yi(e)}function Yi(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Yi.prototype.add=function(e){return this.list.add(e),this},Yi.prototype.remove=function(e){return pw.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Yi.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},Yi.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Yi.prototype.array=function(){return Array.from(this.list)},Yi.prototype.has=Yi.prototype.contains=function(e){return this.list.contains(e)};function ms(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function ah(e){return e.cloneNode(!0)}var Uu={svg:"http://www.w3.org/2000/svg"},sh='<svg xmlns="'+Uu.svg+'"';function fw(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(Uu.svg)===-1&&(e=sh+e.substring(4)):(e=sh+">"+e+"</svg>",t=!0);var n=dw(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function dw(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=fw(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(Uu.svg,e),t&&re(n,t),n}var qu=null;function ch(){return qu===null&&(qu=pe("svg")),qu}function uh(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function hw(e,t,n,i,r,o){var a=ch().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return uh(a,e);case 6:return uh(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function Wo(e){return ch().createSVGTransform()}var lh=/([&<>]{1})/g,mw=/([&<>\n\r"]{1})/g,gw={"&":"&","<":"<",">":">",'"':"'"};function Yu(e,t){function n(i,r){return gw[r]||r}return e.replace(t,n)}function ph(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(Yu(e.textContent,lh));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,'="',Yu(o.value,mw),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)ph(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",Yu(e.nodeValue,lh),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function yw(e){for(var t=e.firstChild,n=[];t;)ph(t,n),t=t.nextSibling;return n.join("")}function fh(e,t){return yw(e)}function It(e){var t=e.parentNode;return t&&t.removeChild(e),e}function vw(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function _w(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(vw(e,i))}function Uo(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),_w(n,t)),n.consolidate()}const bw=/^class[ {]/;function xw(e){return bw.test(e.toString())}function Ku(e){return Array.isArray(e)}function Xu(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function gs(...e){e.length===1&&Ku(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const Ew=/constructor\s*[^(]*\(\s*([^)]*)\)/m,ww=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,Sw=/\/\*([^*]*)\*\//m;function Rw(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(xw(e)?Ew:ww);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(Sw);return(r&&r[1]||i).trim()})||[]}function dh(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(Xu(o,x))return o[x];if(Xu(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(Ku(x))x=gs(x.slice());else throw s(`Cannot invoke "${x}". Expected a function!`);const T=(x.$inject||Rw(x)).map(L=>Xu(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 gs(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,ue;for(let je in r)H=r[je],b.indexOf(je)!==-1&&(H[2]==="private"?(N=L.indexOf(H[3]),N===-1?(z=H[3].createChild([],b),ue=f(z),L.push(H[3]),A.push(z),F.push(ue),w[je]=[ue,je,"private",z]):w[je]=[F[N],je,"private",A[N]]):w[je]=[H[2],H[1]],T[je]=!0),(H[2]==="factory"||H[2]==="type")&&H[1].$scope&&b.forEach(tt=>{H[1].$scope.indexOf(tt)!==-1&&(w[je]=[H[2],H[1]],T[tt]=!0)});b.forEach(je=>{if(!T[je])throw new Error('No provider for "'+je+'". Cannot use provider from the parent!')}),x.unshift(w)}return new dh(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=gs(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],Cw(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 Cw(e,t){return e!=="value"&&Ku(t)&&(t=gs(t.slice())),t}var Pw=1e3;function Si(e,t){var n=this;t=t||Pw,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)})}Si.prototype.canRender=function(e){},Si.prototype.drawShape=function(e,t){},Si.prototype.drawConnection=function(e,t){},Si.prototype.getShapePath=function(e){},Si.prototype.getConnectionPath=function(e){};function Tr(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function Aw(e){return["M",e.x,e.y]}function Zu(e){return["L",e.x,e.y]}function Tw(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function Mw(e,t){const n=e.length,i=[Aw(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(Zu(a));continue}const c=Math.min(t,Qu(a.x-o.x,a.y-o.y),Qu(s.x-a.x,s.y-a.y));if(!c){i.push(Zu(a));continue}const u=ys(a,o,c),l=ys(a,o,c*.5),p=ys(a,s,c),f=ys(a,s,c*.5);i.push(Zu(u)),i.push(Tw(l,f,p))}return i}function ys(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=Qu(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function Qu(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function qo(e,t,n){xe(t)&&(n=t,t=null),t||(t={});const i=pe("path",t);return xe(n)&&(i.dataset.cornerRadius=String(n)),Ju(i,e)}function Ju(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return re(e,{d:Tr(Mw(t,n))}),e}function vs(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 Mr(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&&Mr(o,t,n+1)})}function el(e,t,n){var i=new Set,r=new Set;return Mr(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 Yo(e,t){return el(e)}function kw(e,t,n){xr(t)&&(t=!0),Ht(t)&&(n=t,t=!0),n=n||{};var i=Ko(n.allShapes),r=Ko(n.allConnections),o=Ko(n.enclosedElements),a=Ko(n.enclosedConnections),s=Ko(n.topLevel,t&&Xr(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 Mr(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 io(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 hh(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function mh(e){return!!(e&&e.isFrame)}function Ko(e,t){return D({},e||{},t||{})}var Dw=1;function Ki(e,t){Si.call(this,e,Dw),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(Ki,Si),Ki.prototype.canRender=function(){return!0},Ki.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}),mh(n)?re(r,D({},this.FRAME_STYLE,i||{})):re(r,D({},this.SHAPE_STYLE,i||{})),Se(t,r),r},Ki.prototype.drawConnection=function(t,n,i){var r=qo(n.waypoints,D({},this.CONNECTION_STYLE,i||{}));return Se(t,r),r},Ki.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 Tr(a)},Ki.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 Tr(o)},Ki.$inject=["eventBus","styles"];function Ow(){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=bn(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 Lw={__init__:["defaultRenderer"],defaultRenderer:["type",Ki],styles:["type",Ow]};function _t(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 tl(e,t){return!e||!t?-1:e.indexOf(t)}function Xo(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function nl(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=Xo(e,t);return Math.abs(r/o)<=i}var Iw=2;function Ri(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(Nw(r,n))return o;return!1}function Nw(e,t){const n=t[0];return Er(t,function(i){return Math.abs(n[e]-i[e])<=Iw})}function gh(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 il(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var Bw=/,?([a-z]),?/gi,yh=parseFloat,Ct=Math,Xi=Ct.PI,pi=Ct.min,fi=Ct.max,vh=Ct.pow,Zi=Ct.abs,$w=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,jw=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,_h=Array.isArray||function(e){return e instanceof Array};function Fw(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Hw(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 zw(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 Fw(r,i)?(Hw(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function Vw(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($w,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(jw,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=ol,n}function Gw(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 Ww(e){for(var t=0,n=e.length;t<n;t++){var i=e[t][0];if(i!=="M"&&i!=="C")return!1}return!0}function rl(e,t,n,i){return arguments.length===1&&(t=e.y,n=e.width,i=e.height,e=e.x),{x:e,y:t,width:n,height:i,x2:e+n,y2:t+i}}function ol(){return this.join(",").replace(Bw,"$1")}function Uw(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=ol,t}function bh(e,t,n,i,r,o,a,s,c){var u=1-c,l=vh(u,3),p=vh(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:_s(h),y:_s(m)}}function xh(e){var t=Qw(...e);return rl(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function Qi(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function qw(e,t){return e=rl(e),t=rl(t),Qi(t,e.x,e.y)||Qi(t,e.x2,e.y)||Qi(t,e.x,e.y2)||Qi(t,e.x2,e.y2)||Qi(e,t.x,t.y)||Qi(e,t.x2,t.y)||Qi(e,t.x,t.y2)||Qi(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 Eh(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 wh(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=Eh(m,e,n,r,a),R=Eh(m,t,i,o,s),E=g*g+R*R;d+=f[h]*Ct.sqrt(E)}return u*d}function Yw(e,t,n,i,r,o,a,s){if(!(fi(e,n)<pi(r,a)||pi(e,n)>fi(r,a)||fi(t,i)<pi(o,s)||pi(t,i)>fi(o,s))){var c=(e*i-t*n)*(r-a)-(e-n)*(r*s-o*a),u=(e*i-t*n)*(o-s)-(t-i)*(r*s-o*a),l=(e-n)*(o-s)-(t-i)*(r-a);if(l){var p=_s(c/l),f=_s(u/l),d=+p.toFixed(2),h=+f.toFixed(2);if(!(d<+pi(e,n).toFixed(2)||d>+fi(e,n).toFixed(2)||d<+pi(r,a).toFixed(2)||d>+fi(r,a).toFixed(2)||h<+pi(t,i).toFixed(2)||h>+fi(t,i).toFixed(2)||h<+pi(o,s).toFixed(2)||h>+fi(o,s).toFixed(2)))return{x:p,y:f}}}}function _s(e){return Math.round(e*1e11)/1e11}function Kw(e,t,n){var i=xh(e),r=xh(t);if(!qw(i,r))return[];var o=wh(...e),a=wh(...t),s=Rh(e)?1:~~(o/5)||1,c=Rh(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=bh(...e,d/s);u[d]={x:m.x,y:m.y,t:d/s}}for(d=0;d<c+1;d++)m=bh(...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=Zi(R.x-g.x)<.01?"y":"x",w=Zi(x.x-E.x)<.01?"y":"x",T=Yw(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+Zi((T[b]-g[b])/(R[b]-g[b]))*(R.t-g.t),F=E.t+Zi((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 Sh(e,t,n){e=Ah(e),t=Ah(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=Kw(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 Xw(e){return _h(e)&&_h(e[0])}function Zw(e){if(Gw(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=ol,t}function Rh(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function bs(e,t,n,i){return[e,t,n,i,n,i]}function Ch(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 Ph(e,t,n,i,r,o,a,s,c,u){var l=Xi*120/180,p=Xi/180*(+r||0),f=[],d,h=zw(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(Zi((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?Xi-L:L,A=s<w?Xi-A:A,L<0&&(L=Xi*2+L),A<0&&(A=Xi*2+A),a&&L>A&&(L=L-Xi*2),!a&&A>L&&(A=A-Xi*2)}var F=A-L;if(Zi(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=Ph(s,c,n,i,r,0,a,N,z,[A,H,w,T])}F=A-L;var ue=Ct.cos(L),je=Ct.sin(L),tt=Ct.cos(A),X=Ct.sin(A),se=Ct.tan(F/4),fe=4/3*n*se,oe=4/3*i*se,de=[e,t],ee=[e+fe*je,t-oe*ue],$=[s+fe*X,c-oe*tt],B=[s,c];if(ee[0]=2*de[0]-ee[0],ee[1]=2*de[1]-ee[1],u)return[ee,$,B].concat(f);f=[ee,$,B].concat(f).join().split(",");for(var U=[],Ae=0,wt=f.length;Ae<wt;Ae++)U[Ae]=Ae%2?h(f[Ae-1],f[Ae],p).y:h(f[Ae],f[Ae+1],p).x;return U}function Qw(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),Zi(l)<1e-12){if(Zi(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:pi(...u[0]),y0:pi(...u[1]),x1:fi(...u[0]),y1:fi(...u[1])}}function Ah(e){if(Xw(e)||(e=Vw(e)),Ww(e))return e;for(var t=Uw(Zw(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",...Ph(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",...Ch(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",...Ch(d.x,d.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...bs(d.x,d.y,f[1],f[2])];break;case"H":f=["C",...bs(d.x,d.y,f[1],d.y)];break;case"V":f=["C",...bs(d.x,d.y,d.x,f[1])];break;case"Z":f=["C",...bs(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=yh(l[p-4])||n.x,n.by=yh(l[p-3])||n.y}return t}function it(e){return Ht(e)&&_n(e,"waypoints")}function ke(e){return Ht(e)&&_n(e,"labelTarget")}function Jw(e){return Ht(e)&&Yr(e.parent)}function Th(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function Ci(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function me(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function xs(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function e1(e){return Ci({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function t1(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=r1(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 it(e)?t1(e):e1(e)}function Xt(e,t,n){n=n||0,Ht(n)||(n={x:n,y:n});var i=me(e),r=me(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 Zo(e,t,n){var i=n1(e,t);return i.length===1||i.length===2&&Xo(i[0],i[1])<1?Ci(i[0]):i.length>1?(i=ri(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),Ci(i[n?0:i.length-1])):null}function n1(e,t){return Sh(e,t)}function i1(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],Xo(n,r)===0||nl(i,r,n)?e.splice(t,1):t++;return e}function r1(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Es(e,t){return Math.round(e*t)/t}function Mh(e){return xe(e)?e+"px":e}function o1(e){for(;e.parent;)e=e.parent;return e}function a1(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"),fn(n,{position:"relative",overflow:"hidden",width:Mh(e.width),height:Mh(e.height)}),t.appendChild(n),n}function kh(e,t,n){const i=pe("g");$e(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const s1="base",Dh=0,c1=1,u1={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=a1(e),i=this._svg=pe("svg");re(i,{width:"100%",height:"100%"}),on(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")}),Se(n,i);const r=this._viewport=kh(i,"viewport");e.deferUpdate&&(this._viewboxChanged=Eu(this._viewboxChanged,300)),this._restoreFocus=Eu(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=hh(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(s1,Dh)},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 bn(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},ve.prototype._createLayer=function(e,t){typeof t>"u"&&(t=c1);const n=this._getChildIndex(t);return{group:kh(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(o1(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 at(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),$e(r).add(t)):(e.markers.delete(t),$e(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,Dh);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=u1[e];if(!Er(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),_t(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);Uo(t,l)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=Uo(t),r=a?a.matrix:hw(),s=Es(r.a,1e3),c=Es(-r.e||0,1e3),u=Es(-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),Oh(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=me(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=me(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)}),Es(i.a,1e3)};function Oh(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),Oh(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 ro="data-element-id";function On(e){this._elements={},this._eventBus=e}On.$inject=["eventBus"],On.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),re(t,ro,i),n&&re(n,ro,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},On.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(re(i.gfx,ro,""),i.secondaryGfx&&re(i.secondaryGfx,ro,""),delete t[n])},On.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)},On.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,ro,i),t},On.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&re(e,ro);var n=this._elements[t];return n&&n.element},On.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},On.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}},On.prototype.getAll=function(){return this.filter(function(e){return e})},On.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)})},On.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},On.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 l1(e,t,n,i){var r=n.inverse;return Object.defineProperty(e,"remove",{value:function(o){var a=this.indexOf(o);return a!==-1&&(this.splice(a,1),t.unset(o,r,i)),o}}),Object.defineProperty(e,"contains",{value:function(o){return this.indexOf(o)!==-1}}),Object.defineProperty(e,"add",{value:function(o,a){var s=this.indexOf(o);if(typeof a>"u"){if(s!==-1)return;a=this.length}s!==-1&&this.splice(s,1),this.splice(a,0,o),s===-1&&t.set(o,r,i)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e}function p1(e){return e.__refs_collection===!0}function f1(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function Lh(e,t,n){var i=l1(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 d1(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 jn(e,t){if(!(this instanceof jn))return new jn(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}jn.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?Lh(this,t,e):d1(this,t,e)},jn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return p1(n)||Lh(this,t,e),n},jn.prototype.ensureBound=function(e,t){f1(e,t)||this.bind(e,t)},jn.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},jn.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var al=new jn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Ih=new jn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Nh=new jn({name:"attachers",collection:!0},{name:"host"}),Bh=new jn({name:"outgoing",collection:!0},{name:"source"}),$h=new jn({name:"incoming",collection:!0},{name:"target"});function oo(){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)}}),al.bind(this,"parent"),Ih.bind(this,"labels"),Bh.bind(this,"outgoing"),$h.bind(this,"incoming")}function Qo(){oo.call(this),al.bind(this,"children"),Nh.bind(this,"host"),Nh.bind(this,"attachers")}ie(Qo,oo);function jh(){oo.call(this),al.bind(this,"children")}ie(jh,Qo);function Fh(){Qo.call(this),Ih.bind(this,"labelTarget")}ie(Fh,Qo);function Hh(){oo.call(this),Bh.bind(this,"source"),$h.bind(this,"target")}ie(Hh,oo);var h1={connection:Hh,shape:Qo,label:Fh,root:jh};function m1(e,t){var n=h1[e];if(!n)throw new Error("unknown type: <"+e+">");return D(new n,t)}function g1(e){return e instanceof oo}function Pi(){this._uid=12}Pi.prototype.createRoot=function(e){return this.create("root",e)},Pi.prototype.createLabel=function(e){return this.create("label",e)},Pi.prototype.createShape=function(e){return this.create("shape",e)},Pi.prototype.createConnection=function(e){return this.create("connection",e)},Pi.prototype.create=function(e,t){return t=D({},t||{}),t.id||(t.id=e+"_"+this._uid++),m1(e,t)};var ws="__fn",zh=1e3,y1=Array.prototype.slice;function wn(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}wn.prototype.on=function(e,t,n,i){if(e=ge(e)?e:[e],zt(t)&&(i=n,n=t,t=zh),!xe(t))throw new Error("priority must be a number");var r=n;i&&(r=mn(n,i),r[ws]=n[ws]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},wn.prototype.once=function(e,t,n,i){var r=this;if(zt(t)&&(i=n,n=t,t=zh),!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[ws]=n,this.on(e,t,o)},wn.prototype.off=function(e,t){e=ge(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},wn.prototype.createEvent=function(e){var t=new Jo;return t.init(e),t},wn.prototype.fire=function(e,t){var n,i,r,o;if(o=y1.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 Jo?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}},wn.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},wn.prototype._destroy=function(){this._listeners={}},wn.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},wn.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=v1(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},wn.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},wn.prototype._getListeners=function(e){return this._listeners[e]},wn.prototype._setListeners=function(e,t){this._listeners[e]=t},wn.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[ws]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function Jo(){}Jo.prototype.stopPropagation=function(){this.cancelBubble=!0},Jo.prototype.preventDefault=function(){this.defaultPrevented=!0},Jo.prototype.init=function(e){D(this,e||{})};function v1(e,t){return e.apply(null,t)}function kr(e){return e.childNodes[0]}function _1(e){return e.parentNode.childNodes[1]}function Ss(e,t,n,i,r){var o=Wo();o.setTranslate(t,n);var a=Wo();a.setRotate(i||0,0,0);var s=Wo();s.setScale(1,1),Uo(e,[o,a,s])}function Zt(e,t,n){var i=Wo();i.setTranslate(t,n),Uo(e,i)}function Vh(e,t){var n=Wo();n.setRotate(t,0,0),Uo(e,n)}function Ln(e,t){this._eventBus=e,this._elementRegistry=t}Ln.$inject=["eventBus","elementRegistry"],Ln.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=_1(t),n||(n=pe("g"),$e(n).add("djs-children"),Se(t.parentNode,n))):n=t,n},Ln.prototype._clear=function(e){var t=kr(e);return fs(t),t},Ln.prototype._createContainer=function(e,t,n,i){var r=pe("g");$e(r).add("djs-group"),typeof n<"u"?b1(r,t,t.childNodes[n]):Se(t,r);var o=pe("g");$e(o).add("djs-element"),$e(o).add("djs-"+e),i&&$e(o).add("djs-frame"),Se(r,o);var a=pe("g");return $e(a).add("djs-visual"),Se(o,a),o},Ln.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,mh(t))},Ln.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=bn(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)})}})},Ln.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},Ln.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},Ln.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},Ln.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},Ln.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),Zt(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")}},Ln.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);It(t.parentNode)};function b1(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const x1={__depends__:[Lw],__init__:["canvas"],canvas:["type",ve],elementRegistry:["type",On],elementFactory:["type",Pi],eventBus:["type",wn],graphicsFactory:["type",Ln]};function E1(e){var t=new dh(e);return t.init(),t}function w1(e){e=e||{};var t={config:["value",e]},n=[t,x1].concat(e.modules||[]);return E1(n)}function Ji(e,t){this._injector=t||w1(e),this.get("eventBus").fire("diagram.init")}Ji.prototype.get=function(e,t){return this._injector.get(e,t)},Ji.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},Ji.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},Ji.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function an(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function gn(e,t){return e.$instanceOf(t)}function S1(e){return at(e.rootElements,function(t){return gn(t,"bpmn:Process")||gn(t,"bpmn:Collaboration")})}function R1(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 ${an($)}`);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(Ae){l(Ae.message,{element:$,error:Ae}),console.error(`failed to import ${an($)}`,Ae)}}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 ${an(U)}`,{element:U}):i[U.id]=B:l(`no bpmnElement referenced in ${an(B)}`,{element:B})};function f($){d($.plane)}function d($){p($),M($.planeElement,h)}function h($){p($)}this.handleDefinitions=function(B,U){var Ae=B.diagrams;if(U&&Ae.indexOf(U)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!U&&Ae&&Ae.length&&(U=Ae[0]),!U)throw new Error("no diagram to display");i={},f(U);var wt=U.plane;if(!wt)throw new Error(`no plane for ${an(U)}`);var C=wt.bpmnElement;if(!C)if(C=S1(B),C)l(`correcting missing bpmnElement on ${an(wt)} to ${an(C)}`),wt.bpmnElement=C,p(wt);else throw new Error("no process or collaboration to display");var _=c(C,wt);if(gn(C,"bpmn:Process")||gn(C,"bpmn:SubProcess"))g(C,_);else if(gn(C,"bpmn:Collaboration"))de(C,_),R(B.rootElements,_);else throw new Error(`unsupported bpmnElement for ${an(wt)}: ${an(C)}`);m(n)};var m=this.handleDeferred=function(){for(var B;n.length;)B=n.shift(),B()};function g($,B){se($,B),F($.ioSpecification,B),A($.artifacts,B),o($)}function R($,B){var U=Oe($,function(Ae){return!a(Ae)&&gn(Ae,"bpmn:Process")&&Ae.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){gn(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){se(B,U),A(B.artifacts,U)};function N($,B){var U=u($,B);gn($,"bpmn:SubProcess")&&H($,U||B),gn($,"bpmn:Activity")&&F($.ioSpecification,B),n.push(function(){M($.dataInputAssociations,r(b,B)),M($.dataOutputAssociations,r(b,B))})}function z($,B){u($,B)}function ue($,B){u($,B)}function je($,B){n.push(function(){var U=u($,B);$.childLaneSet&&tt($.childLaneSet,U||B),ee($)})}function tt($,B){M($.lanes,r(je,B))}function X($,B){M($,r(tt,B))}function se($,B){fe($.flowElements,B),$.laneSets&&X($.laneSets,B)}function fe($,B){M($,function(U){gn(U,"bpmn:SequenceFlow")?n.push(function(){z(U,B)}):gn(U,"bpmn:BoundaryEvent")?n.unshift(function(){N(U,B)}):gn(U,"bpmn:FlowNode")?N(U,B):gn(U,"bpmn:DataObject")||(gn(U,"bpmn:DataStoreReference")||gn(U,"bpmn:DataObjectReference")?ue(U,B):l(`unrecognized flowElement ${an(U)} in context ${an(B&&B.businessObject)}`,{element:U,context:B}))})}function oe($,B){var U=u($,B),Ae=$.processRef;Ae&&g(Ae,U||B)}function de($,B){M($.participants,r(oe,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 De(e,t){return Fi(t,function(n){return v(e,n)})}function K(e){return e&&e.businessObject||e}function Ve(e){return e&&e.di}function C1(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 R1(p);l=l||u.diagrams&&u.diagrams[0];var d=P1(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 P1(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!v(n,"bpmn:Process")&&!v(n,"bpmn:Collaboration")&&(i=A1(n));var r;v(i,"bpmn:Collaboration")?r=i:r=at(e.rootElements,function(u){if(v(u,"bpmn:Collaboration"))return at(u.participants,function(l){return l.processRef===i})});var o=[i];r&&(o=nn(r.participants,function(u){return u.processRef}),o.push(r));var a=Gh(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 Gh(e){var t=[];return M(e,function(n){n&&(t.push(n),t=t.concat(Gh(n.flowElements)))}),t}function A1(e){for(var t=e;t;){if(v(t,"bpmn:Process"))return t;t=t.$parent}}var T1='<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>',Wh=T1,Uh={verticalAlign:"middle"},qh={color:"#404040"},M1={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},k1={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},D1={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"},O1='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+Wh+'</a><span>Web-based tooling for BPMN, DMN and forms powered by <a href="https://bpmn.io" target="_blank" rel="noopener">bpmn.io</a>.</span></div></div>',di;function L1(){di=ut(O1),fn(di,M1),fn(et("svg",di),Uh),fn(et(".backdrop",di),k1),fn(et(".notice",di),D1),fn(et(".link",di),qh,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function I1(){di||(L1(),En.bind(di,".backdrop","click",function(e){document.body.removeChild(di)})),document.body.appendChild(di)}const Rs=5,Yh="djs-outline-hidden";function ht(e){e=D({},B1,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),j1(this._container)}ie(ht,Ji),ht.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||[]),Cs(s,o),s=N1(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},ht.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},ht.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw Cs(o,[]),o}if(typeof t=="string"&&(i=$1(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw Cs(o,[]),o}try{this.clear()}catch(o){throw Cs(o,[]),o}const{warnings:r}=await C1(this,n,i);return{warnings:r}},ht.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},ht.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=et(":scope > defs",i._svg),a=fh(r),s=o?"<defs>"+fh(o)+"</defs>":"",c=i.getContainer();ft(c).add(Yh);let u;try{u=r.getBBox()}finally{ft(c).remove(Yh)}const l=u.x-Rs,p=u.y-Rs,f=u.width+Rs*2,d=u.height+Rs*2;t=`<?xml version="1.0" encoding="utf-8"?>
|
|
4
|
+
nested error: `+w.message;if(L)return a.addWarning({message:z,error:w}),!0;throw Wi(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=Si(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),ue=z.indexOf(A);ue===-1&&(ue=z.length),H?z[ue]=H:z.splice(ue,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 S(w,T){var L=c.peek();try{c.push(L.handleNode(w))}catch(A){u(A,T,o)&&c.push(new ku)}}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(Mu).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,ue){var je=T(F[ue]);return z[ue]=je,z},{}),N={name:w.name,originalName:w.originalName,attributes:H,ns:w.ns};S(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=Wi("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})})},Lu.prototype.handler=function(e){return new Ou(this.model,e)};function i0(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var r0=`<?xml version="1.0" encoding="UTF-8"?>
|
|
5
|
+
`,o0=/<|>|'|"|&|\n\r|\n/g,nd=/<|>|&/g;function si(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}si.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},si.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},si.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},si.prototype.add=function(e,t){this.uriMap[e.uri]=e,t?this.wellknown.push(e):this.custom.push(e),this.mapPrefix(e.prefix,e.uri)},si.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},si.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},si.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},si.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},si.prototype.getUsed=function(e){var t=[].concat(this.wellknown,this.custom);return t.filter(n=>{var i=this.getNSKey(n);return this.used[i]})};function a0(e){return e.charAt(0).toLowerCase()+e.slice(1)}function s0(e,t){return Qf(t)?a0(e):e}function id(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function rd(e){return _n(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function c0(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 u0(e,t){return t.isGeneric?D({localName:t.ns.localName},e):D({localName:s0(t.ns.localName,t.$pkg)},e)}function l0(e,t){return D({localName:t.ns.localName},e)}function p0(e){var t=e.$descriptor;return Oe(t.properties,function(n){var i=n.name;if(n.isVirtual||!bn(e,i))return!1;var r=e[i];return r===n.default||r===null?!1:n.isMany?r.length:!0})}var f0={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},d0={"<":"lt",">":"gt","&":"amp"};function od(e,t,n){return e=_n(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function h0(e){return od(e,o0,f0)}function m0(e){return od(e,nd,d0)}function g0(e){return Oe(e,function(t){return t.isAttr})}function y0(e){return Oe(e,function(t){return!t.isAttr})}function Iu(e){this.tagName=e}Iu.prototype.build=function(e){return this.element=e,this},Iu.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function Pr(){}Pr.prototype.serializeValue=Pr.prototype.serializeTo=function(e){e.append(this.escape?m0(this.value):this.value)},Pr.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(nd)!==-1&&(this.escape=!0),this};function Nu(e){this.tagName=e}id(Nu,Pr),Nu.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=p0(e),this.parseAttributes(g0(r)),this.parseContainments(y0(r))),this.parseGenericAttributes(e,i),this},pt.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return u0(t,e)},pt.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return l0(t,e)},pt.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},pt.prototype.nsAttributeName=function(e){var t;if(_n(e)?t=on(e):t=e.ns,e.inherited)return{localName:t.localName};var n=this.logNamespaceUsed(t);return this.getNamespaces().logUsed(n),this.isLocalNs(n)?{localName:t.localName}: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 Pr().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=on(t),o;if(r.prefix==="xmlns"&&(o={prefix:r.localName,uri:n}),!r.prefix&&r.localName==="xmlns"&&(o={uri:n}),!o)return{name:t,value:n};if(i&&i.getPackage(n))this.logNamespace(o,!0,!0);else{var a=this.logNamespaceUsed(o,!0);this.getNamespaces().logUsed(a)}},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 Pr().build(r,o[0]));else if(Wf(r.type))M(o,function(u){n.push(new Nu(t.addTagName(t.nsPropertyTagName(r))).build(r,u))});else if(a)M(o,function(u){n.push(new Iu(t.addTagName(t.nsPropertyTagName(r))).build(u))});else{var c=ed(r);M(o,function(u){var l;c?c===Jf?l=new pt(t,r):l=new Ja(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 si(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),rd(e)},pt.prototype.addAttribute=function(e,t){var n=this.attrs;_n(t)&&(t=h0(t));var i=Hf(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=c0(n).concat(t)),M(t,function(i){e.append(" ").append(rd(i.name)).append('="').append(i.value).append('"')})},pt.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==Pr;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 Ja(e,t,n){pt.call(this,e,t),this.serialization=n}id(Ja,pt),Ja.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},Ja.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function v0(){this.value="",this.write=function(e){this.value+=e}}function _0(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 b0(e){e=D({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new v0,o=new _0(r,e.format);e.preamble&&o.append(r0);var a=new pt,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(x0(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function x0(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in Mu)n[i]=Mu[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 es(e,t){jn.call(this,e,t)}es.prototype=Object.create(jn.prototype),es.prototype.fromXML=function(e,t,n){_n(t)||(n=t,t="bpmn:Definitions");var i=new Lu(D({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},es.prototype.toXML=function(e,t){var n=new b0(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var E0="BPMN20",w0="http://www.omg.org/spec/BPMN/20100524/MODEL",S0="bpmn",R0=[],C0=[{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"}]}],P0=[{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"}]}],A0={tagAlias:"lowerCase",typePrefix:"t"},T0={name:E0,uri:w0,prefix:S0,associations:R0,types:C0,enumerations:P0,xml:A0},M0="BPMNDI",k0="http://www.omg.org/spec/BPMN/20100524/DI",D0="bpmndi",O0=[{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"]}],L0=[{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"}]}],I0=[],N0={name:M0,uri:k0,prefix:D0,types:O0,enumerations:L0,associations:I0},B0="DC",$0="http://www.omg.org/spec/DD/20100524/DC",j0="dc",F0=[{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}]}],H0=[],z0={name:B0,uri:$0,prefix:j0,types:F0,associations:H0},V0="DI",G0="http://www.omg.org/spec/DD/20100524/DI",W0="di",U0=[{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"}]}],q0=[],Y0={tagAlias:"lowerCase"},K0={name:V0,uri:G0,prefix:W0,types:U0,associations:q0,xml:Y0},X0="bpmn.io colors for BPMN",Z0="http://bpmn.io/schema/bpmn/biocolor/1.0",Q0="bioc",J0=[{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"}]}],eE=[],tE=[],nE={name:X0,uri:Z0,prefix:Q0,types:J0,enumerations:eE,associations:tE},iE="BPMN in Color",rE="http://www.omg.org/spec/BPMN/non-normative/color/1.0",oE="color",aE=[{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"}]}],sE=[],cE=[],uE={name:iE,uri:rE,prefix:oE,types:aE,enumerations:sE,associations:cE};const lE={bpmn:T0,bpmndi:N0,dc:z0,di:K0,bioc:nE,color:uE};function ad(e,t){const n=D({},lE,e);return new es(n,t)}const pE={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"}},fE="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",sd="i18n",ts={[sd]:pE,[_u]:Nf};function cd(){return ad(ts)}const ud=cd();async function Bu(e){const{rootElement:t,warnings:n}=await ud.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function dE(e){const{xml:t}=await ud.toXML(e,{format:!0});return t}function $u(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const ns=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),hE=1,mE=2;function Ui(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 ld=20,pd=1;function fn(e){const t=[];for(let n=0;n+1<e.waypoints.length;n++){const i=e.waypoints[n],r=e.waypoints[n+1];Math.abs(i.y-r.y)<.5&&Math.abs(i.x-r.x)>=.5?t.push({axis:"h",at:i.y,lo:Math.min(i.x,r.x),hi:Math.max(i.x,r.x),dir:r.x>i.x?1:-1}):Math.abs(i.x-r.x)<.5&&Math.abs(i.y-r.y)>=.5&&t.push({axis:"v",at:i.x,lo:Math.min(i.y,r.y),hi:Math.max(i.y,r.y),dir:r.y>i.y?1:-1})}return t}function is(e,t){let n=null;const i=e.type!==t.type;for(const r of fn(e))for(const o of fn(t)){if(r.axis!==o.axis||Math.abs(r.at-o.at)>pd)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>=ld&&(!n||s>n.length)&&(n={axis:r.axis,length:s,kind:a})}return n}function fd(e,t){const n=is(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function gE(e,t){let n=0;for(const i of t)i.id!==e.id&&fd(e,i)&&n++;return n}function zo(e,t){let n=0;for(const i of t)i.id!==e.id&&is(e,i)&&n++;return n}const dd=15,hd=20;function yE(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-hd||t.at>n[1]+hd)return null;const i=t.axis==="v"?[e.y,e.y+e.height]:[e.x,e.x+e.width],r=Math.max(i[0],t.lo),o=Math.min(i[1],t.hi);return o>r?[r,o]:null}const ju=20;function rs(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>pd)continue;const r=Math.max(e.lo,i.lo),o=Math.min(e.hi,i.hi);o-r<ld||n.push([r-ju,o+ju])}return n}function os(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of fn(e)){const o=yE(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of rs(r,fn(a)))if(Math.min(c,o[1])>Math.max(s,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const vE=1,_E=(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 bE(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 md(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 xE=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,Vo=1;function Ri(e,t){const n=e.x+Vo,i=e.x+e.width-Vo,r=e.y+Vo,o=e.y+e.height-Vo;return t.axis==="h"?t.at>r&&t.at<o&&t.lo<i&&t.hi>n:t.at>n&&t.at<i&&t.lo<o&&t.hi>r}function Go(e){return[{axis:"h",at:e.y,lo:e.x,hi:e.x+e.width,dir:1},{axis:"h",at:e.y+e.height,lo:e.x,hi:e.x+e.width,dir:1},{axis:"v",at:e.x,lo:e.y,hi:e.y+e.height,dir:1},{axis:"v",at:e.x+e.width,lo:e.y,hi:e.y+e.height,dir:1}]}function gd(e,t){const n=e.label;if(!n)return null;if(fn(e).some(i=>Ri(n,i)))return e.id;for(const i of[...t.edges].filter(r=>r.id!==e.id).sort((r,o)=>r.id.localeCompare(o.id)))if(fn(i).some(r=>Ri(n,r)))return i.id;for(const i of t.shapes.filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(Go(i).some(r=>Ri(n,r)))return i.id;return null}function ci(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(bE(e.waypoints[o],e.waypoints[o+1],r,mE)){i.push(r);break}}return i}function EE(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 yd=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function as(e,t){let n=0;for(const i of t){if(i.id===e.id||yd(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++)EE(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function Ar(e,t){let n=0;for(const i of t)i.id===e.id||yd(e,i)||as(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function vd(e){let t=0;const n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)as(n[i],[n[r]])>0&&(t+=n[i].type===n[r].type?2:1);return t}function Fu(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(as(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 qi=e=>e.shapes.filter(t=>!t.container);function wE(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 _d(e,t){const n=e.label;if(!n)return null;for(const i of[...t.edges].sort((r,o)=>r.id.localeCompare(o.id)))if(fn(i).some(r=>Ri(n,r)))return i.id;for(const i of[...t.shapes].filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(Go(i).some(r=>Ri(n,r)))return i.id;return null}function ss(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 Yi(e){const t=[],n=e.shapes.filter(a=>!a.container);for(const a of e.edges)for(const s of ci(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(!md(c,u,hE))continue;const l=c.id<u.id?[c.id,u.id]:[u.id,c.id];t.push({kind:"shape-overlap",shapes:l,identical:xE(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=is(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=os(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=gd(a,e);s&&t.push({kind:"label-over-line",edge:a.id,line:s})}for(const a of n){if(!a.label)continue;const s=_d(a,e);s&&t.push({kind:"label-over-line",edge:a.id,line:s})}const r=ss(e);for(const a of n)if(a.type==="bpmn:TextAnnotation")for(const{owner:s,rect:c}of r)s!==a.id&&md(a,c,Vo)&&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??wE(a,e,o);if(!s)continue;const c=o.get(s);!c||!c.container||_E(c,a,vE)||t.push({kind:"shape-outside-container",shape:a.id,container:c.id})}return t.sort((a,s)=>Ui(a).localeCompare(Ui(s)))}const xt=e=>typeof e=="object"&&e!==null?e:void 0,vt=e=>typeof e=="number"?e:0,Tr=e=>{const t=xt(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function SE(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=Tr(o);a&&n.push(a)}}return n}function RE(e,t){const n=xt(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const r=Tr(n);return r?t.get(r):void 0}if(ns.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return Tr(n)}function bd(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=Tr(d),m=Tr(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 S=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:S,x:vt(E.x),y:vt(E.y),width:vt(E.width),height:vt(E.height),container:ns.has(S)&&!b,attached:(m==null?void 0:m.attachedToRef)!==void 0,...m?{parent:RE(m,r)}:{},...w?{label:{x:vt(w.x),y:vt(w.y),width:vt(w.width),height:vt(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:S,waypoints:x.map(w=>{var T,L;return{x:vt((T=xt(w))==null?void 0:T.x),y:vt((L=xt(w))==null?void 0:L.y)}}),endpoints:SE(m),...b?{label:{x:vt(b.x),y:vt(b.y),width:vt(b.width),height:vt(b.height)}}:{}})}}}return{shapes:t,edges:n}}function xd(e){return Yi(bd(e))}async function CE(e){const{definitions:t,warnings:n}=await Bu(e);return{findings:xd(t),warnings:n}}function Kt(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:vt(d.x),y:vt(d.y)})),endpoints:[Tr(r.source),Tr(r.target)].filter(d=>!!d),...f&&typeof f.x=="number"?{label:{x:f.x,y:vt(f.y),width:vt(f.width),height:vt(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&&ns.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:vt(r.width),height:vt(r.height),container:ns.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:vt(c.y),width:vt(c.width),height:vt(c.height)}}:{}})}return{shapes:t,edges:n}}const PE={"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 AE(e,t){const n=PE[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function Ed(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function wd(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 AE(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&Ed(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?Ed(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 Sd=20,TE=4,Rt=(e,t)=>Math.abs(e-t)<.5;function Rd(e,t,n,i=Sd){if(Rt(e.y,t.y)&&!Rt(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(Rt(e.x,t.x)&&!Rt(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 Cd(e,t,n=Sd){if(e.length!==4)return null;const[i,r,o,a]=e;if(Rt(i.y,r.y)&&Rt(r.x,o.x)&&Rt(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(Rt(i.x,r.x)&&Rt(r.y,o.y)&&Rt(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 Pd(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 Ad=30,ME=[0,-25,25,-40,40];function kE(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+Ad:s-Ad,u=a?i.y+i.height:i.y,l=n.x+n.width/2,p=i.x+i.width/2;return ME.map(f=>[{x:l,y:s},{x:l,y:c},{x:p+f,y:c},{x:p+f,y:u}])}const DE=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],cs=(e,t,n)=>ci({...e,waypoints:t},n).length;function Td(e,t,n,i){let r=[...e.waypoints],o=cs(e,r,t);if(o===0)return null;let a=!1;for(const p of Pd(e,t))if(cs(e,p,t)===0)return p;const s=(i??[]).filter(p=>p.id!==e.id).flatMap(fn),c=p=>fn({...e,waypoints:p}).some(f=>rs(f,s).length>0),u=kE(e,t).filter(p=>cs(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<TE&&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)||ci({...e,waypoints:[h,m]},[g]).length===0)continue;const S=Rd(h,m,g),E=S?S.map(b=>DE(r,d,b)):Cd(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=cs(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 Md(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Kt(n),o=qi(r),a=Yi(r).filter(c=>c.kind==="edge-crosses-shape"&&!t.has(Ui(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=Td(u,o,f,r.edges);d&&i.updateWaypoints(l,d)}}const OE=10;function kd(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 Dd(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=kd(i,n),a=kd(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,ue)=>z.y-ue.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=qi(t),b=t.edges.filter(z=>z.id!==e.id),w=Ar(e,b),T=ci(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=(S.x+E.x)/2,H=z=>z.filter((ue,je)=>je===0||!(Rt(ue.x,z[je-1].x)&&Rt(ue.y,z[je-1].y)));let N;for(let z=L;z<=A;z+=OE){const ue=H([S,{x:S.x,y:m},{x:z,y:m},{x:z,y:g},{x:E.x,y:g},E]),je={...e,waypoints:ue};if(ci(je,x).length>0)continue;const tt=Ar(je,b),X=Math.abs(z-F);(!N||tt<N.cross||tt===N.cross&&X<N.detour)&&(N={pts:ue,cross:tt,detour:X})}return N&&(T>0?N.cross<=w:N.cross<w)?N.pts:null}function Od(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Kt(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=Kt(n),s=a.edges.find(l=>l.id===o.id);if(!s)continue;const c=Dd(s,a);if(!c)continue;const u=n.get(o.id);u&&i.updateWaypoints(u,c)}}const no=[25,-25,40,-40],us=35;function Ld(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-us:n.y+n.height+us,p=[];for(const E of[0,...no]){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,...no]){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,...no]){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,S=s?i.y+i.height+us:i.y-us;for(const E of[0,...no]){if(Math.abs(E)>=i.width/2-5)continue;const x=o+E;for(const b of[0,...no]){if(Math.abs(b)>=n.width/2-5)continue;const w=a+b;p.push({pts:[{x:w,y:h},{x:w,y:S},{x,y:S},{x,y:g}],cost:m+Math.abs(E)+Math.abs(b)})}}return p}const ls=30;function Id(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],r=e[n+1],o=Rt(i.y,r.y)&&!Rt(i.x,r.x),a=Rt(i.x,r.x)&&!Rt(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)<ls||Math.abs(i.y-(s.y+s.height))<ls)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)<ls||Math.abs(i.x-(s.x+s.width))<ls)return!0}}return!1}const ps=40;function LE(e,t,n){let i=0;for(const r of t){if(r.container||n.includes(r.id))continue;const o=r.x-ps,a=r.x+r.width+ps,s=r.y-ps,c=r.y+r.height+ps;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 Nd(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(E=>E.container),i=new Map(t.shapes.map(E=>[E.id,E])),r=qi(t),o=t.edges.filter(E=>E.id!==e.id),a=zo(e,o),s=Ar(e,o),c=E=>LE(E,t.shapes,e.endpoints)+(Id(E,n)?1:0),u=c(e.waypoints),l=E=>{if(!E)return;const x=E.x+E.width/2,b=E.y+E.height/2;return n.find(w=>w.type==="bpmn:Lane"&&x>=w.x&&x<=w.x+w.width&&b>=w.y&&b<=w.y+w.height)},p=l(i.get(e.endpoints[0]??"")),f=l(i.get(e.endpoints[1]??"")),d=!!p&&!!f&&p.id!==f.id,h=E=>{if(!d||!f)return!1;for(let x=1;x<E.length-2;x++){const b=E[x],w=E[x+1];if(Rt(b.y,w.y)&&!Rt(b.x,w.x)&&b.y>f.y&&b.y<f.y+f.height)return!0}return!1},m=h(e.waypoints);if(!Id(e.waypoints,n)&&!(d&&!m))return null;const g=E=>E.reduce((x,b,w)=>w?x+Math.abs(b.x-E[w-1].x)+Math.abs(b.y-E[w-1].y):0,0);let S;for(const{pts:E,cost:x}of Ld(e,i)){const b={...e,waypoints:E};if(ci(b,r).length>0||zo(b,o)>a||Ar(b,o)>s)continue;const w=c(E),T=h(E);if(!(T&&!m)&&w>=u)continue;const A=T?0:1,F=g(E);(!S||A<S.lane||A===S.lane&&(w<S.sc||w===S.sc&&(x<S.cost||x===S.cost&&F<S.len)))&&(S={pts:E,sc:w,lane:A,cost:x,len:F})}return(S==null?void 0:S.pts)??null}function Bd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Kt(n).edges.filter(o=>o.type==="bpmn:SequenceFlow"&&!t.has(o.id)).map(o=>o.id).sort();for(const o of r){const a=Kt(n),s=a.edges.find(l=>l.id===o);if(!s)continue;const c=Nd(s,a);if(!c)continue;const u=n.get(o);u&&i.updateWaypoints(u,c)}}function IE(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=Rt(n[0].x,n[1].x)&&!Rt(n[0].y,n[1].y),s=Rt(n[n.length-1].x,n[n.length-2].x)&&!Rt(n[n.length-1].y,n[n.length-2].y);for(const c of no){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 $d(e,t){const n=new Map(t.shapes.map(l=>[l.id,l])),i=qi(t),r=t.edges.filter(l=>l.id!==e.id),o=zo(e,r);if(o===0)return null;const a=Ar(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=[...Ld(e,n),...IE(e,n)];for(const{pts:l,cost:p}of u){const f={...e,waypoints:l};if(ci(f,i).length>0)continue;const d=zo(f,r),h=Ar(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 jd(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Kt(i),a=Yi(o).filter(l=>(l.kind==="edge-overlap-opposite"||l.kind==="edge-overlap-mixed")&&!t.has(Ui(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=Kt(i),f=p.edges.find(m=>m.id===l);if(!f)continue;const d=$d(f,p);if(!d)continue;const h=i.get(l);h&&r.updateWaypoints(h,d)}}const NE=10,BE=(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 Fd(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!os(e,i))return null;const r=qi(t),o=i.flatMap(fn);for(const a of fn(e)){let s=[[a.lo,a.hi]];for(const[d,h]of rs(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+NE*2);if(!u)continue;const l=(u[0]+u[1])/2,p=a.axis==="h"?{x:l,y:a.at-dd}:{x:a.at+En+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(!os({...e,label:f},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&BE(f,d)))return f}return null}const En=8;function Hd(e,t){const n=e.label;if(!n)return null;const i=fn(e);if(!i.length)return null;const r=n.x+n.width/2,o=n.y+n.height/2,a=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(fn),...t.shapes.filter(f=>f.container).flatMap(Go)],u=f=>!c.some(d=>Ri(f,d));if(u(n))return null;const l=(s.axis==="v"?n.height:n.width)+En,p=[0,-l,l,-2*l,2*l];if(s.axis==="v")for(const f of[s.at+En,s.at-En-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-En-n.height,s.at+En])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 zd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Kt(n);for(const o of r.edges){if(!o.label||t.has(o.id))continue;const a=Hd(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 Vd(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Kt(i),a=Yi(o).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(Ui(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=Fd(c,o);if(!u)continue;const l=i.get(s.edge),p=l==null?void 0:l.label;p&&r.moveElements([p],{x:u.x-p.x,y:u.y-p.y})}}function Gd(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(fn),...t.shapes.filter(f=>f.container).flatMap(Go)],r=i.filter(f=>Ri(n,f));if(!r.length)return null;const o=t.shapes.filter(f=>!f.container&&f.id!==e.id),a=ss(t).filter(f=>f.owner!==e.id).map(f=>f.rect),s=(f,d)=>f.x<d.x+d.width&&d.x<f.x+f.width&&f.y<d.y+d.height&&d.y<f.y+f.height,c=f=>!i.some(d=>Ri(f,d))&&!o.some(d=>s(f,d))&&!a.some(d=>s(f,d)),u=[];for(const f of r)f.axis==="h"?u.push({...n,y:f.at-En-n.height},{...n,y:f.at+En}):u.push({...n,x:f.at-En-n.width},{...n,x:f.at+En});const l=e.x+e.width/2,p=e.y+e.height/2;return u.push({...n,x:l-n.width/2,y:e.y+e.height+En},{...n,x:l-n.width/2,y:e.y-En-n.height},{...n,x:e.x+e.width+En,y:p-n.height/2},{...n,x:e.x-En-n.width,y:p-n.height/2}),u.find(c)??null}function Wd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Kt(n);for(const o of r.shapes){if(o.container||!o.label||t.has(o.id))continue;const a=Gd(o,Kt(n));if(!a)continue;const s=n.get(o.id),c=s==null?void 0:s.label;c&&i.moveElements([c],{x:a.x-c.x,y:a.y-c.y})}}const $E=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,Ud=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),qd={"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}]},fs=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Hu=e=>typeof e=="string"&&e!=="";function jE(e){const t=[];function n(i,r,o,a){if(a===null){Hu(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!fs(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)Hu(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{if(!fs(i)||!Hu(i.kind)||!(i.kind in qd)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const o of qd[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(!fs(u))break;u=u[p]}if(!fs(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 Yd(e,t){const n=jE(e);if(n.length>0)return n;const i=[],r=new Map,o=new Map;function a(f,d,h){if(!$E.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&&Ud.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&&Ud.has(g)&&i.push({kind:"ref-category",opIndex:d,ref:m,role:"member",expected:"shape",actual:g})}break}case"element.remove":{p(d,f.id)==="lane"&&i.push({kind:"ref-category",opIndex:d,ref:f.id,role:"target",expected:"removable",actual:"lane"});break}}}),i;function p(f,d,h){if(r.has(d)){i.push({kind:"target-added-in-batch",opIndex:f,id:d});return}const m=t.categoryOf(d);if(m===void 0){i.push({kind:"ref-missing",opIndex:f,ref:d,role:"target"});return}if(h&&m!==h){i.push({kind:"ref-category",opIndex:f,ref:d,role:"target",expected:h,actual:m});return}return m}}const io={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},FE=/[ᄀ-ᇿ -〿-ヿ㐀-鿿가--⦆]/;function HE(e){const t=io;return FE.test(e)?t.cjkEm:e===" "?t.spaceEm:e>="0"&&e<="9"?t.digitEm:e>="A"&&e<="Z"?t.upperEm:e>="a"&&e<="z"?t.lowerEm:t.otherEm}function Wo(e,t){let n=0;for(const i of e)n+=t*HE(i);return n}function Kd(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&zE(e),VE(e),GE(e),WE(e)}function zE(e){var i;const t=(i=e.HTMLCanvasElement)==null?void 0:i.prototype;if(!t||t.__headlessTextMeasurement)return;t.__headlessTextMeasurement=!0;const n={font:"12px sans-serif",letterSpacing:"0px",measureText(r){var a;const o=Number.parseFloat(((a=String(n.font).match(/(\d+(?:\.\d+)?)px/))==null?void 0:a[1])??"12");return{width:Wo(r,o),fontBoundingBoxAscent:o*io.ascentEm,fontBoundingBoxDescent:o*io.descentEm,actualBoundingBoxAscent:o*io.ascentEm,actualBoundingBoxDescent:o*io.descentEm}}};t.getContext=()=>n}function VE(e){if(e.SVGMatrix)return;class t{constructor(){Kr(this,"a",1);Kr(this,"b",0);Kr(this,"c",0);Kr(this,"d",1);Kr(this,"e",0);Kr(this,"f",0)}static of(i,r,o,a,s,c){return Object.assign(new t,{a:i,b:r,c:o,d:a,e:s,f:c})}multiply(i){return t.of(this.a*i.a+this.c*i.b,this.b*i.a+this.d*i.b,this.a*i.c+this.c*i.d,this.b*i.c+this.d*i.d,this.a*i.e+this.c*i.f+this.e,this.b*i.e+this.d*i.f+this.f)}translate(i,r){return this.multiply(t.of(1,0,0,1,i,r))}scale(i,r=i){return this.multiply(t.of(i,0,0,r,0,0))}inverse(){const i=this.a*this.d-this.b*this.c;return t.of(this.d/i,-this.b/i,-this.c/i,this.a/i,(this.c*this.f-this.d*this.e)/i,(this.b*this.e-this.a*this.f)/i)}}e.SVGMatrix=t}function GE(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 WE(e){const t=e.SVGElement.prototype;if(!t.getCTM){const n=()=>new e.SVGMatrix;t.getCTM=n,t.getScreenCTM=n}t.getBBox||(t.getBBox=function(){const n=String(this.textContent??"");return{x:0,y:0,width:Wo(n,12),height:14}})}function Xd(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 ds(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const zu={"top-left":[-1,-1],top:[0,-1],"top-right":[1,-1],right:[1,0],"bottom-right":[1,1],bottom:[0,1],"bottom-left":[-1,1],left:[-1,0]};function Xt(e,t){return e.filter(n=>n.kind===t)}function Zd(e,t){var dx,hx,mx,gx,yx;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 P=l(R);if(!P)throw new Error(`하강 참조 해소 실패: ${R}`);return P},f=R=>{let P=R.parent;for(;P;){if(P.type==="bpmn:Participant")return P;P=P.parent}},d=Xt(e,"participant.add"),h=Xt(e,"node.add"),m=Xt(e,"sequenceFlow.add"),g=Xt(e,"messageFlow.add"),S=Xt(e,"dataStore.add"),E=Xt(e,"dataAssociation.add"),x=Xt(e,"annotation.add"),b=Xt(e,"group.add"),w=new Map(h.map(R=>[R.node.id,R])),T=(R,P,O)=>{var Ce;const V=R.businessObject,G=(((Ce=V.extensionElements)==null?void 0:Ce.values)??[]).filter(J=>J.$type!==P),j=O?[...G,i.create(P,O)]:G;if(!j.length){V.extensionElements&&n.updateProperties(R,{extensionElements:void 0});return}const Z=i.create("bpmn:ExtensionElements",{values:j});j.forEach(J=>{J.$parent=Z}),n.updateProperties(R,{extensionElements:Z})},L=R=>({anchor:R.anchor,side:R.side,...R.offset!==void 0?{offset:R.offset}:{}});for(const R of Xt(e,"element.remove")){const P=l(R.id);P&&n.removeElements([P])}const A=R=>o.filter(P=>{var O;return P.type==="bpmn:Lane"&&((O=f(P))==null?void 0:O.id)===R}).sort((P,O)=>P.y-O.y);for(const R of Xt(e,"participant.update")){const P=p(R.id);if(R.name!==void 0&&n.updateProperties(P,{name:R.name??void 0}),!R.lanes)continue;const O=A(R.id);if(!O.length){n.splitLane(P,R.lanes.length),A(R.id).forEach((G,j)=>{const Z=R.lanes[j];Z&&n.updateProperties(G,{id:Z.id,name:Z.name})});continue}const V=new Set(O.map(G=>G.id));R.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(R.id)[0],"top"):n.addLane(p(R.lanes[j-1].id),"bottom");n.updateProperties(Z,{id:G.id,name:G.name})})}const F=150,H=80,N=90,z=180,ue=new Set;for(const R of d){ue.add(`pool:${R.participant.id}`);for(const P of R.participant.lanes??[])ue.add(P.id)}const je=new Map;for(const R of h){const P=R.node.lane??`pool:${R.node.participant??""}`;let O=je.get(P);O||je.set(P,O=new Set([0])),R.band!==void 0&&O.add(R.band)}const tt=new Map;for(const[R,P]of je){if(!ue.has(R))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);tt.set(R,new Map(O.map((j,Z)=>[j,V[Z]-G])))}{const R=new Map;for(const P of d)(P.participant.lanes??[]).forEach((O,V)=>R.set(O.id,V));for(const[P,O]of tt){if(!R.has(P)||O.size<2)continue;const V=R.get(P),G=O.get(0)??0,j=new Set;for(const Fe of h){if(Fe.node.lane!==P||(Fe.band??0)!==0||!Fe.node.type.endsWith("Gateway"))continue;const Pe={in:new Set,out:new Set,cross:new Set};for(const _e of m){const st=_e.flow.source===Fe.node.id;if(!st&&_e.flow.target!==Fe.node.id)continue;const qt=w.get(st?_e.flow.target:_e.flow.source);if(!qt||qt.node.participant!==Fe.node.participant||!qt.node.lane)continue;let Qn,ln=!1;if(qt.node.lane!==P){const $n=R.get(qt.node.lane);if($n===void 0)continue;Qn=$n>V?"down":"up",ln=!0}else{const $n=O.get(qt.band??0)??G;Qn=$n>G?"down":$n<G?"up":void 0}Qn&&(Pe[st?"out":"in"].add(Qn),ln&&Pe.cross.add(Qn))}for(const _e of["up","down"])Pe.in.has(_e)&&Pe.out.has(_e)&&Pe.cross.has(_e)&&j.add(_e)}if(j.size!==1)continue;const[Z]=j,Ce=Math.max(...O.values()),J=Z==="down"?Ce:0;if(G===J)continue;const be=[...O.entries()].filter(([Fe])=>Fe!==0).sort((Fe,Pe)=>Fe[1]-Pe[1]),Ke=[...Array(Ce+1).keys()].filter(Fe=>Fe!==J),lt=new Map([[0,J]]);be.forEach(([Fe],Pe)=>lt.set(Fe,Ke[Pe])),tt.set(P,lt)}}const X=R=>{var P;return(((P=je.get(R))==null?void 0:P.size)??0)>1},se=R=>R.band??(R.node.lane||!X(`pool:${R.node.participant??""}`)?void 0:0),fe=new Map,oe=R=>fe.get(R.node.id)??se(R),de=new Set,ee=new Set;{const R=new Map;for(const V of m)R.set(V.flow.target,(R.get(V.flow.target)??0)+1);const P=V=>{const G=[],j=new Set([V]),Z=[V];for(;Z.length;){const Ce=Z.shift();G.push(Ce);for(const J of m)J.flow.source!==Ce||j.has(J.flow.target)||(R.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=tt.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=tt.get(G);if(!j||j.size<2)continue;const Z=oe(V);if(Z===void 0||O(G,Z)!==O(G,0))continue;const Ce=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 st=oe(_e);return st!==void 0&&O(G,st)===Ce&&(R.get(_e.node.id)??0)===1}),Ke=J.some(_e=>{const st=oe(_e);return st!==void 0&&O(G,st)>Ce});if(be.length!==1||!Ke)continue;const lt=new Set(J.flatMap(_e=>P(_e.node.id)));if(!m.some(_e=>_e.flow.target===V.node.id&<.has(_e.flow.source)))continue;const Pe=new Map;for(const[_e,st]of j)Pe.set(_e,st+1);Pe.set(-1,0),tt.set(G,Pe);for(const _e of P(be[0].node.id))w.has(_e)&&(fe.set(_e,-1),ee.add(_e));de.add(V.node.id)}}const $=(R,P)=>{var O;return((O=tt.get(R))==null?void 0:O.get(P))??P},B=new Map;for(const[R,P]of je){let O=0;for(const V of P)O=Math.max(O,$(R,V));B.set(R,O)}const U=R=>z+F*R,Ae=d.map((R,P)=>({op:R,declared:P}));Ae.sort((R,P)=>{const O=R.op.order??Number.POSITIVE_INFINITY,V=P.op.order??Number.POSITIVE_INFINITY;return O!==V?O-V:R.declared-P.declared});let wt=80;for(const R of o.getAll())R.parent===u()&&"height"in R&&typeof R.y=="number"&&(wt=Math.max(wt,R.y+R.height+60));for(const{op:R}of Ae){const P=R.participant,O=h.filter(Fe=>Fe.node.participant===P.id).length,V=((dx=P.lanes)==null?void 0:dx.length)??0,G=Math.max(1200,O*160+300),j=(P.lanes??[]).map(Fe=>U(B.get(Fe.id)??0)),Z=j.reduce((Fe,Pe)=>Fe+Pe,0);V&&Z<300&&(j[V-1]+=300-Z);const Ce=Math.max(300,F*((B.get(`pool:${P.id}`)??0)+1)),J=P.blackBox||O+V===0?120:V?Math.max(300,Z):Ce,be=r.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:P.id,name:P.name,...R.order!==void 0?{"bwl:poolOrder":R.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()),lt=P.lanes??[];if(lt.length&&n.splitLane(Ke,lt.length),lt.length){const Fe=o.filter(Pe=>{var _e;return Pe.type==="bpmn:Lane"&&((_e=f(Pe))==null?void 0:_e.id)===P.id}).sort((Pe,_e)=>Pe.y-_e.y);if(Fe.forEach((Pe,_e)=>{const st=lt[_e];st&&n.updateProperties(Pe,{id:st.id,name:st.name})}),j.some(Pe=>Pe!==Ke.height/V)){let Pe=Ke.y;Fe.forEach((_e,st)=>{const qt=j[st];n.resizeShape(_e,{x:_e.x,y:Pe,width:_e.width,height:qt}),Pe+=qt})}}wt=Ke.y+Ke.height+60}const C=R=>{var V;const P=w.get(R);if(P)return P.node.participant??"";const O=l(R);return O?O.type==="bpmn:Participant"?O.id:((V=f(O))==null?void 0:V.id)??"":""},_=new Map,y=R=>{let P=_.get(R);return P||_.set(R,P={nodes:[],flows:[]}),P};for(const R of h)y(R.node.participant??"").nodes.push(R);for(const R of m)y(C(R.flow.source)).flows.push(R);const k=R=>{var P;return i.create("bpmn:SequenceFlow",{id:R.id,name:R.name??((P=R.condition)==null?void 0:P.label)})},I=(R,P)=>r.createShape({type:ds(R.type),businessObject:i.create(ds(R.type),{id:R.id,name:R.name,...P!==void 0?{"bwl:band":P}:{}})}),W=[...Ae.map(({op:R})=>R.participant.id).filter(R=>_.has(R)),...[..._.keys()].filter(R=>!d.some(P=>P.participant.id===R))],ae=R=>R.endsWith("Gateway");for(const R of W){const P=_.get(R),O=R?p(R):void 0,V=O?O.x+150:250;let G=O?O.y+80:120;const j=(ne,he,le)=>{const Ze=u().children.filter(qe=>!("waypoints"in qe&&qe.waypoints)&&qe.id!==he&&typeof qe.y=="number"&&qe.y>=ne);Ze.length&&n.moveElements(Ze,{x:0,y:le})},Z=(ne,he)=>{if(ne){const Me=p(ne),Xe=U(he);if(Me.height>=Xe)return;const Ht=Xe-Me.height,ce=f(Me),We=ce?ce.y+ce.height:Me.y+Me.height;n.resizeLane(Me,{x:Me.x,y:Me.y,width:Me.width,height:Xe},!1),j(We,ce==null?void 0:ce.id,Ht);return}if(!O)return;const le=F*(he+1);if(O.height>=le)return;const Ze=le-O.height,qe=O.y+O.height;n.resizeShape(O,{x:O.x,y:O.y,width:O.width,height:le}),j(qe,O.id,Ze)},Ce=(ne,he,le)=>{if(ne){const Ze=p(ne);return Ze.y+Math.min(Ze.height/2,N)+$(ne,he??0)*F}return he!==void 0&&O?O.y+H+$(`pool:${R}`,he)*F:le},J=(ne,he,le)=>{if(ne){const Ze=p(ne);return Ze.y+Math.min(Ze.height/2,N)+he*F}return O?O.y+H+he*F:le},be=ne=>ne.participant?p(ne.participant):u(),Ke=30,lt=(ne,he,le,Ze)=>{const qe=le-he.width/2,Me=Ze-he.height/2;return(ne.children??[]).find(Xe=>!("waypoints"in Xe&&Xe.waypoints)&&Xe.type!=="bpmn:Lane"&&Xe.type!=="label"&&typeof Xe.x=="number"&&qe<Xe.x+Xe.width+Ke&&qe+he.width+Ke>Xe.x&&Me<Xe.y+Xe.height&&Me+he.height>Xe.y)},Fe=(ne,he,le,Ze,qe,Me)=>{const Xe=le!==void 0||Ze!==void 0,Ht=$(le??`pool:${R}`,Ze??0);if(Xe)for(let Le=0;Le<4;Le++){const Ne=J(le,Ht+Le,Me);if(!lt(ne,he,qe,Ne))return Z(le,Ht+Le),{x:qe,y:Ne}}const ce=Ce(le,Ze,Me);Xe&&Z(le,Ht);let We=qe;for(let Le=0;Le<64;Le++){const Ne=lt(ne,he,We,ce);if(!Ne)break;We=Ne.x+Ne.width+130+he.width/2}return{x:We,y:ce}},Pe=new Set(P.flows.map(ne=>ne.flow.target)),_e=new Map;for(const ne of P.nodes){if(Pe.has(ne.node.id))continue;const he=I(ne.node,ne.band),le=se(ne),Ze=ne.node.lane?`${ne.node.lane}|${le??""}`:le!==void 0?`band:${le}`:"",qe=be(ne.node),Me=Fe(qe,he,ne.node.lane,le,_e.get(Ze)??V,G);n.createShape(he,Me,qe),_e.set(Ze,Me.x+he.width+130),!ne.node.lane&&le===void 0&&(G+=160)}const st=new Set,qt=new Map,Qn=new Map,ln=new Map;if(R&&ue.has(`pool:${R}`)){const ne=new Map;for(const ce of P.flows)ne.set(ce.flow.target,(ne.get(ce.flow.target)??0)+1);const he=ce=>Ce(ce.node.lane,oe(ce),Number.NaN),le=new Set,Ze=ce=>{var Ne;const We=(Ne=w.get(ce))==null?void 0:Ne.node.participant;if(We)return l(We);const Le=l(ce);if(Le)return Le.type==="bpmn:Participant"?Le:f(Le)},qe=ce=>{const We=[],Le=new Set([ce]),Ne=[ce];for(;Ne.length;){const dt=Ne.shift(),Qe=w.get(dt);Qe&&We.push(Qe);for(const Ee of P.flows)Ee.flow.source!==dt||Le.has(Ee.flow.target)||(ne.get(Ee.flow.target)??0)!==1||(Le.add(Ee.flow.target),Ne.push(Ee.flow.target))}return We},Me=ce=>{if(!O)return;const We=new Set(ce.map(dt=>dt.node.id));let Le=!1,Ne=!1;for(const dt of g){if(!We.has(dt.flow.source))continue;const Qe=Ze(dt.flow.target);!Qe||Qe.id===O.id||(Qe.y<O.y?Le=!0:Ne=!0)}return Le&&!Ne?"up":Ne&&!Le?"down":void 0};for(const ce of P.nodes){if(!ae(ce.node.type))continue;const We=Ce(ce.node.lane,se(ce),Number.NaN);if(Number.isNaN(We))continue;const Le=[];for(const Ee of P.flows){if(Ee.flow.source!==ce.node.id)continue;const ze=w.get(Ee.flow.target);if(!ze||ze.node.lane!==ce.node.lane||(ne.get(ze.node.id)??0)!==1)continue;const Je=se(ze);if(Je===void 0)continue;const mn=Ce(ze.node.lane,Je,Number.NaN);if(Number.isNaN(mn))continue;const Yr=qe(ze.node.id),Yt=Me(Yr);Yt&&Le.push({subtree:Yr,band:Je,row:mn,dir:Yt})}if(!Le.some(Ee=>Ee.dir==="up")||!Le.some(Ee=>Ee.dir==="down")||!Le.some(Ee=>Ee.dir==="up"&&Le.some(ze=>ze.dir==="down"&&ze.row<Ee.row)))continue;const dt=[...Le].sort((Ee,ze)=>Ee.row-ze.row);[...Le.filter(Ee=>Ee.dir==="up"),...Le.filter(Ee=>Ee.dir==="down")].sort((Ee,ze)=>Ee.dir===ze.dir?Ee.row-ze.row:Ee.dir==="up"?-1:1).forEach((Ee,ze)=>{const Je=dt[ze].band;if(Je!==Ee.band){le.add(ce.node.id);for(const mn of Ee.subtree)se(mn)===Ee.band&&fe.set(mn.node.id,Je)}})}const Xe=ce=>{if(!O)return;const We=new Set(ce.map(dt=>dt.node.id));let Le=!1,Ne=!1;for(const dt of g){if(!We.has(dt.flow.target))continue;const Qe=Ze(dt.flow.source);!Qe||Qe.id===O.id||(Qe.y<O.y?Le=!0:Ne=!0)}return Le&&!Ne?"up":Ne&&!Le?"down":void 0};for(const ce of P.nodes){if(!ae(ce.node.type))continue;const We=ce.node.lane??`pool:${R}`,Le=tt.get(We);if(!Le||Le.size<2)continue;const Ne=Le.get(0);if(Ne===void 0)continue;const dt=Math.max(...Le.values()),Qe=Ne===dt&&Ne!==0?"down":void 0;if(!Qe)continue;const Ee=[];for(const Yt of P.flows){if(Yt.flow.source!==ce.node.id)continue;const Jn=w.get(Yt.flow.target);if(!Jn||Jn.node.lane!==ce.node.lane||(ne.get(Jn.node.id)??0)!==1)continue;const vx=oe(Jn);vx!==void 0&&Ee.push({t:Jn,subtree:qe(Jn.node.id),band:vx})}const ze=Ee.find(Yt=>(Le.get(Yt.band)??Yt.band)===Ne);if(!ze||Xe(ze.subtree)===Qe||Me(ze.subtree)===Qe)continue;const Je=Ee.find(Yt=>Yt!==ze&&Xe(Yt.subtree)===Qe);if(!Je)continue;const mn=ze.band,Yr=Je.band;for(const Yt of ze.subtree)oe(Yt)===mn&&fe.set(Yt.node.id,Yr);for(const Yt of Je.subtree)oe(Yt)===Yr&&fe.set(Yt.node.id,mn);le.add(ce.node.id)}for(const ce of P.nodes){if(!ae(ce.node.type))continue;const We=he(ce);if(Number.isNaN(We)||x.some(Ee=>{var ze,Je;return(((ze=Ee.placement)==null?void 0:ze.anchor)??(Ee.association?Ee.association.source===Ee.annotation.id?Ee.association.target:Ee.association.source:void 0))===ce.node.id&&((Je=Ee.placement)==null?void 0:Je.side.startsWith("bottom"))}))continue;let Ne,dt=!1,Qe;for(const Ee of P.flows){if(Ee.flow.source!==ce.node.id)continue;const ze=w.get(Ee.flow.target);if(!ze||!ze.node.lane&&se(ze)===void 0)continue;const Je=he(ze);Number.isNaN(Je)||(Math.abs(Je-We)<.5&&(dt=!0),Je>We?!Ne||Je>Ne.row?Ne={id:ze.node.id,row:Je,count:1}:Je===Ne.row&&Ne.count++:Je<We&&ze.node.lane===ce.node.lane&&(!Qe||Je>Qe.row?Qe={op:ze,row:Je,count:1}:Je===Qe.row&&Qe.count++))}Ne&&Ne.count===1&&(ne.get(Ne.id)??0)===1&&!le.has(ce.node.id)&&st.add(Ne.id),!dt&&Qe&&Qe.count===1&&(ne.get(Qe.op.node.id)??0)===1&&!de.has(ce.node.id)&&qt.set(Qe.op.node.id,{lane:ce.node.lane,band:oe(ce)})}const Ht=new Map;for(const ce of g)Ht.set(ce.flow.target,[...Ht.get(ce.flow.target)??[],ce]);for(const ce of P.nodes){const We=Ht.get(ce.node.id);if(!We||We.length!==1||!ne.get(ce.node.id)||!ce.node.lane&&se(ce)===void 0||ee.has(ce.node.id))continue;const Le=(hx=w.get(We[0].flow.source))==null?void 0:hx.node.participant,Ne=Le?l(Le):void 0;if(!Ne||!O||Ne.id===O.id)continue;const dt=ce.node.lane??`pool:${R}`,Qe=tt.get(dt);if(!Qe)continue;const Ee=Qe.get(0)??0,ze=(Qe.get(oe(ce)??0)??Ee)-Ee;if(ze===0)continue;const Je=Ne.y<O.y;if(Je&&ze<0||!Je&&ze>0)continue;let mn;for(const[Yr,Yt]of Qe){const Jn=Yt-Ee;(Je&&Jn<0&&(!mn||Jn<mn.row)||!Je&&Jn>0&&(!mn||Jn>mn.row))&&(mn={band:Yr,row:Jn})}mn&&Qn.set(ce.node.id,{lane:ce.node.lane,band:mn.band})}}const $n=new Set;let vu=0;for(;vu++<P.nodes.length+2;){for(let le=0;le<P.nodes.length+P.flows.length+2;le++){let Ze=!1;for(const qe of P.flows){const Me=qe.flow;if($n.has(Me.id))continue;const Xe=l(Me.source);if(!Xe)continue;const Ht=l(Me.target),ce=w.get(Me.target);if(!Ht&&ce){const We=I(ce.node,ce.band),Le=oe(ce);if(ce.node.lane||Le!==void 0){const Ne=be(ce.node),dt=Xe,Qe=dt.x+(ln.get(Me.source)??0)+dt.width+130,Ee=qt.get(Me.target)??Qn.get(Me.target),ze=Fe(Ne,We,Ee?Ee.lane:ce.node.lane,Ee?Ee.band:Le,st.has(Me.target)?dt.x+dt.width/2:Qe,Number.NaN),Je=n.createShape(We,ze,Ne);st.has(Me.target)&&ln.set(Me.target,Qe-(Je.x+Je.width/2)),n.connect(Xe,Je,{type:"bpmn:SequenceFlow",businessObject:k(Me)})}else s.append(Xe,We,{connection:{type:"bpmn:SequenceFlow",businessObject:k(Me)}})}else if(Ht)n.connect(Xe,Ht,{type:"bpmn:SequenceFlow",businessObject:k(Me)});else continue;$n.add(Me.id),Ze=!0}if(!Ze)break}const ne=P.nodes.filter(le=>!l(le.node.id));if(!ne.length)break;const he=ne[0];{const le=I(he.node,he.band),Ze=be(he.node),qe=se(he);n.createShape(le,Fe(Ze,le,he.node.lane,qe,V,G),Ze),!he.node.lane&&qe===void 0&&(G+=160)}}}const Te=40,He=(R,P=()=>!0)=>{const O=l(R);if(!O)return[];const V=[O],G=new Set([R]);for(let j=0;j<V.length;j++){const Z=V[j].id;for(const Ce of m){const J=Ce.flow.target;if(Ce.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 R of Xt(e,"sequenceFlow.update")){if(R.target===void 0)continue;const P=w.get(R.target);if(!P)continue;const O=l(R.target),V=l(R.id);if(!O||!V)continue;const G=R.source!==void 0?l(R.source):V.source,j=V.target;if(!G||!j||j.id===O.id)continue;const Z=He(R.target),Ce=new Set(Z.map(Pe=>Pe.id)),J=Math.min(...Z.map(Pe=>Pe.x)),be=Math.max(...Z.map(Pe=>Pe.x+Pe.width)),Ke=G.x+G.width,lt=be-J+Te*2-(j.x-Ke);if(lt>0){const Pe=f(O),_e=(Pe==null?void 0:Pe.children)??[],st=ln=>ln.type==="bpmn:Lane",qt=_e.filter(ln=>!("waypoints"in ln&&ln.waypoints)&&!st(ln)&&!Ce.has(ln.id)&&ln.x>=j.x),Qn=Pe?[Pe,..._e.filter(ln=>st(ln))]:[];qt.length&&n.createSpace(qt,Qn,{x:lt,y:0},"e",j.x-1)}const Fe=P.node.lane||P.band!==void 0?O.y+O.height/2:G.y+G.height/2;n.moveElements(Z,{x:Ke+Te-J,y:Fe-(O.y+O.height/2)})}const bt=(R,P)=>{const O=P.target===R,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 R of S){const P=R.associations??[],O=P.map(j=>j.source===R.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:R.dataStore.id,name:R.dataStore.name})},G,V);for(const j of P)bt(R.dataStore.id,j)}for(const R of E){const O=p(R.association.target).type==="bpmn:DataStoreReference"?R.association.target:R.association.source;bt(O,R.association)}const nt=100,Dt=R=>{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,Ce=Z?l(Z):void 0;Ce&&typeof Ce.x=="number"&&Ce.type!=="bpmn:Participant"&&V.push(Ce)}if(!V.length)continue;const G=Math.max(...V.map(j=>j.x+j.width/2))+nt;if(G>O.x+O.width&&n.resizeShape(O,{x:O.x,y:O.y,width:G-O.x,height:O.height}),!!R)for(const j of g){const Z=l(j.flow.id),Ce=j.flow.source===P.participant.id?j.flow.target:j.flow.target===P.participant.id?j.flow.source:void 0,J=Ce?l(Ce):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,lt=Ke?J.y+J.height:J.y,Fe=Ke?O.y:O.y+O.height,Pe=j.flow.source===P.participant.id?[{x:be,y:Fe},{x:be,y:lt}]:[{x:be,y:lt},{x:be,y:Fe}],_e=Kt(o),st={..._e.edges.find(qt=>qt.id===j.flow.id),waypoints:Pe};ci(st,qi(_e)).length||n.updateWaypoints(Z,Pe)}}};Dt(!1);for(const R of g){const P=R.flow;n.connect(p(P.source),p(P.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:P.id,name:P.name})})}const Ut=100,un=30,ct=4,jt=R=>!("waypoints"in R&&R.waypoints)&&R.type!=="bpmn:Lane"&&R.type!=="label"&&typeof R.x=="number",Ft=()=>{const R=Kt(o);return{bad:Yi(R).filter(P=>P.kind==="edge-crosses-shape"||P.kind==="edge-overlap-opposite"||P.kind==="edge-overlap-mixed").length,crossings:vd(R),straight:R.edges.filter(P=>P.type==="bpmn:MessageFlow"&&P.waypoints.length===2).length}},qr=R=>{const P=Kt(o),O=P.edges.find(V=>V.id===R);return!!O&&ci(O,qi(P)).length>0},kn=(R,P,O)=>{const V=new Set(R.map(be=>be.id)),G=(P.children??[]).filter(jt).filter(be=>!V.has(be.id));if(R.some(be=>G.some(Ke=>be.x+O<Ke.x+Ke.width+un&&be.x+O+be.width+un>Ke.x&&be.y<Ke.y+Ke.height&&be.y+be.height>Ke.y)))return null;const Z=P.width;n.moveElements(R,{x:O,y:0});const J=Math.max(...R.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(R,{x:-O,y:0}),J>0&&n.resizeShape(P,{x:P.x,y:P.y,width:Z,height:P.height})}},ii=(R,P)=>P.bad>R.bad||P.crossings>R.crossings&&P.straight<=R.straight,Bn=(R,P,O,V=()=>!0)=>{const G=Ft(),j=kn(R,P,O);if(!j)return!1;const Z=Ft();return ii(G,Z)||!V()?(j(),!1):!0},Ot=R=>{var O;const P=(O=w.get(R))==null?void 0:O.node.participant;return!!P&&ue.has(`pool:${P}`)},ri=new Map;for(const R of g){if(!Ot(R.flow.target))continue;const P=ri.get(R.flow.target)??[];P.push(R),ri.set(R.flow.target,P)}const Bo=[...ri.keys()],Dn=new Set(m.map(R=>R.flow.target)),Ue=R=>Ae.findIndex(({op:P})=>P.participant.id===R);Bo.sort((R,P)=>{var G,j;const O=Dn.has(R)?1:0,V=Dn.has(P)?1:0;return O!==V?O-V:Ue((G=w.get(R))==null?void 0:G.node.participant)-Ue((j=w.get(P))==null?void 0:j.node.participant)});const Ye=R=>R.x+R.width/2,sx=R=>{let P;for(const O of ri.get(R)??[]){const V=l(O.flow.source);if(!V)continue;const G=Ye(V);(!P||G>P.cx)&&(P={op:O,cx:G})}return P==null?void 0:P.op},DD=R=>{const P=sx(R),O=l(R),V=P?l(P.flow.source):void 0;return O&&V?Ye(V)-Ye(O):void 0},OD=R=>{const P=DD(R);return P!==void 0&&Math.abs(P)<Ut},Of=R=>{const P=sx(R);if(!P)return null;const O=l(R),V=l(P.flow.source);if(!O||!V)return null;const G=Ye(V)-Ye(O);if(G>=Ut){const j=p(w.get(R).node.participant);return{subtree:He(R,Z=>Z.x>=O.x),pool:j,dx:G}}if(-G>=Ut&&Ot(P.flow.source)){const j=p(w.get(P.flow.source).node.participant);return{subtree:He(P.flow.source,Z=>Z.x>=V.x&&!OD(Z.id)),pool:j,dx:-G}}return null},cx=()=>Bo.map(R=>({id:R,plan:Of(R)})).filter(R=>!!R.plan).sort((R,P)=>Math.min(...R.plan.subtree.map(O=>O.x))-Math.min(...P.plan.subtree.map(O=>O.x))).map(R=>R.id);for(let R=0;R<3;R++){const P=Ft(),O=[];for(const G of cx()){const j=Of(G);if(!j)continue;const Z=kn(j.subtree,j.pool,j.dx);Z&&O.push(Z)}if(!O.length)break;if(!ii(P,Ft()))continue;for(const G of O.reverse())G();let V=!1;for(const G of cx()){const j=Of(G);j&&Bn(j.subtree,j.pool,j.dx)&&(V=!0)}if(!V)break}for(const R of Bo.flatMap(P=>ri.get(P)??[])){if(!qr(R.flow.id))continue;const P=l(R.flow.target);if(!P)continue;const O=p(w.get(R.flow.target).node.participant),V=He(R.flow.target,j=>j.x>=P.x),G=P.width+130;for(let j=1;j<=ct&&!Bn(V,O,G*j,()=>!qr(R.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||!ue.has(`pool:${j}`))continue;const Z=m.filter(be=>be.flow.target===V);if(Z.length!==1)continue;const Ce=l(Z[0].flow.source),J=l(V);!Ce||!J||!w.has(Ce.id)||Math.abs(P(Ce)-P(J))>1||J.x-(Ce.x+Ce.width)<=131||O.push({id:V,pred:Ce,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(Pe=>Pe.flow.target===V).flow.source);if(!j||!Z)continue;const Ce=j.x-(Z.x+Z.width);if(Ce<=131)continue;const J=p(G.node.participant),be=He(V,Pe=>Pe.x>=j.x),Ke=Ft(),lt=kn(be,J,-(Ce-130));if(!lt)continue;const Fe=Ft();(Fe.bad>Ke.bad||Fe.crossings>=Ke.crossings)&<()}}Dt(!0);let ux=0;for(const R of b){const P=(R.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,Ce=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:Ce-j,height:J-Z}}else V={x:300+ux*350,y:40,width:300,height:200},ux++;const G=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:R.group.id}),width:V.width,height:V.height},{x:V.x+V.width/2,y:V.y+V.height/2},u());R.group.name&&n.updateLabel(G,R.group.name),(mx=R.group.members)!=null&&mx.length&&T(G,"bwl:Members",{refs:R.group.members.join(" ")})}const lx=R=>{const P=R.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=R;return{x:O.x,y:O.y,width:O.width,height:O.height}};let qa=0;const px=12,fx=14,LD=15,ID=300,ND=R=>{const P=R.split(`
|
|
7
|
+
`),O=Math.max(...P.map(j=>Wo(j,px))),V=Math.max(100,Math.min(ID,Math.ceil(O)+fx)),G=P.reduce((j,Z)=>j+Math.max(1,Math.ceil((Wo(Z,px)+fx)/V)),0);return{width:V,height:Math.max(30,G*LD+10)}},tn=10;for(const R of x){const P=R.association,O=((gx=R.placement)==null?void 0:gx.anchor)??(P?P.source===R.annotation.id?P.target:P.source:void 0),V=O?l(O):void 0,G=V?lx(V):void 0,j=ND(R.annotation.text??"");let Z;if(G&&R.placement){const[Ke,lt]=zu[R.placement.side],Fe=R.placement.offset??50;Z={x:G.x+G.width/2+Ke*(G.width/2+j.width/2+Fe),y:G.y+G.height/2+lt*(G.height/2+j.height/2+Fe)}}else G?(Z={x:G.x+G.width/2+180+qa%3*260,y:G.y-110-qa%2*95},qa++):(Z={x:300+qa*260,y:60},qa++);const Ce=V?f(V)??u():u(),J=Ce;if(G&&typeof J.x=="number"&&typeof J.width=="number"&&J.type==="bpmn:Participant"){const Ke=(ne,he)=>{const[le,Ze]=zu[ne];let qe={x:G.x+G.width/2+le*(G.width/2+j.width/2+he),y:G.y+G.height/2+Ze*(G.height/2+j.height/2+he)};const Me=J.x+tn+j.width/2,Xe=J.x+J.width-tn-j.width/2,Ht=J.y+tn+j.height/2,ce=J.y+J.height-tn-j.height/2,We={x:Math.min(Xe,Math.max(Me,qe.x)),y:Math.min(ce,Math.max(Ht,qe.y))};return(We.x!==qe.x||We.y!==qe.y)&&(qe=Math.abs(We.x-(G.x+G.width/2))<(G.width+j.width)/2+tn&&Math.abs(We.y-(G.y+G.height/2))<(G.height+j.height)/2+tn?{x:G.x+G.width+tn+j.width/2,y:We.y}:We),qe},lt=(J.children??[]).filter(ne=>!("waypoints"in ne&&ne.waypoints)&&ne.type!=="bpmn:Lane"&&ne.type!=="label"&&typeof ne.x=="number"),Fe=Kt(o),Pe=Fe.edges.flatMap(fn),_e=ss(Fe).map(ne=>ne.rect),st=ne=>({x0:ne.x-j.width/2-tn,x1:ne.x+j.width/2+tn,y0:ne.y-j.height/2-tn,y1:ne.y+j.height/2+tn}),qt=ne=>{const he=st(ne);return lt.some(le=>he.x0<le.x+le.width&&he.x1>le.x&&he.y0<le.y+le.height&&he.y1>le.y)},Qn=ne=>{const he=st(ne);return Pe.some(le=>le.axis==="h"?le.at>he.y0&&le.at<he.y1&&le.lo<he.x1&&le.hi>he.x0:le.at>he.x0&&le.at<he.x1&&le.lo<he.y1&&le.hi>he.y0)},ln=ne=>{const he=st(ne);return _e.some(le=>he.x0<le.x+le.width&&he.x1>le.x&&he.y0<le.y+le.height&&he.y1>le.y)},$n=ne=>qt(ne)||Qn(ne)||ln(ne),vu=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(R.placement){const ne=Me=>Me.startsWith("top")?Me.replace(/^top/,"bottom"):Me.replace(/^bottom/,"top"),he=Me=>Me.endsWith("left")?Me.replace(/left$/,"right"):Me.replace(/right$/,"left"),le=R.placement.side,Ze=[le,ne(le),he(le),ne(he(le)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],qe=R.placement.offset??50;if(Z=Ke(le,qe),$n(Z)){const Me=new Set;for(const Xe of Ze){if(Me.has(Xe))continue;Me.add(Xe);const Ht=Ke(Xe,qe);if(vu(Ht)&&!$n(Ht)){Z=Ht;break}}}}else{const ne=J.x+tn+j.width/2,he=J.x+J.width-tn-j.width/2,le=J.y+tn+j.height/2,Ze=J.y+J.height-tn-j.height/2;if(Z={x:Math.min(he,Math.max(ne,Z.x)),y:Math.min(Ze,Math.max(le,Z.y))},$n(Z)){const qe=(G.width+j.width)/2+tn,Xe=[{x:Z.x+qe,y:Z.y},{x:Z.x-qe,y:Z.y},{x:Z.x,y:Z.y-j.height-tn},{x:Z.x,y:Z.y+j.height+tn}].filter(vu).find(Ht=>!$n(Ht));Xe&&(Z=Xe)}}}const be=n.createShape({type:"bpmn:TextAnnotation",width:j.width,height:j.height,businessObject:i.create("bpmn:TextAnnotation",{id:R.annotation.id,text:R.annotation.text})},Z,Ce);if(P){const Ke=lt=>lt===R.annotation.id?be:p(lt);n.connect(Ke(P.source),Ke(P.target),P.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:P.id})}:{type:"bpmn:Association"})}R.placement&&T(be,"bwl:Placement",L(R.placement))}for(const R of Xt(e,"association.add")){const P=R.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 R of Xt(e,"node.update")){let P=p(R.id);if(R.type&&ds(R.type)!==P.type&&(P=c.replaceElement(P,{type:ds(R.type)})),R.name!==void 0&&n.updateProperties(P,{name:R.name??void 0}),R.lane){const O=p(R.lane),V=O.y+O.height/2-(P.y+P.height/2);V!==0&&n.moveElements([P],{x:0,y:V})}}for(const R of Xt(e,"sequenceFlow.update")){const P=p(R.id);if(R.source!==void 0||R.target!==void 0){const O=P,V=R.source!==void 0?p(R.source):O.source,G=R.target!==void 0?p(R.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)])}R.name!==void 0&&n.updateProperties(P,{name:R.name??void 0}),R.condition!==void 0&&n.updateProperties(P,{name:((yx=R.condition)==null?void 0:yx.label)??void 0})}for(const R of Xt(e,"messageFlow.update"))R.name!==void 0&&n.updateProperties(p(R.id),{name:R.name??void 0});for(const R of Xt(e,"dataStore.update"))R.name!==void 0&&n.updateProperties(p(R.id),{name:R.name??void 0});for(const R of Xt(e,"annotation.update")){const P=p(R.id);if(R.text!==void 0&&n.updateProperties(P,{text:R.text}),R.placement===null)T(P,"bwl:Placement",null);else if(R.placement){const O=lx(p(R.placement.anchor)),[V,G]=zu[R.placement.side],j=R.placement.offset??50,Z=O.x+O.width/2+V*(O.width/2+P.width/2+j),Ce=O.y+O.height/2+G*(O.height/2+P.height/2+j);n.moveElements([P],{x:Z-(P.x+P.width/2),y:Ce-(P.y+P.height/2)}),T(P,"bwl:Placement",L(R.placement))}}for(const R of Xt(e,"group.update")){const P=p(R.id);if(R.name!==void 0&&n.updateLabel(P,R.name??""),R.members){const O=R.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,Ce=Math.max(...O.map(J=>J.y+J.height))+40;n.resizeShape(P,{x:G,y:j,width:Z-G,height:Ce-j})}T(P,"bwl:Members",{refs:R.members.join(" ")})}}}function Qd(e,t,n=Zd){const i=Xd(e),r=Yd(t,wd(i.elementRegistry)),o={edgeCrossings:{before:0,after:0}};if(r.length)return{ok:!1,issues:r,findings:[],stats:o};const a=Kt(i.elementRegistry),s=new Set(Yi(a).map(Ui)),c=new Set(a.edges.map(h=>h.id)),u=new Set(a.shapes.map(h=>h.id)),l=Fu(a).length,p=e.get("commandStack");try{$f(p,()=>{n(t,i),Od(i,c),Md(i,s),jd(i,s,c),Bd(i,c),Vd(i,s,c),zd(i,c),Wd(i,u)})}catch(h){return{ok:!1,issues:[{kind:"lower-failed",message:h instanceof Error?h.message:String(h)}],findings:[],stats:o}}const f=Kt(i.elementRegistry),d=Yi(f).filter(h=>!s.has(Ui(h)));return{ok:!0,issues:[],findings:d,stats:{edgeCrossings:{before:l,after:Fu(f).length}}}}function UE(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function qE(e,t){return typeof e.get=="function"?e.get(t):e[t]}function Jd(e,t){const n=qE(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function eh(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function YE(e){return typeof e=="string"&&bu.includes(e)}function ui(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function th(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 se=eh(X,"bwl:Placement");if(!se)return;const fe=typeof se.anchor=="string"?se.anchor:void 0;if(!fe||!YE(se.side))return;const oe=typeof se.offset=="number"?se.offset:void 0;m.push({owner:X.id,anchor:fe,side:se.side,...oe!==void 0?{offset:oe}:{}})},T=X=>{const se=eh(X,"bwl:Members"),fe=typeof(se==null?void 0:se.refs)=="string"?se.refs.split(/\s+/).filter(Boolean):[];fe.length&&g.push({owner:X.id,refs:fe})},L=X=>{var se;for(const fe of X)switch(x(fe.id),fe.$type){case"bpmn:TextAnnotation":b(fe.id),s.push({id:fe.id,text:typeof fe.text=="string"?fe.text:""}),w(fe);break;case"bpmn:Association":d.push({id:fe.id,type:fe.$type,source:ui(fe.sourceRef),target:ui(fe.targetRef)});break;case"bpmn:Group":{b(fe.id);const oe=(se=fe.categoryValueRef)==null?void 0:se.value;c.push({id:fe.id,...typeof oe=="string"&&oe?{name:oe}:{}}),T(fe);break}default:u.push({id:fe.id,type:fe.$type,reason:"type-outside-mvp"})}},A=(X,se)=>{const fe=X.flowElements??[],oe=(X.laneSets??[]).flatMap(ee=>ee.lanes??[]),de=new Map;for(const ee of oe){x(ee.id);for(const $ of ee.flowNodeRef??[]){const B=ui($);B&&de.set(B,ee.id)}}for(const ee of fe){if(x(ee.id),ee.$type==="bpmn:SequenceFlow"){p.push({id:ee.id,source:ui(ee.sourceRef),target:ui(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 $=UE(ee.$type);if(!Lf($)){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}:{},...se?{participant:se}:{},...de.has(ee.id)?{lane:de.get(ee.id)}:{}});const B=Jd(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:ui(U.targetRef)});for(const U of ee.dataInputAssociations??[])x(U.id),h.push({id:U.id,type:U.$type,source:ui((U.sourceRef??[])[0]),target:ee.id})}L(X.artifacts??[])};if(n){const X=new Set;for(const se of n.participants??[]){b(se.id);const fe=ui(se.processRef);fe&&X.add(fe);const oe=fe?i.get(fe):void 0,de=((oe==null?void 0:oe.laneSets)??[]).flatMap(U=>U.lanes??[]),ee=de.map(U=>({id:U.id,...U.name?{name:U.name}:{}}));for(const U of ee)b(U.id);const $=!oe||(oe.flowElements??[]).length===0&&de.length===0&&(oe.artifacts??[]).length===0;r.push({id:se.id,...se.name?{name:se.name}:{},...$?{blackBox:!0}:{},...ee.length?{lanes:ee}:{}});const B=Jd(se,"bwl:poolOrder");B!==void 0&&(l.poolOrders[se.id]=B),oe&&A(oe,se.id)}for(const se of n.messageFlows??[])x(se.id),f.push({id:se.id,source:ui(se.sourceRef),target:ui(se.targetRef),...typeof se.name=="string"&&se.name?{name:se.name}:{}});L(n.artifacts??[]);for(const[se,fe]of i)!X.has(se)&&(fe.flowElements??[]).length>0&&u.push({id:se,type:fe.$type,reason:"unreachable-process"})}else for(const X of i.values())A(X);const F=[],H=[],N=[],z=[],ue=(X,se)=>!!X&&!!se&&E.has(X)&&E.has(se);for(const X of p){if(!ue(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(!ue(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(!ue(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(!ue(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 je=new Map(c.map(X=>[X.id,X]));for(const{owner:X,refs:se}of g){const fe=se.filter(de=>S.has(de)),oe=je.get(X);oe&&fe.length&&(oe.members=fe)}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: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 KE(e){const{definitions:t,warnings:n}=await Bu(e);return{...th(t),warnings:n}}function XE(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function nh(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=Qd(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 ZE=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 nh(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:$u(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 JE(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Vu={exports:{}},ih;function ew(){if(ih)return Vu.exports;ih=1;var e=Vu.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},Vu.exports}var tw=ew(),nw=JE(tw);function li(e){if(!(this instanceof li))return new li(e);e=e||[128,36,1],this._seed=e.length?nw.rack(e[0],e[1],e[2]):e}li.prototype.next=function(e){return this._seed(e||!0)},li.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},li.prototype.claim=function(e,t){this._seed.set(e,t||!0)},li.prototype.assigned=function(e){return this._seed.get(e)||!1},li.prototype.unclaim=function(e){delete this._seed.hats[e]},li.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const It={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};It.td=It.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],It.option=It.optgroup=[1,'<select multiple="multiple">',"</select>"],It.thead=It.tbody=It.colgroup=It.caption=It.tfoot=[1,"<table>","</table>"],It.polyline=It.ellipse=It.polygon=It.circle=It.text=It.line=It.path=It.rect=It.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function ut(e,t=globalThis.document){var u;if(typeof e!="string")throw new TypeError("String expected");const n=/^<!--(.*?)-->$/s.exec(e);if(n)return t.createComment(n[1]);const i=(u=/<([\w:]+)/.exec(e))==null?void 0:u[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const l=t.createElement("html");l.innerHTML=e;const{lastChild:p}=l;return p.remove(),p}let[r,o,a]=Object.hasOwn(It,i)?It[i]:It._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 iw(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 dn(e,...t){const n=e.style;return M(t,function(i){i&&M(i,function(r,o){n[o]=r})}),e}function an(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const rw=Object.prototype.toString;function ft(e){return new Ki(e)}function Ki(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Ki.prototype.add=function(e){return this.list.add(e),this},Ki.prototype.remove=function(e){return rw.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Ki.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},Ki.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Ki.prototype.array=function(){return Array.from(this.list)},Ki.prototype.has=Ki.prototype.contains=function(e){return this.list.contains(e)};function hs(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Mr(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function ow(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ms={},rh;function aw(){if(rh)return ms;rh=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return ms.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},ms.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},ms}var oh=aw(),sw=ow(oh),we=iw({__proto__:null,default:sw},[oh]),ah=["focus","blur"];function cw(e,t,n,i,r){return ah.indexOf(n)!==-1&&(r=!0),we.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=Mr(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function uw(e,t,n,i){return ah.indexOf(t)!==-1&&(i=!0),we.unbind(e,t,n,i)}var wn={bind:cw,unbind:uw};function Gu(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function et(e,t){return t=t||document,t.querySelector(e)}function gs(e,t){return t=t||document,t.querySelectorAll(e)}function pi(e){e.parentNode&&e.parentNode.removeChild(e)}function lw(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function pw(e,t){return t.appendChild(lw(e,t))}function Se(e,t){return pw(t,e),e}var Wu=2,sh={"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":Wu,"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":Wu,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function fw(e,t){return sh[t]?e.style[t]:e.getAttributeNS(null,t)}function ch(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=sh[i];r?(r===Wu&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function dw(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)ch(e,r,t[r])}function re(e,t,n){if(typeof t=="string")if(n!==void 0)ch(e,t,n);else return fw(e,t);else dw(e,t);return e}const hw=Object.prototype.toString;function $e(e){return new Xi(e)}function Xi(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Xi.prototype.add=function(e){return this.list.add(e),this},Xi.prototype.remove=function(e){return hw.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Xi.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},Xi.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Xi.prototype.array=function(){return Array.from(this.list)},Xi.prototype.has=Xi.prototype.contains=function(e){return this.list.contains(e)};function ys(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function uh(e){return e.cloneNode(!0)}var Uu={svg:"http://www.w3.org/2000/svg"},lh='<svg xmlns="'+Uu.svg+'"';function mw(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(Uu.svg)===-1&&(e=lh+e.substring(4)):(e=lh+">"+e+"</svg>",t=!0);var n=gw(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function gw(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=mw(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(Uu.svg,e),t&&re(n,t),n}var qu=null;function ph(){return qu===null&&(qu=pe("svg")),qu}function fh(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function yw(e,t,n,i,r,o){var a=ph().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return fh(a,e);case 6:return fh(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function Uo(e){return ph().createSVGTransform()}var dh=/([&<>]{1})/g,vw=/([&<>\n\r"]{1})/g,_w={"&":"&","<":"<",">":">",'"':"'"};function Yu(e,t){function n(i,r){return _w[r]||r}return e.replace(t,n)}function hh(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(Yu(e.textContent,dh));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,'="',Yu(o.value,vw),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)hh(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",Yu(e.nodeValue,dh),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function bw(e){for(var t=e.firstChild,n=[];t;)hh(t,n),t=t.nextSibling;return n.join("")}function mh(e,t){return bw(e)}function Nt(e){var t=e.parentNode;return t&&t.removeChild(e),e}function xw(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function Ew(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(xw(e,i))}function qo(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),Ew(n,t)),n.consolidate()}const ww=/^class[ {]/;function Sw(e){return ww.test(e.toString())}function Ku(e){return Array.isArray(e)}function Xu(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function vs(...e){e.length===1&&Ku(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const Rw=/constructor\s*[^(]*\(\s*([^)]*)\)/m,Cw=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,Pw=/\/\*([^*]*)\*\//m;function Aw(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(Sw(e)?Rw:Cw);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(Pw);return(r&&r[1]||i).trim()})||[]}function gh(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(Xu(o,x))return o[x];if(Xu(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(Ku(x))x=vs(x.slice());else throw s(`Cannot invoke "${x}". Expected a function!`);const T=(x.$inject||Aw(x)).map(L=>Xu(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 vs(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,ue;for(let je in r)H=r[je],b.indexOf(je)!==-1&&(H[2]==="private"?(N=L.indexOf(H[3]),N===-1?(z=H[3].createChild([],b),ue=f(z),L.push(H[3]),A.push(z),F.push(ue),w[je]=[ue,je,"private",z]):w[je]=[F[N],je,"private",A[N]]):w[je]=[H[2],H[1]],T[je]=!0),(H[2]==="factory"||H[2]==="type")&&H[1].$scope&&b.forEach(tt=>{H[1].$scope.indexOf(tt)!==-1&&(w[je]=[H[2],H[1]],T[tt]=!0)});b.forEach(je=>{if(!T[je])throw new Error('No provider for "'+je+'". Cannot use provider from the parent!')}),x.unshift(w)}return new gh(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=vs(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],Tw(L,A),L]}),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 Tw(e,t){return e!=="value"&&Ku(t)&&(t=vs(t.slice())),t}var Mw=1e3;function Ci(e,t){var n=this;t=t||Mw,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)})}Ci.prototype.canRender=function(e){},Ci.prototype.drawShape=function(e,t){},Ci.prototype.drawConnection=function(e,t){},Ci.prototype.getShapePath=function(e){},Ci.prototype.getConnectionPath=function(e){};function kr(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function kw(e){return["M",e.x,e.y]}function Zu(e){return["L",e.x,e.y]}function Dw(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function Ow(e,t){const n=e.length,i=[kw(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(Zu(a));continue}const c=Math.min(t,Qu(a.x-o.x,a.y-o.y),Qu(s.x-a.x,s.y-a.y));if(!c){i.push(Zu(a));continue}const u=_s(a,o,c),l=_s(a,o,c*.5),p=_s(a,s,c),f=_s(a,s,c*.5);i.push(Zu(u)),i.push(Dw(l,f,p))}return i}function _s(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=Qu(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function Qu(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Yo(e,t,n){xe(t)&&(n=t,t=null),t||(t={});const i=pe("path",t);return xe(n)&&(i.dataset.cornerRadius=String(n)),Ju(i,e)}function Ju(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return re(e,{d:kr(Ow(t,n))}),e}function bs(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 Dr(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&&Dr(o,t,n+1)})}function el(e,t,n){var i=new Set,r=new Set;return Dr(e,function(o,a,s){i.add(o);var c=o.children;if(c&&!r.has(c))return r.add(c),c}),Array.from(i)}function Ko(e,t){return el(e)}function Lw(e,t,n){wr(t)&&(t=!0),zt(t)&&(n=t,t=!0),n=n||{};var i=Xo(n.allShapes),r=Xo(n.allConnections),o=Xo(n.enclosedElements),a=Xo(n.enclosedConnections),s=Xo(n.topLevel,t&&Qr(e,function(l){return l.id}));function c(l){s[l.source.id]&&s[l.target.id]&&(s[l.id]=[l]),i[l.source.id]&&i[l.target.id]&&(a[l.id]=o[l.id]=l),r[l.id]=l}function u(l){if(o[l.id]=l,l.waypoints)a[l.id]=r[l.id]=l;else return i[l.id]=l,M(l.incoming,c),M(l.outgoing,c),l.children}return Dr(e,u),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function Ct(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=Ct(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 ro(e,t){var n={};return M(e,function(i){var r=i;r.waypoints&&(r=Ct(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 yh(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function vh(e){return!!(e&&e.isFrame)}function Xo(e,t){return D({},e||{},t||{})}var Iw=1;function Zi(e,t){Ci.call(this,e,Iw),this.CONNECTION_STYLE=t.style(["no-fill"],{strokeWidth:5,stroke:"fuchsia"}),this.SHAPE_STYLE=t.style({fill:"white",stroke:"fuchsia",strokeWidth:2}),this.FRAME_STYLE=t.style(["no-fill"],{stroke:"fuchsia",strokeDasharray:4,strokeWidth:2})}ie(Zi,Ci),Zi.prototype.canRender=function(){return!0},Zi.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}),vh(n)?re(r,D({},this.FRAME_STYLE,i||{})):re(r,D({},this.SHAPE_STYLE,i||{})),Se(t,r),r},Zi.prototype.drawConnection=function(t,n,i){var r=Yo(n.waypoints,D({},this.CONNECTION_STYLE,i||{}));return Se(t,r),r},Zi.prototype.getShapePath=function(t){var n=t.x,i=t.y,r=t.width,o=t.height,a=[["M",n,i],["l",r,0],["l",0,o],["l",-r,0],["z"]];return kr(a)},Zi.prototype.getConnectionPath=function(t){var n=t.waypoints,i,r,o=[];for(i=0;r=n[i];i++)r=r.original||r,o.push([i===0?"M":"L",r.x,r.y]);return kr(o)},Zi.$inject=["eventBus","styles"];function Nw(){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=xn(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 Bw={__init__:["defaultRenderer"],defaultRenderer:["type",Zi],styles:["type",Nw]};function _t(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 tl(e,t){return!e||!t?-1:e.indexOf(t)}function Zo(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function nl(e,t,n,i){if(typeof i>"u"&&(i=5),!e||!t||!n)return!1;var r=(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),o=Zo(e,t);return Math.abs(r/o)<=i}var $w=2;function Pi(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(jw(r,n))return o;return!1}function jw(e,t){const n=t[0];return Sr(t,function(i){return Math.abs(n[e]-i[e])<=$w})}function _h(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 il(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var Fw=/,?([a-z]),?/gi,bh=parseFloat,Pt=Math,Qi=Pt.PI,fi=Pt.min,di=Pt.max,xh=Pt.pow,Ji=Pt.abs,Hw=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,zw=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,Eh=Array.isArray||function(e){return e instanceof Array};function Vw(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Gw(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 Ww(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 Vw(r,i)?(Gw(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function Uw(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(Hw,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(zw,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=ol,n}function qw(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 Yw(e){for(var t=0,n=e.length;t<n;t++){var i=e[t][0];if(i!=="M"&&i!=="C")return!1}return!0}function rl(e,t,n,i){return arguments.length===1&&(t=e.y,n=e.width,i=e.height,e=e.x),{x:e,y:t,width:n,height:i,x2:e+n,y2:t+i}}function ol(){return this.join(",").replace(Fw,"$1")}function Kw(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=ol,t}function wh(e,t,n,i,r,o,a,s,c){var u=1-c,l=xh(u,3),p=xh(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:xs(h),y:xs(m)}}function Sh(e){var t=t1(...e);return rl(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function er(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function Xw(e,t){return e=rl(e),t=rl(t),er(t,e.x,e.y)||er(t,e.x2,e.y)||er(t,e.x,e.y2)||er(t,e.x2,e.y2)||er(e,t.x,t.y)||er(e,t.x2,t.y)||er(e,t.x,t.y2)||er(e,t.x2,t.y2)||(e.x<t.x2&&e.x>t.x||t.x<e.x2&&t.x>e.x)&&(e.y<t.y2&&e.y>t.y||t.y<e.y2&&t.y>e.y)}function Rh(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 Ch(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=Rh(m,e,n,r,a),S=Rh(m,t,i,o,s),E=g*g+S*S;d+=f[h]*Pt.sqrt(E)}return u*d}function Zw(e,t,n,i,r,o,a,s){if(!(di(e,n)<fi(r,a)||fi(e,n)>di(r,a)||di(t,i)<fi(o,s)||fi(t,i)>di(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=xs(c/l),f=xs(u/l),d=+p.toFixed(2),h=+f.toFixed(2);if(!(d<+fi(e,n).toFixed(2)||d>+di(e,n).toFixed(2)||d<+fi(r,a).toFixed(2)||d>+di(r,a).toFixed(2)||h<+fi(t,i).toFixed(2)||h>+di(t,i).toFixed(2)||h<+fi(o,s).toFixed(2)||h>+di(o,s).toFixed(2)))return{x:p,y:f}}}}function xs(e){return Math.round(e*1e11)/1e11}function Qw(e,t,n){var i=Sh(e),r=Sh(t);if(!Xw(i,r))return[];var o=Ch(...e),a=Ch(...t),s=Ah(e)?1:~~(o/5)||1,c=Ah(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=wh(...e,d/s);u[d]={x:m.x,y:m.y,t:d/s}}for(d=0;d<c+1;d++)m=wh(...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=Ji(S.x-g.x)<.01?"y":"x",w=Ji(x.x-E.x)<.01?"y":"x",T=Zw(g.x,g.y,S.x,S.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+Ji((T[b]-g[b])/(S[b]-g[b]))*(S.t-g.t),F=E.t+Ji((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 Ph(e,t,n){e=kh(e),t=kh(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=Qw(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 Jw(e){return Eh(e)&&Eh(e[0])}function e1(e){if(qw(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=ol,t}function Ah(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Es(e,t,n,i){return[e,t,n,i,n,i]}function Th(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 Mh(e,t,n,i,r,o,a,s,c,u){var l=Qi*120/180,p=Qi/180*(+r||0),f=[],d,h=Ww(function(C,_,y){var k=C*Pt.cos(y)-_*Pt.sin(y),I=C*Pt.sin(y)+_*Pt.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,S=m*m/(n*n)+g*g/(i*i);S>1&&(S=Pt.sqrt(S),n=S*n,i=S*i);var E=n*n,x=i*i,b=(o==a?-1:1)*Pt.sqrt(Ji((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=Pt.asin(((t-T)/i).toFixed(9)),A=Pt.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(Ji(F)>l){var H=A,N=s,z=c;A=L+l*(a&&A>L?1:-1),s=w+n*Pt.cos(A),c=T+i*Pt.sin(A),f=Mh(s,c,n,i,r,0,a,N,z,[A,H,w,T])}F=A-L;var ue=Pt.cos(L),je=Pt.sin(L),tt=Pt.cos(A),X=Pt.sin(A),se=Pt.tan(F/4),fe=4/3*n*se,oe=4/3*i*se,de=[e,t],ee=[e+fe*je,t-oe*ue],$=[s+fe*X,c-oe*tt],B=[s,c];if(ee[0]=2*de[0]-ee[0],ee[1]=2*de[1]-ee[1],u)return[ee,$,B].concat(f);f=[ee,$,B].concat(f).join().split(",");for(var U=[],Ae=0,wt=f.length;Ae<wt;Ae++)U[Ae]=Ae%2?h(f[Ae-1],f[Ae],p).y:h(f[Ae],f[Ae+1],p).x;return U}function t1(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),Ji(l)<1e-12){if(Ji(p)<1e-12)continue;d=-f/p,0<d&&d<1&&c.push(d);continue}g=p*p-4*f*l,S=Pt.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:fi(...u[0]),y0:fi(...u[1]),x1:di(...u[0]),y1:di(...u[1])}}function kh(e){if(Jw(e)||(e=Uw(e)),Yw(e))return e;for(var t=Kw(e1(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",...Mh(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",...Th(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",...Th(d.x,d.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...Es(d.x,d.y,f[1],f[2])];break;case"H":f=["C",...Es(d.x,d.y,f[1],d.y)];break;case"V":f=["C",...Es(d.x,d.y,d.x,f[1])];break;case"Z":f=["C",...Es(d.x,d.y,d.X,d.Y)];break}return f},r=function(f,d){if(f[d].length>7){f[d].shift();for(var h=f[d];h.length;)o[d]="A",f.splice(d++,0,["C",...h.splice(0,6)]);f.splice(d,1),u=t.length}},o=[],a="",s="",c=0,u=t.length;c<u;c++){t[c]&&(a=t[c][0]),a!="C"&&(o[c]=a,c&&(s=o[c-1])),t[c]=i(t[c],n,s),o[c]!="A"&&a=="C"&&(o[c]="C"),r(t,c);var l=t[c],p=l.length;n.x=l[p-2],n.y=l[p-1],n.bx=bh(l[p-4])||n.x,n.by=bh(l[p-3])||n.y}return t}function it(e){return zt(e)&&bn(e,"waypoints")}function ke(e){return zt(e)&&bn(e,"labelTarget")}function n1(e){return zt(e)&&Xr(e.parent)}function Dh(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function Ai(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function me(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function ws(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function i1(e){return Ai({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function r1(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=s1(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 it(e)?r1(e):i1(e)}function Zt(e,t,n){n=n||0,zt(n)||(n={x:n,y:n});var i=me(e),r=me(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=o1(e,t);return i.length===1||i.length===2&&Zo(i[0],i[1])<1?Ai(i[0]):i.length>1?(i=oi(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),Ai(i[n?0:i.length-1])):null}function o1(e,t){return Ph(e,t)}function a1(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],Zo(n,r)===0||nl(i,r,n)?e.splice(t,1):t++;return e}function s1(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Ss(e,t){return Math.round(e*t)/t}function Oh(e){return xe(e)?e+"px":e}function c1(e){for(;e.parent;)e=e.parent;return e}function u1(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"),dn(n,{position:"relative",overflow:"hidden",width:Oh(e.width),height:Oh(e.height)}),t.appendChild(n),n}function Lh(e,t,n){const i=pe("g");$e(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const l1="base",Ih=0,p1=1,f1={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=u1(e),i=this._svg=pe("svg");re(i,{width:"100%",height:"100%"}),an(i,"tabindex",0),e.autoFocus&&t.on("element.hover",()=>{this.restoreFocus()}),t.on("element.mousedown",500,o=>{this.focus()}),i.addEventListener("focusin",()=>{this._setFocused(!0)}),i.addEventListener("focusout",()=>{this._setFocused(!1)}),i.addEventListener("mouseover",()=>{this._eventBus.fire("canvas.mouseover")}),i.addEventListener("mouseout",()=>{this._eventBus.fire("canvas.mouseout")}),Se(n,i);const r=this._viewport=Lh(i,"viewport");e.deferUpdate&&(this._viewboxChanged=Su(this._viewboxChanged,300)),this._restoreFocus=Su(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=yh(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(l1,Ih)},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 xn(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},ve.prototype._createLayer=function(e,t){typeof t>"u"&&(t=p1);const n=this._getChildIndex(t);return{group:Lh(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&&(Nt(n),t.visible=!1),n},ve.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],Nt(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(c1(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 at(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),$e(r).add(t)):(e.markers.delete(t),$e(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,Ih);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=f1[e];if(!Sr(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),_t(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);qo(t,l)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=qo(t),r=a?a.matrix:yw(),s=Ss(r.a,1e3),c=Ss(-r.e||0,1e3),u=Ss(-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),Nh(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=Ct(o),s=me(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=me(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})},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)}),Ss(i.a,1e3)};function Nh(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),Nh(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 oo="data-element-id";function Ln(e){this._elements={},this._eventBus=e}Ln.$inject=["eventBus"],Ln.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),re(t,oo,i),n&&re(n,oo,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},Ln.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(re(i.gfx,oo,""),i.secondaryGfx&&re(i.secondaryGfx,oo,""),delete t[n])},Ln.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)},Ln.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&re(t,oo,i),t},Ln.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&re(e,oo);var n=this._elements[t];return n&&n.element},Ln.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},Ln.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}},Ln.prototype.getAll=function(){return this.filter(function(e){return e})},Ln.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)})},Ln.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},Ln.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 d1(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 h1(e){return e.__refs_collection===!0}function m1(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function Bh(e,t,n){var i=d1(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 g1(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 Fn(e,t){if(!(this instanceof Fn))return new Fn(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Fn.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?Bh(this,t,e):g1(this,t,e)},Fn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return h1(n)||Bh(this,t,e),n},Fn.prototype.ensureBound=function(e,t){m1(e,t)||this.bind(e,t)},Fn.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Fn.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var al=new Fn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),$h=new Fn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),jh=new Fn({name:"attachers",collection:!0},{name:"host"}),Fh=new Fn({name:"outgoing",collection:!0},{name:"source"}),Hh=new Fn({name:"incoming",collection:!0},{name:"target"});function ao(){Object.defineProperty(this,"businessObject",{writable:!0}),Object.defineProperty(this,"label",{get:function(){return this.labels[0]},set:function(e){var t=this.label,n=this.labels;!e&&t?n.remove(t):n.add(e,0)}}),al.bind(this,"parent"),$h.bind(this,"labels"),Fh.bind(this,"outgoing"),Hh.bind(this,"incoming")}function Jo(){ao.call(this),al.bind(this,"children"),jh.bind(this,"host"),jh.bind(this,"attachers")}ie(Jo,ao);function zh(){ao.call(this),al.bind(this,"children")}ie(zh,Jo);function Vh(){Jo.call(this),$h.bind(this,"labelTarget")}ie(Vh,Jo);function Gh(){ao.call(this),Fh.bind(this,"source"),Hh.bind(this,"target")}ie(Gh,ao);var y1={connection:Gh,shape:Jo,label:Vh,root:zh};function v1(e,t){var n=y1[e];if(!n)throw new Error("unknown type: <"+e+">");return D(new n,t)}function _1(e){return e instanceof ao}function Ti(){this._uid=12}Ti.prototype.createRoot=function(e){return this.create("root",e)},Ti.prototype.createLabel=function(e){return this.create("label",e)},Ti.prototype.createShape=function(e){return this.create("shape",e)},Ti.prototype.createConnection=function(e){return this.create("connection",e)},Ti.prototype.create=function(e,t){return t=D({},t||{}),t.id||(t.id=e+"_"+this._uid++),v1(e,t)};var Rs="__fn",Wh=1e3,b1=Array.prototype.slice;function Sn(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}Sn.prototype.on=function(e,t,n,i){if(e=ge(e)?e:[e],Vt(t)&&(i=n,n=t,t=Wh),!xe(t))throw new Error("priority must be a number");var r=n;i&&(r=gn(n,i),r[Rs]=n[Rs]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},Sn.prototype.once=function(e,t,n,i){var r=this;if(Vt(t)&&(i=n,n=t,t=Wh),!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[Rs]=n,this.on(e,t,o)},Sn.prototype.off=function(e,t){e=ge(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},Sn.prototype.createEvent=function(e){var t=new ea;return t.init(e),t},Sn.prototype.fire=function(e,t){var n,i,r,o;if(o=b1.call(arguments),typeof e=="object"&&(t=e,e=t.type),!e)throw new Error("no event type specified");if(i=this._listeners[e],!!i){t instanceof ea?n=t:n=this.createEvent(t),o[0]=n;var a=n.type;e!==a&&(n.type=e);try{r=this._invokeListeners(n,o,i)}finally{e!==a&&(n.type=a)}return r===void 0&&n.defaultPrevented&&(r=!1),r}},Sn.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},Sn.prototype._destroy=function(){this._listeners={}},Sn.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},Sn.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=x1(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},Sn.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},Sn.prototype._getListeners=function(e){return this._listeners[e]},Sn.prototype._setListeners=function(e,t){this._listeners[e]=t},Sn.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[Rs]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function ea(){}ea.prototype.stopPropagation=function(){this.cancelBubble=!0},ea.prototype.preventDefault=function(){this.defaultPrevented=!0},ea.prototype.init=function(e){D(this,e||{})};function x1(e,t){return e.apply(null,t)}function Or(e){return e.childNodes[0]}function E1(e){return e.parentNode.childNodes[1]}function Cs(e,t,n,i,r){var o=Uo();o.setTranslate(t,n);var a=Uo();a.setRotate(i||0,0,0);var s=Uo();s.setScale(1,1),qo(e,[o,a,s])}function Qt(e,t,n){var i=Uo();i.setTranslate(t,n),qo(e,i)}function Uh(e,t){var n=Uo();n.setRotate(t,0,0),qo(e,n)}function In(e,t){this._eventBus=e,this._elementRegistry=t}In.$inject=["eventBus","elementRegistry"],In.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=E1(t),n||(n=pe("g"),$e(n).add("djs-children"),Se(t.parentNode,n))):n=t,n},In.prototype._clear=function(e){var t=Or(e);return hs(t),t},In.prototype._createContainer=function(e,t,n,i){var r=pe("g");$e(r).add("djs-group"),typeof n<"u"?w1(r,t,t.childNodes[n]):Se(t,r);var o=pe("g");$e(o).add("djs-element"),$e(o).add("djs-"+e),i&&$e(o).add("djs-frame"),Se(r,o);var a=pe("g");return $e(a).add("djs-visual"),Se(o,a),o},In.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,vh(t))},In.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=xn(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)})}})},In.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},In.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},In.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},In.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},In.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),Qt(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?re(n,"display","none"):re(n,"display","block")}},In.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);Nt(t.parentNode)};function w1(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const S1={__depends__:[Bw],__init__:["canvas"],canvas:["type",ve],elementRegistry:["type",Ln],elementFactory:["type",Ti],eventBus:["type",Sn],graphicsFactory:["type",In]};function R1(e){var t=new gh(e);return t.init(),t}function C1(e){e=e||{};var t={config:["value",e]},n=[t,S1].concat(e.modules||[]);return R1(n)}function tr(e,t){this._injector=t||C1(e),this.get("eventBus").fire("diagram.init")}tr.prototype.get=function(e,t){return this._injector.get(e,t)},tr.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},tr.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},tr.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function sn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function yn(e,t){return e.$instanceOf(t)}function P1(e){return at(e.rootElements,function(t){return yn(t,"bpmn:Process")||yn(t,"bpmn:Collaboration")})}function A1(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 ${sn($)}`);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(Ae){l(Ae.message,{element:$,error:Ae}),console.error(`failed to import ${sn($)}`,Ae)}}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 ${sn(U)}`,{element:U}):i[U.id]=B:l(`no bpmnElement referenced in ${sn(B)}`,{element:B})};function f($){d($.plane)}function d($){p($),M($.planeElement,h)}function h($){p($)}this.handleDefinitions=function(B,U){var Ae=B.diagrams;if(U&&Ae.indexOf(U)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!U&&Ae&&Ae.length&&(U=Ae[0]),!U)throw new Error("no diagram to display");i={},f(U);var wt=U.plane;if(!wt)throw new Error(`no plane for ${sn(U)}`);var C=wt.bpmnElement;if(!C)if(C=P1(B),C)l(`correcting missing bpmnElement on ${sn(wt)} to ${sn(C)}`),wt.bpmnElement=C,p(wt);else throw new Error("no process or collaboration to display");var _=c(C,wt);if(yn(C,"bpmn:Process")||yn(C,"bpmn:SubProcess"))g(C,_);else if(yn(C,"bpmn:Collaboration"))de(C,_),S(B.rootElements,_);else throw new Error(`unsupported bpmnElement for ${sn(wt)}: ${sn(C)}`);m(n)};var m=this.handleDeferred=function(){for(var B;n.length;)B=n.shift(),B()};function g($,B){se($,B),F($.ioSpecification,B),A($.artifacts,B),o($)}function S($,B){var U=Oe($,function(Ae){return!a(Ae)&&yn(Ae,"bpmn:Process")&&Ae.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){yn(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){se(B,U),A(B.artifacts,U)};function N($,B){var U=u($,B);yn($,"bpmn:SubProcess")&&H($,U||B),yn($,"bpmn:Activity")&&F($.ioSpecification,B),n.push(function(){M($.dataInputAssociations,r(b,B)),M($.dataOutputAssociations,r(b,B))})}function z($,B){u($,B)}function ue($,B){u($,B)}function je($,B){n.push(function(){var U=u($,B);$.childLaneSet&&tt($.childLaneSet,U||B),ee($)})}function tt($,B){M($.lanes,r(je,B))}function X($,B){M($,r(tt,B))}function se($,B){fe($.flowElements,B),$.laneSets&&X($.laneSets,B)}function fe($,B){M($,function(U){yn(U,"bpmn:SequenceFlow")?n.push(function(){z(U,B)}):yn(U,"bpmn:BoundaryEvent")?n.unshift(function(){N(U,B)}):yn(U,"bpmn:FlowNode")?N(U,B):yn(U,"bpmn:DataObject")||(yn(U,"bpmn:DataStoreReference")||yn(U,"bpmn:DataObjectReference")?ue(U,B):l(`unrecognized flowElement ${sn(U)} in context ${sn(B&&B.businessObject)}`,{element:U,context:B}))})}function oe($,B){var U=u($,B),Ae=$.processRef;Ae&&g(Ae,U||B)}function de($,B){M($.participants,r(oe,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 De(e,t){return zi(t,function(n){return v(e,n)})}function K(e){return e&&e.businessObject||e}function Ve(e){return e&&e.di}function T1(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 A1(p);l=l||u.diagrams&&u.diagrams[0];var d=M1(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 M1(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!v(n,"bpmn:Process")&&!v(n,"bpmn:Collaboration")&&(i=k1(n));var r;v(i,"bpmn:Collaboration")?r=i:r=at(e.rootElements,function(u){if(v(u,"bpmn:Collaboration"))return at(u.participants,function(l){return l.processRef===i})});var o=[i];r&&(o=rn(r.participants,function(u){return u.processRef}),o.push(r));var a=qh(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 qh(e){var t=[];return M(e,function(n){n&&(t.push(n),t=t.concat(qh(n.flowElements)))}),t}function k1(e){for(var t=e;t;){if(v(t,"bpmn:Process"))return t;t=t.$parent}}var D1='<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>',Yh=D1,Kh={verticalAlign:"middle"},Xh={color:"#404040"},O1={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},L1={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},I1={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"},N1='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+Yh+'</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>',hi;function B1(){hi=ut(N1),dn(hi,O1),dn(et("svg",hi),Kh),dn(et(".backdrop",hi),L1),dn(et(".notice",hi),I1),dn(et(".link",hi),Xh,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function $1(){hi||(B1(),wn.bind(hi,".backdrop","click",function(e){document.body.removeChild(hi)})),document.body.appendChild(hi)}const Ps=5,Zh="djs-outline-hidden";function ht(e){e=D({},F1,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),z1(this._container)}ie(ht,tr),ht.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||[]),As(s,o),s=j1(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},ht.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},ht.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw As(o,[]),o}if(typeof t=="string"&&(i=H1(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw As(o,[]),o}try{this.clear()}catch(o){throw As(o,[]),o}const{warnings:r}=await T1(this,n,i);return{warnings:r}},ht.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},ht.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=et(":scope > defs",i._svg),a=mh(r),s=o?"<defs>"+mh(o)+"</defs>":"",c=i.getContainer();ft(c).add(Zh);let u;try{u=r.getBBox()}finally{ft(c).remove(Zh)}const l=u.x-Ps,p=u.y-Ps,f=u.width+Ps*2,d=u.height+Ps*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}},ht.prototype._setDefinitions=function(e){this._definitions=e},ht.prototype.getModules=function(){return this._modules},ht.prototype.clear=function(){this.getDefinitions()&&Ji.prototype.clear.call(this)},ht.prototype.destroy=function(){Ji.prototype.destroy.call(this),li(this._container)},ht.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},ht.prototype.off=function(e,t){this.get("eventBus").off(e,t)},ht.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),typeof e=="string"&&(e=et(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},ht.prototype.getDefinitions=function(){return this._definitions},ht.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},ht.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(oi(n,["additionalModules"]),{canvas:D({},n.canvas,{container:e}),modules:a});Ji.call(this,s),n&&n.container&&this.attachTo(n.container)},ht.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},ht.prototype._createContainer=function(e){const t=ut('<div class="bjs-container"></div>');return fn(t,{width:Kh(e.width),height:Kh(e.height),position:e.position}),t},ht.prototype._createModdle=function(e){const t=D({},this._moddleExtensions,e.moddleExtensions);return new ad(t)},ht.prototype._modules=[];function Cs(e,t){return e.warnings=t,e}function N1(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 B1={width:"100%",height:"100%",position:"relative"};function Kh(e){return e+(xe(e)?"px":"")}function $1(e,t){return t&&at(e.diagrams,function(n){return n.id===t})||null}function j1(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Wh+"</a>",i=ut(n);fn(et("svg",i),Uh),fn(i,qh,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),we.bind(i,"click",function(r){I1(),r.preventDefault()})}function ao(e){ht.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(ao,ht),ao.prototype._createModdle=function(e){var t=ht.prototype._createModdle.call(this,e);return t.ids=new ui([32,36,1]),t},ao.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 Be(e,t){return v(e,"bpmn:CallActivity")?!1:v(e,"bpmn:SubProcess")?(t=t||Ve(e),t&&v(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):v(e,"bpmn:Participant")?!!K(e).processRef:!0}function Gt(e){if(!(!v(e,"bpmn:Participant")&&!v(e,"bpmn:Lane"))){var t=Ve(e).isHorizontal;return t===void 0?!0:t}}function F1(e){return e&&K(e).isInterrupting!==!1}function sn(e){return e&&!!K(e).triggeredByEvent}function so(e,t){var n=K(e).eventDefinitions;return Fi(n,function(i){return v(i,t)})}function H1(e){return so(e,"bpmn:ErrorEventDefinition")}function z1(e){return so(e,"bpmn:EscalationEventDefinition")}function V1(e){return so(e,"bpmn:CompensateEventDefinition")}var Dr={width:90,height:20},Xh=15;function er(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 Ps(e){return ke(e.label)}function G1(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=W1(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-=Xh:a+=Xh,{x:a,y:s}}function W1(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 sl(e){return e.waypoints?G1(e.waypoints):v(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Dr.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Dr.height/2}}function U1(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(Dr.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=sl(t),i=Dr),D({x:n.x-i.width/2,y:n.y-i.height/2},i)}function Zh(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 q1(e){var t=e.categoryValueRef;return t&&t.value||""}function In(e){var t=e.businessObject,n=Zh(t);if(n)return n==="categoryValueRef"?q1(t):t[n]||""}function Y1(e,t){var n=e.businessObject,i=Zh(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function K1(e){return ke(e)&&er(e.labelTarget)}var co=7;function Qh(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 ea(e){const t=new Map;return M(el(e),n=>{M(Qh(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 cl="hsl(225, 10%, 15%)",X1="white";function hi(e,t){return Fi(e.eventDefinitions,function(n){return n.$type===t})}function Z1(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function Q1(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function Ie(e,t,n){var i=Ve(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||X1}function te(e,t,n){var i=Ve(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||cl}function ta(e,t,n,i){var r=Ve(e),o=r.get("label");return i||o&&o.get("color:color")||t||te(e,n)}function Jh(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 Tr(r)}function ul(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 Tr(a)}function J1(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 Tr(s)}function eS(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 Tr(o)}function na(e,t={}){return{width:Fn(e,t),height:Sn(e,t)}}function Fn(e,t={}){return _n(t,"width")?t.width:e.width}function Sn(e,t={}){return _n(t,"height")?t.height:e.height}var tS=new ui,nS=10,As=3,iS=1.5,Ts=10,rS=4,uo=.95,oS=1,aS=.25;function Or(e,t,n,i,r,o,a){Si.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:cl,strokeWidth:2,fill:"white"})}function p(C){return n.computeStyle(C,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:cl,strokeWidth:2})}function f(C,_){var{ref:y={x:0,y:0},scale:k=1,element:I,parentGfx:W=r._svg}=_,ae=pe("marker",{id:C,viewBox:"0 0 20 20",refX:y.x,refY:y.y,markerWidth:20*k,markerHeight:20*k,orient:"auto"});Se(ae,I);var Te=et(":scope > defs",W);Te||(Te=pe("defs"),Se(W,Te)),Se(Te,ae)}function d(C,_,y,k){var I=tS.nextPrefixed("marker-");return h(C,I,_,y,k),"url(#"+I+")"}function h(C,_,y,k,I){if(y==="sequenceflow-end"){var W=pe("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 ae=pe("circle",{cx:6,cy:6,r:3.5,...l({fill:k,stroke:I,strokeWidth:1,strokeDasharray:[1e4,1]})});f(_,{element:ae,ref:{x:6,y:6},parentGfx:C})}if(y==="messageflow-end"){var Te=pe("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:Te,ref:{x:8.5,y:5},parentGfx:C})}if(y==="association-start"){var He=pe("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:I,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(_,{element:He,ref:{x:1,y:10},scale:.5,parentGfx:C})}if(y==="association-end"){var bt=pe("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:I,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(_,{element:bt,ref:{x:11,y:10},scale:.5,parentGfx:C})}if(y==="conditional-flow-marker"){var nt=pe("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...l({fill:k,stroke:I})});f(_,{element:nt,ref:{x:-1,y:10},scale:.5,parentGfx:C})}if(y==="conditional-default-flow-marker"){var kt=pe("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={}){Ht(k)&&(I=k,k=0),k=k||0,I=l(I);var W=_/2,ae=y/2,Te=pe("circle",{cx:W,cy:ae,r:Math.round((_+y)/4-k),...I});return Se(C,Te),Te}function g(C,_,y,k,I,W){Ht(I)&&(W=I,I=0),I=I||0,W=l(W);var ae=pe("rect",{x:I,y:I,width:_-I*2,height:y-I*2,rx:k,ry:k,...W});return Se(C,ae),ae}function R(C,_,y,k){var I=_/2,W=y/2,ae=[{x:I,y:0},{x:_,y:W},{x:I,y},{x:0,y:W}],Te=ae.map(function(bt){return bt.x+","+bt.y}).join(" ");k=l(k);var He=pe("polygon",{...k,points:Te});return Se(C,He),He}function E(C,_,y,k){y=p(y);var I=qo(_,y,k);return Se(C,I),I}function x(C,_,y){return E(C,_,y,5)}function b(C,_,y){y=p(y);var k=pe("path",{...y,d:_});return Se(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):Ie(_,s,y.fill),ae=k?Ie(_,s,y.fill):te(_,c,y.stroke),Te=b(C,I,{fill:W,stroke:ae,strokeWidth:1});return Te},"bpmn:TimerEventDefinition":function(C,_,y={}){var k=y.width||_.width,I=y.height||_.height,W=y.width?1:2,ae=m(C,k,I,.2*I,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:W}),Te=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:k,containerHeight:I,position:{mx:.5,my:.5}});b(C,Te,{stroke:te(_,c,y.stroke),strokeWidth:W});for(var He=0;He<12;He++){var bt=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:k,containerHeight:I,position:{mx:.5,my:.5}}),nt=k/2,kt=I/2;b(C,bt,{strokeWidth:1,stroke:te(_,c,y.stroke),transform:"rotate("+He*30+","+kt+","+nt+")"})}return ae},"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):Ie(_,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:Ie(_,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):Ie(_,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):Ie(_,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",ae=b(C,I,{fill:W,stroke:te(_,c,y.stroke),strokeWidth:1});return Vh(ae,45),ae},"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):Ie(_,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):Ie(_,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):Ie(_,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:Ie(_,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=Z1(I),ae=k||C;return I.get("eventDefinitions")&&I.get("eventDefinitions").length>1?I.get("parallelMultiple")?A["bpmn:ParallelMultipleEventDefinition"](_,ae,y,W):A["bpmn:MultipleEventDefinition"](_,ae,y,W):hi(I,"bpmn:MessageEventDefinition")?A["bpmn:MessageEventDefinition"](_,ae,y,W):hi(I,"bpmn:TimerEventDefinition")?A["bpmn:TimerEventDefinition"](_,ae,y,W):hi(I,"bpmn:ConditionalEventDefinition")?A["bpmn:ConditionalEventDefinition"](_,ae,y,W):hi(I,"bpmn:SignalEventDefinition")?A["bpmn:SignalEventDefinition"](_,ae,y,W):hi(I,"bpmn:EscalationEventDefinition")?A["bpmn:EscalationEventDefinition"](_,ae,y,W):hi(I,"bpmn:LinkEventDefinition")?A["bpmn:LinkEventDefinition"](_,ae,y,W):hi(I,"bpmn:ErrorEventDefinition")?A["bpmn:ErrorEventDefinition"](_,ae,y,W):hi(I,"bpmn:CancelEventDefinition")?A["bpmn:CancelEventDefinition"](_,ae,y,W):hi(I,"bpmn:CompensateEventDefinition")?A["bpmn:CompensateEventDefinition"](_,ae,y,W):hi(I,"bpmn:TerminateEventDefinition")?A["bpmn:TerminateEventDefinition"](_,ae,y,W):null}var H={ParticipantMultiplicityMarker:function(C,_,y={}){var k=Fn(_,y),I=Sn(_,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:Ie(_,s,y.fill),stroke:te(_,c,y.stroke)})},SubProcessMarker:function(C,_,y={}){var k=g(C,14,14,0,{strokeWidth:1,fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke)});Zt(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:Ie(_,s,y.fill),stroke:te(_,c,y.stroke)})},ParallelMarker:function(C,_,y){var k=Fn(_,y),I=Sn(_,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:Ie(_,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:Ie(_,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:Ie(_,s,y.fill),stroke:te(_,c,y.stroke)})},LoopMarker:function(C,_,y){var k=Fn(_,y),I=Sn(_,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=Fn(_,y),I=Sn(_,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:Fn(_,k),height:Sn(_,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 ae=I.get("loopCharacteristics"),Te=ae&&ae.get("isSequential");ae&&(D(k,{compensation:k.compensation-18}),y.includes("AdhocMarker")&&D(k,{seq:-23,loop:-18,parallel:-24}),Te===void 0&&y.push("LoopMarker"),Te===!1&&y.push("ParallelMarker"),Te===!0&&y.push("SequentialMarker")),y.includes("CompensationMarker")&&y.length===1&&D(k,{compensation:-8}),M(y,function(He){N(He,C,_,k)})}function ue(C,_,y={}){y=D({size:{width:100}},y);var k=o.createText(_||"",y);return $e(k).add("djs-label"),Se(C,k),k}function je(C,_,y,k={}){var I=K(_),W=na({x:_.x,y:_.y,width:_.width,height:_.height},k);return ue(C,I.name,{align:y,box:W,padding:7,style:{fill:ta(_,u,c,k.stroke)}})}function tt(C,_,y={}){var k={width:_.width,height:_.height,x:_.width/2+_.x,y:_.height/2+_.y};return ue(C,In(_),{box:k,style:D({},o.getExternalStyle(),{fill:ta(_,u,c,y.stroke)})})}function X(C,_,y,k={}){var I=Gt(y),W=ue(C,_,{box:{height:30,width:I?Sn(y,k):Fn(y,k)},align:"center-middle",style:{fill:ta(y,u,c,k.stroke)}});if(I){var ae=-1*Sn(y,k);Ss(W,0,-ae,270)}}function se(C,_,y={}){var{width:k,height:I}=na(_,y);return g(C,k,I,Ts,{...y,fill:Ie(_,s,y.fill),fillOpacity:uo,stroke:te(_,c,y.stroke)})}function fe(C,_,y={}){var k=K(_),I=Ie(_,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=Ge(y,["markerStart","markerEnd"]),x(C,_.waypoints,{...y,stroke:W,strokeDasharray:"0, 5"})}function oe(C,_,y={}){var k=Ie(_,s,y.fill),I=te(_,c,y.stroke),W=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}}),ae=b(C,W,{fill:k,fillOpacity:uo,stroke:I}),Te=K(_);if(Q1(Te)){var He=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.33,my:(_.height-18)/_.height}});b(C,He,{strokeWidth:2,fill:k,stroke:I})}return ae}function de(C,_,y={}){return m(C,_.width,_.height,{fillOpacity:uo,...y,fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke)})}function ee(C,_,y={}){return R(C,_.width,_.height,{fill:Ie(_,s,y.fill),fillOpacity:uo,stroke:te(_,c,y.stroke)})}function $(C,_,y={}){var k=g(C,Fn(_,y),Sn(_,y),0,{fill:Ie(_,s,y.fill),fillOpacity:y.fillOpacity||uo,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=se(C,_,y),I=Be(_);if(sn(_)&&(re(k,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!I)){var W=K(_).flowElements||[],ae=W.filter(Te=>v(Te,"bpmn:StartEvent"));ae.length===1&&U(ae[0],C,y,_)}return je(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:Ie(k,s,y.fill),stroke:te(k,c,y.stroke),width:I,height:I},ae=K(C).isInterrupting,Te=ae?0:3,He=ae?1:1.2,bt=20,nt=(I-bt)/2,kt="translate("+nt+","+nt+")";m(_,bt,bt,{fill:W.fill,stroke:W.stroke,strokeWidth:He,strokeDasharray:Te,transform:kt}),F(C,_,W,k)}function Ae(C,_,y={}){var k=se(C,_,y);return je(C,_,"center-middle",y),z(C,_,void 0,y),k}var wt=this.handlers={"bpmn:AdHocSubProcess":function(C,_,y={}){return Be(_)?y=Ge(y,["fill","stroke","width","height"]):y=Ge(y,["fill","stroke"]),B(C,_,y)},"bpmn:Association":function(C,_,y={}){return y=Ge(y,["fill","stroke"]),fe(C,_,y)},"bpmn:BoundaryEvent":function(C,_,y={}){var{renderIcon:k=!0}=y;y=Ge(y,["fill","stroke"]);var I=K(_),W=I.get("cancelActivity");y={strokeWidth:1.5,fill:Ie(_,s,y.fill),fillOpacity:oS,stroke:te(_,c,y.stroke)},W||(y.strokeDasharray="6");var ae=de(C,_,y);return m(C,_.width,_.height,As,{...y,fill:"none"}),k&&F(_,C,y),ae},"bpmn:BusinessRuleTask":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var k=Ae(C,_,y),I=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),W=b(C,I);re(W,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1});var ae=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),Te=b(C,ae);return re(Te,{fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke),strokeWidth:1}),k},"bpmn:CallActivity":function(C,_,y={}){return y=Ge(y,["fill","stroke"]),B(C,_,{strokeWidth:5,...y})},"bpmn:ComplexGateway":function(C,_,y={}){y=Ge(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=Ge(y,["fill","stroke"]);var k=i.getRawPath("DATA_ARROW"),I=oe(C,_,y);return b(C,k,{fill:"none",stroke:te(_,c,y.stroke),strokeWidth:1}),I},"bpmn:DataInputAssociation":function(C,_,y={}){return y=Ge(y,["fill","stroke"]),fe(C,_,{...y,markerEnd:d(C,"association-end",Ie(_,s,y.fill),te(_,c,y.stroke))})},"bpmn:DataObject":function(C,_,y={}){return y=Ge(y,["fill","stroke"]),oe(C,_,y)},"bpmn:DataObjectReference":L("bpmn:DataObject"),"bpmn:DataOutput":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var k=i.getRawPath("DATA_ARROW"),I=oe(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=Ge(y,["fill","stroke"]),fe(C,_,{...y,markerEnd:d(C,"association-end",Ie(_,s,y.fill),te(_,c,y.stroke))})},"bpmn:DataStoreReference":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var k=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:0,my:.133}});return b(C,k,{fill:Ie(_,s,y.fill),fillOpacity:uo,stroke:te(_,c,y.stroke),strokeWidth:2})},"bpmn:EndEvent":function(C,_,y={}){var{renderIcon:k=!0}=y;y=Ge(y,["fill","stroke"]);var I=de(C,_,{...y,strokeWidth:4});return k&&F(_,C,y),I},"bpmn:EventBasedGateway":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var k=K(_),I=ee(C,_,y);m(C,_.width,_.height,_.height*.2,{fill:Ie(_,"none",y.fill),stroke:te(_,c,y.stroke),strokeWidth:1});var W=k.get("eventGatewayType"),ae=!!k.get("instantiate");function Te(){var bt=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:_.width,containerHeight:_.height,position:{mx:.36,my:.44}});b(C,bt,{fill:"none",stroke:te(_,c,y.stroke),strokeWidth:2})}if(W==="Parallel"){var He=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}});b(C,He,{fill:"none",stroke:te(_,c,y.stroke),strokeWidth:1})}else W==="Exclusive"&&(ae||m(C,_.width,_.height,_.height*.26,{fill:"none",stroke:te(_,c,y.stroke),strokeWidth:1}),Te());return I},"bpmn:ExclusiveGateway":function(C,_,y={}){y=Ge(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=Ve(_);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=Ge(y,["fill","stroke"]),ee(C,_,y)},"bpmn:Group":function(C,_,y={}){return y=Ge(y,["fill","stroke","width","height"]),g(C,_.width,_.height,Ts,{stroke:te(_,c,y.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:Fn(_,y),height:Sn(_,y)})},"bpmn:InclusiveGateway":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var k=ee(C,_,y);return m(C,_.width,_.height,_.height*.24,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:2.5}),k},"bpmn:IntermediateEvent":function(C,_,y={}){var{renderIcon:k=!0}=y;y=Ge(y,["fill","stroke"]);var I=de(C,_,{...y,strokeWidth:1.5});return m(C,_.width,_.height,As,{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=Ge(y,["fill","stroke","width","height"]),$(C,_,{...y,fillOpacity:aS})},"bpmn:ManualTask":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var k=Ae(C,_,y),I=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return b(C,I,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:.5}),k},"bpmn:MessageFlow":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var k=K(_),I=Ve(_),W=Ie(_,s,y.fill),ae=te(_,c,y.stroke),Te=x(C,_.waypoints,{markerEnd:d(C,"messageflow-end",W,ae),markerStart:d(C,"messageflow-start",W,ae),stroke:ae,strokeDasharray:"10, 11",strokeWidth:1.5});if(k.get("messageRef")){var He=Te.getPointAtLength(Te.getTotalLength()/2),bt=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:He.x,y:He.y}}),nt={strokeWidth:1};I.get("messageVisibleKind")==="initiating"?(nt.fill=W,nt.stroke=ae):(nt.fill=ae,nt.stroke=W);var kt=b(C,bt,nt),Ut=k.get("messageRef"),cn=Ut.get("name"),ct=ue(C,cn,{align:"center-top",fitBox:!0,style:{fill:ae}}),$t=kt.getBBox(),jt=ct.getBBox(),Wr=He.x-jt.width/2,Mn=He.y+$t.height/2+nS;Ss(ct,Wr,Mn,0)}return Te},"bpmn:ParallelGateway":function(C,_,y={}){y=Ge(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=Ge(y,["fill","stroke","width","height"]);var k=$(C,_,y),I=Be(_),W=Gt(_),ae=K(_),Te=ae.get("name");if(I){var He=W?[{x:30,y:0},{x:30,y:Sn(_,y)}]:[{x:0,y:30},{x:Fn(_,y),y:30}];E(C,He,{stroke:te(_,c,y.stroke),strokeWidth:iS}),X(C,Te,_,y)}else{var bt=na(_,y);W||(bt.height=Fn(_,y),bt.width=Sn(_,y));var nt=ue(C,Te,{box:bt,align:"center-middle",style:{fill:ta(_,u,c,y.stroke)}});if(!W){var kt=-1*Sn(_,y);Ss(nt,0,-kt,270)}}return ae.get("participantMultiplicity")&&N("ParticipantMultiplicityMarker",C,_,y),k},"bpmn:ReceiveTask":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var k=K(_),I=Ae(C,_,y),W;return k.get("instantiate")?(m(C,28,28,20*.22,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1}),W=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):W=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),b(C,W,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1}),I},"bpmn:ScriptTask":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var k=Ae(C,_,y),I=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return b(C,I,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1}),k},"bpmn:SendTask":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var k=Ae(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:Ie(_,s,y.fill),strokeWidth:1}),k},"bpmn:SequenceFlow":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var k=Ie(_,s,y.fill),I=te(_,c,y.stroke),W=x(C,_.waypoints,{markerEnd:d(C,"sequenceflow-end",k,I),stroke:I}),ae=K(_),{source:Te}=_;if(Te){var He=K(Te);ae.get("conditionExpression")&&v(He,"bpmn:Activity")&&re(W,{markerStart:d(C,"conditional-flow-marker",k,I)}),He.get("default")&&(v(He,"bpmn:Gateway")||v(He,"bpmn:Activity"))&&He.get("default")===ae&&re(W,{markerStart:d(C,"conditional-default-flow-marker",k,I)})}return W},"bpmn:ServiceTask":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var k=Ae(C,_,y);m(C,10,10,{fill:Ie(_,s,y.fill),stroke:"none",transform:"translate(6, 6)"});var I=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});b(C,I,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1}),m(C,10,10,{fill:Ie(_,s,y.fill),stroke:"none",transform:"translate(11, 10)"});var W=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return b(C,W,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1}),k},"bpmn:StartEvent":function(C,_,y={}){var{renderIcon:k=!0}=y;y=Ge(y,["fill","stroke"]);var I=K(_);I.get("isInterrupting")||(y={...y,strokeDasharray:"6"});var W=de(C,_,y);return k&&F(_,C,y),W},"bpmn:SubProcess":function(C,_,y={}){return Be(_)?y=Ge(y,["fill","stroke","width","height"]):y=Ge(y,["fill","stroke"]),B(C,_,y)},"bpmn:Task":function(C,_,y={}){return y=Ge(y,["fill","stroke"]),Ae(C,_,y)},"bpmn:TextAnnotation":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var{width:k,height:I}=na(_,y),W=g(C,k,I,0,0,{fill:"none",stroke:"none"}),ae=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:k,containerHeight:I,position:{mx:0,my:0}});b(C,ae,{stroke:te(_,c,y.stroke)});var Te=K(_),He=Te.get("text")||"";return ue(C,He,{align:"left-top",box:na(_,y),padding:co,style:{fill:ta(_,u,c,y.stroke)}}),W},"bpmn:Transaction":function(C,_,y={}){Be(_)?y=Ge(y,["fill","stroke","width","height"]):y=Ge(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=Be(_);return W||(y={}),g(C,Fn(_,y),Sn(_,y),Ts-As,As,I),k},"bpmn:UserTask":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var k=Ae(C,_,y),I=15,W=12,ae=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:I,y:W}});b(C,ae,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:.5});var Te=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:I,y:W}});b(C,Te,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:.5});var He=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:I,y:W}});return b(C,He,{fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke),strokeWidth:.5}),k},label:function(C,_,y={}){return tt(C,_,y)}};this._drawPath=b,this._renderer=T}ie(Or,Si),Or.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Or.prototype.canRender=function(e){return v(e,"bpmn:BaseElement")},Or.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Or.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Or.prototype.getShapePath=function(e){return ke(e)?ul(e,rS):v(e,"bpmn:Event")?Jh(e):v(e,"bpmn:Activity")?ul(e,Ts):v(e,"bpmn:Gateway")?J1(e):eS(e)};function Ge(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var sS=0,cS={width:150,height:50};function uS(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function lS(e){return Ht(e)?D({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var ll=null;function pS(){return ll||(ll=document.createElement("canvas").getContext("2d")),ll}function fS(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(em(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function em(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function dS(e,t){var n=pS();if(!n)return{width:0,height:0};n.font=fS(t),"letterSpacing"in n&&(n.letterSpacing=em(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 hS(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=dS(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return mS(e,r,i,o);r=yS(r,o.width,t)}}function mS(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 tm="";function gS(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===tm)&&r.pop();break}var a=r[r.length-1];return a&&a===tm&&(r[r.length-1]="-"),r.join("")}function yS(e,t,n){var i=Math.max(e.length*(n/t),1),r=gS(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function Ms(e){this._config=D({},{size:cS,padding:sS,style:{},align:"center-top"},e||{})}Ms.prototype.createText=function(e,t){return this.layoutText(e,t).element},Ms.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Ms.prototype.layoutText=function(e,t){for(var n=D({},this._config.size,t.box),i=D({},this._config.style,t.style),r=uS(t.align||this._config.align),o=lS(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=vS(i),c=e.split(/\u00AD?\r?\n/),u=[],l=n.width-o.left-o.right;c.length;)u.push(hS(c,l,i));r.vertical==="middle"&&(o.top=o.bottom=0);var p=bn(u,function(g,R,E){return g+(s||R.height)},0)+o.top+o.bottom,f=bn(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=pe("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=pe("tspan");re(E,{x:R,y:d}),E.textContent=g.text,Se(h,E)});var m={width:f,height:p};return{dimensions:m,element:h}};function vS(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var _S=12,bS=1.2,xS=40;function nm(e){var t=D({fontFamily:"Arial, sans-serif",fontSize:_S,fontWeight:"normal",lineHeight:bS},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=D({},t,{fontSize:n},e&&e.externalStyle||{}),r=new Ms({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Dr.width),height:30},u=o(s,c,{style:i});return{x:Math.round(a.x+a.width/2-u.width/2),y:a.y,width:Math.ceil(u.width),height:Math.ceil(u.height)}},this.getTextAnnotationBounds=function(a,s){var c=o(s,a,{style:t,align:"left-top",padding:co});return{x:a.x,y:a.y,width:a.width,height:Math.max(xS,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}}nm.$inject=["config.textRenderer"];function ES(){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=CS(i.d,{mx:r,my:o,e:a});return p}}var wS=/\{([^{}]+)\}/g,SS=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function RS(e,t,n){var i=n;return t.replace(SS,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 CS(e,t){return String(e).replace(wS,function(n,i){return RS(n,i,t)})}const PS={__init__:["bpmnRenderer"],bpmnRenderer:["type",Or],textRenderer:["type",nm],pathMap:["type",ES]};function AS(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const ia={translate:["value",AS]};function ks(e,t,n){return D({id:e.id,type:e.$type,businessObject:e,di:t},n)}function TS(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 im(e,t,n){return new Error(`element ${an(t)} referenced by ${an(e)}#${n} not yet drawn`)}function Ai(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}Ai.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],Ai.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(ks(e,t,a)),this._canvas.addRootElement(i)}else if(v(t,"bpmndi:BPMNShape")){var s=!Be(e,t),c=kS(e);r=n&&(n.hidden||n.collapsed);var u=t.bounds;i=this._elementFactory.createShape(ks(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")&&(MS(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(ks(e,t,{hidden:r,source:l,target:p,waypoints:TS(t,l,p)})),v(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${an(t)} for element ${an(e)}`);return er(e)&&In(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},Ai.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${an(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw im(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},Ai.prototype.addLabel=function(e,t,n){var i,r,o;return i=U1(t,n),r=In(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(ks(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!In(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)},Ai.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?im(e,i,t+"Ref"):new Error(`${an(e)}#${t} Ref not specified`)},Ai.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},Ai.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},Ai.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function MS(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 kS(e){return v(e,"bpmn:Group")}const rm={__depends__:[PS,{__depends__:[ia],bpmnImporter:["type",Ai]}]};function ra(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function ei(e,t){return{x:e.x-t.x,y:e.y-t.y}}function pl(e){return Math.log(e)/Math.log(10)}var DS=1e3;function Y(e){this._eventBus=e}Y.$inject=["eventBus"];function OS(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((zt(t)||xe(t))&&(o=r,r=i,i=n,n=t,t=null),zt(n)&&(o=r,r=i,i=n,n=DS),Ht(r)&&(o=r,r=!1),!zt(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?OS(i,o):i,o)})},Y.prototype.canExecute=Ti("canExecute"),Y.prototype.preExecute=Ti("preExecute"),Y.prototype.preExecuted=Ti("preExecuted"),Y.prototype.execute=Ti("execute"),Y.prototype.executed=Ti("executed"),Y.prototype.postExecute=Ti("postExecute"),Y.prototype.postExecuted=Ti("postExecuted"),Y.prototype.revert=Ti("revert"),Y.prototype.reverted=Ti("reverted");function Ti(e){return function(n,i,r,o,a){(zt(n)||xe(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var fl=["top","bottom","left","right"],Ds=10;function dl(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(Ps(r)&&!it(r)){var o=NS(r);o&&i(r,o)}}function i(r,o){var a=ye(r),s=r.label,c=ye(s);if(s.parent){var u=me(r),l;switch(o){case"top":l={x:a.x,y:u.top-Ds-s.height/2};break;case"left":l={x:u.left-Ds-s.width/2,y:a.y};break;case"bottom":l={x:a.x,y:u.bottom+Ds+s.height/2};break;case"right":l={x:u.right+Ds+s.width/2,y:a.y};break}var p=ei(l,c);t.moveShape(s,p)}}}ie(dl,Y),dl.$inject=["eventBus","modeling"];function LS(e){var t=e.host,n=ye(e),i=Xt(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=fl.filter(function(a){return r.indexOf(a)===-1});return o}function IS(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 om(t,i)});return n}function NS(e){var t=ye(e.label),n=ye(e),i=om(n,t);if(BS(i)){var r=IS(e);if(e.host){var o=LS(e);r=r.concat(o)}var a=fl.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?Xt(e.label,e)!=="intersect"?void 0:i:a[0]}}function om(e,t){return Xt(t,e,5)}function BS(e){return fl.indexOf(e)!==-1}function hl(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(hl,Y),hl.$inject=["eventBus"];var $S=1500;function ml(e,t,n){e.invoke(Y,this),this.preExecute("elements.delete",$S,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(Kr(io(Array.from(s),Rt(u))));c=c.union(l),s=s.difference(l)}),Array.from(c)}}ie(ml,Y),ml.$inject=["injector","eventBus","canvas"];function gl(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(gl,Y),gl.$inject=["injector","modeling"];function lo(e,t){for(vn(t)&&(t=[t]);e=e.parent;)if(De(e,t))return e;return null}function am(e,t){var n=lo(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=lo(e,i),n)return Gt(n);if(De(e,i))return Gt(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?Gt(o):!0}var sm=500;function Os(e,t){t.invoke(Y,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",sm,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return cm(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",sm,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];cm(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}Os.$inject=["bpmnReplace","injector"],ie(Os,Y),Os.prototype._replaceShape=function(e,t){var n=jS(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function jS(e){var t=K(e),n=t.eventDefinitions;return n&&n[0]}function cm(e,t){return!ke(e)&&De(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function yl(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)})})}yl.$inject=["eventBus","modeling"],ie(yl,Y);function um(e){return e.create("bpmn:Category")}function FS(e){return e.create("bpmn:CategoryValue")}function lm(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=FS(e)),n.$parent||(n.$parent=um(e)),n}function HS(e,t,n){return Et(t.get("categoryValue"),e),e.$parent=t,Et(n.get("rootElements"),t),t.$parent=n,e}function zS(e){var t=e.$parent;return t&&(_t(t.get("categoryValue"),e),e.$parent=null),e}function VS(e){var t=e.$parent;return t&&(_t(t.get("rootElements"),e),e.$parent=null),e}var GS=500;function vl(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&&HS(c,u,e.getDefinitions())}function s(c,u,l){u&&!o(u,l)&&VS(u),c&&!r(c,l)&&zS(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"],GS,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){pm(c).forEach(function(u){a(u.categoryValue,u.category)})},!0),this.reverted("group.updateRefs",function(c){pm(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)}vl.$inject=["bpmnjs","elementRegistry","injector"],ie(vl,Y);function pm(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function _l(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;po(R)&&oa(E)&&l(E)}function r(g){const R=g.connection,E=g.source,x=g.target;po(E)&&Ls(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;oa(x)&&l(x),po(b)&&Ls(R)&&u(R)}}function a(g){const{element:R}=g;oa(R)?(p(R),d(R)):Ls(R)&&h(R)}function s(g){const{newData:R,oldShape:E}=g;if(po(g.oldShape)&&R.eventDefinitionType!=="bpmn:CompensateEventDefinition"||R.type!=="bpmn:BoundaryEvent"){const x=E.outgoing.find(({target:b})=>oa(b));x&&x.target&&(g._connectionTarget=x.target)}else if(!po(g.oldShape)&&R.eventDefinitionType==="bpmn:CompensateEventDefinition"&&R.type==="bpmn:BoundaryEvent"){const x=E.outgoing.find(({target:b})=>Ls(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=>oa(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=>po(E.source));t.removeElements(R)}function m(g){const R=g.outgoing.filter(E=>v(E,"bpmn:SequenceFlow"));t.removeElements(R)}}ie(_l,Y),_l.$inject=["eventBus","modeling","bpmnRules"];function oa(e){const t=K(e);return t&&t.get("isForCompensation")}function po(e){return e&&v(e,"bpmn:BoundaryEvent")&&so(e,"bpmn:CompensateEventDefinition")}function Ls(e){return e&&v(e,"bpmn:Activity")&&!sn(e)}function bl(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=lo(i,"bpmn:Participant"))})}bl.$inject=["injector"],ie(bl,Y);function xl(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}})}xl.$inject=["eventBus","bpmnFactory"],ie(xl,Y);var El=20,wl=20,fm=30,Is=2e3;function Sl(e,t,n){Y.call(this,t),t.on(["create.start","shape.move.start"],Is,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")&&!ke(p)&&!it(p)});if(c.length){var u=Rt(c),l=WS(a,u);D(a,l),o.createConstraints=US(a,u)}}}),t.on("create.start",Is,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",Is,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",Is,function(r){var o=r.elements,a=r.parent,s=qS(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)}Sl.$inject=["canvas","eventBus","modeling"],ie(Sl,Y);function WS(e,t){t={width:t.width+El*2+fm,height:t.height+wl*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 US(e,t){return t=me(t),{bottom:t.top+e.height/2-wl,left:t.right-e.width/2+El,top:t.bottom-e.height/2+wl,right:t.left+e.width/2-El-fm}}function qS(e){return at(e,function(t){return v(t,"bpmn:Participant")})}var dm="__targetRef_placeholder";function Rl(e,t){Y.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],hm(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],hm(o));function n(a,s,c){var u=a.get("dataInputAssociations");return at(u,function(l){return l!==c&&l.targetRef===s})}function i(a,s){var c=a.get("properties"),u=at(c,function(l){return l.name===dm});return!u&&s&&(u=t.create("bpmn:Property",{name:dm}),Et(c,u)),u}function r(a,s){var c=i(a);c&&(n(a,c,s)||_t(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}}Rl.$inject=["eventBus","bpmnFactory"],ie(Rl,Y);function hm(e){return function(t){var n=t.context,i=n.connection;if(v(i,"bpmn:DataInputAssociation"))return e(t)}}function Ns(e){this._bpmnUpdater=e}Ns.$inject=["bpmnUpdater"],Ns.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),[]},Ns.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 Cl(e,t,n,i){Y.call(this,i),t.registerHandler("dataStore.updateContainment",Ns);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:Ve(s),newSemanticParent:l.processRef||l,newDiParent:Ve(c)})}}this.preExecute("shape.create",function(s){var c=s.context,u=c.shape;v(u,"bpmn:DataStoreReference")&&u.type!=="label"&&(c.hints||(c.hints={}),c.hints.autoResize=!1)}),this.preExecute("elements.move",function(s){var c=s.context,u=c.shapes,l=u.filter(function(p){return v(p,"bpmn:DataStoreReference")});l.length&&(c.hints||(c.hints={}),c.hints.autoResize=u.filter(function(p){return!v(p,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,u=c.shape,l=u.parent;v(u,"bpmn:DataStoreReference")&&u.type!=="label"&&v(l,"bpmn:Collaboration")&&a(u)}),this.postExecute("shape.move",function(s){var c=s.context,u=c.shape,l=c.oldParent,p=u.parent;if(!v(l,"bpmn:Collaboration")&&v(u,"bpmn:DataStoreReference")&&u.type!=="label"&&v(p,"bpmn:Collaboration")){var f=v(l,"bpmn:Participant")?l:KS(l,"bpmn:Participant");a(u,f)}}),this.postExecute("shape.delete",function(s){var c=s.context,u=c.shape,l=e.getRootElement();De(u,["bpmn:Participant","bpmn:SubProcess"])&&v(l,"bpmn:Collaboration")&&o(l).filter(function(p){return YS(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)})})}Cl.$inject=["canvas","commandStack","elementRegistry","eventBus"],ie(Cl,Y);function YS(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 KS(e,t){for(;e.parent;){if(v(e.parent,t))return e.parent;e=e.parent}}var Bs=Math.max,$s=Math.min,XS=20;function mm(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function ZS(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 QS(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 js(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)?$s:Bs)(i,r)),xe(o)&&(i=(/top|left/.test(e)?Bs:$s)(i,o)),i}function JS(e,t){if(!t)return e;var n=me(e);return xs({top:js("top",n,t),right:js("right",n,t),bottom:js("bottom",n,t),left:js("left",n,t)})}function eR(e,t,n,i){var r=me(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?me(i):o,s={top:$s(o.top,a.top),left:$s(o.left,a.left),bottom:Bs(o.bottom,a.bottom),right:Bs(o.right,a.right)};return xs(s)}function aa(e,t){return typeof e<"u"?e:XS}function tR(e,t){var n,i,r,o;return typeof t=="object"?(n=aa(t.left),i=aa(t.right),r=aa(t.top),o=aa(t.bottom)):n=i=r=o=aa(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function nR(e){return!(e.waypoints||e.type==="label")}function gm(e,t){var n;if(e.length===void 0?n=Oe(e.children,nR):n=e,n.length)return tR(Rt(n),t)}var tr=Math.abs;function iR(e,t){return mm(me(t),me(e))}var rR=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Hn=30;function Fs(e,t){return t=t||[],e.children.filter(function(n){v(n,"bpmn:Lane")&&(Fs(n,t),t.push(n))}),t}function nr(e){return e.children.filter(function(t){return v(t,"bpmn:Lane")})}function zn(e){return lo(e,rR)||e}function oR(e,t){var n=zn(e),i=v(n,"bpmn:Process")?[]:[n],r=Fs(n,i),o=me(e),a=me(t),s=iR(e,t),c=[],u=Gt(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=me(l);s.top&&(tr(m.bottom-o.top)<10&&(d=a.top-m.bottom),tr(m.top-o.top)<5&&(p=a.top-m.top)),s.left&&(tr(m.right-o.left)<10&&(f=a.left-m.right),tr(m.left-o.left)<5&&(h=a.left-m.left)),s.bottom&&(tr(m.top-o.bottom)<10&&(p=a.bottom-m.top),tr(m.bottom-o.bottom)<5&&(d=a.bottom-m.bottom)),s.right&&(tr(m.left-o.right)<10&&(h=a.right-m.left),tr(m.right-o.right)<5&&(f=a.right-m.right)),(p||f||d||h)&&c.push({shape:l,newBounds:QS(l,{top:p,right:f,bottom:d,left:h})})}}),c}var aR=500;function Pl(e,t){Y.call(this,e);function n(i,r){var o=Gt(i),a=nr(r),s=[],c=[],u=[],l=[];if(Mr(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",aR,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))})}Pl.$inject=["eventBus","spaceTool"],ie(Pl,Y);var ym=500;function Hs(e,t){t.invoke(Y,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",ym,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return vm(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",ym,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;vm(a,cR(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}Hs.$inject=["bpmnReplace","injector"],ie(Hs,Y),Hs.prototype._replaceShape=function(e){var t=sR(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function sR(e){var t=K(e),n=t.eventDefinitions;return n&&n[0]}function vm(e,t){return!ke(e)&&v(e,"bpmn:BoundaryEvent")&&!t}function cR(e,t){return e.indexOf(t)!==-1}var zs=Math.round,uR=Math.max;function lR(e,t){var n=e.x,i=e.y;return[["M",n,i],["m",0,-t],["a",t,t,0,1,1,0,2*t],["a",t,t,0,1,1,0,-2*t],["z"]]}function pR(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var _m=10;function fR(e,t){var n,i;for(n=0;i=e[n];n++)if(Xo(i,t)<=_m)return{point:e[n],bendpoint:!0,index:n};return null}function dR(e,t){var n=Sh(lR(t,_m),pR(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=uR(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:zs(i.x+r.x)/2,y:zs(i.y+r.y)/2},index:i.segment2}:{point:{x:zs(i.x),y:zs(i.y)},index:i.segment2}:null}function Al(e,t){return fR(e,t)||dR(e,t)}function Tl(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=Al(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||!bm(r,c[c.length-1]))&&c.push(xm(l)),(u.length===1||!bm(r,u[0]))&&u.unshift(xm(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=at(o.children,function(f){var d=t.canInsert(a,f);return d&&Al(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(Tl,Y),Tl.$inject=["eventBus","bpmnRules","modeling"];function bm(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 xm(e){return D({},e)}function Ml(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)&&fo(r)){var c=[];v(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(u=>u!==r&&fo(u)):c=a.incoming.filter(u=>u!==r&&fo(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(fo).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(fo).forEach(function(s){const c=a.incoming.filter(fo).filter(function(u){return u.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}Ml.$inject=["eventBus","modeling"],ie(Ml,Y);function fo(e){return v(e,"bpmn:SequenceFlow")}var Vs=1500,Em=2e3;function wm(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"],Vs,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;v(a,"bpmn:Lane")&&!De(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=zn(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||De(o,["bpmn:Group","bpmn:TextAnnotation"]))&&(i.hover=s,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.hover","connect.out","connect.end","connect.cleanup","global-connect.hover","global-connect.out","global-connect.end","global-connect.cleanup"],Vs,function(i){var r=i.hover;v(r,"bpmn:Lane")&&(i.hover=zn(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Vs,function(i){var r=i.context,o=i.hover,a=r.type;v(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=zn(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Vs,function(i){var r=i.context,o=r.start;v(o,"bpmn:Lane")&&(r.start=zn(o)||o)}),t.on("shape.move.start",Em,function(i){var r=i.shape;v(r,"bpmn:Lane")&&(i.shape=zn(r)||r)}),t.on("spaceTool.move",Em,function(i){var r=i.hover;r&&v(r,"bpmn:Lane")&&(i.hover=zn(r))})}wm.$inject=["elementRegistry","eventBus","canvas"];var Sm=770;function kl(e,t,n,i){n.invoke(Y,this);function r(s,c){var u=K(s),l=c.categoryValue||u.categoryValueRef;l||(l=lm(e,u));var p=c.category||l.$parent||um(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",Sm,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",Sm,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})}kl.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],ie(kl,Y);function Dl(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 Rm(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=Dl(i,r,o,a),u=Dl(i,r,o,s),l;c&&u?Cm(c,o)>Cm(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)})}Rm.$inject=["eventBus"];function Cm(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Ol(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=Ve(i);if(De(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}Ol.$inject=["eventBus"],ie(Ol,Y);function Pm(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Am(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function hR(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 mR(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 Ll(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=mR([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 Tm(e,t){var n=Ll(e,t),i={x:n.x-e.x,y:n.y-e.y};return Pm(i)}function sa(e,t){return Pm({x:e.x-t.x,y:e.y-t.y})}var Mm=Math.sqrt,km=Math.min,gR=Math.max,Dm=Math.abs;function Om(e){return Math.pow(e,2)}function ca(e,t){return Mm(Om(e.x-t.x)+Om(e.y-t.y))}function yR(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],Im(i,r)?u=[i]:(o=ca(e,i),a=ca(e,r),c=km(o,a),u=vR(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:Im(i,u[0])?n:n+1}),u.length===2&&(s=bR(u[0],u[1]),l={type:"segment",position:s,segmentIndex:n,relativeLocation:ca(i,s)/ca(i,r)}),p=ca(l.position,e),(!d||f>p)&&(d=l,f=p)}return d}function vR(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=Mm(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 _R(x,e,t)})}function _R(e,t,n){return Lm(e.x,t.x,n.x)&&Lm(e.y,t.y,n.y)}function Lm(e,t,n){return e>=km(t,n)-Gs&&e<=gR(t,n)+Gs}function bR(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Gs=.1;function Im(e,t){return Dm(e.x-t.x)<=Gs&&Dm(e.y-t.y)<=Gs}function xR(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=Bm(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 Nm(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=yR(e,n),c=s.segmentIndex,u=xR(n,t,s,i);if(u<0||u>t.length-2||u===null)return a;var l=$m(n,c),p=$m(t,u),f=s.position,d=wR(l,f),h=ER(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=Bm(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=hR({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:Ci(x),delta:Ci({x:r,y:o})}}function Bm(e,t){var n=sa(e[t-1],e[t]),i=sa(e[t],e[t+1]),r=n/(n+i);return r}function ER(e,t){var n=Am(e),i=Am(t);return i-n}function $m(e,t){return[e[t],e[t+1]]}function wR(e,t){var n=sa(e[0],e[1]),i=sa(e[0],t);return n===0?0:i/n}function SR(e,t,n,i){var r=ye(e);return Nm(r,t,n,i).delta}function ua(e,t,n){var i=ra(t),r=ra(n),o=ei(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return Ci({x:r.x+a.x,y:r.y+a.y})}function jm(e,t,n){var i=ra(e),r=ra(t),o=ra(n),a=ei(e,i),s=ei(i,r),c=RR(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 Ci({x:l.x+a.x-e.x,y:l.y+a.y-e.y})}function RR(e,t,n){var i=me(t),r=me(n);if(CR(i,r))return null;var o=Xt(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=Xt(n,s),c!==o?null:a}function CR(e,t){return PR(e,t)||AR(e,t)}function PR(e,t){return e.right!==t.right&&e.left!==t.left}function AR(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var Fm="name",Hm="text";function Il(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(Fm in u&&t.updateLabel(c,u[Fm]),Hm in u&&v(c,"bpmn:TextAnnotation")){var l=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},u[Hm]||"");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;ke(u)||!er(u)||In(u)&&t.updateLabel(u,In(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),SR(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&&er(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(!(!ke(c)||u.autoResize)){var l=s.newBounds,p=i.getDimensions(In(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(Ps(c)){var p=c.label,f=ye(p),d=kR(l),h=MR(f,d),m=TR(h,l,u);t.moveShape(p,m)}})}ie(Il,Y),Il.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function TR(e,t,n){var i=ua(e,t,n);return Ci(ei(i,e))}function MR(e,t){if(t.length){var n=DR(e,t);return Ll(e,n)}}function kR(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 DR(e,t){var n=t.map(function(r){return{line:r,distance:Tm(e,r)}}),i=ri(n,"distance");return i[0].line}function OR(e,t,n,i){return Nm(e,t,n,i).point}function Nl(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),OR(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(Nl,Y),Nl.$inject=["eventBus","modeling"];function Ws(e,t,n){var i=qs(e),r=Vm(i,t),o=i[0];return r.length?r[r.length-1]:ua(o.original||o,n,t)}function Us(e,t,n){var i=qs(e),r=Vm(i,t),o=i[i.length-1];return r.length?r[0]:ua(o.original||o,n,t)}function Bl(e,t,n){var i=qs(e),r=zm(t,n),o=i[0];return ua(o.original||o,r,t)}function $l(e,t,n){var i=qs(e),r=zm(t,n),o=i[i.length-1];return ua(o.original||o,r,t)}function zm(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function qs(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Vm(e,t){var n=nn(e,IR);return Oe(n,function(i){return LR(i,t)})}function LR(e,t){return Xt(t,e,1)==="intersect"}function IR(e){return e.original||e}function jl(e,t){Y.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(NR(i,r)){var o=BR(i);o.incoming.forEach(function(a){var s=Us(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=Ws(a,r,i);t.reconnectStart(a,r,s)})}},!0)}jl.$inject=["eventBus","modeling"],ie(jl,Y);function NR(e,t){return v(e,"bpmn:Participant")&&Be(e)&&v(t,"bpmn:Participant")&&!Be(t)}function BR(e){var t=Yo([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 $R=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Gm(e){const t=K(e);if(!v(t,"bpmn:BoundaryEvent")&&!(v(t,"bpmn:StartEvent")&&sn(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:$R.some(i=>v(n[0],i))}function Wm(e){return v(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Fl(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(!Gm(r))return;const a=Wm(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})})}Fl.$inject=["injector","modeling"],ie(Fl,Y);function Hl(e,t){Y.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=Ve(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}ie(Hl,Y),Hl.$inject=["eventBus","modeling"];function zl(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=jR(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}ie(zl,Y),zl.$inject=["eventBus","bpmnRules","modeling"];function ho(e){return e.original||e}function jR(e,t){var n=Dl(ho(e[e.length-2]),ho(e[e.length-1]),ho(t[1]),ho(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[ho(e[0]),ho(t[t.length-1])]}function Vl(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)}Vl.$inject=["eventBus","modeling"],ie(Vl,Y);function Gl(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=at(p.outgoing,Zr({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(Gl,Y),Gl.$inject=["eventBus","modeling","bpmnRules","injector"];function Ys(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=bn(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){sn(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(Ys,Y),Ys.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)},Ys.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var FR=1500,HR={width:140,height:120},Wl={width:300,height:60},Ul={width:60,height:300},Ks={width:300,height:150},Xs={width:150,height:300},Um={width:140,height:120},qm={width:100,height:40};function Ym(e){e.on("resize.start",FR,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=UR(i,r,o)),v(i,"bpmn:SubProcess")&&Be(i)&&(n.minDimensions=Um),v(i,"bpmn:TextAnnotation")&&(n.minDimensions=qm)})}Ym.$inject=["eventBus"];var ir=Math.abs,zR=Math.min,VR=Math.max;function Km(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function mo(e,t,n){return Km(e,t,n,zR)}function go(e,t,n){return Km(e,t,n,VR)}var GR={top:20,left:50,right:20,bottom:20},WR={top:50,left:20,right:20,bottom:20};function UR(e,t,n){var i=zn(e),r=!0,o=!0,a=Fs(i,[i]),s=me(e),c={},u={},l=Gt(e),p=l?Wl:Ul;/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=me(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&&ir(s.top-m.bottom)<10&&go(c,"top",m.top+p.height),ir(s.top-m.top)<5&&mo(u,"top",m.bottom-p.height)),/e/.test(t)&&(n&&ir(s.right-m.left)<10&&mo(c,"right",m.right-p.width),ir(s.right-m.right)<5&&go(u,"right",m.left+p.width)),/s/.test(t)&&(n&&ir(s.bottom-m.top)<10&&mo(c,"bottom",m.bottom-p.height),ir(s.bottom-m.bottom)<5&&go(u,"bottom",m.top+p.height)),/w/.test(t)&&(n&&ir(s.left-m.right)<10&&go(c,"left",m.left+p.width),ir(s.left-m.left)<5&&mo(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?GR:WR;return f.forEach(function(h){var m=me(h);/n/.test(t)&&(!l||r)&&mo(u,"top",m.top-d.top),/e/.test(t)&&(l||o)&&go(u,"right",m.right+d.right),/s/.test(t)&&(!l||o)&&go(u,"bottom",m.bottom+d.bottom),/w/.test(t)&&(l||r)&&mo(u,"left",m.left-d.left)}),{min:u,max:c}}function Xm(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function yo(e){return e.originalEvent||e.srcEvent}function ql(e){Xm(e),Xm(yo(e))}function Lr(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 Zm(){return/mac/i.test(navigator.platform)}function Qm(e,t){return(yo(e)||e).button===t}function rr(e){return Qm(e,0)}function qR(e){return Qm(e,1)}function la(e){var t=yo(e)||e;return rr(e)?Zm()?t.metaKey:t.ctrlKey:!1}function Zs(e){var t=yo(e)||e;return rr(e)&&t.shiftKey}var Jm=1001;function eg(e,t){e.on("resize.start",Jm+500,function(n){var i=n.context,r=i.shape;(v(r,"bpmn:Lane")||v(r,"bpmn:Participant"))&&(i.balanced=!la(n))}),e.on("resize.end",Jm,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=Th(a),t.resizeLane(r,a,i.balanced)),!1})}eg.$inject=["eventBus","modeling"];var YR=500;function Yl(e,t,n,i,r){n.invoke(Y,this);function o(l){return De(l,["bpmn:ReceiveTask","bpmn:SendTask"])||KR(l,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(l){var p=e.getDefinitions(),f=p.get("rootElements");return!!at(f,Zr({id:l.id}))}function s(l){if(v(l,"bpmn:ErrorEventDefinition"))return"errorRef";if(v(l,"bpmn:EscalationEventDefinition"))return"escalationRef";if(v(l,"bpmn:MessageEventDefinition"))return"messageRef";if(v(l,"bpmn:SignalEventDefinition"))return"signalRef"}function c(l){if(De(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.get("messageRef");var p=l.get("eventDefinitions"),f=p[0];return f.get(s(f))}function u(l,p){if(De(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.set("messageRef",p);var f=l.get("eventDefinitions"),d=f[0];return d.set(s(d),p)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var p=l.shape||l.element;if(o(p)){var f=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");_t(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",YR,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)})}Yl.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],ie(Yl,Y);function KR(e,t){return ge(t)||(t=[t]),Fi(t,function(n){return so(e,n)})}var tg=Math.max;function ng(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]=ZR(a,i,r)),v(a,"bpmn:Lane")&&(o[s]=Gt(a)?Wl:Ul),v(a,"bpmn:SubProcess")&&Be(a)&&(o[s]=Um),v(a,"bpmn:TextAnnotation")&&(o[s]=qm),v(a,"bpmn:Group")&&(o[s]=HR)}),o})}ng.$inject=["eventBus"];function XR(e){return e==="x"}function ZR(e,t,n){var i=Gt(e);if(!eC(e))return i?Ks:Xs;var r=XR(t),o={};return r?i?o=Ks:o={width:JR(e,n,r),height:Xs.height}:i?o={width:Ks.width,height:QR(e,n,r)}:o=Xs,o}function QR(e,t,n){var i;return i=tC(e,t,n),tg(Ks.height,i)}function JR(e,t,n){var i;return i=nC(e,t,n),tg(Xs.width,i)}function eC(e){return!!nr(e).length}function tC(e,t,n){var i=nr(e),r;return r=Kl(i,t,n),e.height-r.height+Wl.height}function nC(e,t,n){var i=nr(e),r;return r=Kl(i,t,n),e.width-r.width+Ul.width}function Kl(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=nr(r),o.length?Kl(o,t,n):r}var ig="_plane";function rg(e){var t=e.id;return iC(t)}function mi(e){var t=e.id;return v(e,"bpmn:SubProcess")?og(t):t}function Ir(e){return og(e)}function Qs(e){var t=Ve(e);return v(t,"bpmndi:BPMNPlane")}function og(e){return e+ig}function iC(e){return e.replace(new RegExp(ig+"$"),"")}var ag=400,rC=600,sg={x:180,y:160};function Mi(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")&&!Be(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(mi(d));e.removeRootElement(h)}this.executed("shape.create",function(p){var f=p.shape;c(f)&&u(p)},!0),this.postExecuted("elements.create",function(p){var f=p.elements;M(f,function(d){if(c(d)){var h=a.get(mi(d));if(!(!h||!d.children||!d.children.length)){var m=cg(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")||!Be(f)||M(ea([f]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(p){var f=p.shape;if(c(f)){var d=a.get(mi(f));d&&n.removeElements(d.children.slice())}},!0),this.executed("shape.delete",function(p){var f=p.shape;c(f)&&l(p)},!0),this.reverted("shape.delete",function(p){var f=p.shape;c(f)&&u(p)},!0),this.preExecuted("shape.replace",function(p){var f=p.oldShape,d=p.newShape;!c(f)||!c(d)||(p.oldRoot=e.removeRootElement(mi(f)))},!0),this.postExecuted("shape.replace",function(p){var f=p.newShape,d=p.oldRoot,h=e.findRoot(mi(f));if(!(!d||!h)){var m=d.children;n.moveElements(m,{x:0,y:0},h)}},!0),this.executed("element.updateProperties",function(p){var f=p.element;if(v(f,"bpmn:SubProcess")){var d=p.properties,h=p.oldProperties,m=h.id,g=d.id;if(m!==g){if(Qs(f)){a.updateId(f,Ir(g)),a.updateId(m,g);return}var R=a.get(Ir(m));R&&a.updateId(Ir(m),Ir(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(Qs(f)){a.updateId(f,Ir(m)),a.updateId(g,m);return}var R=a.get(Ir(g));R&&a.updateId(R,Ir(m))}}},!0),t.on("element.changed",function(p){var f=p.element;if(Qs(f)){var d=f,h=a.get(rg(d));!h||h===d||t.fire("element.changed",{element:h})}}),this.executed("shape.toggleCollapse",ag,function(p){var f=p.shape;v(f,"bpmn:SubProcess")&&(Be(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",ag,function(p){var f=p.shape;v(f,"bpmn:SubProcess")&&(Be(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",rC,function(p){var f=p.shape;if(v(f,"bpmn:SubProcess")){var d=p.newRootElement;if(d)if(Be(f))s._moveChildrenToShape(d.children.slice(),f),M(ea(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=cg(f);s._moveChildrenToShape(h,d)}}},!0),t.on("copyPaste.createTree",function(p){var f=p.element,d=p.children;if(c(f)){var h=mi(f),m=a.get(h);m&&d.push.apply(d,m.children)}}),t.on("copyPaste.copyElement",function(p){var f=p.descriptor,d=p.element,h=p.elements,m=d.parent,g=v(Ve(m),"bpmndi:BPMNPlane");if(g){var R=rg(m),E=at(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(Mi,Y),Mi.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:sg.x-r.x,y:sg.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})}},Mi.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(Qh(e).map(i=>i.annotation));n.size&&M(ea(e.children),i=>{n.has(i.annotation)&&M(i.associations,r=>{t.removeConnection(r)})})},Mi.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},Mi.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},Mi.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,i=t.create("bpmndi:BPMNPlane",{bpmnElement:e}),r=t.create("bpmndi:BPMNDiagram",{plane:i});i.$parent=r;var o=n.createRoot({id:mi(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},Mi.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=at(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},Mi.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function oC(e){var t=[];return M(ea(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function cg(e){return e.children.slice().concat(oC(e.children)).concat(aC(e))}function aC(e){return el(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function Xl(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"))||!Be(r))){var o=sC(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}Xl.$inject=["injector","modeling"],ie(Xl,Y);function sC(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function Zl(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,In(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(Zl,Y),Zl.$inject=["eventBus","textRenderer"];function Ql(e,t){Y.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(Be(i))return;var r=Yo(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(Ql,Y),Ql.$inject=["eventBus","modeling"];var Jl=500;function ep(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=cC(c).concat([a]),p=gm(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"],Jl,function(a){var s=a.context,c=s.shape;v(c,"bpmn:SubProcess")&&(c.collapsed?Ve(c).isExpanded=!1:(i(c.children),Ve(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],Jl,function(a){var s=a.context,c=s.shape;c.collapsed?Ve(c).isExpanded=!1:Ve(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],Jl,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(ep,Y),ep.$inject=["eventBus","elementFactory","modeling"];function cC(e){return e.filter(function(t){return!t.hidden})}function tp(e,t,n,i){t.invoke(Y,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;ke(a)||(v(a,"bpmn:Participant")&&Be(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(tp,Y),tp.$inject=["canvas","injector","moddle","modeling"];function np(e,t){Y.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;uC(r,o)&&t.updateProperties(o,{default:null})})}ie(np,Y),np.$inject=["eventBus","modeling"];function uC(e,t){if(!v(e,"bpmn:SequenceFlow"))return!1;var n=K(t),i=K(e);return n.get("default")===i}var lC=500,pC=5e3,ug=["shape.create","shape.delete","shape.move","shape.resize"],lg=[...ug,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function ip(e,t){Y.call(this,e);var n;function i(){return n=n||new fC,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(lg,pC,function(){i()}),this.postExecuted(lg,lC,function(){o()}),this.preExecute(ug,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))})}ip.$inject=["eventBus","modeling"],ie(ip,Y);function fC(){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 dC=500,hC=5e3,pg=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],fg=[...pg,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function rp(e,t){Y.call(this,e);var n;function i(){return n=n||new mC,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(fg,hC,function(){i()}),this.postExecuted(fg,dC,function(){o()}),this.preExecute(pg,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)})}rp.$inject=["eventBus","modeling"],ie(rp,Y);function mC(){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 op(e,t){Y.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)gC(o)&&!vC(o)&&t.updateProperties(o,{isForCompensation:void 0})})}ie(op,Y),op.$inject=["eventBus","modeling"];function gC(e){const t=K(e);return t&&t.isForCompensation}function yC(e){return e&&v(e,"bpmn:BoundaryEvent")&&so(e,"bpmn:CompensateEventDefinition")}function vC(e){return e.incoming.filter(n=>yC(n.source)).length>0}const _C={__init__:["adaptiveLabelPositioningBehavior","appendBehavior","artifactBehavior","associationBehavior","attachEventBehavior","boundaryEventBehavior","categoryRootElementReferenceBehavior","compensateBoundaryEventBehaviour","createBehavior","createDataObjectBehavior","createParticipantBehavior","dataInputAssociationBehavior","dataStoreBehavior","deleteLaneBehavior","detachEventBehavior","dropOnFlowBehavior","eventBasedGatewayBehavior","fixHoverBehavior","groupBehavior","importDockingFix","isHorizontalFix","labelBehavior","layoutConnectionBehavior","messageFlowBehavior","nonInterruptingBehavior","removeElementBehavior","removeEmbeddedLabelBoundsBehavior","removeParticipantBehavior","replaceConnectionBehavior","replaceElementBehaviour","resizeBehavior","resizeLaneBehavior","rootElementReferenceBehavior","spaceToolBehavior","subProcessPlaneBehavior","subProcessStartEventBehavior","textAnnotationBehavior","toggleCollapseConnectionBehaviour","toggleElementCollapseBehaviour","unclaimIdBehavior","updateFlowNodeRefsBehavior","updateCategoryValueRefsBehavior","unsetDefaultFlowBehavior","setCompensationActivityAfterPasteBehavior"],adaptiveLabelPositioningBehavior:["type",dl],appendBehavior:["type",hl],associationBehavior:["type",gl],attachEventBehavior:["type",Os],artifactBehavior:["type",ml],boundaryEventBehavior:["type",yl],categoryRootElementReferenceBehavior:["type",vl],compensateBoundaryEventBehaviour:["type",_l],createBehavior:["type",bl],createDataObjectBehavior:["type",xl],createParticipantBehavior:["type",Sl],dataInputAssociationBehavior:["type",Rl],dataStoreBehavior:["type",Cl],deleteLaneBehavior:["type",Pl],detachEventBehavior:["type",Hs],dropOnFlowBehavior:["type",Tl],eventBasedGatewayBehavior:["type",Ml],fixHoverBehavior:["type",wm],groupBehavior:["type",kl],importDockingFix:["type",Rm],isHorizontalFix:["type",Ol],labelBehavior:["type",Il],layoutConnectionBehavior:["type",Nl],messageFlowBehavior:["type",jl],nonInterruptingBehavior:["type",Fl],removeElementBehavior:["type",zl],removeEmbeddedLabelBoundsBehavior:["type",Hl],removeParticipantBehavior:["type",Vl],replaceConnectionBehavior:["type",Gl],replaceElementBehaviour:["type",Ys],resizeBehavior:["type",Ym],resizeLaneBehavior:["type",eg],rootElementReferenceBehavior:["type",Yl],spaceToolBehavior:["type",ng],subProcessPlaneBehavior:["type",Mi],subProcessStartEventBehavior:["type",Xl],textAnnotationBehavior:["type",Zl],toggleCollapseConnectionBehaviour:["type",Ql],toggleElementCollapseBehaviour:["type",ep],unclaimIdBehavior:["type",tp],unsetDefaultFlowBehavior:["type",np],updateFlowNodeRefsBehavior:["type",ip],updateCategoryValueRefsBehavior:["type",rp],setCompensationActivityAfterPasteBehavior:["type",op]};function ap(e){this._commandStack=e.get("commandStack",!1)}ap.$inject=["injector"],ap.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const gi={__init__:["rules"],rules:["type",ap]};function Vn(e){Y.call(this,e),this.init()}Vn.$inject=["eventBus"],ie(Vn,Y),Vn.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)})},Vn.prototype.init=function(){};function dg(e,t){var n=Xt(e,t,-15);return n!=="intersect"?n:null}function Qt(e){Vn.call(this,e)}ie(Qt,Vn),Qt.$inject=["eventBus"],Qt.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return bC(t)}),this.addRule("connection.create",function(e){var t=e.source,n=e.target,i=e.hints||{},r=i.targetParent,o=i.targetAttach;if(o)return!1;r&&(n.parent=r);try{return ec(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return ec(n,i,t)}),this.addRule("connection.updateWaypoints",function(e){return{type:e.connection.type}}),this.addRule("shape.resize",function(e){var t=e.shape,n=e.newBounds,i=e.direction;return Cg(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return it(i)&&!tc(t,i)?!1:Er(t,function(r){return it(r)?ec(r.source,r.target,r):r.host?pa(r,r.host,null,n):lp(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 bg(a)&&!n.includes(a.host)})?!1:pa(n,t,null,i)||Sg(n,t,i)||Rg(n,t)||tc(n,t)}),this.addRule("shape.create",function(e){return lp(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return pa(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return kg(n,t)})},Qt.prototype.canConnectMessageFlow=Tg,Qt.prototype.canConnectSequenceFlow=Mg,Qt.prototype.canConnectDataAssociation=pp,Qt.prototype.canConnectAssociation=Pg,Qt.prototype.canConnectCompensationAssociation=Ag,Qt.prototype.canMove=Rg,Qt.prototype.canAttach=pa,Qt.prototype.canReplace=Sg,Qt.prototype.canDrop=vo,Qt.prototype.canInsert=tc,Qt.prototype.canCreate=lp,Qt.prototype.canConnect=ec,Qt.prototype.canResize=Cg,Qt.prototype.canCopy=kg;function bC(e){return sp(e)?null:De(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function sp(e){return!e||ke(e)}function hg(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 cp(e){return v(e,"bpmn:TextAnnotation")}function up(e){return v(e,"bpmn:Group")&&!e.labelTarget}function mg(e){return v(e,"bpmn:BoundaryEvent")&&yi(e,"bpmn:CompensateEventDefinition")}function Js(e){return K(e).isForCompensation}function xC(e,t){var n=hg(e),i=hg(t);return n===i}function EC(e){return v(e,"bpmn:InteractionNode")&&!v(e,"bpmn:BoundaryEvent")&&(!v(e,"bpmn:Event")||v(e,"bpmn:ThrowEvent")&&vg(e,"bpmn:MessageEventDefinition"))}function wC(e){return v(e,"bpmn:InteractionNode")&&!Js(e)&&(!v(e,"bpmn:Event")||v(e,"bpmn:CatchEvent")&&vg(e,"bpmn:MessageEventDefinition"))&&!(v(e,"bpmn:BoundaryEvent")&&!yi(e,"bpmn:MessageEventDefinition"))}function gg(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 yg(e,t){var n=gg(e),i=gg(t);return n===i}function yi(e,t){var n=K(e);return!!at(n.eventDefinitions||[],function(i){return v(i,t)})}function vg(e,t){var n=K(e);return(n.eventDefinitions||[]).every(function(i){return v(i,t)})}function SC(e){return v(e,"bpmn:FlowNode")&&!v(e,"bpmn:EndEvent")&&!sn(e)&&!(v(e,"bpmn:IntermediateThrowEvent")&&yi(e,"bpmn:LinkEventDefinition"))&&!mg(e)&&!Js(e)}function RC(e){return v(e,"bpmn:FlowNode")&&!v(e,"bpmn:StartEvent")&&!v(e,"bpmn:BoundaryEvent")&&!sn(e)&&!(v(e,"bpmn:IntermediateCatchEvent")&&yi(e,"bpmn:LinkEventDefinition"))&&!Js(e)}function CC(e){return v(e,"bpmn:ReceiveTask")||v(e,"bpmn:IntermediateCatchEvent")&&(yi(e,"bpmn:MessageEventDefinition")||yi(e,"bpmn:TimerEventDefinition")||yi(e,"bpmn:ConditionalEventDefinition")||yi(e,"bpmn:SignalEventDefinition"))}function PC(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function _g(e,t){var n=PC(t);return n.indexOf(e)!==-1}function ec(e,t,n){if(sp(e)||sp(t))return null;if(!v(n,"bpmn:DataAssociation")){if(Tg(e,t))return{type:"bpmn:MessageFlow"};if(Mg(e,t))return{type:"bpmn:SequenceFlow"}}var i=pp(e,t);return i||(Ag(e,t)?{type:"bpmn:Association",associationDirection:"One"}:Pg(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function vo(e,t){return ke(e)||up(e)?!0:v(t,"bpmn:Participant")&&!Be(t)?!1:v(e,"bpmn:Participant")?v(t,"bpmn:Process")||v(t,"bpmn:Collaboration"):De(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:v(e,"bpmn:Lane")?v(t,"bpmn:Participant")||v(t,"bpmn:Lane"):v(e,"bpmn:BoundaryEvent")&&!AC(e)?!1:v(e,"bpmn:FlowElement")&&!v(e,"bpmn:DataStoreReference")?v(t,"bpmn:FlowElementsContainer")?Be(t):De(t,["bpmn:Participant","bpmn:Lane"]):v(e,"bpmn:DataStoreReference")&&v(t,"bpmn:Collaboration")?Fi(K(t).get("participants"),function(n){return!!n.get("processRef")}):De(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?De(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):v(e,"bpmn:MessageFlow")?v(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function AC(e){return K(e).cancelActivity&&(xg(e)||Eg(e))}function bg(e){return!ke(e)&&v(e,"bpmn:BoundaryEvent")}function TC(e){return v(e,"bpmn:Lane")}function MC(e){return bg(e)||v(e,"bpmn:IntermediateThrowEvent")&&xg(e)?!0:v(e,"bpmn:IntermediateCatchEvent")&&Eg(e)}function xg(e){var t=K(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Eg(e){return wg(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function wg(e,t){return t.some(function(n){return yi(e,n)})}function kC(e){return v(e,"bpmn:ReceiveTask")&&at(e.incoming,function(t){return v(t.source,"bpmn:EventBasedGateway")})}function pa(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return ke(r)||!MC(r)||sn(t)||!v(t,"bpmn:Activity")||Js(t)||i&&!dg(i,t)||kC(t)?!1:"attach"}function Sg(e,t,n){if(!t)return!1;var i={replacements:[]};return M(e,function(r){sn(t)||v(r,"bpmn:StartEvent")&&r.type!=="label"&&vo(r,t)&&(F1(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(H1(r)||z1(r)||V1(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),wg(r,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&v(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"})),v(t,"bpmn:Transaction")||yi(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(v(r,"bpmn:EndEvent")&&vo(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),v(r,"bpmn:BoundaryEvent")&&pa(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function Rg(e,t){return Fi(e,TC)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return vo(n,t)})}function lp(e,t,n,i){return t?ke(e)||up(e)?!0:vo(e,t)||tc(e,t):!1}function Cg(e,t,n){return v(e,"bpmn:SubProcess")?Be(e)&&(!t||t.width>=100&&t.height>=80):v(e,"bpmn:Lane")||v(e,"bpmn:Participant")?!0:cp(e)?n?n==="e"||n==="w":!0:up(e)?!0:ke(e)?n?n==="e"||n==="w":!0:!1}function DC(e,t){var n=cp(e),i=cp(t);return(n||i)&&n!==i}function Pg(e,t){return _g(t,e)||_g(e,t)?!1:DC(e,t)?!0:!!pp(e,t)}function Ag(e,t){return yg(e,t)&&mg(e)&&v(t,"bpmn:Activity")&&!LC(t,e)&&!sn(t)}function Tg(e,t){return Og(e)&&!Og(t)?!1:EC(e)&&wC(t)&&!xC(e,t)}function Mg(e,t){return SC(e)&&RC(t)&&yg(e,t)&&!(v(e,"bpmn:EventBasedGateway")&&!CC(t))}function pp(e,t){return De(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&De(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:De(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&De(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function tc(e,t,n){if(!t)return!1;if(Array.isArray(e)){if(e.length!==1)return!1;e=e[0]}return t.source===e||t.target===e?!1:De(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!ke(t)&&v(e,"bpmn:FlowNode")&&!v(e,"bpmn:BoundaryEvent")&&vo(e,t.parent)}function fp(e,t){return e&&t&&e.indexOf(t)!==-1}function kg(e,t){return ke(t)?!0:!(v(t,"bpmn:Lane")&&!fp(e,t.parent)||v(t,"bpmn:MessageFlow")&&!OC(e,t))}function OC(e,t){var n=Dg(t.source),i=Dg(t.target);return fp(e,n)&&fp(e,i)}function Dg(e){for(;e;e=e.parent)if(v(e,"bpmn:Participant"))return e;return null}function Og(e){return lo(e,"bpmn:Process")||lo(e,"bpmn:Collaboration")}function LC(e,t){return e.attachers.includes(t)}const IC={__depends__:[gi],__init__:["bpmnRules"],bpmnRules:["type",Qt]};var NC=2e3;function Lg(e,t){e.on("saveXML.start",NC,n);function n(){var i=t.getRootElements();M(i,function(r){var o=Ve(r),a,s;a=Yo([r]),a=Oe(a,function(c){return c!==r&&!c.labelTarget}),s=nn(a,Ve),o.set("planeElement",s)})}}Lg.$inject=["eventBus","canvas"];const BC={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Lg]};function nc(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)})}nc.prototype.getOrdering=function(e,t){return null},ie(nc,Y);function dp(e,t){nc.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=at(n,function(c){return De(a,[c.type])});return s&&s.order||{level:1}}function r(a){var s=a.order;if(s||(a.order=s=i(a)),!s)throw new Error(`no order for <${a.id}>`);return s}function o(a,s,c){for(var u=s;u&&!De(u,c);)u=u.parent;if(!u)throw new Error(`no parent for <${a.id}> in <${s&&s.id}>`);return u}this.getOrdering=function(a,s){if(a.labelTarget||v(a,"bpmn:TextAnnotation"))return{parent:t.findRoot(s)||t.getRootElement(),index:-1};var c=r(a);c.containers&&(s=o(a,s,c.containers));var u=s.children.indexOf(a),l=Hf(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}}}dp.$inject=["eventBus","canvas"],ie(dp,nc);const $C={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",dp]};function fa(){}fa.prototype.get=function(){return this._data},fa.prototype.set=function(e){this._data=e},fa.prototype.clear=function(){var e=this._data;return delete this._data,e},fa.prototype.isEmpty=function(){return!this._data};const jC={clipboard:["type",fa]};var Ig=1500;function Ng(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",Ig,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",Ig,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=Lr(a),c=document.elementFromPoint(s.x,s.y),FC(c)}}Ng.$inject=["elementRegistry","eventBus","injector"];function FC(e){return Ar(e,"svg, .djs-element",!0)}const HC={__init__:["hoverFix"],hoverFix:["type",Ng]};function zC(e){return!0}function ic(e){return rr(e)||qR(e)}var Bg=500;function $g(e,t,n){var i=this;function r(A,F,H){if(!s(A,F)){var N,z,ue;H?z=t.getGraphics(H):(N=F.delegateTarget||F.target,N&&(z=N,H=t.get(z))),!(!z||!H)&&(ue=e.fire(A,{element:H,gfx:z,originalEvent:F}),ue===!1&&(F.stopPropagation(),F.preventDefault()))}}var o={};function a(A){return o[A]}function s(A,F){var H=u[A]||rr;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":zC,"element.mousedown":ic,"element.mouseup":ic,"element.click":ic,"element.dblclick":ic};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(ue){r(H,ue)};N&&(u[H]=N),z.$delegate=En.bind(A,p,F,z)}function d(A,F,H){var N=a(H);N&&En.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"],Bg,function(A){var F=A.element,H=A.gfx;e.fire("interactionEvents.updateHit",{element:F,gfx:H})}),e.on("interactionEvents.createHit",Bg,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){Se(A,F)}this.removeHits=function(A){var F=hs(".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=qo(F);return T(H,"stroke"),L(A,H),H},this.createBoxHit=function(A,F,H){H=D({x:0,y:0},H);var N=pe("rect");return T(N,F),re(N,H),L(A,N),N},this.updateDefaultHit=function(A,F){var H=et(".djs-hit",F);if(H)return A.waypoints?Ju(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}$g.$inject=["eventBus","elementRegistry","styles"];const rc={__init__:["interactionEvents"],interactionEvents:["type",$g]};function _o(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)})}_o.$inject=["eventBus","canvas"],_o.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()})}},_o.prototype.get=function(){return Array.from(this._selectedElements)},_o.prototype.isSelected=function(e){return this._selectedElements.has(e)},_o.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 jg="hover",Fg="selected";function Hg(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,jg)}),t.on("element.out",function(r){i(r.element,jg)}),t.on("selection.changed",function(r){function o(u){i(u,Fg)}function a(u){n(u,Fg)}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)})}Hg.$inject=["canvas","eventBus"];function zg(e,t,n,i){e.on("create.end",500,function(r){var o=r.context,a=o.canExecute,s=o.elements,c=o.hints||{},u=c.autoSelect;if(a){if(u===!1)return;ge(u)?t.select(u):t.select(s.filter(VC))}}),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=at(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(rr(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=Zs(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}zg.$inject=["eventBus","selection","canvas","elementRegistry"];function VC(e){return!e.hidden}const Gn={__init__:["selectionVisuals","selectionBehavior"],__depends__:[rc],selection:["type",_o],selectionVisuals:["type",Hg],selectionBehavior:["type",zg]};var GC=/^djs-cursor-.*$/;function oc(e){var t=ft(document.body);t.removeMatching(GC),e&&t.add("djs-cursor-"+e)}function Vg(){oc(null)}var WC=5e3;function Gg(e,t){t=t||"element.click";function n(){return!1}return e.once(t,WC,n),function(){e.off(t,n)}}var UC=["c","C"],qC=["v","V"],YC=["d","D"],KC=["x","X"],XC=["y","Y"],Wg=["z","Z"];function ZC(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Rn(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 hp(e){return e.shiftKey}function QC(e){return Rn(e)&&Nt(UC,e)}function JC(e){return Rn(e)&&Nt(qC,e)}function eP(e){return Rn(e)&&Nt(YC,e)}function tP(e){return Rn(e)&&Nt(KC,e)}function nP(e){return Rn(e)&&!hp(e)&&Nt(Wg,e)}function iP(e){return Rn(e)&&(Nt(XC,e)||Nt(Wg,e)&&hp(e))}var bo=Math.round,Ug="djs-drag-active";function Nr(e){e.preventDefault()}function rP(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function oP(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function qg(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=Lr(x),F=ei(A,L),H=o.localStart,N=a(A),z=ei(N,H);if(!o.active&&(b||oP(F)>o.threshold)){if(D(w,{x:bo(H.x+T.x),y:bo(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&&oc(o.cursor),t.addMarker(t.getRootElement(),Ug)}ql(x),o.active&&(D(w,{x:bo(N.x+T.x),y:bo(N.y+T.y),dx:bo(z.x),dy:bo(z.y)},{originalEvent:x}),s("move"))}function l(x){var b,w=!0;o.active&&(x&&(o.payload.originalEvent=x,ql(x)),w=s("end")),w===!1&&s("rejected"),b=R(w!==!0),s("ended",b)}function p(x){Nt("Escape",x)&&(Nr(x),g())}function f(x){var b;o.active&&(b=Gg(e),setTimeout(b,400),Nr(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"),Vg(),o.trapClick?w=f:w=l,we.unbind(document,"mousemove",u),we.unbind(document,"dragstart",Nr),we.unbind(document,"selectstart",Nr),we.unbind(document,"mousedown",w,!0),we.unbind(document,"mouseup",w,!0),we.unbind(document,"keyup",p),we.unbind(document,"touchstart",d,!0),we.unbind(document,"touchcancel",g,!0),we.unbind(document,"touchmove",u,!0),we.unbind(document,"touchend",l,!0),e.off("element.hover",h),e.off("element.out",m),t.removeMarker(t.getRootElement(),Ug);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=yo(x)||x,F=Lr(x),ql(x),A.type==="dragstart"&&Nr(A)):(A=null,F={x:0,y:0}),H=a(F),b||(b=H),z=rP(A),o=D({prefix:w,data:L,payload:{},globalStart:F,displacement:ei(b,H),localStart:H,isTouch:z},T),T.manual||(z?(we.bind(document,"touchstart",d,!0),we.bind(document,"touchcancel",g,!0),we.bind(document,"touchmove",u,!0),we.bind(document,"touchend",l,!0)):(we.bind(document,"mousemove",u),we.bind(document,"dragstart",Nr),we.bind(document,"selectstart",Nr),we.bind(document,"mousedown",N,!0),we.bind(document,"mouseup",N,!0)),we.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)}}qg.$inject=["eventBus","canvas","selection","elementRegistry"];const ki={__depends__:[HC,Gn],dragging:["type",qg]};function xo(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}xo.prototype.next=function(){return this._prefix+ ++this._counter};const aP=new xo("ps");var sP=["marker-start","marker-mid","marker-end"],cP=["circle","ellipse","line","path","polygon","polyline","path","rect"];function or(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}or.$inject=["elementRegistry","eventBus","canvas","styles"],or.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")},or.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},or.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=ah(n);return this._cloneMarkers(kr(r),i),re(r,this._styles.cls(i,[])),Se(t,r),re(r,"data-preview-support-element-id",e.id),r},or.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 Se(t,n),re(n,"data-preview-support-element-id",e.id),n},or.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),fP(e)&&sP.forEach(function(r){if(re(e,r)){var o=uP(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},or.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,aP.next()].join("-"),a=et("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||ah(n);s.id=o,$e(s).add(r);var c=et(":scope > defs",e);c||(c=pe("defs"),Se(e,c)),Se(c,s);var u=pP(s.id);re(t,i,u)};function uP(e,t,n){var i=lP(re(e,t));return et("marker#"+i,n||document)}function lP(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function pP(e){return"url(#"+e+")"}function fP(e){return cP.indexOf(e.nodeName)!==-1}const Eo={__init__:["previewSupport"],previewSupport:["type",or]};var dP="drop-ok",Yg="drop-not-ok",Kg="attach-ok",Xg="new-parent",Zg="create",hP=2e3;function Qg(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&&!(ke(E)&&c.indexOf(x)!==-1)});var d=at(c,function(E){return!it(E)}),h=!1,m=!1,g=!1;ey(c)&&(h=r.allowed("shape.attach",{position:l,shape:d,target:u})),h||(ey(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){[Kg,dP,Yg,Xg].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}Jg(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,Kg):a(p,m?Xg:Yg))}),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;Jg(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=at(f,function(x){return!it(x)})),D(u,{elements:f,shape:p}),D(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===Zg&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],hP,function(){n.off("elements.changed",s)})}),this.start=function(c,u,l){ge(u)||(u=[u]);var p=at(u,function(h){return!it(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){it(h)&&(h.waypoints=nn(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,Zg,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:u,context:l}})}}}Qg.$inject=["canvas","dragging","eventBus","modeling","rules"];function Jg(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 ey(e){return e&&e.length===1&&!it(e[0])}var mP=750;function ty(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(kr(l),u)):(l=n._createContainer("shape",c),n.drawShape(kr(l),u),Zt(l,u.x,u.y)),i.addDragger(u,s,l))}),s}t.on("create.move",mP,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(),Se(p,l)),Zt(l,a.x,a.y)):It(l)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&It(c)})}ty.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const ac={__depends__:[ki,Eo,gi,Gn],__init__:["create","createPreview"],create:["type",Qg],createPreview:["type",ty]};function mp(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)})}mp.$inject=["eventBus"],mp.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||gP(0,0)};function gP(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 da={__init__:["mouse"],mouse:["type",mp]};var ny=2e3;function Cn(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),yP(l)&&(u.priority=2,u.host=l.host.id),it(l)&&(u.priority=3,u.source=l.source.id,u.target=l.target.id,u.waypoints=vP(l)),ke(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",ny,function(c){var u;((u=c.hints)==null?void 0:u.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",ny,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var u=c.hints;D(u,{createElementsBehavior:!1})})}Cn.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],Cn.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},Cn.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})}}},Cn.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},Cn.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},Cn.prototype._getElementIdsFromTree=function(e){var t={};return M(e,function(n){M(n,function(i){i.id&&(t[i.id]=!0)})}),t},Cn.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){it(o)&&(o.waypoints=nn(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))},Cn.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return M(e,function(o,a){o=ri(o,"priority"),M(o,function(s){var c=D({},oi(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var u;if(it(c)){c.source=i[s.source],c.target=i[s.target],u=i[s.id]=t.createConnection(c),r.push(u);return}if(ke(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},Cn.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(oi(e,["id"]));return t},Cn.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(oi(e,["id"]));return t},Cn.prototype.createShape=function(e){var t=this._elementFactory.createShape(oi(e,["id"]));return t},Cn.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(it(e)&&(!n.has(e.source)||!n.has(e.target))||ke(e)&&!n.has(e.labelTarget))},Cn.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=vs(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}Mr(a,function(p,f,d){if(ke(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=nn(r,function(p){return p.element});var l=new Set(e);return r=nn(r,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:l}),p}),r=ri(r,function(p){return p.descriptor.priority}),e=nn(r,function(p){return p.element}),M(r,function(p){var f=p.depth;if(!n.hasRelations(p.element,e,l)){ry(p.element,e),l.delete(p.element);return}if(!s(p.element,e)){ry(p.element,e),l.delete(p.element);return}i[f]||(i[f]=[]),i[f].push(p.descriptor)}),i};function yP(e){return!!e.host}function vP(e){return nn(e.waypoints,function(t){return t=iy(t),t.original&&(t.original=iy(t.original)),t})}function iy(e){return D({},e)}function ry(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const _P={__depends__:[jC,ac,da,gi],__init__:["copyPaste"],copyPaste:["type",Cn]};function gp(e,t,n){ge(n)||(n=[n]),M(n,function(i){xr(e[i])||(t[i]=e[i])})}var yp=750;function oy(e,t,n){function i(c,u){var l=e.create(c.$type);return n.copyElement(c,l,null,u)}t.on("copyPaste.copyElement",yp,function(c){var u=c.descriptor,l=c.element,p=K(l);if(ke(l))return u;var f=u.businessObject=i(p,!0),d=u.di=i(Ve(l),!0);d.bpmnElement=f,gp(f,u,"name"),gp(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])),oi(l,bn(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(ke(l)){l.businessObject=K(u[l.labelTarget]),l.di=Ve(u[l.labelTarget]);return}p=l.businessObject=i(p),f=l.di=i(f),f.bpmnElement=p,gp(l,p,["isExpanded","name"]),l.type=p.$type}),t.on("copyPaste.copyElement",yp,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(ea(l),p=>{l.push(p.annotation)})}),t.on("copyPaste.pasteElement",yp,function(c){var u=c.cache,l=c.descriptor;a(u,s(l,u,o(u)))})}oy.$inject=["bpmnFactory","eventBus","moddleCopy"];const bP=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],xP=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function ha(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 ri(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=Ht(r)&&r.$descriptor;if(a&&xP.includes(a))return o;if(a&&bP.includes(a)||a&&s&&!at(s.properties,Zr({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})}ha.$inject=["eventBus","bpmnFactory","moddle"],ha.prototype.copyElement=function(e,t,n,i=!1){n&&!ge(n)&&(n=[n]),n=n||vp(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;_n(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},ha.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 Ht(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)?bn(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):Ht(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},ha.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 vp(e,t){return bn(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const ay={__depends__:[_P],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",oy],moddleCopy:["type",ha]};var sy=Math.round;function _p(e,t){this._modeling=e,this._eventBus=t}_p.$inject=["modeling","eventBus"],_p.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=sy(s+o/2),l=sy(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 cy(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}cy.$inject=["selection","eventBus"];const EP={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",cy],replace:["type",_p]};function wP(e,t,n){ge(n)||(n=[n]),M(n,function(i){xr(e[i])||(t[i]=e[i])})}var SP=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function RP(e,t){var n=e&&_n(e,"collapsed")?e.collapsed:!Be(e),i;return t&&(_n(t,"collapsed")||_n(t,"isExpanded"))?i=_n(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function uy(e,t,n,i,r,o){function a(s,c,u){u=u||{};var l=c.type,p=s.businessObject;if(sc(p)&&(l==="bpmn:SubProcess"||l==="bpmn:AdHocSubProcess")&&RP(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),wP(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var h=vp(p.$descriptor),m=vp(f.$descriptor,!0),g=CP(h,m);D(f,Jn(c,SP));var R=Oe(g,function(b){return b==="eventDefinitions"?ly(s,c.eventDefinitionType):b==="loopCharacteristics"?!sn(f):_n(f,b)||b==="processRef"&&c.isExpanded===!1||b==="triggeredByEvent"?!1:b==="isForCompensation"?!sn(f):!0});if(f=n.copyElement(p,f,R),c.eventDefinitionType&&(ly(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),v(p,"bpmn:Activity")){if(sc(p))d.isExpanded=Be(s);else if(c&&_n(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}Be(s)&&!v(p,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(sc(p)&&!sc(f)&&(u.moveChildren=!1),v(p,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):u.moveChildren=!1;var x=Gt(s);Ve(s).isHorizontal||(Ve(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,De(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&De(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(f.default=p.default),c.host&&!v(p,"bpmn:BoundaryEvent")&&v(f,"bpmn:BoundaryEvent")&&(d.host=c.host),(d.type==="bpmn:DataStoreReference"||d.type==="bpmn:DataObjectReference")&&(d.x=s.x+(s.width-d.width)/2),r.replaceElement(s,d,{...u,targetElement:c})}this.replaceElement=a}uy.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function sc(e){return v(e,"bpmn:SubProcess")}function ly(e,t){var n=K(e);return t&&n.get("eventDefinitions").some(function(i){return v(i,t)})}function CP(e,t){return e.filter(function(n){return t.includes(n)})}const py={__depends__:[ay,EP,Gn],bpmnReplace:["type",uy]};var PP=250;function Br(e){this._eventBus=e,this._tools=[],this._active=null}Br.$inject=["eventBus"],Br.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)},Br.prototype.isActive=function(e){return e&&this._active===e},Br.prototype.length=function(e){return this._tools.length},Br.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Br.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,PP,function(r){this._active&&(AP(r)||this.setActive(null))},this)};function AP(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Ar(t,'.group[data-group="tools"]')}const cc={__depends__:[ki],__init__:["toolManager"],toolManager:["type",Br]};function TP(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 MP(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 kP(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 bp=Math.abs,DP=Math.round,Di={x:"width",y:"height"},fy="crosshair",ar={n:"top",w:"left",s:"bottom",e:"right"},OP=1500,uc={n:"s",w:"e",s:"n",e:"w"},lc=20;function Wn(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",OP,function(c){var u=c.context,l=u.initialized;l||(l=u.initialized=s.init(c,u)),l&&hy(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){hy(c);var m={x:0,y:0};m[l]=DP(c["d"+l]),s.makeSpace(f,d,m,p,h),n.once("spaceTool.ended",function(g){s.activateSelection(g.originalEvent,!0,!0)})}})}Wn.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Wn.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:fy,data:{context:{reactivate:n}},trapClick:!1})},Wn.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:fy,data:{context:{}}})},Wn.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},Wn.prototype.init=function(e,t){var n=bp(e.dx)>bp(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(bp(i)<5)return!1;i<0&&(i*=-1),la(e)&&(i*=-1);var o=TP(n,i),a=this._canvas.getRootElement();!Zs(e)&&e.hover&&(a=e.hover);var s=[...Yo(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=LP(c,n,o,r,u);return D(t,c,{axis:n,direction:o,spaceToolConstraints:l,start:r}),oc("resize-"+(n==="x"?"ew":"ns")),!0},Wn.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||ke(d))){if(it(d)){l.push(d);return}var h=d[t],m=h+d[Di[t]];if(IP(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}},Wn.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Wn.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function dy(e){return{top:e.top-lc,right:e.right+lc,bottom:e.bottom+lc,left:e.left-lc}}function hy(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 LP(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=me(f),g=Oe(h,function(z){return!it(z)&&!ke(z)&&!l.has(z)&&!p.has(z)}),R=Oe(h,function(z){return!it(z)&&!ke(z)&&l.has(z)}),E,x,b,w=[],T=[],L,A,F,H;g.length&&(x=dy(me(Rt(g))),E=i-m[ar[n]]+x[ar[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=dy(me(Rt(R))),E=i-b[ar[uc[n]]]+m[ar[uc[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=me(Rt(w.map(ye))),A=m[ar[uc[n]]]-(L[ar[uc[n]]]-i)),T.length&&(F=me(Rt(T.map(ye))),H=F[ar[n]]-(m[ar[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[Di[t]]-N[Di[t]],s.bottom=u=xe(u)?Math.min(u,E):E):n==="w"?(E=i+f[Di[t]]-N[Di[t]],s.right=u=xe(u)?Math.min(u,E):E):n==="s"?(E=i-f[Di[t]]+N[Di[t]],s.top=c=xe(c)?Math.max(c,E):E):n==="e"&&(E=i-f[Di[t]]+N[Di[t]],s.left=c=xe(c)?Math.max(c,E):E))}),s}}function IP(e){return!!e.host}var xp="djs-dragging",my="djs-resizing",NP=250,pc=Math.max;function gy(e,t,n,i,r){function o(a,s){M(a,function(c){r.addDragger(c,s),n.addMarker(c,xp)})}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"])),Se(s,l);var p=pe("path");re(p,"d",u.x),$e(p).add("djs-crosshair"),Se(l,p);var f=pe("path");re(f,"d",u.y),$e(f).add("djs-crosshair"),Se(l,f),c.crosshairGroup=l}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;Zt(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",NP,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"),$e(c).add("djs-crosshair"),Se(f,c),s.line=c;var d=pe("g");re(d,i.cls("djs-drag-group",["no-events"])),Se(n.getActiveLayer(),d),o(l,d);var h=new Set(l);M(p,function(T){h.add(T)});var m=new Set,g=s.movingConnections=[];h.forEach(function(T){M(T.outgoing,function(L){m.has(L)||!it(L)||!h.has(L.target)||(m.add(L),g.push(L))})}),o(g,d),s.dragGroup=d}if(!s.frameGroup){var R=pe("g");re(R,i.cls("djs-frame-group",["no-events"])),Se(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,my)}),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,Zt(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:pc(A.width+w.x,5)}):(F=pc(A.width-w.x,5),re(L,{width:F,x:A.x+A.width-F})),s.direction==="s"?re(L,{height:pc(A.height+w.y,5)}):(H=pc(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,xp)}),M(u,function(h){n.removeMarker(h,xp)}),f&&(It(p),It(f)),M(l,function(h){n.removeMarker(h,my)}),d&&It(d)})}gy.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const BP={__init__:["spaceToolPreview"],__depends__:[ki,gi,cc,Eo,da],spaceTool:["type",Wn],spaceToolPreview:["type",gy]};function fc(e,t){e.invoke(Wn,this),this._canvas=t}fc.$inject=["injector","canvas"],ie(fc,Wn),fc.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=Kr(io(r.children.filter(u=>v(u,"bpmn:Artifact")),Rt(o))));const s=[...e,...a];var c=Wn.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(u){return!(v(u,"bpmn:TextAnnotation")||$P(u)&&(t==="y"&&Gt(u)||t==="x"&&!Gt(u)))}),c};function $P(e){return v(e,"bpmn:Participant")&&!K(e).processRef}const yy={__depends__:[BP],spaceTool:["type",fc]};function mt(e,t){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[],trigger:null},this._injector=t,this._eventBus=e,this._uid=1,e.on(["diagram.destroy","diagram.clear"],function(){this.clear(!1)},this)}mt.$inject=["eventBus","injector"],mt.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";const n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction()},mt.prototype.canExecute=function(e,t){const n={command:e,context:t},i=this._getHandler(e);let r=this._fire(e,"canExecute",n);if(r===void 0){if(!i)return!1;i.canExecute&&(r=i.canExecute(t))}return r},mt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},mt.prototype.undo=function(){let e=this._getUndoAction(),t;if(e){for(this._currentExecution.trigger="undo",this._pushAction(e);e&&(this._internalUndo(e),t=this._getUndoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},mt.prototype.redo=function(){let e=this._getRedoAction(),t;if(e){for(this._currentExecution.trigger="redo",this._pushAction(e);e&&(this._internalExecute(e,!0),t=this._getRedoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},mt.prototype.register=function(e,t){this._setHandler(e,t)},mt.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");const n=this._injector.instantiate(t);this.register(e,n)},mt.prototype.canUndo=function(){return!!this._getUndoAction()},mt.prototype.canRedo=function(){return!!this._getRedoAction()},mt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},mt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},mt.prototype._internalUndo=function(e){const t=e.command,n=e.context,i=this._getHandler(t);this._atomicDo(()=>{this._fire(t,"revert",e),i.revert&&this._markDirty(i.revert(n)),this._revertedAction(e),this._fire(t,"reverted",e)})},mt.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const i=t?[e+"."+t,t]:[e];let r;n=this._eventBus.createEvent(n);for(const o of i)if(r=this._eventBus.fire("commandStack."+o,n),n.cancelBubble)break;return r},mt.prototype._createId=function(){return this._uid++},mt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},mt.prototype._internalExecute=function(e,t){const n=e.command,i=e.context,r=this._getHandler(n);if(!r)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),r.preExecute&&r.preExecute(i),this._fire(n,"preExecuted",e)),this._atomicDo(()=>{this._fire(n,"execute",e),r.execute&&this._markDirty(r.execute(i)),this._executedAction(e,t),this._fire(n,"executed",e)}),t||(this._fire(n,"postExecute",e),r.postExecute&&r.postExecute(i),this._fire(n,"postExecuted",e)),this._popAction()},mt.prototype._pushAction=function(e){const t=this._currentExecution,n=t.actions,i=n[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=i&&i.id||this._createId()),n.push(e)},mt.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,n=e.actions,i=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:zf("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},mt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=ge(e)?e:[e],t.dirty=t.dirty.concat(e))},mt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},mt.prototype._revertedAction=function(e){this._stackIdx--},mt.prototype._getHandler=function(e){return this._handlerMap[e]},mt.prototype._setHandler=function(e,t){if(!e||!t)throw new Error("command and handler required");if(this._handlerMap[e])throw new Error("overriding handler for command <"+e+">");this._handlerMap[e]=t};const jP={commandStack:["type",mt]};function sr(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 FP=250,vy=1400;function Ep(e,t,n){Y.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",vy,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=_y(a),o.validatedShapes=_y(s)}),i&&t.on("shape.move.start",FP,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",vy,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;sr(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=tl(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(Ep,Y),Ep.$inject=["injector","eventBus","modeling"];function _y(e){var t=new Set(e);return Oe(e,function(n){return!t.has(n.labelTarget)})}const HP={__init__:["labelSupport"],labelSupport:["type",Ep]};var zP=251,by=1401,xy="attach-ok";function wp(e,t,n,i,r){Y.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",by,function(a){var s=a.context,c=s.shapes,u=s.validatedShapes;s.shapes=VP(c),s.validatedShapes=GP(u)}),o&&t.on("shape.move.start",zP,function(a){var s=a.context,c=s.shapes,u=Sp(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,xy),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(l,xy)}))}}),this.preExecuted("elements.move",by,function(a){var s=a.context,c=s.closure,u=s.shapes,l=Sp(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 WP(p)&&!UP(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;sr(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=jm(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=jm(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;sr(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}ie(wp,Y),wp.$inject=["injector","eventBus","canvas","rules","modeling"];function Sp(e){return bu(nn(e,function(t){return t.attachers||[]}))}function VP(e){var t=Sp(e);return Nx("id",e,t)}function GP(e){var t=Xr(e,"id");return Oe(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function WP(e){return!!e.host}function UP(e,t){return e.indexOf(t)!==-1}const qP={__depends__:[gi],__init__:["attachSupport"],attachSupport:["type",wp]};function Ey(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(hh(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)})}Ey.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const Rp={__init__:["changeSupport"],changeSupport:["type",Ey]};function Un(e){this._model=e}Un.$inject=["moddle"],Un.prototype._needsId=function(e){return De(e,["bpmn:RootElement","bpmn:FlowElement","bpmn:MessageFlow","bpmn:DataAssociation","bpmn:Artifact","bpmn:Participant","bpmn:Lane","bpmn:LaneSet","bpmn:Process","bpmn:Collaboration","bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane","bpmn:Property","bpmn:CategoryValue"])},Un.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;v(e,"bpmn:Activity")?t="Activity":v(e,"bpmn:Event")?t="Event":v(e,"bpmn:Gateway")?t="Gateway":De(e,["bpmn:SequenceFlow","bpmn:MessageFlow"])?t="Flow":t=(e.$type||"").replace(/^[^:]*:/g,""),t+="_",!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e))},Un.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Un.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Un.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",D({bpmnElement:e,bounds:this.createDiBounds()},t))},Un.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Un.prototype.createDiWaypoints=function(e){var t=this;return nn(e,function(n){return t.createDiWaypoint(n)})},Un.prototype.createDiWaypoint=function(e){return this.create("dc:Point",Jn(e,["x","y"]))},Un.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",D({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Un.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",D({bpmnElement:e},t))};function Pn(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"],An(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],An(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"],An(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],An(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"],An(u)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],An(u));function l(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],An(l)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],An(l)),this.executed("connection.reconnect",An(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&&!De(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",An(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"],An(p)),this.reverted(["element.updateAttachment"],An(p)),this.executed("element.updateLabel",An(f)),this.reverted("element.updateLabel",An(f));function f(d){const{element:h}=d.context,m=In(h),g=Ve(h),R=g&&g.get("label");er(h)||Qs(h)||(m&&!R?g.set("label",t.create("bpmndi:BPMNLabel")):!m&&R&&g.set("label",void 0))}}ie(Pn,Y),Pn.$inject=["eventBus","bpmnFactory","connectionDocking"],Pn.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},Pn.prototype.updateParent=function(e,t){if(!ke(e)&&!(v(e,"bpmn:DataStoreReference")&&e.parent&&v(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=Ve(e),o=n&&n.businessObject,a=Ve(n);v(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),v(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),v(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(i,o),v(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},Pn.prototype.updateBounds=function(e){var t=Ve(e),n=KP(e);if(n){var i=ei(n,t.get("bounds"));D(n,{x:e.x+i.x,y:e.y+i.y})}var r=ke(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})},Pn.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;v(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),_t(i,e)),v(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),Et(r,e))}},Pn.prototype.updateDiConnection=function(e,t,n){var i=Ve(e),r=Ve(t),o=Ve(n);i.sourceElement&&i.sourceElement.bpmnElement!==K(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==K(n)&&(i.targetElement=n&&o)},Pn.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):(_t(n,e),e.$parent=null)}};function YP(e){for(;e&&!v(e,"bpmn:Definitions");)e=e.$parent;return e}Pn.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)},Pn.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=YP(e.$parent||t),e.$parent&&(_t(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),_t(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);_t(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},Pn.prototype.updateConnectionWaypoints=function(e){var t=Ve(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},Pn.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&&(_t(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(_t(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)},Pn.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function An(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;v(i,"bpmn:BaseElement")&&e(t)}}function KP(e){if(v(e,"bpmn:Activity")){var t=Ve(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function cr(e,t){Pi.call(this),this._bpmnFactory=e,this._moddle=t}ie(cr,Pi),cr.$inject=["bpmnFactory","moddle"],cr.prototype._baseCreate=Pi.prototype.create,cr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,D({type:"label",di:n},Dr,t))}return this.createElement(e,t)},cr.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(!ZP(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=XP(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Cp(r,t,"isExpanded")),De(i,["bpmn:Lane","bpmn:Participant"])&&(t=Cp(r,t,"isHorizontal")),v(i,"bpmn:SubProcess")&&(t.collapsed=!Be(i,r)),v(i,"bpmn:ExclusiveGateway")&&(_n(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)},cr.prototype.getDefaultSize=function(e,t){var n=K(e);if(t=t||Ve(e),v(n,"bpmn:SubProcess"))return Be(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 Be(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}},cr.prototype.createParticipantShape=function(e){return Ht(e)||(e={isExpanded:e}),e=D({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function XP(e,t,n){return M(n,function(i){t=Cp(e,t,i)}),t}function Cp(e,t,n){return t[n]===void 0?t:(e[n]=t[n],oi(t,[n]))}function ZP(e){return De(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function dc(e,t){this._modeling=e,this._canvas=t}dc.$inject=["modeling","canvas"],dc.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)})},dc.prototype.postExecute=function(e){};function hc(e){this._modeling=e}hc.$inject=["modeling"],hc.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},hc.prototype.postExecute=function(e){var t=e.hints||{};QP(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 QP(e,t){return Fi(e.outgoing,function(n){return n.target===t})}function mc(e,t){this._canvas=e,this._layouter=t}mc.$inject=["canvas","layouter"],mc.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},mc.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var gc=Math.round;function Pp(e){this._modeling=e}Pp.$inject=["modeling"],Pp.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){it(p)&&(p.waypoints=nn(p.waypoints,function(f){return{x:gc(f.x-c.x-c.width/2+r.x),y:gc(f.y-c.y-c.height/2+r.y)}})),D(p,{x:gc(p.x-c.x-c.width/2+r.x),y:gc(p.y-c.y-c.height/2+r.y)})});var u=new Set(vs(t)),l={};M(t,function(p){if(it(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),ke(p)&&(f=oi(f,["attach"])),l[p.id]=xe(i)?a.createShape(p,Jn(p,["x","y","width","height"]),p.parent||n,i,f):a.createShape(p,Jn(p,["x","y","width","height"]),p.parent||n,f)}),e.elements=Kr(l)};var wy=Math.round;function ur(e){this._canvas=e}ur.$inject=["canvas"],ur.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-wy(t.width/2),y:n.y-wy(t.height/2)}),this._canvas.addShape(t,i,r),t},ur.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function ma(e){ur.call(this,e)}ie(ma,ur),ma.$inject=["canvas"];var JP=ur.prototype.execute;ma.prototype.execute=function(e){var t=e.shape;return tA(t),t.labelTarget=e.labelTarget,JP.call(this,e)};var eA=ur.prototype.revert;ma.prototype.revert=function(e){return e.shape.labelTarget=null,eA.call(this,e)};function tA(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function ga(e,t){this._canvas=e,this._modeling=t}ga.$inject=["canvas","modeling"],ga.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;sr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),sr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},ga.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=tl(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},ga.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 Ap(e,t){this._modeling=e,this._elementRegistry=t}Ap.$inject=["modeling","elementRegistry"],Ap.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 ya(e,t){this._canvas=e,this._modeling=t}ya.$inject=["canvas","modeling"],ya.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;sr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),sr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),sr(n.children,function(i){it(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},ya.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=tl(i.children,n),t.removeShape(n),n},ya.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 yc(e){this._modeling=e}yc.$inject=["modeling"];var Sy={x:"y",y:"x"};yc.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[Sy[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=ri(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[Sy[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)}))})},yc.prototype.postExecute=function(e){};function vc(e,t){this._layouter=e,this._canvas=t}vc.$inject=["layouter","canvas"],vc.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},vc.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Tp(){}Tp.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=_t(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},Tp.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return _t(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 Mp(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Mp.prototype.add=function(e,t){return this.addAll([e],t)},Mp.prototype.addAll=function(e,t){var n=kw(e,!!t,this);return D(this,n),this};function va(e){this._modeling=e}va.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},va.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&&Bl(p,p.source,t),connectionEnd:d&&$l(p,p.target,t)})})},va.prototype.getClosure=function(e){return new Mp().addAll(e,!0)};function _c(e){this._helper=new va(e)}_c.$inject=["modeling"],_c.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},_c.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 $r(e){this._modeling=e,this._helper=new va(e)}$r.$inject=["modeling"],$r.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=Jn(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=_t(o.children,t),Et(i.children,t,r),D(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},$r.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:$l(o,t,n)})}),M(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:Bl(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},$r.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},$r.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},$r.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function _a(e){this._modeling=e}_a.$inject=["modeling"],_a.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},_a.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||Ry(ge(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||Ry(ge(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},_a.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 Ry(e){return e.original||e}function Oi(e,t){this._modeling=e,this._rules=t}Oi.$inject=["modeling","rules"],Oi.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,Us(h,s,l),a)}),M(d,function(h){var m=h.target,g=c(s,m,h);g&&t.reconnectStart(h,s,Ws(h,s,l),a)})},Oi.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Oi.prototype.execute=function(e){},Oi.prototype.revert=function(e){},Oi.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},Oi.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},Oi.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function ba(e){this._modeling=e}ba.$inject=["modeling"],ba.prototype.execute=function(e){var t=e.shape,n=e.newBounds,i=e.minBounds;if(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)throw new Error("newBounds must have {x, y, width, height} properties");if(i&&(n.width<i.width||n.height<i.height))throw new Error("width and height cannot be less than minimum height and width");if(!i&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},D(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},ba.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(M(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:Us(o,n,i)})}),M(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:Ws(o,n,i)})}))},ba.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 lr(e){this._modeling=e}lr.$inject=["modeling"],lr.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,r=e.resizingShapes,o=e.start,a={};this.moveShapes(i,t),M(r,function(s){a[s.id]=iA(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(MP(i,r),t,n,o,i,r,a)},lr.prototype.execute=function(){},lr.prototype.revert=function(){},lr.prototype.moveShapes=function(e,t){var n=this;M(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},lr.prototype.resizeShapes=function(e,t,n){var i=this;M(e,function(r){var o=kP(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},lr.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=new Set(r),u=new Set(o);M(e,function(l){var p=l.source,f=l.target,d=nA(l),h=Py(n),m={},g=c.has(p)||u.has(p),R=c.has(f)||u.has(f);g&&R?(d=nn(d,function(E){return Ay(E,i,n)&&(E[h]=E[h]+t[h]),E.original&&Ay(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=Bl(l,p,t):c.has(f)?m.connectionEnd=$l(l,f,t):u.has(p)?m.connectionStart=Ws(l,p,a[p.id]):u.has(f)&&(m.connectionEnd=Us(l,f,a[f.id])),s._modeling.layoutConnection(l,m))})};function Cy(e){return D({},e)}function nA(e){return nn(e.waypoints,function(t){return t=Cy(t),t.original&&(t.original=Cy(t.original)),t})}function Py(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function Ay(e,t,n){var i=Py(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function iA(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function bc(e){this._modeling=e}bc.$inject=["modeling"],bc.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=Ty(n),t.collapsed=!t.collapsed;var i=My(n,t.collapsed);return[t].concat(i)},bc.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=ky(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function Ty(e){var t={};return M(e,function(n){t[n.id]=n.hidden,n.children&&(t=D({},t,Ty(n.children)))}),t}function My(e,t){var n=[];return M(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(My(i.children,i.collapsed||t)))}),n}function ky(e,t){var n=[];return M(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(ky(i.children,t)))}),n}function xc(e){this._modeling=e}xc.$inject=["modeling"],xc.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Dy(i,t),Oy(n,t),t.host=n,t},xc.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,Dy(n,t),Oy(i,t,r),t};function Dy(e,t){return _t(e&&e.attachers,t)}function Oy(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),Et(i,t,n)}}function kp(){}kp.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},kp.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function rt(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}rt.$inject=["eventBus","elementFactory","commandStack"],rt.prototype.getHandlers=function(){return{"shape.append":hc,"shape.create":ur,"shape.delete":ya,"shape.move":$r,"shape.resize":ba,"shape.replace":Oi,"shape.toggleCollapse":bc,spaceTool:lr,"label.create":ma,"connection.create":mc,"connection.delete":ga,"connection.move":Tp,"connection.layout":vc,"connection.updateWaypoints":kp,"connection.reconnect":_a,"elements.create":Pp,"elements.move":_c,"elements.delete":Ap,"elements.distribute":yc,"elements.align":dc,"element.updateAttachment":xc}},rt.prototype.registerHandlers=function(e){M(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},rt.prototype.moveShape=function(e,t,n,i,r){typeof i=="object"&&(r=i,i=null);var o={shape:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("shape.move",o)},rt.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},rt.prototype.moveElements=function(e,t,n,i){i=i||{};var r=i.attach,o=n,a;r===!0?(a=n,o=n.parent):r===!1&&(a=null);var s={shapes:e,delta:t,newParent:o,newHost:a,hints:i};this._commandStack.execute("elements.move",s)},rt.prototype.moveConnection=function(e,t,n,i,r){typeof i=="object"&&(r=i,i=void 0);var o={connection:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("connection.move",o)},rt.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},rt.prototype.createConnection=function(e,t,n,i,r,o){typeof n=="object"&&(o=r,r=i,i=n,n=void 0),i=this._create("connection",i);var a={source:e,target:t,parent:r,parentIndex:n,connection:i,hints:o};return this._commandStack.execute("connection.create",a),a.connection},rt.prototype.createShape=function(e,t,n,i,r){typeof i!="number"&&(r=i,i=void 0),r=r||{};var o=r.attach,a,s;e=this._create("shape",e),o?(a=n.parent,s=n):a=n;var c={position:t,shape:e,parent:a,parentIndex:i,host:s,hints:r};return this._commandStack.execute("shape.create",c),c.shape},rt.prototype.createElements=function(e,t,n,i,r){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},rt.prototype.createLabel=function(e,t,n,i){n=this._create("label",n);var r={labelTarget:e,position:t,parent:i||e.parent,shape:n};return this._commandStack.execute("label.create",r),r.shape},rt.prototype.appendShape=function(e,t,n,i,r){r=r||{},t=this._create("shape",t);var o={source:e,position:n,target:i,shape:t,connection:r.connection,connectionParent:r.connectionParent,hints:r};return this._commandStack.execute("shape.append",o),o.shape},rt.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},rt.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},rt.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},rt.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},rt.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},rt.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},rt.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},rt.prototype.createSpace=function(e,t,n,i,r){var o={delta:n,direction:i,movingShapes:e,resizingShapes:t,start:r};this._commandStack.execute("spaceTool",o)},rt.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},rt.prototype.reconnect=function(e,t,n,i,r){var o={connection:e,newSource:t,newTarget:n,dockingOrPoints:i,hints:r||{}};this._commandStack.execute("connection.reconnect",o)},rt.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,D(i,{docking:"source"}))},rt.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,D(i,{docking:"target"}))},rt.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},rt.prototype._create=function(e,t){return g1(t)?t:this._elementFactory.create(e,t)},rt.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function xa(e){this._elementRegistry=e}xa.$inject=["elementRegistry"],xa.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||rA(n,qa(i));return Ly(n,i),e.oldProperties=o,e.changed=r,r},xa.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return Ly(n,t),i},xa.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return v(e,"bpmn:DataObject")?oA(e,t):[]};function rA(e,t){return bn(t,function(n,i){return n[i]=e.get(i),n},{})}function Ly(e,t){M(t,function(n,i){e.set(i,n)})}function oA(e,t){return t.filter(function(n){return v(n,"bpmn:DataObjectReference")&&K(n).dataObjectRef===e})}var Ea="default",Li="id",Iy="di",aA={width:0,height:0};function wa(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}wa.$inject=["elementRegistry","moddle","modeling","textRenderer"],wa.prototype.execute=function(e){var t=e.element,n=[t];if(!t)throw new Error("element required");var i=this._elementRegistry,r=this._moddle.ids,o=t.businessObject,a=pA(e.properties),s=e.oldProperties||sA(t,a);return Ny(a,o)&&(r.unclaim(o[Li]),i.updateId(t,a[Li]),r.claim(a[Li],o)),Ea in a&&(a[Ea]&&n.push(i.get(a[Ea].id)),o[Ea]&&n.push(i.get(o[Ea].id))),By(t,a),e.oldProperties=s,e.changed=n,n},wa.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,aA)}},wa.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 By(t,i),Ny(n,r)&&(a.unclaim(n[Li]),o.updateId(t,i[Li]),a.claim(i[Li],r)),e.changed};function Ny(e,t){return Li in e&&e[Li]!==t[Li]}function sA(e,t){var n=qa(t),i=e.businessObject,r=Ve(e);return bn(n,function(o,a){return a!==Iy?o[a]=i.get(a):o[a]=cA(r,qa(t.di)),o},{})}function cA(e,t){return bn(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function By(e,t){var n=e.businessObject,i=Ve(e);M(t,function(r,o){o!==Iy?n.set(o,r):i&&uA(i,r)})}function uA(e,t){M(t,function(n,i){e.set(i,n)})}var lA=["default"];function pA(e){var t=D({},e);return lA.forEach(function(n){n in e&&(t[n]=K(t[n]))}),t}function Ec(e,t){this._canvas=e,this._modeling=t}Ec.$inject=["canvas","modeling"],Ec.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=Ve(r);return t.setRootElement(n),t.removeRootElement(r),Et(a.rootElements,i),i.$parent=a,_t(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},Ec.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=Ve(n);return t.setRootElement(r),t.removeRootElement(n),_t(a.rootElements,i),i.$parent=null,Et(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function Dp(e,t){this._modeling=e,this._spaceTool=t}Dp.$inject=["modeling","spaceTool"],Dp.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=zn(i),a=o===i,s=a?i:i.parent,c=nr(s),u=Gt(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+Hn,y:i.y,width:i.width-Hn,height:i.height}:{x:i.x,y:i.y+Hn,width:i.width,height:i.height-Hn};n.createShape({type:"bpmn:Lane",isHorizontal:u},l,s)}var p=[];Mr(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?Hn:0),y:d-(r==="top"?120:0),width:i.width-(a?Hn:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?Hn:0),width:120,height:i.height-(a?Hn:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:u},x,s)};function Op(e){this._modeling=e}Op.$inject=["modeling"],Op.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=nr(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=Gt(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+Hn,y:n.y+f*c,width:n.width-Hn,height:u}:{x:n.x+f*c,y:n.y+Hn,width:u,height:n.height-Hn},f<o?t.resizeShape(r[f],l):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,l,n))};function Sa(e,t){this._modeling=e,this._spaceTool=t}Sa.$inject=["modeling","spaceTool"],Sa.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Sa.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=oR(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},Sa.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=me(e),r=me(t),o=mm(r,i),a=zn(e),s=[],c=[];Mr(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 Ra="flowNodeRef",Lp="lanes";function wc(){}wc.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(l,p){var f=me(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=zn(l);return r[p.id]||(r[p.id]=Fs(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=zn(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(Lp),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(Ra).forEach(function(f){i.push({flowNode:f,remove:[p],add:[]})})}),i},wc.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(Lp);n.remove.forEach(function(o){_t(r,o),_t(o.get(Ra),i)}),n.add.forEach(function(o){Et(r,o),Et(o.get(Ra),i)})}),[]},wc.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(Lp);n.add.forEach(function(o){_t(r,o),_t(o.get(Ra),i)}),n.remove.forEach(function(o){Et(r,o),Et(o.get(Ra),i)})}),[]};var Ip="categoryValueRef";function Ca(e,t){this._bpmnFactory=e,this._elementRegistry=t}Ca.$inject=["bpmnFactory","elementRegistry"],Ca.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:Np(E)}:w.past={categoryValue:x}))}}function c(E){r.set(E,K(E))}function u(){n.filter(function(E){return v(E,"bpmn:FlowElement")&&!ke(E)&&E.parent}).forEach(c)}function l(E){var x=K(E),b=x.get("categoryValueRef");return b||(b=lm(i,x),o.push(fA(E,b))),b}function p(E){return E.reduce(function(x,b){var w=Np(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")&&!ke(E)&&E.parent}).forEach(function(E){var x=K(E).get("categoryValueRef");if(!x){var b=Np(E),w=f.get(b)||[],T=io(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=io(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(Ip),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}},Ca.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),dA(t.groups),mA(t.flowElements),[]},Ca.prototype.revert=function(e){var t=e.updates;return gA(t.flowElements),hA(t.groups),[]};function fA(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function dA(e){e.forEach(function(t){K(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function hA(e){e.forEach(function(t){K(t.groupShape).categoryValueRef=null})}function mA(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Ip);t.categoryValuesToRemove.forEach(function(r){_t(i,r)}),t.categoryValuesToAdd.forEach(function(r){Et(i,r,!0)})})}function gA(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Ip);t.categoryValuesToAdd.forEach(function(r){_t(i,r)}),t.categoryValuesToRemove.forEach(function(r){Et(i,r,!0)})})}function Np(e){for(;e.parent;)e=e.parent;return e}function Sc(e){this._moddle=e}Sc.$inject=["moddle"],Sc.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),[]},Sc.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 yA={fill:void 0,stroke:void 0};function Bp(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(vn(t)){var n=vA(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}Bp.$inject=["commandStack"],Bp.prototype.postExecute=function(e){var t=e.elements,n=e.colors||yA,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=it(o)?Jn(r,["border-color"]):r,s=Ve(o);if(_A(a),ke(o)){if(!s||!v(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:s.label,properties:{color:r["border-color"]}})}else{if(!De(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function vA(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 _A(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var bA={width:0,height:0};function $y(e,t,n){function i(c,u){var l=c.label||c,p=c.labelTarget||c;return Y1(l,u),[l,p]}function r(c){var u=c.element,l=u.businessObject,p=c.newLabel;if(!ke(u)&&er(u)&&!Ps(u)&&!jy(p)){var f=7,d=sl(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=In(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(!(!ke(l)&&!v(l,"bpmn:TextAnnotation"))){if(ke(l)&&jy(p)){d.removeShape!==!1&&e.removeShape(l,{unsetLabel:!1});return}var h=In(u);typeof f>"u"&&(f=t.getExternalLabelBounds(l,h)),f&&e.resizeShape(l,f,bA)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}$y.$inject=["modeling","textRenderer","bpmnFactory"];function jy(e){return!e||!e.trim()}function Jt(e,t,n,i){rt.call(this,e,t,n),this._bpmnRules=i}ie(Jt,rt),Jt.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],Jt.prototype.getHandlers=function(){var e=rt.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=xa,e["element.updateProperties"]=wa,e["canvas.updateRoot"]=Ec,e["lane.add"]=Dp,e["lane.resize"]=Sa,e["lane.split"]=Op,e["lane.updateRefs"]=wc,e["group.updateRefs"]=Ca,e["id.updateClaim"]=Sc,e["element.setColor"]=Bp,e["element.updateLabel"]=$y,e},Jt.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},Jt.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)},Jt.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},Jt.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},Jt.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},Jt.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},Jt.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},Jt.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Jt.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Jt.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},Jt.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},Jt.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},Jt.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},Jt.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function Fy(){}Fy.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||ye(t.source||e.source),t.connectionEnd||ye(t.target||e.target)]};var Rc=20,xA=5,Cc=Math.round,Hy=20,EA={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function wA(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function SA(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function zy(e,t,n){var i=Xt(t,e,xA),r=n.split(":")[0],o=Cc((t.x-e.x)/2+e.x),a=Cc((t.y-e.y)/2+e.y),s,c,u=SA(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=wA(i,r),c=l?"h:v":"v:h",p?l?(f=a===e.y,s={x:e.x+Rc*(/l/.test(r)?-1:1),y:f?a+Rc:a}):(f=o===e.x,s={x:f?o+Rc:o,y:e.y+Rc*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:$p(e,s,c).concat(s),directions:c,turnNextDirections:f}}function RA(e,t,n){return zy(e,t,n)}function CA(e,t,n){var i=zy(t,e,Vy(n));return{waypoints:i.waypoints.slice().reverse(),directions:Vy(i.directions),turnNextDirections:i.turnNextDirections}}function PA(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=$p(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function Vy(e){return e.split(":").reverse().join(":")}function AA(e,t,n){var i=Cc((t.x-e.x)/2+e.x),r=Cc((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 $p(e,t,n){if(n=n||"h:h",!BA(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Wy(n)){var i=RA(e,t,n),r=CA(e,t,n),o=PA(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return AA(e,t,n)}function TA(e,t,n){var i=$p(e,t,n);return i.unshift(e),i.push(t),qy(i)}function MA(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=Lx(o,"straight")[0]||"h:h",s=EA[a]||0,c=Xt(e,t,s),u=NA(c,a);n=n||ye(e),i=i||ye(t);var l=u.split(":"),p=Uy(n,e,l[0],$A(c)),f=Uy(i,t,l[1],c);return TA(p,f,u)}function kA(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&&OA(e,t,n,i,o),c||(c=o.connectionEnd&&IA(t,e,i,r),c)||(c=o.connectionStart&&LA(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:MA(e,t,n,i,o)}function DA(e,t,n){return e>=t&&e<=n}function Gy(e,t,n){var i={x:"width",y:"height"};return DA(t[e],n[e],n[e]+n[i[e]])}function OA(e,t,n,i,r){var o={},a,s;return s=Xt(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?Gy(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:Gy(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 LA(e,t,n,i){return jp(e,t,n,i)}function IA(e,t,n,i){var r=i.slice().reverse();return r=jp(e,t,n,r),r?r.reverse():null}function jp(e,t,n,i){function r(l){return l.length<3?!0:l.length>4?!1:!!at(l,function(p,f){var d=l[f-1];return d&&Xo(p,d)<3})}function o(l,p,f){var d=Ri(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(gh(l[d],p,Hy)||gh(l[d],f,Hy))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=jp(e,t,n,u)),c&&Ri(c)?null:c}function NA(e,t){if(Wy(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 BA(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Wy(e){return e&&/t|r|b|l/.test(e)}function $A(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 Uy(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 qy(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return nl(r,o,n,0)||t.push(n),t},[])}var jA=-10,FA=40,HA={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},zA={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},Fp={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Pa={top:"t",right:"r",bottom:"b",left:"l"};function Pc(e){this._elementRegistry=e}ie(Pc,Fy),Pc.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=Yy(r&&r[0],n)),a||(a=Yy(r&&r[r.length-1],i)),(v(e,"bpmn:Association")||v(e,"bpmn:DataAssociation"))&&r&&!Ky(n,i))return[].concat([o],r.slice(1,-1),[a]);var l=am(n,s)?HA:zA;return v(e,"bpmn:MessageFlow")?c=GA(n,i,l):(v(e,"bpmn:SequenceFlow")||Ky(n,i))&&(n===i?c={preferredLayouts:XA(n,e,l)}:v(n,"bpmn:BoundaryEvent")?c={preferredLayouts:ZA(n,i,a,l)}:Aa(n)||Aa(i)?c={preferredLayouts:l.subProcess,preserveDocking:UA(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=qy(kA(n,i,o,a,r,c))),u||[o,a]};function VA(e){var t=e.host;return Xt(ye(e),t,jA)}function GA(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:WA(e,t)}}function WA(e,t){return v(t,"bpmn:Participant")?"source":v(e,"bpmn:Participant")?"target":Aa(t)?"source":Aa(e)||v(t,"bpmn:Event")?"target":v(e,"bpmn:Event")?"source":null}function UA(e){return Aa(e)?"target":"source"}function Yy(e,t){return e?e.original||e:ye(t)}function Ky(e,t){return v(t,"bpmn:Activity")&&v(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Aa(e){return v(e,"bpmn:SubProcess")&&Be(e)}function jr(e,t){return e===t}function qA(e,t){return t.indexOf(e)!==-1}function wo(e){var t=/right|left/.exec(e);return t&&t[0]}function So(e){var t=/top|bottom/.exec(e);return t&&t[0]}function Xy(e,t){return Fp[e]===t}function YA(e,t){var n=wo(e),i=Fp[n];return t.indexOf(i)!==-1}function KA(e,t){var n=So(e),i=Fp[n];return t.indexOf(i)!==-1}function Zy(e){return e==="right"||e==="left"}function XA(e,t,n){var i=t.waypoints,r=i&&i.length&&Xt(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function ZA(e,t,n,i){var r=ye(e),o=ye(t),a=VA(e),s,c,u=jr(e.host,t),l=qA(a,["top","right","bottom","left"]),p=Xt(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?QA(a,l,e,t,n,i):(s=JA(a,p,l,i.isHorizontal),c=eT(a,p,l,i.isHorizontal),[s+":"+c])}function QA(e,t,n,i,r,o){var a=t?e:o.isHorizontal?So(e):wo(e),s=Pa[a],c;return t?Zy(e)?c=Qy("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=Qy("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function Qy(e,t,n,i){var r=FA;return!(Hp(e,i,n,r)||Hp(e,i,{x:n.x+n.width,y:n.y+n.height},r)||Hp(e,i,ye(t),r))}function Hp(e,t,n,i){return Math.abs(t[e]-n[e])<i}function JA(e,t,n,i){if(n)return Pa[e];var r=So(e),o=wo(e),a=So(t),s=wo(t);if(i){if(jr(r,a)||Xy(o,s))return Pa[r]}else if(jr(o,s)||Xy(r,a))return Pa[o];return Pa[i?o:r]}function eT(e,t,n,i){if(n)return Zy(e)?YA(e,t)||jr(e,t)?"h":"v":KA(e,t)||jr(e,t)?"v":"h";var r=So(e),o=wo(e),a=So(t),s=wo(t);return a&&!s?"v":s&&!a?"h":i?jr(r,a)?"h":"v":jr(o,s)?"v":"h"}Pc.$inject=["elementRegistry"];function Jy(e){return D({original:e.point.original||e.point},e.actual)}function pr(e,t){this._elementRegistry=e,this._graphicsFactory=t}pr.$inject=["elementRegistry","graphicsFactory"],pr.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(Jy(i)),o.push(Jy(r)),o},pr.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}},pr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return Zo(i,r,n)},pr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},pr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},pr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const zp={__init__:["modeling","bpmnUpdater"],__depends__:[_C,IC,BC,$C,py,jP,HP,qP,Gn,Rp,yy],bpmnFactory:["type",Un],bpmnUpdater:["type",Pn],elementFactory:["type",cr],modeling:["type",Jt],layouter:["type",Pc],connectionDocking:["type",pr]};var tT=10,ev=50,nT=250;function Vp(e,t,n,i){for(var r;r=iT(e,n,t);)n=i(t,n,r);return n}function Gp(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 iT(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=oT(e);return at(r,function(o){if(o===n)return!1;var a=Xt(o,i,tT);return a==="intersect"})}function rT(e,t){t||(t={});function n(h){return h.source===e?1:-1}var i=t.defaultDistance||ev,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||nT,c=t.reference||"start";o||(o=cT);function u(h,m){return r==="n"?c==="start"?me(h).top-me(m).bottom:c==="center"?me(h).top-ye(m).y:me(h).top-me(m).top:r==="w"?c==="start"?me(h).left-me(m).right:c==="center"?me(h).left-ye(m).x:me(h).left-me(m).left:r==="s"?c==="start"?me(m).top-me(h).bottom:c==="center"?ye(m).y-me(h).bottom:me(m).bottom-me(h).bottom:c==="start"?me(m).left-me(h).right:c==="center"?ye(m).x-me(h).right:me(m).right-me(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=bn(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 oT(e){var t=Wp(e);return e.host&&(t=t.concat(Wp(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(Wp(i))},[]))),t}function Wp(e){return sT(e).concat(aT(e))}function aT(e){return e.incoming.map(function(t){return t.source})}function sT(e){return e.outgoing.map(function(t){return t.target})}function cT(){return!0}var uT=100;function tv(e,t,n){e.on("autoPlace",uT,function(i){var r=i.shape,o=i.source;return lT(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}}tv.$inject=["eventBus","modeling","canvas"];function lT(e,t,n){n||(n={});var i=n.defaultDistance||ev,r=ye(e),o=me(e);return{x:o.right+i+t.width/2,y:r.y}}function nv(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}nv.$inject=["eventBus","selection"];const pT={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",tv],autoPlaceSelectionBehavior:["type",nv]};function iv(e,t,n){var i=am(e,n);if(v(t,"bpmn:TextAnnotation"))return dT(e,t,i);if(De(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return hT(e,t,i);if(v(t,"bpmn:FlowNode"))return fT(e,t,i)}function fT(e,t,n){var i=me(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=rT(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=Xt(e,e.host,-25),u.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var l=n?{x:i.right+a+t.width/2,y:r.y+rv(u,c,o)}:{x:r.x+rv(u,c,o),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},f=n?{y:p}:{x:p};return Vp(e,t,l,Gp(f))}function rv(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function dT(e,t,n){var i=me(e),r=n?{x:i.right+t.width/2,y:i.top-50-t.height/2}:{x:i.right+50+t.width/2,y:i.bottom+t.height/2};it(e)&&(r=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 Vp(e,t,r,Gp(a))}function hT(e,t,n){var i=me(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 Vp(e,t,r,Gp(a))}function ov(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return iv(r,i,t)})}ov.$inject=["eventBus","elementRegistry"];const Ac={__depends__:[pT],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",ov]},av=[rm,ia,zp,Ac];function mT(e={}){Ud(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new ao({container:t,moddleExtensions:e.moddleExtensions??es,additionalModules:[...av,...e.additionalModules??[]]})}var gT=new xo("ov"),yT=500;function Wt(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=gT,this._overlayDefaults=D({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=vT(n.getContainer()),this._init()}Wt.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Wt.prototype.get=function(e){if(vn(e)&&(e={id:e}),vn(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,Zr({type:e.type})):t.overlays.slice():[]}else return e.type?Oe(this._overlays,Zr({type:e.type})):e.id?this._overlays[e.id]:null},Wt.prototype.add=function(e,t,n){if(Ht(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},Wt.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&&(li(i.html),li(i.htmlContainer),delete i.htmlContainer,delete i.element,delete n._overlays[i.id]),r){var o=r.overlays.indexOf(i);o!==-1&&r.overlays.splice(o,1)}})},Wt.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Wt.prototype.show=function(){Tc(this._overlayRoot)},Wt.prototype.hide=function(){Tc(this._overlayRoot,!1)},Wt.prototype.clear=function(){this._overlays={},this._overlayContainers=[],fs(this._overlayRoot)},Wt.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}sv(n,i,r),on(e.html,"data-container-id",t.id)},Wt.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}sv(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Wt.prototype._createOverlayContainer=function(e){var t=ut('<div class="djs-overlays" />');fn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},Wt.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";cv(this._overlayRoot,n)},Wt.prototype._getOverlayContainer=function(e,t){var n=at(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},Wt.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)),vn(i)&&(i=ut(i)),o=this._getOverlayContainer(n),r=ut('<div class="djs-overlay" data-overlay-id="'+t+'">'),fn(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();Tc(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())},Wt.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),Tc(a,c),this._updateOverlayScale(e,t)},Wt.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+")"),cv(o,s)},Wt.prototype._updateOverlaysVisibilty=function(e){var t=this;M(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},Wt.prototype._init=function(){var e=this._eventBus,t=this;function n(i){t._updateRoot(i),t._updateOverlaysVisibilty(i),t.show()}e.on("canvas.viewbox.changing",function(i){t.hide()}),e.on("canvas.viewbox.changed",function(i){n(i.viewbox)}),e.on(["shape.remove","connection.remove"],function(i){var r=i.element,o=t.get({element:r});M(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){li(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",yT,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 vT(e){var t=ut('<div class="djs-overlay-container" />');return fn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function sv(e,t,n){fn(e,{left:t+"px",top:n+"px"})}function Tc(e,t){e.style.display=t===!1?"none":""}function cv(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Mc={__init__:["overlays"],overlays:["type",Wt]};function Up(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(Up,Y),Up.$inject=["canvas","injector"];const _T={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",Up]};function Ta(e){return CSS.escape(e)}var bT={"&":"&","<":"<",">":">",'"':""","'":"'"};function uv(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return bT[t]})}var xT="bjs-breadcrumbs-shown";function lv(e,t,n){var i=ut('<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=at(a,function(f){return f===l});p&&s()});function s(c){c&&(a=ET(c));var u=a.flatMap(function(p){var f=n.findRoot(mi(p))||n.findRoot(p.id);if(!f&&v(p,"bpmn:Process")){var d=t.find(function(g){var R=K(g);return R&&R.get("processRef")===p});f=d&&n.findRoot(d.id)}if(!f)return[];var h=uv(p.name||p.id),m=ut('<li><span class="bjs-crumb"><a title="'+h+'">'+h+"</a></span></li>");return m.addEventListener("click",function(){n.setRootElement(f)}),m});i.innerHTML="";var l=u.length>1;o.toggle(xT,l),u.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}lv.$inject=["eventBus","elementRegistry","canvas"];function ET(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 pv(e,t){var n=null,i=new wT;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})}pv.$inject=["eventBus","canvas"];function wT(){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 fv={x:180,y:160};function Fr(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}Fr.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)})}},Fr.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),RT(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},Fr.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=ST(e),i={x:n.x-fv.x,y:n.y-fv.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)})},Fr.prototype._moveToDiPlane=function(e,t){var n=dv(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},Fr.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},Fr.$inject=["eventBus","moddle"];function dv(e){return v(e,"bpmndi:BPMNDiagram")?e:dv(e.$parent)}function ST(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=me(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),xs(t)}function RT(e,t){var n=e.$parent;return!(!v(n,"bpmn:SubProcess")||n===t.bpmnElement||De(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var kc=250,CT='<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>',PT="bjs-drilldown-empty";function fr(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",kc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",kc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],kc,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"],kc,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(fr,Y),fr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},fr.prototype._canDrillDown=function(e){var t=this._canvas;return v(e,"bpmn:SubProcess")&&t.findRoot(mi(e))},fr.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(PT,!r)}},fr.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=ut('<button type="button" class="bjs-drilldown">'+CT+"</button>"),a=i.get("name")||i.get("id"),s=this._translate("Open {element}",{element:a});o.setAttribute("title",s),o.addEventListener("click",function(){t.setRootElement(t.findRoot(mi(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},fr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},fr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const AT={__depends__:[Mc,Rp,_T],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",lv],drilldownCentering:["type",pv],drilldownOverlayBehavior:["type",fr],subprocessCompatibility:["type",Fr]};function dr(e){ht.call(this,e)}ie(dr,ht),dr.prototype._modules=[rm,AT,Mc,Gn,ia],dr.prototype._moddleExtensions={};var Dc="keyboard.keydown",TT="keyboard.keyup",MT=1e3,hv="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 dn(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(hv));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}dn.$inject=["config.keyboard","eventBus"],dn.prototype._keydownHandler=function(e){this._keyHandler(e,Dc)},dn.prototype._keyupHandler=function(e){this._keyHandler(e,TT)},dn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Dc,i),n&&e.preventDefault()}},dn.prototype._isEventIgnored=function(e){return!1},dn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(hv)),this.unbind(),e=this._node=this._target,we.bind(e,"keydown",this._keydownHandler),we.bind(e,"keyup",this._keyupHandler),this._fire("bind")},dn.prototype.getBinding=function(){return this._node},dn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),we.unbind(e,"keydown",this._keydownHandler),we.unbind(e,"keyup",this._keyupHandler)),this._node=null},dn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},dn.prototype.addListener=function(e,t,n){zt(e)&&(n=t,t=e,e=MT),this._eventBus.on(n||Dc,e,t)},dn.prototype.removeListener=function(e,t){this._eventBus.off(t||Dc,e)},dn.prototype.hasModifier=ZC,dn.prototype.isCmd=Rn,dn.prototype.isShift=hp,dn.prototype.isKey=Nt;var kT=500;function Ro(e,t){var n=this;e.on("editorActions.init",kT,function(i){var r=i.editorActions;n.registerBindings(t,r)})}Ro.$inject=["eventBus","keyboard"],Ro.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(nP(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(iP(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(QC(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(JC(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(eP(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(tP(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Nt(["+","Add","="],r)&&Rn(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Nt(["-","Subtract"],r)&&Rn(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(Nt("0",r)&&Rn(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 qp={__init__:["keyboard","keyboardBindings"],keyboard:["type",dn],keyboardBindings:["type",Ro]};var DT={moveSpeed:50,moveSpeedAccelerated:200};function mv(e,t,n){var i=this;this._config=D({},DT,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})}}mv.$inject=["config.keyboardMove","keyboard","canvas"];const gv={__depends__:[qp],__init__:["keyboardMove"],keyboardMove:["type",mv]};var OT=15;function yv(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=Lr(s),p=ei(l,c);if(!n.dragging&<(p)>OT&&(n.dragging=!0,u===0&&Gg(e),oc("grab")),n.dragging){var f=n.last||n.start;p=ei(l,f),t.scroll({dx:p.x,dy:p.y}),n.last=l}s.preventDefault()}function o(s){we.unbind(document,"mousemove",r),we.unbind(document,"mouseup",o),n=null,Vg()}function a(s){if(!Ar(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:Lr(s)},we.bind(document,"mousemove",r),we.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}yv.$inject=["eventBus","canvas"];function LT(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const vv={__init__:["moveCanvas"],moveCanvas:["type",yv]};function _v(e,t){var n=pl(e.min),i=pl(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function IT(e,t){return Math.max(e.min,Math.min(e.max,t))}var NT=Math.sign||function(e){return e>=0?1:-1},Yp={min:.2,max:4},bv=10,BT=.1,$T=.75;function vi(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=mn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||$T;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}vi.$inject=["config.zoomScroll","eventBus","canvas"],vi.prototype.scroll=function(t){this._canvas.scroll(t)},vi.prototype.reset=function(){this._canvas.zoom("fit-viewport")},vi.prototype.zoom=function(t,n){var i=_v(Yp,bv*2);this._totalDelta+=t,Math.abs(this._totalDelta)>BT&&(this._zoom(t,n,i),this._totalDelta=0)},vi.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||Zm()&&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))*NT(t.deltaY)*o,this.zoom(a,c)}else r?a={dx:o*t.deltaY,dy:0}:a={dx:o*t.deltaX,dy:o*t.deltaY},this.scroll(a)}},vi.prototype.stepZoom=function(t,n){var i=_v(Yp,bv);this._zoom(t,n,i)},vi.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=pl(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(IT(Yp,s),t)},vi.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&we[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},vi.prototype._init=function(e){this.toggle(e)};const xv={__init__:["zoomScroll"],zoomScroll:["type",vi]};function Ma(e){dr.call(this,e)}ie(Ma,dr),Ma.prototype._navigationModules=[gv,vv,xv],Ma.prototype._modules=[].concat(dr.prototype._modules,Ma.prototype._navigationModules);function Kp(e){return e&&e[e.length-1]}function Ev(e){return e.y}function wv(e){return e.x}var jT={left:wv,center:wv,right:function(e){return e.x+e.width},top:Ev,middle:Ev,bottom:function(e){return e.y+e.height}};function Co(e,t){this._modeling=e,this._rules=t}Co.$inject=["modeling","rules"],Co.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}},Co.prototype._isType=function(e,t){return t.indexOf(e)!==-1},Co.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=Kp(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=ri(a,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return o[e]=Kp(c).center,o;u=t[0],t=ri(t,function(f){return f[i]+f[r]}),l=Kp(t),o[e]=p(u,l)}return o},Co.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=jT[t],a=ri(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const FT={__init__:["alignElements"],alignElements:["type",Co]},HT=new xo;function Po(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Po.$inject=["eventBus"],Po.prototype.schedule=function(e,t=HT.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},Po.prototype._schedule=function(e,t){const n=zT();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}},Po.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Po.prototype._cancel=function(e){clearTimeout(e.executionId)};function zT(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const VT={scheduler:["type",Po]};var GT="djs-element-hidden",Oc=".entry",WT=1e3,Sv=8,UT=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=ut('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},Pt.prototype.registerProvider=function(e,t){t||(t=e,e=WT),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(zt(r[n])){var o=r[n](e);zt(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=on(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},UT);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(zt(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=ut(r.html||'<div class="entry" draggable="true"></div>'),c;on(s,"data-action",o),c=et("[data-group="+Ta(a)+"]",n),c||(c=ut('<div class="group"></div>'),on(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&qT(s,r.className),r.title&&on(s,"title",r.title),r.imageUrl&&(i=ut("<img>"),on(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=ut('<div class="djs-context-pad"></div>');return En.bind(n,Oc,"click",function(i){t.trigger("click",i)}),En.bind(n,Oc,"dragstart",function(i){t.trigger("dragstart",i)}),En.bind(n,Oc,"mouseover",function(i){t.trigger("mouseover",i)}),En.bind(n,Oc,"mouseout",function(i){t.trigger("mouseout",i)}),we.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()&&KT(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&&Er(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)&&it(e)){var t=this._canvas.viewbox(),n=YT(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+Sv*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+Sv*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,GT)});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 qT(e,t){var n=ft(e);t=ge(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function YT(e){return e.waypoints[e.waypoints.length-1]}function KT(e,t){return e=ge(e)?e:[e],t=ge(t)?t:[t],e.length===t.length&&Er(e,function(n){return t.includes(n)})}const Rv={__depends__:[rc,VT,Mc],contextPad:["type",Pt]};var Lc,gt,Cv,hr,Pv,Av,Tv,Xp,Ic,ka,Mv,Zp,Qp,Jp,Nc={},Bc=[],XT=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,$c=Array.isArray;function Ii(e,t){for(var n in t)e[n]=t[n];return e}function ef(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function kv(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?Lc.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 jc(e,a,i,r,null)}function jc(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??++Cv,__i:-1,__u:0};return r==null&>.vnode!=null&>.vnode(o),o}function Fc(e){return e.children}function Hc(e,t){this.props=e,this.context=t}function Hr(e,t){if(t==null)return e.__?Hr(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"?Hr(e):null}function ZT(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=Ii({},t);o.__v=t.__v+1,gt.vnode&>.vnode(o),tf(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??Hr(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,jv(i,o,r),t.__e=t.__=null,o.__e!=n&&Dv(o)}}function Dv(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}),Dv(e)}function Ov(e){(!e.__d&&(e.__d=!0)&&hr.push(e)&&!zc.__r++||Pv!=gt.debounceRendering)&&((Pv=gt.debounceRendering)||Av)(zc)}function zc(){try{for(var e,t=1;hr.length;)hr.length>t&&hr.sort(Tv),e=hr.shift(),t=hr.length,ZT(e)}finally{hr.length=zc.__r=0}}function Lv(e,t,n,i,r,o,a,s,c,u,l){var p,f,d,h,m,g,R=i&&i.__k||Bc,E=t.length;for(c=QT(n,t,R,c,E),p=0;p<E;p++)(d=n.__k[p])!=null&&(f=d.__i!=-1&&R[d.__i]||Nc,d.__i=p,g=tf(e,d,f,r,o,a,s,c,u,l),h=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&nf(f.ref,null,d),l.push(d.ref,d.__c||h,d)),m==null&&h!=null&&(m=h),4&d.__u?(c=Iv(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 QT(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]=jc(null,a,null,null,null):$c(a)?a=e.__k[o]=jc(Fc,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=jc(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=JT(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=Hr(s)),Hv(s,s));return i}function Iv(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=Iv(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Hr(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function JT(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 Nv(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||XT.test(t)?n:n+"px"}function Vc(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||Nv(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||Nv(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(Mv,"$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[ka]=i[ka]:(n[ka]=Zp,e.addEventListener(t,o?Jp:Qp,o)):e.removeEventListener(t,o?Jp:Qp,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 Bv(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Ic]==null)t[Ic]=Zp++;else if(t[Ic]<n[ka])return;return n(gt.event?gt.event(t):t)}}}function tf(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=gt.__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 Hc(E,w),f.constructor=H,f.render=tM),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=Ii({},f.__s)),Ii(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)}),Bc.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&a.push(f),s=Hr(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=gt.__r,L=0,x)f.state=f.__s,f.__d=!1,T&&T(t),l=f.render(f.props,f.state,f.context),Bc.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=Ii(Ii({},i),f.getChildContext())),x&&!d&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(h,m)),A=l!=null&&l.type===Fc&&l.key==null?Fv(l.props.children):l,s=Lv(e,$c(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--;)ef(o[F])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),N.then||$v(t),gt.__e(N,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=eM(n.__e,t,n,i,r,o,a,c,u);return(l=gt.diffed)&&l(t),128&t.__u?void 0:s}function $v(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some($v))}function jv(e,t,n){for(var i=0;i<n.length;i++)nf(n[i],n[++i],n[++i]);gt.__c&>.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){gt.__e(o,r.__v)}})}function Fv(e){return typeof e!="object"||e==null||e.__b>0?e:$c(e)?e.map(Fv):e.constructor!==void 0?null:Ii({},e)}function eM(e,t,n,i,r,o,a,s,c){var u,l,p,f,d,h,m,g=n.props||Nc,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&&(gt.__m&>.__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&&Lc.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||Vc(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||Vc(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=""),Lv(t.type=="template"?e.content:e,$c(f)?f:[f],t,n,i,E=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&Hr(n,0),s,c),o!=null)for(u=o.length;u--;)ef(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])&&Vc(e,u,h,g[u],r),u="checked",m!=null&&m!=e[u]&&Vc(e,u,m,g[u],r))}return e}function nf(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){gt.__e(r,n)}}function Hv(e,t,n){var i,r;if(gt.unmount&>.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||nf(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){gt.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&Hv(i[r],t,n||typeof e.type!="function");n||ef(e.__e),e.__c=e.__=e.__e=void 0}function tM(e,t,n){return this.constructor(e,n)}function zv(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),gt.__&>.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],tf(t,e=t.__k=kv(Fc,null,[e]),r||Nc,Nc,t.namespaceURI,r?null:t.firstChild?Lc.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),jv(o,e,a),e.props.children=null}Lc=Bc.slice,gt={__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}},Cv=0,Hc.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Ii({},this.state),typeof e=="function"&&(e=e(Ii({},n),this.props)),e&&Ii(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Ov(this))},Hc.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Ov(this))},Hc.prototype.render=Fc,hr=[],Av=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Tv=function(e,t){return e.__v.__b-t.__v.__b},zc.__r=0,Xp=Math.random().toString(8),Ic="__d"+Xp,ka="__a"+Xp,Mv=/(PointerCapture)$|Capture$/i,Zp=0,Qp=Bv(!1),Jp=Bv(!0);var Vv=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,Vv(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},Gv=new Map;function nM(e){var t=Gv.get(this);return t||(t=new Map,Gv.set(this,t)),(t=Vv(this,t.get(e)||(t.set(e,t=(function(n){for(var i,r,o=1,a="",s="",c=[0],u=function(f){o===1&&(f||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,f,a):o===3&&(f||a)?(c.push(3,f,a),o=2):o===2&&a==="..."&&f?c.push(4,f,0):o===2&&a&&!f?c.push(5,0,!0,a):o>=5&&((a||!f&&o===5)&&(c.push(o,0,a,r),o=6),f&&(c.push(o,f,0,r),o=6)),a=""},l=0;l<n.length;l++){l&&(o===1&&u(),u(l));for(var p=0;p<n[l].length;p++)i=n[l][p],o===1?i==="<"?(u(),c=[c],o=3):a+=i:o===4?a==="--"&&i===">"?(o=1,a=""):a=i+a[0]:s?i===s?s="":a+=i:i==='"'||i==="'"?s=i:i===">"?(u(),o=1):o&&(i==="="?(o=5,r=a,a=""):i==="/"&&(o<5||n[l][p+1]===">")?(u(),o===3&&(c=c[0]),o=c,(c=c[0]).push(2,0,o),o=0):i===" "||i===" "||i===`
|
|
11
|
-
`||i==="\r"?(u(),o=2):a+=i),o===3&&a==="!--"&&(o=4,c=c[0])}return u(),c})(e)),t),arguments,[])).length>1?t:t[0]}var ot=
|
|
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}},ht.prototype._setDefinitions=function(e){this._definitions=e},ht.prototype.getModules=function(){return this._modules},ht.prototype.clear=function(){this.getDefinitions()&&tr.prototype.clear.call(this)},ht.prototype.destroy=function(){tr.prototype.destroy.call(this),pi(this._container)},ht.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},ht.prototype.off=function(e,t){this.get("eventBus").off(e,t)},ht.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),typeof e=="string"&&(e=et(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},ht.prototype.getDefinitions=function(){return this._definitions},ht.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},ht.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(ai(n,["additionalModules"]),{canvas:D({},n.canvas,{container:e}),modules:a});tr.call(this,s),n&&n.container&&this.attachTo(n.container)},ht.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},ht.prototype._createContainer=function(e){const t=ut('<div class="bjs-container"></div>');return dn(t,{width:Qh(e.width),height:Qh(e.height),position:e.position}),t},ht.prototype._createModdle=function(e){const t=D({},this._moddleExtensions,e.moddleExtensions);return new ad(t)},ht.prototype._modules=[];function As(e,t){return e.warnings=t,e}function j1(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 F1={width:"100%",height:"100%",position:"relative"};function Qh(e){return e+(xe(e)?"px":"")}function H1(e,t){return t&&at(e.diagrams,function(n){return n.id===t})||null}function z1(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Yh+"</a>",i=ut(n);dn(et("svg",i),Kh),dn(i,Xh,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),we.bind(i,"click",function(r){$1(),r.preventDefault()})}function so(e){ht.call(this,e),this.on("import.parse.complete",function(t){t.error||this._collectIds(t.definitions,t.elementsById)},this),this.on("diagram.destroy",function(){this.get("moddle").ids.clear()},this)}ie(so,ht),so.prototype._createModdle=function(e){var t=ht.prototype._createModdle.call(this,e);return t.ids=new li([32,36,1]),t},so.prototype._collectIds=function(e,t){var n=e.$model,i=n.ids,r;i.clear();for(r in t)i.claim(r,t[r])};function Be(e,t){return v(e,"bpmn:CallActivity")?!1:v(e,"bpmn:SubProcess")?(t=t||Ve(e),t&&v(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):v(e,"bpmn:Participant")?!!K(e).processRef:!0}function Gt(e){if(!(!v(e,"bpmn:Participant")&&!v(e,"bpmn:Lane"))){var t=Ve(e).isHorizontal;return t===void 0?!0:t}}function V1(e){return e&&K(e).isInterrupting!==!1}function cn(e){return e&&!!K(e).triggeredByEvent}function co(e,t){var n=K(e).eventDefinitions;return zi(n,function(i){return v(i,t)})}function G1(e){return co(e,"bpmn:ErrorEventDefinition")}function W1(e){return co(e,"bpmn:EscalationEventDefinition")}function U1(e){return co(e,"bpmn:CompensateEventDefinition")}var Lr={width:90,height:20},Jh=15;function nr(e){return v(e,"bpmn:Event")||v(e,"bpmn:Gateway")||v(e,"bpmn:DataStoreReference")||v(e,"bpmn:DataObjectReference")||v(e,"bpmn:DataInput")||v(e,"bpmn:DataOutput")||v(e,"bpmn:SequenceFlow")||v(e,"bpmn:MessageFlow")||v(e,"bpmn:Group")}function Ts(e){return ke(e.label)}function q1(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=Y1(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-=Jh:a+=Jh,{x:a,y:s}}function Y1(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 sl(e){return e.waypoints?q1(e.waypoints):v(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Lr.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Lr.height/2}}function K1(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(Lr.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=sl(t),i=Lr),D({x:n.x-i.width/2,y:n.y-i.height/2},i)}function em(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 X1(e){var t=e.categoryValueRef;return t&&t.value||""}function Nn(e){var t=e.businessObject,n=em(t);if(n)return n==="categoryValueRef"?X1(t):t[n]||""}function Z1(e,t){var n=e.businessObject,i=em(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 ke(e)&&nr(e.labelTarget)}var uo=7;function tm(e){let t=[];return M(e.incoming,n=>{v(n,"bpmn:Association")&&v(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),M(e.outgoing,n=>{v(n,"bpmn:Association")&&v(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function ta(e){const t=new Map;return M(el(e),n=>{M(tm(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 cl="hsl(225, 10%, 15%)",J1="white";function mi(e,t){return zi(e.eventDefinitions,function(n){return n.$type===t})}function eS(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function tS(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function Ie(e,t,n){var i=Ve(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||J1}function te(e,t,n){var i=Ve(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||cl}function na(e,t,n,i){var r=Ve(e),o=r.get("label");return i||o&&o.get("color:color")||t||te(e,n)}function nm(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 kr(r)}function ul(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 kr(a)}function nS(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 kr(s)}function iS(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 kr(o)}function ia(e,t={}){return{width:Hn(e,t),height:Rn(e,t)}}function Hn(e,t={}){return bn(t,"width")?t.width:e.width}function Rn(e,t={}){return bn(t,"height")?t.height:e.height}var rS=new li,oS=10,Ms=3,aS=1.5,ks=10,sS=4,lo=.95,cS=1,uS=.25;function Ir(e,t,n,i,r,o,a){Ci.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:cl,strokeWidth:2,fill:"white"})}function p(C){return n.computeStyle(C,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:cl,strokeWidth:2})}function f(C,_){var{ref:y={x:0,y:0},scale:k=1,element:I,parentGfx:W=r._svg}=_,ae=pe("marker",{id:C,viewBox:"0 0 20 20",refX:y.x,refY:y.y,markerWidth:20*k,markerHeight:20*k,orient:"auto"});Se(ae,I);var Te=et(":scope > defs",W);Te||(Te=pe("defs"),Se(W,Te)),Se(Te,ae)}function d(C,_,y,k){var I=rS.nextPrefixed("marker-");return h(C,I,_,y,k),"url(#"+I+")"}function h(C,_,y,k,I){if(y==="sequenceflow-end"){var W=pe("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 ae=pe("circle",{cx:6,cy:6,r:3.5,...l({fill:k,stroke:I,strokeWidth:1,strokeDasharray:[1e4,1]})});f(_,{element:ae,ref:{x:6,y:6},parentGfx:C})}if(y==="messageflow-end"){var Te=pe("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:Te,ref:{x:8.5,y:5},parentGfx:C})}if(y==="association-start"){var He=pe("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:I,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(_,{element:He,ref:{x:1,y:10},scale:.5,parentGfx:C})}if(y==="association-end"){var bt=pe("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:I,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(_,{element:bt,ref:{x:11,y:10},scale:.5,parentGfx:C})}if(y==="conditional-flow-marker"){var nt=pe("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...l({fill:k,stroke:I})});f(_,{element:nt,ref:{x:-1,y:10},scale:.5,parentGfx:C})}if(y==="conditional-default-flow-marker"){var Dt=pe("path",{d:"M 6 4 L 10 16",...l({stroke:I,fill:"none"})});f(_,{element:Dt,ref:{x:0,y:10},scale:.5,parentGfx:C})}}function m(C,_,y,k,I={}){zt(k)&&(I=k,k=0),k=k||0,I=l(I);var W=_/2,ae=y/2,Te=pe("circle",{cx:W,cy:ae,r:Math.round((_+y)/4-k),...I});return Se(C,Te),Te}function g(C,_,y,k,I,W){zt(I)&&(W=I,I=0),I=I||0,W=l(W);var ae=pe("rect",{x:I,y:I,width:_-I*2,height:y-I*2,rx:k,ry:k,...W});return Se(C,ae),ae}function S(C,_,y,k){var I=_/2,W=y/2,ae=[{x:I,y:0},{x:_,y:W},{x:I,y},{x:0,y:W}],Te=ae.map(function(bt){return bt.x+","+bt.y}).join(" ");k=l(k);var He=pe("polygon",{...k,points:Te});return Se(C,He),He}function E(C,_,y,k){y=p(y);var I=Yo(_,y,k);return Se(C,I),I}function x(C,_,y){return E(C,_,y,5)}function b(C,_,y){y=p(y);var k=pe("path",{...y,d:_});return Se(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):Ie(_,s,y.fill),ae=k?Ie(_,s,y.fill):te(_,c,y.stroke),Te=b(C,I,{fill:W,stroke:ae,strokeWidth:1});return Te},"bpmn:TimerEventDefinition":function(C,_,y={}){var k=y.width||_.width,I=y.height||_.height,W=y.width?1:2,ae=m(C,k,I,.2*I,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:W}),Te=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:k,containerHeight:I,position:{mx:.5,my:.5}});b(C,Te,{stroke:te(_,c,y.stroke),strokeWidth:W});for(var He=0;He<12;He++){var bt=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:k,containerHeight:I,position:{mx:.5,my:.5}}),nt=k/2,Dt=I/2;b(C,bt,{strokeWidth:1,stroke:te(_,c,y.stroke),transform:"rotate("+He*30+","+Dt+","+nt+")"})}return ae},"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):Ie(_,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:Ie(_,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):Ie(_,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):Ie(_,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",ae=b(C,I,{fill:W,stroke:te(_,c,y.stroke),strokeWidth:1});return Uh(ae,45),ae},"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):Ie(_,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):Ie(_,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):Ie(_,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:Ie(_,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=eS(I),ae=k||C;return I.get("eventDefinitions")&&I.get("eventDefinitions").length>1?I.get("parallelMultiple")?A["bpmn:ParallelMultipleEventDefinition"](_,ae,y,W):A["bpmn:MultipleEventDefinition"](_,ae,y,W):mi(I,"bpmn:MessageEventDefinition")?A["bpmn:MessageEventDefinition"](_,ae,y,W):mi(I,"bpmn:TimerEventDefinition")?A["bpmn:TimerEventDefinition"](_,ae,y,W):mi(I,"bpmn:ConditionalEventDefinition")?A["bpmn:ConditionalEventDefinition"](_,ae,y,W):mi(I,"bpmn:SignalEventDefinition")?A["bpmn:SignalEventDefinition"](_,ae,y,W):mi(I,"bpmn:EscalationEventDefinition")?A["bpmn:EscalationEventDefinition"](_,ae,y,W):mi(I,"bpmn:LinkEventDefinition")?A["bpmn:LinkEventDefinition"](_,ae,y,W):mi(I,"bpmn:ErrorEventDefinition")?A["bpmn:ErrorEventDefinition"](_,ae,y,W):mi(I,"bpmn:CancelEventDefinition")?A["bpmn:CancelEventDefinition"](_,ae,y,W):mi(I,"bpmn:CompensateEventDefinition")?A["bpmn:CompensateEventDefinition"](_,ae,y,W):mi(I,"bpmn:TerminateEventDefinition")?A["bpmn:TerminateEventDefinition"](_,ae,y,W):null}var H={ParticipantMultiplicityMarker:function(C,_,y={}){var k=Hn(_,y),I=Rn(_,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:Ie(_,s,y.fill),stroke:te(_,c,y.stroke)})},SubProcessMarker:function(C,_,y={}){var k=g(C,14,14,0,{strokeWidth:1,fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke)});Qt(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:Ie(_,s,y.fill),stroke:te(_,c,y.stroke)})},ParallelMarker:function(C,_,y){var k=Hn(_,y),I=Rn(_,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:Ie(_,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:Ie(_,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:Ie(_,s,y.fill),stroke:te(_,c,y.stroke)})},LoopMarker:function(C,_,y){var k=Hn(_,y),I=Rn(_,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=Hn(_,y),I=Rn(_,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:Hn(_,k),height:Rn(_,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 ae=I.get("loopCharacteristics"),Te=ae&&ae.get("isSequential");ae&&(D(k,{compensation:k.compensation-18}),y.includes("AdhocMarker")&&D(k,{seq:-23,loop:-18,parallel:-24}),Te===void 0&&y.push("LoopMarker"),Te===!1&&y.push("ParallelMarker"),Te===!0&&y.push("SequentialMarker")),y.includes("CompensationMarker")&&y.length===1&&D(k,{compensation:-8}),M(y,function(He){N(He,C,_,k)})}function ue(C,_,y={}){y=D({size:{width:100}},y);var k=o.createText(_||"",y);return $e(k).add("djs-label"),Se(C,k),k}function je(C,_,y,k={}){var I=K(_),W=ia({x:_.x,y:_.y,width:_.width,height:_.height},k);return ue(C,I.name,{align:y,box:W,padding:7,style:{fill:na(_,u,c,k.stroke)}})}function tt(C,_,y={}){var k={width:_.width,height:_.height,x:_.width/2+_.x,y:_.height/2+_.y};return ue(C,Nn(_),{box:k,style:D({},o.getExternalStyle(),{fill:na(_,u,c,y.stroke)})})}function X(C,_,y,k={}){var I=Gt(y),W=ue(C,_,{box:{height:30,width:I?Rn(y,k):Hn(y,k)},align:"center-middle",style:{fill:na(y,u,c,k.stroke)}});if(I){var ae=-1*Rn(y,k);Cs(W,0,-ae,270)}}function se(C,_,y={}){var{width:k,height:I}=ia(_,y);return g(C,k,I,ks,{...y,fill:Ie(_,s,y.fill),fillOpacity:lo,stroke:te(_,c,y.stroke)})}function fe(C,_,y={}){var k=K(_),I=Ie(_,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=Ge(y,["markerStart","markerEnd"]),x(C,_.waypoints,{...y,stroke:W,strokeDasharray:"0, 5"})}function oe(C,_,y={}){var k=Ie(_,s,y.fill),I=te(_,c,y.stroke),W=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}}),ae=b(C,W,{fill:k,fillOpacity:lo,stroke:I}),Te=K(_);if(tS(Te)){var He=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.33,my:(_.height-18)/_.height}});b(C,He,{strokeWidth:2,fill:k,stroke:I})}return ae}function de(C,_,y={}){return m(C,_.width,_.height,{fillOpacity:lo,...y,fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke)})}function ee(C,_,y={}){return S(C,_.width,_.height,{fill:Ie(_,s,y.fill),fillOpacity:lo,stroke:te(_,c,y.stroke)})}function $(C,_,y={}){var k=g(C,Hn(_,y),Rn(_,y),0,{fill:Ie(_,s,y.fill),fillOpacity:y.fillOpacity||lo,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=se(C,_,y),I=Be(_);if(cn(_)&&(re(k,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!I)){var W=K(_).flowElements||[],ae=W.filter(Te=>v(Te,"bpmn:StartEvent"));ae.length===1&&U(ae[0],C,y,_)}return je(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:Ie(k,s,y.fill),stroke:te(k,c,y.stroke),width:I,height:I},ae=K(C).isInterrupting,Te=ae?0:3,He=ae?1:1.2,bt=20,nt=(I-bt)/2,Dt="translate("+nt+","+nt+")";m(_,bt,bt,{fill:W.fill,stroke:W.stroke,strokeWidth:He,strokeDasharray:Te,transform:Dt}),F(C,_,W,k)}function Ae(C,_,y={}){var k=se(C,_,y);return je(C,_,"center-middle",y),z(C,_,void 0,y),k}var wt=this.handlers={"bpmn:AdHocSubProcess":function(C,_,y={}){return Be(_)?y=Ge(y,["fill","stroke","width","height"]):y=Ge(y,["fill","stroke"]),B(C,_,y)},"bpmn:Association":function(C,_,y={}){return y=Ge(y,["fill","stroke"]),fe(C,_,y)},"bpmn:BoundaryEvent":function(C,_,y={}){var{renderIcon:k=!0}=y;y=Ge(y,["fill","stroke"]);var I=K(_),W=I.get("cancelActivity");y={strokeWidth:1.5,fill:Ie(_,s,y.fill),fillOpacity:cS,stroke:te(_,c,y.stroke)},W||(y.strokeDasharray="6");var ae=de(C,_,y);return m(C,_.width,_.height,Ms,{...y,fill:"none"}),k&&F(_,C,y),ae},"bpmn:BusinessRuleTask":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var k=Ae(C,_,y),I=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),W=b(C,I);re(W,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1});var ae=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),Te=b(C,ae);return re(Te,{fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke),strokeWidth:1}),k},"bpmn:CallActivity":function(C,_,y={}){return y=Ge(y,["fill","stroke"]),B(C,_,{strokeWidth:5,...y})},"bpmn:ComplexGateway":function(C,_,y={}){y=Ge(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=Ge(y,["fill","stroke"]);var k=i.getRawPath("DATA_ARROW"),I=oe(C,_,y);return b(C,k,{fill:"none",stroke:te(_,c,y.stroke),strokeWidth:1}),I},"bpmn:DataInputAssociation":function(C,_,y={}){return y=Ge(y,["fill","stroke"]),fe(C,_,{...y,markerEnd:d(C,"association-end",Ie(_,s,y.fill),te(_,c,y.stroke))})},"bpmn:DataObject":function(C,_,y={}){return y=Ge(y,["fill","stroke"]),oe(C,_,y)},"bpmn:DataObjectReference":L("bpmn:DataObject"),"bpmn:DataOutput":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var k=i.getRawPath("DATA_ARROW"),I=oe(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=Ge(y,["fill","stroke"]),fe(C,_,{...y,markerEnd:d(C,"association-end",Ie(_,s,y.fill),te(_,c,y.stroke))})},"bpmn:DataStoreReference":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var k=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:0,my:.133}});return b(C,k,{fill:Ie(_,s,y.fill),fillOpacity:lo,stroke:te(_,c,y.stroke),strokeWidth:2})},"bpmn:EndEvent":function(C,_,y={}){var{renderIcon:k=!0}=y;y=Ge(y,["fill","stroke"]);var I=de(C,_,{...y,strokeWidth:4});return k&&F(_,C,y),I},"bpmn:EventBasedGateway":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var k=K(_),I=ee(C,_,y);m(C,_.width,_.height,_.height*.2,{fill:Ie(_,"none",y.fill),stroke:te(_,c,y.stroke),strokeWidth:1});var W=k.get("eventGatewayType"),ae=!!k.get("instantiate");function Te(){var bt=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:_.width,containerHeight:_.height,position:{mx:.36,my:.44}});b(C,bt,{fill:"none",stroke:te(_,c,y.stroke),strokeWidth:2})}if(W==="Parallel"){var He=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}});b(C,He,{fill:"none",stroke:te(_,c,y.stroke),strokeWidth:1})}else W==="Exclusive"&&(ae||m(C,_.width,_.height,_.height*.26,{fill:"none",stroke:te(_,c,y.stroke),strokeWidth:1}),Te());return I},"bpmn:ExclusiveGateway":function(C,_,y={}){y=Ge(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=Ve(_);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=Ge(y,["fill","stroke"]),ee(C,_,y)},"bpmn:Group":function(C,_,y={}){return y=Ge(y,["fill","stroke","width","height"]),g(C,_.width,_.height,ks,{stroke:te(_,c,y.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:Hn(_,y),height:Rn(_,y)})},"bpmn:InclusiveGateway":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var k=ee(C,_,y);return m(C,_.width,_.height,_.height*.24,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:2.5}),k},"bpmn:IntermediateEvent":function(C,_,y={}){var{renderIcon:k=!0}=y;y=Ge(y,["fill","stroke"]);var I=de(C,_,{...y,strokeWidth:1.5});return m(C,_.width,_.height,Ms,{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=Ge(y,["fill","stroke","width","height"]),$(C,_,{...y,fillOpacity:uS})},"bpmn:ManualTask":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var k=Ae(C,_,y),I=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return b(C,I,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:.5}),k},"bpmn:MessageFlow":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var k=K(_),I=Ve(_),W=Ie(_,s,y.fill),ae=te(_,c,y.stroke),Te=x(C,_.waypoints,{markerEnd:d(C,"messageflow-end",W,ae),markerStart:d(C,"messageflow-start",W,ae),stroke:ae,strokeDasharray:"10, 11",strokeWidth:1.5});if(k.get("messageRef")){var He=Te.getPointAtLength(Te.getTotalLength()/2),bt=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:He.x,y:He.y}}),nt={strokeWidth:1};I.get("messageVisibleKind")==="initiating"?(nt.fill=W,nt.stroke=ae):(nt.fill=ae,nt.stroke=W);var Dt=b(C,bt,nt),Ut=k.get("messageRef"),un=Ut.get("name"),ct=ue(C,un,{align:"center-top",fitBox:!0,style:{fill:ae}}),jt=Dt.getBBox(),Ft=ct.getBBox(),qr=He.x-Ft.width/2,kn=He.y+jt.height/2+oS;Cs(ct,qr,kn,0)}return Te},"bpmn:ParallelGateway":function(C,_,y={}){y=Ge(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=Ge(y,["fill","stroke","width","height"]);var k=$(C,_,y),I=Be(_),W=Gt(_),ae=K(_),Te=ae.get("name");if(I){var He=W?[{x:30,y:0},{x:30,y:Rn(_,y)}]:[{x:0,y:30},{x:Hn(_,y),y:30}];E(C,He,{stroke:te(_,c,y.stroke),strokeWidth:aS}),X(C,Te,_,y)}else{var bt=ia(_,y);W||(bt.height=Hn(_,y),bt.width=Rn(_,y));var nt=ue(C,Te,{box:bt,align:"center-middle",style:{fill:na(_,u,c,y.stroke)}});if(!W){var Dt=-1*Rn(_,y);Cs(nt,0,-Dt,270)}}return ae.get("participantMultiplicity")&&N("ParticipantMultiplicityMarker",C,_,y),k},"bpmn:ReceiveTask":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var k=K(_),I=Ae(C,_,y),W;return k.get("instantiate")?(m(C,28,28,20*.22,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1}),W=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):W=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),b(C,W,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1}),I},"bpmn:ScriptTask":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var k=Ae(C,_,y),I=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return b(C,I,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1}),k},"bpmn:SendTask":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var k=Ae(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:Ie(_,s,y.fill),strokeWidth:1}),k},"bpmn:SequenceFlow":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var k=Ie(_,s,y.fill),I=te(_,c,y.stroke),W=x(C,_.waypoints,{markerEnd:d(C,"sequenceflow-end",k,I),stroke:I}),ae=K(_),{source:Te}=_;if(Te){var He=K(Te);ae.get("conditionExpression")&&v(He,"bpmn:Activity")&&re(W,{markerStart:d(C,"conditional-flow-marker",k,I)}),He.get("default")&&(v(He,"bpmn:Gateway")||v(He,"bpmn:Activity"))&&He.get("default")===ae&&re(W,{markerStart:d(C,"conditional-default-flow-marker",k,I)})}return W},"bpmn:ServiceTask":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var k=Ae(C,_,y);m(C,10,10,{fill:Ie(_,s,y.fill),stroke:"none",transform:"translate(6, 6)"});var I=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});b(C,I,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1}),m(C,10,10,{fill:Ie(_,s,y.fill),stroke:"none",transform:"translate(11, 10)"});var W=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return b(C,W,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1}),k},"bpmn:StartEvent":function(C,_,y={}){var{renderIcon:k=!0}=y;y=Ge(y,["fill","stroke"]);var I=K(_);I.get("isInterrupting")||(y={...y,strokeDasharray:"6"});var W=de(C,_,y);return k&&F(_,C,y),W},"bpmn:SubProcess":function(C,_,y={}){return Be(_)?y=Ge(y,["fill","stroke","width","height"]):y=Ge(y,["fill","stroke"]),B(C,_,y)},"bpmn:Task":function(C,_,y={}){return y=Ge(y,["fill","stroke"]),Ae(C,_,y)},"bpmn:TextAnnotation":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var{width:k,height:I}=ia(_,y),W=g(C,k,I,0,0,{fill:"none",stroke:"none"}),ae=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:k,containerHeight:I,position:{mx:0,my:0}});b(C,ae,{stroke:te(_,c,y.stroke)});var Te=K(_),He=Te.get("text")||"";return ue(C,He,{align:"left-top",box:ia(_,y),padding:uo,style:{fill:na(_,u,c,y.stroke)}}),W},"bpmn:Transaction":function(C,_,y={}){Be(_)?y=Ge(y,["fill","stroke","width","height"]):y=Ge(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=Be(_);return W||(y={}),g(C,Hn(_,y),Rn(_,y),ks-Ms,Ms,I),k},"bpmn:UserTask":function(C,_,y={}){y=Ge(y,["fill","stroke"]);var k=Ae(C,_,y),I=15,W=12,ae=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:I,y:W}});b(C,ae,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:.5});var Te=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:I,y:W}});b(C,Te,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:.5});var He=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:I,y:W}});return b(C,He,{fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke),strokeWidth:.5}),k},label:function(C,_,y={}){return tt(C,_,y)}};this._drawPath=b,this._renderer=T}ie(Ir,Ci),Ir.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Ir.prototype.canRender=function(e){return v(e,"bpmn:BaseElement")},Ir.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Ir.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Ir.prototype.getShapePath=function(e){return ke(e)?ul(e,sS):v(e,"bpmn:Event")?nm(e):v(e,"bpmn:Activity")?ul(e,ks):v(e,"bpmn:Gateway")?nS(e):iS(e)};function Ge(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var lS=0,pS={width:150,height:50};function fS(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function dS(e){return zt(e)?D({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var ll=null;function hS(){return ll||(ll=document.createElement("canvas").getContext("2d")),ll}function mS(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(im(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function im(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function gS(e,t){var n=hS();if(!n)return{width:0,height:0};n.font=mS(t),"letterSpacing"in n&&(n.letterSpacing=im(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 yS(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=gS(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return vS(e,r,i,o);r=bS(r,o.width,t)}}function vS(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 rm="";function _S(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===rm)&&r.pop();break}var a=r[r.length-1];return a&&a===rm&&(r[r.length-1]="-"),r.join("")}function bS(e,t,n){var i=Math.max(e.length*(n/t),1),r=_S(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function Ds(e){this._config=D({},{size:pS,padding:lS,style:{},align:"center-top"},e||{})}Ds.prototype.createText=function(e,t){return this.layoutText(e,t).element},Ds.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Ds.prototype.layoutText=function(e,t){for(var n=D({},this._config.size,t.box),i=D({},this._config.style,t.style),r=fS(t.align||this._config.align),o=dS(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=xS(i),c=e.split(/\u00AD?\r?\n/),u=[],l=n.width-o.left-o.right;c.length;)u.push(yS(c,l,i));r.vertical==="middle"&&(o.top=o.bottom=0);var p=xn(u,function(g,S,E){return g+(s||S.height)},0)+o.top+o.bottom,f=xn(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,Se(h,E)});var m={width:f,height:p};return{dimensions:m,element:h}};function xS(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var ES=12,wS=1.2,SS=40;function om(e){var t=D({fontFamily:"Arial, sans-serif",fontSize:ES,fontWeight:"normal",lineHeight:wS},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=D({},t,{fontSize:n},e&&e.externalStyle||{}),r=new Ds({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Lr.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:uo});return{x:a.x,y:a.y,width:a.width,height:Math.max(SS,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}}om.$inject=["config.textRenderer"];function RS(){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=TS(i.d,{mx:r,my:o,e:a});return p}}var CS=/\{([^{}]+)\}/g,PS=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function AS(e,t,n){var i=n;return t.replace(PS,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 TS(e,t){return String(e).replace(CS,function(n,i){return AS(n,i,t)})}const MS={__init__:["bpmnRenderer"],bpmnRenderer:["type",Ir],textRenderer:["type",om],pathMap:["type",RS]};function kS(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const ra={translate:["value",kS]};function Os(e,t,n){return D({id:e.id,type:e.$type,businessObject:e,di:t},n)}function DS(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 am(e,t,n){return new Error(`element ${sn(t)} referenced by ${sn(e)}#${n} not yet drawn`)}function Mi(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}Mi.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],Mi.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(Os(e,t,a)),this._canvas.addRootElement(i)}else if(v(t,"bpmndi:BPMNShape")){var s=!Be(e,t),c=LS(e);r=n&&(n.hidden||n.collapsed);var u=t.bounds;i=this._elementFactory.createShape(Os(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")&&(OS(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(Os(e,t,{hidden:r,source:l,target:p,waypoints:DS(t,l,p)})),v(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${sn(t)} for element ${sn(e)}`);return nr(e)&&Nn(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},Mi.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${sn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw am(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},Mi.prototype.addLabel=function(e,t,n){var i,r,o;return i=K1(t,n),r=Nn(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(Os(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!Nn(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)},Mi.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?am(e,i,t+"Ref"):new Error(`${sn(e)}#${t} Ref not specified`)},Mi.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},Mi.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},Mi.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function OS(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 LS(e){return v(e,"bpmn:Group")}const sm={__depends__:[MS,{__depends__:[ra],bpmnImporter:["type",Mi]}]};function oa(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function ti(e,t){return{x:e.x-t.x,y:e.y-t.y}}function pl(e){return Math.log(e)/Math.log(10)}var IS=1e3;function Y(e){this._eventBus=e}Y.$inject=["eventBus"];function NS(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((Vt(t)||xe(t))&&(o=r,r=i,i=n,n=t,t=null),Vt(n)&&(o=r,r=i,i=n,n=IS),zt(r)&&(o=r,r=!1),!Vt(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?NS(i,o):i,o)})},Y.prototype.canExecute=ki("canExecute"),Y.prototype.preExecute=ki("preExecute"),Y.prototype.preExecuted=ki("preExecuted"),Y.prototype.execute=ki("execute"),Y.prototype.executed=ki("executed"),Y.prototype.postExecute=ki("postExecute"),Y.prototype.postExecuted=ki("postExecuted"),Y.prototype.revert=ki("revert"),Y.prototype.reverted=ki("reverted");function ki(e){return function(n,i,r,o,a){(Vt(n)||xe(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var fl=["top","bottom","left","right"],Ls=10;function dl(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(Ts(r)&&!it(r)){var o=jS(r);o&&i(r,o)}}function i(r,o){var a=ye(r),s=r.label,c=ye(s);if(s.parent){var u=me(r),l;switch(o){case"top":l={x:a.x,y:u.top-Ls-s.height/2};break;case"left":l={x:u.left-Ls-s.width/2,y:a.y};break;case"bottom":l={x:a.x,y:u.bottom+Ls+s.height/2};break;case"right":l={x:u.right+Ls+s.width/2,y:a.y};break}var p=ti(l,c);t.moveShape(s,p)}}}ie(dl,Y),dl.$inject=["eventBus","modeling"];function BS(e){var t=e.host,n=ye(e),i=Zt(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=fl.filter(function(a){return r.indexOf(a)===-1});return o}function $S(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 cm(t,i)});return n}function jS(e){var t=ye(e.label),n=ye(e),i=cm(n,t);if(FS(i)){var r=$S(e);if(e.host){var o=BS(e);r=r.concat(o)}var a=fl.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?Zt(e.label,e)!=="intersect"?void 0:i:a[0]}}function cm(e,t){return Zt(t,e,5)}function FS(e){return fl.indexOf(e)!==-1}function hl(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(hl,Y),hl.$inject=["eventBus"];var HS=1500;function ml(e,t,n){e.invoke(Y,this),this.preExecute("elements.delete",HS,function(r){var o=r.context,a=o.elements,s=i(a);s.length&&(o.elements=a.concat(s))}),t.on("shape.move.start",function(r){var o=r.context.shapes,a=i(o);a.length&&(r.context.shapes=o.concat(a))});function i(r){var o=Oe(r,u=>v(u,"bpmn:Participant")||v(u,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(u=>v(u,"bpmn:Artifact"))),c=new Set;return M(o,u=>{const l=new Set(Zr(ro(Array.from(s),Ct(u))));c=c.union(l),s=s.difference(l)}),Array.from(c)}}ie(ml,Y),ml.$inject=["injector","eventBus","canvas"];function gl(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(gl,Y),gl.$inject=["injector","modeling"];function po(e,t){for(_n(t)&&(t=[t]);e=e.parent;)if(De(e,t))return e;return null}function um(e,t){var n=po(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=po(e,i),n)return Gt(n);if(De(e,i))return Gt(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?Gt(o):!0}var lm=500;function Is(e,t){t.invoke(Y,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",lm,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return pm(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",lm,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];pm(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}Is.$inject=["bpmnReplace","injector"],ie(Is,Y),Is.prototype._replaceShape=function(e,t){var n=zS(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function zS(e){var t=K(e),n=t.eventDefinitions;return n&&n[0]}function pm(e,t){return!ke(e)&&De(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function yl(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)})})}yl.$inject=["eventBus","modeling"],ie(yl,Y);function fm(e){return e.create("bpmn:Category")}function VS(e){return e.create("bpmn:CategoryValue")}function dm(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=VS(e)),n.$parent||(n.$parent=fm(e)),n}function GS(e,t,n){return Et(t.get("categoryValue"),e),e.$parent=t,Et(n.get("rootElements"),t),t.$parent=n,e}function WS(e){var t=e.$parent;return t&&(_t(t.get("categoryValue"),e),e.$parent=null),e}function US(e){var t=e.$parent;return t&&(_t(t.get("rootElements"),e),e.$parent=null),e}var qS=500;function vl(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&&GS(c,u,e.getDefinitions())}function s(c,u,l){u&&!o(u,l)&&US(u),c&&!r(c,l)&&WS(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"],qS,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){hm(c).forEach(function(u){a(u.categoryValue,u.category)})},!0),this.reverted("group.updateRefs",function(c){hm(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)}vl.$inject=["bpmnjs","elementRegistry","injector"],ie(vl,Y);function hm(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function _l(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 S=g.source,E=g.target;fo(S)&&aa(E)&&l(E)}function r(g){const S=g.connection,E=g.source,x=g.target;fo(E)&&Ns(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;aa(x)&&l(x),fo(b)&&Ns(S)&&u(S)}}function a(g){const{element:S}=g;aa(S)?(p(S),d(S)):Ns(S)&&h(S)}function s(g){const{newData:S,oldShape:E}=g;if(fo(g.oldShape)&&S.eventDefinitionType!=="bpmn:CompensateEventDefinition"||S.type!=="bpmn:BoundaryEvent"){const x=E.outgoing.find(({target:b})=>aa(b));x&&x.target&&(g._connectionTarget=x.target)}else if(!fo(g.oldShape)&&S.eventDefinitionType==="bpmn:CompensateEventDefinition"&&S.type==="bpmn:BoundaryEvent"){const x=E.outgoing.find(({target:b})=>Ns(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=>v(b,"bpmn:Association")).filter(b=>aa(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=>fo(E.source));t.removeElements(S)}function m(g){const S=g.outgoing.filter(E=>v(E,"bpmn:SequenceFlow"));t.removeElements(S)}}ie(_l,Y),_l.$inject=["eventBus","modeling","bpmnRules"];function aa(e){const t=K(e);return t&&t.get("isForCompensation")}function fo(e){return e&&v(e,"bpmn:BoundaryEvent")&&co(e,"bpmn:CompensateEventDefinition")}function Ns(e){return e&&v(e,"bpmn:Activity")&&!cn(e)}function bl(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=po(i,"bpmn:Participant"))})}bl.$inject=["injector"],ie(bl,Y);function xl(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}})}xl.$inject=["eventBus","bpmnFactory"],ie(xl,Y);var El=20,wl=20,mm=30,Bs=2e3;function Sl(e,t,n){Y.call(this,t),t.on(["create.start","shape.move.start"],Bs,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")&&!ke(p)&&!it(p)});if(c.length){var u=Ct(c),l=YS(a,u);D(a,l),o.createConstraints=KS(a,u)}}}),t.on("create.start",Bs,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",Bs,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",Bs,function(r){var o=r.elements,a=r.parent,s=XS(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)}Sl.$inject=["canvas","eventBus","modeling"],ie(Sl,Y);function YS(e,t){t={width:t.width+El*2+mm,height:t.height+wl*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 KS(e,t){return t=me(t),{bottom:t.top+e.height/2-wl,left:t.right-e.width/2+El,top:t.bottom-e.height/2+wl,right:t.left+e.width/2-El-mm}}function XS(e){return at(e,function(t){return v(t,"bpmn:Participant")})}var gm="__targetRef_placeholder";function Rl(e,t){Y.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],ym(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],ym(o));function n(a,s,c){var u=a.get("dataInputAssociations");return at(u,function(l){return l!==c&&l.targetRef===s})}function i(a,s){var c=a.get("properties"),u=at(c,function(l){return l.name===gm});return!u&&s&&(u=t.create("bpmn:Property",{name:gm}),Et(c,u)),u}function r(a,s){var c=i(a);c&&(n(a,c,s)||_t(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}}Rl.$inject=["eventBus","bpmnFactory"],ie(Rl,Y);function ym(e){return function(t){var n=t.context,i=n.connection;if(v(i,"bpmn:DataInputAssociation"))return e(t)}}function $s(e){this._bpmnUpdater=e}$s.$inject=["bpmnUpdater"],$s.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),[]},$s.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 Cl(e,t,n,i){Y.call(this,i),t.registerHandler("dataStore.updateContainment",$s);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:Ve(s),newSemanticParent:l.processRef||l,newDiParent:Ve(c)})}}this.preExecute("shape.create",function(s){var c=s.context,u=c.shape;v(u,"bpmn:DataStoreReference")&&u.type!=="label"&&(c.hints||(c.hints={}),c.hints.autoResize=!1)}),this.preExecute("elements.move",function(s){var c=s.context,u=c.shapes,l=u.filter(function(p){return v(p,"bpmn:DataStoreReference")});l.length&&(c.hints||(c.hints={}),c.hints.autoResize=u.filter(function(p){return!v(p,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,u=c.shape,l=u.parent;v(u,"bpmn:DataStoreReference")&&u.type!=="label"&&v(l,"bpmn:Collaboration")&&a(u)}),this.postExecute("shape.move",function(s){var c=s.context,u=c.shape,l=c.oldParent,p=u.parent;if(!v(l,"bpmn:Collaboration")&&v(u,"bpmn:DataStoreReference")&&u.type!=="label"&&v(p,"bpmn:Collaboration")){var f=v(l,"bpmn:Participant")?l:QS(l,"bpmn:Participant");a(u,f)}}),this.postExecute("shape.delete",function(s){var c=s.context,u=c.shape,l=e.getRootElement();De(u,["bpmn:Participant","bpmn:SubProcess"])&&v(l,"bpmn:Collaboration")&&o(l).filter(function(p){return ZS(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)})})}Cl.$inject=["canvas","commandStack","elementRegistry","eventBus"],ie(Cl,Y);function ZS(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 js=Math.max,Fs=Math.min,JS=20;function vm(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function eR(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 tR(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 Hs(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)?Fs:js)(i,r)),xe(o)&&(i=(/top|left/.test(e)?js:Fs)(i,o)),i}function nR(e,t){if(!t)return e;var n=me(e);return ws({top:Hs("top",n,t),right:Hs("right",n,t),bottom:Hs("bottom",n,t),left:Hs("left",n,t)})}function iR(e,t,n,i){var r=me(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?me(i):o,s={top:Fs(o.top,a.top),left:Fs(o.left,a.left),bottom:js(o.bottom,a.bottom),right:js(o.right,a.right)};return ws(s)}function sa(e,t){return typeof e<"u"?e:JS}function rR(e,t){var n,i,r,o;return typeof t=="object"?(n=sa(t.left),i=sa(t.right),r=sa(t.top),o=sa(t.bottom)):n=i=r=o=sa(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function oR(e){return!(e.waypoints||e.type==="label")}function _m(e,t){var n;if(e.length===void 0?n=Oe(e.children,oR):n=e,n.length)return rR(Ct(n),t)}var ir=Math.abs;function aR(e,t){return vm(me(t),me(e))}var sR=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],zn=30;function zs(e,t){return t=t||[],e.children.filter(function(n){v(n,"bpmn:Lane")&&(zs(n,t),t.push(n))}),t}function rr(e){return e.children.filter(function(t){return v(t,"bpmn:Lane")})}function Vn(e){return po(e,sR)||e}function cR(e,t){var n=Vn(e),i=v(n,"bpmn:Process")?[]:[n],r=zs(n,i),o=me(e),a=me(t),s=aR(e,t),c=[],u=Gt(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=me(l);s.top&&(ir(m.bottom-o.top)<10&&(d=a.top-m.bottom),ir(m.top-o.top)<5&&(p=a.top-m.top)),s.left&&(ir(m.right-o.left)<10&&(f=a.left-m.right),ir(m.left-o.left)<5&&(h=a.left-m.left)),s.bottom&&(ir(m.top-o.bottom)<10&&(p=a.bottom-m.top),ir(m.bottom-o.bottom)<5&&(d=a.bottom-m.bottom)),s.right&&(ir(m.left-o.right)<10&&(h=a.right-m.left),ir(m.right-o.right)<5&&(f=a.right-m.right)),(p||f||d||h)&&c.push({shape:l,newBounds:tR(l,{top:p,right:f,bottom:d,left:h})})}}),c}var uR=500;function Pl(e,t){Y.call(this,e);function n(i,r){var o=Gt(i),a=rr(r),s=[],c=[],u=[],l=[];if(Dr(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",uR,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))})}Pl.$inject=["eventBus","spaceTool"],ie(Pl,Y);var bm=500;function Vs(e,t){t.invoke(Y,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",bm,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return xm(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",bm,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;xm(a,pR(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}Vs.$inject=["bpmnReplace","injector"],ie(Vs,Y),Vs.prototype._replaceShape=function(e){var t=lR(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function lR(e){var t=K(e),n=t.eventDefinitions;return n&&n[0]}function xm(e,t){return!ke(e)&&v(e,"bpmn:BoundaryEvent")&&!t}function pR(e,t){return e.indexOf(t)!==-1}var Gs=Math.round,fR=Math.max;function dR(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 hR(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var Em=10;function mR(e,t){var n,i;for(n=0;i=e[n];n++)if(Zo(i,t)<=Em)return{point:e[n],bendpoint:!0,index:n};return null}function gR(e,t){var n=Ph(dR(t,Em),hR(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=fR(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:Gs(i.x+r.x)/2,y:Gs(i.y+r.y)/2},index:i.segment2}:{point:{x:Gs(i.x),y:Gs(i.y)},index:i.segment2}:null}function Al(e,t){return mR(e,t)||gR(e,t)}function Tl(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(),S;xe(a.width)?S=ye(a):S=a;var E=Al(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||!wm(r,c[c.length-1]))&&c.push(Sm(l)),(u.length===1||!wm(r,u[0]))&&u.unshift(Sm(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&&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=at(o.children,function(f){var d=t.canInsert(a,f);return d&&Al(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(Tl,Y),Tl.$inject=["eventBus","bpmnRules","modeling"];function wm(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 Sm(e){return D({},e)}function Ml(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)&&ho(r)){var c=[];v(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(u=>u!==r&&ho(u)):c=a.incoming.filter(u=>u!==r&&ho(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(ho).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(ho).forEach(function(s){const c=a.incoming.filter(ho).filter(function(u){return u.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}Ml.$inject=["eventBus","modeling"],ie(Ml,Y);function ho(e){return v(e,"bpmn:SequenceFlow")}var Ws=1500,Rm=2e3;function Cm(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"],Ws,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;v(a,"bpmn:Lane")&&!De(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Vn(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||De(o,["bpmn:Group","bpmn:TextAnnotation"]))&&(i.hover=s,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.hover","connect.out","connect.end","connect.cleanup","global-connect.hover","global-connect.out","global-connect.end","global-connect.cleanup"],Ws,function(i){var r=i.hover;v(r,"bpmn:Lane")&&(i.hover=Vn(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Ws,function(i){var r=i.context,o=i.hover,a=r.type;v(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Vn(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Ws,function(i){var r=i.context,o=r.start;v(o,"bpmn:Lane")&&(r.start=Vn(o)||o)}),t.on("shape.move.start",Rm,function(i){var r=i.shape;v(r,"bpmn:Lane")&&(i.shape=Vn(r)||r)}),t.on("spaceTool.move",Rm,function(i){var r=i.hover;r&&v(r,"bpmn:Lane")&&(i.hover=Vn(r))})}Cm.$inject=["elementRegistry","eventBus","canvas"];var Pm=770;function kl(e,t,n,i){n.invoke(Y,this);function r(s,c){var u=K(s),l=c.categoryValue||u.categoryValueRef;l||(l=dm(e,u));var p=c.category||l.$parent||fm(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",Pm,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",Pm,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})}kl.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],ie(kl,Y);function Dl(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 Am(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=Dl(i,r,o,a),u=Dl(i,r,o,s),l;c&&u?Tm(c,o)>Tm(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)})}Am.$inject=["eventBus"];function Tm(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Ol(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=Ve(i);if(De(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}Ol.$inject=["eventBus"],ie(Ol,Y);function Mm(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function km(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function yR(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 vR(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 Ll(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=vR([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 Dm(e,t){var n=Ll(e,t),i={x:n.x-e.x,y:n.y-e.y};return Mm(i)}function ca(e,t){return Mm({x:e.x-t.x,y:e.y-t.y})}var Om=Math.sqrt,Lm=Math.min,_R=Math.max,Im=Math.abs;function Nm(e){return Math.pow(e,2)}function ua(e,t){return Om(Nm(e.x-t.x)+Nm(e.y-t.y))}function bR(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],$m(i,r)?u=[i]:(o=ua(e,i),a=ua(e,r),c=Lm(o,a),u=xR(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:$m(i,u[0])?n:n+1}),u.length===2&&(s=wR(u[0],u[1]),l={type:"segment",position:s,segmentIndex:n,relativeLocation:ua(i,s)/ua(i,r)}),p=ua(l.position,e),(!d||f>p)&&(d=l,f=p)}return d}function xR(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=Om(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 ER(x,e,t)})}function ER(e,t,n){return Bm(e.x,t.x,n.x)&&Bm(e.y,t.y,n.y)}function Bm(e,t,n){return e>=Lm(t,n)-Us&&e<=_R(t,n)+Us}function wR(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Us=.1;function $m(e,t){return Im(e.x-t.x)<=Us&&Im(e.y-t.y)<=Us}function SR(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=Fm(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 jm(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=bR(e,n),c=s.segmentIndex,u=SR(n,t,s,i);if(u<0||u>t.length-2||u===null)return a;var l=Hm(n,c),p=Hm(t,u),f=s.position,d=CR(l,f),h=RR(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=Fm(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=yR({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:Ai(x),delta:Ai({x:r,y:o})}}function Fm(e,t){var n=ca(e[t-1],e[t]),i=ca(e[t],e[t+1]),r=n/(n+i);return r}function RR(e,t){var n=km(e),i=km(t);return i-n}function Hm(e,t){return[e[t],e[t+1]]}function CR(e,t){var n=ca(e[0],e[1]),i=ca(e[0],t);return n===0?0:i/n}function PR(e,t,n,i){var r=ye(e);return jm(r,t,n,i).delta}function la(e,t,n){var i=oa(t),r=oa(n),o=ti(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return Ai({x:r.x+a.x,y:r.y+a.y})}function zm(e,t,n){var i=oa(e),r=oa(t),o=oa(n),a=ti(e,i),s=ti(i,r),c=AR(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 Ai({x:l.x+a.x-e.x,y:l.y+a.y-e.y})}function AR(e,t,n){var i=me(t),r=me(n);if(TR(i,r))return null;var o=Zt(t,e),a,s,c;if(o==="top")a={x:0,y:r.bottom-i.bottom};else if(o==="bottom")a={x:0,y:r.top-i.top};else if(o==="right")a={x:r.left-i.left,y:0};else if(o==="left")a={x:r.right-i.right,y:0};else return null;return s={x:e.x+a.x,y:e.y+a.y},c=Zt(n,s),c!==o?null:a}function TR(e,t){return MR(e,t)||kR(e,t)}function MR(e,t){return e.right!==t.right&&e.left!==t.left}function kR(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var Vm="name",Gm="text";function Il(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(Vm in u&&t.updateLabel(c,u[Vm]),Gm in u&&v(c,"bpmn:TextAnnotation")){var l=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},u[Gm]||"");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;ke(u)||!nr(u)||Nn(u)&&t.updateLabel(u,Nn(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),PR(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&&nr(l)&&u.label&&c.label&&(c.label.x=u.label.x,c.label.y=u.label.y)}),this.preExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.hints||{};if(!(!ke(c)||u.autoResize)){var l=s.newBounds,p=i.getDimensions(Nn(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(Ts(c)){var p=c.label,f=ye(p),d=LR(l),h=OR(f,d),m=DR(h,l,u);t.moveShape(p,m)}})}ie(Il,Y),Il.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function DR(e,t,n){var i=la(e,t,n);return Ai(ti(i,e))}function OR(e,t){if(t.length){var n=IR(e,t);return Ll(e,n)}}function LR(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 IR(e,t){var n=t.map(function(r){return{line:r,distance:Dm(e,r)}}),i=oi(n,"distance");return i[0].line}function NR(e,t,n,i){return jm(e,t,n,i).point}function Nl(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),NR(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(Nl,Y),Nl.$inject=["eventBus","modeling"];function qs(e,t,n){var i=Ks(e),r=Um(i,t),o=i[0];return r.length?r[r.length-1]:la(o.original||o,n,t)}function Ys(e,t,n){var i=Ks(e),r=Um(i,t),o=i[i.length-1];return r.length?r[0]:la(o.original||o,n,t)}function Bl(e,t,n){var i=Ks(e),r=Wm(t,n),o=i[0];return la(o.original||o,r,t)}function $l(e,t,n){var i=Ks(e),r=Wm(t,n),o=i[i.length-1];return la(o.original||o,r,t)}function Wm(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Ks(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Um(e,t){var n=rn(e,$R);return Oe(n,function(i){return BR(i,t)})}function BR(e,t){return Zt(t,e,1)==="intersect"}function $R(e){return e.original||e}function jl(e,t){Y.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(jR(i,r)){var o=FR(i);o.incoming.forEach(function(a){var s=Ys(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=qs(a,r,i);t.reconnectStart(a,r,s)})}},!0)}jl.$inject=["eventBus","modeling"],ie(jl,Y);function jR(e,t){return v(e,"bpmn:Participant")&&Be(e)&&v(t,"bpmn:Participant")&&!Be(t)}function FR(e){var t=Ko([e]),n=[],i=[];return t.forEach(function(r){r!==e&&(r.incoming.forEach(function(o){v(o,"bpmn:MessageFlow")&&n.push(o)}),r.outgoing.forEach(function(o){v(o,"bpmn:MessageFlow")&&i.push(o)}))},[]),{incoming:n,outgoing:i}}const HR=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function qm(e){const t=K(e);if(!v(t,"bpmn:BoundaryEvent")&&!(v(t,"bpmn:StartEvent")&&cn(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:HR.some(i=>v(n[0],i))}function Ym(e){return v(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Fl(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(!qm(r))return;const a=Ym(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})})}Fl.$inject=["injector","modeling"],ie(Fl,Y);function Hl(e,t){Y.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=Ve(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}ie(Hl,Y),Hl.$inject=["eventBus","modeling"];function zl(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=zR(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}ie(zl,Y),zl.$inject=["eventBus","bpmnRules","modeling"];function mo(e){return e.original||e}function zR(e,t){var n=Dl(mo(e[e.length-2]),mo(e[e.length-1]),mo(t[1]),mo(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[mo(e[0]),mo(t[t.length-1])]}function Vl(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)}Vl.$inject=["eventBus","modeling"],ie(Vl,Y);function Gl(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=at(p.outgoing,Jr({id:p.businessObject.default.id})),d&&t.updateProperties(d,{conditionExpression:void 0})),l.conditionExpression&&f.sourceRef.default===f&&t.updateProperties(p.source,{default:void 0})})}ie(Gl,Y),Gl.$inject=["eventBus","modeling","bpmnRules","injector"];function Xs(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=xn(u,function(p,f){var d=t.canReplace([f],f.host||f.parent||c);return d?p.concat(d.replacements):p},[]);l.length&&this._replaceElements(u,l)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,u=s.newHost,l=[];M(s.closure.topLevel,function(f){cn(f)?l=l.concat(f.children):l=l.concat(f)}),l.length===1&&u&&(c=u);var p=t.canReplace(l,c);p&&this._replaceElements(l,p.replacements,u)},this),this.postExecute(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,u=s.newShape,l=c.attachers,p;l&&l.length&&(p=t.canReplace(l,u),this._replaceElements(l,p.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,u=s.newShape;r.unclaimId(c.businessObject.id,c.businessObject),r.updateProperties(u,{id:c.id})})}ie(Xs,Y),Xs.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)},Xs.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var VR=1500,GR={width:140,height:120},Wl={width:300,height:60},Ul={width:60,height:300},Zs={width:300,height:150},Qs={width:150,height:300},Km={width:140,height:120},Xm={width:100,height:40};function Zm(e){e.on("resize.start",VR,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=KR(i,r,o)),v(i,"bpmn:SubProcess")&&Be(i)&&(n.minDimensions=Km),v(i,"bpmn:TextAnnotation")&&(n.minDimensions=Xm)})}Zm.$inject=["eventBus"];var or=Math.abs,WR=Math.min,UR=Math.max;function Qm(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function go(e,t,n){return Qm(e,t,n,WR)}function yo(e,t,n){return Qm(e,t,n,UR)}var qR={top:20,left:50,right:20,bottom:20},YR={top:50,left:20,right:20,bottom:20};function KR(e,t,n){var i=Vn(e),r=!0,o=!0,a=zs(i,[i]),s=me(e),c={},u={},l=Gt(e),p=l?Wl:Ul;/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=me(h);l?(m.top<s.top-10&&(r=!1),m.bottom>s.bottom+10&&(o=!1)):(m.left<s.left-10&&(r=!1),m.right>s.right+10&&(o=!1)),/n/.test(t)&&(n&&or(s.top-m.bottom)<10&&yo(c,"top",m.top+p.height),or(s.top-m.top)<5&&go(u,"top",m.bottom-p.height)),/e/.test(t)&&(n&&or(s.right-m.left)<10&&go(c,"right",m.right-p.width),or(s.right-m.right)<5&&yo(u,"right",m.left+p.width)),/s/.test(t)&&(n&&or(s.bottom-m.top)<10&&go(c,"bottom",m.bottom-p.height),or(s.bottom-m.bottom)<5&&yo(u,"bottom",m.top+p.height)),/w/.test(t)&&(n&&or(s.left-m.right)<10&&yo(c,"left",m.left+p.width),or(s.left-m.left)<5&&go(u,"left",m.right-p.width))});var f=i.children.filter(function(h){return!h.hidden&&!h.waypoints&&(v(h,"bpmn:FlowElement")||v(h,"bpmn:Artifact"))}),d=l?qR:YR;return f.forEach(function(h){var m=me(h);/n/.test(t)&&(!l||r)&&go(u,"top",m.top-d.top),/e/.test(t)&&(l||o)&&yo(u,"right",m.right+d.right),/s/.test(t)&&(!l||o)&&yo(u,"bottom",m.bottom+d.bottom),/w/.test(t)&&(l||r)&&go(u,"left",m.left-d.left)}),{min:u,max:c}}function Jm(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function vo(e){return e.originalEvent||e.srcEvent}function ql(e){Jm(e),Jm(vo(e))}function Nr(e){return e.pointers&&e.pointers.length&&(e=e.pointers[0]),e.touches&&e.touches.length&&(e=e.touches[0]),e?{x:e.clientX,y:e.clientY}:null}function eg(){return/mac/i.test(navigator.platform)}function tg(e,t){return(vo(e)||e).button===t}function ar(e){return tg(e,0)}function XR(e){return tg(e,1)}function pa(e){var t=vo(e)||e;return ar(e)?eg()?t.metaKey:t.ctrlKey:!1}function Js(e){var t=vo(e)||e;return ar(e)&&t.shiftKey}var ng=1001;function ig(e,t){e.on("resize.start",ng+500,function(n){var i=n.context,r=i.shape;(v(r,"bpmn:Lane")||v(r,"bpmn:Participant"))&&(i.balanced=!pa(n))}),e.on("resize.end",ng,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=Dh(a),t.resizeLane(r,a,i.balanced)),!1})}ig.$inject=["eventBus","modeling"];var ZR=500;function Yl(e,t,n,i,r){n.invoke(Y,this);function o(l){return De(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!!at(f,Jr({id:l.id}))}function s(l){if(v(l,"bpmn:ErrorEventDefinition"))return"errorRef";if(v(l,"bpmn:EscalationEventDefinition"))return"escalationRef";if(v(l,"bpmn:MessageEventDefinition"))return"messageRef";if(v(l,"bpmn:SignalEventDefinition"))return"signalRef"}function c(l){if(De(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.get("messageRef");var p=l.get("eventDefinitions"),f=p[0];return f.get(s(f))}function u(l,p){if(De(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.set("messageRef",p);var f=l.get("eventDefinitions"),d=f[0];return d.set(s(d),p)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var p=l.shape||l.element;if(o(p)){var f=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");_t(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",ZR,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)})}Yl.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],ie(Yl,Y);function QR(e,t){return ge(t)||(t=[t]),zi(t,function(n){return co(e,n)})}var rg=Math.max;function og(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]=eC(a,i,r)),v(a,"bpmn:Lane")&&(o[s]=Gt(a)?Wl:Ul),v(a,"bpmn:SubProcess")&&Be(a)&&(o[s]=Km),v(a,"bpmn:TextAnnotation")&&(o[s]=Xm),v(a,"bpmn:Group")&&(o[s]=GR)}),o})}og.$inject=["eventBus"];function JR(e){return e==="x"}function eC(e,t,n){var i=Gt(e);if(!iC(e))return i?Zs:Qs;var r=JR(t),o={};return r?i?o=Zs:o={width:nC(e,n,r),height:Qs.height}:i?o={width:Zs.width,height:tC(e,n,r)}:o=Qs,o}function tC(e,t,n){var i;return i=rC(e,t,n),rg(Zs.height,i)}function nC(e,t,n){var i;return i=oC(e,t,n),rg(Qs.width,i)}function iC(e){return!!rr(e).length}function rC(e,t,n){var i=rr(e),r;return r=Kl(i,t,n),e.height-r.height+Wl.height}function oC(e,t,n){var i=rr(e),r;return r=Kl(i,t,n),e.width-r.width+Ul.width}function Kl(e,t,n){var i,r,o;for(i=0;i<e.length;i++)if(r=e[i],!n&&t>=r.y&&t<=r.y+r.height||n&&t>=r.x&&t<=r.x+r.width)return o=rr(r),o.length?Kl(o,t,n):r}var ag="_plane";function sg(e){var t=e.id;return aC(t)}function gi(e){var t=e.id;return v(e,"bpmn:SubProcess")?cg(t):t}function Br(e){return cg(e)}function ec(e){var t=Ve(e);return v(t,"bpmndi:BPMNPlane")}function cg(e){return e+ag}function aC(e){return e.replace(new RegExp(ag+"$"),"")}var ug=400,sC=600,lg={x:180,y:160};function Di(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")&&!Be(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(gi(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(gi(d));if(!(!h||!d.children||!d.children.length)){var m=pg(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")||!Be(f)||M(ta([f]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(p){var f=p.shape;if(c(f)){var d=a.get(gi(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(gi(f)))},!0),this.postExecuted("shape.replace",function(p){var f=p.newShape,d=p.oldRoot,h=e.findRoot(gi(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(ec(f)){a.updateId(f,Br(g)),a.updateId(m,g);return}var S=a.get(Br(m));S&&a.updateId(Br(m),Br(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(ec(f)){a.updateId(f,Br(m)),a.updateId(g,m);return}var S=a.get(Br(g));S&&a.updateId(S,Br(m))}}},!0),t.on("element.changed",function(p){var f=p.element;if(ec(f)){var d=f,h=a.get(sg(d));!h||h===d||t.fire("element.changed",{element:h})}}),this.executed("shape.toggleCollapse",ug,function(p){var f=p.shape;v(f,"bpmn:SubProcess")&&(Be(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",ug,function(p){var f=p.shape;v(f,"bpmn:SubProcess")&&(Be(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",sC,function(p){var f=p.shape;if(v(f,"bpmn:SubProcess")){var d=p.newRootElement;if(d)if(Be(f))s._moveChildrenToShape(d.children.slice(),f),M(ta(f.children),m=>{n.moveShape(m.annotation,{x:0,y:0},f.parent),M(m.associations,g=>{n.moveConnection(g,{x:0,y:0},f.parent)})});else{s._disconnectSharedAnnotations(f);var h=pg(f);s._moveChildrenToShape(h,d)}}},!0),t.on("copyPaste.createTree",function(p){var f=p.element,d=p.children;if(c(f)){var h=gi(f),m=a.get(h);m&&d.push.apply(d,m.children)}}),t.on("copyPaste.copyElement",function(p){var f=p.descriptor,d=p.element,h=p.elements,m=d.parent,g=v(Ve(m),"bpmndi:BPMNPlane");if(g){var S=sg(m),E=at(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(Di,Y),Di.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=Ct(i),o;if(!t.x)o={x:lg.x-r.x,y:lg.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})}},Di.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(tm(e).map(i=>i.annotation));n.size&&M(ta(e.children),i=>{n.has(i.annotation)&&M(i.associations,r=>{t.removeConnection(r)})})},Di.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},Di.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},Di.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:gi(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},Di.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=at(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},Di.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function cC(e){var t=[];return M(ta(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function pg(e){return e.children.slice().concat(cC(e.children)).concat(uC(e))}function uC(e){return el(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function Xl(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"))||!Be(r))){var o=lC(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}Xl.$inject=["injector","modeling"],ie(Xl,Y);function lC(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function Zl(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,Nn(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(Zl,Y),Zl.$inject=["eventBus","textRenderer"];function Ql(e,t){Y.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(Be(i))return;var r=Ko(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(Ql,Y),Ql.$inject=["eventBus","modeling"];var Jl=500;function ep(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=pC(c).concat([a]),p=_m(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"],Jl,function(a){var s=a.context,c=s.shape;v(c,"bpmn:SubProcess")&&(c.collapsed?Ve(c).isExpanded=!1:(i(c.children),Ve(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],Jl,function(a){var s=a.context,c=s.shape;c.collapsed?Ve(c).isExpanded=!1:Ve(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],Jl,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(ep,Y),ep.$inject=["eventBus","elementFactory","modeling"];function pC(e){return e.filter(function(t){return!t.hidden})}function tp(e,t,n,i){t.invoke(Y,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;ke(a)||(v(a,"bpmn:Participant")&&Be(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(tp,Y),tp.$inject=["canvas","injector","moddle","modeling"];function np(e,t){Y.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;fC(r,o)&&t.updateProperties(o,{default:null})})}ie(np,Y),np.$inject=["eventBus","modeling"];function fC(e,t){if(!v(e,"bpmn:SequenceFlow"))return!1;var n=K(t),i=K(e);return n.get("default")===i}var dC=500,hC=5e3,fg=["shape.create","shape.delete","shape.move","shape.resize"],dg=[...fg,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function ip(e,t){Y.call(this,e);var n;function i(){return n=n||new mC,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(dg,hC,function(){i()}),this.postExecuted(dg,dC,function(){o()}),this.preExecute(fg,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))})}ip.$inject=["eventBus","modeling"],ie(ip,Y);function mC(){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 gC=500,yC=5e3,hg=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],mg=[...hg,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function rp(e,t){Y.call(this,e);var n;function i(){return n=n||new vC,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(mg,yC,function(){i()}),this.postExecuted(mg,gC,function(){o()}),this.preExecute(hg,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)})}rp.$inject=["eventBus","modeling"],ie(rp,Y);function vC(){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 op(e,t){Y.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)_C(o)&&!xC(o)&&t.updateProperties(o,{isForCompensation:void 0})})}ie(op,Y),op.$inject=["eventBus","modeling"];function _C(e){const t=K(e);return t&&t.isForCompensation}function bC(e){return e&&v(e,"bpmn:BoundaryEvent")&&co(e,"bpmn:CompensateEventDefinition")}function xC(e){return e.incoming.filter(n=>bC(n.source)).length>0}const EC={__init__:["adaptiveLabelPositioningBehavior","appendBehavior","artifactBehavior","associationBehavior","attachEventBehavior","boundaryEventBehavior","categoryRootElementReferenceBehavior","compensateBoundaryEventBehaviour","createBehavior","createDataObjectBehavior","createParticipantBehavior","dataInputAssociationBehavior","dataStoreBehavior","deleteLaneBehavior","detachEventBehavior","dropOnFlowBehavior","eventBasedGatewayBehavior","fixHoverBehavior","groupBehavior","importDockingFix","isHorizontalFix","labelBehavior","layoutConnectionBehavior","messageFlowBehavior","nonInterruptingBehavior","removeElementBehavior","removeEmbeddedLabelBoundsBehavior","removeParticipantBehavior","replaceConnectionBehavior","replaceElementBehaviour","resizeBehavior","resizeLaneBehavior","rootElementReferenceBehavior","spaceToolBehavior","subProcessPlaneBehavior","subProcessStartEventBehavior","textAnnotationBehavior","toggleCollapseConnectionBehaviour","toggleElementCollapseBehaviour","unclaimIdBehavior","updateFlowNodeRefsBehavior","updateCategoryValueRefsBehavior","unsetDefaultFlowBehavior","setCompensationActivityAfterPasteBehavior"],adaptiveLabelPositioningBehavior:["type",dl],appendBehavior:["type",hl],associationBehavior:["type",gl],attachEventBehavior:["type",Is],artifactBehavior:["type",ml],boundaryEventBehavior:["type",yl],categoryRootElementReferenceBehavior:["type",vl],compensateBoundaryEventBehaviour:["type",_l],createBehavior:["type",bl],createDataObjectBehavior:["type",xl],createParticipantBehavior:["type",Sl],dataInputAssociationBehavior:["type",Rl],dataStoreBehavior:["type",Cl],deleteLaneBehavior:["type",Pl],detachEventBehavior:["type",Vs],dropOnFlowBehavior:["type",Tl],eventBasedGatewayBehavior:["type",Ml],fixHoverBehavior:["type",Cm],groupBehavior:["type",kl],importDockingFix:["type",Am],isHorizontalFix:["type",Ol],labelBehavior:["type",Il],layoutConnectionBehavior:["type",Nl],messageFlowBehavior:["type",jl],nonInterruptingBehavior:["type",Fl],removeElementBehavior:["type",zl],removeEmbeddedLabelBoundsBehavior:["type",Hl],removeParticipantBehavior:["type",Vl],replaceConnectionBehavior:["type",Gl],replaceElementBehaviour:["type",Xs],resizeBehavior:["type",Zm],resizeLaneBehavior:["type",ig],rootElementReferenceBehavior:["type",Yl],spaceToolBehavior:["type",og],subProcessPlaneBehavior:["type",Di],subProcessStartEventBehavior:["type",Xl],textAnnotationBehavior:["type",Zl],toggleCollapseConnectionBehaviour:["type",Ql],toggleElementCollapseBehaviour:["type",ep],unclaimIdBehavior:["type",tp],unsetDefaultFlowBehavior:["type",np],updateFlowNodeRefsBehavior:["type",ip],updateCategoryValueRefsBehavior:["type",rp],setCompensationActivityAfterPasteBehavior:["type",op]};function ap(e){this._commandStack=e.get("commandStack",!1)}ap.$inject=["injector"],ap.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const yi={__init__:["rules"],rules:["type",ap]};function Gn(e){Y.call(this,e),this.init()}Gn.$inject=["eventBus"],ie(Gn,Y),Gn.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)})},Gn.prototype.init=function(){};function gg(e,t){var n=Zt(e,t,-15);return n!=="intersect"?n:null}function Jt(e){Gn.call(this,e)}ie(Jt,Gn),Jt.$inject=["eventBus"],Jt.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return wC(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 nc(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return nc(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 Tg(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return it(i)&&!ic(t,i)?!1:Sr(t,function(r){return it(r)?nc(r.source,r.target,r):r.host?fa(r,r.host,null,n):lp(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 wg(a)&&!n.includes(a.host)})?!1:fa(n,t,null,i)||Pg(n,t,i)||Ag(n,t)||ic(n,t)}),this.addRule("shape.create",function(e){return lp(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return fa(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return Lg(n,t)})},Jt.prototype.canConnectMessageFlow=Dg,Jt.prototype.canConnectSequenceFlow=Og,Jt.prototype.canConnectDataAssociation=pp,Jt.prototype.canConnectAssociation=Mg,Jt.prototype.canConnectCompensationAssociation=kg,Jt.prototype.canMove=Ag,Jt.prototype.canAttach=fa,Jt.prototype.canReplace=Pg,Jt.prototype.canDrop=_o,Jt.prototype.canInsert=ic,Jt.prototype.canCreate=lp,Jt.prototype.canConnect=nc,Jt.prototype.canResize=Tg,Jt.prototype.canCopy=Lg;function wC(e){return sp(e)?null:De(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function sp(e){return!e||ke(e)}function yg(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 cp(e){return v(e,"bpmn:TextAnnotation")}function up(e){return v(e,"bpmn:Group")&&!e.labelTarget}function vg(e){return v(e,"bpmn:BoundaryEvent")&&vi(e,"bpmn:CompensateEventDefinition")}function tc(e){return K(e).isForCompensation}function SC(e,t){var n=yg(e),i=yg(t);return n===i}function RC(e){return v(e,"bpmn:InteractionNode")&&!v(e,"bpmn:BoundaryEvent")&&(!v(e,"bpmn:Event")||v(e,"bpmn:ThrowEvent")&&xg(e,"bpmn:MessageEventDefinition"))}function CC(e){return v(e,"bpmn:InteractionNode")&&!tc(e)&&(!v(e,"bpmn:Event")||v(e,"bpmn:CatchEvent")&&xg(e,"bpmn:MessageEventDefinition"))&&!(v(e,"bpmn:BoundaryEvent")&&!vi(e,"bpmn:MessageEventDefinition"))}function _g(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 bg(e,t){var n=_g(e),i=_g(t);return n===i}function vi(e,t){var n=K(e);return!!at(n.eventDefinitions||[],function(i){return v(i,t)})}function xg(e,t){var n=K(e);return(n.eventDefinitions||[]).every(function(i){return v(i,t)})}function PC(e){return v(e,"bpmn:FlowNode")&&!v(e,"bpmn:EndEvent")&&!cn(e)&&!(v(e,"bpmn:IntermediateThrowEvent")&&vi(e,"bpmn:LinkEventDefinition"))&&!vg(e)&&!tc(e)}function AC(e){return v(e,"bpmn:FlowNode")&&!v(e,"bpmn:StartEvent")&&!v(e,"bpmn:BoundaryEvent")&&!cn(e)&&!(v(e,"bpmn:IntermediateCatchEvent")&&vi(e,"bpmn:LinkEventDefinition"))&&!tc(e)}function TC(e){return v(e,"bpmn:ReceiveTask")||v(e,"bpmn:IntermediateCatchEvent")&&(vi(e,"bpmn:MessageEventDefinition")||vi(e,"bpmn:TimerEventDefinition")||vi(e,"bpmn:ConditionalEventDefinition")||vi(e,"bpmn:SignalEventDefinition"))}function MC(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function Eg(e,t){var n=MC(t);return n.indexOf(e)!==-1}function nc(e,t,n){if(sp(e)||sp(t))return null;if(!v(n,"bpmn:DataAssociation")){if(Dg(e,t))return{type:"bpmn:MessageFlow"};if(Og(e,t))return{type:"bpmn:SequenceFlow"}}var i=pp(e,t);return i||(kg(e,t)?{type:"bpmn:Association",associationDirection:"One"}:Mg(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function _o(e,t){return ke(e)||up(e)?!0:v(t,"bpmn:Participant")&&!Be(t)?!1:v(e,"bpmn:Participant")?v(t,"bpmn:Process")||v(t,"bpmn:Collaboration"):De(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:v(e,"bpmn:Lane")?v(t,"bpmn:Participant")||v(t,"bpmn:Lane"):v(e,"bpmn:BoundaryEvent")&&!kC(e)?!1:v(e,"bpmn:FlowElement")&&!v(e,"bpmn:DataStoreReference")?v(t,"bpmn:FlowElementsContainer")?Be(t):De(t,["bpmn:Participant","bpmn:Lane"]):v(e,"bpmn:DataStoreReference")&&v(t,"bpmn:Collaboration")?zi(K(t).get("participants"),function(n){return!!n.get("processRef")}):De(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?De(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):v(e,"bpmn:MessageFlow")?v(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function kC(e){return K(e).cancelActivity&&(Sg(e)||Rg(e))}function wg(e){return!ke(e)&&v(e,"bpmn:BoundaryEvent")}function DC(e){return v(e,"bpmn:Lane")}function OC(e){return wg(e)||v(e,"bpmn:IntermediateThrowEvent")&&Sg(e)?!0:v(e,"bpmn:IntermediateCatchEvent")&&Rg(e)}function Sg(e){var t=K(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Rg(e){return Cg(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Cg(e,t){return t.some(function(n){return vi(e,n)})}function LC(e){return v(e,"bpmn:ReceiveTask")&&at(e.incoming,function(t){return v(t.source,"bpmn:EventBasedGateway")})}function fa(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return ke(r)||!OC(r)||cn(t)||!v(t,"bpmn:Activity")||tc(t)||i&&!gg(i,t)||LC(t)?!1:"attach"}function Pg(e,t,n){if(!t)return!1;var i={replacements:[]};return M(e,function(r){cn(t)||v(r,"bpmn:StartEvent")&&r.type!=="label"&&_o(r,t)&&(V1(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(G1(r)||W1(r)||U1(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),Cg(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")||vi(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(v(r,"bpmn:EndEvent")&&_o(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),v(r,"bpmn:BoundaryEvent")&&fa(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function Ag(e,t){return zi(e,DC)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return _o(n,t)})}function lp(e,t,n,i){return t?ke(e)||up(e)?!0:_o(e,t)||ic(e,t):!1}function Tg(e,t,n){return v(e,"bpmn:SubProcess")?Be(e)&&(!t||t.width>=100&&t.height>=80):v(e,"bpmn:Lane")||v(e,"bpmn:Participant")?!0:cp(e)?n?n==="e"||n==="w":!0:up(e)?!0:ke(e)?n?n==="e"||n==="w":!0:!1}function IC(e,t){var n=cp(e),i=cp(t);return(n||i)&&n!==i}function Mg(e,t){return Eg(t,e)||Eg(e,t)?!1:IC(e,t)?!0:!!pp(e,t)}function kg(e,t){return bg(e,t)&&vg(e)&&v(t,"bpmn:Activity")&&!BC(t,e)&&!cn(t)}function Dg(e,t){return Ng(e)&&!Ng(t)?!1:RC(e)&&CC(t)&&!SC(e,t)}function Og(e,t){return PC(e)&&AC(t)&&bg(e,t)&&!(v(e,"bpmn:EventBasedGateway")&&!TC(t))}function pp(e,t){return De(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&De(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:De(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&De(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function ic(e,t,n){if(!t)return!1;if(Array.isArray(e)){if(e.length!==1)return!1;e=e[0]}return t.source===e||t.target===e?!1:De(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!ke(t)&&v(e,"bpmn:FlowNode")&&!v(e,"bpmn:BoundaryEvent")&&_o(e,t.parent)}function fp(e,t){return e&&t&&e.indexOf(t)!==-1}function Lg(e,t){return ke(t)?!0:!(v(t,"bpmn:Lane")&&!fp(e,t.parent)||v(t,"bpmn:MessageFlow")&&!NC(e,t))}function NC(e,t){var n=Ig(t.source),i=Ig(t.target);return fp(e,n)&&fp(e,i)}function Ig(e){for(;e;e=e.parent)if(v(e,"bpmn:Participant"))return e;return null}function Ng(e){return po(e,"bpmn:Process")||po(e,"bpmn:Collaboration")}function BC(e,t){return e.attachers.includes(t)}const $C={__depends__:[yi],__init__:["bpmnRules"],bpmnRules:["type",Jt]};var jC=2e3;function Bg(e,t){e.on("saveXML.start",jC,n);function n(){var i=t.getRootElements();M(i,function(r){var o=Ve(r),a,s;a=Ko([r]),a=Oe(a,function(c){return c!==r&&!c.labelTarget}),s=rn(a,Ve),o.set("planeElement",s)})}}Bg.$inject=["eventBus","canvas"];const FC={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Bg]};function rc(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)})}rc.prototype.getOrdering=function(e,t){return null},ie(rc,Y);function dp(e,t){rc.call(this,e);var n=[{type:"bpmn:SubProcess",order:{level:6}},{type:"bpmn:SequenceFlow",order:{level:9,containers:["bpmn:Participant","bpmn:FlowElementsContainer"]}},{type:"bpmn:DataAssociation",order:{level:9,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:TextAnnotation",order:{level:9}},{type:"bpmn:MessageFlow",order:{level:9,containers:["bpmn:Collaboration"]}},{type:"bpmn:Association",order:{level:6,containers:["bpmn:Participant","bpmn:FlowElementsContainer","bpmn:Collaboration"]}},{type:"bpmn:BoundaryEvent",order:{level:8}},{type:"bpmn:Group",order:{level:10,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:FlowElement",order:{level:5}},{type:"bpmn:Participant",order:{level:-2}},{type:"bpmn:Lane",order:{level:-1}}];function i(a){if(a.labelTarget)return{level:10};var s=at(n,function(c){return De(a,[c.type])});return s&&s.order||{level:1}}function r(a){var s=a.order;if(s||(a.order=s=i(a)),!s)throw new Error(`no order for <${a.id}>`);return s}function o(a,s,c){for(var u=s;u&&!De(u,c);)u=u.parent;if(!u)throw new Error(`no parent for <${a.id}> in <${s&&s.id}>`);return u}this.getOrdering=function(a,s){if(a.labelTarget||v(a,"bpmn:TextAnnotation"))return{parent:t.findRoot(s)||t.getRootElement(),index:-1};var c=r(a);c.containers&&(s=o(a,s,c.containers));var u=s.children.indexOf(a),l=Hf(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}}}dp.$inject=["eventBus","canvas"],ie(dp,rc);const HC={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",dp]};function da(){}da.prototype.get=function(){return this._data},da.prototype.set=function(e){this._data=e},da.prototype.clear=function(){var e=this._data;return delete this._data,e},da.prototype.isEmpty=function(){return!this._data};const zC={clipboard:["type",da]};var $g=1500;function jg(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",$g,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",$g,function(c){s&&t.fire("element.out",{element:s,gfx:a})}),t.on("element.out",function(){a=null,s=null})})(),this._findTargetGfx=function(a){var s,c;if(a instanceof MouseEvent)return s=Nr(a),c=document.elementFromPoint(s.x,s.y),VC(c)}}jg.$inject=["elementRegistry","eventBus","injector"];function VC(e){return Mr(e,"svg, .djs-element",!0)}const GC={__init__:["hoverFix"],hoverFix:["type",jg]};function WC(e){return!0}function oc(e){return ar(e)||XR(e)}var Fg=500;function Hg(e,t,n){var i=this;function r(A,F,H){if(!s(A,F)){var N,z,ue;H?z=t.getGraphics(H):(N=F.delegateTarget||F.target,N&&(z=N,H=t.get(z))),!(!z||!H)&&(ue=e.fire(A,{element:H,gfx:z,originalEvent:F}),ue===!1&&(F.stopPropagation(),F.preventDefault()))}}var o={};function a(A){return o[A]}function s(A,F){var H=u[A]||ar;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":WC,"element.mousedown":oc,"element.mouseup":oc,"element.click":oc,"element.dblclick":oc};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(ue){r(H,ue)};N&&(u[H]=N),z.$delegate=wn.bind(A,p,F,z)}function d(A,F,H){var N=a(H);N&&wn.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"],Fg,function(A){var F=A.element,H=A.gfx;e.fire("interactionEvents.updateHit",{element:F,gfx:H})}),e.on("interactionEvents.createHit",Fg,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"),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(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){Se(A,F)}this.removeHits=function(A){var F=gs(".djs-hit",A);M(F,Nt)},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=Yo(F);return T(H,"stroke"),L(A,H),H},this.createBoxHit=function(A,F,H){H=D({x:0,y:0},H);var N=pe("rect");return T(N,F),re(N,H),L(A,N),N},this.updateDefaultHit=function(A,F){var H=et(".djs-hit",F);if(H)return A.waypoints?Ju(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}Hg.$inject=["eventBus","elementRegistry","styles"];const ac={__init__:["interactionEvents"],interactionEvents:["type",Hg]};function bo(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=new Set;var n=this;e.on(["shape.remove","connection.remove"],function(i){var r=i.element;n.deselect(r)}),e.on(["diagram.clear","root.set"],function(i){n.select(null)})}bo.$inject=["eventBus","canvas"],bo.prototype.deselect=function(e){if(this._selectedElements.has(e)){var t=this.get();this._selectedElements.delete(e),this._eventBus.fire("selection.changed",{oldSelection:t,newSelection:this.get()})}},bo.prototype.get=function(){return Array.from(this._selectedElements)},bo.prototype.isSelected=function(e){return this._selectedElements.has(e)},bo.prototype.select=function(e,t){var n=this.get();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 zg="hover",Vg="selected";function Gg(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,zg)}),t.on("element.out",function(r){i(r.element,zg)}),t.on("selection.changed",function(r){function o(u){i(u,Vg)}function a(u){n(u,Vg)}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)})}Gg.$inject=["canvas","eventBus"];function Wg(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(UC))}}),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=at(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(ar(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=Js(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}Wg.$inject=["eventBus","selection","canvas","elementRegistry"];function UC(e){return!e.hidden}const Wn={__init__:["selectionVisuals","selectionBehavior"],__depends__:[ac],selection:["type",bo],selectionVisuals:["type",Gg],selectionBehavior:["type",Wg]};var qC=/^djs-cursor-.*$/;function sc(e){var t=ft(document.body);t.removeMatching(qC),e&&t.add("djs-cursor-"+e)}function Ug(){sc(null)}var YC=5e3;function qg(e,t){t=t||"element.click";function n(){return!1}return e.once(t,YC,n),function(){e.off(t,n)}}var KC=["c","C"],XC=["v","V"],ZC=["d","D"],QC=["x","X"],JC=["y","Y"],Yg=["z","Z"];function eP(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Cn(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function Bt(e,t){return e=ge(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function hp(e){return e.shiftKey}function tP(e){return Cn(e)&&Bt(KC,e)}function nP(e){return Cn(e)&&Bt(XC,e)}function iP(e){return Cn(e)&&Bt(ZC,e)}function rP(e){return Cn(e)&&Bt(QC,e)}function oP(e){return Cn(e)&&!hp(e)&&Bt(Yg,e)}function aP(e){return Cn(e)&&(Bt(JC,e)||Bt(Yg,e)&&hp(e))}var xo=Math.round,Kg="djs-drag-active";function $r(e){e.preventDefault()}function sP(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function cP(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Xg(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=Nr(x),F=ti(A,L),H=o.localStart,N=a(A),z=ti(N,H);if(!o.active&&(b||cP(F)>o.threshold)){if(D(w,{x:xo(H.x+T.x),y:xo(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&&sc(o.cursor),t.addMarker(t.getRootElement(),Kg)}ql(x),o.active&&(D(w,{x:xo(N.x+T.x),y:xo(N.y+T.y),dx:xo(z.x),dy:xo(z.y)},{originalEvent:x}),s("move"))}function l(x){var b,w=!0;o.active&&(x&&(o.payload.originalEvent=x,ql(x)),w=s("end")),w===!1&&s("rejected"),b=S(w!==!0),s("ended",b)}function p(x){Bt("Escape",x)&&($r(x),g())}function f(x){var b;o.active&&(b=qg(e),setTimeout(b,400),$r(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"),Ug(),o.trapClick?w=f:w=l,we.unbind(document,"mousemove",u),we.unbind(document,"dragstart",$r),we.unbind(document,"selectstart",$r),we.unbind(document,"mousedown",w,!0),we.unbind(document,"mouseup",w,!0),we.unbind(document,"keyup",p),we.unbind(document,"touchstart",d,!0),we.unbind(document,"touchcancel",g,!0),we.unbind(document,"touchmove",u,!0),we.unbind(document,"touchend",l,!0),e.off("element.hover",h),e.off("element.out",m),t.removeMarker(t.getRootElement(),Kg);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=vo(x)||x,F=Nr(x),ql(x),A.type==="dragstart"&&$r(A)):(A=null,F={x:0,y:0}),H=a(F),b||(b=H),z=sP(A),o=D({prefix:w,data:L,payload:{},globalStart:F,displacement:ti(b,H),localStart:H,isTouch:z},T),T.manual||(z?(we.bind(document,"touchstart",d,!0),we.bind(document,"touchcancel",g,!0),we.bind(document,"touchmove",u,!0),we.bind(document,"touchend",l,!0)):(we.bind(document,"mousemove",u),we.bind(document,"dragstart",$r),we.bind(document,"selectstart",$r),we.bind(document,"mousedown",N,!0),we.bind(document,"mouseup",N,!0)),we.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)}}Xg.$inject=["eventBus","canvas","selection","elementRegistry"];const Oi={__depends__:[GC,Wn],dragging:["type",Xg]};function Eo(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}Eo.prototype.next=function(){return this._prefix+ ++this._counter};const uP=new Eo("ps");var lP=["marker-start","marker-mid","marker-end"],pP=["circle","ellipse","line","path","polygon","polyline","path","rect"];function sr(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}sr.$inject=["elementRegistry","eventBus","canvas","styles"],sr.prototype.cleanUp=function(){console.warn("PreviewSupport#cleanUp is deprecated and will be removed in future versions. You do not need to manually clean up previews anymore. cf. https://github.com/bpmn-io/diagram-js/pull/906")},sr.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},sr.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=uh(n);return this._cloneMarkers(Or(r),i),re(r,this._styles.cls(i,[])),Se(t,r),re(r,"data-preview-support-element-id",e.id),r},sr.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 Se(t,n),re(n,"data-preview-support-element-id",e.id),n},sr.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),mP(e)&&lP.forEach(function(r){if(re(e,r)){var o=fP(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},sr.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,uP.next()].join("-"),a=et("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||uh(n);s.id=o,$e(s).add(r);var c=et(":scope > defs",e);c||(c=pe("defs"),Se(e,c)),Se(c,s);var u=hP(s.id);re(t,i,u)};function fP(e,t,n){var i=dP(re(e,t));return et("marker#"+i,n||document)}function dP(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function hP(e){return"url(#"+e+")"}function mP(e){return pP.indexOf(e.nodeName)!==-1}const wo={__init__:["previewSupport"],previewSupport:["type",sr]};var gP="drop-ok",Zg="drop-not-ok",Qg="attach-ok",Jg="new-parent",ey="create",yP=2e3;function ty(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&&!(ke(E)&&c.indexOf(x)!==-1)});var d=at(c,function(E){return!it(E)}),h=!1,m=!1,g=!1;iy(c)&&(h=r.allowed("shape.attach",{position:l,shape:d,target:u})),h||(iy(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){[Qg,gP,Zg,Jg].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}ny(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,Qg):a(p,m?Jg:Zg))}),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;ny(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=at(f,function(x){return!it(x)})),D(u,{elements:f,shape:p}),D(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===ey&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],yP,function(){n.off("elements.changed",s)})}),this.start=function(c,u,l){ge(u)||(u=[u]);var p=at(u,function(h){return!it(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=Ct(f);M(u,function(h){it(h)&&(h.waypoints=rn(h.waypoints,function(m){return{x:m.x-d.x-d.width/2,y:m.y-d.y-d.height/2}})),D(h,{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2})}),t.init(c,ey,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:u,context:l}})}}}ty.$inject=["canvas","dragging","eventBus","modeling","rules"];function ny(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 iy(e){return e&&e.length===1&&!it(e[0])}var vP=750;function ry(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(Or(l),u)):(l=n._createContainer("shape",c),n.drawShape(Or(l),u),Qt(l,u.x,u.y)),i.addDragger(u,s,l))}),s}t.on("create.move",vP,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(),Se(p,l)),Qt(l,a.x,a.y)):Nt(l)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&Nt(c)})}ry.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const cc={__depends__:[Oi,wo,yi,Wn],__init__:["create","createPreview"],create:["type",ty],createPreview:["type",ry]};function mp(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)})}mp.$inject=["eventBus"],mp.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||_P(0,0)};function _P(e,t){var n=document.createEvent("MouseEvent"),i=e,r=t,o=e,a=t;return n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,i,r,o,a,!1,!1,!1,!1,0,null),n}const ha={__init__:["mouse"],mouse:["type",mp]};var oy=2e3;function Pn(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),bP(l)&&(u.priority=2,u.host=l.host.id),it(l)&&(u.priority=3,u.source=l.source.id,u.target=l.target.id,u.waypoints=xP(l)),ke(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",oy,function(c){var u;((u=c.hints)==null?void 0:u.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",oy,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var u=c.hints;D(u,{createElementsBehavior:!1})})}Pn.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],Pn.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},Pn.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})}}},Pn.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},Pn.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},Pn.prototype._getElementIdsFromTree=function(e){var t={};return M(e,function(n){M(n,function(i){i.id&&(t[i.id]=!0)})}),t},Pn.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=Ct(e);return M(e,function(o){it(o)&&(o.waypoints=rn(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),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))},Pn.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return M(e,function(o,a){o=oi(o,"priority"),M(o,function(s){var c=D({},ai(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var u;if(it(c)){c.source=i[s.source],c.target=i[s.target],u=i[s.id]=t.createConnection(c),r.push(u);return}if(ke(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},Pn.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(ai(e,["id"]));return t},Pn.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(ai(e,["id"]));return t},Pn.prototype.createShape=function(e){var t=this._elementFactory.createShape(ai(e,["id"]));return t},Pn.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(it(e)&&(!n.has(e.source)||!n.has(e.target))||ke(e)&&!n.has(e.labelTarget))},Pn.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=bs(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}Dr(a,function(p,f,d){if(ke(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=rn(r,function(p){return p.element});var l=new Set(e);return r=rn(r,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:l}),p}),r=oi(r,function(p){return p.descriptor.priority}),e=rn(r,function(p){return p.element}),M(r,function(p){var f=p.depth;if(!n.hasRelations(p.element,e,l)){sy(p.element,e),l.delete(p.element);return}if(!s(p.element,e)){sy(p.element,e),l.delete(p.element);return}i[f]||(i[f]=[]),i[f].push(p.descriptor)}),i};function bP(e){return!!e.host}function xP(e){return rn(e.waypoints,function(t){return t=ay(t),t.original&&(t.original=ay(t.original)),t})}function ay(e){return D({},e)}function sy(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const EP={__depends__:[zC,cc,ha,yi],__init__:["copyPaste"],copyPaste:["type",Pn]};function gp(e,t,n){ge(n)||(n=[n]),M(n,function(i){wr(e[i])||(t[i]=e[i])})}var yp=750;function cy(e,t,n){function i(c,u){var l=e.create(c.$type);return n.copyElement(c,l,null,u)}t.on("copyPaste.copyElement",yp,function(c){var u=c.descriptor,l=c.element,p=K(l);if(ke(l))return u;var f=u.businessObject=i(p,!0),d=u.di=i(Ve(l),!0);d.bpmnElement=f,gp(f,u,"name"),gp(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])),ai(l,xn(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(ke(l)){l.businessObject=K(u[l.labelTarget]),l.di=Ve(u[l.labelTarget]);return}p=l.businessObject=i(p),f=l.di=i(f),f.bpmnElement=p,gp(l,p,["isExpanded","name"]),l.type=p.$type}),t.on("copyPaste.copyElement",yp,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(ta(l),p=>{l.push(p.annotation)})}),t.on("copyPaste.pasteElement",yp,function(c){var u=c.cache,l=c.descriptor;a(u,s(l,u,o(u)))})}cy.$inject=["bpmnFactory","eventBus","moddleCopy"];const wP=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],SP=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function ma(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",i=>{const{propertyNames:r}=i;if(!(!r||!r.length))return oi(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=zt(r)&&r.$descriptor;if(a&&SP.includes(a))return o;if(a&&wP.includes(a)||a&&s&&!at(s.properties,Jr({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:r}=i;if(v(r,"bpmn:ExtensionElements")&&(!r.values||!r.values.length))return!1})}ma.$inject=["eventBus","bpmnFactory","moddle"],ma.prototype.copyElement=function(e,t,n,i=!1){n&&!ge(n)&&(n=[n]),n=n||vp(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;bn(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!Lt(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},ma.prototype.copyProperty=function(e,t,n,i=!1){let r=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n,clone:i});if(r===!1)return;if(r)return zt(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)?xn(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):zt(e)&&e.$type?this._moddle.getElementDescriptor(e).isGeneric?void 0:(r=this._bpmnFactory.create(e.$type),r.$parent=t,r=this.copyElement(e,r,null,i),r):e},ma.prototype._copyId=function(e,t,n=!1){if(n)return e;if(!this._moddle.ids.assigned(e))return this._moddle.ids.claim(e,t),e};function vp(e,t){return xn(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const uy={__depends__:[EP],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",cy],moddleCopy:["type",ma]};var ly=Math.round;function _p(e,t){this._modeling=e,this._eventBus=t}_p.$inject=["modeling","eventBus"],_p.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=ly(s+o/2),l=ly(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 py(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}py.$inject=["selection","eventBus"];const RP={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",py],replace:["type",_p]};function CP(e,t,n){ge(n)||(n=[n]),M(n,function(i){wr(e[i])||(t[i]=e[i])})}var PP=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function AP(e,t){var n=e&&bn(e,"collapsed")?e.collapsed:!Be(e),i;return t&&(bn(t,"collapsed")||bn(t,"isExpanded"))?i=bn(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function fy(e,t,n,i,r,o){function a(s,c,u){u=u||{};var l=c.type,p=s.businessObject;if(uc(p)&&(l==="bpmn:SubProcess"||l==="bpmn:AdHocSubProcess")&&AP(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),CP(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var h=vp(p.$descriptor),m=vp(f.$descriptor,!0),g=TP(h,m);D(f,ei(c,PP));var S=Oe(g,function(b){return b==="eventDefinitions"?dy(s,c.eventDefinitionType):b==="loopCharacteristics"?!cn(f):bn(f,b)||b==="processRef"&&c.isExpanded===!1||b==="triggeredByEvent"?!1:b==="isForCompensation"?!cn(f):!0});if(f=n.copyElement(p,f,S),c.eventDefinitionType&&(dy(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),v(p,"bpmn:Activity")){if(uc(p))d.isExpanded=Be(s);else if(c&&bn(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}Be(s)&&!v(p,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(uc(p)&&!uc(f)&&(u.moveChildren=!1),v(p,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):u.moveChildren=!1;var x=Gt(s);Ve(s).isHorizontal||(Ve(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,De(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&De(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(f.default=p.default),c.host&&!v(p,"bpmn:BoundaryEvent")&&v(f,"bpmn:BoundaryEvent")&&(d.host=c.host),(d.type==="bpmn:DataStoreReference"||d.type==="bpmn:DataObjectReference")&&(d.x=s.x+(s.width-d.width)/2),r.replaceElement(s,d,{...u,targetElement:c})}this.replaceElement=a}fy.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function uc(e){return v(e,"bpmn:SubProcess")}function dy(e,t){var n=K(e);return t&&n.get("eventDefinitions").some(function(i){return v(i,t)})}function TP(e,t){return e.filter(function(n){return t.includes(n)})}const hy={__depends__:[uy,RP,Wn],bpmnReplace:["type",fy]};var MP=250;function jr(e){this._eventBus=e,this._tools=[],this._active=null}jr.$inject=["eventBus"],jr.prototype.registerTool=function(e,t){var n=this._tools;if(!t)throw new Error(`A tool has to be registered with it's "events"`);n.push(e),this.bindEvents(e,t)},jr.prototype.isActive=function(e){return e&&this._active===e},jr.prototype.length=function(e){return this._tools.length},jr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},jr.prototype.bindEvents=function(e,t){var n=this._eventBus,i=[];n.on(t.tool+".init",function(r){var o=r.context;if(!o.reactivate&&this.isActive(e)){this.setActive(null);return}this.setActive(e)},this),M(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,MP,function(r){this._active&&(kP(r)||this.setActive(null))},this)};function kP(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Mr(t,'.group[data-group="tools"]')}const lc={__depends__:[Oi],__init__:["toolManager"],toolManager:["type",jr]};function DP(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 OP(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 LP(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 bp=Math.abs,IP=Math.round,Li={x:"width",y:"height"},my="crosshair",cr={n:"top",w:"left",s:"bottom",e:"right"},NP=1500,pc={n:"s",w:"e",s:"n",e:"w"},fc=20;function Un(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",NP,function(c){var u=c.context,l=u.initialized;l||(l=u.initialized=s.init(c,u)),l&&yy(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){yy(c);var m={x:0,y:0};m[l]=IP(c["d"+l]),s.makeSpace(f,d,m,p,h),n.once("spaceTool.ended",function(g){s.activateSelection(g.originalEvent,!0,!0)})}})}Un.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Un.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:my,data:{context:{reactivate:n}},trapClick:!1})},Un.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:my,data:{context:{}}})},Un.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},Un.prototype.init=function(e,t){var n=bp(e.dx)>bp(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(bp(i)<5)return!1;i<0&&(i*=-1),pa(e)&&(i*=-1);var o=DP(n,i),a=this._canvas.getRootElement();!Js(e)&&e.hover&&(a=e.hover);var s=[...Ko(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=BP(c,n,o,r,u);return D(t,c,{axis:n,direction:o,spaceToolConstraints:l,start:r}),sc("resize-"+(n==="x"?"ew":"ns")),!0},Un.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||ke(d))){if(it(d)){l.push(d);return}var h=d[t],m=h+d[Li[t]];if($P(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}},Un.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Un.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function gy(e){return{top:e.top-fc,right:e.right+fc,bottom:e.bottom+fc,left:e.left-fc}}function yy(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 BP(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=me(f),g=Oe(h,function(z){return!it(z)&&!ke(z)&&!l.has(z)&&!p.has(z)}),S=Oe(h,function(z){return!it(z)&&!ke(z)&&l.has(z)}),E,x,b,w=[],T=[],L,A,F,H;g.length&&(x=gy(me(Ct(g))),E=i-m[cr[n]]+x[cr[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)),S.length&&(b=gy(me(Ct(S))),E=i-b[cr[pc[n]]]+m[cr[pc[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=me(Ct(w.map(ye))),A=m[cr[pc[n]]]-(L[cr[pc[n]]]-i)),T.length&&(F=me(Ct(T.map(ye))),H=F[cr[n]]-(m[cr[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[Li[t]]-N[Li[t]],s.bottom=u=xe(u)?Math.min(u,E):E):n==="w"?(E=i+f[Li[t]]-N[Li[t]],s.right=u=xe(u)?Math.min(u,E):E):n==="s"?(E=i-f[Li[t]]+N[Li[t]],s.top=c=xe(c)?Math.max(c,E):E):n==="e"&&(E=i-f[Li[t]]+N[Li[t]],s.left=c=xe(c)?Math.max(c,E):E))}),s}}function $P(e){return!!e.host}var xp="djs-dragging",vy="djs-resizing",jP=250,dc=Math.max;function _y(e,t,n,i,r){function o(a,s){M(a,function(c){r.addDragger(c,s),n.addMarker(c,xp)})}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"])),Se(s,l);var p=pe("path");re(p,"d",u.x),$e(p).add("djs-crosshair"),Se(l,p);var f=pe("path");re(f,"d",u.y),$e(f).add("djs-crosshair"),Se(l,f),c.crosshairGroup=l}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;Qt(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&Nt(c)}),e.on("spaceTool.move",jP,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"),$e(c).add("djs-crosshair"),Se(f,c),s.line=c;var d=pe("g");re(d,i.cls("djs-drag-group",["no-events"])),Se(n.getActiveLayer(),d),o(l,d);var h=new Set(l);M(p,function(T){h.add(T)});var m=new Set,g=s.movingConnections=[];h.forEach(function(T){M(T.outgoing,function(L){m.has(L)||!it(L)||!h.has(L.target)||(m.add(L),g.push(L))})}),o(g,d),s.dragGroup=d}if(!s.frameGroup){var S=pe("g");re(S,i.cls("djs-frame-group",["no-events"])),Se(n.getActiveLayer(),S);var E=[];M(p,function(T){var L=r.addFrame(T,S),A=L.getBBox();E.push({element:L,initialBounds:A}),n.addMarker(T,vy)}),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,Qt(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:dc(A.width+w.x,5)}):(F=dc(A.width-w.x,5),re(L,{width:F,x:A.x+A.width-F})),s.direction==="s"?re(L,{height:dc(A.height+w.y,5)}):(H=dc(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,xp)}),M(u,function(h){n.removeMarker(h,xp)}),f&&(Nt(p),Nt(f)),M(l,function(h){n.removeMarker(h,vy)}),d&&Nt(d)})}_y.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const FP={__init__:["spaceToolPreview"],__depends__:[Oi,yi,lc,wo,ha],spaceTool:["type",Un],spaceToolPreview:["type",_y]};function hc(e,t){e.invoke(Un,this),this._canvas=t}hc.$inject=["injector","canvas"],ie(hc,Un),hc.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=Zr(ro(r.children.filter(u=>v(u,"bpmn:Artifact")),Ct(o))));const s=[...e,...a];var c=Un.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(u){return!(v(u,"bpmn:TextAnnotation")||HP(u)&&(t==="y"&&Gt(u)||t==="x"&&!Gt(u)))}),c};function HP(e){return v(e,"bpmn:Participant")&&!K(e).processRef}const by={__depends__:[FP],spaceTool:["type",hc]};function mt(e,t){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[],trigger:null},this._injector=t,this._eventBus=e,this._uid=1,e.on(["diagram.destroy","diagram.clear"],function(){this.clear(!1)},this)}mt.$inject=["eventBus","injector"],mt.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";const n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction()},mt.prototype.canExecute=function(e,t){const n={command:e,context:t},i=this._getHandler(e);let r=this._fire(e,"canExecute",n);if(r===void 0){if(!i)return!1;i.canExecute&&(r=i.canExecute(t))}return r},mt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},mt.prototype.undo=function(){let e=this._getUndoAction(),t;if(e){for(this._currentExecution.trigger="undo",this._pushAction(e);e&&(this._internalUndo(e),t=this._getUndoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},mt.prototype.redo=function(){let e=this._getRedoAction(),t;if(e){for(this._currentExecution.trigger="redo",this._pushAction(e);e&&(this._internalExecute(e,!0),t=this._getRedoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},mt.prototype.register=function(e,t){this._setHandler(e,t)},mt.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");const n=this._injector.instantiate(t);this.register(e,n)},mt.prototype.canUndo=function(){return!!this._getUndoAction()},mt.prototype.canRedo=function(){return!!this._getRedoAction()},mt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},mt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},mt.prototype._internalUndo=function(e){const t=e.command,n=e.context,i=this._getHandler(t);this._atomicDo(()=>{this._fire(t,"revert",e),i.revert&&this._markDirty(i.revert(n)),this._revertedAction(e),this._fire(t,"reverted",e)})},mt.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const i=t?[e+"."+t,t]:[e];let r;n=this._eventBus.createEvent(n);for(const o of i)if(r=this._eventBus.fire("commandStack."+o,n),n.cancelBubble)break;return r},mt.prototype._createId=function(){return this._uid++},mt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},mt.prototype._internalExecute=function(e,t){const n=e.command,i=e.context,r=this._getHandler(n);if(!r)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),r.preExecute&&r.preExecute(i),this._fire(n,"preExecuted",e)),this._atomicDo(()=>{this._fire(n,"execute",e),r.execute&&this._markDirty(r.execute(i)),this._executedAction(e,t),this._fire(n,"executed",e)}),t||(this._fire(n,"postExecute",e),r.postExecute&&r.postExecute(i),this._fire(n,"postExecuted",e)),this._popAction()},mt.prototype._pushAction=function(e){const t=this._currentExecution,n=t.actions,i=n[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=i&&i.id||this._createId()),n.push(e)},mt.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,n=e.actions,i=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:zf("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},mt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=ge(e)?e:[e],t.dirty=t.dirty.concat(e))},mt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},mt.prototype._revertedAction=function(e){this._stackIdx--},mt.prototype._getHandler=function(e){return this._handlerMap[e]},mt.prototype._setHandler=function(e,t){if(!e||!t)throw new Error("command and handler required");if(this._handlerMap[e])throw new Error("overriding handler for command <"+e+">");this._handlerMap[e]=t};const zP={commandStack:["type",mt]};function ur(e,t){if(typeof t!="function")throw new Error("removeFn iterator must be a function");if(!e)return[];for(var n;n=e[0];)t(n);return e}var VP=250,xy=1400;function Ep(e,t,n){Y.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",xy,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=Ey(a),o.validatedShapes=Ey(s)}),i&&t.on("shape.move.start",VP,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",xy,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];M(s,function(u){M(u.labels,function(l){s[l.id]||c.push(l)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(r){var o=r.context,a=o.connection||o.shape;ur(a.labels,function(s){n.removeShape(s,{nested:!0})})}),this.execute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.labelTarget;s&&(o.labelTargetIndex=tl(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(Ep,Y),Ep.$inject=["injector","eventBus","modeling"];function Ey(e){var t=new Set(e);return Oe(e,function(n){return!t.has(n.labelTarget)})}const GP={__init__:["labelSupport"],labelSupport:["type",Ep]};var WP=251,wy=1401,Sy="attach-ok";function wp(e,t,n,i,r){Y.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",wy,function(a){var s=a.context,c=s.shapes,u=s.validatedShapes;s.shapes=UP(c),s.validatedShapes=qP(u)}),o&&t.on("shape.move.start",WP,function(a){var s=a.context,c=s.shapes,u=Sp(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,Sy),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(l,Sy)}))}}),this.preExecuted("elements.move",wy,function(a){var s=a.context,c=s.closure,u=s.shapes,l=Sp(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 YP(p)&&!KP(c,f)}),M(l,function(p){r.updateAttachment(p,u)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;M(s,function(c){M(c.attachers,function(u){M(u.outgoing.slice(),function(l){var p=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});p||r.removeConnection(l)}),M(u.incoming.slice(),function(l){var p=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});p||r.removeConnection(l)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,u=s.host;u&&r.updateAttachment(c,u)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,u=s.newShape;ur(c.attachers,function(l){var p=i.allowed("elements.move",{target:u,shapes:[l]});p==="attach"?r.updateAttachment(l,u):r.removeShape(l)}),u.attachers.length&&M(u.attachers,function(l){var p=zm(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=zm(d,u,l);r.moveShape(d,h,d.parent),M(d.labels,function(m){r.moveShape(m,h,m.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;ur(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}ie(wp,Y),wp.$inject=["injector","eventBus","canvas","rules","modeling"];function Sp(e){return Eu(rn(e,function(t){return t.attachers||[]}))}function UP(e){var t=Sp(e);return jx("id",e,t)}function qP(e){var t=Qr(e,"id");return Oe(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function YP(e){return!!e.host}function KP(e,t){return e.indexOf(t)!==-1}const XP={__depends__:[yi],__init__:["attachSupport"],attachSupport:["type",wp]};function Ry(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(yh(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)})}Ry.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const Rp={__init__:["changeSupport"],changeSupport:["type",Ry]};function qn(e){this._model=e}qn.$inject=["moddle"],qn.prototype._needsId=function(e){return De(e,["bpmn:RootElement","bpmn:FlowElement","bpmn:MessageFlow","bpmn:DataAssociation","bpmn:Artifact","bpmn:Participant","bpmn:Lane","bpmn:LaneSet","bpmn:Process","bpmn:Collaboration","bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane","bpmn:Property","bpmn:CategoryValue"])},qn.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;v(e,"bpmn:Activity")?t="Activity":v(e,"bpmn:Event")?t="Event":v(e,"bpmn:Gateway")?t="Gateway":De(e,["bpmn:SequenceFlow","bpmn:MessageFlow"])?t="Flow":t=(e.$type||"").replace(/^[^:]*:/g,""),t+="_",!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e))},qn.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},qn.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},qn.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",D({bpmnElement:e,bounds:this.createDiBounds()},t))},qn.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},qn.prototype.createDiWaypoints=function(e){var t=this;return rn(e,function(n){return t.createDiWaypoint(n)})},qn.prototype.createDiWaypoint=function(e){return this.create("dc:Point",ei(e,["x","y"]))},qn.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",D({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},qn.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",D({bpmnElement:e},t))};function An(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"],Tn(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Tn(a));function s(d){var h=d.context,m=h.oldRoot,g=m.children;M(g,function(S){v(S,"bpmn:BaseElement")&&i.updateParent(S)})}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"],Tn(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],Tn(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"],Tn(u)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],Tn(u));function l(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],Tn(l)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],Tn(l)),this.executed("connection.reconnect",Tn(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&&!De(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",Tn(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"],Tn(p)),this.reverted(["element.updateAttachment"],Tn(p)),this.executed("element.updateLabel",Tn(f)),this.reverted("element.updateLabel",Tn(f));function f(d){const{element:h}=d.context,m=Nn(h),g=Ve(h),S=g&&g.get("label");nr(h)||ec(h)||(m&&!S?g.set("label",t.create("bpmndi:BPMNLabel")):!m&&S&&g.set("label",void 0))}}ie(An,Y),An.$inject=["eventBus","bpmnFactory","connectionDocking"],An.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},An.prototype.updateParent=function(e,t){if(!ke(e)&&!(v(e,"bpmn:DataStoreReference")&&e.parent&&v(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=Ve(e),o=n&&n.businessObject,a=Ve(n);v(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),v(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),v(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(i,o),v(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},An.prototype.updateBounds=function(e){var t=Ve(e),n=QP(e);if(n){var i=ti(n,t.get("bounds"));D(n,{x:e.x+i.x,y:e.y+i.y})}var r=ke(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})},An.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;v(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),_t(i,e)),v(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),Et(r,e))}},An.prototype.updateDiConnection=function(e,t,n){var i=Ve(e),r=Ve(t),o=Ve(n);i.sourceElement&&i.sourceElement.bpmnElement!==K(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==K(n)&&(i.targetElement=n&&o)},An.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):(_t(n,e),e.$parent=null)}};function ZP(e){for(;e&&!v(e,"bpmn:Definitions");)e=e.$parent;return e}An.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)},An.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=ZP(e.$parent||t),e.$parent&&(_t(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),_t(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);_t(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},An.prototype.updateConnectionWaypoints=function(e){var t=Ve(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},An.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&&(_t(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(_t(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)},An.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function Tn(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=Ve(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function lr(e,t){Ti.call(this),this._bpmnFactory=e,this._moddle=t}ie(lr,Ti),lr.$inject=["bpmnFactory","moddle"],lr.prototype._baseCreate=Ti.prototype.create,lr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,D({type:"label",di:n},Lr,t))}return this.createElement(e,t)},lr.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(!eA(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=JP(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Cp(r,t,"isExpanded")),De(i,["bpmn:Lane","bpmn:Participant"])&&(t=Cp(r,t,"isHorizontal")),v(i,"bpmn:SubProcess")&&(t.collapsed=!Be(i,r)),v(i,"bpmn:ExclusiveGateway")&&(bn(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),Lt(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),Lt(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)},lr.prototype.getDefaultSize=function(e,t){var n=K(e);if(t=t||Ve(e),v(n,"bpmn:SubProcess"))return Be(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 Be(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return v(n,"bpmn:Lane")?{width:400,height:100}:v(n,"bpmn:DataObjectReference")?{width:36,height:50}:v(n,"bpmn:DataStoreReference")?{width:50,height:50}:v(n,"bpmn:TextAnnotation")?{width:100,height:40}:v(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},lr.prototype.createParticipantShape=function(e){return zt(e)||(e={isExpanded:e}),e=D({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function JP(e,t,n){return M(n,function(i){t=Cp(e,t,i)}),t}function Cp(e,t,n){return t[n]===void 0?t:(e[n]=t[n],ai(t,[n]))}function eA(e){return De(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function mc(e,t){this._modeling=e,this._canvas=t}mc.$inject=["modeling","canvas"],mc.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;M(n,function(r){var o={x:0,y:0};Lt(i.left)?o.x=i.left-r.x:Lt(i.right)?o.x=i.right-r.width-r.x:Lt(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:Lt(i.top)?o.y=i.top-r.y:Lt(i.bottom)?o.y=i.bottom-r.height-r.y:Lt(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},mc.prototype.postExecute=function(e){};function gc(e){this._modeling=e}gc.$inject=["modeling"],gc.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},gc.prototype.postExecute=function(e){var t=e.hints||{};tA(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 tA(e,t){return zi(e.outgoing,function(n){return n.target===t})}function yc(e,t){this._canvas=e,this._layouter=t}yc.$inject=["canvas","layouter"],yc.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},yc.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var vc=Math.round;function Pp(e){this._modeling=e}Pp.$inject=["modeling"],Pp.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=Ct(s);M(t,function(p){it(p)&&(p.waypoints=rn(p.waypoints,function(f){return{x:vc(f.x-c.x-c.width/2+r.x),y:vc(f.y-c.y-c.height/2+r.y)}})),D(p,{x:vc(p.x-c.x-c.width/2+r.x),y:vc(p.y-c.y-c.height/2+r.y)})});var u=new Set(bs(t)),l={};M(t,function(p){if(it(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),ke(p)&&(f=ai(f,["attach"])),l[p.id]=xe(i)?a.createShape(p,ei(p,["x","y","width","height"]),p.parent||n,i,f):a.createShape(p,ei(p,["x","y","width","height"]),p.parent||n,f)}),e.elements=Zr(l)};var Cy=Math.round;function pr(e){this._canvas=e}pr.$inject=["canvas"],pr.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,r=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?D(t,n):D(t,{x:n.x-Cy(t.width/2),y:n.y-Cy(t.height/2)}),this._canvas.addShape(t,i,r),t},pr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function ga(e){pr.call(this,e)}ie(ga,pr),ga.$inject=["canvas"];var nA=pr.prototype.execute;ga.prototype.execute=function(e){var t=e.shape;return rA(t),t.labelTarget=e.labelTarget,nA.call(this,e)};var iA=pr.prototype.revert;ga.prototype.revert=function(e){return e.shape.labelTarget=null,iA.call(this,e)};function rA(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function ya(e,t){this._canvas=e,this._modeling=t}ya.$inject=["canvas","modeling"],ya.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;ur(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),ur(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},ya.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=tl(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},ya.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,Et(n.children,t,i),this._canvas.addConnection(t,n),t};function Ap(e,t){this._modeling=e,this._elementRegistry=t}Ap.$inject=["modeling","elementRegistry"],Ap.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;M(i,function(r){n.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};function va(e,t){this._canvas=e,this._modeling=t}va.$inject=["canvas","modeling"],va.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;ur(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),ur(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),ur(n.children,function(i){it(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},va.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=tl(i.children,n),t.removeShape(n),n},va.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return Et(i.children,n,r),t.addShape(n,i),n};function _c(e){this._modeling=e}_c.$inject=["modeling"];var Py={x:"y",y:"x"};_c.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[Py[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=oi(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[Py[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)}))})},_c.prototype.postExecute=function(e){};function bc(e,t){this._layouter=e,this._canvas=t}bc.$inject=["layouter","canvas"],bc.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},bc.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Tp(){}Tp.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=_t(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},Tp.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return _t(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 Mp(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Mp.prototype.add=function(e,t){return this.addAll([e],t)},Mp.prototype.addAll=function(e,t){var n=Lw(e,!!t,this);return D(this,n),this};function _a(e){this._modeling=e}_a.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},_a.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,a=e.allShapes,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&&Bl(p,p.source,t),connectionEnd:d&&$l(p,p.target,t)})})},_a.prototype.getClosure=function(e){return new Mp().addAll(e,!0)};function xc(e){this._helper=new _a(e)}xc.$inject=["modeling"],xc.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},xc.prototype.postExecute=function(e){var t=e.hints,n;t&&t.primaryShape&&(n=t.primaryShape,t.oldParent=n.parent),this._helper.moveClosure(e.closure,e.delta,e.newParent,e.newHost,n)};function Fr(e){this._modeling=e,this._helper=new _a(e)}Fr.$inject=["modeling"],Fr.prototype.execute=function(e){var t=e.shape,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldBounds=ei(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=_t(o.children,t),Et(i.children,t,r),D(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Fr.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;i.layout!==!1&&(M(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:$l(o,t,n)})}),M(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:Bl(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},Fr.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return Et(n.children,t,i),D(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},Fr.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Fr.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function ba(e){this._modeling=e}ba.$inject=["modeling"],ba.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,i=e.connection,r=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return 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},ba.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,i=e.newTarget,r=e.dockingOrPoints,o=e.hints||{},a={};o.connectionStart&&(a.connectionStart=o.connectionStart),o.connectionEnd&&(a.connectionEnd=o.connectionEnd),o.layoutConnection!==!1&&(n&&(!i||o.docking==="source")&&(a.connectionStart=a.connectionStart||Ay(ge(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||Ay(ge(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},ba.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,i=e.oldWaypoints,r=e.connection;return t&&(r.source=t),n&&(r.target=n),i&&(r.waypoints=i),r};function Ay(e){return e.original||e}function Ii(e,t){this._modeling=e,this._rules=t}Ii.$inject=["modeling","rules"],Ii.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,Ys(h,s,l),a)}),M(d,function(h){var m=h.target,g=c(s,m,h);g&&t.reconnectStart(h,s,qs(h,s,l),a)})},Ii.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Ii.prototype.execute=function(e){},Ii.prototype.revert=function(e){},Ii.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},Ii.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},Ii.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function xa(e){this._modeling=e}xa.$inject=["modeling"],xa.prototype.execute=function(e){var t=e.shape,n=e.newBounds,i=e.minBounds;if(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)throw new Error("newBounds must have {x, y, width, height} properties");if(i&&(n.width<i.width||n.height<i.height))throw new Error("width and height cannot be less than minimum height and width");if(!i&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},D(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},xa.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(M(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:Ys(o,n,i)})}),M(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:qs(o,n,i)})}))},xa.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return D(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function fr(e){this._modeling=e}fr.$inject=["modeling"],fr.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,r=e.resizingShapes,o=e.start,a={};this.moveShapes(i,t),M(r,function(s){a[s.id]=aA(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(OP(i,r),t,n,o,i,r,a)},fr.prototype.execute=function(){},fr.prototype.revert=function(){},fr.prototype.moveShapes=function(e,t){var n=this;M(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},fr.prototype.resizeShapes=function(e,t,n){var i=this;M(e,function(r){var o=LP(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},fr.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=new Set(r),u=new Set(o);M(e,function(l){var p=l.source,f=l.target,d=oA(l),h=My(n),m={},g=c.has(p)||u.has(p),S=c.has(f)||u.has(f);g&&S?(d=rn(d,function(E){return ky(E,i,n)&&(E[h]=E[h]+t[h]),E.original&&ky(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=Bl(l,p,t):c.has(f)?m.connectionEnd=$l(l,f,t):u.has(p)?m.connectionStart=qs(l,p,a[p.id]):u.has(f)&&(m.connectionEnd=Ys(l,f,a[f.id])),s._modeling.layoutConnection(l,m))})};function Ty(e){return D({},e)}function oA(e){return rn(e.waypoints,function(t){return t=Ty(t),t.original&&(t.original=Ty(t.original)),t})}function My(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function ky(e,t,n){var i=My(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function aA(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Ec(e){this._modeling=e}Ec.$inject=["modeling"],Ec.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=Dy(n),t.collapsed=!t.collapsed;var i=Oy(n,t.collapsed);return[t].concat(i)},Ec.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=Ly(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function Dy(e){var t={};return M(e,function(n){t[n.id]=n.hidden,n.children&&(t=D({},t,Dy(n.children)))}),t}function Oy(e,t){var n=[];return M(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(Oy(i.children,i.collapsed||t)))}),n}function Ly(e,t){var n=[];return M(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(Ly(i.children,t)))}),n}function wc(e){this._modeling=e}wc.$inject=["modeling"],wc.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Iy(i,t),Ny(n,t),t.host=n,t},wc.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,Iy(n,t),Ny(i,t,r),t};function Iy(e,t){return _t(e&&e.attachers,t)}function Ny(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),Et(i,t,n)}}function kp(){}kp.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},kp.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function rt(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}rt.$inject=["eventBus","elementFactory","commandStack"],rt.prototype.getHandlers=function(){return{"shape.append":gc,"shape.create":pr,"shape.delete":va,"shape.move":Fr,"shape.resize":xa,"shape.replace":Ii,"shape.toggleCollapse":Ec,spaceTool:fr,"label.create":ga,"connection.create":yc,"connection.delete":ya,"connection.move":Tp,"connection.layout":bc,"connection.updateWaypoints":kp,"connection.reconnect":ba,"elements.create":Pp,"elements.move":xc,"elements.delete":Ap,"elements.distribute":_c,"elements.align":mc,"element.updateAttachment":wc}},rt.prototype.registerHandlers=function(e){M(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},rt.prototype.moveShape=function(e,t,n,i,r){typeof i=="object"&&(r=i,i=null);var o={shape:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("shape.move",o)},rt.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},rt.prototype.moveElements=function(e,t,n,i){i=i||{};var r=i.attach,o=n,a;r===!0?(a=n,o=n.parent):r===!1&&(a=null);var s={shapes:e,delta:t,newParent:o,newHost:a,hints:i};this._commandStack.execute("elements.move",s)},rt.prototype.moveConnection=function(e,t,n,i,r){typeof i=="object"&&(r=i,i=void 0);var o={connection:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("connection.move",o)},rt.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},rt.prototype.createConnection=function(e,t,n,i,r,o){typeof n=="object"&&(o=r,r=i,i=n,n=void 0),i=this._create("connection",i);var a={source:e,target:t,parent:r,parentIndex:n,connection:i,hints:o};return this._commandStack.execute("connection.create",a),a.connection},rt.prototype.createShape=function(e,t,n,i,r){typeof i!="number"&&(r=i,i=void 0),r=r||{};var o=r.attach,a,s;e=this._create("shape",e),o?(a=n.parent,s=n):a=n;var c={position:t,shape:e,parent:a,parentIndex:i,host:s,hints:r};return this._commandStack.execute("shape.create",c),c.shape},rt.prototype.createElements=function(e,t,n,i,r){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},rt.prototype.createLabel=function(e,t,n,i){n=this._create("label",n);var r={labelTarget:e,position:t,parent:i||e.parent,shape:n};return this._commandStack.execute("label.create",r),r.shape},rt.prototype.appendShape=function(e,t,n,i,r){r=r||{},t=this._create("shape",t);var o={source:e,position:n,target:i,shape:t,connection:r.connection,connectionParent:r.connectionParent,hints:r};return this._commandStack.execute("shape.append",o),o.shape},rt.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},rt.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},rt.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},rt.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},rt.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},rt.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},rt.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},rt.prototype.createSpace=function(e,t,n,i,r){var o={delta:n,direction:i,movingShapes:e,resizingShapes:t,start:r};this._commandStack.execute("spaceTool",o)},rt.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},rt.prototype.reconnect=function(e,t,n,i,r){var o={connection:e,newSource:t,newTarget:n,dockingOrPoints:i,hints:r||{}};this._commandStack.execute("connection.reconnect",o)},rt.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,D(i,{docking:"source"}))},rt.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,D(i,{docking:"target"}))},rt.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},rt.prototype._create=function(e,t){return _1(t)?t:this._elementFactory.create(e,t)},rt.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function Ea(e){this._elementRegistry=e}Ea.$inject=["elementRegistry"],Ea.prototype.execute=function(e){var t=e.element,n=e.moddleElement,i=e.properties;if(!n)throw new Error("<moddleElement> required");var r=e.changed||this._getVisualReferences(n).concat(t),o=e.oldProperties||sA(n,Ya(i));return By(n,i),e.oldProperties=o,e.changed=r,r},Ea.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return By(n,t),i},Ea.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return v(e,"bpmn:DataObject")?cA(e,t):[]};function sA(e,t){return xn(t,function(n,i){return n[i]=e.get(i),n},{})}function By(e,t){M(t,function(n,i){e.set(i,n)})}function cA(e,t){return t.filter(function(n){return v(n,"bpmn:DataObjectReference")&&K(n).dataObjectRef===e})}var wa="default",Ni="id",$y="di",uA={width:0,height:0};function Sa(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}Sa.$inject=["elementRegistry","moddle","modeling","textRenderer"],Sa.prototype.execute=function(e){var t=e.element,n=[t];if(!t)throw new Error("element required");var i=this._elementRegistry,r=this._moddle.ids,o=t.businessObject,a=hA(e.properties),s=e.oldProperties||lA(t,a);return jy(a,o)&&(r.unclaim(o[Ni]),i.updateId(t,a[Ni]),r.claim(a[Ni],o)),wa in a&&(a[wa]&&n.push(i.get(a[wa].id)),o[wa]&&n.push(i.get(o[wa].id))),Fy(t,a),e.oldProperties=s,e.changed=n,n},Sa.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,uA)}},Sa.prototype.revert=function(e){var t=e.element,n=e.properties,i=e.oldProperties,r=t.businessObject,o=this._elementRegistry,a=this._moddle.ids;return Fy(t,i),jy(n,r)&&(a.unclaim(n[Ni]),o.updateId(t,i[Ni]),a.claim(i[Ni],r)),e.changed};function jy(e,t){return Ni in e&&e[Ni]!==t[Ni]}function lA(e,t){var n=Ya(t),i=e.businessObject,r=Ve(e);return xn(n,function(o,a){return a!==$y?o[a]=i.get(a):o[a]=pA(r,Ya(t.di)),o},{})}function pA(e,t){return xn(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function Fy(e,t){var n=e.businessObject,i=Ve(e);M(t,function(r,o){o!==$y?n.set(o,r):i&&fA(i,r)})}function fA(e,t){M(t,function(n,i){e.set(i,n)})}var dA=["default"];function hA(e){var t=D({},e);return dA.forEach(function(n){n in e&&(t[n]=K(t[n]))}),t}function Sc(e,t){this._canvas=e,this._modeling=t}Sc.$inject=["canvas","modeling"],Sc.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=Ve(r);return t.setRootElement(n),t.removeRootElement(r),Et(a.rootElements,i),i.$parent=a,_t(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},Sc.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=Ve(n);return t.setRootElement(r),t.removeRootElement(n),_t(a.rootElements,i),i.$parent=null,Et(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function Dp(e,t){this._modeling=e,this._spaceTool=t}Dp.$inject=["modeling","spaceTool"],Dp.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=Vn(i),a=o===i,s=a?i:i.parent,c=rr(s),u=Gt(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+zn,y:i.y,width:i.width-zn,height:i.height}:{x:i.x,y:i.y+zn,width:i.width,height:i.height-zn};n.createShape({type:"bpmn:Lane",isHorizontal:u},l,s)}var p=[];Dr(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 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?zn:0),y:d-(r==="top"?120:0),width:i.width-(a?zn:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?zn:0),width:120,height:i.height-(a?zn:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:u},x,s)};function Op(e){this._modeling=e}Op.$inject=["modeling"],Op.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=rr(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=Gt(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+zn,y:n.y+f*c,width:n.width-zn,height:u}:{x:n.x+f*c,y:n.y+zn,width:u,height:n.height-zn},f<o?t.resizeShape(r[f],l):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,l,n))};function Ra(e,t){this._modeling=e,this._spaceTool=t}Ra.$inject=["modeling","spaceTool"],Ra.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Ra.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=cR(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},Ra.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=me(e),r=me(t),o=vm(r,i),a=Vn(e),s=[],c=[];Dr(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 Ca="flowNodeRef",Lp="lanes";function Rc(){}Rc.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(l,p){var f=me(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=Vn(l);return r[p.id]||(r[p.id]=zs(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=Vn(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(Lp),d=f.slice(),h=u(l);i.push({flowNode:p,remove:d,add:h})}),t.forEach(function(l){var p=l.businessObject;l.parent||p.get(Ca).forEach(function(f){i.push({flowNode:f,remove:[p],add:[]})})}),i},Rc.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(Lp);n.remove.forEach(function(o){_t(r,o),_t(o.get(Ca),i)}),n.add.forEach(function(o){Et(r,o),Et(o.get(Ca),i)})}),[]},Rc.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(Lp);n.add.forEach(function(o){_t(r,o),_t(o.get(Ca),i)}),n.remove.forEach(function(o){Et(r,o),Et(o.get(Ca),i)})}),[]};var Ip="categoryValueRef";function Pa(e,t){this._bpmnFactory=e,this._elementRegistry=t}Pa.$inject=["bpmnFactory","elementRegistry"],Pa.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,r=new Map,o=[],a=new Map;function 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:Np(E)}:w.past={categoryValue:x}))}}function c(E){r.set(E,K(E))}function u(){n.filter(function(E){return v(E,"bpmn:FlowElement")&&!ke(E)&&E.parent}).forEach(c)}function l(E){var x=K(E),b=x.get("categoryValueRef");return b||(b=dm(i,x),o.push(mA(E,b))),b}function p(E){return E.reduce(function(x,b){var w=Np(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")&&!ke(E)&&E.parent}).forEach(function(E){var x=K(E).get("categoryValueRef");if(!x){var b=Np(E),w=f.get(b)||[],T=ro(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=ro(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 S=d.reduce(function(E,x){var b=r.get(x),w=b.get(Ip),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:S,groups:o}},Pa.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),gA(t.groups),vA(t.flowElements),[]},Pa.prototype.revert=function(e){var t=e.updates;return _A(t.flowElements),yA(t.groups),[]};function mA(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function gA(e){e.forEach(function(t){K(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function yA(e){e.forEach(function(t){K(t.groupShape).categoryValueRef=null})}function vA(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Ip);t.categoryValuesToRemove.forEach(function(r){_t(i,r)}),t.categoryValuesToAdd.forEach(function(r){Et(i,r,!0)})})}function _A(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Ip);t.categoryValuesToAdd.forEach(function(r){_t(i,r)}),t.categoryValuesToRemove.forEach(function(r){Et(i,r,!0)})})}function Np(e){for(;e.parent;)e=e.parent;return e}function Cc(e){this._moddle=e}Cc.$inject=["moddle"],Cc.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),[]},Cc.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 bA={fill:void 0,stroke:void 0};function Bp(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(_n(t)){var n=xA(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}Bp.$inject=["commandStack"],Bp.prototype.postExecute=function(e){var t=e.elements,n=e.colors||bA,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=it(o)?ei(r,["border-color"]):r,s=Ve(o);if(EA(a),ke(o)){if(!s||!v(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:s.label,properties:{color:r["border-color"]}})}else{if(!De(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function xA(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 EA(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var wA={width:0,height:0};function Hy(e,t,n){function i(c,u){var l=c.label||c,p=c.labelTarget||c;return Z1(l,u),[l,p]}function r(c){var u=c.element,l=u.businessObject,p=c.newLabel;if(!ke(u)&&nr(u)&&!Ts(u)&&!zy(p)){var f=7,d=sl(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=Nn(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(!(!ke(l)&&!v(l,"bpmn:TextAnnotation"))){if(ke(l)&&zy(p)){d.removeShape!==!1&&e.removeShape(l,{unsetLabel:!1});return}var h=Nn(u);typeof f>"u"&&(f=t.getExternalLabelBounds(l,h)),f&&e.resizeShape(l,f,wA)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}Hy.$inject=["modeling","textRenderer","bpmnFactory"];function zy(e){return!e||!e.trim()}function en(e,t,n,i){rt.call(this,e,t,n),this._bpmnRules=i}ie(en,rt),en.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],en.prototype.getHandlers=function(){var e=rt.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=Ea,e["element.updateProperties"]=Sa,e["canvas.updateRoot"]=Sc,e["lane.add"]=Dp,e["lane.resize"]=Ra,e["lane.split"]=Op,e["lane.updateRefs"]=Rc,e["group.updateRefs"]=Pa,e["id.updateClaim"]=Cc,e["element.setColor"]=Bp,e["element.updateLabel"]=Hy,e},en.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},en.prototype.connect=function(e,t,n,i){var r=this._bpmnRules;if(n||(n=r.canConnect(e,t)),!!n)return this.createConnection(e,t,n,e.parent,i)},en.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},en.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},en.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},en.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},en.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},en.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},en.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},en.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},en.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},en.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},en.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},en.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function Vy(){}Vy.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||ye(t.source||e.source),t.connectionEnd||ye(t.target||e.target)]};var Pc=20,SA=5,Ac=Math.round,Gy=20,RA={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function CA(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function PA(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function Wy(e,t,n){var i=Zt(t,e,SA),r=n.split(":")[0],o=Ac((t.x-e.x)/2+e.x),a=Ac((t.y-e.y)/2+e.y),s,c,u=PA(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=CA(i,r),c=l?"h:v":"v:h",p?l?(f=a===e.y,s={x:e.x+Pc*(/l/.test(r)?-1:1),y:f?a+Pc:a}):(f=o===e.x,s={x:f?o+Pc:o,y:e.y+Pc*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:$p(e,s,c).concat(s),directions:c,turnNextDirections:f}}function AA(e,t,n){return Wy(e,t,n)}function TA(e,t,n){var i=Wy(t,e,Uy(n));return{waypoints:i.waypoints.slice().reverse(),directions:Uy(i.directions),turnNextDirections:i.turnNextDirections}}function MA(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=$p(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function Uy(e){return e.split(":").reverse().join(":")}function kA(e,t,n){var i=Ac((t.x-e.x)/2+e.x),r=Ac((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 $p(e,t,n){if(n=n||"h:h",!FA(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Yy(n)){var i=AA(e,t,n),r=TA(e,t,n),o=MA(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return kA(e,t,n)}function DA(e,t,n){var i=$p(e,t,n);return i.unshift(e),i.push(t),Xy(i)}function OA(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=Bx(o,"straight")[0]||"h:h",s=RA[a]||0,c=Zt(e,t,s),u=jA(c,a);n=n||ye(e),i=i||ye(t);var l=u.split(":"),p=Ky(n,e,l[0],HA(c)),f=Ky(i,t,l[1],c);return DA(p,f,u)}function LA(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&&NA(e,t,n,i,o),c||(c=o.connectionEnd&&$A(t,e,i,r),c)||(c=o.connectionStart&&BA(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:OA(e,t,n,i,o)}function IA(e,t,n){return e>=t&&e<=n}function qy(e,t,n){var i={x:"width",y:"height"};return IA(t[e],n[e],n[e]+n[i[e]])}function NA(e,t,n,i,r){var o={},a,s;return s=Zt(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?qy(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:qy(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 BA(e,t,n,i){return jp(e,t,n,i)}function $A(e,t,n,i){var r=i.slice().reverse();return r=jp(e,t,n,r),r?r.reverse():null}function jp(e,t,n,i){function r(l){return l.length<3?!0:l.length>4?!1:!!at(l,function(p,f){var d=l[f-1];return d&&Zo(p,d)<3})}function o(l,p,f){var d=Pi(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(_h(l[d],p,Gy)||_h(l[d],f,Gy))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=jp(e,t,n,u)),c&&Pi(c)?null:c}function jA(e,t){if(Yy(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 FA(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Yy(e){return e&&/t|r|b|l/.test(e)}function HA(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 Ky(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 Xy(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return nl(r,o,n,0)||t.push(n),t},[])}var zA=-10,VA=40,GA={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},WA={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},Fp={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Aa={top:"t",right:"r",bottom:"b",left:"l"};function Tc(e){this._elementRegistry=e}ie(Tc,Vy),Tc.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=Zy(r&&r[0],n)),a||(a=Zy(r&&r[r.length-1],i)),(v(e,"bpmn:Association")||v(e,"bpmn:DataAssociation"))&&r&&!Qy(n,i))return[].concat([o],r.slice(1,-1),[a]);var l=um(n,s)?GA:WA;return v(e,"bpmn:MessageFlow")?c=qA(n,i,l):(v(e,"bpmn:SequenceFlow")||Qy(n,i))&&(n===i?c={preferredLayouts:JA(n,e,l)}:v(n,"bpmn:BoundaryEvent")?c={preferredLayouts:eT(n,i,a,l)}:Ta(n)||Ta(i)?c={preferredLayouts:l.subProcess,preserveDocking:KA(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=Xy(LA(n,i,o,a,r,c))),u||[o,a]};function UA(e){var t=e.host;return Zt(ye(e),t,zA)}function qA(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:YA(e,t)}}function YA(e,t){return v(t,"bpmn:Participant")?"source":v(e,"bpmn:Participant")?"target":Ta(t)?"source":Ta(e)||v(t,"bpmn:Event")?"target":v(e,"bpmn:Event")?"source":null}function KA(e){return Ta(e)?"target":"source"}function Zy(e,t){return e?e.original||e:ye(t)}function Qy(e,t){return v(t,"bpmn:Activity")&&v(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Ta(e){return v(e,"bpmn:SubProcess")&&Be(e)}function Hr(e,t){return e===t}function XA(e,t){return t.indexOf(e)!==-1}function So(e){var t=/right|left/.exec(e);return t&&t[0]}function Ro(e){var t=/top|bottom/.exec(e);return t&&t[0]}function Jy(e,t){return Fp[e]===t}function ZA(e,t){var n=So(e),i=Fp[n];return t.indexOf(i)!==-1}function QA(e,t){var n=Ro(e),i=Fp[n];return t.indexOf(i)!==-1}function ev(e){return e==="right"||e==="left"}function JA(e,t,n){var i=t.waypoints,r=i&&i.length&&Zt(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function eT(e,t,n,i){var r=ye(e),o=ye(t),a=UA(e),s,c,u=Hr(e.host,t),l=XA(a,["top","right","bottom","left"]),p=Zt(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?tT(a,l,e,t,n,i):(s=nT(a,p,l,i.isHorizontal),c=iT(a,p,l,i.isHorizontal),[s+":"+c])}function tT(e,t,n,i,r,o){var a=t?e:o.isHorizontal?Ro(e):So(e),s=Aa[a],c;return t?ev(e)?c=tv("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=tv("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function tv(e,t,n,i){var r=VA;return!(Hp(e,i,n,r)||Hp(e,i,{x:n.x+n.width,y:n.y+n.height},r)||Hp(e,i,ye(t),r))}function Hp(e,t,n,i){return Math.abs(t[e]-n[e])<i}function nT(e,t,n,i){if(n)return Aa[e];var r=Ro(e),o=So(e),a=Ro(t),s=So(t);if(i){if(Hr(r,a)||Jy(o,s))return Aa[r]}else if(Hr(o,s)||Jy(r,a))return Aa[o];return Aa[i?o:r]}function iT(e,t,n,i){if(n)return ev(e)?ZA(e,t)||Hr(e,t)?"h":"v":QA(e,t)||Hr(e,t)?"v":"h";var r=Ro(e),o=So(e),a=Ro(t),s=So(t);return a&&!s?"v":s&&!a?"h":i?Hr(r,a)?"h":"v":Hr(o,s)?"v":"h"}Tc.$inject=["elementRegistry"];function nv(e){return D({original:e.point.original||e.point},e.actual)}function dr(e,t){this._elementRegistry=e,this._graphicsFactory=t}dr.$inject=["elementRegistry","graphicsFactory"],dr.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),r=this.getDockingPoint(e,n),o=e.waypoints.slice(i.idx+1,r.idx);return o.unshift(nv(i)),o.push(nv(r)),o},dr.prototype.getDockingPoint=function(e,t,n){var i=e.waypoints,r,o,a;return r=n?0:i.length-1,o=i[r],a=this._getIntersection(t,e,n),{point:o,actual:a||o,idx:r}},dr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return Qo(i,r,n)},dr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},dr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},dr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const zp={__init__:["modeling","bpmnUpdater"],__depends__:[EC,$C,FC,HC,hy,zP,GP,XP,Wn,Rp,by],bpmnFactory:["type",qn],bpmnUpdater:["type",An],elementFactory:["type",lr],modeling:["type",en],layouter:["type",Tc],connectionDocking:["type",dr]};var rT=10,iv=50,oT=250;function Vp(e,t,n,i){for(var r;r=aT(e,n,t);)n=i(t,n,r);return n}function Gp(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 aT(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=cT(e);return at(r,function(o){if(o===n)return!1;var a=Zt(o,i,rT);return a==="intersect"})}function sT(e,t){t||(t={});function n(h){return h.source===e?1:-1}var i=t.defaultDistance||iv,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||oT,c=t.reference||"start";o||(o=pT);function u(h,m){return r==="n"?c==="start"?me(h).top-me(m).bottom:c==="center"?me(h).top-ye(m).y:me(h).top-me(m).top:r==="w"?c==="start"?me(h).left-me(m).right:c==="center"?me(h).left-ye(m).x:me(h).left-me(m).left:r==="s"?c==="start"?me(m).top-me(h).bottom:c==="center"?ye(m).y-me(h).bottom:me(m).bottom-me(h).bottom:c==="start"?me(m).left-me(h).right:c==="center"?ye(m).x-me(h).right:me(m).right-me(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=xn(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 cT(e){var t=Wp(e);return e.host&&(t=t.concat(Wp(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(Wp(i))},[]))),t}function Wp(e){return lT(e).concat(uT(e))}function uT(e){return e.incoming.map(function(t){return t.source})}function lT(e){return e.outgoing.map(function(t){return t.target})}function pT(){return!0}var fT=100;function rv(e,t,n){e.on("autoPlace",fT,function(i){var r=i.shape,o=i.source;return dT(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}}rv.$inject=["eventBus","modeling","canvas"];function dT(e,t,n){n||(n={});var i=n.defaultDistance||iv,r=ye(e),o=me(e);return{x:o.right+i+t.width/2,y:r.y}}function ov(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}ov.$inject=["eventBus","selection"];const hT={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",rv],autoPlaceSelectionBehavior:["type",ov]};function av(e,t,n){var i=um(e,n);if(v(t,"bpmn:TextAnnotation"))return gT(e,t,i);if(De(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return yT(e,t,i);if(v(t,"bpmn:FlowNode"))return mT(e,t,i)}function mT(e,t,n){var i=me(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=sT(e,{filter:function(d){return v(d,"bpmn:SequenceFlow")},direction:o.directionHint}),s=30,c=o.minDistance,u=o.baseOrientation;v(e,"bpmn:BoundaryEvent")&&(u=Zt(e,e.host,-25),u.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var l=n?{x:i.right+a+t.width/2,y:r.y+sv(u,c,o)}:{x:r.x+sv(u,c,o),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},f=n?{y:p}:{x:p};return Vp(e,t,l,Gp(f))}function sv(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function gT(e,t,n){var i=me(e),r=n?{x:i.right+t.width/2,y:i.top-50-t.height/2}:{x:i.right+50+t.width/2,y:i.bottom+t.height/2};it(e)&&(r=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 Vp(e,t,r,Gp(a))}function yT(e,t,n){var i=me(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 Vp(e,t,r,Gp(a))}function cv(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return av(r,i,t)})}cv.$inject=["eventBus","elementRegistry"];const Mc={__depends__:[hT],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",cv]},uv=[sm,ra,zp,Mc];function vT(e={}){Kd(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new so({container:t,moddleExtensions:e.moddleExtensions??ts,additionalModules:[...uv,...e.additionalModules??[]]})}var _T=new Eo("ov"),bT=500;function Wt(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=_T,this._overlayDefaults=D({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=xT(n.getContainer()),this._init()}Wt.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Wt.prototype.get=function(e){if(_n(e)&&(e={id:e}),_n(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?Oe(t.overlays,Jr({type:e.type})):t.overlays.slice():[]}else return e.type?Oe(this._overlays,Jr({type:e.type})):e.id?this._overlays[e.id]:null},Wt.prototype.add=function(e,t,n){if(zt(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},Wt.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&&(pi(i.html),pi(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)}})},Wt.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Wt.prototype.show=function(){kc(this._overlayRoot)},Wt.prototype.hide=function(){kc(this._overlayRoot,!1)},Wt.prototype.clear=function(){this._overlays={},this._overlayContainers=[],hs(this._overlayRoot)},Wt.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=Ct(t);i=o.x,r=o.y}lv(n,i,r),an(e.html,"data-container-id",t.id)},Wt.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=Ct(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=Ct(i).height:s=i.height,o=t.bottom*-1+s}lv(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Wt.prototype._createOverlayContainer=function(e){var t=ut('<div class="djs-overlays" />');dn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},Wt.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";pv(this._overlayRoot,n)},Wt.prototype._getOverlayContainer=function(e,t){var n=at(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},Wt.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)),_n(i)&&(i=ut(i)),o=this._getOverlayContainer(n),r=ut('<div class="djs-overlay" data-overlay-id="'+t+'">'),dn(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();kc(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())},Wt.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&&(Lt(r)&&r>t.scale||Lt(o)&&o<t.scale))&&(c=!1),kc(a,c),this._updateOverlayScale(e,t)},Wt.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),Lt(i)&&t.scale<i&&(a=(1/t.scale||1)*i),Lt(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),Lt(a)&&(s="scale("+a+","+a+")"),pv(o,s)},Wt.prototype._updateOverlaysVisibilty=function(e){var t=this;M(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},Wt.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){pi(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",bT,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 xT(e){var t=ut('<div class="djs-overlay-container" />');return dn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function lv(e,t,n){dn(e,{left:t+"px",top:n+"px"})}function kc(e,t){e.style.display=t===!1?"none":""}function pv(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Dc={__init__:["overlays"],overlays:["type",Wt]};function Up(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(Up,Y),Up.$inject=["canvas","injector"];const ET={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",Up]};function Ma(e){return CSS.escape(e)}var wT={"&":"&","<":"<",">":">",'"':""","'":"'"};function fv(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return wT[t]})}var ST="bjs-breadcrumbs-shown";function dv(e,t,n){var i=ut('<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=at(a,function(f){return f===l});p&&s()});function s(c){c&&(a=RT(c));var u=a.flatMap(function(p){var f=n.findRoot(gi(p))||n.findRoot(p.id);if(!f&&v(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=fv(p.name||p.id),m=ut('<li><span class="bjs-crumb"><a title="'+h+'">'+h+"</a></span></li>");return m.addEventListener("click",function(){n.setRootElement(f)}),m});i.innerHTML="";var l=u.length>1;o.toggle(ST,l),u.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}dv.$inject=["eventBus","elementRegistry","canvas"];function RT(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 hv(e,t){var n=null,i=new CT;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})}hv.$inject=["eventBus","canvas"];function CT(){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 mv={x:180,y:160};function zr(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}zr.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)})}},zr.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),AT(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},zr.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=PT(e),i={x:n.x-mv.x,y:n.y-mv.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)})},zr.prototype._moveToDiPlane=function(e,t){var n=gv(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},zr.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},zr.$inject=["eventBus","moddle"];function gv(e){return v(e,"bpmndi:BPMNDiagram")?e:gv(e.$parent)}function PT(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=me(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),ws(t)}function AT(e,t){var n=e.$parent;return!(!v(n,"bpmn:SubProcess")||n===t.bpmnElement||De(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var Oc=250,TT='<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>',MT="bjs-drilldown-empty";function hr(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",Oc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",Oc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],Oc,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"],Oc,function(a){var s=a.oldParent,c=a.newParent||a.parent,u=a.shape;o._canDrillDown(u)&&o._addOverlay(u),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(u)},!0),t.on("import.render.complete",function(){n.filter(function(a){return o._canDrillDown(a)}).map(function(a){o._addOverlay(a)})})}ie(hr,Y),hr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},hr.prototype._canDrillDown=function(e){var t=this._canvas;return v(e,"bpmn:SubProcess")&&t.findRoot(gi(e))},hr.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(MT,!r)}},hr.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=ut('<button type="button" class="bjs-drilldown">'+TT+"</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(gi(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},hr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},hr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const kT={__depends__:[Dc,Rp,ET],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",dv],drilldownCentering:["type",hv],drilldownOverlayBehavior:["type",hr],subprocessCompatibility:["type",zr]};function mr(e){ht.call(this,e)}ie(mr,ht),mr.prototype._modules=[sm,kT,Dc,Wn,ra],mr.prototype._moddleExtensions={};var Lc="keyboard.keydown",DT="keyboard.keyup",OT=1e3,yv="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 hn(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(yv));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}hn.$inject=["config.keyboard","eventBus"],hn.prototype._keydownHandler=function(e){this._keyHandler(e,Lc)},hn.prototype._keyupHandler=function(e){this._keyHandler(e,DT)},hn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Lc,i),n&&e.preventDefault()}},hn.prototype._isEventIgnored=function(e){return!1},hn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(yv)),this.unbind(),e=this._node=this._target,we.bind(e,"keydown",this._keydownHandler),we.bind(e,"keyup",this._keyupHandler),this._fire("bind")},hn.prototype.getBinding=function(){return this._node},hn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),we.unbind(e,"keydown",this._keydownHandler),we.unbind(e,"keyup",this._keyupHandler)),this._node=null},hn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},hn.prototype.addListener=function(e,t,n){Vt(e)&&(n=t,t=e,e=OT),this._eventBus.on(n||Lc,e,t)},hn.prototype.removeListener=function(e,t){this._eventBus.off(t||Lc,e)},hn.prototype.hasModifier=eP,hn.prototype.isCmd=Cn,hn.prototype.isShift=hp,hn.prototype.isKey=Bt;var LT=500;function Co(e,t){var n=this;e.on("editorActions.init",LT,function(i){var r=i.editorActions;n.registerBindings(t,r)})}Co.$inject=["eventBus","keyboard"],Co.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(oP(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(aP(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(tP(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(nP(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(iP(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(rP(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Bt(["+","Add","="],r)&&Cn(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Bt(["-","Subtract"],r)&&Cn(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(Bt("0",r)&&Cn(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(Bt(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const qp={__init__:["keyboard","keyboardBindings"],keyboard:["type",hn],keyboardBindings:["type",Co]};var IT={moveSpeed:50,moveSpeedAccelerated:200};function vv(e,t,n){var i=this;this._config=D({},IT,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})}}vv.$inject=["config.keyboardMove","keyboard","canvas"];const _v={__depends__:[qp],__init__:["keyboardMove"],keyboardMove:["type",vv]};var NT=15;function bv(e,t){var n;function i(s){return a(s.originalEvent)}e.on("canvas.focus.changed",function(s){s.focused?e.on("element.mousedown",500,i):e.off("element.mousedown",i)});function r(s){var c=n.start,u=n.button,l=Nr(s),p=ti(l,c);if(!n.dragging&&BT(p)>NT&&(n.dragging=!0,u===0&&qg(e),sc("grab")),n.dragging){var f=n.last||n.start;p=ti(l,f),t.scroll({dx:p.x,dy:p.y}),n.last=l}s.preventDefault()}function o(s){we.unbind(document,"mousemove",r),we.unbind(document,"mouseup",o),n=null,Ug()}function a(s){if(!Mr(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:Nr(s)},we.bind(document,"mousemove",r),we.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}bv.$inject=["eventBus","canvas"];function BT(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const xv={__init__:["moveCanvas"],moveCanvas:["type",bv]};function Ev(e,t){var n=pl(e.min),i=pl(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function $T(e,t){return Math.max(e.min,Math.min(e.max,t))}var jT=Math.sign||function(e){return e>=0?1:-1},Yp={min:.2,max:4},wv=10,FT=.1,HT=.75;function _i(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=gn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||HT;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}_i.$inject=["config.zoomScroll","eventBus","canvas"],_i.prototype.scroll=function(t){this._canvas.scroll(t)},_i.prototype.reset=function(){this._canvas.zoom("fit-viewport")},_i.prototype.zoom=function(t,n){var i=Ev(Yp,wv*2);this._totalDelta+=t,Math.abs(this._totalDelta)>FT&&(this._zoom(t,n,i),this._totalDelta=0)},_i.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||eg()&&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))*jT(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)}},_i.prototype.stepZoom=function(t,n){var i=Ev(Yp,wv);this._zoom(t,n,i)},_i.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=pl(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom($T(Yp,s),t)},_i.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&we[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},_i.prototype._init=function(e){this.toggle(e)};const Sv={__init__:["zoomScroll"],zoomScroll:["type",_i]};function ka(e){mr.call(this,e)}ie(ka,mr),ka.prototype._navigationModules=[_v,xv,Sv],ka.prototype._modules=[].concat(mr.prototype._modules,ka.prototype._navigationModules);function Kp(e){return e&&e[e.length-1]}function Rv(e){return e.y}function Cv(e){return e.x}var zT={left:Cv,center:Cv,right:function(e){return e.x+e.width},top:Rv,middle:Rv,bottom:function(e){return e.y+e.height}};function Po(e,t){this._modeling=e,this._rules=t}Po.$inject=["modeling","rules"],Po.prototype._getOrientationDetails=function(e){var t=["top","bottom","middle"],n="x",i="width";return t.indexOf(e)!==-1&&(n="y",i="height"),{axis:n,dimension:i}},Po.prototype._isType=function(e,t){return t.indexOf(e)!==-1},Po.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),i=n.axis,r=n.dimension,o={},a={},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=Kp(t),o[e]=l[i]+l[r];else if(this._isType(e,["center","middle"])){if(M(t,function(f){var d=f[i]+Math.round(f[r]/2);a[d]?a[d].elements.push(f):a[d]={elements:[f],center:d}}),c=oi(a,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return o[e]=Kp(c).center,o;u=t[0],t=oi(t,function(f){return f[i]+f[r]}),l=Kp(t),o[e]=p(u,l)}return o},Po.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=zT[t],a=oi(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const VT={__init__:["alignElements"],alignElements:["type",Po]},GT=new Eo;function Ao(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Ao.$inject=["eventBus"],Ao.prototype.schedule=function(e,t=GT.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},Ao.prototype._schedule=function(e,t){const n=WT();return{executionId:setTimeout(()=>{try{this._scheduled[t]=null;try{n.resolve(e())}catch(r){n.reject(r)}}catch(r){console.error("Scheduler#_schedule execution failed",r)}}),promise:n.promise}},Ao.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Ao.prototype._cancel=function(e){clearTimeout(e.executionId)};function WT(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const UT={scheduler:["type",Ao]};var qT="djs-element-hidden",Ic=".entry",YT=1e3,Pv=8,KT=300;function At(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}At.$inject=["canvas","elementRegistry","eventBus","scheduler"],At.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()},At.prototype._createContainer=function(){var e=ut('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},At.prototype.registerProvider=function(e,t){t||(t=e,e=YT),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},At.prototype.getEntries=function(e){var t=this._getProviders(),n=ge(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return M(t,function(r){if(Vt(r[n])){var o=r[n](e);Vt(o)?i=o(i):M(o,function(a,s){i[s]=a})}}),i},At.prototype.trigger=function(e,t,n){var i=this,r,o,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(r=an(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},KT);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,o,n)},At.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(Vt(s)){if(t==="click")return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},At.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))}},At.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},At.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;M(t,function(r,o){var a=r.group||"default",s=ut(r.html||'<div class="entry" draggable="true"></div>'),c;an(s,"data-action",o),c=et("[data-group="+Ma(a)+"]",n),c||(c=ut('<div class="group"></div>'),an(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&XT(s,r.className),r.title&&an(s,"title",r.title),r.imageUrl&&(i=ut("<img>"),an(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),ft(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},At.prototype._createHtml=function(e){var t=this,n=ut('<div class="djs-context-pad"></div>');return wn.bind(n,Ic,"click",function(i){t.trigger("click",i)}),wn.bind(n,Ic,"dragstart",function(i){t.trigger("dragstart",i)}),wn.bind(n,Ic,"mouseover",function(i){t.trigger("mouseover",i)}),wn.bind(n,Ic,"mouseout",function(i){t.trigger("mouseout",i)}),we.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},At.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}},At.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},At.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&&Sr(e,function(i){return n.includes(i)}):n===e},At.prototype.isShown=function(){return this.isOpen()&&ft(this._current.html).has("open")},At.prototype.show=function(){this.isOpen()&&(ft(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},At.prototype.hide=function(){this.isOpen()&&(ft(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},At.prototype._getPosition=function(e){if(!ge(e)&&it(e)){var t=this._canvas.viewbox(),n=ZT(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+Pv*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+Pv*this._canvas.zoom(),top:s.top-a.top}},At.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")},At.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,qT)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},At.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 XT(e,t){var n=ft(e);t=ge(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function ZT(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&&Sr(e,function(n){return t.includes(n)})}const Av={__depends__:[ac,UT,Dc],contextPad:["type",At]};var Nc,gt,Tv,gr,Mv,kv,Dv,Xp,Bc,Da,Ov,Zp,Qp,Jp,$c={},jc=[],JT=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Fc=Array.isArray;function Bi(e,t){for(var n in t)e[n]=t[n];return e}function ef(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Lv(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?Nc.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 Hc(e,a,i,r,null)}function Hc(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??++Tv,__i:-1,__u:0};return r==null&>.vnode!=null&>.vnode(o),o}function zc(e){return e.children}function Vc(e,t){this.props=e,this.context=t}function Vr(e,t){if(t==null)return e.__?Vr(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?Vr(e):null}function eM(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=Bi({},t);o.__v=t.__v+1,gt.vnode&>.vnode(o),tf(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??Vr(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,zv(i,o,r),t.__e=t.__=null,o.__e!=n&&Iv(o)}}function Iv(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}),Iv(e)}function Nv(e){(!e.__d&&(e.__d=!0)&&gr.push(e)&&!Gc.__r++||Mv!=gt.debounceRendering)&&((Mv=gt.debounceRendering)||kv)(Gc)}function Gc(){try{for(var e,t=1;gr.length;)gr.length>t&&gr.sort(Dv),e=gr.shift(),t=gr.length,eM(e)}finally{gr.length=Gc.__r=0}}function Bv(e,t,n,i,r,o,a,s,c,u,l){var p,f,d,h,m,g,S=i&&i.__k||jc,E=t.length;for(c=tM(n,t,S,c,E),p=0;p<E;p++)(d=n.__k[p])!=null&&(f=d.__i!=-1&&S[d.__i]||$c,d.__i=p,g=tf(e,d,f,r,o,a,s,c,u,l),h=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&nf(f.ref,null,d),l.push(d.ref,d.__c||h,d)),m==null&&h!=null&&(m=h),4&d.__u?(c=$v(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 tM(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]=Hc(null,a,null,null,null):Fc(a)?a=e.__k[o]=Hc(zc,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=Hc(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=nM(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=Vr(s)),Gv(s,s));return i}function $v(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=$v(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Vr(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function nM(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 jv(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||JT.test(t)?n:n+"px"}function Wc(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||jv(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||jv(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(Ov,"$1")),a=t.toLowerCase(),t=a in e||t=="onFocusOut"||t=="onFocusIn"?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?i?n[Da]=i[Da]:(n[Da]=Zp,e.addEventListener(t,o?Jp:Qp,o)):e.removeEventListener(t,o?Jp:Qp,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 Fv(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Bc]==null)t[Bc]=Zp++;else if(t[Bc]<n[Da])return;return n(gt.event?gt.event(t):t)}}}function tf(e,t,n,i,r,o,a,s,c,u){var l,p,f,d,h,m,g,S,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=gt.__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?S=(f=t.__c=n.__c).__=f.__E:(x?t.__c=f=new H(E,w):(t.__c=f=new Vc(E,w),f.constructor=H,f.render=rM),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=Bi({},f.__s)),Bi(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)}),jc.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&a.push(f),s=Vr(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=gt.__r,L=0,x)f.state=f.__s,f.__d=!1,T&&T(t),l=f.render(f.props,f.state,f.context),jc.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=Bi(Bi({},i),f.getChildContext())),x&&!d&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(h,m)),A=l!=null&&l.type===zc&&l.key==null?Vv(l.props.children):l,s=Bv(e,Fc(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),S&&(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--;)ef(o[F])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),N.then||Hv(t),gt.__e(N,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=iM(n.__e,t,n,i,r,o,a,c,u);return(l=gt.diffed)&&l(t),128&t.__u?void 0:s}function Hv(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Hv))}function zv(e,t,n){for(var i=0;i<n.length;i++)nf(n[i],n[++i],n[++i]);gt.__c&>.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){gt.__e(o,r.__v)}})}function Vv(e){return typeof e!="object"||e==null||e.__b>0?e:Fc(e)?e.map(Vv):e.constructor!==void 0?null:Bi({},e)}function iM(e,t,n,i,r,o,a,s,c){var u,l,p,f,d,h,m,g=n.props||$c,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&&(gt.__m&>.__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&&Nc.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||Wc(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||Wc(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=""),Bv(t.type=="template"?e.content:e,Fc(f)?f:[f],t,n,i,E=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&Vr(n,0),s,c),o!=null)for(u=o.length;u--;)ef(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])&&Wc(e,u,h,g[u],r),u="checked",m!=null&&m!=e[u]&&Wc(e,u,m,g[u],r))}return e}function nf(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){gt.__e(r,n)}}function Gv(e,t,n){var i,r;if(gt.unmount&>.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||nf(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){gt.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&Gv(i[r],t,n||typeof e.type!="function");n||ef(e.__e),e.__c=e.__=e.__e=void 0}function rM(e,t,n){return this.constructor(e,n)}function Wv(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),gt.__&>.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],tf(t,e=t.__k=Lv(zc,null,[e]),r||$c,$c,t.namespaceURI,r?null:t.firstChild?Nc.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),zv(o,e,a),e.props.children=null}Nc=jc.slice,gt={__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}},Tv=0,Vc.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Bi({},this.state),typeof e=="function"&&(e=e(Bi({},n),this.props)),e&&Bi(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Nv(this))},Vc.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Nv(this))},Vc.prototype.render=zc,gr=[],kv=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Dv=function(e,t){return e.__v.__b-t.__v.__b},Gc.__r=0,Xp=Math.random().toString(8),Bc="__d"+Xp,Da="__a"+Xp,Ov=/(PointerCapture)$|Capture$/i,Zp=0,Qp=Fv(!1),Jp=Fv(!0);var Uv=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,Uv(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},qv=new Map;function oM(e){var t=qv.get(this);return t||(t=new Map,qv.set(this,t)),(t=Uv(this,t.get(e)||(t.set(e,t=(function(n){for(var i,r,o=1,a="",s="",c=[0],u=function(f){o===1&&(f||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,f,a):o===3&&(f||a)?(c.push(3,f,a),o=2):o===2&&a==="..."&&f?c.push(4,f,0):o===2&&a&&!f?c.push(5,0,!0,a):o>=5&&((a||!f&&o===5)&&(c.push(o,0,a,r),o=6),f&&(c.push(o,f,0,r),o=6)),a=""},l=0;l<n.length;l++){l&&(o===1&&u(),u(l));for(var p=0;p<n[l].length;p++)i=n[l][p],o===1?i==="<"?(u(),c=[c],o=3):a+=i:o===4?a==="--"&&i===">"?(o=1,a=""):a=i+a[0]:s?i===s?s="":a+=i:i==='"'||i==="'"?s=i:i===">"?(u(),o=1):o&&(i==="="?(o=5,r=a,a=""):i==="/"&&(o<5||n[l][p+1]===">")?(u(),o===3&&(c=c[0]),o=c,(c=c[0]).push(2,0,o),o=0):i===" "||i===" "||i===`
|
|
11
|
+
`||i==="\r"?(u(),o=2):a+=i),o===3&&a==="!--"&&(o=4,c=c[0])}return u(),c})(e)),t),arguments,[])).length>1?t:t[0]}var ot=oM.bind(Lv),To,Tt,rf,Yv,Oa=0,Kv=[],$t=gt,Xv=$t.__b,Zv=$t.__r,Qv=$t.diffed,Jv=$t.__c,e_=$t.unmount,t_=$t.__;function Uc(e,t){$t.__h&&$t.__h(Tt,e,Oa||t),Oa=0;var n=Tt.__H||(Tt.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function of(e){return Oa=1,aM(i_,e)}function aM(e,t,n){var i=Uc(To++,2);if(i.t=e,!i.__c&&(i.__=[i_(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=Tt,!Tt.__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};Tt.__f=!0;var o=Tt.shouldComponentUpdate,a=Tt.componentWillUpdate;Tt.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)},Tt.shouldComponentUpdate=r}return i.__N||i.__}function qc(e,t){var n=Uc(To++,3);!$t.__s&&cf(n.__H,t)&&(n.__=e,n.u=t,Tt.__H.__h.push(n))}function af(e,t){var n=Uc(To++,4);!$t.__s&&cf(n.__H,t)&&(n.__=e,n.u=t,Tt.__h.push(n))}function Yc(e){return Oa=5,$i(function(){return{current:e}},[])}function $i(e,t){var n=Uc(To++,7);return cf(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function La(e,t){return Oa=8,$i(function(){return e},t)}function sM(){for(var e;e=Kv.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Kc),t.__h.some(sf),t.__h=[]}catch(n){t.__h=[],$t.__e(n,e.__v)}}}$t.__b=function(e){Tt=null,Xv&&Xv(e)},$t.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),t_&&t_(e,t)},$t.__r=function(e){Zv&&Zv(e),To=0;var t=(Tt=e.__c).__H;t&&(rf===Tt?(t.__h=[],Tt.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(Kc),t.__h.some(sf),t.__h=[],To=0)),rf=Tt},$t.diffed=function(e){Qv&&Qv(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Kv.push(t)!==1&&Yv===$t.requestAnimationFrame||((Yv=$t.requestAnimationFrame)||cM)(sM)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),rf=Tt=null},$t.__c=function(e,t){t.some(function(n){try{n.__h.some(Kc),n.__h=n.__h.filter(function(i){return!i.__||sf(i)})}catch(i){t.some(function(r){r.__h&&(r.__h=[])}),t=[],$t.__e(i,n.__v)}}),Jv&&Jv(e,t)},$t.unmount=function(e){e_&&e_(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{Kc(i)}catch(r){t=r}}),n.__H=void 0,t&&$t.__e(t,n.__v))};var n_=typeof requestAnimationFrame=="function";function cM(e){var t,n=function(){clearTimeout(i),n_&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);n_&&(t=requestAnimationFrame(n))}function Kc(e){var t=Tt,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),Tt=t}function sf(e){var t=Tt;e.__c=e.__(),Tt=t}function cf(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function i_(e,t){return typeof t=="function"?t(e):t}function uM(e){const{navigationStack:t,setNavigationStack:n}=e,i=$i(()=>t.length<=1?[]:t.slice(0,-1).map((a,s)=>({label:a.label,onClick:()=>n(c=>c.slice(0,s+1))})),[t,n]),r=t.length>0?()=>n([]):null,o=t.length>0?t[t.length-1].label:null;return ot`
|
|
12
12
|
<div class="djs-popup-breadcrumbs">
|
|
13
13
|
${r&&ot`
|
|
14
14
|
<button
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
</span>
|
|
42
42
|
`}
|
|
43
43
|
</div>
|
|
44
|
-
`}function
|
|
44
|
+
`}function r_(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=r_(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function Xc(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=r_(e))&&(i&&(i+=" "),i+=t);return i}function lM(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:r,title:o}=e,a=$i(()=>pM(t),[t]),s=u=>u.action&&!u.disabled,c=(u,l)=>{if(s(l))return n(u,l)};return ot`
|
|
45
45
|
<div class="djs-popup-header">
|
|
46
46
|
<h3 class="djs-popup-title" title=${o}>${o}</h3>
|
|
47
47
|
${a.map(u=>ot`
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
${u.entries.map(l=>ot`
|
|
51
51
|
<li key=${l.id}>
|
|
52
52
|
<${s(l)?"button":"span"}
|
|
53
|
-
class=${
|
|
53
|
+
class=${fM(l,l===i)}
|
|
54
54
|
onClick=${p=>c(p,l)}
|
|
55
55
|
title=${l.title||l.label}
|
|
56
56
|
data-id=${l.id}
|
|
@@ -70,11 +70,11 @@
|
|
|
70
70
|
</ul>
|
|
71
71
|
`)}
|
|
72
72
|
</div>
|
|
73
|
-
`}function
|
|
73
|
+
`}function pM(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 fM(e,t){return Xc("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function o_(e,t){return`${e}-entry-${t.id}`}function dM(e){const{idPrefix:t,entry:n,selected:i,onMouseEnter:r,onMouseLeave:o,onAction:a}=e,s=(u,l)=>{if(!n.disabled)return a(u,n,l)},c=!n.entries;return ot`
|
|
74
74
|
<li
|
|
75
|
-
class=${
|
|
75
|
+
class=${Xc("entry",{selected:i,disabled:n.disabled})}
|
|
76
76
|
data-id=${n.id}
|
|
77
|
-
id=${
|
|
77
|
+
id=${o_(t,n)}
|
|
78
78
|
role="option"
|
|
79
79
|
aria-selected=${i||void 0}
|
|
80
80
|
aria-haspopup=${n.entries?"true":void 0}
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
>
|
|
89
89
|
<div class="djs-popup-entry-content">
|
|
90
90
|
<span
|
|
91
|
-
class=${
|
|
91
|
+
class=${Xc("djs-popup-entry-name",n.className)}
|
|
92
92
|
>
|
|
93
93
|
${n.imageUrl&&ot`<img class="djs-popup-entry-icon" src=${n.imageUrl} alt="" />`||n.imageHtml&&ot`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:n.imageHtml}} />`}
|
|
94
94
|
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
</div>
|
|
132
132
|
`}
|
|
133
133
|
</li>
|
|
134
|
-
`}function
|
|
134
|
+
`}function hM(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:r,idPrefix:o,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:u,...l}=e,p=Yc();af(()=>{if(!r||!r.current)return;const m=p.current;if(!m)return;const g=m.querySelector(".selected");g&&mM(g)},[t]);const f=()=>{r.current=!1},d=m=>{r.current||n(m)},h=()=>{r.current||n(null)};return ot`
|
|
135
135
|
<div
|
|
136
136
|
class="djs-popup-results"
|
|
137
137
|
ref=${p}
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
>
|
|
145
145
|
${i.map(m=>ot`
|
|
146
146
|
${m.name&&ot`
|
|
147
|
-
<div key=${m.id} id=${
|
|
147
|
+
<div key=${m.id} id=${a_(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?
|
|
155
|
+
aria-labelledby=${m.name?a_(o,m):void 0}
|
|
156
156
|
>
|
|
157
157
|
${m.entries.map(g=>ot`
|
|
158
|
-
<${
|
|
158
|
+
<${dM}
|
|
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
|
|
172
|
-
<${
|
|
171
|
+
`}function a_(e,t){return`${e}-group-${t.id}`}function mM(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const gM=new Eo("djs-popup");function yM(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]=of([]);qc(()=>{g([])},[f]);const[S,E]=of(""),x=S.trim().length>0,b=$i(()=>bM(f),[f]),w=$i(()=>Lt(u)?b.length>5:!1,[u,b]),T=$i(()=>{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]),L=$i(()=>x?T.length?[{id:"default",entries:T}]:[]:xM(T),[T,x]),[A,F]=of(T[0]),H=Yc(null),N=Yc(!1),z=$i(()=>gM.next(),[]),ue=`${z}-results`,je=A&&o_(z,A);qc(()=>{const $=H.current;$&&T.includes($)?F($):F(T[0]),H.current=null},[T]);const tt=La($=>{const B=_M(L);let Ae=B.indexOf(A)+$;Ae<0&&(Ae=B.length-1),Ae>=B.length&&(Ae=0),N.current=!0,F(B[Ae])},[L,A]),X=La($=>{$>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]),se=La(($,B,U)=>{if(!(!B||B.disabled))return B.entries?($.preventDefault(),X(1)):n($,B,U)},[n,X]),fe=La($=>{if($.key==="Enter"&&A){const B=$.target;return!!Mr(B,"a, button",!0)||A.disabled?void 0:se($,A)}if($.key==="Backspace"){const B=$.target;if(!(Gu(B,"input")&&B.value!==""))return X(-1),$.preventDefault()}if($.key==="ArrowUp")return tt(-1),$.preventDefault();if($.key==="ArrowDown")return tt(1),$.preventDefault();if($.key==="ArrowRight")return X(1),$.preventDefault();if($.key==="ArrowLeft")return X(-1),$.preventDefault()},[A,tt,X,se]),oe=La($=>{Gu($.target,"input")&&E(()=>$.target.value)},[E]);qc(()=>(d(),()=>{h()}),[]);const de=!x&&m.length>0,ee=(a||r.length>0)&&!de;return ot`
|
|
172
|
+
<${s_}
|
|
173
173
|
onClose=${t}
|
|
174
174
|
onKeyup=${oe}
|
|
175
175
|
onKeydown=${fe}
|
|
@@ -180,7 +180,7 @@
|
|
|
180
180
|
navigationStack=${m}
|
|
181
181
|
>
|
|
182
182
|
${ee&&ot`
|
|
183
|
-
<${
|
|
183
|
+
<${lM}
|
|
184
184
|
headerEntries=${r}
|
|
185
185
|
onSelect=${n}
|
|
186
186
|
selectedEntry=${A}
|
|
@@ -189,7 +189,7 @@
|
|
|
189
189
|
/>
|
|
190
190
|
`}
|
|
191
191
|
${de&&ot`
|
|
192
|
-
<${
|
|
192
|
+
<${uM}
|
|
193
193
|
navigationStack=${m}
|
|
194
194
|
setNavigationStack=${g}
|
|
195
195
|
/>
|
|
@@ -221,7 +221,7 @@
|
|
|
221
221
|
</div>
|
|
222
222
|
`}
|
|
223
223
|
|
|
224
|
-
<${
|
|
224
|
+
<${hM}
|
|
225
225
|
groupedEntries=${L}
|
|
226
226
|
selectedEntry=${A}
|
|
227
227
|
setSelectedEntry=${F}
|
|
@@ -255,13 +255,13 @@
|
|
|
255
255
|
</div>
|
|
256
256
|
`}
|
|
257
257
|
${l&&T.length===0&&ot`
|
|
258
|
-
<div class="djs-popup-no-results">${
|
|
258
|
+
<div class="djs-popup-no-results">${Vt(l)?l(S):l}</div>
|
|
259
259
|
`}
|
|
260
|
-
</${
|
|
261
|
-
`}function
|
|
260
|
+
</${s_}>
|
|
261
|
+
`}function s_(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,navigationStack:a,position:s}=e,c=Yc();return af(()=>{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]),af(()=>{const u=c.current;if(!u)return;(u.querySelector("input")||u.querySelector('[role="listbox"]')||u).focus()},[a]),qc(()=>{const u=p=>{if(p.key==="Escape")return p.preventDefault(),t()},l=p=>{if(!Mr(p.target,".djs-popup",!0))return t()};return document.documentElement.addEventListener("keydown",u),document.body.addEventListener("click",l,!0),()=>{document.documentElement.removeEventListener("keydown",u),document.body.removeEventListener("click",l,!0)}},[]),ot`
|
|
262
262
|
<div
|
|
263
|
-
class=${
|
|
264
|
-
style=${
|
|
263
|
+
class=${Xc("djs-popup",r)}
|
|
264
|
+
style=${vM(e)}
|
|
265
265
|
onKeydown=${n}
|
|
266
266
|
onKeyup=${i}
|
|
267
267
|
ref=${c}
|
|
@@ -269,8 +269,8 @@
|
|
|
269
269
|
>
|
|
270
270
|
${o}
|
|
271
271
|
</div>
|
|
272
|
-
`}function
|
|
273
|
-
<${
|
|
272
|
+
`}function vM(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:Lt(t)?n:void 0,maxWidth:Lt(t)?"unset":void 0,"transform-origin":"top left"}}function _M(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function bM(e){const t=[];function n(i){i.forEach(r=>{if(r.entries){n(r.entries);return}t.push(r)})}return n(e),t}function xM(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 EM="data-id",c_=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],wM=1e3;function yt(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var r=Lt(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()})}yt.$inject=["config.popupMenu","eventBus","canvas","search"],yt.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:r,options:o}=this._current,a=u_(n),s=Object.entries(i).map(([f,d])=>({id:f,...d})),c=e&&(f=>this._ensureVisible(f,e)),u=this._updateScale(this._current.container);Wv(ot`
|
|
273
|
+
<${yM}
|
|
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)},yt.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()},yt.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()},yt.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)}},yt.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},yt.prototype.reset=function(){const e=this._current.container;
|
|
287
|
+
`,this._current.container)},yt.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()},yt.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()},yt.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)}},yt.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},yt.prototype.reset=function(){const e=this._current.container;Wv(null,e),pi(e)},yt.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},yt.prototype._onOpened=function(){this._emit("opened")},yt.prototype._onClosed=function(){this._emit("closed")},yt.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=ut(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},yt.prototype._bindAutoClose=function(){this._eventBus.once(c_,this.close,this)},yt.prototype._unbindAutoClose=function(){this._eventBus.off(c_,this.close,this)},yt.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),Lt(n)&&e<n&&(r=n),Lt(i)&&e>i&&(r=i)),r},yt.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}},yt.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},yt.prototype.registerProvider=function(e,t,n){n||(n=t,t=wM),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},yt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},yt.prototype._getEntries=function(e,t){var n={};return M(t,function(i){if(!i.getPopupMenuEntries){M(i.getEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=ai(o,["id"])});return}var r=i.getPopupMenuEntries(e);Vt(r)?n=r(n):M(r,function(o,a){n[a]=o})}),n},yt.prototype._getHeaderEntries=function(e,t){var n={};return M(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;M(i.getHeaderEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=ai(o,["id"])});return}var r=i.getPopupMenuHeaderEntries(e);Vt(r)?n=r(n):M(r,function(o,a){n[a]=o})}),n},yt.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>Vt(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},yt.prototype.isOpen=function(){return!!this._current},yt.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let r=Mr(e.delegateTarget||e.target,".entry",!0),o=an(r,EM);t={id:o,...this._getEntry(o)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(Vt(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},yt.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 u_(e,t=[]){return Object.entries(e).map(([n,i])=>{const r={id:n,...i};return r.entries?r.entries=u_(r.entries,[...t,...l_(r.search)]):t.length&&(r.search=[...t,...l_(r.search)]),r})}function l_(e){return e?ge(e)?e:[e]:[]}function SM(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=RM(o,r,i);return a?{item:o,tokens:a}:[]}).sort(CM(i))}function RM(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}=m_(p,t);return{tokens:[...l.tokens,f],matchedWords:{...l.matchedWords,...d}}},{matchedWords:{},tokens:[]}):m_(s,t);return{tokens:{...o.tokens,[a]:c},matchedWords:{...o.matchedWords,...u}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:r}function CM(e){return(t,n)=>{let i=0,r=1;for(const o of e){const a=PM(t.tokens[o],n.tokens[o]);if(a!==0){i+=a*r,r*=p_;continue}const s=AM(t.item[o],n.item[o]);if(s!==0){i+=s*r,r*=p_;continue}}return i}}function PM(e,t){return f_(t)-f_(e)}const p_=.5,Mo={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function f_(e){const t=e.reduce((s,c)=>s+d_(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 d_(e){if(ge(e))return Math.max(...e.map(d_));const t=Math.log(e.value.length);return e.match?(e.start?e.end?Mo.FULL:e.wordEnd?Mo.START_FULL_WORD:Mo.START_WORD_PART:e.wordStart?Mo.WORD_START:Mo.WORD_PART)*t:Mo.NO_MATCH*t}function h_(e=""){return ge(e)?e.join(", "):e}function AM(e,t){return h_(e).localeCompare(h_(t))}function m_(e,t){var u;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map(TM),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 TM(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const g_={search:["value",SM]},uf={__depends__:[g_],__init__:["popupMenu"],popupMenu:["type",yt]};var y_={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>`},PM=900;function Mo(e,t,n,i){e.registerProvider(PM,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}Mo.$inject=["contextPad","popupMenu","translate","canvas"],Mo.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&D(t,this._getEntries(e)),t},Mo.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Mo.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${h_.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)}}}}},Mo.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 AM=["left","center","right","top","middle","bottom"];function La(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}La.$inject=["popupMenu","alignElements","translate","rules"],La.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&D(t,this._getEntries(e)),t},La.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},La.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return M(AM,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:h_[o],action:function(){t.trigger(e,o),i.close()}}}),r};function Kc(e){Vn.call(this,e)}Kc.$inject=["eventBus"],ie(Kc,Vn),Kc.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=vs(n),n.length<2?!1:n})};const TM={__depends__:[FT,Rv,uf],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Mo],alignElementsMenuProvider:["type",La],bpmnAlignElements:["type",Kc]};function Bi(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=bu(Kr(a.closure.topLevel)),c=a.hints,u=c?c.autoResize:!0;if(u!==!1){var l=Xr(s,function(p){return p.parent.id});M(l,function(p,f){ge(u)&&(p=p.filter(function(d){return at(u,Zr({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)})}Bi.$inject=["eventBus","elementRegistry","modeling","rules"],ie(Bi,Y),Bi.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=me(Rt(e)),o=me(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),xs(D({},o,a))},Bi.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(MM(i,t)){var r=kM(Jn(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},Bi.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Bi.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Bi.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function MM(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function kM(e,t){var n="";return e=me(e),t=me(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 Xc(e){e.invoke(Bi,this)}Xc.$inject=["injector"],ie(Xc,Bi),Xc.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 Ia(e){Vn.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}Ia.$inject=["eventBus"],ie(Ia,Vn),Ia.prototype.canResize=function(e,t){return!1};function Zc(e,t){Ia.call(this,e),this._modeling=t}ie(Zc,Ia),Zc.$inject=["eventBus","modeling"],Zc.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")||ke(i)){n=!1;return}}),n};const DM={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Xc],bpmnAutoResizeProvider:["type",Zc]};function ko(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()})}ko.$inject=["config.autoScroll","eventBus","canvas"],ko.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++)OM(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 OM(e,t,n){return t<e&&e<n}ko.prototype.stopScroll=function(){clearTimeout(this._scrolling)},ko.prototype.setOptions=function(e){this._opts=D({},this._opts,e)},ko.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Lr(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const LM={__depends__:[ki],__init__:["autoScroll"],autoScroll:["type",ko]};var m_="djs-bendpoint",g_="djs-segment-dragger";function IM(e,t){var n=Lr(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 lf(e,t,n){var i=IM(e,n),r=Al(t,i);return r}function pf(e,t){var n=pe("g");$e(n).add(m_),Se(e,n);var i=pe("circle");re(i,{cx:0,cy:0,r:4}),$e(i).add("djs-visual"),Se(n,i);var r=pe("circle");return re(r,{cx:0,cy:0,r:10}),$e(r).add("djs-hit"),Se(n,r),t&&$e(n).add(t),n}function NM(e,t,n,i){var r=pe("g");Se(e,r);var o=18,a=6,s=11,c=$M(t,n,i),u=a+s,l=pe("rect");re(l,{x:-o/2,y:-a/2,width:o,height:a}),$e(l).add("djs-visual"),Se(r,l);var p=pe("rect");return re(p,{x:-c/2,y:-u/2,width:c,height:u}),$e(p).add("djs-hit"),Se(r,p),Vh(r,i==="v"?90:0),r}function y_(e,t,n){var i=pe("g"),r=il(t,n),o=Ri(t,n);return Se(e,i),NM(i,t,n,o),$e(i).add(g_),$e(i).add(o==="h"?"horizontal":"vertical"),Zt(i,r.x,r.y),i}function ff(e){return Math.abs(Math.round(e*2/3))}function BM(e,t){var n=jM(e,t);return Ll(e,n)}function $M(e,t,n){var i=t.x-e.x,r=t.y-e.y;return ff(n==="h"?i:r)}function jM(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=Tm(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function v_(e,t,n,i,r){function o(x,b,w){var T=x.index,L=x.point,A,F,H,N,z,ue;return T<=0||x.bendpoint?!1:(A=b[T-1],F=b[T],H=il(A,F),N=Ri(A,F),z=Math.abs(L.x-H.x),ue=Math.abs(L.y-H.y),N&&z<=w&&ue<=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=Ri(T.start,T.end),!L)?null:(L==="h"?A=T.end.x-T.start.x:A=T.end.y-T.start.y,F=ff(A)/2,F)}function s(x,b){var w=b.waypoints,T=lf(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){we.bind(x,b,function(T){n.triggerMouseEvent(b,T,w),T.stopPropagation()})}function u(x,b){var w=t.getLayer("overlays"),T=et('.djs-bendpoints[data-element-id="'+Ta(x.id)+'"]',w);return!T&&b&&(T=pe("g"),re(T,{"data-element-id":x.id}),$e(T).add("djs-bendpoints"),Se(w,T),c(T,"mousedown",x),c(T,"click",x),c(T,"dblclick",x)),T}function l(x,b){return et('.djs-segment-dragger[data-segment-idx="'+x+'"]',b)}function p(x,b){b.waypoints.forEach(function(w,T){var L=pf(x);Se(x,L),Zt(L,w.x,w.y)}),pf(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],Ri(T,L)&&(A=y_(x,T,L),re(A,{"data-segment-idx":F}),c(A,"mousemove",b))}function d(x){M(hs("."+m_,x),function(b){It(b)})}function h(x){M(hs("."+g_,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=et(".floating",x),T=b.point;w&&(Zt(w,T.x,T.y),$e(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=il(L,A),N=Ri(L,A),z,ue;T&&(z=FM(T),ue={x:F.x-H.x,y:F.y-H.y},N==="v"&&(ue={x:ue.y,y:ue.x}),Zt(z,ue.x,ue.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?$e(w).add(x.marker):$e(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=lf(t,w,x.originalEvent),!L)return;R(T,L),L.bendpoint||E(T,L,w)}}),e.on("element.mousedown",function(x){if(rr(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=et(".floating",w);T&&$e(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}v_.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function FM(e){return et(".djs-visual",e)}var __=Math.round,zr="reconnectStart",Vr="reconnectEnd",Na="updateWaypoints";function df(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=zr:!u&&c===d.length-1?h=Vr:h=Na;var m=h===Na?"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===Na?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(h,{connection:c,source:f===zr?p:u,target:f===Vr?p:l}),d){s.source=f===zr?p:u,s.target=f===Vr?p:l;return}d===!1&&(d=s.allowed=r.allowed(h,{connection:c,source:f===Vr?p:l,target:f===zr?p:u})),d&&(s.source=f===Vr?p:l,s.target=f===zr?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!==Na&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(a){var s=a.context,c=s.allowed,u=s.bendpointIndex,l=s.connection,p=s.insert,f=l.waypoints.slice(),d=s.source,h=s.target,m=s.type,g=s.hints||{},R={x:__(a.x),y:__(a.y)};if(!c)return!1;m===Na?(p?f.splice(u,0,R):f[u]=R,g.bendpointMove={insert:p,bendpointIndex:u},f=this.cropWaypoints(l,f),o.updateWaypoints(l,i1(f),g)):(m===zr?(g.docking="source",Qc(s)&&(g.docking="target",g.newWaypoints=f.reverse())):m===Vr&&(g.docking="target",Qc(s)&&(g.docking="source",g.newWaypoints=f.reverse())),o.reconnect(l,d,h,R,g))},this)}df.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],df.prototype.cropWaypoints=function(e,t){var n=this._injector.get("connectionDocking",!1);if(!n)return t;var i=e.waypoints;return e.waypoints=t,e.waypoints=n.getCroppedWaypoints(e),t=e.waypoints,e.waypoints=i,t};function Qc(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===zr)return t&&i&&t===i&&n!==i;if(r===Vr)return t&&n&&t===n&&n!==i}var HM="reconnectStart",zM="reconnectEnd",b_="updateWaypoints",Ba="connect-ok",Jc="connect-not-ok",x_="connect-hover",E_="djs-updating",w_="djs-dragging",S_=1100;function R_(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=pf(i.getLayer("overlays"));$e(f).add("djs-dragging"),i.addMarker(c,w_),i.addMarker(c,E_)}),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,x_),u===b_)return;s?(i.removeMarker(c,Jc),i.addMarker(c,Ba)):s===!1&&(i.removeMarker(c,Ba),i.addMarker(c,Jc))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],S_,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,x_),i.removeMarker(s,c?Ba:Jc))}),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===HM?Qc(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===zM?Qc(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===b_&&(m=e.cropWaypoints(f,m)),E.waypoints=m,r.drawPreview(a,s,E)),Zt(u,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],S_,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,u=a.hover,l=a.target,p=a.waypoints;s.waypoints=p,It(c),i.removeMarker(s,E_),i.removeMarker(s,w_),u&&(i.removeMarker(u,Ba),i.removeMarker(u,l?Ba:Jc)),r&&r.cleanUp(a)})}R_.$inject=["bendpointMove","injector","eventBus","canvas"];var C_="connect-hover",P_="djs-updating";function A_(e,t,n){return hf(e,t,e[t]+n)}function hf(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function VM(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 hf(t,i,s)}function T_(e){return e==="x"?"y":"x"}function M_(e,t,n){var i,r;return e.original?e.original:(i=ye(t),r=T_(n),hf(e,r,i[r]))}function k_(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=lf(n,E,p),T,L,A;if(T=Ri(x,b),!!T)return L=T==="v"?"x":"y",g===0&&(x=M_(x,f.source,L)),R===E.length-1&&(b=M_(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=T_(p.axis),b=VM(d,g,E,x);Zt(p.draggerGfx,b.x,b.y)}function l(p,f){var d=0,h=p.filter(function(m,g){return nl(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=y_(h,f.segmentStart,f.segmentEnd),$e(f.draggerGfx).add("djs-dragging"),n.addMarker(d,P_)}),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=A_(g,E,p["d"+E]),w=A_(R,E,p["d"+E]),T=x.length,L=0;x[h]=b,x[m]=w;var A,F;h<2&&(A=Xt(d.source,b),h===1?A==="intersect"&&(x.shift(),x[0]=b,L--):A!=="intersect"&&(x.unshift(g),L++)),m>T-3&&(F=Xt(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,C_)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,C_)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,d=f.connection;f.draggerGfx&&It(f.draggerGfx),n.removeMarker(d,P_)}),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)})}k_.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var GM=Math.abs,D_=Math.round;function WM(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],GM(r-e)<=n)return r}function O_(e){return{x:e.x,y:e.y}}function L_(e){return{x:e.x+e.width,y:e.y+e.height}}function qn(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:D_(e.x+e.width/2),y:D_(e.y+e.height/2)}}function Do(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 I_(e){return e.children||[]}var UM=Math.abs,N_=Math.round,mf=10;function B_(e){function t(o,a){if(ge(o)){for(var s=o.length;s--;)if(UM(o[s]-a)<=mf)return o[s]}else{o=+o;var c=a%o;if(c<mf)return a-c;if(c>o-mf)return a-c+o}return a}function n(o,a){if(o.waypoints)return BM(a,o);if(o.width)return{x:N_(o.width/2+o.x),y:N_(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);!it(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)}})}B_.$inject=["eventBus"];const qM={__depends__:[ki,gi],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",v_],bendpointMove:["type",df],bendpointMovePreview:["type",R_],connectionSegmentMove:["type",k_],bendpointSnapping:["type",B_]};function $_(e,t,n,i){function r(a,s){return i.allowed("connection.create",{source:a,target:s})}function o(a,s){return r(s,a)}e.on("connect.hover",function(a){var s=a.context,c=s.start,u=a.hover,l;if(s.hover=u,l=s.canExecute=r(c,u),!Yr(l)){if(l!==!1){s.source=c,s.target=u;return}l=s.canExecute=o(c,u),!Yr(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:gf(s)?l:u,connectionEnd:gf(s)?u:l};Ht(c)&&(d=c),s.connection=n.connect(p,f,d,h)}),this.start=function(a,s,c,u){Ht(c)||(u=c,c=ye(s)),t.init(a,"connect",{autoActivate:u,data:{shape:s,context:{start:s,connectionStart:c}}})}}$_.$inject=["eventBus","dragging","modeling","rules"];function gf(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var YM=1100,KM=900,j_="connect-ok",F_="connect-not-ok";function H_(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;gf(o)&&(h=d,m=f),i.drawPreview(o,a,{source:c||u,target:p||s,connectionStart:h,connectionEnd:m})}),t.on("connect.hover",KM,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?j_:F_)}),t.on(["connect.out","connect.cleanup"],YM,function(r){var o=r.hover;o&&(n.removeMarker(o,j_),n.removeMarker(o,F_))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}H_.$inject=["injector","eventBus","canvas"];const yf={__depends__:[Gn,gi,ki],__init__:["connectPreview"],connect:["type",$_],connectPreview:["type",H_]};var XM="djs-dragger";function $i(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)}$i.$inject=["injector","canvas","graphicsFactory","elementFactory"],$i.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()),ms(i),r||(r=e.getConnection=ZM(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)"})},$i.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]);Se(e,s)},$i.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&&Zo(o,s,!0)||e,t=i&&Zo(a,s,!1)||t,[e,t]},$i.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&It(e.connectionPreviewGfx)},$i.prototype.getConnection=function(e){var t=QM(e);return this._elementFactory.createConnection(t)},$i.prototype.createConnectionPreviewGfx=function(){var e=pe("g");return re(e,{pointerEvents:"none"}),$e(e).add(XM),Se(this._canvas.getActiveLayer(),e),e},$i.prototype.createNoopConnection=function(e,t){return qo([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function ZM(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 QM(e){return Ht(e)?e:{}}const JM={__init__:["connectionPreview"],connectionPreview:["type",$i]},eu="complex-preview";class z_{constructor(t,n,i){this._canvas=t,this._graphicsFactory=n,this._previewSupport=i,this._markers=[]}create(t){this.cleanUp();const{created:n=[],moved:i=[],removed:r=[],resized:o=[]}=t,a=this._canvas.getLayer(eu);n.filter(s=>!e2(s)).forEach(s=>{let c;it(s)?(c=this._graphicsFactory._createContainer("connection",pe("g")),this._graphicsFactory.drawConnection(kr(c),s)):(c=this._graphicsFactory._createContainer("shape",pe("g")),this._graphicsFactory.drawShape(kr(c),s),Zt(c,s.x,s.y)),this._previewSupport.addDragger(s,a,c)}),i.forEach(({element:s,delta:c})=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"]);const u=this._previewSupport.addDragger(s,a);it(s)?Zt(u,c.x,c.y):Zt(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(kr(u),s,{width:c.width,height:c.height}),Zt(u,c.x,c.y),this._previewSupport.addDragger(s,a,u)})}cleanUp(){ms(this._canvas.getLayer(eu)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(eu)}hide(){this._canvas.hideLayer(eu)}}z_.$inject=["canvas","graphicsFactory","previewSupport"];function e2(e){return e.hidden}const t2={__depends__:[Eo],__init__:["complexPreview"],complexPreview:["type",z_]},V_=Math.round;function tu(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}tu.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-V_(u.width/2),y:l.y-V_(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=>!Yr(d))})},tu.prototype.cleanUp=function(){this._complexPreview.cleanUp()},tu.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const n2={__depends__:[Ac,t2,zp],__init__:["appendPreview"],appendPreview:["type",tu]};var G_=Math.min,W_=Math.max;function vf(e){e.preventDefault()}function $a(e){e.stopPropagation()}function i2(e){return e.nodeType===Node.TEXT_NODE}function r2(e){return[].slice.call(e)}function ti(e){this.container=e.container,this.parent=ut('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=et("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=mn(this.autoResize,this),this.handlePaste=mn(this.handlePaste,this)}ti.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=Jn(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=Jn(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,we.bind(a,"keydown",this.keyHandler),we.bind(a,"mousedown",$a),we.bind(a,"paste",r.handlePaste),we.bind(a,"focusout",this.focusoutHandler),i.autoResize&&we.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},ti.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)}},ti.prototype.insertText=function(e){e=o2(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},ti.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=r2(a.childNodes),c,u;if(i2(a)){var l=n.textContent;n.textContent=l.substring(0,r)+e+l.substring(o),c=n,u=r+e.length}else if(n===this.content&&i===this.content){var p=document.createTextNode(e);this.content.insertBefore(p,s[r]),c=p,u=p.textContent.length}else{var f=s.indexOf(n),d=s.indexOf(i);s.forEach(function(h,m){m===f?h.textContent=n.textContent.substring(0,r)+e+i.textContent.substring(o):m>f&&m<=d&&li(h)}),c=n,u=r+e.length}c&&u!==void 0&&setTimeout(function(){self.setSelection(c,u)})},ti.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})}},ti.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,i=parseInt(this.style.minWidth)||0,r=parseInt(this.style.minHeight)||0,o=parseInt(this.style.maxWidth)||1/0,a=parseInt(this.style.maxHeight)||1/0;if(!n){n=this.resizeHandle=ut('<div class="djs-direct-editing-resize-handle"></div>');var s,c,u,l,p=function(h){vf(h),$a(h),s=h.clientX,c=h.clientY;var m=t.getBoundingClientRect();u=m.width,l=m.height,we.bind(document,"mousemove",f),we.bind(document,"mouseup",d)},f=function(h){vf(h),$a(h);var m=G_(W_(u+h.clientX-s,i),o),g=G_(W_(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){vf(h),$a(h),we.unbind(document,"mousemove",f,!1),we.unbind(document,"mouseup",d,!1)};we.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)},ti.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),we.unbind(t,"keydown",this.keyHandler),we.unbind(t,"mousedown",$a),we.unbind(t,"input",this.autoResize),we.unbind(t,"paste",this.handlePaste),we.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),li(n)),li(e)},ti.prototype.getValue=function(){return this.content.innerText.trim()},ti.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},ti.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 o2(e){return e.replace(/\r\n|\r|\n/g,`
|
|
316
|
-
`)}function Tn(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new ti({container:t.getContainer(),keyHandler:mn(this._handleKey,this),resizeHandler:mn(this._handleResize,this),focusoutHandler:mn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}Tn.$inject=["eventBus","canvas"],Tn.prototype.registerProvider=function(e){this._providers.push(e)},Tn.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},Tn.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},Tn.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},Tn.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},Tn.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},Tn.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()}},Tn.prototype.getValue=function(){return this._textbox.getValue()},Tn.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()},Tn.prototype._handleResize=function(e){this._fire("resize",e)},Tn.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},Tn.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=at(this._providers,function(i){return(t=i.activate(e))?i:null});return t&&(this.$textbox=this._textbox.create(t.bounds,t.style,t.text,t.options),this._active={element:e,context:t,provider:n},t.options&&t.options.resizable&&(this.resizable=!0),this._fire("activate")),!!t};const U_={__depends__:[rc],__init__:["directEditing"],directEditing:["type",Tn]};function a2(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===Be(e);return!o||!a||!s||!c}}const s2={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=s2[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var c2=[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")],u2=[q("none-start-event",{actionName:"replace-with-none-start"}),q("none-intermediate-throwing"),q("none-end-event",{actionName:"replace-with-none-end"})],l2=[q("none-start-event",{actionName:"replace-with-none-start"}),q("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),q("none-end-event",{actionName:"replace-with-none-end"}),q("message-intermediate-catch"),q("message-intermediate-throw"),q("timer-intermediate-catch"),q("escalation-intermediate-throw"),q("conditional-intermediate-catch"),q("link-intermediate-catch"),q("link-intermediate-throw"),q("compensation-intermediate-throw"),q("signal-intermediate-catch"),q("signal-intermediate-throw")],p2=[q("none-start-event",{actionName:"replace-with-none-start"}),q("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),q("none-end-event",{actionName:"replace-with-none-end"}),q("message-end"),q("escalation-end"),q("error-end"),q("cancel-end"),q("compensation-end"),q("signal-end"),q("terminate-end")],f2=[q("exclusive-gateway"),q("parallel-gateway"),q("inclusive-gateway"),q("complex-gateway"),q("event-based-gateway")],d2=[q("transaction"),q("event-subprocess"),q("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),q("collapsed-subprocess")],h2=[q("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),q("transaction"),q("event-subprocess"),q("collapsed-ad-hoc-subprocess")],q_=[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")],m2=q_,Y_=[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"})],g2=[q("data-store-reference")],y2=[q("data-object-reference")],v2=[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")],_2=[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")],b2=[{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"}],x2=[q("expanded-pool"),q("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],E2={"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 K_={"start-event-non-interrupting":`
|
|
315
|
+
</svg>`},MM=900;function ko(e,t,n,i){e.registerProvider(MM,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}ko.$inject=["contextPad","popupMenu","translate","canvas"],ko.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&D(t,this._getEntries(e)),t},ko.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},ko.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${y_.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)}}}}},ko.prototype._getMenuPosition=function(e){var t=5,n=this._contextPad.getPad(e).html,i=n.getBoundingClientRect(),r={x:i.left,y:i.bottom+t};return r};var kM=["left","center","right","top","middle","bottom"];function Ia(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}Ia.$inject=["popupMenu","alignElements","translate","rules"],Ia.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&D(t,this._getEntries(e)),t},Ia.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Ia.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return M(kM,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:y_[o],action:function(){t.trigger(e,o),i.close()}}}),r};function Zc(e){Gn.call(this,e)}Zc.$inject=["eventBus"],ie(Zc,Gn),Zc.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=bs(n),n.length<2?!1:n})};const DM={__depends__:[VT,Av,uf],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",ko],alignElementsMenuProvider:["type",Ia],bpmnAlignElements:["type",Zc]};function ji(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=Eu(Zr(a.closure.topLevel)),c=a.hints,u=c?c.autoResize:!0;if(u!==!1){var l=Qr(s,function(p){return p.parent.id});M(l,function(p,f){ge(u)&&(p=p.filter(function(d){return at(u,Jr({id:d.id}))})),r._expand(p,f)})}}),this.postExecuted(["shape.toggleCollapse"],function(o){var a=o.context,s=a.hints,c=a.shape;s&&s.autoResize===!1||c.collapsed||r._expand(c.children||[],c)}),this.postExecuted(["shape.resize"],function(o){var a=o.context,s=a.hints,c=a.shape,u=c.parent;s&&s.autoResize===!1||u&&r._expand([c],u)})}ji.$inject=["eventBus","elementRegistry","modeling","rules"],ie(ji,Y),ji.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=me(Ct(e)),o=me(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),ws(D({},o,a))},ji.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(OM(i,t)){var r=LM(ei(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},ji.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},ji.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},ji.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function OM(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function LM(e,t){var n="";return e=me(e),t=me(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(ji,this)}Qc.$inject=["injector"],ie(Qc,ji),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 Na(e){Gn.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}Na.$inject=["eventBus"],ie(Na,Gn),Na.prototype.canResize=function(e,t){return!1};function Jc(e,t){Na.call(this,e),this._modeling=t}ie(Jc,Na),Jc.$inject=["eventBus","modeling"],Jc.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")||ke(i)){n=!1;return}}),n};const IM={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Qc],bpmnAutoResizeProvider:["type",Jc]};function Do(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()})}Do.$inject=["config.autoScroll","eventBus","canvas"],Do.prototype.startScroll=function(e){var t=this._canvas,n=this._opts,i=this,r=t.getContainer().getBoundingClientRect(),o=[e.x,e.y,r.width-e.x,r.height-e.y];this.stopScroll();for(var a=0,s=0,c=0;c<4;c++)NM(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 NM(e,t,n){return t<e&&e<n}Do.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Do.prototype.setOptions=function(e){this._opts=D({},this._opts,e)},Do.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Nr(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const BM={__depends__:[Oi],__init__:["autoScroll"],autoScroll:["type",Do]};var v_="djs-bendpoint",__="djs-segment-dragger";function $M(e,t){var n=Nr(t),i=e._container.getBoundingClientRect(),r;r={x:i.left,y:i.top};var o=e.viewbox();return{x:o.x+(n.x-r.x)/o.scale,y:o.y+(n.y-r.y)/o.scale}}function lf(e,t,n){var i=$M(e,n),r=Al(t,i);return r}function pf(e,t){var n=pe("g");$e(n).add(v_),Se(e,n);var i=pe("circle");re(i,{cx:0,cy:0,r:4}),$e(i).add("djs-visual"),Se(n,i);var r=pe("circle");return re(r,{cx:0,cy:0,r:10}),$e(r).add("djs-hit"),Se(n,r),t&&$e(n).add(t),n}function jM(e,t,n,i){var r=pe("g");Se(e,r);var o=18,a=6,s=11,c=HM(t,n,i),u=a+s,l=pe("rect");re(l,{x:-o/2,y:-a/2,width:o,height:a}),$e(l).add("djs-visual"),Se(r,l);var p=pe("rect");return re(p,{x:-c/2,y:-u/2,width:c,height:u}),$e(p).add("djs-hit"),Se(r,p),Uh(r,i==="v"?90:0),r}function b_(e,t,n){var i=pe("g"),r=il(t,n),o=Pi(t,n);return Se(e,i),jM(i,t,n,o),$e(i).add(__),$e(i).add(o==="h"?"horizontal":"vertical"),Qt(i,r.x,r.y),i}function ff(e){return Math.abs(Math.round(e*2/3))}function FM(e,t){var n=zM(e,t);return Ll(e,n)}function HM(e,t,n){var i=t.x-e.x,r=t.y-e.y;return ff(n==="h"?i:r)}function zM(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=Dm(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function x_(e,t,n,i,r){function o(x,b,w){var T=x.index,L=x.point,A,F,H,N,z,ue;return T<=0||x.bendpoint?!1:(A=b[T-1],F=b[T],H=il(A,F),N=Pi(A,F),z=Math.abs(L.x-H.x),ue=Math.abs(L.y-H.y),N&&z<=w&&ue<=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=Pi(T.start,T.end),!L)?null:(L==="h"?A=T.end.x-T.start.x:A=T.end.y-T.start.y,F=ff(A)/2,F)}function s(x,b){var w=b.waypoints,T=lf(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){we.bind(x,b,function(T){n.triggerMouseEvent(b,T,w),T.stopPropagation()})}function u(x,b){var w=t.getLayer("overlays"),T=et('.djs-bendpoints[data-element-id="'+Ma(x.id)+'"]',w);return!T&&b&&(T=pe("g"),re(T,{"data-element-id":x.id}),$e(T).add("djs-bendpoints"),Se(w,T),c(T,"mousedown",x),c(T,"click",x),c(T,"dblclick",x)),T}function l(x,b){return et('.djs-segment-dragger[data-segment-idx="'+x+'"]',b)}function p(x,b){b.waypoints.forEach(function(w,T){var L=pf(x);Se(x,L),Qt(L,w.x,w.y)}),pf(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],Pi(T,L)&&(A=b_(x,T,L),re(A,{"data-segment-idx":F}),c(A,"mousemove",b))}function d(x){M(gs("."+v_,x),function(b){Nt(b)})}function h(x){M(gs("."+__,x),function(b){Nt(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=et(".floating",x),T=b.point;w&&(Qt(w,T.x,T.y),$e(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=il(L,A),N=Pi(L,A),z,ue;T&&(z=VM(T),ue={x:F.x-H.x,y:F.y-H.y},N==="v"&&(ue={x:ue.y,y:ue.x}),Qt(z,ue.x,ue.y))}e.on("connection.changed",function(x){g(x.element)}),e.on("connection.remove",function(x){var b=u(x.element);b&&Nt(b)}),e.on("element.marker.update",function(x){var b=x.element,w;b.waypoints&&(w=m(b),x.add?$e(w).add(x.marker):$e(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=lf(t,w,x.originalEvent),!L)return;S(T,L),L.bendpoint||E(T,L,w)}}),e.on("element.mousedown",function(x){if(ar(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=et(".floating",w);T&&$e(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}x_.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function VM(e){return et(".djs-visual",e)}var E_=Math.round,Gr="reconnectStart",Wr="reconnectEnd",Ba="updateWaypoints";function df(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=Gr:!u&&c===d.length-1?h=Wr:h=Ba;var m=h===Ba?"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===Ba?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(h,{connection:c,source:f===Gr?p:u,target:f===Wr?p:l}),d){s.source=f===Gr?p:u,s.target=f===Wr?p:l;return}d===!1&&(d=s.allowed=r.allowed(h,{connection:c,source:f===Wr?p:l,target:f===Gr?p:u})),d&&(s.source=f===Wr?p:l,s.target=f===Gr?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!==Ba&&(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:E_(a.x),y:E_(a.y)};if(!c)return!1;m===Ba?(p?f.splice(u,0,S):f[u]=S,g.bendpointMove={insert:p,bendpointIndex:u},f=this.cropWaypoints(l,f),o.updateWaypoints(l,a1(f),g)):(m===Gr?(g.docking="source",eu(s)&&(g.docking="target",g.newWaypoints=f.reverse())):m===Wr&&(g.docking="target",eu(s)&&(g.docking="source",g.newWaypoints=f.reverse())),o.reconnect(l,d,h,S,g))},this)}df.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],df.prototype.cropWaypoints=function(e,t){var n=this._injector.get("connectionDocking",!1);if(!n)return t;var i=e.waypoints;return e.waypoints=t,e.waypoints=n.getCroppedWaypoints(e),t=e.waypoints,e.waypoints=i,t};function eu(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===Gr)return t&&i&&t===i&&n!==i;if(r===Wr)return t&&n&&t===n&&n!==i}var GM="reconnectStart",WM="reconnectEnd",w_="updateWaypoints",$a="connect-ok",tu="connect-not-ok",S_="connect-hover",R_="djs-updating",C_="djs-dragging",P_=1100;function A_(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=pf(i.getLayer("overlays"));$e(f).add("djs-dragging"),i.addMarker(c,C_),i.addMarker(c,R_)}),n.on("bendpoint.move.hover",function(o){var a=o.context,s=a.allowed,c=a.hover,u=a.type;if(c){if(i.addMarker(c,S_),u===w_)return;s?(i.removeMarker(c,tu),i.addMarker(c,$a)):s===!1&&(i.removeMarker(c,$a),i.addMarker(c,tu))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],P_,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,S_),i.removeMarker(s,c?$a:tu))}),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===GM?eu(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===WM?eu(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===w_&&(m=e.cropWaypoints(f,m)),E.waypoints=m,r.drawPreview(a,s,E)),Qt(u,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],P_,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,u=a.hover,l=a.target,p=a.waypoints;s.waypoints=p,Nt(c),i.removeMarker(s,R_),i.removeMarker(s,C_),u&&(i.removeMarker(u,$a),i.removeMarker(u,l?$a:tu)),r&&r.cleanUp(a)})}A_.$inject=["bendpointMove","injector","eventBus","canvas"];var T_="connect-hover",M_="djs-updating";function k_(e,t,n){return hf(e,t,e[t]+n)}function hf(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function UM(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 hf(t,i,s)}function D_(e){return e==="x"?"y":"x"}function O_(e,t,n){var i,r;return e.original?e.original:(i=ye(t),r=D_(n),hf(e,r,i[r]))}function L_(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=lf(n,E,p),T,L,A;if(T=Pi(x,b),!!T)return L=T==="v"?"x":"y",g===0&&(x=O_(x,f.source,L)),S===E.length-1&&(b=O_(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:S,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],S=p.segmentEndIndex+f,E=h[S],x=D_(p.axis),b=UM(d,g,E,x);Qt(p.draggerGfx,b.x,b.y)}function l(p,f){var d=0,h=p.filter(function(m,g){return nl(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=b_(h,f.segmentStart,f.segmentEnd),$e(f.draggerGfx).add("djs-dragging"),n.addMarker(d,M_)}),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=k_(g,E,p["d"+E]),w=k_(S,E,p["d"+E]),T=x.length,L=0;x[h]=b,x[m]=w;var A,F;h<2&&(A=Zt(d.source,b),h===1?A==="intersect"&&(x.shift(),x[0]=b,L--):A!=="intersect"&&(x.unshift(g),L++)),m>T-3&&(F=Zt(d.target,w),m===T-2?F==="intersect"&&(x.pop(),x[x.length-1]=w):F!=="intersect"&&x.push(S)),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,T_)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,T_)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,d=f.connection;f.draggerGfx&&Nt(f.draggerGfx),n.removeMarker(d,M_)}),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)})}L_.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var qM=Math.abs,I_=Math.round;function YM(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],qM(r-e)<=n)return r}function N_(e){return{x:e.x,y:e.y}}function B_(e){return{x:e.x+e.width,y:e.y+e.height}}function Yn(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:I_(e.x+e.width/2),y:I_(e.y+e.height/2)}}function Oo(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function Mt(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 $_(e){return e.children||[]}var KM=Math.abs,j_=Math.round,mf=10;function F_(e){function t(o,a){if(ge(o)){for(var s=o.length;s--;)if(KM(o[s]-a)<=mf)return o[s]}else{o=+o;var c=a%o;if(c<mf)return a-c;if(c>o-mf)return a-c+o}return a}function n(o,a){if(o.waypoints)return FM(a,o);if(o.width)return{x:j_(o.width/2+o.x),y:j_(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)&&Mt(o,"x",u),(f||a.horizontal.indexOf(c)!==-1)&&Mt(o,"y",l)}});function r(o){var a=o.snapPoints,s=o.connection.waypoints,c=o.bendpointIndex;if(a)return a;var u=[s[c-1],s[c+1]];return o.snapPoints=a={horizontal:[],vertical:[]},M(u,function(l){l&&(l=l.original||l,a.horizontal.push(l.y),a.vertical.push(l.x))}),a}e.on(["connect.hover","connect.move","connect.end"],1500,function(o){var a=o.context,s=a.hover,c=s&&n(s,o);!it(s)||!c||!c.x||!c.y||(Mt(o,"x",c.x),Mt(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)&&Mt(o,"x",f),(m||s.horizontal.indexOf(p)!==-1)&&Mt(o,"y",d)}})}F_.$inject=["eventBus"];const XM={__depends__:[Oi,yi],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",x_],bendpointMove:["type",df],bendpointMovePreview:["type",A_],connectionSegmentMove:["type",L_],bendpointSnapping:["type",F_]};function H_(e,t,n,i){function r(a,s){return i.allowed("connection.create",{source:a,target:s})}function o(a,s){return r(s,a)}e.on("connect.hover",function(a){var s=a.context,c=s.start,u=a.hover,l;if(s.hover=u,l=s.canExecute=r(c,u),!Xr(l)){if(l!==!1){s.source=c,s.target=u;return}l=s.canExecute=o(c,u),!Xr(l)&&l!==!1&&(s.source=u,s.target=c)}}),e.on(["connect.out","connect.cleanup"],function(a){var s=a.context;s.hover=null,s.source=null,s.target=null,s.canExecute=!1}),e.on("connect.end",function(a){var s=a.context,c=s.canExecute,u=s.connectionStart,l={x:a.x,y:a.y},p=s.source,f=s.target;if(!c)return!1;var d=null,h={connectionStart:gf(s)?l:u,connectionEnd:gf(s)?u:l};zt(c)&&(d=c),s.connection=n.connect(p,f,d,h)}),this.start=function(a,s,c,u){zt(c)||(u=c,c=ye(s)),t.init(a,"connect",{autoActivate:u,data:{shape:s,context:{start:s,connectionStart:c}}})}}H_.$inject=["eventBus","dragging","modeling","rules"];function gf(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var ZM=1100,QM=900,z_="connect-ok",V_="connect-not-ok";function G_(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;gf(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?z_:V_)}),t.on(["connect.out","connect.cleanup"],ZM,function(r){var o=r.hover;o&&(n.removeMarker(o,z_),n.removeMarker(o,V_))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}G_.$inject=["injector","eventBus","canvas"];const yf={__depends__:[Wn,yi,Oi],__init__:["connectPreview"],connect:["type",H_],connectPreview:["type",G_]};var JM="djs-dragger";function Fi(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)}Fi.$inject=["injector","canvas","graphicsFactory","elementFactory"],Fi.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()),ys(i),r||(r=e.getConnection=e2(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?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)"})},Fi.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]);Se(e,s)},Fi.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]},Fi.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&Nt(e.connectionPreviewGfx)},Fi.prototype.getConnection=function(e){var t=t2(e);return this._elementFactory.createConnection(t)},Fi.prototype.createConnectionPreviewGfx=function(){var e=pe("g");return re(e,{pointerEvents:"none"}),$e(e).add(JM),Se(this._canvas.getActiveLayer(),e),e},Fi.prototype.createNoopConnection=function(e,t){return Yo([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function e2(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 t2(e){return zt(e)?e:{}}const n2={__init__:["connectionPreview"],connectionPreview:["type",Fi]},nu="complex-preview";class W_{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(nu);n.filter(s=>!i2(s)).forEach(s=>{let c;it(s)?(c=this._graphicsFactory._createContainer("connection",pe("g")),this._graphicsFactory.drawConnection(Or(c),s)):(c=this._graphicsFactory._createContainer("shape",pe("g")),this._graphicsFactory.drawShape(Or(c),s),Qt(c,s.x,s.y)),this._previewSupport.addDragger(s,a,c)}),i.forEach(({element:s,delta:c})=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"]);const u=this._previewSupport.addDragger(s,a);it(s)?Qt(u,c.x,c.y):Qt(u,s.x+c.x,s.y+c.y)}),r.forEach(s=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"])}),o.forEach(({shape:s,bounds:c})=>{this._canvas.addMarker(s,"djs-hidden"),this._markers.push([s,"djs-hidden"]),this._previewSupport.addDragger(s,a,void 0,"djs-dragging");const u=this._graphicsFactory._createContainer("shape",pe("g"));this._graphicsFactory.drawShape(Or(u),s,{width:c.width,height:c.height}),Qt(u,c.x,c.y),this._previewSupport.addDragger(s,a,u)})}cleanUp(){ys(this._canvas.getLayer(nu)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(nu)}hide(){this._canvas.hideLayer(nu)}}W_.$inject=["canvas","graphicsFactory","previewSupport"];function i2(e){return e.hidden}const r2={__depends__:[wo],__init__:["complexPreview"],complexPreview:["type",W_]},U_=Math.round;function iu(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}iu.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-U_(u.width/2),y:l.y-U_(u.height/2)});const p=c.allowed("connection.create",{source:e,target:u,hints:{targetParent:e.parent}});let f=null;p&&(f=o.createConnection(p),f.waypoints=s.layoutConnection(f,{source:e,target:u}),f.waypoints=r.getCroppedWaypoints(f,e,u)),i.create({created:[u,f].filter(d=>!Xr(d))})},iu.prototype.cleanUp=function(){this._complexPreview.cleanUp()},iu.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const o2={__depends__:[Mc,r2,zp],__init__:["appendPreview"],appendPreview:["type",iu]};var q_=Math.min,Y_=Math.max;function vf(e){e.preventDefault()}function ja(e){e.stopPropagation()}function a2(e){return e.nodeType===Node.TEXT_NODE}function s2(e){return[].slice.call(e)}function ni(e){this.container=e.container,this.parent=ut('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=et("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=gn(this.autoResize,this),this.handlePaste=gn(this.handlePaste,this)}ni.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=ei(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=ei(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,we.bind(a,"keydown",this.keyHandler),we.bind(a,"mousedown",ja),we.bind(a,"paste",r.handlePaste),we.bind(a,"focusout",this.focusoutHandler),i.autoResize&&we.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},ni.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)}},ni.prototype.insertText=function(e){e=c2(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},ni.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=s2(a.childNodes),c,u;if(a2(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&&pi(h)}),c=n,u=r+e.length}c&&u!==void 0&&setTimeout(function(){self.setSelection(c,u)})},ni.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})}},ni.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,i=parseInt(this.style.minWidth)||0,r=parseInt(this.style.minHeight)||0,o=parseInt(this.style.maxWidth)||1/0,a=parseInt(this.style.maxHeight)||1/0;if(!n){n=this.resizeHandle=ut('<div class="djs-direct-editing-resize-handle"></div>');var s,c,u,l,p=function(h){vf(h),ja(h),s=h.clientX,c=h.clientY;var m=t.getBoundingClientRect();u=m.width,l=m.height,we.bind(document,"mousemove",f),we.bind(document,"mouseup",d)},f=function(h){vf(h),ja(h);var m=q_(Y_(u+h.clientX-s,i),o),g=q_(Y_(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){vf(h),ja(h),we.unbind(document,"mousemove",f,!1),we.unbind(document,"mouseup",d,!1)};we.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)},ni.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),we.unbind(t,"keydown",this.keyHandler),we.unbind(t,"mousedown",ja),we.unbind(t,"input",this.autoResize),we.unbind(t,"paste",this.handlePaste),we.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),pi(n)),pi(e)},ni.prototype.getValue=function(){return this.content.innerText.trim()},ni.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},ni.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 c2(e){return e.replace(/\r\n|\r|\n/g,`
|
|
316
|
+
`)}function Mn(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new ni({container:t.getContainer(),keyHandler:gn(this._handleKey,this),resizeHandler:gn(this._handleResize,this),focusoutHandler:gn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}Mn.$inject=["eventBus","canvas"],Mn.prototype.registerProvider=function(e){this._providers.push(e)},Mn.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},Mn.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},Mn.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},Mn.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},Mn.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},Mn.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()}},Mn.prototype.getValue=function(){return this._textbox.getValue()},Mn.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()},Mn.prototype._handleResize=function(e){this._fire("resize",e)},Mn.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},Mn.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=at(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 K_={__depends__:[ac],__init__:["directEditing"],directEditing:["type",Mn]};function u2(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===Be(e);return!o||!a||!s||!c}}const l2={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=l2[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var p2=[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")],f2=[q("none-start-event",{actionName:"replace-with-none-start"}),q("none-intermediate-throwing"),q("none-end-event",{actionName:"replace-with-none-end"})],d2=[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")],h2=[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")],m2=[q("exclusive-gateway"),q("parallel-gateway"),q("inclusive-gateway"),q("complex-gateway"),q("event-based-gateway")],g2=[q("transaction"),q("event-subprocess"),q("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),q("collapsed-subprocess")],y2=[q("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),q("transaction"),q("event-subprocess"),q("collapsed-ad-hoc-subprocess")],X_=[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")],v2=X_,Z_=[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"})],_2=[q("data-store-reference")],b2=[q("data-object-reference")],x2=[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")],E2=[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")],w2=[{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"}],S2=[q("expanded-pool"),q("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],R2={"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 Q_={"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 Yn(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()}Yn.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Yn.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Yn.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=a2(e);return v(t,"bpmn:DataObjectReference")?this._createEntries(e,g2):v(t,"bpmn:DataStoreReference")&&!v(e.parent,"bpmn:Collaboration")?this._createEntries(e,y2):(v(t,"bpmn:Event")&&!v(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=E2[r]||[],!sn(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(c2.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:Participant")?(o=Oe(x2,function(c){return Be(e)!==c.target.isExpanded}),this._createEntries(e,o)):v(t,"bpmn:StartEvent")&&sn(t.$parent)?(o=Oe(_2.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")&&!sn(t.$parent)&&v(t.$parent,"bpmn:SubProcess")?(o=Oe(u2.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:EndEvent")?(o=Oe(p2.concat(i),function(c){var u=c.target;return u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!v(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,o)):v(t,"bpmn:BoundaryEvent")?(o=Oe(v2,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(l2.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:Gateway")?(o=Oe(f2,a),this._createEntries(e,o)):v(t,"bpmn:Transaction")?(o=Oe(q_,a),this._createEntries(e,o)):sn(t)&&Be(e)?(o=Oe(m2,a),this._createEntries(e,o)):v(t,"bpmn:AdHocSubProcess")&&Be(e)?(o=Oe(h2,a),this._createEntries(e,o)):v(t,"bpmn:SubProcess")&&Be(e)?(o=Oe(d2,a),this._createEntries(e,o)):v(t,"bpmn:SubProcess")&&!Be(e)?(o=Oe(Y_,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,b2):v(t,"bpmn:FlowNode")?(o=Oe(Y_,a),this._createEntries(e,o)):{})},Yn.prototype.getPopupMenuHeaderEntries=function(e){var t={};return v(e,"bpmn:Activity")&&!sn(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),v(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),v(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),Gm(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Yn.prototype._createEntries=function(e,t){var n={},i=this;return M(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},Yn.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},Yn.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}},Yn.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"}}}},Yn.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}}},Yn.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}}},Yn.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=K(e),i=this,r=Wm(e),o=v(e,"bpmn:BoundaryEvent")?K_["intermediate-event-non-interrupting"]:K_["start-event-non-interrupting"],a=!n[r];return{"toggle-non-interrupting":{imageHtml:o,title:t("Toggle non-interrupting"),active:a,action:function(){i._modeling.updateProperties(e,{[r]:!!a})}}}};const w2={__depends__:[uf,py,Ac],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Yn]};function ja(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(!(!la(d)||!i.isOpen(m))){var g=i.getEntries(m);g.replace&&g.replace.action.click(d,m)}}),n.on("contextPad.close",function(){f.cleanUp()})}ja.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],ja.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},ja.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return ge(t)?Er(e,n=>t.includes(n)):t},ja.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(De(p,["bpmn:Lane","bpmn:Participant"])&&Be(e)){var E=nr(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&&((Gt(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)}}}),(Gt(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"})}):X_(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&&!X_(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!sn(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"))}),De(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}}}),De(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 X_(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 S2={__depends__:[n2,U_,Rv,Gn,yf,ac,w2],__init__:["contextPadProvider"],contextPadProvider:["type",ja]};var R2={horizontal:["x","width"],vertical:["y","height"]},Z_=5;function ji(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:[]})}ji.$inject=["modeling","rules"],ji.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},ji.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},ji.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},ji.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=ri(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},ji.prototype._setOrientation=function(e){var t=R2[e];this._axis=t[0],this._dimension=t[1]},ji.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)},ji.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+Z_,max:t+n-Z_}};const C2={__init__:["distributeElements"],distributeElements:["type",ji]};function nu(e){Vn.call(this,e)}nu.$inject=["eventBus"],ie(nu,Vn),nu.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=Oe(t,function(n){var i=De(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=vs(t),t.length<3?!1:t})};var Q_={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
|
|
327
|
+
</svg>`};function Kn(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()}Kn.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Kn.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Kn.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=u2(e);return v(t,"bpmn:DataObjectReference")?this._createEntries(e,_2):v(t,"bpmn:DataStoreReference")&&!v(e.parent,"bpmn:Collaboration")?this._createEntries(e,b2):(v(t,"bpmn:Event")&&!v(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=R2[r]||[],!cn(t.$parent)&&v(t.$parent,"bpmn:SubProcess")&&(i=Oe(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),v(t,"bpmn:StartEvent")&&!v(t.$parent,"bpmn:SubProcess")?(o=Oe(p2.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:Participant")?(o=Oe(S2,function(c){return Be(e)!==c.target.isExpanded}),this._createEntries(e,o)):v(t,"bpmn:StartEvent")&&cn(t.$parent)?(o=Oe(E2.concat(i),function(c){var u=c.target,l=u.isInterrupting!==!1,p=t.isInterrupting===l;return a(c)||!a(c)&&!p}),this._createEntries(e,o)):v(t,"bpmn:StartEvent")&&!cn(t.$parent)&&v(t.$parent,"bpmn:SubProcess")?(o=Oe(f2.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:EndEvent")?(o=Oe(h2.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(x2,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(d2.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:Gateway")?(o=Oe(m2,a),this._createEntries(e,o)):v(t,"bpmn:Transaction")?(o=Oe(X_,a),this._createEntries(e,o)):cn(t)&&Be(e)?(o=Oe(v2,a),this._createEntries(e,o)):v(t,"bpmn:AdHocSubProcess")&&Be(e)?(o=Oe(y2,a),this._createEntries(e,o)):v(t,"bpmn:SubProcess")&&Be(e)?(o=Oe(g2,a),this._createEntries(e,o)):v(t,"bpmn:SubProcess")&&!Be(e)?(o=Oe(Z_,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,w2):v(t,"bpmn:FlowNode")?(o=Oe(Z_,a),this._createEntries(e,o)):{})},Kn.prototype.getPopupMenuHeaderEntries=function(e){var t={};return v(e,"bpmn:Activity")&&!cn(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),v(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),v(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),qm(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Kn.prototype._createEntries=function(e,t){var n={},i=this;return M(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},Kn.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},Kn.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}},Kn.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"}}}},Kn.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}}},Kn.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}}},Kn.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=K(e),i=this,r=Ym(e),o=v(e,"bpmn:BoundaryEvent")?Q_["intermediate-event-non-interrupting"]:Q_["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 C2={__depends__:[uf,hy,Mc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Kn]};function Fa(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(!(!pa(d)||!i.isOpen(m))){var g=i.getEntries(m);g.replace&&g.replace.action.click(d,m)}}),n.on("contextPad.close",function(){f.cleanUp()})}Fa.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Fa.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&D(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},Fa.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return ge(t)?Sr(e,n=>t.includes(n)):t},Fa.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,r=this._connect,o=this._create,a=this._popupMenu,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 S(x){return function(b,w){n.splitLane(w,x),t.open(w,!0)}}if(De(p,["bpmn:Lane","bpmn:Participant"])&&Be(e)){var E=rr(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&&((Gt(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)}}}),(Gt(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 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"})}):J_(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&&!J_(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!cn(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"))}),De(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}}}),De(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 J_(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 P2={__depends__:[o2,K_,Av,Wn,yf,cc,C2],__init__:["contextPadProvider"],contextPadProvider:["type",Fa]};var A2={horizontal:["x","width"],vertical:["y","height"]},eb=5;function Hi(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:[]})}Hi.$inject=["modeling","rules"],Hi.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},Hi.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},Hi.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},Hi.prototype._createGroups=function(e){var t=[],n=this,i=this._axis,r=this._dimension;if(!i)throw new Error('must have a defined "axis" and "dimension"');var o=oi(e,i);return M(o,function(a,s){var c=n._findRange(a,i,r),u,l=t[t.length-1];l&&n._hasIntersection(l.range,c)?t[t.length-1].elements.push(a):(u={range:c,elements:[a]},t.push(u))}),t},Hi.prototype._setOrientation=function(e){var t=A2[e];this._axis=t[0],this._dimension=t[1]},Hi.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)},Hi.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+eb,max:t+n-eb}};const T2={__init__:["distributeElements"],distributeElements:["type",Hi]};function ru(e){Gn.call(this,e)}ru.$inject=["eventBus"],ie(ru,Gn),ru.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=Oe(t,function(n){var i=De(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=bs(t),t.length<3?!1:t})};var tb={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>`},P2=900;function Fa(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",P2,this)}Fa.$inject=["popupMenu","distributeElements","translate","rules"],Fa.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&D(t,this._getEntries(e)),t},Fa.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Fa.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:Q_.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:Q_.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const A2={__depends__:[uf,C2],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",nu],distributeElementsMenuProvider:["type",Fa]};var J_="is not a registered action",T2="is already registered";function Kn(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}Kn.$inject=["eventBus","injector"],Kn.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)})},Kn.prototype.trigger=function(e,t){if(!this._actions[e])throw _f(e,J_);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},Kn.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)})},Kn.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw _f(e,T2);this._actions[e]=t},Kn.prototype.unregister=function(e){if(!this.isRegistered(e))throw _f(e,J_);this._actions[e]=void 0},Kn.prototype.getActions=function(){return Object.keys(this._actions)},Kn.prototype.isRegistered=function(e){return!!this._actions[e]};function _f(e,t){return new Error(e+" "+t)}const M2={__init__:["editorActions"],editorActions:["type",Kn]};function iu(e){e.invoke(Kn,this)}ie(iu,Kn),iu.$inject=["injector"],iu.prototype._registerDefaultActions=function(e){Kn.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 k2={__depends__:[M2],editorActions:["type",iu]};function eb(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;De(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}eb.$inject=["eventBus"];function Gr(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;vn(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}Gr.$inject=["eventBus","gridSnapping","modeling"],ie(Gr,Y),Gr.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},Gr.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},Gr.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},Gr.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 D2=2e3;function tb(e,t){e.on(["spaceTool.move","spaceTool.end"],D2,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)}})}tb.$inject=["eventBus","gridSnapping"];const O2={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Gr],gridSnappingSpaceToolBehavior:["type",tb]};var ru=10;function bf(e,t,n){return n||(n="round"),Math[n](e/t)*t}var L2=1200,I2=800;function mr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",I2,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"],L2,function(o){var a=o.originalEvent;if(!(!r.active||a&&Rn(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(u){var l={},p=B2(o,u,e);p&&(l.offset=p);var f=N2(o,u);f&&D(l,f),Do(o,u)||r.snapEvent(o,u,l)})}})}mr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);Tt(e,t,i)},mr.prototype.getGridSpacing=function(){return ru},mr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=bf(e,ru);var i,r;return t&&t.min&&(i=t.min,xe(i)&&(i=bf(i+n,ru,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,xe(r)&&(r=bf(r+n,ru,"floor"),e=Math.min(e,r))),e-=n,e},mr.prototype.isActive=function(){return this.active},mr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},mr.prototype.toggleActive=function(){this.setActive(!this.active)},mr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function N2(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&&(ou(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&&(ou(t)?ib(s)?a.x.max=c.left:a.x.min=c.right:nb(s)?a.y.max=c.top:a.y.min=c.bottom),u&&(ou(t)?ib(s)?a.x.min=u.left:a.x.max=u.right:nb(s)?a.y.min=u.top:a.y.max=u.bottom),a[t]}function B2(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)||(ou(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 ou(e){return e==="x"}function nb(e){return e.indexOf("n")!==-1}function ib(e){return e.indexOf("w")!==-1}const $2={__depends__:[O2],__init__:["gridSnapping"],gridSnapping:["type",mr]};var j2=2e3;function rb(e,t,n){e.on("autoPlace",j2,function(i){var r=i.source,o=ye(r),a=i.shape,s=iv(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")&&(F2(c)?u.offset=-a.width/2:u.offset=-a.height/2),s[c]=t.snapValue(s[c],u))}),s})}rb.$inject=["eventBus","gridSnapping","elementRegistry"];function F2(e){return e==="x"}var H2=1750;function ob(e,t,n){t.on(["create.start","shape.move.start"],H2,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}))}})}ob.$inject=["canvas","eventBus","gridSnapping"];var z2=3e3;function au(e,t,n){Y.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],z2,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||V2(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}au.$inject=["eventBus","gridSnapping","modeling"],ie(au,Y),au.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=U2(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function V2(e){return e.length>3}function G2(e){return e==="h"}function W2(e){return e==="v"}function U2(e,t,n){var i=Ri(t,n),r={};return G2(i)&&(r.y=e.snapValue(t.y)),W2(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=D({},t,r),n=D({},n,r)),[t,n]}const q2={__depends__:[$2,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",rb],gridSnappingParticipantBehavior:["type",ob],gridSnappingLayoutConnectionBehavior:["type",au]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",eb]};var Y2=30,ab=30;function Ha(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 Be(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(v(r,"bpmn:SubProcess"))return Be(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}Ha.$inject=["eventBus","interactionEvents"],Ha.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Ha.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=Gt(e)?{width:Y2,height:e.height}:{width:e.width,height:ab};return this._interactionEvents.createBoxHit(t,"all",n),!0},Ha.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:ab}),!0};const K2={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Ha]};function su(e){e.invoke(Ro,this)}ie(su,Ro),su.$inject=["injector"],su.prototype.registerBindings=function(e,t){Ro.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 X2={__depends__:[qp],__init__:["keyboardBindings"],keyboardBindings:["type",su]};var Z2={moveSpeed:1,moveSpeedAccelerated:10},Q2=1500,sb="left",cb="up",ub="right",lb="down",J2={ArrowLeft:sb,Left:sb,ArrowUp:cb,Up:cb,ArrowRight:ub,Right:ub,ArrowDown:lb,Down:lb},ek={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 pb(e,t,n,i,r){var o=this;this._config=D({},Z2,e||{}),t.addListener(Q2,function(a){var s=a.keyEvent,c=J2[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=ek[a](u),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,l)}}}pb.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const tk={__depends__:[qp,Gn],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",pb]};var fb=10;function za(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=ZS(l,p,u),c.newBounds=JS(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:me(l)})}function s(c){var u=c.shape,l=c.canExecute,p=c.newBounds;if(l){if(p=Th(p),!nk(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)})}za.prototype.canResize=function(e){var t=this._rules,n=Jn(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},za.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,db(t,o),"resize",{autoActivate:!0,cursor:ik(o),data:{shape:t,context:r}})},za.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:fb,height:fb},r=gm(t,e.childrenBoxPadding),eR(n,t,i,r)},za.$inject=["eventBus","rules","modeling","dragging"];function nk(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function db(e,t){var n=ye(e),i=me(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 ik(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 hb="djs-resizing",mb="resize-not-ok",rk=500;function gb(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,hb)),s.width>5&&re(c,{x:s.x,width:s.width}),s.height>5&&re(c,{y:s.y,height:s.height}),o.canExecute?$e(c).remove(mb):$e(c).add(mb)}function r(o){var a=o.shape,s=o.frame;s&&It(o.frame),t.removeMarker(a,hb)}e.on("resize.move",rk,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}gb.$inject=["eventBus","canvas","previewSupport"];var cu=-6,uu=8,lu=20,Va="djs-resizer",ok=["n","w","s","e","nw","ne","se","sw"];function gr(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,mn(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}gr.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){rr(o)&&i.activate(o,e,n)}we.bind(t,"mousedown",r),we.bind(t,"touchstart",r)},gr.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=ak(i),a=pe("g");$e(a).add(Va),$e(a).add(Va+"-"+e.id),$e(a).add(Va+"-"+i),Se(r,a);var s=pe("rect");re(s,{x:-uu/2+o.x,y:-uu/2+o.y,width:uu,height:uu}),$e(s).add(Va+"-visual"),Se(a,s);var c=pe("rect");return re(c,{x:-lu/2+o.x,y:-lu/2+o.y,width:lu,height:lu}),$e(c).add(Va+"-hit"),Se(a,c),Ss(a,t,n),a},gr.prototype.createResizer=function(e,t){var n=db(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},gr.prototype.addResizer=function(e){var t=this;it(e)||M(ok,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},gr.prototype.removeResizers=function(){var e=this._getResizersParent();ms(e)},gr.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},gr.$inject=["eventBus","canvas","selection","resize"];function ak(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-cu:e.indexOf("w")!==-1&&(t.x=cu),e.indexOf("s")!==-1?t.y=-cu:e.indexOf("n")!==-1&&(t.y=cu),t}const yb={__depends__:[gi,ki,Eo],__init__:["resize","resizePreview","resizeHandles"],resize:["type",za],resizePreview:["type",gb],resizeHandles:["type",gr]};var sk=2e3;function Ga(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"],sk,function(c){i.isActive(c.element)&&i.cancel()}),e.on(["commandStack.changed"],function(c){i.isActive()&&i.cancel()}),e.on("directEditing.activate",function(c){o.removeResizers()}),e.on("create.end",500,function(c){var u=c.context,l=u.shape,p=c.context.canExecute,f=c.isTouch;f||p&&(u.hints&&u.hints.createElementsBehavior===!1||s(l))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,u){(u||De(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}Ga.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Ga.prototype.activate=function(e){var t=In(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}),(De(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||vb(e))&&D(r,{centerVertically:!0}),er(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}},Ga.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")||lk(e)){var h=Gt(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(uk(e)){var g=Gt(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)"})}(De(e,["bpmn:Task","bpmn:CallActivity"])||vb(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"})),ck(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})),er(n)&&!Ps(n)&&!ke(n)){var b=sl(e),w=t.getAbsoluteBBox({x:b.x,y:b.y,width:0,height:0}),T=u,L=Dr.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:co*a+"px",paddingBottom:co*a+"px",paddingLeft:co*a+"px",paddingRight:co*a+"px",fontSize:p+"px",lineHeight:f})),{bounds:o,style:d}},Ga.prototype.update=function(e,t,n,i){var r,o;v(e,"bpmn:TextAnnotation")&&(o=this._canvas.getAbsoluteBBox(e),r={x:e.x,y:e.y,width:e.width/o.width*i.width,height:e.height/o.height*i.height}),pk(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function vb(e){return v(e,"bpmn:SubProcess")&&!Be(e)}function ck(e){return v(e,"bpmn:SubProcess")&&Be(e)}function uk(e){return v(e,"bpmn:Participant")&&!Be(e)}function lk(e){return v(e,"bpmn:Participant")&&Be(e)}function pk(e){return!e||!e.trim()}var _b="djs-element-hidden",bb="djs-label-hidden";function xb(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=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:fk(o)}),Se(s,p),Se(r,s),Zt(s,o.x,o.y)}v(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,_b):(v(o,"bpmn:Task")||v(o,"bpmn:CallActivity")||v(o,"bpmn:SubProcess")||v(o,"bpmn:Participant")||v(o,"bpmn:Lane"))&&t.addMarker(o,bb)}),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,_b),t.removeMarker(o,bb)),o=void 0,a=void 0,s&&(It(s),s=void 0)})}xb.$inject=["eventBus","canvas","pathMap"];function fk(e,t){var n=Ve(e);return n.get("stroke")||t||"black"}const dk={__depends__:[Rp,yb,U_],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Ga],labelEditingPreview:["type",xb]};var hk=500,mk=1e3;function _i(e,t,n){this._eventBus=e,this._elementRegistry=n,this._outlineOffset=5,this._outlineStyle=t.cls("djs-outline",["no-fill"]);var i=this;function r(o){Jw(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"],hk,function(o){var a=o.element,s=o.gfx,c=et(".djs-outline",s);c&&i.updateOutline(a,c)})}_i.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=et(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),Se(t,n),this.updateOutline(e,n)),n},_i.prototype._createOutlineGfx=function(){var e=pe("rect");return re(e,D({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},_i.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},_i.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&M(i,function(r){n=n||r.updateOutline(t,e)}),n||re(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},_i.prototype.updateConnectionOutline=function(e,t){var n=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})},_i.prototype.registerProvider=function(e,t){t||(t=e,e=mk),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},_i.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},_i.prototype.getOutline=function(e){var t,n=this._getProviders();return M(n,function(i){zt(i.getOutline)&&(t=t||i.getOutline(e))}),t},_i.$inject=["eventBus","styles","elementRegistry"];var pu=6;function xf(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)})}xf.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");ms(t);var n=e.length>1,i=this._canvas.getContainer();if($e(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=gk(Rt(e)),o=pe("rect");re(o,D({rx:3},r)),$e(o).add("djs-selection-outline"),Se(t,o)}},xf.$inject=["eventBus","canvas","selection"];function gk(e){return{x:e.x-pu,y:e.y-pu,width:e.width+pu*2,height:e.height+pu*2}}const Ef={__depends__:[Gn],__init__:["outline","multiSelectionOutline"],outline:["type",_i],multiSelectionOutline:["type",xf]},Eb=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],wb={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},yk=15,fu=2;function Sb(e,t,n,i,r){const o=t.getLayer("overlays");e.on(["selection.changed","shape.changed"],function(){s()}),e.on("selection.changed",function({newSelection:p}){var d;const f=p.filter(h=>De(h,Eb));if(f.length===1){const h=f[0];ke(h)?a(h,h.labelTarget):(d=h.labels)!=null&&d.length&&a(h.labels[0],h)}if(f.length===2){const h=f.find(ke),m=f.find(g=>{var R;return(R=g.labels)==null?void 0:R.includes(h)});h&&m&&a(h,m)}}),e.on("shape.changed",function({element:p}){var f;!De(p,Eb)||!l(p)||(ke(p)?a(p,p.labelTarget):(f=p.labels)!=null&&f.length&&a(p.labels[0],p))});function a(p,f){const d=qo([ye(f),ye(p)],wb),h=d.getAttribute("d"),g=r.isSelected(p)?c(p):u(p),R=Zo(g,h);if(!R)return;const x=r.isSelected(f)?c(f):u(f),b=Zo(x,h)||ye(f);sa(b,R)<yk||(Ju(d,[b,R]),Se(o,d))}function s(){hs(`.${wb.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+yr(f,"x")-fu,y:p.y+yr(f,"y")-fu,width:yr(f,"width")+fu*2,height:yr(f,"height")+fu*2};return ul(d,yr(f,"rx"))}if(f.cx){const d=yr(f,"r"),h={x:p.x+yr(f,"cx")-d,y:p.y+yr(f,"cy")-d,width:d*2,height:d*2};return Jh(h)}}function u(p){return n.getShapePath(p)}function l(p){return r.isSelected(p)}}Sb.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function yr(e,t){return parseFloat(re(e,t)||0)}const vk={__depends__:[Gn,Ef],__init__:["labelLink"],labelLink:["type",Sb]};var _k=new xo("tt");function bk(e){var t=ut('<div class="djs-tooltip-container" />');return fn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function xk(e,t,n){fn(e,{left:t+"px",top:n+"px"})}function wf(e,t){e.style.display=t===!1?"none":""}var Rb="djs-tooltip",Sf="."+Rb;function yn(e,t){this._eventBus=e,this._canvas=t,this._ids=_k,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=bk(t.getContainer());var n=this;En.bind(this._tooltipRoot,Sf,"mousedown",function(i){i.stopPropagation()}),En.bind(this._tooltipRoot,Sf,"mouseover",function(i){n.trigger("mouseover",i)}),En.bind(this._tooltipRoot,Sf,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}yn.$inject=["eventBus","canvas"],yn.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},yn.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(on(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},yn.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},yn.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},yn.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)}},yn.prototype.remove=function(e){var t=this.get(e);t&&(li(t.html),li(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},yn.prototype.show=function(){wf(this._tooltipRoot)},yn.prototype.hide=function(){wf(this._tooltipRoot,!1)},yn.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},yn.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)),vn(n)&&(n=ut(n)),i=ut('<div data-tooltip-id="'+t+'" class="'+Rb+'">'),fn(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)},yn.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;xk(n,t.x,t.y)},yn.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),wf(i,r))})},yn.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 Ek={__init__:["tooltips"],tooltips:["type",yn]};var wk="flow elements must be children of pools/participants",Sk="Data object must be placed within a pool/participant.";function Cb(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(wk)):v(a,"bpmn:DataObjectReference")&&i(r,n(Sk)))})}Cb.$inject=["eventBus","tooltips","translate"];const Rk={__depends__:[Ek],__init__:["modelingFeedback"],modelingFeedback:["type",Cb]};var Ck=500,Pk=1250,Ak=1500,du=Math.round;function Tk(e){return{x:e.x+du(e.width/2),y:e.y+du(e.height/2)}}function Pb(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",Ak,function(s){var c=s.context,u=s.shape,l=i.get().slice();l.indexOf(u)===-1&&(l=[u]),l=Mk(l),D(c,{shapes:l,validatedShapes:l,shape:u})}),e.on("shape.move.start",Pk,function(s){var c=s.context,u=c.validatedShapes,l;if(l=c.canExecute=o(u),!l)return!1}),e.on("shape.move.move",Ck,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=du(u.x),u.y=du(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(rr(s)){var c=yo(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,u,l){if(Ht(u)&&(l=u,u=!1),!(c.waypoints||!c.parent)&&!$e(s.target).has("djs-hit-no-move")){var p=Tk(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}Pb.$inject=["eventBus","dragging","modeling","selection","rules"];function Mk(e){var t=Xr(e,"id");return Oe(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var Ab=499,Rf="djs-dragging",Tb="drop-ok",Mb="drop-not-ok",kb="new-parent",Db="attach-ok";function Ob(e,t,n,i){function r(c){var u=o(c),l=kk(u);return l}function o(c){var u=Yo(c),l=u.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),p=u.concat(l),f=[...new Set(p)];return f}function a(c,u){[Db,Tb,Mb,kb].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,Rf),c.allDraggedElements?c.allDraggedElements.push(u):c.allDraggedElements=[u]}e.on("shape.move.start",Ab,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();Se(h,d),u.dragGroup=d}f.forEach(function(m){i.addDragger(m,u.dragGroup)}),p?p=bu([p,o(l)]):p=o(l),M(p,function(m){t.addMarker(m,Rf)}),u.allDraggedElements=p,u.differentParents=Dk(l)}),e.on("shape.move.move",Ab,function(c){var u=c.context,l=u.dragGroup,p=u.target,f=u.shape.parent,d=u.canExecute;p&&(d==="attach"?a(p,Db):u.canExecute&&f&&p.id!==f.id?a(p,kb):a(p,u.canExecute?Tb:Mb)),Zt(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,Rf)}),p&&It(p)}),this.makeDraggable=s}Ob.$inject=["eventBus","canvas","styles","previewSupport"];function kk(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=Oe(e,function(i){return it(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function Dk(e){return Ix(Xr(e,function(t){return t.parent&&t.parent.id}))!==1}const Ok={__depends__:[rc,Gn,Ef,gi,ki,Eo],__init__:["move","movePreview"],move:["type",Pb],movePreview:["type",Ob]};var Lb=".djs-palette-toggle",Ib=".entry",Lk=Lb+", "+Ib,Cf="djs-palette-",Ik="shown",Pf="open",Nb="two-column",Nk=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=Nk),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($k,{})},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=ut(Mt.HTML_MARKUP);n.appendChild(i),ft(n).add(Cf+Ik),En.bind(i,Lk,"click",function(r){var o=r.delegateTarget;if(Gu(o,Lb))return e.toggle();e.trigger("click",r)}),we.bind(i,"mousedown",function(r){r.stopPropagation()}),En.bind(i,Ib,"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(Nb,r),a.toggle(Cf+Nb,r),"open"in e&&(o.toggle(Pf,e.open),a.toggle(Cf+Pf,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},Mt.prototype._update=function(){var e=et(".djs-palette-entries",this._container),t=this._entries=this.getEntries();fs(e),M(t,function(n,i){var r=n.group||"default",o=et("[data-group="+Ta(r)+"]",e);o||(o=ut('<div class="group"></div>'),on(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=ut(a);if(o.appendChild(s),!n.separator&&(on(s,"data-action",i),n.title&&on(s,"title",n.title),n.className&&Bk(s,n.className),n.imageUrl)){var c=ut("<img>");on(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=on(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(zt(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=et(".djs-palette-entries",this._container),this._toolsContainer=et("[data-group=tools]",t)),n=this._toolsContainer,M(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=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(Pf)},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 Bk(e,t){var n=ft(e),i=ge(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function $k(e,t){var n=t.getPaletteEntries();return zt(n)?n(e):(M(n,function(i,r){e[r]=i}),e)}const jk={__init__:["palette"],palette:["type",Mt]};var Bb="crosshair",$b="selected",Fk="djs-dragging-active-lasso";function vr(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}),Se(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,$b);for(const g of h)m.has(g)||t.addMarker(g,$b)}},remove:function(p){this.update(p),p.frame&&It(p.frame),u(!1)}};function u(p){$e(t.getContainer()).toggle(Fk,p)}function l(p){var f=i.getAll();return new Set(Kr(io(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=jb(p),f.add=Zs(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=jb(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(Zs(p))return s.activateLasso(p.originalEvent),!0})}vr.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],vr.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:Bb,data:{context:{}},keepSelection:!0})},vr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:Bb,data:{context:{}},keepSelection:!0})},vr.prototype._select=function(e){this._selection.select(e)},vr.prototype.select=function(e,t,n=[]){var i=Kr(io(e,t));this._select([...n,...i])},vr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},vr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function jb(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 Hk={__depends__:[cc,da],__init__:["lassoTool"],lassoTool:["type",vr]};var Af=1500,Fb="grab";function Oo(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",Af,function(c){if(la(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(Af,function(c){if(!(!Hb(c.keyEvent)||a.isActive())){var u=a._mouse.getLastMoveEvent();a.activateMove(u,!!u)}},"keyboard.keydown"),s&&s.addListener(Af,function(c){!Hb(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!la(c)&&l&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}Oo.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Oo.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:Fb,data:{context:n||{}}})},Oo.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:Fb,data:{context:{reactivate:n}}})},Oo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Oo.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function Hb(e){return Nt("Space",e)}const zk={__depends__:[cc,da],__init__:["handTool"],handTool:["type",Oo]};var zb="connect-ok",Vb="connect-not-ok";function Lo(e,t,n,i,r,o,a){var s=this;this._dragging=t,this._rules=o,this._mouse=a,r.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",function(c){var u=c.context,l=c.hover,p=u.canStartConnect=s.canStartConnect(l);p!==null&&(u.startTarget=l,i.addMarker(l,p?zb:Vb))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var u=c.context.startTarget,l=c.context.canStartConnect;u&&i.removeMarker(u,l?zb:Vb)}),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})}Lo.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Lo.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Lo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Lo.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Lo.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const Vk={__depends__:[yf,gi,ki,cc,da],globalConnect:["type",Lo]};function Tf(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)}Tf.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],Tf.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 Gk={__depends__:[jk,ac,yy,Hk,zk,Vk,ia],__init__:["paletteProvider"],paletteProvider:["type",Tf]};var Wk=250;function Mf(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=et('[data-element-id="'+Ta(f.id)+'"]',s.dragGroup);h&&re(h,{display:"none"});var m=r.addDragger(d,s.dragGroup);s.visualReplacements[l]=m,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;M(c,function(u,l){var p=et('[data-element-id="'+Ta(l)+'"]',s.dragGroup);p&&re(p,{display:"inline"}),u.remove(),c[l]&&delete c[l]})}e.on("shape.move.move",Wk,function(s){var c=s.context,u=c.canExecute;c.visualReplacements||(c.visualReplacements={}),u&&u.replacements?o(c):a(c)})}Mf.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],ie(Mf,Y);const Uk={__depends__:[Eo],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Mf]};var qk=1250,kf=40,Yk=20,Kk=10,Gb=20,Wb=["x","y"],Xk=Math.abs;function Ub(e){e.on(["connect.hover","connect.move","connect.end"],qk,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&Rn(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&Zk(t,o,tD(o)),o&&eD(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=qn(r),De(o,["bpmn:Event","bpmn:Gateway"])&&qb(t,qn(o)),De(o,["bpmn:Task","bpmn:SubProcess"])&&Qk(t,o),v(a,"bpmn:BoundaryEvent")&&s===a.host&&Jk(t)):Yb(i,"bpmn:MessageFlow")?(v(r,"bpmn:Event")&&(n.connectionStart=qn(r)),v(o,"bpmn:Event")&&qb(t,qn(o))):n.connectionStart=n.initialConnectionStart)})}Ub.$inject=["eventBus"];function Zk(e,t,n){Wb.forEach(function(i){var r=Kb(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 Qk(e,t){var n=qn(t);Wb.forEach(function(i){nD(e,t,i)&&Tt(e,i,n[i])})}function Jk(e){var t=e.context,n=t.source,i=t.target;if(!iD(t)){var r=qn(n),o=Xt(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;Xk(c-r[s])<kf&&(c>r[s]?u=r[s]+kf:u=r[s]-kf,Tt(e,s,u))})}}function qb(e,t){Tt(e,"x",t.x),Tt(e,"y",t.y)}function Yb(e,t){return e&&e.type===t}function eD(e,t){return Fi(t,function(n){return Yb(e,n)})}function Kb(e,t){return e==="x"?t.width:t.height}function tD(e){return v(e,"bpmn:Task")?Kk:Yk}function nD(e,t,n){return e[n]>t[n]+Gb&&e[n]<t[n]+Kb(n,t)-Gb}function iD(e){var t=e.hover,n=e.source;return t&&n&&t===n}function _r(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}_r.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},_r.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},_r.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},_r.prototype.getSnapLocations=function(){return this._snapLocations},_r.prototype.setSnapLocations=function(e){this._snapLocations=e},_r.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new hu,n.initDefaults(this._defaultSnaps)),n};function hu(){this._snapValues={}}hu.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)},hu.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&WM(e[n],r[n],i)},hu.prototype.initDefaults=function(e){var t=this;M(e||{},function(n,i){M(n,function(r){t.add(i,r)})})};var rD=1250;function bi(e,t,n){var i=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],function(r){i.initSnap(r)}),t.on(["create.move","create.end","shape.move.move","shape.move.end"],rD,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&Rn(r.originalEvent))&&!(Do(r)||!c)){var u=s.pointsForTarget(c);u.initialized||(u=i.addSnapTargetPoints(u,a,c),u.initialized=!0),n.snap(r,u)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){n.hide()})}bi.$inject=["elementRegistry","eventBus","snapping"],bi.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new _r);var o;t.get(i.id)?o=qn(i,e):o={x:e.x+qn(i).x,y:e.y+qn(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}),ke(i)||(r.setSnapOrigin("top-left",{x:a.x-e.x,y:a.y-e.y}),r.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),r},bi.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return M(i,function(r){if(ke(r)){ke(t)&&e.add("mid",qn(r));return}if(it(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);M(o,function(a){e.add("mid",a)});return}e.add("mid",qn(r))}),!xe(t.x)||!xe(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",qn(t)),e},bi.prototype.getSnapTargets=function(e,t){return I_(t).filter(function(n){return!oD(n)})};function oD(e){return!!e.hidden}var Xb=1500;function Io(e,t){t.invoke(bi,this),e.on(["create.move","create.end"],Xb,uD),e.on(["create.move","create.end","shape.move.move","shape.move.end"],Xb,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!Do(n)&&aD(n,o)})}ie(Io,bi),Io.$inject=["eventBus","injector"],Io.prototype.initSnap=function(e){var t=bi.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return M(n.outgoing,function(r){var o=r.waypoints[0];o=o.original||o,t.setSnapOrigin(r.id+"-docking",Qb(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",Qb(o,i,e))}),v(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Io.prototype.addSnapTargetPoints=function(e,t,n){bi.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);M(i,function(o){(cD(o)||sD([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",O_(o)),e.add("bottom-right",L_(o)))});var r=this._elementRegistry;return M(t.incoming,function(o){if(r.get(t.id)){Zb(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)){Zb(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},Io.prototype.getSnapTargets=function(e,t){return bi.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!v(n,"bpmn:Lane")})};function aD(e,t){var n=me(t),i=dg(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 sD(e,t){return e.every(function(n){return v(n,t)})}function cD(e){return v(e,"bpmn:SubProcess")&&Be(e)?!0:v(e,"bpmn:Participant")}function uD(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 Zb(e,t){return e.indexOf(t)!==-1}function Qb(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var lD=1250;function Wa(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],lD,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&Rn(i.originalEvent))&&!Do(i)){var u=c.pointsForTarget(a);u.initialized||(u=n.addSnapTargetPoints(u,o,a,s),u.initialized=!0),dD(s)&&Tt(i,"x",i.x),hD(s)&&Tt(i,"y",i.y),t.snap(i,u)}}),e.on(["resize.cleanup"],function(){t.hide()})}Wa.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new _r);var o=Jb(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},Wa.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return M(r,function(o){e.add("corner",L_(o)),e.add("corner",O_(o))}),e.add("corner",Jb(t,i)),e},Wa.$inject=["eventBus","snapping"],Wa.prototype.getSnapTargets=function(e,t){return I_(t).filter(function(n){return!pD(n,e)&&!it(n)&&!fD(n)&&!ke(n)})};function Jb(e,t){var n=ye(e),i=me(e),r={x:n.x,y:n.y};return t.indexOf("n")!==-1?r.y=i.top:t.indexOf("s")!==-1&&(r.y=i.bottom),t.indexOf("e")!==-1?r.x=i.right:t.indexOf("w")!==-1&&(r.x=i.left),r}function pD(e,t){return e.host===t}function fD(e){return!!e.hidden}function dD(e){return e==="n"||e==="s"}function hD(e){return e==="e"||e==="w"}var mD=7,gD=1e3;function br(e){this._canvas=e,this._asyncHide=Eu(mn(this.hide,this),gD)}br.$inject=["canvas"],br.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:Do(e,"x"),y:Do(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,mD),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];Ht(s)&&Tt(e,a,s.originValue)})},br.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=pe("path");return re(n,{d:"M0,0 L0,0"}),$e(n).add("djs-snap-line"),Se(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"})}}},br.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},br.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},br.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},br.prototype.hide=function(){M(this._snapLines,function(e){e.update()})};const yD={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",bi],resizeSnapping:["type",Wa],snapping:["type",br]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",Ub],createMoveSnapping:["type",Io]};var ex=300;function Re(e,t,n,i){this._open=!1,this._results={},this._eventMaps=[],this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._canvas=e,this._eventBus=t,this._selection=n,this._translate=i,this._container=this._getBoxHtml(),this._searchInput=et(Re.INPUT_SELECTOR,this._container),this._resultsContainer=et(Re.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}Re.$inject=["canvas","eventBus","selection","translate"],Re.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:En.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,Re.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,Re.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,Re.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,Re.INPUT_SELECTOR,"keydown",function(n){Nt("ArrowUp",n)&&n.preventDefault(),Nt("ArrowDown",n)&&n.preventDefault()}),t(this._container,Re.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)})},Re.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){En.unbind(e.el,e.type,e.listener)})},Re.prototype._search=function(e){var t=this;if(this._clearResults(),!!e.trim()){var n=this._searchProvider.find(e);if(n=n.filter(function(r){return!t._canvas.getRootElements().includes(r.element)}),!n.length){this._selection.select(null);return}n.forEach(function(r){var o=r.element.id,a=t._createResultNode(r,o);t._results[o]={element:r.element,node:a}});var i=et(Re.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},Re.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},Re.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)}},Re.prototype._clearResults=function(){fs(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},Re.prototype._getCurrentResult=function(){return et(Re.RESULT_SELECTED_SELECTOR,this._resultsContainer)},Re.prototype._createResultNode=function(e,t){var n=ut(Re.RESULT_HTML);return e.primaryTokens.length>0&&tx(n,e.primaryTokens,Re.RESULT_PRIMARY_HTML),tx(n,e.secondaryTokens,Re.RESULT_SECONDARY_HTML),on(n,Re.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},Re.prototype.registerProvider=function(e){this._searchProvider=e},Re.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"))},Re.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())},Re.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Re.prototype.isOpen=function(){return this._open},Re.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&ft(t).remove(Re.RESULT_SELECTED_CLASS);var n=on(e,Re.RESULT_ID_ATTRIBUTE),i=this._results[n].element;ft(e).add(Re.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:ex}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},Re.prototype._select=function(e){var t=on(e,Re.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:ex}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},Re.prototype._getBoxHtml=function(){const e=ut(Re.BOX_HTML),t=et(Re.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function tx(e,t,n){var i=vD(t),r=ut(n);r.innerHTML=i,e.appendChild(r)}function vD(e){var t="";return e.forEach(function(n){var i=uv(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+Re.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}Re.CONTAINER_SELECTOR=".djs-search-container",Re.INPUT_SELECTOR=".djs-search-input input",Re.RESULTS_CONTAINER_SELECTOR=".djs-search-results",Re.RESULT_SELECTOR=".djs-search-result",Re.RESULT_SELECTED_CLASS="djs-search-result-selected",Re.RESULT_SELECTED_SELECTOR="."+Re.RESULT_SELECTED_CLASS,Re.RESULT_ID_ATTRIBUTE="data-result-id",Re.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",Re.BOX_HTML=`<div class="djs-search-container djs-scrollable">
|
|
335
|
+
</svg>`},M2=900;function Ha(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",M2,this)}Ha.$inject=["popupMenu","distributeElements","translate","rules"],Ha.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&D(t,this._getEntries(e)),t},Ha.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Ha.prototype._getEntries=function(e){var t=this._distributeElements,n=this._translate,i=this._popupMenu,r={"distribute-elements-horizontal":{group:"distribute",title:n("Distribute elements horizontally"),className:"bjs-align-elements-menu-entry",imageHtml:tb.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:tb.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const k2={__depends__:[uf,T2],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",ru],distributeElementsMenuProvider:["type",Ha]};var nb="is not a registered action",D2="is already registered";function Xn(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}Xn.$inject=["eventBus","injector"],Xn.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)})},Xn.prototype.trigger=function(e,t){if(!this._actions[e])throw _f(e,nb);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},Xn.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)})},Xn.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw _f(e,D2);this._actions[e]=t},Xn.prototype.unregister=function(e){if(!this.isRegistered(e))throw _f(e,nb);this._actions[e]=void 0},Xn.prototype.getActions=function(){return Object.keys(this._actions)},Xn.prototype.isRegistered=function(e){return!!this._actions[e]};function _f(e,t){return new Error(e+" "+t)}const O2={__init__:["editorActions"],editorActions:["type",Xn]};function ou(e){e.invoke(Xn,this)}ie(ou,Xn),ou.$inject=["injector"],ou.prototype._registerDefaultActions=function(e){Xn.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=Oe(m,function(E){return!v(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;v(h,"bpmn:Collaboration")?g=n.filter(function(S){return v(S.parent,"bpmn:Collaboration")}):g=n.filter(function(S){return S!==h&&!v(S.parent,"bpmn:SubProcess")}),m=Ct(g),f.moveElements(g,{x:-m.x,y:-m.y},h)}),i&&d&&this._registerAction("replaceElement",function(h){d.triggerEntry("replace","click",h)})};const L2={__depends__:[O2],editorActions:["type",ou]};function ib(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;De(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}ib.$inject=["eventBus"];function Ur(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;_n(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}Ur.$inject=["eventBus","gridSnapping","modeling"],ie(Ur,Y),Ur.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},Ur.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},Ur.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},Ur.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 I2=2e3;function rb(e,t){e.on(["spaceTool.move","spaceTool.end"],I2,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)}})}rb.$inject=["eventBus","gridSnapping"];const N2={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Ur],gridSnappingSpaceToolBehavior:["type",rb]};var au=10;function bf(e,t,n){return n||(n="round"),Math[n](e/t)*t}var B2=1200,$2=800;function yr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",$2,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"],B2,function(o){var a=o.originalEvent;if(!(!r.active||a&&Cn(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(u){var l={},p=F2(o,u,e);p&&(l.offset=p);var f=j2(o,u);f&&D(l,f),Oo(o,u)||r.snapEvent(o,u,l)})}})}yr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);Mt(e,t,i)},yr.prototype.getGridSpacing=function(){return au},yr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=bf(e,au);var i,r;return t&&t.min&&(i=t.min,xe(i)&&(i=bf(i+n,au,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,xe(r)&&(r=bf(r+n,au,"floor"),e=Math.min(e,r))),e-=n,e},yr.prototype.isActive=function(){return this.active},yr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},yr.prototype.toggleActive=function(){this.setActive(!this.active)},yr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function j2(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&&(su(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&&(su(t)?ab(s)?a.x.max=c.left:a.x.min=c.right:ob(s)?a.y.max=c.top:a.y.min=c.bottom),u&&(su(t)?ab(s)?a.x.min=u.left:a.x.max=u.right:ob(s)?a.y.min=u.top:a.y.max=u.bottom),a[t]}function F2(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)||(su(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 su(e){return e==="x"}function ob(e){return e.indexOf("n")!==-1}function ab(e){return e.indexOf("w")!==-1}const H2={__depends__:[N2],__init__:["gridSnapping"],gridSnapping:["type",yr]};var z2=2e3;function sb(e,t,n){e.on("autoPlace",z2,function(i){var r=i.source,o=ye(r),a=i.shape,s=av(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")&&(V2(c)?u.offset=-a.width/2:u.offset=-a.height/2),s[c]=t.snapValue(s[c],u))}),s})}sb.$inject=["eventBus","gridSnapping","elementRegistry"];function V2(e){return e==="x"}var G2=1750;function cb(e,t,n){t.on(["create.start","shape.move.start"],G2,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}))}})}cb.$inject=["canvas","eventBus","gridSnapping"];var W2=3e3;function cu(e,t,n){Y.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],W2,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||U2(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}cu.$inject=["eventBus","gridSnapping","modeling"],ie(cu,Y),cu.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=K2(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function U2(e){return e.length>3}function q2(e){return e==="h"}function Y2(e){return e==="v"}function K2(e,t,n){var i=Pi(t,n),r={};return q2(i)&&(r.y=e.snapValue(t.y)),Y2(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=D({},t,r),n=D({},n,r)),[t,n]}const X2={__depends__:[H2,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",sb],gridSnappingParticipantBehavior:["type",cb],gridSnappingLayoutConnectionBehavior:["type",cu]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",ib]};var Z2=30,ub=30;function za(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var r=i.element,o=i.gfx;if(v(r,"bpmn:Lane"))return n._createParticipantHit(r,o);if(v(r,"bpmn:Participant"))return Be(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(v(r,"bpmn:SubProcess"))return Be(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}za.$inject=["eventBus","interactionEvents"],za.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},za.prototype._createParticipantHit=function(e,t){this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height});var n=Gt(e)?{width:Z2,height:e.height}:{width:e.width,height:ub};return this._interactionEvents.createBoxHit(t,"all",n),!0},za.prototype._createSubProcessHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"all",{width:e.width,height:ub}),!0};const Q2={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",za]};function uu(e){e.invoke(Co,this)}ie(uu,Co),uu.$inject=["injector"],uu.prototype.registerBindings=function(e,t){Co.prototype.registerBindings.call(this,e,t);function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("selectElements",function(i){var r=i.keyEvent;if(e.isKey(["a","A"],r)&&e.isCmd(r))return t.trigger("selectElements"),!0}),n("find",function(i){var r=i.keyEvent;if(e.isKey(["f","F"],r)&&e.isCmd(r))return t.trigger("find"),!0}),n("spaceTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["s","S"],r))return t.trigger("spaceTool"),!0}),n("lassoTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["l","L"],r))return t.trigger("lassoTool"),!0}),n("handTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["h","H"],r))return t.trigger("handTool"),!0}),n("globalConnectTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["c","C"],r))return t.trigger("globalConnectTool"),!0}),n("directEditing",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["e","E"],r))return t.trigger("directEditing"),!0}),n("replaceElement",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["r","R"],r))return t.trigger("replaceElement",r),!0})};const J2={__depends__:[qp],__init__:["keyboardBindings"],keyboardBindings:["type",uu]};var ek={moveSpeed:1,moveSpeedAccelerated:10},tk=1500,lb="left",pb="up",fb="right",db="down",nk={ArrowLeft:lb,Left:lb,ArrowUp:pb,Up:pb,ArrowRight:fb,Right:fb,ArrowDown:db,Down:db},ik={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 hb(e,t,n,i,r){var o=this;this._config=D({},ek,e||{}),t.addListener(tk,function(a){var s=a.keyEvent,c=nk[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=ik[a](u),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,l)}}}hb.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const rk={__depends__:[qp,Wn],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",hb]};var mb=10;function Va(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=eR(l,p,u),c.newBounds=nR(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:me(l)})}function s(c){var u=c.shape,l=c.canExecute,p=c.newBounds;if(l){if(p=Dh(p),!ok(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)})}Va.prototype.canResize=function(e){var t=this._rules,n=ei(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Va.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=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,gb(t,o),"resize",{autoActivate:!0,cursor:ak(o),data:{shape:t,context:r}})},Va.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:mb,height:mb},r=_m(t,e.childrenBoxPadding),iR(n,t,i,r)},Va.$inject=["eventBus","rules","modeling","dragging"];function ok(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function gb(e,t){var n=ye(e),i=me(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 ak(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 yb="djs-resizing",vb="resize-not-ok",sk=500;function _b(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,yb)),s.width>5&&re(c,{x:s.x,width:s.width}),s.height>5&&re(c,{y:s.y,height:s.height}),o.canExecute?$e(c).remove(vb):$e(c).add(vb)}function r(o){var a=o.shape,s=o.frame;s&&Nt(o.frame),t.removeMarker(a,yb)}e.on("resize.move",sk,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}_b.$inject=["eventBus","canvas","previewSupport"];var lu=-6,pu=8,fu=20,Ga="djs-resizer",ck=["n","w","s","e","nw","ne","se","sw"];function vr(e,t,n,i){this._resize=i,this._canvas=t;var r=this;e.on("selection.changed",function(o){var a=o.newSelection;r.removeResizers(),a.length===1&&M(a,gn(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}vr.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){ar(o)&&i.activate(o,e,n)}we.bind(t,"mousedown",r),we.bind(t,"touchstart",r)},vr.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=uk(i),a=pe("g");$e(a).add(Ga),$e(a).add(Ga+"-"+e.id),$e(a).add(Ga+"-"+i),Se(r,a);var s=pe("rect");re(s,{x:-pu/2+o.x,y:-pu/2+o.y,width:pu,height:pu}),$e(s).add(Ga+"-visual"),Se(a,s);var c=pe("rect");return re(c,{x:-fu/2+o.x,y:-fu/2+o.y,width:fu,height:fu}),$e(c).add(Ga+"-hit"),Se(a,c),Cs(a,t,n),a},vr.prototype.createResizer=function(e,t){var n=gb(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},vr.prototype.addResizer=function(e){var t=this;it(e)||M(ck,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},vr.prototype.removeResizers=function(){var e=this._getResizersParent();ys(e)},vr.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},vr.$inject=["eventBus","canvas","selection","resize"];function uk(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-lu:e.indexOf("w")!==-1&&(t.x=lu),e.indexOf("s")!==-1?t.y=-lu:e.indexOf("n")!==-1&&(t.y=lu),t}const bb={__depends__:[yi,Oi,wo],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Va],resizePreview:["type",_b],resizeHandles:["type",vr]};var lk=2e3;function Wa(e,t,n,i,r,o,a){this._bpmnFactory=t,this._canvas=n,this._modeling=r,this._textRenderer=a,i.registerProvider(this),e.on("element.dblclick",function(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"],lk,function(c){i.isActive(c.element)&&i.cancel()}),e.on(["commandStack.changed"],function(c){i.isActive()&&i.cancel()}),e.on("directEditing.activate",function(c){o.removeResizers()}),e.on("create.end",500,function(c){var u=c.context,l=u.shape,p=c.context.canExecute,f=c.isTouch;f||p&&(u.hints&&u.hints.createElementsBehavior===!1||s(l))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,u){(u||De(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}Wa.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Wa.prototype.activate=function(e){var t=Nn(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}),(De(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||xb(e))&&D(r,{centerVertically:!0}),nr(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}},Wa.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),r={x:i.x+i.width/2,y:i.y+i.height/2},o={x:i.x,y:i.y},a=t.zoom(),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")||dk(e)){var h=Gt(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(fk(e)){var g=Gt(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)"})}(De(e,["bpmn:Task","bpmn:CallActivity"])||xb(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"})),pk(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})),nr(n)&&!Ts(n)&&!ke(n)){var b=sl(e),w=t.getAbsoluteBBox({x:b.x,y:b.y,width:0,height:0}),T=u,L=Lr.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:uo*a+"px",paddingBottom:uo*a+"px",paddingLeft:uo*a+"px",paddingRight:uo*a+"px",fontSize:p+"px",lineHeight:f})),{bounds:o,style:d}},Wa.prototype.update=function(e,t,n,i){var r,o;v(e,"bpmn:TextAnnotation")&&(o=this._canvas.getAbsoluteBBox(e),r={x:e.x,y:e.y,width:e.width/o.width*i.width,height:e.height/o.height*i.height}),hk(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function xb(e){return v(e,"bpmn:SubProcess")&&!Be(e)}function pk(e){return v(e,"bpmn:SubProcess")&&Be(e)}function fk(e){return v(e,"bpmn:Participant")&&!Be(e)}function dk(e){return v(e,"bpmn:Participant")&&Be(e)}function hk(e){return!e||!e.trim()}var Eb="djs-element-hidden",wb="djs-label-hidden";function Sb(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=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:mk(o)}),Se(s,p),Se(r,s),Qt(s,o.x,o.y)}v(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,Eb):(v(o,"bpmn:Task")||v(o,"bpmn:CallActivity")||v(o,"bpmn:SubProcess")||v(o,"bpmn:Participant")||v(o,"bpmn:Lane"))&&t.addMarker(o,wb)}),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,Eb),t.removeMarker(o,wb)),o=void 0,a=void 0,s&&(Nt(s),s=void 0)})}Sb.$inject=["eventBus","canvas","pathMap"];function mk(e,t){var n=Ve(e);return n.get("stroke")||t||"black"}const gk={__depends__:[Rp,bb,K_],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Wa],labelEditingPreview:["type",Sb]};var yk=500,vk=1e3;function bi(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){n1(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"],yk,function(o){var a=o.element,s=o.gfx,c=et(".djs-outline",s);c&&i.updateOutline(a,c)})}bi.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=et(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),Se(t,n),this.updateOutline(e,n)),n},bi.prototype._createOutlineGfx=function(){var e=pe("rect");return re(e,D({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},bi.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},bi.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})},bi.prototype.updateConnectionOutline=function(e,t){var n=Ct(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})},bi.prototype.registerProvider=function(e,t){t||(t=e,e=vk),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},bi.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},bi.prototype.getOutline=function(e){var t,n=this._getProviders();return M(n,function(i){Vt(i.getOutline)&&(t=t||i.getOutline(e))}),t},bi.$inject=["eventBus","styles","elementRegistry"];var du=6;function xf(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)})}xf.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");ys(t);var n=e.length>1,i=this._canvas.getContainer();if($e(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=_k(Ct(e)),o=pe("rect");re(o,D({rx:3},r)),$e(o).add("djs-selection-outline"),Se(t,o)}},xf.$inject=["eventBus","canvas","selection"];function _k(e){return{x:e.x-du,y:e.y-du,width:e.width+du*2,height:e.height+du*2}}const Ef={__depends__:[Wn],__init__:["outline","multiSelectionOutline"],outline:["type",bi],multiSelectionOutline:["type",xf]},Rb=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],Cb={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},bk=15,hu=2;function Pb(e,t,n,i,r){const o=t.getLayer("overlays");e.on(["selection.changed","shape.changed"],function(){s()}),e.on("selection.changed",function({newSelection:p}){var d;const f=p.filter(h=>De(h,Rb));if(f.length===1){const h=f[0];ke(h)?a(h,h.labelTarget):(d=h.labels)!=null&&d.length&&a(h.labels[0],h)}if(f.length===2){const h=f.find(ke),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;!De(p,Rb)||!l(p)||(ke(p)?a(p,p.labelTarget):(f=p.labels)!=null&&f.length&&a(p.labels[0],p))});function a(p,f){const d=Yo([ye(f),ye(p)],Cb),h=d.getAttribute("d"),g=r.isSelected(p)?c(p):u(p),S=Qo(g,h);if(!S)return;const x=r.isSelected(f)?c(f):u(f),b=Qo(x,h)||ye(f);ca(b,S)<bk||(Ju(d,[b,S]),Se(o,d))}function s(){gs(`.${Cb.class}`,o).forEach(Nt)}function c(p){const f=i.getOutline(p);if(!f)return u(p);if(f.x){const d={x:p.x+_r(f,"x")-hu,y:p.y+_r(f,"y")-hu,width:_r(f,"width")+hu*2,height:_r(f,"height")+hu*2};return ul(d,_r(f,"rx"))}if(f.cx){const d=_r(f,"r"),h={x:p.x+_r(f,"cx")-d,y:p.y+_r(f,"cy")-d,width:d*2,height:d*2};return nm(h)}}function u(p){return n.getShapePath(p)}function l(p){return r.isSelected(p)}}Pb.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function _r(e,t){return parseFloat(re(e,t)||0)}const xk={__depends__:[Wn,Ef],__init__:["labelLink"],labelLink:["type",Pb]};var Ek=new Eo("tt");function wk(e){var t=ut('<div class="djs-tooltip-container" />');return dn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function Sk(e,t,n){dn(e,{left:t+"px",top:n+"px"})}function wf(e,t){e.style.display=t===!1?"none":""}var Ab="djs-tooltip",Sf="."+Ab;function vn(e,t){this._eventBus=e,this._canvas=t,this._ids=Ek,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=wk(t.getContainer());var n=this;wn.bind(this._tooltipRoot,Sf,"mousedown",function(i){i.stopPropagation()}),wn.bind(this._tooltipRoot,Sf,"mouseover",function(i){n.trigger("mouseover",i)}),wn.bind(this._tooltipRoot,Sf,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}vn.$inject=["eventBus","canvas"],vn.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},vn.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(an(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},vn.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},vn.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},vn.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)}},vn.prototype.remove=function(e){var t=this.get(e);t&&(pi(t.html),pi(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},vn.prototype.show=function(){wf(this._tooltipRoot)},vn.prototype.hide=function(){wf(this._tooltipRoot,!1)},vn.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},vn.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)),_n(n)&&(n=ut(n)),i=ut('<div data-tooltip-id="'+t+'" class="'+Ab+'">'),dn(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)},vn.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;Sk(n,t.x,t.y)},vn.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),wf(i,r))})},vn.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 Rk={__init__:["tooltips"],tooltips:["type",vn]};var Ck="flow elements must be children of pools/participants",Pk="Data object must be placed within a pool/participant.";function Tb(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(Ck)):v(a,"bpmn:DataObjectReference")&&i(r,n(Pk)))})}Tb.$inject=["eventBus","tooltips","translate"];const Ak={__depends__:[Rk],__init__:["modelingFeedback"],modelingFeedback:["type",Tb]};var Tk=500,Mk=1250,kk=1500,mu=Math.round;function Dk(e){return{x:e.x+mu(e.width/2),y:e.y+mu(e.height/2)}}function Mb(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",kk,function(s){var c=s.context,u=s.shape,l=i.get().slice();l.indexOf(u)===-1&&(l=[u]),l=Ok(l),D(c,{shapes:l,validatedShapes:l,shape:u})}),e.on("shape.move.start",Mk,function(s){var c=s.context,u=c.validatedShapes,l;if(l=c.canExecute=o(u),!l)return!1}),e.on("shape.move.move",Tk,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=mu(u.x),u.y=mu(u.y),!(u.x===0&&u.y===0)&&n.moveElements(f,u,c.target,{primaryShape:c.shape,attach:p})}),e.on("element.mousedown",function(s){if(ar(s)){var c=vo(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,u,l){if(zt(u)&&(l=u,u=!1),!(c.waypoints||!c.parent)&&!$e(s.target).has("djs-hit-no-move")){var p=Dk(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}Mb.$inject=["eventBus","dragging","modeling","selection","rules"];function Ok(e){var t=Qr(e,"id");return Oe(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var kb=499,Rf="djs-dragging",Db="drop-ok",Ob="drop-not-ok",Lb="new-parent",Ib="attach-ok";function Nb(e,t,n,i){function r(c){var u=o(c),l=Lk(u);return l}function o(c){var u=Ko(c),l=u.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),p=u.concat(l),f=[...new Set(p)];return f}function a(c,u){[Ib,Db,Ob,Lb].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,Rf),c.allDraggedElements?c.allDraggedElements.push(u):c.allDraggedElements=[u]}e.on("shape.move.start",kb,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();Se(h,d),u.dragGroup=d}f.forEach(function(m){i.addDragger(m,u.dragGroup)}),p?p=Eu([p,o(l)]):p=o(l),M(p,function(m){t.addMarker(m,Rf)}),u.allDraggedElements=p,u.differentParents=Ik(l)}),e.on("shape.move.move",kb,function(c){var u=c.context,l=u.dragGroup,p=u.target,f=u.shape.parent,d=u.canExecute;p&&(d==="attach"?a(p,Ib):u.canExecute&&f&&p.id!==f.id?a(p,Lb):a(p,u.canExecute?Db:Ob)),Qt(l,c.dx,c.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(c){var u=c.context,l=u.target;l&&a(l,null)}),e.on("shape.move.cleanup",function(c){var u=c.context,l=u.allDraggedElements,p=u.dragGroup;M(l,function(f){t.removeMarker(f,Rf)}),p&&Nt(p)}),this.makeDraggable=s}Nb.$inject=["eventBus","canvas","styles","previewSupport"];function Lk(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=Oe(e,function(i){return it(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function Ik(e){return $x(Qr(e,function(t){return t.parent&&t.parent.id}))!==1}const Nk={__depends__:[ac,Wn,Ef,yi,Oi,wo],__init__:["move","movePreview"],move:["type",Mb],movePreview:["type",Nb]};var Bb=".djs-palette-toggle",$b=".entry",Bk=Bb+", "+$b,Cf="djs-palette-",$k="shown",Pf="open",jb="two-column",jk=1e3;function kt(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()})}kt.$inject=["eventBus","canvas"],kt.prototype.registerProvider=function(e,t){t||(t=e,e=jk),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},kt.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(Hk,{})},kt.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},kt.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=ut(kt.HTML_MARKUP);n.appendChild(i),ft(n).add(Cf+$k),wn.bind(i,Bk,"click",function(r){var o=r.delegateTarget;if(Gu(o,Bb))return e.toggle();e.trigger("click",r)}),we.bind(i,"mousedown",function(r){r.stopPropagation()}),wn.bind(i,$b,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},kt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},kt.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(jb,r),a.toggle(Cf+jb,r),"open"in e&&(o.toggle(Pf,e.open),a.toggle(Cf+Pf,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},kt.prototype._update=function(){var e=et(".djs-palette-entries",this._container),t=this._entries=this.getEntries();hs(e),M(t,function(n,i){var r=n.group||"default",o=et("[data-group="+Ma(r)+"]",e);o||(o=ut('<div class="group"></div>'),an(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=ut(a);if(o.appendChild(s),!n.separator&&(an(s,"data-action",i),n.title&&an(s,"title",n.title),n.className&&Fk(s,n.className),n.imageUrl)){var c=ut("<img>");an(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},kt.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=an(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},kt.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(Vt(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},kt.prototype._layoutChanged=function(){this._toggleState({})},kt.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},kt.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},kt.prototype.open=function(){this._toggleState({open:!0})},kt.prototype.toggle=function(){this.isOpen()?this.close():this.open()},kt.prototype.isActiveTool=function(e){return e&&this._activeTool===e},kt.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=et(".djs-palette-entries",this._container),this._toolsContainer=et("[data-group=tools]",t)),n=this._toolsContainer,M(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=ft(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},kt.prototype.isOpen=function(){return ft(this._container).has(Pf)},kt.prototype._getParentContainer=function(){return this._canvas.getContainer()},kt.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function Fk(e,t){var n=ft(e),i=ge(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function Hk(e,t){var n=t.getPaletteEntries();return Vt(n)?n(e):(M(n,function(i,r){e[r]=i}),e)}const zk={__init__:["palette"],palette:["type",kt]};var Fb="crosshair",Hb="selected",Vk="djs-dragging-active-lasso";function br(e,t,n,i,r,o,a){this._selection=r,this._dragging=n,this._mouse=a;var s=this,c={create:function(p){var f=t.getActiveLayer(),d=p.frame=pe("rect");re(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),Se(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,Hb);for(const g of h)m.has(g)||t.addMarker(g,Hb)}},remove:function(p){this.update(p),p.frame&&Nt(p.frame),u(!1)}};function u(p){$e(t.getContainer()).toggle(Vk,p)}function l(p){var f=i.getAll();return new Set(Zr(ro(f,p)))}o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(p){var f=p.originalEvent.target;!p.hover&&!(f instanceof SVGElement)||e.once("lasso.selection.ended",function(){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=zb(p),f.add=Js(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=zb(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(Js(p))return s.activateLasso(p.originalEvent),!0})}br.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],br.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:Fb,data:{context:{}},keepSelection:!0})},br.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:Fb,data:{context:{}},keepSelection:!0})},br.prototype._select=function(e){this._selection.select(e)},br.prototype.select=function(e,t,n=[]){var i=Zr(ro(e,t));this._select([...n,...i])},br.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},br.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function zb(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 Gk={__depends__:[lc,ha],__init__:["lassoTool"],lassoTool:["type",br]};var Af=1500,Vb="grab";function Lo(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",Af,function(c){if(pa(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(Af,function(c){if(!(!Gb(c.keyEvent)||a.isActive())){var u=a._mouse.getLastMoveEvent();a.activateMove(u,!!u)}},"keyboard.keydown"),s&&s.addListener(Af,function(c){!Gb(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!pa(c)&&l&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}Lo.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Lo.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:Vb,data:{context:n||{}}})},Lo.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:Vb,data:{context:{reactivate:n}}})},Lo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Lo.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function Gb(e){return Bt("Space",e)}const Wk={__depends__:[lc,ha],__init__:["handTool"],handTool:["type",Lo]};var Wb="connect-ok",Ub="connect-not-ok";function Io(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?Wb:Ub))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var u=c.context.startTarget,l=c.context.canStartConnect;u&&i.removeMarker(u,l?Wb:Ub)}),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})}Io.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Io.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Io.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Io.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Io.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const Uk={__depends__:[yf,yi,Oi,lc,ha],globalConnect:["type",Io]};function Tf(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)}Tf.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],Tf.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 qk={__depends__:[zk,cc,by,Gk,Wk,Uk,ra],__init__:["paletteProvider"],paletteProvider:["type",Tf]};var Yk=250;function Mf(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=et('[data-element-id="'+Ma(f.id)+'"]',s.dragGroup);h&&re(h,{display:"none"});var m=r.addDragger(d,s.dragGroup);s.visualReplacements[l]=m,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;M(c,function(u,l){var p=et('[data-element-id="'+Ma(l)+'"]',s.dragGroup);p&&re(p,{display:"inline"}),u.remove(),c[l]&&delete c[l]})}e.on("shape.move.move",Yk,function(s){var c=s.context,u=c.canExecute;c.visualReplacements||(c.visualReplacements={}),u&&u.replacements?o(c):a(c)})}Mf.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],ie(Mf,Y);const Kk={__depends__:[wo],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Mf]};var Xk=1250,kf=40,Zk=20,Qk=10,qb=20,Yb=["x","y"],Jk=Math.abs;function Kb(e){e.on(["connect.hover","connect.move","connect.end"],Xk,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&Cn(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&eD(t,o,rD(o)),o&&iD(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Yn(r),De(o,["bpmn:Event","bpmn:Gateway"])&&Xb(t,Yn(o)),De(o,["bpmn:Task","bpmn:SubProcess"])&&tD(t,o),v(a,"bpmn:BoundaryEvent")&&s===a.host&&nD(t)):Zb(i,"bpmn:MessageFlow")?(v(r,"bpmn:Event")&&(n.connectionStart=Yn(r)),v(o,"bpmn:Event")&&Xb(t,Yn(o))):n.connectionStart=n.initialConnectionStart)})}Kb.$inject=["eventBus"];function eD(e,t,n){Yb.forEach(function(i){var r=Qb(i,t);e[i]<t[i]+n?Mt(e,i,t[i]+n):e[i]>t[i]+r-n&&Mt(e,i,t[i]+r-n)})}function tD(e,t){var n=Yn(t);Yb.forEach(function(i){oD(e,t,i)&&Mt(e,i,n[i])})}function nD(e){var t=e.context,n=t.source,i=t.target;if(!aD(t)){var r=Yn(n),o=Zt(r,i,-10),a=[];/top|bottom/.test(o)&&a.push("x"),/left|right/.test(o)&&a.push("y"),a.forEach(function(s){var c=e[s],u;Jk(c-r[s])<kf&&(c>r[s]?u=r[s]+kf:u=r[s]-kf,Mt(e,s,u))})}}function Xb(e,t){Mt(e,"x",t.x),Mt(e,"y",t.y)}function Zb(e,t){return e&&e.type===t}function iD(e,t){return zi(t,function(n){return Zb(e,n)})}function Qb(e,t){return e==="x"?t.width:t.height}function rD(e){return v(e,"bpmn:Task")?Qk:Zk}function oD(e,t,n){return e[n]>t[n]+qb&&e[n]<t[n]+Qb(n,t)-qb}function aD(e){var t=e.hover,n=e.source;return t&&n&&t===n}function xr(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}xr.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},xr.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},xr.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},xr.prototype.getSnapLocations=function(){return this._snapLocations},xr.prototype.setSnapLocations=function(e){this._snapLocations=e},xr.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new gu,n.initDefaults(this._defaultSnaps)),n};function gu(){this._snapValues={}}gu.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)},gu.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&YM(e[n],r[n],i)},gu.prototype.initDefaults=function(e){var t=this;M(e||{},function(n,i){M(n,function(r){t.add(i,r)})})};var sD=1250;function xi(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"],sD,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&Cn(r.originalEvent))&&!(Oo(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()})}xi.$inject=["elementRegistry","eventBus","snapping"],xi.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new xr);var o;t.get(i.id)?o=Yn(i,e):o={x:e.x+Yn(i).x,y:e.y+Yn(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}),ke(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},xi.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return M(i,function(r){if(ke(r)){ke(t)&&e.add("mid",Yn(r));return}if(it(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);M(o,function(a){e.add("mid",a)});return}e.add("mid",Yn(r))}),!xe(t.x)||!xe(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Yn(t)),e},xi.prototype.getSnapTargets=function(e,t){return $_(t).filter(function(n){return!cD(n)})};function cD(e){return!!e.hidden}var Jb=1500;function No(e,t){t.invoke(xi,this),e.on(["create.move","create.end"],Jb,fD),e.on(["create.move","create.end","shape.move.move","shape.move.end"],Jb,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!Oo(n)&&uD(n,o)})}ie(No,xi),No.$inject=["eventBus","injector"],No.prototype.initSnap=function(e){var t=xi.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",tx(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",tx(o,i,e))}),v(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},No.prototype.addSnapTargetPoints=function(e,t,n){xi.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);M(i,function(o){(pD(o)||lD([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",N_(o)),e.add("bottom-right",B_(o)))});var r=this._elementRegistry;return M(t.incoming,function(o){if(r.get(t.id)){ex(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)){ex(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},No.prototype.getSnapTargets=function(e,t){return xi.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!v(n,"bpmn:Lane")})};function uD(e,t){var n=me(t),i=gg(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=ye(o),/top/.test(i)?Mt(e,"y",n.top-a.y):/bottom/.test(i)&&Mt(e,"y",n.bottom-a.y),/left/.test(i)?Mt(e,"x",n.left-a.x):/right/.test(i)&&Mt(e,"x",n.right-a.x)}function lD(e,t){return e.every(function(n){return v(n,t)})}function pD(e){return v(e,"bpmn:SubProcess")&&Be(e)?!0:v(e,"bpmn:Participant")}function fD(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)&&Mt(e,"x",e.x),(i&&i>=e.y||o&&o<=e.y)&&Mt(e,"y",e.y)}}function ex(e,t){return e.indexOf(t)!==-1}function tx(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var dD=1250;function Ua(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],dD,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&Cn(i.originalEvent))&&!Oo(i)){var u=c.pointsForTarget(a);u.initialized||(u=n.addSnapTargetPoints(u,o,a,s),u.initialized=!0),gD(s)&&Mt(i,"x",i.x),yD(s)&&Mt(i,"y",i.y),t.snap(i,u)}}),e.on(["resize.cleanup"],function(){t.hide()})}Ua.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new xr);var o=nx(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},Ua.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return M(r,function(o){e.add("corner",B_(o)),e.add("corner",N_(o))}),e.add("corner",nx(t,i)),e},Ua.$inject=["eventBus","snapping"],Ua.prototype.getSnapTargets=function(e,t){return $_(t).filter(function(n){return!hD(n,e)&&!it(n)&&!mD(n)&&!ke(n)})};function nx(e,t){var n=ye(e),i=me(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 hD(e,t){return e.host===t}function mD(e){return!!e.hidden}function gD(e){return e==="n"||e==="s"}function yD(e){return e==="e"||e==="w"}var vD=7,_D=1e3;function Er(e){this._canvas=e,this._asyncHide=Su(gn(this.hide,this),_D)}Er.$inject=["canvas"],Er.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:Oo(e,"x"),y:Oo(e,"y")};M(r,function(a){var 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,vD),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];zt(s)&&Mt(e,a,s.originValue)})},Er.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=pe("path");return re(n,{d:"M0,0 L0,0"}),$e(n).add("djs-snap-line"),Se(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"})}}},Er.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Er.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},Er.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Er.prototype.hide=function(){M(this._snapLines,function(e){e.update()})};const bD={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",xi],resizeSnapping:["type",Ua],snapping:["type",Er]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",Kb],createMoveSnapping:["type",No]};var ix=300;function Re(e,t,n,i){this._open=!1,this._results={},this._eventMaps=[],this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._canvas=e,this._eventBus=t,this._selection=n,this._translate=i,this._container=this._getBoxHtml(),this._searchInput=et(Re.INPUT_SELECTOR,this._container),this._resultsContainer=et(Re.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}Re.$inject=["canvas","eventBus","selection","translate"],Re.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:wn.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,Re.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,Re.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,Re.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,Re.INPUT_SELECTOR,"keydown",function(n){Bt("ArrowUp",n)&&n.preventDefault(),Bt("ArrowDown",n)&&n.preventDefault()}),t(this._container,Re.INPUT_SELECTOR,"keyup",function(n){if(Bt("Escape",n))return e.close();if(Bt("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(Bt("ArrowUp",n))return e._scrollToDirection(!0);if(Bt("ArrowDown",n))return e._scrollToDirection();Bt(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},Re.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){wn.unbind(e.el,e.type,e.listener)})},Re.prototype._search=function(e){var t=this;if(this._clearResults(),!!e.trim()){var n=this._searchProvider.find(e);if(n=n.filter(function(r){return!t._canvas.getRootElements().includes(r.element)}),!n.length){this._selection.select(null);return}n.forEach(function(r){var o=r.element.id,a=t._createResultNode(r,o);t._results[o]={element:r.element,node:a}});var i=et(Re.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},Re.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},Re.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)}},Re.prototype._clearResults=function(){hs(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},Re.prototype._getCurrentResult=function(){return et(Re.RESULT_SELECTED_SELECTOR,this._resultsContainer)},Re.prototype._createResultNode=function(e,t){var n=ut(Re.RESULT_HTML);return e.primaryTokens.length>0&&rx(n,e.primaryTokens,Re.RESULT_PRIMARY_HTML),rx(n,e.secondaryTokens,Re.RESULT_SECONDARY_HTML),an(n,Re.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},Re.prototype.registerProvider=function(e){this._searchProvider=e},Re.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"))},Re.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())},Re.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Re.prototype.isOpen=function(){return this._open},Re.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&ft(t).remove(Re.RESULT_SELECTED_CLASS);var n=an(e,Re.RESULT_ID_ATTRIBUTE),i=this._results[n].element;ft(e).add(Re.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:ix}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},Re.prototype._select=function(e){var t=an(e,Re.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:ix}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},Re.prototype._getBoxHtml=function(){const e=ut(Re.BOX_HTML),t=et(Re.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function rx(e,t,n){var i=xD(t),r=ut(n);r.innerHTML=i,e.appendChild(r)}function xD(e){var t="";return e.forEach(function(n){var i=fv(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+Re.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}Re.CONTAINER_SELECTOR=".djs-search-container",Re.INPUT_SELECTOR=".djs-search-input input",Re.RESULTS_CONTAINER_SELECTOR=".djs-search-results",Re.RESULT_SELECTOR=".djs-search-result",Re.RESULT_SELECTED_CLASS="djs-search-result-selected",Re.RESULT_SELECTED_SELECTOR="."+Re.RESULT_SELECTED_CLASS,Re.RESULT_ID_ATTRIBUTE="data-result-id",Re.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",Re.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>`,Re.RESULT_HTML='<div class="djs-search-result"></div>',Re.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',Re.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const
|
|
343
|
+
</div>`,Re.RESULT_HTML='<div class="djs-search-result"></div>',Re.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',Re.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const ED={__depends__:[ra,Dc,Wn],searchPad:["type",Re]};function Df(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}Df.$inject=["elementRegistry","searchPad","canvas","search"],Df.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!ke(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:Nn(i),id:i.id})),e,{keys:["label","id"]}).map(wD)};function wD(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const SD={__depends__:[ED,g_],__init__:["bpmnSearch"],bpmnSearch:["type",Df]},RD="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",CD="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",PD={width:36,height:50},AD={width:50,height:50};function ox(e,t,n){return pe("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const Zn=5;function yu(e,t){this._styles=t,e.registerProvider(this)}yu.$inject=["outline","styles"],yu.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(Q1(e))return n=pe("rect"),re(n,D({x:-Zn,y:-Zn,rx:4,width:e.width+Zn*2,height:e.height+Zn*2},t)),n;if(!ke(e))return v(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))):De(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=pe("rect"),re(n,D({x:-Zn,y:-Zn,rx:14,width:e.width+Zn*2,height:e.height+Zn*2},t))):v(e,"bpmn:EndEvent")?(n=pe("circle"),re(n,D({cx:e.width/2,cy:e.height/2,r:e.width/2+Zn+1},t))):v(e,"bpmn:Event")?(n=pe("circle"),re(n,D({cx:e.width/2,cy:e.height/2,r:e.width/2+Zn},t))):v(e,"bpmn:DataObjectReference")&&ax(e,"bpmn:DataObjectReference")?n=ox(RD,{x:-6,y:-6},t):v(e,"bpmn:DataStoreReference")&&ax(e,"bpmn:DataStoreReference")&&(n=ox(CD,{x:-6,y:-6},t)),n},yu.prototype.updateOutline=function(e,t){if(!ke(e))return De(e,["bpmn:SubProcess","bpmn:Group"])?(re(t,{width:e.width+Zn*2,height:e.height+Zn*2}),!0):!!De(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function ax(e,t){var n;return t==="bpmn:DataObjectReference"?n=PD:t==="bpmn:DataStoreReference"&&(n=AD),e.width===n.width&&e.height===n.height}const TD={__depends__:[Ef],__init__:["outlineProvider"],outlineProvider:["type",yu]};var MD='<?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 Ei(e){so.call(this,e)}ie(Ei,so),Ei.Viewer=mr,Ei.NavigatedViewer=ka,Ei.prototype.createDiagram=function(){return this.importXML(MD)},Ei.prototype._interactionModules=[_v,xv,Sv],Ei.prototype._modelingModules=[DM,Mc,BM,IM,XM,yf,n2,P2,uy,cc,k2,L2,X2,Q2,J2,rk,gk,xk,zp,Ak,Nk,qk,Kk,bb,bD,SD,TD],Ei.prototype._modules=[].concat(mr.prototype._modules,Ei.prototype._interactionModules,Ei.prototype._modelingModules);const kD=((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=$u(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 Ei({container:o.value,moddleExtensions:ts}),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=Lx,Q.BPMN_MODDLE_EXTENSIONS=ts,Q.BWL_MODDLE_SCHEMA=Nf,Q.BWL_NS=If,Q.BWL_PREFIX=_u,Q.BWL_SIDES=bu,Q.BpmnModelerView=kD,Q.EDITOR=ZE,Q.FLOW_LABEL_INDENT=dd,Q.HEADLESS_BPMN_MODULES=uv,Q.HEADLESS_TEXT_METRICS=io,Q.I18N_NS=fE,Q.I18N_PREFIX=sd,Q.LABEL_FORK_MARGIN=ju,Q.MVP_FLOW_NODE_TYPES=wi,Q.SYMBOLIC_OP_KINDS=jf,Q.SYMBOLIC_OP_SCHEMA=Ff,Q.UNDO_EPISODE_COMMAND=xu,Q.applyBpmnOpBatch=nh,Q.applyBpmnOps=Qd,Q.approximateTextWidth=Wo,Q.auditBpmnGeometry=xd,Q.auditBpmnGeometryXml=CE,Q.auditGeometry=Yi,Q.auditTargetsOf=qi,Q.axisSegmentsOf=fn,Q.buildBpmnOpBatch=XE,Q.buildRegistryIndex=wd,Q.containerBoundarySegments=Go,Q.createBpmnEditorController=QE,Q.createBpmnModdle=cd,Q.createHeadlessBpmnModeler=vT,Q.crossedShapesOf=ci,Q.crossingCost=Ar,Q.describeProcess=th,Q.describeProcessXml=KE,Q.edgeCrossCount=as,Q.edgeCrossingPairsOf=Fu,Q.executeAsUndoEpisode=$f,Q.forwardThreePointCandidates=Pd,Q.geometryFindingKey=Ui,Q.installHeadlessBpmnDom=Kd,Q.isMvpFlowNodeType=Lf,Q.labelRectsOf=ss,Q.lineCrossesLabel=Ri,Q.lineThroughLabel=gd,Q.lineThroughShapeLabel=_d,Q.loadBpmnXml=Bu,Q.lowerOps=Zd,Q.oppositeOverlapCount=gE,Q.oppositeOverlapOf=fd,Q.planBackEdgeBoundaryClearance=Nd,Q.planCrossPoolRoute=Dd,Q.planEdgeRepair=Td,Q.planLabelLineClearance=Hd,Q.planLabelPlacement=Fd,Q.planMiddleSegmentShifts=Cd,Q.planOppositeOverlapRepair=$d,Q.planSegmentDetours=Rd,Q.planShapeLabelClearance=Gd,Q.repairIntroducedBoundaryHugging=Bd,Q.repairIntroducedCrossings=Md,Q.repairIntroducedLabelLines=zd,Q.repairIntroducedOppositeOverlaps=jd,Q.repairIntroducedShapeLabelLines=Wd,Q.repairIntroducedSharedSegmentLabels=Vd,Q.rerouteIntroducedCrossPoolEdges=Od,Q.resolverServicesOf=Xd,Q.saveBpmnXml=dE,Q.sceneCrossingCost=vd,Q.sceneFromDefinitions=bd,Q.sceneFromRegistry=Kt,Q.sharedSegmentUnderLabel=os,Q.sharedSpansOf=rs,Q.unreadableOverlapCount=zo,Q.unreadableOverlapOf=is,Q.validateOps=Yd,Q.warningMessages=$u,Object.defineProperty(Q,Symbol.toStringTag,{value:"Module"})}));
|