@g1cloud/bpmn-modeler-next 5.0.0-alpha.23 → 5.0.0-alpha.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/geometryAudit.d.ts +14 -0
- package/dist/agent/resolver/routeRepair.d.ts +10 -0
- package/dist/bpmn-modeler.js +7779 -7717
- package/dist/bpmn-modeler.umd.cjs +54 -54
- package/package.json +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
(function(Q,wt){typeof exports=="object"&&typeof module<"u"?wt(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],wt):(Q=typeof globalThis<"u"?globalThis:Q||self,wt(Q.BpmnModeler={},Q.Vue))})(this,(function(Q,wt){"use strict";var HD=Object.defineProperty;var zD=(Q,wt,wi)=>wt in Q?HD(Q,wt,{enumerable:!0,configurable:!0,writable:!0,value:wi}):Q[wt]=wi;var Xr=(Q,wt,wi)=>zD(Q,typeof wt!="symbol"?wt+"":wt,wi);const wi=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway"];function If(e){return wi.includes(e)}const Nf="http://g1project.net/spec/bpmn/bwl/1.0",bu="bwl",xu=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],Bf={name:"bwl-hints",uri:Nf,prefix:bu,xml:{tagAlias:"lowerCase"},types:[{name:"Placement",superClass:["Element"],properties:[{name:"anchor",isAttr:!0,type:"String"},{name:"side",isAttr:!0,type:"String"},{name:"offset",isAttr:!0,type:"Real"}]},{name:"Members",superClass:["Element"],properties:[{name:"refs",isAttr:!0,type:"String"}]},{name:"BandHint",extends:["bpmn:FlowNode"],properties:[{name:"band",isAttr:!0,type:"Integer"}]},{name:"PoolOrderHint",extends:["bpmn:Participant"],properties:[{name:"poolOrder",isAttr:!0,type:"Integer"}]}]},Eu="bwl.undoEpisode",$f=new WeakSet;function wx(e){$f.has(e)||(e.register(Eu,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),$f.add(e))}function jf(e,t){wx(e);const n={run:t};if(e.execute(Eu,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const Ff=["participant.add","participant.update","node.add","node.update","sequenceFlow.add","sequenceFlow.update","messageFlow.add","messageFlow.update","dataStore.add","dataStore.update","dataAssociation.add","association.add","annotation.add","annotation.update","group.add","group.update","element.remove"],Sx={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},Rx={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},Cx={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},Px={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},Ax={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},Tx={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},Mx={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"}},required:["id","source","target"],additionalProperties:!1},kx={type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},Dx={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},Ox={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},Lx={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},Ix={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},Nx={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...xu]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function nn(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const Bx={"participant.add":nn("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":nn("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":nn("node.add",{description:'플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 갈래 1, 2…) — 위/아래가 아니라 "주 흐름에서 몇 번째 갈래"다. 행 배치(어느 갈래가 위/아래인지)는 호스트가 정한다(대칭·메시지 방향). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.',properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["node"]}),"node.update":nn("node.update",{description:"노드 이름/레인/타입 갱신. lane = 레인 재배정(이동), type = 태스크·이벤트 타입 전환.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lane:{type:"string"},type:{type:"string",enum:[...wi]}},required:["id"]}),"sequenceFlow.add":nn("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":nn("sequenceFlow.update",{description:"시퀀스 플로우 이름/조건/끝점 갱신. condition: null = 조건 제거. source/target = 끝점 재배선 — 중간 삽입은 기존 플로우를 지우지 말고 이것으로 한쪽 끝을 옮긴 뒤 새 플로우를 추가한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},condition:{description:"생략 = 보존, null = 제거.",anyOf:[{$ref:"#/$defs/irFlowCondition"},{type:"null"}]},source:{description:"새 출발 노드 id(생략 = 보존). 같은 배치에서 추가한 노드도 지목할 수 있다.",type:"string"},target:{description:"새 도착 노드 id(생략 = 보존). 같은 배치에서 추가한 노드도 지목할 수 있다.",type:"string"}},required:["id"]}),"messageFlow.add":nn("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":nn("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataStore.add":nn("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":nn("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataAssociation.add":nn("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":nn("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":nn("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":nn("annotation.update",{description:"주석 본문/방위 힌트 갱신. placement: null = 힌트 제거(휴리스틱 복귀). 주석 삭제는 element.remove.",properties:{id:{type:"string"},text:{type:"string"},placement:{description:"생략 = 보존, null = 힌트 제거.",anyOf:[{$ref:"#/$defs/bwlPlacement"},{type:"null"}]}},required:["id"]}),"group.add":nn("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":nn("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"element.remove":nn("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},Hf={anyOf:Ff.map(e=>Bx[e])},$x={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:Rx,irParticipant:Cx,irNode:Px,irFlowCondition:Ax,irSequenceFlow:Tx,irMessageFlow:Mx,irDataStore:kx,irDataAssociation:Dx,irTextAnnotation:Ox,irAssociation:Lx,irGroup:Ix,bwlPlacement:Nx,nullableString:Sx,symbolicOp:Hf}};function wu(e){return Array.prototype.concat.apply([],e)}const $o=Object.prototype.toString,jx=Object.prototype.hasOwnProperty;function Rr(e){return e===void 0}function Ot(e){return e!==void 0}function Zr(e){return e==null}function ge(e){return $o.call(e)==="[object Array]"}function Ht(e){return $o.call(e)==="[object Object]"}function be(e){return $o.call(e)==="[object Number]"}function zt(e){const t=$o.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function bn(e){return $o.call(e)==="[object String]"}function Fx(e){if(!ge(e))throw new Error("must supply array")}function xn(e,t){return!Zr(e)&&jx.call(e,t)}function ot(e,t){const n=Xa(t);let i;return M(e,function(r,o){if(n(r,o))return i=r,!1}),i}function zf(e,t){const n=Xa(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=Xa(t);let i=[];return M(e,function(r,o){n(r,o)&&i.push(r)}),i}function M(e,t){let n,i;if(Rr(e))return;const r=ge(e)?Wx:Gx;for(let o in e)if(xn(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function Hx(e,t){if(Rr(e))return[];Fx(e);const n=Xa(t);return e.filter(function(i,r){return!n(i,r)})}function En(e,t,n){return M(e,function(i,r){n=t(n,i,r)}),n}function Cr(e,t){return!!En(e,function(n,i,r){return n&&t(i,r)},!0)}function zi(e,t){return!!ot(e,t)}function rn(e,t){let n=[];return M(e,function(i,r){n.push(t(i,r))}),n}function Ka(e){return e&&Object.keys(e)||[]}function zx(e){return Ka(e).length}function Qr(e){return rn(e,t=>t)}function Jr(e,t,n={}){return t=Su(t),M(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function Vf(e,...t){e=Su(e);let n={};return M(t,r=>Jr(r,e,n)),rn(n,function(r,o){return r[0]})}const Vx=Vf;function oi(e,t){t=Su(t);let n=[];return M(e,function(i,r){let o=t(i,r),a={d:o,v:i};for(var s=0;s<n.length;s++){let{d:c}=n[s];if(o<c){n.splice(s,0,a);return}}n.push(a)}),rn(n,i=>i.v)}function eo(e){return function(t){return Cr(e,function(n,i){return t[i]===n})}}function Su(e){return zt(e)?e:t=>t[e]}function Xa(e){return zt(e)?e:t=>t===e}function Gx(e){return e}function Wx(e){return Number(e)}function Ru(e,t){let n,i,r,o;function a(p){let f=Date.now(),d=p?0:o+t-f;if(d>0)return s(d);e.apply(r,i),c()}function s(p){n=setTimeout(a,p)}function c(){n&&clearTimeout(n),n=o=i=r=void 0}function u(){n&&a(!0),c()}function l(...p){o=Date.now(),i=p,r=this,n||s(t)}return l.flush=u,l.cancel=c,l}function gn(e,t){return e.bind(t)}function O(e,...t){return Object.assign(e,...t)}function Ux(e,t,n){let i=e;return M(t,function(r,o){if(typeof r!="number"&&typeof r!="string")throw new Error("illegal key type: "+typeof r+". Key should be of type number or string.");if(r==="constructor")throw new Error("illegal key: constructor");if(r==="__proto__")throw new Error("illegal key: __proto__");let a=t[o+1],s=i[r];Ot(a)&&Zr(s)&&(s=i[r]=isNaN(+a)?{}:[]),Rr(a)?Rr(n)?delete i[r]:i[r]=n:i=s}),e}function ti(e,t){let n={},i=Object(e);return M(t,function(r){r in i&&(n[r]=e[r])}),n}function ai(e,t){let n={},i=Object(e);return M(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function Cu(){}Cu.prototype.get=function(e){return this.$model.properties.get(this,e)},Cu.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function Gf(e,t){this.model=e,this.properties=t}Gf.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Cu.prototype);M(e.properties,function(a){!a.isMany&&a.default!==void 0&&(i[a.name]=a.default)}),n.defineModel(i,t),n.defineDescriptor(i,e);var r=e.ns.name;function o(a){n.define(this,"$type",{value:r,enumerable:!0}),n.define(this,"$attrs",{value:{}}),n.define(this,"$parent",{writable:!0}),M(a,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 qx=O(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),Wf=O(Object.create(null),{String:function(e){return e},Boolean:function(e){return e==="true"},Integer:function(e){return parseInt(e,10)},Real:function(e){return parseFloat(e)}});function Pu(e,t){var n=Wf[e];return n?n(t):t}function Au(e){return!!qx[e]}function Uf(e){return!!Wf[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 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 ti(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=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},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,gn(function(o){o=O({},o,{name:o.ns.localName,inherited:t}),Object.defineProperty(o,"definedBy",{value:e});var a=o.replaces,s=o.redefines;a||s?this.redefineProperty(o,a||s,a):(o.isBody&&this.setBodyProperty(o),o.isId&&this.setIdProperty(o),this.addProperty(o))},this)),i.push(e),n[r]=e)};function 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=O({},e);var t=this.packageMap;qf(t,e,"prefix"),qf(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=O({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:O({},e.meta||{})});var n=on(e.name,t.prefix),i=n.name,r=Object.create(null);M(e.properties,gn(function(o){var a=on(o.name,n.prefix),s=a.name;Au(o.type)||(o.type=on(o.type,a.prefix).name),O(o,{ns:a,name:s}),r[s]=o},this)),O(e,{ns:n,name:i,propertiesByName:r}),M(e.extends,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=Au(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,u){var l=on(c,Au(c)?"":e.prefix);r.mapTypes(l,t,u)}function a(c){return o(c,!0)}function s(c){return o(c,!1)}if(!i)throw new Error("unknown type <"+e.name+">");M(i.superClass,n?a:s),t(i,!n),M(i.traits,a)},Vi.prototype.getEffectiveDescriptor=function(e){var t=on(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},Vi.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function qf(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function Pr(e){this.model=e}Pr.prototype.set=function(e,t,n){if(!bn(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;Yx(n)?i?delete e[r]:delete e.$attrs[Tu(t)]:i?r in e?e[r]=n:Yf(e,i,n):e.$attrs[Tu(t)]=n},Pr.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[Tu(t)];var i=n.name;return!e[i]&&n.isMany&&Yf(e,n,[]),e[i]},Pr.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=O({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},Pr.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Pr.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Pr.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 Yx(e){return typeof e>"u"}function Yf(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Tu(e){return e.replace(/^:/,"")}function jn(e,t={}){this.properties=new Pr(this),this.factory=new Gf(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=bn(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){Ux(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},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 Kf=String.fromCharCode,Kx=Object.prototype.hasOwnProperty,Xx=/&#(\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 Zx(e,t,n,i){return i?Kx.call(jo,i)?jo[i]:"&"+i+";":Kf(t||parseInt(n,16))}function Ar(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(Xx,Zx):e}var Xf="non-whitespace outside of root node";function Gi(e){return new Error(e)}function Qx(e){return"missing namespace for prefix <"+e+">"}function Za(e){return{get:e,enumerable:!0}}function Jx(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var Zf=Symbol("nameCache");function Mu(e){return e+"$uri"}function e0(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[Mu(i)]=n;return t}function Qa(){return{line:0,column:0}}function t0(e){throw e}function Qf(e){if(!this)return new Qf(e);var t=e&&e.proxy,n,i,r,o,a=t0,s,c,u,l,p=Qa,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),le;for(le in N)z[le]=N[le];return g=!0,T=z,this};function F(){x=g?[]:null,b=g?e0(T):null,w=[],p=Qa,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=Qa,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=Qa,E=!1,S},this.stop=function(){E=!0};function H(N,z=!1){var le=null,$e=null,ut,q=0,pe=!1,fe=!1,se=0,ce=0,ee,j,B,U,Te,kt,C,_,y,D="",I=0,G;function oe(Je,$t){var Jt=Je.indexOf(":");if(Jt===-1)return Je;var en=b[Je.substring(0,Jt)];return en?$t===en?Je.substr(Jt+1):en+Je.substr(Jt):(A(Qx(Je.substring(0,Jt))),null)}function Ce(){if(G!==null)return G;var Je,$t,Jt=g&&b.xmlns,en=g&&m?[]:null,at=I,jt=D,hn=jt.length,ri,Nn,Qn,Bn,Dt,wr={},Sr=new Set,_n,Ue,Xe;e:for(;at<hn;at++)if(_n=!1,Ue=jt.charCodeAt(at),!(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"),_n=!0),Xe=at+1;Xe<hn;Xe++)if(Ue=jt.charCodeAt(Xe),!(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"),at=Xe;continue e}if(Ue===61)break;A("illegal attribute name char"),_n=!0}if(Dt=jt.substring(at,Xe),Dt==="xmlns:xmlns"&&(A("illegal declaration of xmlns"),_n=!0),Ue=jt.charCodeAt(Xe+1),Ue===34)Xe=jt.indexOf('"',at=Xe+2),Xe===-1&&(Xe=jt.indexOf("'",at),Xe!==-1&&(A("attribute value quote missmatch"),_n=!0));else if(Ue===39)Xe=jt.indexOf("'",at=Xe+2),Xe===-1&&(Xe=jt.indexOf('"',at),Xe!==-1&&(A("attribute value quote missmatch"),_n=!0));else for(A("missing attribute value quotes"),_n=!0,Xe=Xe+1;Xe<hn&&(Ue=jt.charCodeAt(Xe+1),!(Ue===32||Ue<14&&Ue>8));Xe++);for(Xe===-1&&(A("missing closing quotes"),Xe=hn,_n=!0),_n||(Qn=jt.substring(at,Xe)),at=Xe;Xe+1<hn&&(Ue=jt.charCodeAt(Xe+1),!(Ue===32||Ue<14&&Ue>8));Xe++)at===Xe&&(A("illegal character after attribute end"),_n=!0);if(at=Xe+1,_n)continue e;if(Sr.has(Dt)){A("attribute <"+Dt+"> already defined");continue}if(Sr.add(Dt),!g){wr[Dt]=Qn;continue}if(m){if(Nn=Dt==="xmlns"?"xmlns":Dt.charCodeAt(0)===120&&Dt.substr(0,6)==="xmlns:"?Dt.substr(6):null,Nn!==null){if(Je=Ar(Qn),$t=Mu(Nn),Bn=T[Je],!Bn){if(Nn==="xmlns"||$t in b&&b[$t]!==Je)do Bn="ns"+q++;while(typeof b[Bn]<"u");else Bn=Nn;T[Je]=Bn}b[Nn]!==Bn&&(ri||(b=Jx(b),ri=!0),b[Nn]=Bn,Nn==="xmlns"&&(b[Mu(Bn)]=Je,Jt=Bn),b[$t]=Je),wr[Dt]=Qn;continue}en.push(Dt,Qn);continue}Dt=oe(Dt,Jt),Dt!==null&&(wr[Dt]=Qn)}if(m)for(at=0,hn=en.length;at<hn;at++)Dt=oe(en[at++],Jt),Qn=en[at],Dt!==null&&(wr[Dt]=Qn);return G=wr}function We(){for(var Je=/(\r\n|\r|\n)/g,$t=0,Jt=0,en=0,at=ce,jt,hn;se>=en&&(jt=Je.exec(N),!(!jt||(at=jt[0].length+jt.index,at>se)));)$t+=1,en=at;return se==-1?(Jt=at,hn=N.substring(ce)):ce===0?hn=N.substring(ce,se):(Jt=se-en,hn=ce==-1?N.substring(se):N.substring(se,ce+1)),{data:hn,line:$t,column:Jt}}for(p=We,t&&(y=Object.create({},{name:Za(function(){return C}),originalName:Za(function(){return _}),attrs:Za(Ce),ns:Za(function(){return b})}));ce!==-1;){if(N.charCodeAt(ce)===60?se=ce:se=N.indexOf("<",ce),se===-1){if(z)return N.substring(ce);if(w.length)return L("unexpected end of file");if(!d)return L("missing start tag");ce<N.length&&N.substring(ce).trim()&&A(Xf);return}if(d||(d=!0),ce!==se){if(w.length){if(n&&(n(N.substring(ce,se),Ar,p),E))return}else if(N.substring(ce,se).trim()&&(A(Xf),E))return}if(U=N.charCodeAt(se+1),U===33){if(B=N.charCodeAt(se+2),B===91&&N.substr(se+3,6)==="CDATA["){if(ce=N.indexOf("]]>",se),ce===-1)return z?N.substring(se):L("unclosed cdata");if(o&&(o(N.substring(se+9,ce),p),E))return;ce+=3;continue}if(B===45&&N.charCodeAt(se+3)===45){if(ce=N.indexOf("-->",se),ce===-1)return z?N.substring(se):L("unclosed comment");if(c&&(c(N.substring(se+4,ce),Ar,p),E))return;ce+=3;continue}}if(U===63){if(ce=N.indexOf("?>",se),ce===-1)return z?N.substring(se):L("unclosed question");if(u&&(u(N.substring(se,ce+2),p),E))return;ce+=2;continue}for(ee=se+1;;ee++){if(Te=N.charCodeAt(ee),isNaN(Te))return z?N.substring(se):(ce=-1,L("unclosed tag"));if(Te===34)B=N.indexOf('"',ee+1),ee=B!==-1?B:ee;else if(Te===39)B=N.indexOf("'",ee+1),ee=B!==-1?B:ee;else if(Te===62){ce=ee;break}}if(U===33){if(l&&(l(N.substring(se,ce+1),Ar,p),E))return;ce+=1;continue}if(G={},U===47){if(pe=!1,fe=!0,!w.length)return L("missing open tag");if(ee=C=w.pop(),B=se+2+ee.length,N.substring(se+2,B)!==ee)return L("closing tag mismatch");for(;B<ce;B++)if(U=N.charCodeAt(B),!(U===32||U>8&&U<14))return L("close tag")}else{if(N.charCodeAt(ce-1)===47?(ee=C=N.substring(se+1,ce-1),pe=!0,fe=!0):(ee=C=N.substring(se+1,ce),pe=!0,fe=!1),!(U>96&&U<123||U>64&&U<91||U===95||U===58))return L("illegal first char nodeName");for(B=1,j=ee.length;B<j;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),G=null;break}return L("invalid nodeName")}fe||w.push(C)}if(g){ut=b,pe&&(fe||x.push(ut),G===null&&(m=ee.indexOf("xmlns",B)!==-1)&&(I=B,D=ee,Ce(),m=!1)),_=C,$e!==b&&(le=b[Zf],le===void 0&&(le=b[Zf]=Object.create(null)),$e=b);var pt=le[C];if(pt!==void 0)C=pt;else{if(U=C.indexOf(":"),U!==-1){if(kt=b[C.substring(0,U)],!kt)return L("missing namespace on <"+_+">");C=C.substr(U+1)}else kt=b.xmlns;kt&&(C=kt+":"+C),le[_]=C}}if(pe&&(I=B,D=ee,i&&(t?i(y,Ar,fe,p):i(C,Ce,Ar,fe,p),E)))return;if(fe){if(r&&(r(t?y:C,Ar,pe,p),E))return;g&&(pe?b=ut:b=x.pop())}ce+=1}}}function Jf(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var ku={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},ed="property";function td(e){return e.xml&&e.xml.serialize}function n0(e){const t=td(e);return t!==ed&&(t||null)}function i0(e){return e.charAt(0).toUpperCase()+e.slice(1)}function nd(e,t){return Jf(t)?e.prefix+":"+i0(e.localName):e.name}function r0(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 o0(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 r0(o,a)}function Wi(e){return new Error(e)}function Si(e){return e.$descriptor}function a0(e){O(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw 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 Du(){}Du.prototype=Object.create(Fo.prototype),Du.prototype.handleNode=function(){return this};function to(){}to.prototype=Object.create(Fo.prototype),to.prototype.handleText=function(e){this.body=(this.body||"")+e};function Ho(e,t){this.property=e,this.context=t}Ho.prototype=Object.create(to.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 Ou(e,t){this.element=t,this.propertyDesc=e}Ou.prototype=Object.create(to.prototype),Ou.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Pu(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function Ja(){}Ja.prototype=Object.create(to.prototype),Ja.prototype.handleNode=function(e){var t=this,n=this.element;return n?t=this.handleChild(e):(n=this.element=this.createElement(e),this.context.addElement(n)),t};function ln(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}ln.prototype=Object.create(Ja.prototype),ln.prototype.addReference=function(e){this.context.addReference(e)},ln.prototype.handleText=function(e){var t=this.element,n=Si(t),i=n.bodyProperty;if(!i)throw Wi("unexpected body text <"+e+">");to.prototype.handleText.call(this,e)},ln.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Si(t),i=n.bodyProperty;i&&e!==void 0&&(e=Pu(i.type,e),t.set(i.name,e))},ln.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=Pu(l.type,c):u==="xmlns"?u=":"+u:(s=on(u,i.ns.prefix),a.getPackage(s.prefix)&&r.addWarning({message:"unknown attribute <"+u+">",element:o,property:u,value:c})),o.set(u,c))}),o},ln.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=n0(s);if(u){const l=e.attributes[u];if(l){const p=o0(l,e.ns,r),f=r.getType(p);return O({},s,{effectiveType:Si(f).name})}}return s}var c=r.getPackage(n.prefix);if(c){const u=nd(n,c),l=r.getType(u);if(s=ot(o.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&l.hasType(p.type)}),s)return O({},s,{effectiveType:Si(l).name})}else if(s=ot(o.properties,function(u){return!u.isReference&&!u.isAttribute&&u.type==="Element"}),s)return s;throw Wi("unrecognized element <"+n.name+">")},ln.prototype.toString=function(){return"ElementDescriptor["+Si(this.type).name+"]"},ln.prototype.valueHandler=function(e,t){return new Ou(e,t)},ln.prototype.referenceHandler=function(e){return new Ho(e,this.context)},ln.prototype.handler=function(e){return e==="Element"?new no(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,Uf(n))return this.valueHandler(t,i);t.isReference?r=this.referenceHandler(t).handleNode(e):r=this.handler(n).handleNode(e);var o=r.element;return o!==void 0&&(t.isMany?i.get(t.name).push(o):i.set(t.name,o),t.isReference?(O(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function Lu(e,t,n){ln.call(this,e,t,n)}Lu.prototype=Object.create(ln.prototype),Lu.prototype.createElement=function(e){var t=e.name,n=on(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&nd(n,o)||t;if(!r.hasType(a))throw Wi("unexpected element <"+e.originalName+">");return ln.prototype.createElement.call(this,e)};function no(e,t,n){this.model=e,this.context=n}no.prototype=Object.create(Ja.prototype),no.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)},no.prototype.handleChild=function(e){var t=new no(this.model,"Element",this.context).handleNode(e),n=this.element,i=t.element,r;return i!==void 0&&(r=n.$children=n.$children||[],r.push(i),i.$parent=n),t},no.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function Iu(e){e instanceof jn&&(e={model:e}),O(this,{lax:!1},e)}Iu.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 a0(O({},t,{rootHandler:i})),s=new Qf({proxy:!0}),c=s0();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 UD=Object.defineProperty;var YD=(Q,St,Ei)=>St in Q?UD(Q,St,{enumerable:!0,configurable:!0,writable:!0,value:Ei}):Q[St]=Ei;var Zr=(Q,St,Ei)=>YD(Q,typeof St!="symbol"?St+"":St,Ei);const Ei=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway"];function Nf(e){return Ei.includes(e)}const Bf="http://g1project.net/spec/bpmn/bwl/1.0",bu="bwl",xu=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],$f={name:"bwl-hints",uri:Bf,prefix:bu,xml:{tagAlias:"lowerCase"},types:[{name:"Placement",superClass:["Element"],properties:[{name:"anchor",isAttr:!0,type:"String"},{name:"side",isAttr:!0,type:"String"},{name:"offset",isAttr:!0,type:"Real"}]},{name:"Members",superClass:["Element"],properties:[{name:"refs",isAttr:!0,type:"String"}]},{name:"BandHint",extends:["bpmn:FlowNode"],properties:[{name:"band",isAttr:!0,type:"Integer"}]},{name:"PoolOrderHint",extends:["bpmn:Participant"],properties:[{name:"poolOrder",isAttr:!0,type:"Integer"}]}]},wu="bwl.undoEpisode",jf=new WeakSet;function Rx(e){jf.has(e)||(e.register(wu,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),jf.add(e))}function Ff(e,t){Rx(e);const n={run:t};if(e.execute(wu,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const Hf=["participant.add","participant.update","node.add","node.update","sequenceFlow.add","sequenceFlow.update","messageFlow.add","messageFlow.update","dataStore.add","dataStore.update","dataAssociation.add","association.add","annotation.add","annotation.update","group.add","group.update","element.remove"],Cx={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},Px={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},Ax={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},Tx={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},Mx={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},kx={type:"object",description:"시퀀스 플로우(같은 풀 안 노드 간).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"},condition:{$ref:"#/$defs/irFlowCondition"}},required:["id","source","target"],additionalProperties:!1},Dx={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"}},required:["id","source","target"],additionalProperties:!1},Ox={type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},Lx={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},Ix={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},Nx={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},Bx={type:"object",description:"그룹 — members(요소 id 목록)가 bwl:members 힌트로 기록되고 바운즈는 멤버 bbox 로 산출된다.",properties:{id:{type:"string"},name:{type:"string"},members:{type:"array",items:{type:"string"}}},required:["id"],additionalProperties:!1},$x={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...xu]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function nn(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const jx={"participant.add":nn("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":nn("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":nn("node.add",{description:'플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 갈래 1, 2…) — 위/아래가 아니라 "주 흐름에서 몇 번째 갈래"다. 행 배치(어느 갈래가 위/아래인지)는 호스트가 정한다(대칭·메시지 방향). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.',properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["node"]}),"node.update":nn("node.update",{description:"노드 이름/레인/타입 갱신. lane = 레인 재배정(이동), type = 태스크·이벤트 타입 전환.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lane:{type:"string"},type:{type:"string",enum:[...Ei]}},required:["id"]}),"sequenceFlow.add":nn("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":nn("sequenceFlow.update",{description:"시퀀스 플로우 이름/조건/끝점 갱신. condition: null = 조건 제거. source/target = 끝점 재배선 — 중간 삽입은 기존 플로우를 지우지 말고 이것으로 한쪽 끝을 옮긴 뒤 새 플로우를 추가한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},condition:{description:"생략 = 보존, null = 제거.",anyOf:[{$ref:"#/$defs/irFlowCondition"},{type:"null"}]},source:{description:"새 출발 노드 id(생략 = 보존). 같은 배치에서 추가한 노드도 지목할 수 있다.",type:"string"},target:{description:"새 도착 노드 id(생략 = 보존). 같은 배치에서 추가한 노드도 지목할 수 있다.",type:"string"}},required:["id"]}),"messageFlow.add":nn("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":nn("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataStore.add":nn("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":nn("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataAssociation.add":nn("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":nn("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":nn("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":nn("annotation.update",{description:"주석 본문/방위 힌트 갱신. placement: null = 힌트 제거(휴리스틱 복귀). 주석 삭제는 element.remove.",properties:{id:{type:"string"},text:{type:"string"},placement:{description:"생략 = 보존, null = 힌트 제거.",anyOf:[{$ref:"#/$defs/bwlPlacement"},{type:"null"}]}},required:["id"]}),"group.add":nn("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":nn("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"element.remove":nn("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},zf={anyOf:Hf.map(e=>jx[e])},Fx={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:Px,irParticipant:Ax,irNode:Tx,irFlowCondition:Mx,irSequenceFlow:kx,irMessageFlow:Dx,irDataStore:Ox,irDataAssociation:Lx,irTextAnnotation:Ix,irAssociation:Nx,irGroup:Bx,bwlPlacement:$x,nullableString:Cx,symbolicOp:zf}};function Eu(e){return Array.prototype.concat.apply([],e)}const jo=Object.prototype.toString,Hx=Object.prototype.hasOwnProperty;function Cr(e){return e===void 0}function Lt(e){return e!==void 0}function Qr(e){return e==null}function ve(e){return jo.call(e)==="[object Array]"}function Ht(e){return jo.call(e)==="[object Object]"}function we(e){return jo.call(e)==="[object Number]"}function zt(e){const t=jo.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function xn(e){return jo.call(e)==="[object String]"}function zx(e){if(!ve(e))throw new Error("must supply array")}function wn(e,t){return!Qr(e)&&Hx.call(e,t)}function ot(e,t){const n=Xa(t);let i;return M(e,function(r,o){if(n(r,o))return i=r,!1}),i}function Vf(e,t){const n=Xa(t);let i=ve(e)?-1:void 0;return M(e,function(r,o){if(n(r,o))return i=o,!1}),i}function Le(e,t){const n=Xa(t);let i=[];return M(e,function(r,o){n(r,o)&&i.push(r)}),i}function M(e,t){let n,i;if(Cr(e))return;const r=ve(e)?Yx:Ux;for(let o in e)if(wn(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function Vx(e,t){if(Cr(e))return[];zx(e);const n=Xa(t);return e.filter(function(i,r){return!n(i,r)})}function En(e,t,n){return M(e,function(i,r){n=t(n,i,r)}),n}function Pr(e,t){return!!En(e,function(n,i,r){return n&&t(i,r)},!0)}function Gi(e,t){return!!ot(e,t)}function rn(e,t){let n=[];return M(e,function(i,r){n.push(t(i,r))}),n}function Ka(e){return e&&Object.keys(e)||[]}function Gx(e){return Ka(e).length}function Jr(e){return rn(e,t=>t)}function eo(e,t,n={}){return t=Su(t),M(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function Gf(e,...t){e=Su(e);let n={};return M(t,r=>eo(r,e,n)),rn(n,function(r,o){return r[0]})}const Wx=Gf;function ai(e,t){t=Su(t);let n=[];return M(e,function(i,r){let o=t(i,r),a={d:o,v:i};for(var c=0;c<n.length;c++){let{d:s}=n[c];if(o<s){n.splice(c,0,a);return}}n.push(a)}),rn(n,i=>i.v)}function to(e){return function(t){return Pr(e,function(n,i){return t[i]===n})}}function Su(e){return zt(e)?e:t=>t[e]}function Xa(e){return zt(e)?e:t=>t===e}function Ux(e){return e}function Yx(e){return Number(e)}function Ru(e,t){let n,i,r,o;function a(p){let f=Date.now(),d=p?0:o+t-f;if(d>0)return c(d);e.apply(r,i),s()}function c(p){n=setTimeout(a,p)}function s(){n&&clearTimeout(n),n=o=i=r=void 0}function u(){n&&a(!0),s()}function l(...p){o=Date.now(),i=p,r=this,n||c(t)}return l.flush=u,l.cancel=s,l}function yn(e,t){return e.bind(t)}function O(e,...t){return Object.assign(e,...t)}function qx(e,t,n){let i=e;return M(t,function(r,o){if(typeof r!="number"&&typeof r!="string")throw new Error("illegal key type: "+typeof r+". Key should be of type number or string.");if(r==="constructor")throw new Error("illegal key: constructor");if(r==="__proto__")throw new Error("illegal key: __proto__");let a=t[o+1],c=i[r];Lt(a)&&Qr(c)&&(c=i[r]=isNaN(+a)?{}:[]),Cr(a)?Cr(n)?delete i[r]:i[r]=n:i=c}),e}function ni(e,t){let n={},i=Object(e);return M(t,function(r){r in i&&(n[r]=e[r])}),n}function si(e,t){let n={},i=Object(e);return M(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function Cu(){}Cu.prototype.get=function(e){return this.$model.properties.get(this,e)},Cu.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function Wf(e,t){this.model=e,this.properties=t}Wf.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Cu.prototype);M(e.properties,function(a){!a.isMany&&a.default!==void 0&&(i[a.name]=a.default)}),n.defineModel(i,t),n.defineDescriptor(i,e);var r=e.ns.name;function o(a){n.define(this,"$type",{value:r,enumerable:!0}),n.define(this,"$attrs",{value:{}}),n.define(this,"$parent",{writable:!0}),M(a,yn(function(c,s){this.set(s,c)},this))}return o.prototype=i,o.hasType=i.$instanceOf=this.model.hasType,n.defineModel(o,t),n.defineDescriptor(o,e),o};var Kx=O(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),Uf=O(Object.create(null),{String:function(e){return e},Boolean:function(e){return e==="true"},Integer:function(e){return parseInt(e,10)},Real:function(e){return parseFloat(e)}});function Pu(e,t){var n=Uf[e];return n?n(t):t}function Au(e){return!!Kx[e]}function Yf(e){return!!Uf[e]}function on(e,t){var n=e.split(/:/),i,r;if(n.length===1)i=e,r=t;else if(n.length===2)i=n[1],r=n[0];else throw new Error("expected <prefix:localName> or <localName>, got "+e);return e=(r?r+":":"")+i,{name:e,prefix:r,localName:i}}function 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 ni(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 c=r.indexOf(e);if(c===-1)throw new Error("property <"+i.name+"> not found in property list");r.splice(c,1),this.addProperty(t,n?void 0:c,a),o[i.name]=o[i.localName]=t},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,c=this.propertiesByName[a];if(c)this.replaceProperty(c,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,yn(function(o){o=O({},o,{name:o.ns.localName,inherited:t}),Object.defineProperty(o,"definedBy",{value:e});var a=o.replaces,c=o.redefines;a||c?this.redefineProperty(o,a||c,a):(o.isBody&&this.setBodyProperty(o),o.isId&&this.setIdProperty(o),this.addProperty(o))},this)),i.push(e),n[r]=e)};function Wi(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,M(e,yn(this.registerPackage,this))}Wi.prototype.getPackage=function(e){return this.packageMap[e]},Wi.prototype.getPackages=function(){return this.packages},Wi.prototype.registerPackage=function(e){e=O({},e);var t=this.packageMap;qf(t,e,"prefix"),qf(t,e,"uri"),M(e.types,yn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Wi.prototype.registerType=function(e,t){e=O({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:O({},e.meta||{})});var n=on(e.name,t.prefix),i=n.name,r=Object.create(null);M(e.properties,yn(function(o){var a=on(o.name,n.prefix),c=a.name;Au(o.type)||(o.type=on(o.type,a.prefix).name),O(o,{ns:a,name:c}),r[c]=o},this)),O(e,{ns:n,name:i,propertiesByName:r}),M(e.extends,yn(function(o){var a=on(o,n.prefix),c=this.typeMap[a.name];c.traits=c.traits||[],c.traits.push(i)},this)),this.definePackage(e,t),this.typeMap[i]=e},Wi.prototype.mapTypes=function(e,t,n){var i=Au(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(s,u){var l=on(s,Au(s)?"":e.prefix);r.mapTypes(l,t,u)}function a(s){return o(s,!0)}function c(s){return o(s,!1)}if(!i)throw new Error("unknown type <"+e.name+">");M(i.superClass,n?a:c),t(i,!n),M(i.traits,a)},Wi.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},Wi.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function qf(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function Ar(e){this.model=e}Ar.prototype.set=function(e,t,n){if(!xn(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;Xx(n)?i?delete e[r]:delete e.$attrs[Tu(t)]:i?r in e?e[r]=n:Kf(e,i,n):e.$attrs[Tu(t)]=n},Ar.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[Tu(t)];var i=n.name;return!e[i]&&n.isMany&&Kf(e,n,[]),e[i]},Ar.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=O({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},Ar.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Ar.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Ar.prototype.getProperty=function(e,t){var n=this.model,i=n.getPropertyDescriptor(e,t);if(i)return i;if(t.includes(":"))return null;const r=n.config.strict;if(typeof r<"u"){const o=new TypeError(`unknown property <${t}> on <${e.$type}>`);if(r)throw o;typeof console<"u"&&console.warn(o)}return null};function Xx(e){return typeof e>"u"}function Kf(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Tu(e){return e.replace(/^:/,"")}function jn(e,t={}){this.properties=new Ar(this),this.factory=new Wf(this,this.properties),this.registry=new Wi(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=xn(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,c){qx(this,[a],c)}},o={name:e,isGeneric:!0,ns:{prefix:i.prefix,localName:i.localName,uri:t}};return this.properties.defineDescriptor(r,o),this.properties.defineModel(r,this),this.properties.define(r,"get",{enumerable:!1,writable:!0}),this.properties.define(r,"set",{enumerable:!1,writable:!0}),this.properties.define(r,"$parent",{enumerable:!1,writable:!0}),this.properties.define(r,"$instanceOf",{enumerable:!1,writable:!0}),M(n,function(a,c){Ht(a)&&a.value!==void 0?r[a.name]=a.value:r[c]=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 Xf=String.fromCharCode,Zx=Object.prototype.hasOwnProperty,Qx=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,Fo={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(Fo).forEach(function(e){Fo[e.toUpperCase()]=Fo[e]});function Jx(e,t,n,i){return i?Zx.call(Fo,i)?Fo[i]:"&"+i+";":Xf(t||parseInt(n,16))}function Tr(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(Qx,Jx):e}var Zf="non-whitespace outside of root node";function Ui(e){return new Error(e)}function e0(e){return"missing namespace for prefix <"+e+">"}function Za(e){return{get:e,enumerable:!0}}function t0(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var Qf=Symbol("nameCache");function Mu(e){return e+"$uri"}function n0(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[Mu(i)]=n;return t}function Qa(){return{line:0,column:0}}function i0(e){throw e}function Jf(e){if(!this)return new Jf(e);var t=e&&e.proxy,n,i,r,o,a=i0,c,s,u,l,p=Qa,f=!1,d=!1,h="",m=!1,g=!1,R=null,w=!1,x,b,E,T;function L(N){N instanceof Error||(N=Ui(N)),R=N,a(N,p)}function A(N){c&&(N instanceof Error||(N=Ui(N)),c(N,p))}this.on=function(N,V){if(typeof V!="function")throw Ui("required args <name, cb>");switch(N){case"openTag":i=V;break;case"text":n=V;break;case"closeTag":r=V;break;case"error":a=V;break;case"warn":c=V;break;case"cdata":o=V;break;case"attention":l=V;break;case"question":u=V;break;case"comment":s=V;break;default:throw Ui("unsupported event: "+N)}return this},this.ns=function(N){if(typeof N>"u"&&(N={}),typeof N!="object")throw Ui("required args <nsMap={}>");var V=Object.create(null),pe;for(pe in N)V[pe]=N[pe];return g=!0,T=V,this};function F(){x=g?[]:null,b=g?n0(T):null,E=[],p=Qa,w=!1,R=null,d=!1,h=""}this.parse=function(N){if(typeof N!="string")throw Ui("required args <xml=string>");if(f)throw Ui("parse during stream; call end() first");return F(),H(N),p=Qa,w=!1,R},this.write=function(N){if(typeof N!="string")throw Ui("required args <xml=string>");return f||(F(),f=!0),R||(h=H(h+N,!0)||""),this},this.end=function(){return f||F(),f=!1,R||H(h),h="",p=Qa,w=!1,R},this.stop=function(){w=!0};function H(N,V=!1){var pe=null,je=null,lt,Y=0,fe=!1,he=!1,se=0,ce=0,ee,j,$,U,ke,Dt,C,_,y,D="",I=0,W;function oe(Je,jt){var Jt=Je.indexOf(":");if(Jt===-1)return Je;var en=b[Je.substring(0,Jt)];return en?jt===en?Je.substr(Jt+1):en+Je.substr(Jt):(A(e0(Je.substring(0,Jt))),null)}function Ae(){if(W!==null)return W;var Je,jt,Jt=g&&b.xmlns,en=g&&m?[]:null,at=I,Ot=D,hn=Ot.length,oi,mn,Jn,Bn,Et,Sr={},Rr=new Set,bn,Ye,Xe;e:for(;at<hn;at++)if(bn=!1,Ye=Ot.charCodeAt(at),!(Ye===32||Ye<14&&Ye>8)){for((Ye<65||Ye>122||Ye>90&&Ye<97)&&Ye!==95&&Ye!==58&&(A("illegal first char attribute name"),bn=!0),Xe=at+1;Xe<hn;Xe++)if(Ye=Ot.charCodeAt(Xe),!(Ye>96&&Ye<123||Ye>64&&Ye<91||Ye>47&&Ye<59||Ye===46||Ye===45||Ye===95)){if(Ye===32||Ye<14&&Ye>8){A("missing attribute value"),at=Xe;continue e}if(Ye===61)break;A("illegal attribute name char"),bn=!0}if(Et=Ot.substring(at,Xe),Et==="xmlns:xmlns"&&(A("illegal declaration of xmlns"),bn=!0),Ye=Ot.charCodeAt(Xe+1),Ye===34)Xe=Ot.indexOf('"',at=Xe+2),Xe===-1&&(Xe=Ot.indexOf("'",at),Xe!==-1&&(A("attribute value quote missmatch"),bn=!0));else if(Ye===39)Xe=Ot.indexOf("'",at=Xe+2),Xe===-1&&(Xe=Ot.indexOf('"',at),Xe!==-1&&(A("attribute value quote missmatch"),bn=!0));else for(A("missing attribute value quotes"),bn=!0,Xe=Xe+1;Xe<hn&&(Ye=Ot.charCodeAt(Xe+1),!(Ye===32||Ye<14&&Ye>8));Xe++);for(Xe===-1&&(A("missing closing quotes"),Xe=hn,bn=!0),bn||(Jn=Ot.substring(at,Xe)),at=Xe;Xe+1<hn&&(Ye=Ot.charCodeAt(Xe+1),!(Ye===32||Ye<14&&Ye>8));Xe++)at===Xe&&(A("illegal character after attribute end"),bn=!0);if(at=Xe+1,bn)continue e;if(Rr.has(Et)){A("attribute <"+Et+"> already defined");continue}if(Rr.add(Et),!g){Sr[Et]=Jn;continue}if(m){if(mn=Et==="xmlns"?"xmlns":Et.charCodeAt(0)===120&&Et.substr(0,6)==="xmlns:"?Et.substr(6):null,mn!==null){if(Je=Tr(Jn),jt=Mu(mn),Bn=T[Je],!Bn){if(mn==="xmlns"||jt in b&&b[jt]!==Je)do Bn="ns"+Y++;while(typeof b[Bn]<"u");else Bn=mn;T[Je]=Bn}b[mn]!==Bn&&(oi||(b=t0(b),oi=!0),b[mn]=Bn,mn==="xmlns"&&(b[Mu(Bn)]=Je,Jt=Bn),b[jt]=Je),Sr[Et]=Jn;continue}en.push(Et,Jn);continue}Et=oe(Et,Jt),Et!==null&&(Sr[Et]=Jn)}if(m)for(at=0,hn=en.length;at<hn;at++)Et=oe(en[at++],Jt),Jn=en[at],Et!==null&&(Sr[Et]=Jn);return W=Sr}function Ue(){for(var Je=/(\r\n|\r|\n)/g,jt=0,Jt=0,en=0,at=ce,Ot,hn;se>=en&&(Ot=Je.exec(N),!(!Ot||(at=Ot[0].length+Ot.index,at>se)));)jt+=1,en=at;return se==-1?(Jt=at,hn=N.substring(ce)):ce===0?hn=N.substring(ce,se):(Jt=se-en,hn=ce==-1?N.substring(se):N.substring(se,ce+1)),{data:hn,line:jt,column:Jt}}for(p=Ue,t&&(y=Object.create({},{name:Za(function(){return C}),originalName:Za(function(){return _}),attrs:Za(Ae),ns:Za(function(){return b})}));ce!==-1;){if(N.charCodeAt(ce)===60?se=ce:se=N.indexOf("<",ce),se===-1){if(V)return N.substring(ce);if(E.length)return L("unexpected end of file");if(!d)return L("missing start tag");ce<N.length&&N.substring(ce).trim()&&A(Zf);return}if(d||(d=!0),ce!==se){if(E.length){if(n&&(n(N.substring(ce,se),Tr,p),w))return}else if(N.substring(ce,se).trim()&&(A(Zf),w))return}if(U=N.charCodeAt(se+1),U===33){if($=N.charCodeAt(se+2),$===91&&N.substr(se+3,6)==="CDATA["){if(ce=N.indexOf("]]>",se),ce===-1)return V?N.substring(se):L("unclosed cdata");if(o&&(o(N.substring(se+9,ce),p),w))return;ce+=3;continue}if($===45&&N.charCodeAt(se+3)===45){if(ce=N.indexOf("-->",se),ce===-1)return V?N.substring(se):L("unclosed comment");if(s&&(s(N.substring(se+4,ce),Tr,p),w))return;ce+=3;continue}}if(U===63){if(ce=N.indexOf("?>",se),ce===-1)return V?N.substring(se):L("unclosed question");if(u&&(u(N.substring(se,ce+2),p),w))return;ce+=2;continue}for(ee=se+1;;ee++){if(ke=N.charCodeAt(ee),isNaN(ke))return V?N.substring(se):(ce=-1,L("unclosed tag"));if(ke===34)$=N.indexOf('"',ee+1),ee=$!==-1?$:ee;else if(ke===39)$=N.indexOf("'",ee+1),ee=$!==-1?$:ee;else if(ke===62){ce=ee;break}}if(U===33){if(l&&(l(N.substring(se,ce+1),Tr,p),w))return;ce+=1;continue}if(W={},U===47){if(fe=!1,he=!0,!E.length)return L("missing open tag");if(ee=C=E.pop(),$=se+2+ee.length,N.substring(se+2,$)!==ee)return L("closing tag mismatch");for(;$<ce;$++)if(U=N.charCodeAt($),!(U===32||U>8&&U<14))return L("close tag")}else{if(N.charCodeAt(ce-1)===47?(ee=C=N.substring(se+1,ce-1),fe=!0,he=!0):(ee=C=N.substring(se+1,ce),fe=!0,he=!1),!(U>96&&U<123||U>64&&U<91||U===95||U===58))return L("illegal first char nodeName");for($=1,j=ee.length;$<j;$++)if(U=ee.charCodeAt($),!(U>96&&U<123||U>64&&U<91||U>47&&U<59||U===45||U===95||U==46)){if(U===32||U<14&&U>8){C=ee.substring(0,$),W=null;break}return L("invalid nodeName")}he||E.push(C)}if(g){lt=b,fe&&(he||x.push(lt),W===null&&(m=ee.indexOf("xmlns",$)!==-1)&&(I=$,D=ee,Ae(),m=!1)),_=C,je!==b&&(pe=b[Qf],pe===void 0&&(pe=b[Qf]=Object.create(null)),je=b);var pt=pe[C];if(pt!==void 0)C=pt;else{if(U=C.indexOf(":"),U!==-1){if(Dt=b[C.substring(0,U)],!Dt)return L("missing namespace on <"+_+">");C=C.substr(U+1)}else Dt=b.xmlns;Dt&&(C=Dt+":"+C),pe[_]=C}}if(fe&&(I=$,D=ee,i&&(t?i(y,Tr,he,p):i(C,Ae,Tr,he,p),w)))return;if(he){if(r&&(r(t?y:C,Tr,fe,p),w))return;g&&(fe?b=lt:b=x.pop())}ce+=1}}}function ed(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var ku={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},td="property";function nd(e){return e.xml&&e.xml.serialize}function r0(e){const t=nd(e);return t!==td&&(t||null)}function o0(e){return e.charAt(0).toUpperCase()+e.slice(1)}function id(e,t){return ed(t)?e.prefix+":"+o0(e.localName):e.name}function a0(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 s0(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 a0(o,a)}function Yi(e){return new Error(e)}function Si(e){return e.$descriptor}function c0(e){O(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw Yi("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 Yi("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function Ho(){}Ho.prototype.handleEnd=function(){},Ho.prototype.handleText=function(){},Ho.prototype.handleNode=function(){};function Du(){}Du.prototype=Object.create(Ho.prototype),Du.prototype.handleNode=function(){return this};function no(){}no.prototype=Object.create(Ho.prototype),no.prototype.handleText=function(e){this.body=(this.body||"")+e};function zo(e,t){this.property=e,this.context=t}zo.prototype=Object.create(no.prototype),zo.prototype.handleNode=function(e){if(this.element)throw Yi("expected no sub nodes");return this.element=this.createReference(e),this},zo.prototype.handleEnd=function(){this.element.id=this.body},zo.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function Ou(e,t){this.element=t,this.propertyDesc=e}Ou.prototype=Object.create(no.prototype),Ou.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Pu(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function Ja(){}Ja.prototype=Object.create(no.prototype),Ja.prototype.handleNode=function(e){var t=this,n=this.element;return n?t=this.handleChild(e):(n=this.element=this.createElement(e),this.context.addElement(n)),t};function ln(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}ln.prototype=Object.create(Ja.prototype),ln.prototype.addReference=function(e){this.context.addReference(e)},ln.prototype.handleText=function(e){var t=this.element,n=Si(t),i=n.bodyProperty;if(!i)throw Yi("unexpected body text <"+e+">");no.prototype.handleText.call(this,e)},ln.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Si(t),i=n.bodyProperty;i&&e!==void 0&&(e=Pu(i.type,e),t.set(i.name,e))},ln.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=Si(n),r=this.context,o=new n({}),a=this.model,c;return M(t,function(s,u){var l=i.propertiesByName[u],p;l&&l.isReference?l.isMany?(p=s.split(" "),M(p,function(f){r.addReference({element:o,property:l.ns.name,id:f})})):r.addReference({element:o,property:l.ns.name,id:s}):(l?s=Pu(l.type,s):u==="xmlns"?u=":"+u:(c=on(u,i.ns.prefix),a.getPackage(c.prefix)&&r.addWarning({message:"unknown attribute <"+u+">",element:o,property:u,value:s})),o.set(u,s))}),o},ln.prototype.getPropertyForNode=function(e){var t=e.name,n=on(t),i=this.type,r=this.model,o=Si(i),a=n.name,c=o.propertiesByName[a];if(c&&!c.isAttr){const u=r0(c);if(u){const l=e.attributes[u];if(l){const p=s0(l,e.ns,r),f=r.getType(p);return O({},c,{effectiveType:Si(f).name})}}return c}var s=r.getPackage(n.prefix);if(s){const u=id(n,s),l=r.getType(u);if(c=ot(o.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&l.hasType(p.type)}),c)return O({},c,{effectiveType:Si(l).name})}else if(c=ot(o.properties,function(u){return!u.isReference&&!u.isAttribute&&u.type==="Element"}),c)return c;throw Yi("unrecognized element <"+n.name+">")},ln.prototype.toString=function(){return"ElementDescriptor["+Si(this.type).name+"]"},ln.prototype.valueHandler=function(e,t){return new Ou(e,t)},ln.prototype.referenceHandler=function(e){return new zo(e,this.context)},ln.prototype.handler=function(e){return e==="Element"?new io(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,Yf(n))return this.valueHandler(t,i);t.isReference?r=this.referenceHandler(t).handleNode(e):r=this.handler(n).handleNode(e);var o=r.element;return o!==void 0&&(t.isMany?i.get(t.name).push(o):i.set(t.name,o),t.isReference?(O(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function Lu(e,t,n){ln.call(this,e,t,n)}Lu.prototype=Object.create(ln.prototype),Lu.prototype.createElement=function(e){var t=e.name,n=on(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&id(n,o)||t;if(!r.hasType(a))throw Yi("unexpected element <"+e.originalName+">");return ln.prototype.createElement.call(this,e)};function io(e,t,n){this.model=e,this.context=n}io.prototype=Object.create(Ja.prototype),io.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)},io.prototype.handleChild=function(e){var t=new io(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},io.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function Iu(e){e instanceof jn&&(e={model:e}),O(this,{lax:!1},e)}Iu.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 c0(O({},t,{rootHandler:i})),c=new Jf({proxy:!0}),s=u0();i.context=a,s.push(i);function u(E,T,L){var A=T(),F=A.line,H=A.column,N=A.data;N.charAt(0)==="<"&&N.indexOf(" ")!==-1&&(N=N.slice(0,N.indexOf(" "))+">");var V="unparsable content "+(N?N+" ":"")+`detected
|
|
2
2
|
line: `+F+`
|
|
3
3
|
column: `+H+`
|
|
4
|
-
nested error: `+
|
|
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 S0(e){e=O({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new E0,o=new w0(r,e.format);e.preamble&&o.append(c0);var a=new ft,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(R0(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function R0(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in ku)n[i]=ku[i];for(const i in t){const r=t[i];n[r]=i}for(const i of e.getPackages())n[i.prefix]=i.uri;return n}function ts(e,t){jn.call(this,e,t)}ts.prototype=Object.create(jn.prototype),ts.prototype.fromXML=function(e,t,n){bn(t)||(n=t,t="bpmn:Definitions");var i=new Iu(O({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},ts.prototype.toXML=function(e,t){var n=new S0(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var C0="BPMN20",P0="http://www.omg.org/spec/BPMN/20100524/MODEL",A0="bpmn",T0=[],M0=[{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"}]}],k0=[{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"}]}],D0={tagAlias:"lowerCase",typePrefix:"t"},O0={name:C0,uri:P0,prefix:A0,associations:T0,types:M0,enumerations:k0,xml:D0},L0="BPMNDI",I0="http://www.omg.org/spec/BPMN/20100524/DI",N0="bpmndi",B0=[{name:"BPMNDiagram",properties:[{name:"plane",type:"BPMNPlane",redefines:"di:Diagram#rootElement"},{name:"labelStyle",type:"BPMNLabelStyle",isMany:!0}],superClass:["di:Diagram"]},{name:"BPMNPlane",properties:[{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"}],superClass:["di:Plane"]},{name:"BPMNShape",properties:[{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"},{name:"isHorizontal",isAttr:!0,type:"Boolean"},{name:"isExpanded",isAttr:!0,type:"Boolean"},{name:"isMarkerVisible",isAttr:!0,type:"Boolean"},{name:"label",type:"BPMNLabel"},{name:"isMessageVisible",isAttr:!0,type:"Boolean"},{name:"participantBandKind",type:"ParticipantBandKind",isAttr:!0},{name:"choreographyActivityShape",type:"BPMNShape",isAttr:!0,isReference:!0}],superClass:["di:LabeledShape"]},{name:"BPMNEdge",properties:[{name:"label",type:"BPMNLabel"},{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"},{name:"sourceElement",isAttr:!0,isReference:!0,type:"di:DiagramElement",redefines:"di:Edge#source"},{name:"targetElement",isAttr:!0,isReference:!0,type:"di:DiagramElement",redefines:"di:Edge#target"},{name:"messageVisibleKind",type:"MessageVisibleKind",isAttr:!0,default:"initiating"}],superClass:["di:LabeledEdge"]},{name:"BPMNLabel",properties:[{name:"labelStyle",type:"BPMNLabelStyle",isAttr:!0,isReference:!0,redefines:"di:DiagramElement#style"}],superClass:["di:Label"]},{name:"BPMNLabelStyle",properties:[{name:"font",type:"dc:Font"}],superClass:["di:Style"]}],$0=[{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"}]}],j0=[],F0={name:L0,uri:I0,prefix:N0,types:B0,enumerations:$0,associations:j0},H0="DC",z0="http://www.omg.org/spec/DD/20100524/DC",V0="dc",G0=[{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}]}],W0=[],U0={name:H0,uri:z0,prefix:V0,types:G0,associations:W0},q0="DI",Y0="http://www.omg.org/spec/DD/20100524/DI",K0="di",X0=[{name:"DiagramElement",isAbstract:!0,properties:[{name:"id",isAttr:!0,isId:!0,type:"String"},{name:"extension",type:"Extension"},{name:"owningDiagram",type:"Diagram",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"owningElement",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"modelElement",isReadOnly:!0,isVirtual:!0,isReference:!0,type:"Element"},{name:"style",type:"Style",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"ownedElement",type:"DiagramElement",isReadOnly:!0,isMany:!0,isVirtual:!0}]},{name:"Node",isAbstract:!0,superClass:["DiagramElement"]},{name:"Edge",isAbstract:!0,superClass:["DiagramElement"],properties:[{name:"source",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"target",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"waypoint",isUnique:!1,isMany:!0,type:"dc:Point",xml:{serialize:"xsi:type"}}]},{name:"Diagram",isAbstract:!0,properties:[{name:"id",isAttr:!0,isId:!0,type:"String"},{name:"rootElement",type:"DiagramElement",isReadOnly:!0,isVirtual:!0},{name:"name",isAttr:!0,type:"String"},{name:"documentation",isAttr:!0,type:"String"},{name:"resolution",isAttr:!0,type:"Real"},{name:"ownedStyle",type:"Style",isReadOnly:!0,isMany:!0,isVirtual:!0}]},{name:"Shape",isAbstract:!0,superClass:["Node"],properties:[{name:"bounds",type:"dc:Bounds"}]},{name:"Plane",isAbstract:!0,superClass:["Node"],properties:[{name:"planeElement",type:"DiagramElement",subsettedProperty:"DiagramElement-ownedElement",isMany:!0}]},{name:"LabeledEdge",isAbstract:!0,superClass:["Edge"],properties:[{name:"ownedLabel",type:"Label",isReadOnly:!0,subsettedProperty:"DiagramElement-ownedElement",isMany:!0,isVirtual:!0}]},{name:"LabeledShape",isAbstract:!0,superClass:["Shape"],properties:[{name:"ownedLabel",type:"Label",isReadOnly:!0,subsettedProperty:"DiagramElement-ownedElement",isMany:!0,isVirtual:!0}]},{name:"Label",isAbstract:!0,superClass:["Node"],properties:[{name:"bounds",type:"dc:Bounds"}]},{name:"Style",isAbstract:!0,properties:[{name:"id",isAttr:!0,isId:!0,type:"String"}]},{name:"Extension",properties:[{name:"values",isMany:!0,type:"Element"}]}],Z0=[],Q0={tagAlias:"lowerCase"},J0={name:q0,uri:Y0,prefix:K0,types:X0,associations:Z0,xml:Q0},eE="bpmn.io colors for BPMN",tE="http://bpmn.io/schema/bpmn/biocolor/1.0",nE="bioc",iE=[{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"}]}],rE=[],oE=[],aE={name:eE,uri:tE,prefix:nE,types:iE,enumerations:rE,associations:oE},sE="BPMN in Color",cE="http://www.omg.org/spec/BPMN/non-normative/color/1.0",uE="color",lE=[{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"}]}],pE=[],fE=[],dE={name:sE,uri:cE,prefix:uE,types:lE,enumerations:pE,associations:fE};const hE={bpmn:O0,bpmndi:F0,dc:U0,di:J0,bioc:aE,color:dE};function sd(e,t){const n=O({},hE,e);return new ts(n,t)}const mE={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"}},gE="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",cd="i18n",ns={[cd]:mE,[bu]:Bf};function ud(){return sd(ns)}const ld=ud();async function $u(e){const{rootElement:t,warnings:n}=await ld.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function yE(e){const{xml:t}=await ld.toXML(e,{format:!0});return t}function ju(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const is=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),vE=1,_E=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}`;case"group-overlap-unintended":return`g|${e.groups[0]}|${e.groups[1]}`}}const pd=20,fd=5,dd=1;function pn(e){const t=[];for(let n=0;n+1<e.waypoints.length;n++){const i=e.waypoints[n],r=e.waypoints[n+1];Math.abs(i.y-r.y)<.5&&Math.abs(i.x-r.x)>=.5?t.push({axis:"h",at:i.y,lo:Math.min(i.x,r.x),hi:Math.max(i.x,r.x),dir:r.x>i.x?1:-1}):Math.abs(i.x-r.x)<.5&&Math.abs(i.y-r.y)>=.5&&t.push({axis:"v",at:i.x,lo:Math.min(i.y,r.y),hi:Math.max(i.y,r.y),dir:r.y>i.y?1:-1})}return t}function rs(e,t){let n=null;const i=e.type!==t.type;for(const r of pn(e))for(const o of pn(t)){if(r.axis!==o.axis||Math.abs(r.at-o.at)>dd)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>=pd&&(!n||s>n.length)&&(n={axis:r.axis,length:s,kind:a})}return n}function hd(e,t){const n=rs(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function bE(e,t){let n=0;for(const i of t)i.id!==e.id&&hd(e,i)&&n++;return n}function zo(e,t){let n=0;for(const i of t)i.id!==e.id&&rs(e,i)&&n++;return n}const md=15,gd=20;function xE(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-gd||t.at>n[1]+gd)return null;const i=t.axis==="v"?[e.y,e.y+e.height]:[e.x,e.x+e.width],r=Math.max(i[0],t.lo),o=Math.min(i[1],t.hi);return o>r?[r,o]:null}const Fu=20;function os(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>dd)continue;const r=Math.max(e.lo,i.lo),o=Math.min(e.hi,i.hi);o-r<pd||n.push([r-Fu,o+Fu])}return n}function as(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of pn(e)){const o=xE(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of os(r,pn(a)))if(Math.min(c,o[1])>Math.max(s,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const EE=1,wE=(e,t,n)=>t.x>=e.x-n&&t.y>=e.y-n&&t.x+t.width<=e.x+e.width+n&&t.y+t.height<=e.y+e.height+n;function SE(e,t,n,i){const r=n.x+i,o=n.y+i,a=n.x+n.width-i,s=n.y+n.height-i;if(a<=r||s<=o)return!1;const c=t.x-e.x,u=t.y-e.y;let l=0,p=1;const f=(d,h)=>{if(h===0)return d<=0;const m=d/h;if(h>0){if(m>p)return!1;m>l&&(l=m)}else{if(m<l)return!1;m<p&&(p=m)}return!0};return f(r-e.x,c)&&f(e.x-a,-c)&&f(o-e.y,u)&&f(e.y-s,-u)&&p>l}function yd(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 RE=(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 vd(e,t){const n=e.label;if(!n)return null;if(pn(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(pn(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(SE(e.waypoints[o],e.waypoints[o+1],r,_E)){i.push(r);break}}return i}function CE(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 _d=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function ss(e,t){let n=0;for(const i of t){if(i.id===e.id||_d(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++)CE(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function Mr(e,t){let n=0;for(const i of t)i.id===e.id||_d(e,i)||ss(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function bd(e){let t=0;const n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)ss(n[i],[n[r]])>0&&(t+=n[i].type===n[r].type?2:1);return t}function Hu(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(ss(n[i],[n[r]])>0){const o=n[i].id,a=n[r].id;t.push(o<a?[o,a]:[a,o])}return t.sort((i,r)=>`${i[0]}|${i[1]}`.localeCompare(`${r[0]}|${r[1]}`))}function xd(e){var n;const t=(n=mt(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const r=mt(i);if((r==null?void 0:r.$type)!=="bwl:Members"||typeof r.refs!="string")continue;const o=r.refs.split(/\s+/).filter(Boolean);return o.length?o:void 0}}const Ed=e=>e?{members:e}:{},qi=e=>e.shapes.filter(t=>!t.container);function PE(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 wd(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(pn(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 cs(e){const t=[];for(const n of e.shapes)n.label&&t.push({owner:n.id,rect:n.label});for(const n of e.edges)n.label&&t.push({owner:n.id,rect:n.label});return t}function Yi(e){const t=[],n=e.shapes.filter(s=>!s.container);for(const s of e.edges)for(const c of ci(s,n))t.push({kind:"edge-crosses-shape",edge:s.id,shape:c.id});const i=n.filter(s=>!s.attached);for(let s=0;s<i.length;s++)for(let c=s+1;c<i.length;c++){const u=i[s],l=i[c];if(!yd(u,l,vE))continue;const p=u.id<l.id?[u.id,l.id]:[l.id,u.id];t.push({kind:"shape-overlap",shapes:p,identical:RE(u,l)})}const r=e.shapes.filter(s=>s.type==="bpmn:Group"&&Array.isArray(s.members)&&s.members.length>0);for(let s=0;s<r.length;s++)for(let c=s+1;c<r.length;c++){const u=r[s],l=r[c],p=Math.min(u.x+u.width,l.x+l.width)-Math.max(u.x,l.x),f=Math.min(u.y+u.height,l.y+l.height)-Math.max(u.y,l.y);if(p<=fd||f<=fd)continue;const d=new Set(l.members);u.members.some(h=>d.has(h))||t.push({kind:"group-overlap-unintended",groups:u.id<l.id?[u.id,l.id]:[l.id,u.id]})}for(let s=0;s<e.edges.length;s++)for(let c=s+1;c<e.edges.length;c++){const u=e.edges[s],l=e.edges[c],p=rs(u,l);if(!p)continue;const f=u.id<l.id?[u.id,l.id]:[l.id,u.id];t.push({kind:p.kind==="opposite"?"edge-overlap-opposite":"edge-overlap-mixed",edges:f,axis:p.axis,length:Math.round(p.length)})}for(const s of e.edges){if(!s.label)continue;const c=as(s,e.edges);c&&t.push({kind:"label-on-shared-segment",edge:s.id,other:c.other,axis:c.axis})}for(const s of e.edges){if(!s.label)continue;const c=vd(s,e);c&&t.push({kind:"label-over-line",edge:s.id,line:c})}for(const s of n){if(!s.label)continue;const c=wd(s,e);c&&t.push({kind:"label-over-line",edge:s.id,line:c})}const o=cs(e);for(const s of n)if(s.type==="bpmn:TextAnnotation")for(const{owner:c,rect:u}of o)c!==s.id&&yd(s,u,Vo)&&t.push({kind:"annotation-over-label",annotation:s.id,label:c});const a=new Map(e.shapes.map(s=>[s.id,s]));for(const s of n){const c=s.parent??PE(s,e,a);if(!c)continue;const u=a.get(c);!u||!u.container||wE(u,s,EE)||t.push({kind:"shape-outside-container",shape:s.id,container:u.id})}return t.sort((s,c)=>Ui(s).localeCompare(Ui(c)))}const mt=e=>typeof e=="object"&&e!==null?e:void 0,bt=e=>typeof e=="number"?e:0,kr=e=>{const t=mt(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function AE(e){const t=mt(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=kr(o);a&&n.push(a)}}return n}function TE(e,t){const n=mt(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const r=kr(n);return r?t.get(r):void 0}if(is.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return kr(n)}function Sd(e){var o,a,s,c,u;const t=[],n=[],i=((o=mt(e))==null?void 0:o.diagrams)??[],r=new Map;for(const l of((a=mt(e))==null?void 0:a.rootElements)??[]){const p=mt(l);if((p==null?void 0:p.$type)==="bpmn:Collaboration")for(const f of p.participants??[]){const d=mt(f),h=kr(d),m=kr(d==null?void 0:d.processRef);h&&m&&r.set(m,h)}}for(const l of i){const p=mt((s=mt(l))==null?void 0:s.plane),f=(p==null?void 0:p.planeElement)??[];for(const d of f){const h=mt(d);if(!h)continue;const m=mt(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=mt(h.bounds);if(E){const b=h.isExpanded===!1,w=mt((c=mt(h.label))==null?void 0:c.bounds);t.push({id:g,type:S,x:bt(E.x),y:bt(E.y),width:bt(E.width),height:bt(E.height),container:is.has(S)&&!b,attached:(m==null?void 0:m.attachedToRef)!==void 0,...m?{parent:TE(m,r)}:{},...w?{label:{x:bt(w.x),y:bt(w.y),width:bt(w.width),height:bt(w.height)}}:{},...S==="bpmn:Group"?Ed(xd(m)):{}});continue}const x=h.waypoint;if(Array.isArray(x)){const b=mt((u=mt(h.label))==null?void 0:u.bounds);n.push({id:g,type:S,waypoints:x.map(w=>{var T,L;return{x:bt((T=mt(w))==null?void 0:T.x),y:bt((L=mt(w))==null?void 0:L.y)}}),endpoints:AE(m),...b?{label:{x:bt(b.x),y:bt(b.y),width:bt(b.width),height:bt(b.height)}}:{}})}}}return{shapes:t,edges:n}}function Rd(e){return Yi(Sd(e))}async function ME(e){const{definitions:t,warnings:n}=await $u(e);return{findings:Rd(t),warnings:n}}function qt(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=mt(r.label);n.push({id:r.id,type:o,waypoints:a.map(d=>({x:bt(d.x),y:bt(d.y)})),endpoints:[kr(r.source),kr(r.target)].filter(d=>!!d),...f&&typeof f.x=="number"?{label:{x:f.x,y:bt(f.y),width:bt(f.width),height:bt(f.height)}}:{}});continue}if(typeof r.x!="number"||typeof r.y!="number")continue;const s=mt(r.businessObject),c=mt(r.label);let u=mt(r.parent);for(;u&&u.type==="bpmn:Lane";)u=mt(u.parent);const l=typeof(u==null?void 0:u.type)=="string"?u.type:"",p=u&&is.has(l)&&l!=="bpmn:Group"&&typeof u.id=="string"?u.id:void 0;t.push({id:r.id,type:o,x:r.x,y:r.y,width:bt(r.width),height:bt(r.height),container:is.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:bt(c.y),width:bt(c.width),height:bt(c.height)}}:{},...o==="bpmn:Group"?Ed(xd(s)):{}})}return{shapes:t,edges:n}}const kE={"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 DE(e,t){const n=kE[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function Cd(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function Pd(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 DE(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&Cd(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?Cd(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 Ad=20,OE=4,St=(e,t)=>Math.abs(e-t)<.5;function Td(e,t,n,i=Ad){if(St(e.y,t.y)&&!St(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(St(e.x,t.x)&&!St(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 Md(e,t,n=Ad){if(e.length!==4)return null;const[i,r,o,a]=e;if(St(i.y,r.y)&&St(r.x,o.x)&&St(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(St(i.x,r.x)&&St(r.y,o.y)&&St(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 kd(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 Dd=30,LE=[0,-25,25,-40,40];function IE(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+Dd:s-Dd,u=a?i.y+i.height:i.y,l=n.x+n.width/2,p=i.x+i.width/2;return LE.map(f=>[{x:l,y:s},{x:l,y:c},{x:p+f,y:c},{x:p+f,y:u}])}const NE=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],us=(e,t,n)=>ci({...e,waypoints:t},n).length;function Od(e,t,n,i){let r=[...e.waypoints],o=us(e,r,t);if(o===0)return null;let a=!1;for(const p of kd(e,t))if(us(e,p,t)===0)return p;const s=(i??[]).filter(p=>p.id!==e.id).flatMap(pn),c=p=>pn({...e,waypoints:p}).some(f=>os(f,s).length>0),u=IE(e,t).filter(p=>us(e,p,t)===0);if(u.length)return u.find(p=>!c(p))??u[0];const l=p=>!n||p.every(f=>f.x>=n.x&&f.x<=n.x+n.width&&f.y>=n.y&&f.y<=n.y+n.height);for(let p=0;p<OE&&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=Td(h,m,g),E=S?S.map(b=>NE(r,d,b)):Md(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=us(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 Ld(e,t){const{elementRegistry:n}=e,i=e.modeling,r=qt(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=Od(u,o,f,r.edges);d&&i.updateWaypoints(l,d)}}const BE=10;function Id(e,t){if(e.parent){const r=t.find(o=>o.id===e.parent);if(r)return r}const n=e.x+e.width/2,i=e.y+e.height/2;return t.find(r=>n>=r.x&&n<=r.x+r.width&&i>=r.y&&i<=r.y+r.height)}function Nd(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(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=Id(i,n),a=Id(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,le)=>z.y-le.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=Mr(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((le,$e)=>$e===0||!(St(le.x,z[$e-1].x)&&St(le.y,z[$e-1].y)));let N;for(let z=L;z<=A;z+=BE){const le=H([S,{x:S.x,y:m},{x:z,y:m},{x:z,y:g},{x:E.x,y:g},E]),$e={...e,waypoints:le};if(ci($e,x).length>0)continue;const ut=Mr($e,b),q=Math.abs(z-F);(!N||ut<N.cross||ut===N.cross&&q<N.detour)&&(N={pts:le,cross:ut,detour:q})}return N&&(T>0?N.cross<=w:N.cross<w)?N.pts:null}function Bd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=qt(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=qt(n),s=a.edges.find(l=>l.id===o.id);if(!s)continue;const c=Nd(s,a);if(!c)continue;const u=n.get(o.id);u&&i.updateWaypoints(u,c)}}const io=[25,-25,40,-40],ls=35;function $d(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];if(i.x+i.width>n.x)return[];const r=n.y+n.height/2;if(r>=i.y&&r<=i.y+i.height)return[];const o=i.x+i.width/2,a=n.x+n.width/2,s=r<i.y,c=s?i.y:i.y+i.height,u=s?n.y:n.y+n.height,l=s?n.y-ls:n.y+n.height+ls,p=[];for(const E of[0,...io]){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,...io]){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,...io]){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+ls:i.y-ls;for(const E of[0,...io]){if(Math.abs(E)>=i.width/2-5)continue;const x=o+E;for(const b of[0,...io]){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 ps=30;function jd(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],r=e[n+1],o=St(i.y,r.y)&&!St(i.x,r.x),a=St(i.x,r.x)&&!St(i.y,r.y);if(!(!o&&!a))for(const s of t)if(o){const c=Math.min(i.x,r.x);if(Math.max(i.x,r.x)<=s.x||c>=s.x+s.width)continue;if(Math.abs(i.y-s.y)<ps||Math.abs(i.y-(s.y+s.height))<ps)return!0}else{const c=Math.min(i.y,r.y);if(Math.max(i.y,r.y)<=s.y||c>=s.y+s.height)continue;if(Math.abs(i.x-s.x)<ps||Math.abs(i.x-(s.x+s.width))<ps)return!0}}return!1}const fs=40;function $E(e,t,n){let i=0;for(const r of t){if(r.container||n.includes(r.id))continue;const o=r.x-fs,a=r.x+r.width+fs,s=r.y-fs,c=r.y+r.height+fs;for(let u=1;u<e.length-2;u++){const l=e[u],p=e[u+1],f={x:Math.min(l.x,p.x),y:Math.min(l.y,p.y)},d={x:Math.max(l.x,p.x),y:Math.max(l.y,p.y)};if(f.x<a&&d.x>o&&f.y<c&&d.y>s){i++;break}}}return i}function Fd(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=Mr(e,o),c=E=>$E(E,t.shapes,e.endpoints)+(jd(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(St(b.y,w.y)&&!St(b.x,w.x)&&b.y>f.y&&b.y<f.y+f.height)return!0}return!1},m=h(e.waypoints);if(!jd(e.waypoints,n)&&!(d&&!m))return null;const g=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 $d(e,i)){const b={...e,waypoints:E};if(ci(b,r).length>0||zo(b,o)>a||Mr(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 Hd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=qt(n).edges.filter(o=>o.type==="bpmn:SequenceFlow"&&!t.has(o.id)).map(o=>o.id).sort();for(const o of r){const a=qt(n),s=a.edges.find(l=>l.id===o);if(!s)continue;const c=Fd(s,a);if(!c)continue;const u=n.get(o);u&&i.updateWaypoints(u,c)}}function jE(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=St(n[0].x,n[1].x)&&!St(n[0].y,n[1].y),s=St(n[n.length-1].x,n[n.length-2].x)&&!St(n[n.length-1].y,n[n.length-2].y);for(const c of io){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 zd(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=Mr(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=[...$d(e,n),...jE(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=Mr(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 Vd(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=qt(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=qt(i),f=p.edges.find(m=>m.id===l);if(!f)continue;const d=zd(f,p);if(!d)continue;const h=i.get(l);h&&r.updateWaypoints(h,d)}}const FE=10,HE=(e,t)=>e.x<t.x+t.width&&t.x<e.x+e.width&&e.y<t.y+t.height&&t.y<e.y+e.height;function Gd(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!as(e,i))return null;const r=qi(t),o=i.flatMap(pn);for(const a of pn(e)){let s=[[a.lo,a.hi]];for(const[d,h]of os(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+FE*2);if(!u)continue;const l=(u[0]+u[1])/2,p=a.axis==="h"?{x:l,y:a.at-md}:{x:a.at+wn+n.width/2,y:l},f={x:p.x-n.width/2,y:p.y-n.height/2,width:n.width,height:n.height};if(!as({...e,label:f},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&HE(f,d)))return f}return null}const wn=8;function Wd(e,t){const n=e.label;if(!n)return null;const i=pn(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(pn),...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)+wn,p=[0,-l,l,-2*l,2*l];if(s.axis==="v")for(const f of[s.at+wn,s.at-wn-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-wn-n.height,s.at+wn])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 Ud(e,t){const{elementRegistry:n}=e,i=e.modeling,r=qt(n);for(const o of r.edges){if(!o.label||t.has(o.id))continue;const a=Wd(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 qd(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=qt(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=Gd(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 Yd(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(pn),...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=cs(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-wn-n.height},{...n,y:f.at+wn}):u.push({...n,x:f.at-wn-n.width},{...n,x:f.at+wn});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+wn},{...n,x:l-n.width/2,y:e.y-wn-n.height},{...n,x:e.x+e.width+wn,y:p-n.height/2},{...n,x:e.x-wn-n.width,y:p-n.height/2}),u.find(c)??null}function Kd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=qt(n);for(const o of r.shapes){if(o.container||!o.label||t.has(o.id))continue;const a=Yd(o,qt(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 zE=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,Xd=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),Zd={"participant.add":[{path:"participant",shape:["id"]},{path:"participant.lanes[]",shape:["id"],optional:!0}],"participant.update":[{path:"id",shape:null},{path:"lanes[]",shape:["id"],optional:!0}],"node.add":[{path:"node",shape:["id","type"]}],"node.update":[{path:"id",shape:null}],"sequenceFlow.add":[{path:"flow",shape:["id","source","target"]}],"sequenceFlow.update":[{path:"id",shape:null}],"messageFlow.add":[{path:"flow",shape:["id","source","target"]}],"messageFlow.update":[{path:"id",shape:null}],"dataStore.add":[{path:"dataStore",shape:["id"]},{path:"associations[]",shape:["source","target"],optional:!0}],"dataStore.update":[{path:"id",shape:null}],"dataAssociation.add":[{path:"association",shape:["source","target"]}],"association.add":[{path:"association",shape:["source","target"]}],"annotation.add":[{path:"annotation",shape:["id","text"]},{path:"association",shape:["source","target"],optional:!0},{path:"placement",shape:["anchor","side"],optional:!0}],"annotation.update":[{path:"id",shape:null},{path:"placement",shape:["anchor","side"],optional:!0}],"group.add":[{path:"group",shape:["id"]},{path:"group.members[]",shape:null,optional:!0}],"group.update":[{path:"id",shape:null},{path:"members[]",shape:null,optional:!0}],"element.remove":[{path:"id",shape:null}]},ds=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),zu=e=>typeof e=="string"&&e!=="";function VE(e){const t=[];function n(i,r,o,a){if(a===null){zu(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!ds(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)zu(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{if(!ds(i)||!zu(i.kind)||!(i.kind in Zd)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const o of Zd[i.kind]){const a=o.path.endsWith("[]"),s=a?o.path.slice(0,-2):o.path,c=s.split(".");let u=i;for(const p of c.slice(0,-1)){if(!ds(u))break;u=u[p]}if(!ds(u))continue;const l=u[c[c.length-1]];if(!(l===void 0&&o.optional)&&!(l===null&&o.optional)){if(!a){n(r,o.path,l,o.shape);continue}if(!Array.isArray(l)){t.push({kind:"payload-invalid",opIndex:r,field:o.path});continue}l.forEach((p,f)=>n(r,`${s}[${f}]`,p,o.shape))}}if(i.kind==="node.add"){const o=i.band;o!==void 0&&(!Number.isInteger(o)||o<0)&&t.push({kind:"payload-invalid",opIndex:r,field:"band"})}}),t}function Qd(e,t){const n=VE(e);if(n.length>0)return n;const i=[],r=new Map,o=new Map;function a(f,d,h){if(!zE.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&&Xd.has(g)&&i.push({kind:"ref-category",opIndex:d,ref:m,role:"member",expected:"shape",actual:g})}break}case"participant.update":{if(p(d,f.id,"participant")===void 0)break;if(f.lanes){const m=t.lanesOf(f.id),g=f.lanes.map(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&&Xd.has(g)&&i.push({kind:"ref-category",opIndex:d,ref:m,role:"member",expected:"shape",actual:g})}break}case"element.remove":{p(d,f.id)==="lane"&&i.push({kind:"ref-category",opIndex:d,ref:f.id,role:"target",expected:"removable",actual:"lane"});break}}}),i;function p(f,d,h){if(r.has(d)){i.push({kind:"target-added-in-batch",opIndex:f,id:d});return}const m=t.categoryOf(d);if(m===void 0){i.push({kind:"ref-missing",opIndex:f,ref:d,role:"target"});return}if(h&&m!==h){i.push({kind:"ref-category",opIndex:f,ref:d,role:"target",expected:h,actual:m});return}return m}}const ro={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},GE=/[ᄀ-ᇿ -〿-ヿ㐀-鿿가--⦆]/;function WE(e){const t=ro;return GE.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*WE(i);return n}function Jd(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&UE(e),qE(e),YE(e),KE(e)}function UE(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*ro.ascentEm,fontBoundingBoxDescent:o*ro.descentEm,actualBoundingBoxAscent:o*ro.ascentEm,actualBoundingBoxDescent:o*ro.descentEm}}};t.getContext=()=>n}function qE(e){if(e.SVGMatrix)return;class t{constructor(){Xr(this,"a",1);Xr(this,"b",0);Xr(this,"c",0);Xr(this,"d",1);Xr(this,"e",0);Xr(this,"f",0)}static of(i,r,o,a,s,c){return Object.assign(new t,{a:i,b:r,c:o,d:a,e:s,f:c})}multiply(i){return t.of(this.a*i.a+this.c*i.b,this.b*i.a+this.d*i.b,this.a*i.c+this.c*i.d,this.b*i.c+this.d*i.d,this.a*i.e+this.c*i.f+this.e,this.b*i.e+this.d*i.f+this.f)}translate(i,r){return this.multiply(t.of(1,0,0,1,i,r))}scale(i,r=i){return this.multiply(t.of(i,0,0,r,0,0))}inverse(){const i=this.a*this.d-this.b*this.c;return t.of(this.d/i,-this.b/i,-this.c/i,this.a/i,(this.c*this.f-this.d*this.e)/i,(this.b*this.e-this.a*this.f)/i)}}e.SVGMatrix=t}function YE(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 KE(e){const t=e.SVGElement.prototype;if(!t.getCTM){const n=()=>new e.SVGMatrix;t.getCTM=n,t.getScreenCTM=n}t.getBBox||(t.getBBox=function(){const n=String(this.textContent??"");return{x:0,y:0,width:Wo(n,12),height:14}})}function eh(e){return{modeling:e.get("modeling"),bpmnFactory:e.get("bpmnFactory"),elementFactory:e.get("elementFactory"),elementRegistry:e.get("elementRegistry"),canvas:e.get("canvas"),autoPlace:e.get("autoPlace"),bpmnReplace:e.get("bpmnReplace")}}function hs(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const Vu={"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 Yt(e,t){return e.filter(n=>n.kind===t)}function th(e,t){var yx,vx,_x,bx,xx;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=Yt(e,"participant.add"),h=Yt(e,"node.add"),m=Yt(e,"sequenceFlow.add"),g=Yt(e,"messageFlow.add"),S=Yt(e,"dataStore.add"),E=Yt(e,"dataAssociation.add"),x=Yt(e,"annotation.add"),b=Yt(e,"group.add"),w=new Map(h.map(R=>[R.node.id,R])),T=(R,P,k)=>{var Me;const W=R.businessObject,V=(((Me=W.extensionElements)==null?void 0:Me.values)??[]).filter(J=>J.$type!==P),$=k?[...V,i.create(P,k)]:V;if(!$.length){W.extensionElements&&n.updateProperties(R,{extensionElements:void 0});return}const Z=i.create("bpmn:ExtensionElements",{values:$});$.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 Yt(e,"element.remove")){const P=l(R.id);P&&n.removeElements([P])}const A=R=>o.filter(P=>{var k;return P.type==="bpmn:Lane"&&((k=f(P))==null?void 0:k.id)===R}).sort((P,k)=>P.y-k.y);for(const R of Yt(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 k=A(R.id);if(!k.length){n.splitLane(P,R.lanes.length),A(R.id).forEach((V,$)=>{const Z=R.lanes[$];Z&&n.updateProperties(V,{id:Z.id,name:Z.name})});continue}const W=new Set(k.map(V=>V.id));R.lanes.forEach((V,$)=>{if(W.has(V.id)){n.updateProperties(p(V.id),{name:V.name});return}const Z=$===0?n.addLane(A(R.id)[0],"top"):n.addLane(p(R.lanes[$-1].id),"bottom");n.updateProperties(Z,{id:V.id,name:V.name})})}const F=150,H=130,N=80,z=90,le=180,$e=new Set;for(const R of d){$e.add(`pool:${R.participant.id}`);for(const P of R.participant.lanes??[])$e.add(P.id)}const ut=new Map;for(const R of h){const P=R.node.lane??`pool:${R.node.participant??""}`;let k=ut.get(P);k||ut.set(P,k=new Set([0])),R.band!==void 0&&k.add(R.band)}const q=new Map;for(const[R,P]of ut){if(!$e.has(R))continue;const k=[...P].sort(($,Z)=>$-Z),W=k.map(($,Z)=>Z===0?0:Z%2===1?Math.ceil(Z/2):-(Z/2)),V=Math.min(...W);q.set(R,new Map(k.map(($,Z)=>[$,W[Z]-V])))}{const R=new Map;for(const P of d)(P.participant.lanes??[]).forEach((k,W)=>R.set(k.id,W));for(const[P,k]of q){if(!R.has(P)||k.size<2)continue;const W=R.get(P),V=k.get(0)??0,$=new Set;for(const je of h){if(je.node.lane!==P||(je.band??0)!==0||!je.node.type.endsWith("Gateway"))continue;const De={in:new Set,out:new Set,cross:new Set};for(const _e of m){const st=_e.flow.source===je.node.id;if(!st&&_e.flow.target!==je.node.id)continue;const Wt=w.get(st?_e.flow.target:_e.flow.source);if(!Wt||Wt.node.participant!==je.node.participant||!Wt.node.lane)continue;let Jn,un=!1;if(Wt.node.lane!==P){const $n=R.get(Wt.node.lane);if($n===void 0)continue;Jn=$n>W?"down":"up",un=!0}else{const $n=k.get(Wt.band??0)??V;Jn=$n>V?"down":$n<V?"up":void 0}Jn&&(De[st?"out":"in"].add(Jn),un&&De.cross.add(Jn))}for(const _e of["up","down"])De.in.has(_e)&&De.out.has(_e)&&De.cross.has(_e)&&$.add(_e)}if($.size!==1)continue;const[Z]=$,Me=Math.max(...k.values()),J=Z==="down"?Me:0;if(V===J)continue;const xe=[...k.entries()].filter(([je])=>je!==0).sort((je,De)=>je[1]-De[1]),Ye=[...Array(Me+1).keys()].filter(je=>je!==J),lt=new Map([[0,J]]);xe.forEach(([je],De)=>lt.set(je,Ye[De])),q.set(P,lt)}}const pe=R=>{var P;return(((P=ut.get(R))==null?void 0:P.size)??0)>1},fe=R=>R.band??(R.node.lane||!pe(`pool:${R.node.participant??""}`)?void 0:0),se=new Map,ce=R=>se.get(R.node.id)??fe(R),ee=new Set,j=new Set;{const R=new Map;for(const W of m)R.set(W.flow.target,(R.get(W.flow.target)??0)+1);const P=W=>{const V=[],$=new Set([W]),Z=[W];for(;Z.length;){const Me=Z.shift();V.push(Me);for(const J of m)J.flow.source!==Me||$.has(J.flow.target)||(R.get(J.flow.target)??0)!==1||($.add(J.flow.target),Z.push(J.flow.target))}return V},k=(W,V)=>{var $;return(($=q.get(W))==null?void 0:$.get(V))??V};for(const W of h){if(!W.node.type.endsWith("Gateway"))continue;const V=W.node.lane??`pool:${W.node.participant??""}`,$=q.get(V);if(!$||$.size<2)continue;const Z=ce(W);if(Z===void 0||k(V,Z)!==k(V,0))continue;const Me=k(V,Z),J=m.filter(_e=>_e.flow.source===W.node.id).map(_e=>w.get(_e.flow.target)).filter(_e=>!!_e&&(_e.node.lane??`pool:${_e.node.participant??""}`)===V),xe=J.filter(_e=>{const st=ce(_e);return st!==void 0&&k(V,st)===Me&&(R.get(_e.node.id)??0)===1}),Ye=J.some(_e=>{const st=ce(_e);return st!==void 0&&k(V,st)>Me});if(xe.length!==1||!Ye)continue;const lt=new Set(J.flatMap(_e=>P(_e.node.id)));if(!m.some(_e=>_e.flow.target===W.node.id&<.has(_e.flow.source)))continue;const De=new Map;for(const[_e,st]of $)De.set(_e,st+1);De.set(-1,0),q.set(V,De);for(const _e of P(xe[0].node.id))w.has(_e)&&(se.set(_e,-1),j.add(_e));ee.add(W.node.id)}}const B=(R,P)=>{var k;return((k=q.get(R))==null?void 0:k.get(P))??P},U=new Map;for(const[R,P]of ut){let k=0;for(const W of P)k=Math.max(k,B(R,W));U.set(R,k)}const Te=R=>le+F*R,kt=d.map((R,P)=>({op:R,declared:P}));kt.sort((R,P)=>{const k=R.op.order??Number.POSITIVE_INFINITY,W=P.op.order??Number.POSITIVE_INFINITY;return k!==W?k-W:R.declared-P.declared});let C=80;for(const R of o.getAll())R.parent===u()&&"height"in R&&typeof R.y=="number"&&(C=Math.max(C,R.y+R.height+60));for(const{op:R}of kt){const P=R.participant,k=h.filter(je=>je.node.participant===P.id).length,W=((yx=P.lanes)==null?void 0:yx.length)??0,V=Math.max(1200,k*160+300),$=(P.lanes??[]).map(je=>Te(U.get(je.id)??0)),Z=$.reduce((je,De)=>je+De,0);W&&Z<300&&($[W-1]+=300-Z);const Me=Math.max(300,F*((U.get(`pool:${P.id}`)??0)+1)),J=P.blackBox||k+W===0?120:W?Math.max(300,Z):Me,xe=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:V,height:J,isExpanded:!0}),Ye=n.createShape(xe,{x:100+V/2,y:C+J/2},u()),lt=P.lanes??[];if(lt.length&&n.splitLane(Ye,lt.length),lt.length){const je=o.filter(De=>{var _e;return De.type==="bpmn:Lane"&&((_e=f(De))==null?void 0:_e.id)===P.id}).sort((De,_e)=>De.y-_e.y);if(je.forEach((De,_e)=>{const st=lt[_e];st&&n.updateProperties(De,{id:st.id,name:st.name})}),$.some(De=>De!==Ye.height/W)){let De=Ye.y;je.forEach((_e,st)=>{const Wt=$[st];n.resizeShape(_e,{x:_e.x,y:De,width:_e.width,height:Wt}),De+=Wt})}}C=Ye.y+Ye.height+60}const _=R=>{var W;const P=w.get(R);if(P)return P.node.participant??"";const k=l(R);return k?k.type==="bpmn:Participant"?k.id:((W=f(k))==null?void 0:W.id)??"":""},y=new Map,D=R=>{let P=y.get(R);return P||y.set(R,P={nodes:[],flows:[]}),P};for(const R of h)D(R.node.participant??"").nodes.push(R);for(const R of m)D(_(R.flow.source)).flows.push(R);const I=R=>{var P;return i.create("bpmn:SequenceFlow",{id:R.id,name:R.name??((P=R.condition)==null?void 0:P.label)})},G=(R,P)=>r.createShape({type:hs(R.type),businessObject:i.create(hs(R.type),{id:R.id,name:R.name,...P!==void 0?{"bwl:band":P}:{}})}),oe=[...kt.map(({op:R})=>R.participant.id).filter(R=>y.has(R)),...[...y.keys()].filter(R=>!d.some(P=>P.participant.id===R))],Ce=R=>R.endsWith("Gateway");for(const R of oe){const P=y.get(R),k=R?p(R):void 0,W=k?k.x+150:250;let V=k?k.y+80:120;const $=(ne,he,ue)=>{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:ue})},Z=(ne,he)=>{if(ne){const Pe=p(ne),Ke=Te(he);if(Pe.height>=Ke)return;const Ft=Ke-Pe.height,ae=f(Pe),Ge=ae?ae.y+ae.height:Pe.y+Pe.height;n.resizeLane(Pe,{x:Pe.x,y:Pe.y,width:Pe.width,height:Ke},!1),$(Ge,ae==null?void 0:ae.id,Ft);return}if(!k)return;const ue=F*(he+1);if(k.height>=ue)return;const Ze=ue-k.height,qe=k.y+k.height;n.resizeShape(k,{x:k.x,y:k.y,width:k.width,height:ue}),$(qe,k.id,Ze)},Me=(ne,he,ue)=>{if(ne){const Ze=p(ne);return Ze.y+Math.min(Ze.height/2,z)+B(ne,he??0)*F}return he!==void 0&&k?k.y+N+B(`pool:${R}`,he)*F:ue},J=(ne,he,ue)=>{if(ne){const Ze=p(ne);return Ze.y+Math.min(Ze.height/2,z)+he*F}return k?k.y+N+he*F:ue},xe=ne=>ne.participant?p(ne.participant):u(),Ye=30,lt=(ne,he,ue,Ze)=>{const qe=ue-he.width/2,Pe=Ze-he.height/2;return(ne.children??[]).find(Ke=>!("waypoints"in Ke&&Ke.waypoints)&&Ke.type!=="bpmn:Lane"&&Ke.type!=="label"&&typeof Ke.x=="number"&&qe<Ke.x+Ke.width+Ye&&qe+he.width+Ye>Ke.x&&Pe<Ke.y+Ke.height&&Pe+he.height>Ke.y)},je=(ne,he,ue,Ze,qe,Pe)=>{const Ke=ue!==void 0||Ze!==void 0,Ft=B(ue??`pool:${R}`,Ze??0);if(Ke)for(let Le=0;Le<4;Le++){const Ne=J(ue,Ft+Le,Pe);if(!lt(ne,he,qe,Ne))return Z(ue,Ft+Le),{x:qe,y:Ne}}const ae=Me(ue,Ze,Pe);Ke&&Z(ue,Ft);let Ge=qe;for(let Le=0;Le<64;Le++){const Ne=lt(ne,he,Ge,ae);if(!Ne)break;Ge=Ne.x+Ne.width+H+he.width/2}return{x:Ge,y:ae}},De=new Set(P.flows.map(ne=>ne.flow.target)),_e=new Map;for(const ne of P.nodes){if(De.has(ne.node.id))continue;const he=G(ne.node,ne.band),ue=fe(ne),Ze=ne.node.lane?`${ne.node.lane}|${ue??""}`:ue!==void 0?`band:${ue}`:"",qe=xe(ne.node),Pe=je(qe,he,ne.node.lane,ue,_e.get(Ze)??W,V);n.createShape(he,Pe,qe),_e.set(Ze,Pe.x+he.width+H),!ne.node.lane&&ue===void 0&&(V+=160)}const st=new Set,Wt=new Map,Jn=new Map,un=new Map;if(R&&$e.has(`pool:${R}`)){const ne=new Map;for(const ae of P.flows)ne.set(ae.flow.target,(ne.get(ae.flow.target)??0)+1);const he=ae=>Me(ae.node.lane,ce(ae),Number.NaN),ue=new Set,Ze=ae=>{var Ne;const Ge=(Ne=w.get(ae))==null?void 0:Ne.node.participant;if(Ge)return l(Ge);const Le=l(ae);if(Le)return Le.type==="bpmn:Participant"?Le:f(Le)},qe=ae=>{const Ge=[],Le=new Set([ae]),Ne=[ae];for(;Ne.length;){const ht=Ne.shift(),Qe=w.get(ht);Qe&&Ge.push(Qe);for(const Ee of P.flows)Ee.flow.source!==ht||Le.has(Ee.flow.target)||(ne.get(Ee.flow.target)??0)!==1||(Le.add(Ee.flow.target),Ne.push(Ee.flow.target))}return Ge},Pe=ae=>{if(!k)return;const Ge=new Set(ae.map(ht=>ht.node.id));let Le=!1,Ne=!1;for(const ht of g){if(!Ge.has(ht.flow.source))continue;const Qe=Ze(ht.flow.target);!Qe||Qe.id===k.id||(Qe.y<k.y?Le=!0:Ne=!0)}return Le&&!Ne?"up":Ne&&!Le?"down":void 0};for(const ae of P.nodes){if(!Ce(ae.node.type))continue;const Ge=Me(ae.node.lane,fe(ae),Number.NaN);if(Number.isNaN(Ge))continue;const Le=[];for(const Ee of P.flows){if(Ee.flow.source!==ae.node.id)continue;const He=w.get(Ee.flow.target);if(!He||He.node.lane!==ae.node.lane||(ne.get(He.node.id)??0)!==1)continue;const et=fe(He);if(et===void 0)continue;const mn=Me(He.node.lane,et,Number.NaN);if(Number.isNaN(mn))continue;const Kr=qe(He.node.id),Ut=Pe(Kr);Ut&&Le.push({subtree:Kr,band:et,row:mn,dir:Ut})}if(!Le.some(Ee=>Ee.dir==="up")||!Le.some(Ee=>Ee.dir==="down")||!Le.some(Ee=>Ee.dir==="up"&&Le.some(He=>He.dir==="down"&&He.row<Ee.row)))continue;const ht=[...Le].sort((Ee,He)=>Ee.row-He.row);[...Le.filter(Ee=>Ee.dir==="up"),...Le.filter(Ee=>Ee.dir==="down")].sort((Ee,He)=>Ee.dir===He.dir?Ee.row-He.row:Ee.dir==="up"?-1:1).forEach((Ee,He)=>{const et=ht[He].band;if(et!==Ee.band){ue.add(ae.node.id);for(const mn of Ee.subtree)fe(mn)===Ee.band&&se.set(mn.node.id,et)}})}const Ke=ae=>{if(!k)return;const Ge=new Set(ae.map(ht=>ht.node.id));let Le=!1,Ne=!1;for(const ht of g){if(!Ge.has(ht.flow.target))continue;const Qe=Ze(ht.flow.source);!Qe||Qe.id===k.id||(Qe.y<k.y?Le=!0:Ne=!0)}return Le&&!Ne?"up":Ne&&!Le?"down":void 0};for(const ae of P.nodes){if(!Ce(ae.node.type))continue;const Ge=ae.node.lane??`pool:${R}`,Le=q.get(Ge);if(!Le||Le.size<2)continue;const Ne=Le.get(0);if(Ne===void 0)continue;const ht=Math.max(...Le.values()),Qe=Ne===ht&&Ne!==0?"down":void 0;if(!Qe)continue;const Ee=[];for(const Ut of P.flows){if(Ut.flow.source!==ae.node.id)continue;const ei=w.get(Ut.flow.target);if(!ei||ei.node.lane!==ae.node.lane||(ne.get(ei.node.id)??0)!==1)continue;const Ex=ce(ei);Ex!==void 0&&Ee.push({t:ei,subtree:qe(ei.node.id),band:Ex})}const He=Ee.find(Ut=>(Le.get(Ut.band)??Ut.band)===Ne);if(!He||Ke(He.subtree)===Qe||Pe(He.subtree)===Qe)continue;const et=Ee.find(Ut=>Ut!==He&&Ke(Ut.subtree)===Qe);if(!et)continue;const mn=He.band,Kr=et.band;for(const Ut of He.subtree)ce(Ut)===mn&&se.set(Ut.node.id,Kr);for(const Ut of et.subtree)ce(Ut)===Kr&&se.set(Ut.node.id,mn);ue.add(ae.node.id)}for(const ae of P.nodes){if(!Ce(ae.node.type))continue;const Ge=he(ae);if(Number.isNaN(Ge)||x.some(Ee=>{var He,et;return(((He=Ee.placement)==null?void 0:He.anchor)??(Ee.association?Ee.association.source===Ee.annotation.id?Ee.association.target:Ee.association.source:void 0))===ae.node.id&&((et=Ee.placement)==null?void 0:et.side.startsWith("bottom"))}))continue;let Ne,ht=!1,Qe;for(const Ee of P.flows){if(Ee.flow.source!==ae.node.id)continue;const He=w.get(Ee.flow.target);if(!He||!He.node.lane&&fe(He)===void 0)continue;const et=he(He);Number.isNaN(et)||(Math.abs(et-Ge)<.5&&(ht=!0),et>Ge?!Ne||et>Ne.row?Ne={id:He.node.id,row:et,count:1}:et===Ne.row&&Ne.count++:et<Ge&&He.node.lane===ae.node.lane&&(!Qe||et>Qe.row?Qe={op:He,row:et,count:1}:et===Qe.row&&Qe.count++))}Ne&&Ne.count===1&&(ne.get(Ne.id)??0)===1&&!ue.has(ae.node.id)&&st.add(Ne.id),!ht&&Qe&&Qe.count===1&&(ne.get(Qe.op.node.id)??0)===1&&!ee.has(ae.node.id)&&Wt.set(Qe.op.node.id,{lane:ae.node.lane,band:ce(ae)})}const Ft=new Map;for(const ae of g)Ft.set(ae.flow.target,[...Ft.get(ae.flow.target)??[],ae]);for(const ae of P.nodes){const Ge=Ft.get(ae.node.id);if(!Ge||Ge.length!==1||!ne.get(ae.node.id)||!ae.node.lane&&fe(ae)===void 0||j.has(ae.node.id))continue;const Le=(vx=w.get(Ge[0].flow.source))==null?void 0:vx.node.participant,Ne=Le?l(Le):void 0;if(!Ne||!k||Ne.id===k.id)continue;const ht=ae.node.lane??`pool:${R}`,Qe=q.get(ht);if(!Qe)continue;const Ee=Qe.get(0)??0,He=(Qe.get(ce(ae)??0)??Ee)-Ee;if(He===0)continue;const et=Ne.y<k.y;if(et&&He<0||!et&&He>0)continue;let mn;for(const[Kr,Ut]of Qe){const ei=Ut-Ee;(et&&ei<0&&(!mn||ei<mn.row)||!et&&ei>0&&(!mn||ei>mn.row))&&(mn={band:Kr,row:ei})}mn&&Jn.set(ae.node.id,{lane:ae.node.lane,band:mn.band})}}const $n=new Set;let _u=0;for(;_u++<P.nodes.length+2;){for(let ue=0;ue<P.nodes.length+P.flows.length+2;ue++){let Ze=!1;for(const qe of P.flows){const Pe=qe.flow;if($n.has(Pe.id))continue;const Ke=l(Pe.source);if(!Ke)continue;const Ft=l(Pe.target),ae=w.get(Pe.target);if(!Ft&&ae){const Ge=G(ae.node,ae.band),Le=ce(ae);if(ae.node.lane||Le!==void 0){const Ne=xe(ae.node),ht=Ke,Qe=ht.x+(un.get(Pe.source)??0)+ht.width+H,Ee=Wt.get(Pe.target)??Jn.get(Pe.target),He=je(Ne,Ge,Ee?Ee.lane:ae.node.lane,Ee?Ee.band:Le,st.has(Pe.target)?ht.x+ht.width/2:Qe,Number.NaN),et=n.createShape(Ge,He,Ne);st.has(Pe.target)&&un.set(Pe.target,Qe-(et.x+et.width/2)),n.connect(Ke,et,{type:"bpmn:SequenceFlow",businessObject:I(Pe)})}else s.append(Ke,Ge,{connection:{type:"bpmn:SequenceFlow",businessObject:I(Pe)}})}else if(Ft)n.connect(Ke,Ft,{type:"bpmn:SequenceFlow",businessObject:I(Pe)});else continue;$n.add(Pe.id),Ze=!0}if(!Ze)break}const ne=P.nodes.filter(ue=>!l(ue.node.id));if(!ne.length)break;const he=ne[0];{const ue=G(he.node,he.band),Ze=xe(he.node),qe=fe(he);n.createShape(ue,je(Ze,ue,he.node.lane,qe,W,V),Ze),!he.node.lane&&qe===void 0&&(V+=160)}}}const We=40,pt=(R,P=()=>!0)=>{const k=l(R);if(!k)return[];const W=[k],V=new Set([R]);for(let $=0;$<W.length;$++){const Z=W[$].id;for(const Me of m){const J=Me.flow.target;if(Me.flow.source!==Z||V.has(J)||!w.has(J))continue;V.add(J);const xe=l(J);xe&&P(xe)&&W.push(xe)}}return W};for(const R of Yt(e,"sequenceFlow.update")){if(R.target===void 0)continue;const P=w.get(R.target);if(!P)continue;const k=l(R.target),W=l(R.id);if(!k||!W)continue;const V=R.source!==void 0?l(R.source):W.source,$=W.target;if(!V||!$||$.id===k.id)continue;const Z=pt(R.target),Me=new Set(Z.map(De=>De.id)),J=Math.min(...Z.map(De=>De.x)),xe=Math.max(...Z.map(De=>De.x+De.width)),Ye=V.x+V.width,lt=xe-J+We*2-($.x-Ye);if(lt>0){const De=f(k),_e=(De==null?void 0:De.children)??[],st=un=>un.type==="bpmn:Lane",Wt=_e.filter(un=>!("waypoints"in un&&un.waypoints)&&!st(un)&&!Me.has(un.id)&&un.x>=$.x),Jn=De?[De,..._e.filter(un=>st(un))]:[];Wt.length&&n.createSpace(Wt,Jn,{x:lt,y:0},"e",$.x-1)}const je=P.node.lane||P.band!==void 0?k.y+k.height/2:V.y+V.height/2;n.moveElements(Z,{x:Ye+We-J,y:je-(k.y+k.height/2)})}const Je=(R,P)=>{const k=P.target===R,W=p(P.source),V=p(P.target),$=k?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(W,V,P.id?{type:$,businessObject:i.create($,{id:P.id})}:{type:$})},$t=100,Jt=R=>{for(const P of d){if(!P.participant.blackBox)continue;const k=l(P.participant.id);if(!k)continue;const W=[];for(const $ of g){const Z=$.flow.source===P.participant.id?$.flow.target:$.flow.target===P.participant.id?$.flow.source:void 0,Me=Z?l(Z):void 0;Me&&typeof Me.x=="number"&&Me.type!=="bpmn:Participant"&&W.push(Me)}if(!W.length)continue;const V=Math.max(...W.map($=>$.x+$.width/2))+$t;if(V>k.x+k.width&&n.resizeShape(k,{x:k.x,y:k.y,width:V-k.x,height:k.height}),!!R)for(const $ of g){const Z=l($.flow.id),Me=$.flow.source===P.participant.id?$.flow.target:$.flow.target===P.participant.id?$.flow.source:void 0,J=Me?l(Me):void 0;if(!Z||!J||J.type==="bpmn:Participant")continue;const xe=J.x+J.width/2;if(xe<k.x+10||xe>k.x+k.width-10)continue;const Ye=k.y>J.y,lt=Ye?J.y+J.height:J.y,je=Ye?k.y:k.y+k.height,De=$.flow.source===P.participant.id?[{x:xe,y:je},{x:xe,y:lt}]:[{x:xe,y:lt},{x:xe,y:je}],_e=qt(o),st={..._e.edges.find(Wt=>Wt.id===$.flow.id),waypoints:De};ci(st,qi(_e)).length||n.updateWaypoints(Z,De)}}};Jt(!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 en=100,at=30,jt=4,hn=R=>!("waypoints"in R&&R.waypoints)&&R.type!=="bpmn:Lane"&&R.type!=="label"&&typeof R.x=="number",ri=()=>{const R=qt(o);return{bad:Yi(R).filter(P=>P.kind==="edge-crosses-shape"||P.kind==="edge-overlap-opposite"||P.kind==="edge-overlap-mixed").length,crossings:bd(R),straight:R.edges.filter(P=>P.type==="bpmn:MessageFlow"&&P.waypoints.length===2).length}},Nn=R=>{const P=qt(o),k=P.edges.find(W=>W.id===R);return!!k&&ci(k,qi(P)).length>0},Qn=(R,P,k)=>{const W=new Set(R.map(xe=>xe.id)),V=(P.children??[]).filter(hn).filter(xe=>!W.has(xe.id));if(R.some(xe=>V.some(Ye=>xe.x+k<Ye.x+Ye.width+at&&xe.x+k+xe.width+at>Ye.x&&xe.y<Ye.y+Ye.height&&xe.y+xe.height>Ye.y)))return null;const Z=P.width;n.moveElements(R,{x:k,y:0});const J=Math.max(...R.map(xe=>xe.x+xe.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:-k,y:0}),J>0&&n.resizeShape(P,{x:P.x,y:P.y,width:Z,height:P.height})}},Bn=(R,P)=>P.bad>R.bad||P.crossings>R.crossings&&P.straight<=R.straight,Dt=(R,P,k,W=()=>!0)=>{const V=ri(),$=Qn(R,P,k);if(!$)return!1;const Z=ri();return Bn(V,Z)||!W()?($(),!1):!0},wr=R=>{var k;const P=(k=w.get(R))==null?void 0:k.node.participant;return!!P&&$e.has(`pool:${P}`)},Sr=new Map;for(const R of g){if(!wr(R.flow.target))continue;const P=Sr.get(R.flow.target)??[];P.push(R),Sr.set(R.flow.target,P)}const _n=[...Sr.keys()],Ue=new Set(m.map(R=>R.flow.target)),Xe=R=>kt.findIndex(({op:P})=>P.participant.id===R);_n.sort((R,P)=>{var V,$;const k=Ue.has(R)?1:0,W=Ue.has(P)?1:0;return k!==W?k-W:Xe((V=w.get(R))==null?void 0:V.node.participant)-Xe(($=w.get(P))==null?void 0:$.node.participant)});const qa=R=>R.x+R.width/2,px=R=>{let P;for(const k of Sr.get(R)??[]){const W=l(k.flow.source);if(!W)continue;const V=qa(W);(!P||V>P.cx)&&(P={op:k,cx:V})}return P==null?void 0:P.op},ND=R=>{const P=px(R),k=l(R),W=P?l(P.flow.source):void 0;return k&&W?qa(W)-qa(k):void 0},BD=R=>{const P=ND(R);return P!==void 0&&Math.abs(P)<en},Lf=R=>{const P=px(R);if(!P)return null;const k=l(R),W=l(P.flow.source);if(!k||!W)return null;const V=qa(W)-qa(k);if(V>=en){const $=p(w.get(R).node.participant);return{subtree:pt(R,Z=>Z.x>=k.x),pool:$,dx:V}}if(-V>=en&&wr(P.flow.source)){const $=p(w.get(P.flow.source).node.participant);return{subtree:pt(P.flow.source,Z=>Z.x>=W.x&&!BD(Z.id)),pool:$,dx:-V}}return null},fx=()=>_n.map(R=>({id:R,plan:Lf(R)})).filter(R=>!!R.plan).sort((R,P)=>Math.min(...R.plan.subtree.map(k=>k.x))-Math.min(...P.plan.subtree.map(k=>k.x))).map(R=>R.id);for(let R=0;R<3;R++){const P=ri(),k=[];for(const V of fx()){const $=Lf(V);if(!$)continue;const Z=Qn($.subtree,$.pool,$.dx);Z&&k.push(Z)}if(!k.length)break;if(!Bn(P,ri()))continue;for(const V of k.reverse())V();let W=!1;for(const V of fx()){const $=Lf(V);$&&Dt($.subtree,$.pool,$.dx)&&(W=!0)}if(!W)break}for(const R of _n.flatMap(P=>Sr.get(P)??[])){if(!Nn(R.flow.id))continue;const P=l(R.flow.target);if(!P)continue;const k=p(w.get(R.flow.target).node.participant),W=pt(R.flow.target,$=>$.x>=P.x),V=P.width+H;for(let $=1;$<=jt&&!Dt(W,k,V*$,()=>!Nn(R.flow.id));$++);}{const R=k=>k.y+k.height/2,P=[];for(const[k,W]of w){const V=W.node.participant;if(!V||!$e.has(`pool:${V}`))continue;const $=m.filter(J=>J.flow.target===k);if($.length!==1)continue;const Z=l($[0].flow.source),Me=l(k);!Z||!Me||!w.has(Z.id)||Math.abs(R(Z)-R(Me))>1||Me.x-(Z.x+Z.width)<=H+1||P.push({id:k,pred:Z,node:Me})}P.sort((k,W)=>k.node.x-W.node.x);for(const{id:k}of P){const W=w.get(k),V=l(k),$=l(m.find(je=>je.flow.target===k).flow.source);if(!V||!$)continue;const Z=V.x-($.x+$.width);if(Z<=H+1)continue;const Me=p(W.node.participant),J=pt(k,je=>je.x>=V.x),xe=ri(),Ye=Qn(J,Me,-(Z-H));if(!Ye)continue;const lt=ri();(lt.bad>xe.bad||lt.crossings>=xe.crossings)&&Ye()}}Jt(!0);for(const R of S){const P=R.associations??[],k=P.map($=>$.source===R.dataStore.id?$.target:$.source).map(l).find(Boolean),W=k?f(k)??u():u(),V=k?{x:k.x+k.width/2,y:k.y+k.height+110}:{x:200,y:C+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:R.dataStore.id,name:R.dataStore.name})},V,W);for(const $ of P)Je(R.dataStore.id,$)}for(const R of E){const k=p(R.association.target).type==="bpmn:DataStoreReference"?R.association.target:R.association.source;Je(k,R.association)}let dx=0;for(const R of b){const P=(R.group.members??[]).map(l).filter($=>!!$),k=40;let W;if(P.length){const $=Math.min(...P.map(xe=>xe.x))-k,Z=Math.min(...P.map(xe=>xe.y))-k,Me=Math.max(...P.map(xe=>xe.x+xe.width))+k,J=Math.max(...P.map(xe=>xe.y+xe.height))+k;W={x:$,y:Z,width:Me-$,height:J-Z}}else W={x:300+dx*350,y:40,width:300,height:200},dx++;const V=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:R.group.id}),width:W.width,height:W.height},{x:W.x+W.width/2,y:W.y+W.height/2},u());R.group.name&&n.updateLabel(V,R.group.name),(_x=R.group.members)!=null&&_x.length&&T(V,"bwl:Members",{refs:R.group.members.join(" ")})}const hx=R=>{const P=R.waypoints;if(P!=null&&P.length){const W=P[Math.floor((P.length-1)/2)];return{x:W.x,y:W.y,width:0,height:0}}const k=R;return{x:k.x,y:k.y,width:k.width,height:k.height}};let Ya=0;const mx=12,gx=14,$D=15,jD=300,FD=R=>{const P=R.split(`
|
|
7
|
-
`),k=Math.max(...P.map($=>Wo($,mx))),W=Math.max(100,Math.min(jD,Math.ceil(k)+gx)),V=P.reduce(($,Z)=>$+Math.max(1,Math.ceil((Wo(Z,mx)+gx)/W)),0);return{width:W,height:Math.max(30,V*$D+10)}},tn=10;for(const R of x){const P=R.association,k=((bx=R.placement)==null?void 0:bx.anchor)??(P?P.source===R.annotation.id?P.target:P.source:void 0),W=k?l(k):void 0,V=W?hx(W):void 0,$=FD(R.annotation.text??"");let Z;if(V&&R.placement){const[Ye,lt]=Vu[R.placement.side],je=R.placement.offset??50;Z={x:V.x+V.width/2+Ye*(V.width/2+$.width/2+je),y:V.y+V.height/2+lt*(V.height/2+$.height/2+je)}}else V?(Z={x:V.x+V.width/2+180+Ya%3*260,y:V.y-110-Ya%2*95},Ya++):(Z={x:300+Ya*260,y:60},Ya++);const Me=W?f(W)??u():u(),J=Me;if(V&&typeof J.x=="number"&&typeof J.width=="number"&&J.type==="bpmn:Participant"){const Ye=(ne,he)=>{const[ue,Ze]=Vu[ne];let qe={x:V.x+V.width/2+ue*(V.width/2+$.width/2+he),y:V.y+V.height/2+Ze*(V.height/2+$.height/2+he)};const Pe=J.x+tn+$.width/2,Ke=J.x+J.width-tn-$.width/2,Ft=J.y+tn+$.height/2,ae=J.y+J.height-tn-$.height/2,Ge={x:Math.min(Ke,Math.max(Pe,qe.x)),y:Math.min(ae,Math.max(Ft,qe.y))};return(Ge.x!==qe.x||Ge.y!==qe.y)&&(qe=Math.abs(Ge.x-(V.x+V.width/2))<(V.width+$.width)/2+tn&&Math.abs(Ge.y-(V.y+V.height/2))<(V.height+$.height)/2+tn?{x:V.x+V.width+tn+$.width/2,y:Ge.y}:Ge),qe},lt=(J.children??[]).filter(ne=>!("waypoints"in ne&&ne.waypoints)&&ne.type!=="bpmn:Lane"&&ne.type!=="label"&&typeof ne.x=="number"),je=qt(o),De=je.edges.flatMap(pn),_e=cs(je).map(ne=>ne.rect),st=ne=>({x0:ne.x-$.width/2-tn,x1:ne.x+$.width/2+tn,y0:ne.y-$.height/2-tn,y1:ne.y+$.height/2+tn}),Wt=ne=>{const he=st(ne);return lt.some(ue=>he.x0<ue.x+ue.width&&he.x1>ue.x&&he.y0<ue.y+ue.height&&he.y1>ue.y)},Jn=ne=>{const he=st(ne);return De.some(ue=>ue.axis==="h"?ue.at>he.y0&&ue.at<he.y1&&ue.lo<he.x1&&ue.hi>he.x0:ue.at>he.x0&&ue.at<he.x1&&ue.lo<he.y1&&ue.hi>he.y0)},un=ne=>{const he=st(ne);return _e.some(ue=>he.x0<ue.x+ue.width&&he.x1>ue.x&&he.y0<ue.y+ue.height&&he.y1>ue.y)},$n=ne=>Wt(ne)||Jn(ne)||un(ne),_u=ne=>ne.x-$.width/2>=J.x&&ne.x+$.width/2<=J.x+J.width&&ne.y-$.height/2>=J.y&&ne.y+$.height/2<=J.y+J.height;if(R.placement){const ne=Pe=>Pe.startsWith("top")?Pe.replace(/^top/,"bottom"):Pe.replace(/^bottom/,"top"),he=Pe=>Pe.endsWith("left")?Pe.replace(/left$/,"right"):Pe.replace(/right$/,"left"),ue=R.placement.side,Ze=[ue,ne(ue),he(ue),ne(he(ue)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],qe=R.placement.offset??50;if(Z=Ye(ue,qe),$n(Z)){const Pe=new Set;for(const Ke of Ze){if(Pe.has(Ke))continue;Pe.add(Ke);const Ft=Ye(Ke,qe);if(_u(Ft)&&!$n(Ft)){Z=Ft;break}}}}else{const ne=J.x+tn+$.width/2,he=J.x+J.width-tn-$.width/2,ue=J.y+tn+$.height/2,Ze=J.y+J.height-tn-$.height/2;if(Z={x:Math.min(he,Math.max(ne,Z.x)),y:Math.min(Ze,Math.max(ue,Z.y))},$n(Z)){const qe=(V.width+$.width)/2+tn,Ke=[{x:Z.x+qe,y:Z.y},{x:Z.x-qe,y:Z.y},{x:Z.x,y:Z.y-$.height-tn},{x:Z.x,y:Z.y+$.height+tn}].filter(_u).find(Ft=>!$n(Ft));Ke&&(Z=Ke)}}}const xe=n.createShape({type:"bpmn:TextAnnotation",width:$.width,height:$.height,businessObject:i.create("bpmn:TextAnnotation",{id:R.annotation.id,text:R.annotation.text})},Z,Me);if(P){const Ye=lt=>lt===R.annotation.id?xe:p(lt);n.connect(Ye(P.source),Ye(P.target),P.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:P.id})}:{type:"bpmn:Association"})}R.placement&&T(xe,"bwl:Placement",L(R.placement))}for(const R of Yt(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 Yt(e,"node.update")){let P=p(R.id);if(R.type&&hs(R.type)!==P.type&&(P=c.replaceElement(P,{type:hs(R.type)})),R.name!==void 0&&n.updateProperties(P,{name:R.name??void 0}),R.lane){const k=p(R.lane),W=k.y+k.height/2-(P.y+P.height/2);W!==0&&n.moveElements([P],{x:0,y:W})}}for(const R of Yt(e,"sequenceFlow.update")){const P=p(R.id);if(R.source!==void 0||R.target!==void 0){const k=P,W=R.source!==void 0?p(R.source):k.source,V=R.target!==void 0?p(R.target):k.target,$=Z=>({x:Z.x+Z.width/2,y:Z.y+Z.height/2});n.reconnect(k,W,V,[$(W),$(V)])}R.name!==void 0&&n.updateProperties(P,{name:R.name??void 0}),R.condition!==void 0&&n.updateProperties(P,{name:((xx=R.condition)==null?void 0:xx.label)??void 0})}for(const R of Yt(e,"messageFlow.update"))R.name!==void 0&&n.updateProperties(p(R.id),{name:R.name??void 0});for(const R of Yt(e,"dataStore.update"))R.name!==void 0&&n.updateProperties(p(R.id),{name:R.name??void 0});for(const R of Yt(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 k=hx(p(R.placement.anchor)),[W,V]=Vu[R.placement.side],$=R.placement.offset??50,Z=k.x+k.width/2+W*(k.width/2+P.width/2+$),Me=k.y+k.height/2+V*(k.height/2+P.height/2+$);n.moveElements([P],{x:Z-(P.x+P.width/2),y:Me-(P.y+P.height/2)}),T(P,"bwl:Placement",L(R.placement))}}for(const R of Yt(e,"group.update")){const P=p(R.id);if(R.name!==void 0&&n.updateLabel(P,R.name??""),R.members){const k=R.members.map(l).filter(W=>!!W);if(k.length){const V=Math.min(...k.map(J=>J.x))-40,$=Math.min(...k.map(J=>J.y))-40,Z=Math.max(...k.map(J=>J.x+J.width))+40,Me=Math.max(...k.map(J=>J.y+J.height))+40;n.resizeShape(P,{x:V,y:$,width:Z-V,height:Me-$})}T(P,"bwl:Members",{refs:R.members.join(" ")})}}}function nh(e,t,n=th){const i=eh(e),r=Qd(t,Pd(i.elementRegistry)),o={edgeCrossings:{before:0,after:0,pairs:[]}};if(r.length)return{ok:!1,issues:r,findings:[],stats:o};const a=qt(i.elementRegistry),s=new Set(Yi(a).map(Ui)),c=new Set(a.edges.map(m=>m.id)),u=new Set(a.shapes.map(m=>m.id)),l=Hu(a).length,p=e.get("commandStack");try{jf(p,()=>{n(t,i),Bd(i,c),Ld(i,s),Vd(i,s,c),Hd(i,c),qd(i,s,c),Ud(i,c),Kd(i,u)})}catch(m){return{ok:!1,issues:[{kind:"lower-failed",message:m instanceof Error?m.message:String(m)}],findings:[],stats:o}}const f=qt(i.elementRegistry),d=Yi(f).filter(m=>!s.has(Ui(m))),h=Hu(f);return{ok:!0,issues:[],findings:d,stats:{edgeCrossings:{before:l,after:h.length,pairs:h}}}}function XE(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function ZE(e,t){return typeof e.get=="function"?e.get(t):e[t]}function ih(e,t){const n=ZE(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function rh(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function QE(e){return typeof e=="string"&&xu.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 oh(e){const t=e.rootElements??[],n=t.find(q=>q.$type==="bpmn:Collaboration"),i=new Map(t.filter(q=>q.$type==="bpmn:Process").map(q=>[q.id,q])),r=[],o=[],a=[],s=[],c=[],u=[],l={poolOrders:{},bands:{},placements:{}},p=[],f=[],d=[],h=[],m=[],g=[],S=new Set,E=new Set,x=q=>{q&&S.add(q)},b=q=>{S.add(q),E.add(q)},w=q=>{const pe=rh(q,"bwl:Placement");if(!pe)return;const fe=typeof pe.anchor=="string"?pe.anchor:void 0;if(!fe||!QE(pe.side))return;const se=typeof pe.offset=="number"?pe.offset:void 0;m.push({owner:q.id,anchor:fe,side:pe.side,...se!==void 0?{offset:se}:{}})},T=q=>{const pe=rh(q,"bwl:Members"),fe=typeof(pe==null?void 0:pe.refs)=="string"?pe.refs.split(/\s+/).filter(Boolean):[];fe.length&&g.push({owner:q.id,refs:fe})},L=q=>{var pe;for(const fe of q)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 se=(pe=fe.categoryValueRef)==null?void 0:pe.value;c.push({id:fe.id,...typeof se=="string"&&se?{name:se}:{}}),T(fe);break}default:u.push({id:fe.id,type:fe.$type,reason:"type-outside-mvp"})}},A=(q,pe)=>{const fe=q.flowElements??[],se=(q.laneSets??[]).flatMap(ee=>ee.lanes??[]),ce=new Map;for(const ee of se){x(ee.id);for(const j of ee.flowNodeRef??[]){const B=ui(j);B&&ce.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 j=XE(ee.$type);if(!If(j)){u.push({id:ee.id,type:ee.$type,reason:"type-outside-mvp"});continue}b(ee.id),o.push({id:ee.id,type:j,...ee.name?{name:ee.name}:{},...pe?{participant:pe}:{},...ce.has(ee.id)?{lane:ce.get(ee.id)}:{}});const B=ih(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(q.artifacts??[])};if(n){const q=new Set;for(const pe of n.participants??[]){b(pe.id);const fe=ui(pe.processRef);fe&&q.add(fe);const se=fe?i.get(fe):void 0,ce=((se==null?void 0:se.laneSets)??[]).flatMap(U=>U.lanes??[]),ee=ce.map(U=>({id:U.id,...U.name?{name:U.name}:{}}));for(const U of ee)b(U.id);const j=!se||(se.flowElements??[]).length===0&&ce.length===0&&(se.artifacts??[]).length===0;r.push({id:pe.id,...pe.name?{name:pe.name}:{},...j?{blackBox:!0}:{},...ee.length?{lanes:ee}:{}});const B=ih(pe,"bwl:poolOrder");B!==void 0&&(l.poolOrders[pe.id]=B),se&&A(se,pe.id)}for(const pe of n.messageFlows??[])x(pe.id),f.push({id:pe.id,source:ui(pe.sourceRef),target:ui(pe.targetRef),...typeof pe.name=="string"&&pe.name?{name:pe.name}:{}});L(n.artifacts??[]);for(const[pe,fe]of i)!q.has(pe)&&(fe.flowElements??[]).length>0&&u.push({id:pe,type:fe.$type,reason:"unreachable-process"})}else for(const q of i.values())A(q);const F=[],H=[],N=[],z=[],le=(q,pe)=>!!q&&!!pe&&E.has(q)&&E.has(pe);for(const q of p){if(!le(q.source,q.target)){u.push({id:q.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}F.push({id:q.id,source:q.source,target:q.target,...q.name?{name:q.name}:{}}),E.add(q.id)}for(const q of f){if(!le(q.source,q.target)){u.push({id:q.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}H.push({id:q.id,source:q.source,target:q.target,...q.name?{name:q.name}:{}}),E.add(q.id)}for(const q of h){if(!le(q.source,q.target)){u.push({id:q.id??"",type:q.type,reason:"endpoint-outside-mvp"});continue}z.push({...q.id?{id:q.id}:{},source:q.source,target:q.target}),q.id&&E.add(q.id)}for(const q of d){if(!le(q.source,q.target)){u.push({id:q.id??"",type:q.type,reason:"endpoint-outside-mvp"});continue}N.push({...q.id?{id:q.id}:{},source:q.source,target:q.target})}const $e=new Map(c.map(q=>[q.id,q]));for(const{owner:q,refs:pe}of g){const fe=pe.filter(ce=>S.has(ce)),se=$e.get(q);se&&fe.length&&(se.members=fe)}for(const q of m)S.has(q.anchor)&&(l.placements[q.owner]={anchor:q.anchor,side:q.side,...q.offset!==void 0?{offset:q.offset}:{}});return{definition:{...r.length?{participants:r}:{},nodes:o,sequenceFlows:F,...H.length?{messageFlows:H}:{},...a.length?{dataStores:a}:{},...z.length?{dataAssociations:z}:{},...s.length?{annotations:s}:{},...N.length?{associations:N}:{},...c.length?{groups:c}:{}},hints:l,omitted:u}}async function JE(e){const{definitions:t,warnings:n}=await $u(e);return{...oh(t),warnings:n}}function ew(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function ah(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=nh(e,t.ops);if(!i.ok)return{status:"rejected",issues:i.issues};const{xml:r}=await e.saveXML({format:!0});return{status:"applied",version:n+1,xml:r??"",findings:i.findings,stats:i.stats}}const tw=Symbol("bpmn-editor");function nw(){const e=wt.ref(!1),t=wt.ref(!0),n=wt.ref(!1);let i,r;const o=()=>{e.value=!0};function a(u,l){u.get("canvas").getContainer().style.pointerEvents=l?"":"none";const p=u.get("keyboard");l?(r&&p.bind(r),r=void 0):r||(r=p.getBinding(),p.unbind())}function s(){if(!i)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return i}function c(){return i==null?void 0:i.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,attach(u){i&&this.detach(),i=u,i.get("eventBus").on("commandStack.changed",o),t.value||a(i,!1)},detach(){i==null||i.get("eventBus").off("commandStack.changed",o),i&&!t.value&&a(i,!0),r=void 0,i=void 0},setEditable(u){t.value=u,i&&a(i,u)},async applyAgentBatch(u,l){const p=s();n.value=!0;try{const f=await ah(p,u,{currentVersion:l});return f.status==="applied"&&(e.value=!1),f}finally{n.value=!1}},async importXml(u){const{warnings:l}=await s().importXML(u);return e.value=!1,{warnings:ju(l)}},async saveXml(){const{xml:u}=await s().saveXML({format:!0});return e.value=!1,u??""},undo:()=>{var u;return(u=c())==null?void 0:u.undo()},redo:()=>{var u;return(u=c())==null?void 0:u.redo()},canUndo:()=>{var u;return((u=c())==null?void 0:u.canUndo())??!1},canRedo:()=>{var u;return((u=c())==null?void 0:u.canRedo())??!1}}}function ie(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function iw(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Gu={exports:{}},sh;function rw(){if(sh)return Gu.exports;sh=1;var e=Gu.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},Gu.exports}var ow=rw(),aw=iw(ow);function li(e){if(!(this instanceof li))return new li(e);e=e||[128,36,1],this._seed=e.length?aw.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 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 ct(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 sw(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 an(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const cw=Object.prototype.toString;function dt(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 cw.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Ki.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},Ki.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Ki.prototype.array=function(){return Array.from(this.list)},Ki.prototype.has=Ki.prototype.contains=function(e){return this.list.contains(e)};function ms(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Dr(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function uw(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var gs={},ch;function lw(){if(ch)return gs;ch=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return gs.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},gs.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},gs}var uh=lw(),pw=uw(uh),we=sw({__proto__:null,default:pw},[uh]),lh=["focus","blur"];function fw(e,t,n,i,r){return lh.indexOf(n)!==-1&&(r=!0),we.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=Dr(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function dw(e,t,n,i){return lh.indexOf(t)!==-1&&(i=!0),we.unbind(e,t,n,i)}var Sn={bind:fw,unbind:dw};function Wu(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function tt(e,t){return t=t||document,t.querySelector(e)}function ys(e,t){return t=t||document,t.querySelectorAll(e)}function pi(e){e.parentNode&&e.parentNode.removeChild(e)}function hw(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function mw(e,t){return t.appendChild(hw(e,t))}function Se(e,t){return mw(t,e),e}var Uu=2,ph={"alignment-baseline":1,"baseline-shift":1,clip:1,"clip-path":1,"clip-rule":1,color:1,"color-interpolation":1,"color-interpolation-filters":1,"color-profile":1,"color-rendering":1,cursor:1,direction:1,display:1,"dominant-baseline":1,"enable-background":1,fill:1,"fill-opacity":1,"fill-rule":1,filter:1,"flood-color":1,"flood-opacity":1,font:1,"font-family":1,"font-size":Uu,"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":Uu,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function gw(e,t){return ph[t]?e.style[t]:e.getAttributeNS(null,t)}function fh(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=ph[i];r?(r===Uu&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function yw(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)fh(e,r,t[r])}function re(e,t,n){if(typeof t=="string")if(n!==void 0)fh(e,t,n);else return gw(e,t);else yw(e,t);return e}const vw=Object.prototype.toString;function Fe(e){return new Xi(e)}function Xi(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Xi.prototype.add=function(e){return this.list.add(e),this},Xi.prototype.remove=function(e){return vw.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Xi.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},Xi.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Xi.prototype.array=function(){return Array.from(this.list)},Xi.prototype.has=Xi.prototype.contains=function(e){return this.list.contains(e)};function vs(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function dh(e){return e.cloneNode(!0)}var qu={svg:"http://www.w3.org/2000/svg"},hh='<svg xmlns="'+qu.svg+'"';function _w(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(qu.svg)===-1&&(e=hh+e.substring(4)):(e=hh+">"+e+"</svg>",t=!0);var n=bw(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function bw(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function de(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=_w(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(qu.svg,e),t&&re(n,t),n}var Yu=null;function mh(){return Yu===null&&(Yu=de("svg")),Yu}function gh(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function xw(e,t,n,i,r,o){var a=mh().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return gh(a,e);case 6:return gh(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function Uo(e){return mh().createSVGTransform()}var yh=/([&<>]{1})/g,Ew=/([&<>\n\r"]{1})/g,ww={"&":"&","<":"<",">":">",'"':"'"};function Ku(e,t){function n(i,r){return ww[r]||r}return e.replace(t,n)}function vh(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(Ku(e.textContent,yh));break;case 1:if(t.push("<",e.tagName),e.hasAttributes())for(r=e.attributes,n=0,i=r.length;n<i;++n)o=r.item(n),t.push(" ",o.name,'="',Ku(o.value,Ew),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)vh(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",Ku(e.nodeValue,yh),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function Sw(e){for(var t=e.firstChild,n=[];t;)vh(t,n),t=t.nextSibling;return n.join("")}function _h(e,t){return Sw(e)}function It(e){var t=e.parentNode;return t&&t.removeChild(e),e}function Rw(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function Cw(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(Rw(e,i))}function qo(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),Cw(n,t)),n.consolidate()}const Pw=/^class[ {]/;function Aw(e){return Pw.test(e.toString())}function Xu(e){return Array.isArray(e)}function Zu(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function _s(...e){e.length===1&&Xu(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const Tw=/constructor\s*[^(]*\(\s*([^)]*)\)/m,Mw=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,kw=/\/\*([^*]*)\*\//m;function Dw(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(Aw(e)?Tw:Mw);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(kw);return(r&&r[1]||i).trim()})||[]}function bh(e,t){const n=t||{get:function(x,b){if(i.push(x),b===!1)return null;throw 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(Zu(o,x))return o[x];if(Zu(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(Xu(x))x=_s(x.slice());else throw s(`Cannot invoke "${x}". Expected a function!`);const T=(x.$inject||Dw(x)).map(L=>Zu(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 _s(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,le;for(let $e in r)H=r[$e],b.indexOf($e)!==-1&&(H[2]==="private"?(N=L.indexOf(H[3]),N===-1?(z=H[3].createChild([],b),le=f(z),L.push(H[3]),A.push(z),F.push(le),w[$e]=[le,$e,"private",z]):w[$e]=[F[N],$e,"private",A[N]]):w[$e]=[H[2],H[1]],T[$e]=!0),(H[2]==="factory"||H[2]==="type")&&H[1].$scope&&b.forEach(ut=>{H[1].$scope.indexOf(ut)!==-1&&(w[$e]=[H[2],H[1]],T[ut]=!0)});b.forEach($e=>{if(!T[$e])throw new Error('No provider for "'+$e+'". Cannot use provider from the parent!')}),x.unshift(w)}return new bh(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=_s(function(N){return A.get(N)});b.forEach(function(N){r[N]=[F,N,"private",A]});const H=(x.__init__||[]).slice();return H.unshift(function(){A.init()}),x=Object.assign({},x,{__init__:H}),m(x,A)}return Object.keys(x).forEach(function(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],Ow(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 Ow(e,t){return e!=="value"&&Xu(t)&&(t=_s(t.slice())),t}var Lw=1e3;function Ci(e,t){var n=this;t=t||Lw,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 Or(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function Iw(e){return["M",e.x,e.y]}function Qu(e){return["L",e.x,e.y]}function Nw(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function Bw(e,t){const n=e.length,i=[Iw(e[0])];for(let r=1;r<n;r++){const o=e[r-1],a=e[r],s=e[r+1];if(!s||!t){i.push(Qu(a));continue}const c=Math.min(t,Ju(a.x-o.x,a.y-o.y),Ju(s.x-a.x,s.y-a.y));if(!c){i.push(Qu(a));continue}const u=bs(a,o,c),l=bs(a,o,c*.5),p=bs(a,s,c),f=bs(a,s,c*.5);i.push(Qu(u)),i.push(Nw(l,f,p))}return i}function bs(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=Ju(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function Ju(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Yo(e,t,n){be(t)&&(n=t,t=null),t||(t={});const i=de("path",t);return be(n)&&(i.dataset.cornerRadius=String(n)),el(i,e)}function el(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return re(e,{d:Or(Bw(t,n))}),e}function xs(e){var t=new Set(e);return Oe(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function Lr(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&&Lr(o,t,n+1)})}function tl(e,t,n){var i=new Set,r=new Set;return Lr(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 tl(e)}function $w(e,t,n){Rr(t)&&(t=!0),Ht(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&&Jr(e,function(l){return l.id}));function c(l){s[l.source.id]&&s[l.target.id]&&(s[l.id]=[l]),i[l.source.id]&&i[l.target.id]&&(a[l.id]=o[l.id]=l),r[l.id]=l}function u(l){if(o[l.id]=l,l.waypoints)a[l.id]=r[l.id]=l;else return i[l.id]=l,M(l.incoming,c),M(l.outgoing,c),l.children}return Lr(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 oo(e,t){var n={};return M(e,function(i){var r=i;r.waypoints&&(r=Rt(r)),!be(t.y)&&r.x>t.x&&(n[i.id]=i),!be(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(be(t.width)&&be(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!be(t.width)||!be(t.height))&&(n[i.id]=i)}),n}function xh(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function Eh(e){return!!(e&&e.isFrame)}function Xo(e,t){return O({},e||{},t||{})}var jw=1;function Zi(e,t){Ci.call(this,e,jw),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=de("rect");return re(r,{x:0,y:0,width:n.width||0,height:n.height||0}),Eh(n)?re(r,O({},this.FRAME_STYLE,i||{})):re(r,O({},this.SHAPE_STYLE,i||{})),Se(t,r),r},Zi.prototype.drawConnection=function(t,n,i){var r=Yo(n.waypoints,O({},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 Or(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 Or(o)},Zi.$inject=["eventBus","styles"];function Fw(){var e={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},t=this;this.cls=function(n,i,r){var o=this.style(i,r);return O(o,{class:n})},this.style=function(n,i){!ge(n)&&!i&&(i=n,n=[]);var r=En(n,function(o,a){return O(o,e[a]||{})},{});return i?O(r,i):r},this.computeStyle=function(n,i,r){return ge(i)||(r=i,i=[]),t.style(i||[],O({},r,n||{}))}}const Hw={__init__:["defaultRenderer"],defaultRenderer:["type",Zi],styles:["type",Fw]};function xt(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 nl(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 il(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 zw=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(Vw(r,n))return o;return!1}function Vw(e,t){const n=t[0];return Cr(t,function(i){return Math.abs(n[e]-i[e])<=zw})}function wh(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 rl(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var Gw=/,?([a-z]),?/gi,Sh=parseFloat,Ct=Math,Qi=Ct.PI,fi=Ct.min,di=Ct.max,Rh=Ct.pow,Ji=Ct.abs,Ww=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,Uw=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,Ch=Array.isArray||function(e){return e instanceof Array};function qw(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Yw(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 Kw(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 qw(r,i)?(Yw(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function Xw(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(Ww,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(Uw,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=al,n}function Zw(e){for(var t=0,n=e.length;t<n;t++){var i=e[t][0];if(typeof i=="string"&&i!==i.toUpperCase())return!1}return!0}function Qw(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 ol(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 al(){return this.join(",").replace(Gw,"$1")}function Jw(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=al,t}function Ph(e,t,n,i,r,o,a,s,c){var u=1-c,l=Rh(u,3),p=Rh(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:Es(h),y:Es(m)}}function Ah(e){var t=o1(...e);return ol(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 e1(e,t){return e=ol(e),t=ol(t),er(t,e.x,e.y)||er(t,e.x2,e.y)||er(t,e.x,e.y2)||er(t,e.x2,e.y2)||er(e,t.x,t.y)||er(e,t.x2,t.y)||er(e,t.x,t.y2)||er(e,t.x2,t.y2)||(e.x<t.x2&&e.x>t.x||t.x<e.x2&&t.x>e.x)&&(e.y<t.y2&&e.y>t.y||t.y<e.y2&&t.y>e.y)}function Th(e,t,n,i,r){var o=-3*t+9*n-9*i+3*r,a=e*o+6*t-12*n+6*i;return e*a-3*t+3*n}function Mh(e,t,n,i,r,o,a,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=Th(m,e,n,r,a),S=Th(m,t,i,o,s),E=g*g+S*S;d+=f[h]*Ct.sqrt(E)}return u*d}function t1(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=Es(c/l),f=Es(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 Es(e){return Math.round(e*1e11)/1e11}function n1(e,t,n){var i=Ah(e),r=Ah(t);if(!e1(i,r))return[];var o=Mh(...e),a=Mh(...t),s=Dh(e)?1:~~(o/5)||1,c=Dh(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=Ph(...e,d/s);u[d]={x:m.x,y:m.y,t:d/s}}for(d=0;d<c+1;d++)m=Ph(...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=t1(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 kh(e,t,n){e=Ih(e),t=Ih(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=n1(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 i1(e){return Ch(e)&&Ch(e[0])}function r1(e){if(Zw(e))return e;var t=new Array(e.length),n=0,i=0,r=0,o=0,a=0,s;e[0][0]=="M"&&(n=+e[0][1],i=+e[0][2],r=n,o=i,a++,t[0]=["M",n,i]);for(var c,u,l=a,p=e.length;l<p;l++){if(u=e[l],s=u[0],t[l]=c=new Array(u.length),s!=s.toUpperCase())switch(c[0]=s.toUpperCase(),c[0]){case"A":c[1]=u[1],c[2]=u[2],c[3]=u[3],c[4]=u[4],c[5]=u[5],c[6]=+u[6]+n,c[7]=+u[7]+i;break;case"V":c[1]=+u[1]+i;break;case"H":c[1]=+u[1]+n;break;case"M":r=+u[1]+n,o=+u[2]+i;default:for(var f=1,d=u.length;f<d;f++)c[f]=+u[f]+(f%2?n:i)}else for(var h=0,m=u.length;h<m;h++)c[h]=u[h];switch(s=s.toUpperCase(),c[0]){case"Z":n=+r,i=+o;break;case"H":n=c[1];break;case"V":i=c[1];break;case"M":r=c[c.length-2],o=c[c.length-1];default:n=c[c.length-2],i=c[c.length-1]}}return t.toString=al,t}function Dh(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function ws(e,t,n,i){return[e,t,n,i,n,i]}function Oh(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 Lh(e,t,n,i,r,o,a,s,c,u){var l=Qi*120/180,p=Qi/180*(+r||0),f=[],d,h=Kw(function(C,_,y){var D=C*Ct.cos(y)-_*Ct.sin(y),I=C*Ct.sin(y)+_*Ct.cos(y);return{x:D,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=Ct.sqrt(S),n=S*n,i=S*i);var E=n*n,x=i*i,b=(o==a?-1:1)*Ct.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=Ct.asin(((t-T)/i).toFixed(9)),A=Ct.asin(((c-T)/i).toFixed(9));L=e<w?Qi-L:L,A=s<w?Qi-A:A,L<0&&(L=Qi*2+L),A<0&&(A=Qi*2+A),a&&L>A&&(L=L-Qi*2),!a&&A>L&&(A=A-Qi*2)}var F=A-L;if(Ji(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=Lh(s,c,n,i,r,0,a,N,z,[A,H,w,T])}F=A-L;var le=Ct.cos(L),$e=Ct.sin(L),ut=Ct.cos(A),q=Ct.sin(A),pe=Ct.tan(F/4),fe=4/3*n*pe,se=4/3*i*pe,ce=[e,t],ee=[e+fe*$e,t-se*le],j=[s+fe*q,c-se*ut],B=[s,c];if(ee[0]=2*ce[0]-ee[0],ee[1]=2*ce[1]-ee[1],u)return[ee,j,B].concat(f);f=[ee,j,B].concat(f).join().split(",");for(var U=[],Te=0,kt=f.length;Te<kt;Te++)U[Te]=Te%2?h(f[Te-1],f[Te],p).y:h(f[Te],f[Te+1],p).x;return U}function o1(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=Ct.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 Ih(e){if(i1(e)||(e=Xw(e)),Qw(e))return e;for(var t=Jw(r1(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(f,d,h){var m,g;if(!f)return["C",d.x,d.y,d.x,d.y,d.x,d.y];switch(!(f[0]in{T:1,Q:1})&&(d.qx=d.qy=null),f[0]){case"M":d.X=f[1],d.Y=f[2];break;case"A":f=["C",...Lh(d.x,d.y,...f.slice(1))];break;case"S":h=="C"||h=="S"?(m=d.x*2-d.bx,g=d.y*2-d.by):(m=d.x,g=d.y),f=["C",m,g,...f.slice(1)];break;case"T":h=="Q"||h=="T"?(d.qx=d.x*2-d.qx,d.qy=d.y*2-d.qy):(d.qx=d.x,d.qy=d.y),f=["C",...Oh(d.x,d.y,d.qx,d.qy,f[1],f[2])];break;case"Q":d.qx=f[1],d.qy=f[2],f=["C",...Oh(d.x,d.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...ws(d.x,d.y,f[1],f[2])];break;case"H":f=["C",...ws(d.x,d.y,f[1],d.y)];break;case"V":f=["C",...ws(d.x,d.y,d.x,f[1])];break;case"Z":f=["C",...ws(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=Sh(l[p-4])||n.x,n.by=Sh(l[p-3])||n.y}return t}function nt(e){return Ht(e)&&xn(e,"waypoints")}function Ae(e){return Ht(e)&&xn(e,"labelTarget")}function a1(e){return Ht(e)&&Zr(e.parent)}function Nh(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function 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 Ss(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function s1(e){return Ai({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function c1(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=p1(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 nt(e)?c1(e):s1(e)}function Kt(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 Qo(e,t,n){var i=u1(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 u1(e,t){return kh(e,t)}function l1(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||il(i,r,n)?e.splice(t,1):t++;return e}function p1(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Rs(e,t){return Math.round(e*t)/t}function Bh(e){return be(e)?e+"px":e}function f1(e){for(;e.parent;)e=e.parent;return e}function d1(e){e=O({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),fn(n,{position:"relative",overflow:"hidden",width:Bh(e.width),height:Bh(e.height)}),t.appendChild(n),n}function $h(e,t,n){const i=de("g");Fe(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const h1="base",jh=0,m1=1,g1={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=d1(e),i=this._svg=de("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=$h(i,"viewport");e.deferUpdate&&(this._viewboxChanged=Ru(this._viewboxChanged,300)),this._restoreFocus=Ru(this._restoreFocus,0),t.on("diagram.init",()=>{t.fire("canvas.init",{svg:i,viewport:r})}),t.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed","root.set"],()=>{delete this._cachedViewbox}),t.on("diagram.destroy",500,this._destroy,this),t.on("diagram.clear",500,this._clear,this)},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=xh(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(h1,jh)},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 En(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},ve.prototype._createLayer=function(e,t){typeof t>"u"&&(t=m1);const n=this._getChildIndex(t);return{group:$h(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(f1(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 ot(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),Fe(r).add(t)):(e.markers.delete(t),Fe(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},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,jh);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=g1[e];if(!Cr(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),xt(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:xw(),s=Rs(r.a,1e3),c=Rs(-r.e||0,1e3),u=Rs(-r.f||0,1e3),e=this._cachedViewbox={x:c?c/s:0,y:u?u/s:0,width:n.width/s,height:n.height/s,scale:s,inner:{width:i.width||0,height:i.height||0,x:i.x||0,y:i.y||0},outer:n},e;return e},ve.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=O({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Fh(t,n)}),{x:n.e,y:n.f}},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),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)}),Rs(i.a,1e3)};function Fh(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}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=O(o,t),s=a.matrixTransform(c.inverse()),u=r.translate(s.x,s.y).scale(1/p*e).translate(-s.x,-s.y),l=c.multiply(u)):l=r.scale(e),Fh(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 ao="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,ao,i),n&&re(n,ao,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,ao,""),i.secondaryGfx&&re(i.secondaryGfx,ao,""),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,ao,i),t},On.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&re(e,ao);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 y1(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 v1(e){return e.__refs_collection===!0}function _1(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function Hh(e,t,n){var i=y1(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 b1(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?Hh(this,t,e):b1(this,t,e)},Fn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return v1(n)||Hh(this,t,e),n},Fn.prototype.ensureBound=function(e,t){_1(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 sl=new Fn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),zh=new Fn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Vh=new Fn({name:"attachers",collection:!0},{name:"host"}),Gh=new Fn({name:"outgoing",collection:!0},{name:"source"}),Wh=new Fn({name:"incoming",collection:!0},{name:"target"});function so(){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)}}),sl.bind(this,"parent"),zh.bind(this,"labels"),Gh.bind(this,"outgoing"),Wh.bind(this,"incoming")}function Jo(){so.call(this),sl.bind(this,"children"),Vh.bind(this,"host"),Vh.bind(this,"attachers")}ie(Jo,so);function Uh(){so.call(this),sl.bind(this,"children")}ie(Uh,Jo);function qh(){Jo.call(this),zh.bind(this,"labelTarget")}ie(qh,Jo);function Yh(){so.call(this),Gh.bind(this,"source"),Wh.bind(this,"target")}ie(Yh,so);var x1={connection:Yh,shape:Jo,label:qh,root:Uh};function E1(e,t){var n=x1[e];if(!n)throw new Error("unknown type: <"+e+">");return O(new n,t)}function w1(e){return e instanceof so}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=O({},t||{}),t.id||(t.id=e+"_"+this._uid++),E1(e,t)};var Cs="__fn",Kh=1e3,S1=Array.prototype.slice;function Rn(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}Rn.prototype.on=function(e,t,n,i){if(e=ge(e)?e:[e],zt(t)&&(i=n,n=t,t=Kh),!be(t))throw new Error("priority must be a number");var r=n;i&&(r=gn(n,i),r[Cs]=n[Cs]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},Rn.prototype.once=function(e,t,n,i){var r=this;if(zt(t)&&(i=n,n=t,t=Kh),!be(t))throw new Error("priority must be a number");function o(){o.__isTomb=!0;var a=n.apply(i,arguments);return r.off(e,o),a}o[Cs]=n,this.on(e,t,o)},Rn.prototype.off=function(e,t){e=ge(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},Rn.prototype.createEvent=function(e){var t=new ea;return t.init(e),t},Rn.prototype.fire=function(e,t){var n,i,r,o;if(o=S1.call(arguments),typeof e=="object"&&(t=e,e=t.type),!e)throw new Error("no event type specified");if(i=this._listeners[e],!!i){t instanceof 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}},Rn.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},Rn.prototype._destroy=function(){this._listeners={}},Rn.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},Rn.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=R1(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},Rn.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},Rn.prototype._getListeners=function(e){return this._listeners[e]},Rn.prototype._setListeners=function(e,t){this._listeners[e]=t},Rn.prototype._removeListener=function(e,t){var n=this._getListeners(e),i,r,o;if(!t){this._setListeners(e,null);return}for(;n;)i=n.next,o=n.callback,(o===t||o[Cs]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function ea(){}ea.prototype.stopPropagation=function(){this.cancelBubble=!0},ea.prototype.preventDefault=function(){this.defaultPrevented=!0},ea.prototype.init=function(e){O(this,e||{})};function R1(e,t){return e.apply(null,t)}function Ir(e){return e.childNodes[0]}function C1(e){return e.parentNode.childNodes[1]}function Ps(e,t,n,i,r){var o=Uo();o.setTranslate(t,n);var a=Uo();a.setRotate(i||0,0,0);var s=Uo();s.setScale(1,1),qo(e,[o,a,s])}function Xt(e,t,n){var i=Uo();i.setTranslate(t,n),qo(e,i)}function Xh(e,t){var n=Uo();n.setRotate(t,0,0),qo(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=C1(t),n||(n=de("g"),Fe(n).add("djs-children"),Se(t.parentNode,n))):n=t,n},Ln.prototype._clear=function(e){var t=Ir(e);return ms(t),t},Ln.prototype._createContainer=function(e,t,n,i){var r=de("g");Fe(r).add("djs-group"),typeof n<"u"?P1(r,t,t.childNodes[n]):Se(t,r);var o=de("g");Fe(o).add("djs-element"),Fe(o).add("djs-"+e),i&&Fe(o).add("djs-frame"),Se(r,o);var a=de("g");return Fe(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,Eh(t))},Ln.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=En(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),M(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r),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),Xt(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 P1(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const A1={__depends__:[Hw],__init__:["canvas"],canvas:["type",ve],elementRegistry:["type",On],elementFactory:["type",Ti],eventBus:["type",Rn],graphicsFactory:["type",Ln]};function T1(e){var t=new bh(e);return t.init(),t}function M1(e){e=e||{};var t={config:["value",e]},n=[t,A1].concat(e.modules||[]);return T1(n)}function tr(e,t){this._injector=t||M1(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 k1(e){return ot(e.rootElements,function(t){return yn(t,"bpmn:Process")||yn(t,"bpmn:Collaboration")})}function D1(e){var t={},n=[],i={};function r(j,B){return function(U){j(U,B)}}function o(j){t[j.id]=j}function a(j){return t[j.id]}function s(j,B){var U=j.gfx;if(U)throw new Error(`already rendered ${sn(j)}`);return e.element(j,i[j.id],B)}function c(j,B){return e.root(j,i[j.id],B)}function u(j,B){try{var U=i[j.id]&&s(j,B);return o(j),U}catch(Te){l(Te.message,{element:j,error:Te}),console.error(`failed to import ${sn(j)}`,Te)}}function l(j,B){e.error(j,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(j){d(j.plane)}function d(j){p(j),M(j.planeElement,h)}function h(j){p(j)}this.handleDefinitions=function(B,U){var Te=B.diagrams;if(U&&Te.indexOf(U)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!U&&Te&&Te.length&&(U=Te[0]),!U)throw new Error("no diagram to display");i={},f(U);var kt=U.plane;if(!kt)throw new Error(`no plane for ${sn(U)}`);var C=kt.bpmnElement;if(!C)if(C=k1(B),C)l(`correcting missing bpmnElement on ${sn(kt)} to ${sn(C)}`),kt.bpmnElement=C,p(kt);else throw new Error("no process or collaboration to display");var _=c(C,kt);if(yn(C,"bpmn:Process")||yn(C,"bpmn:SubProcess"))g(C,_);else if(yn(C,"bpmn:Collaboration"))ce(C,_),S(B.rootElements,_);else throw new Error(`unsupported bpmnElement for ${sn(kt)}: ${sn(C)}`);m(n)};var m=this.handleDeferred=function(){for(var B;n.length;)B=n.shift(),B()};function g(j,B){pe(j,B),F(j.ioSpecification,B),A(j.artifacts,B),o(j)}function S(j,B){var U=Oe(j,function(Te){return!a(Te)&&yn(Te,"bpmn:Process")&&Te.laneSets});U.forEach(r(g,B))}function E(j,B){u(j,B)}function x(j,B){M(j,r(E,B))}function b(j,B){u(j,B)}function w(j,B){u(j,B)}function T(j,B){u(j,B)}function L(j,B){u(j,B)}function A(j,B){M(j,function(U){yn(U,"bpmn:Association")?n.push(function(){L(U,B)}):L(U,B)})}function F(j,B){j&&(M(j.dataInputs,r(w,B)),M(j.dataOutputs,r(T,B)))}var H=this.handleSubProcess=function(B,U){pe(B,U),A(B.artifacts,U)};function N(j,B){var U=u(j,B);yn(j,"bpmn:SubProcess")&&H(j,U||B),yn(j,"bpmn:Activity")&&F(j.ioSpecification,B),n.push(function(){M(j.dataInputAssociations,r(b,B)),M(j.dataOutputAssociations,r(b,B))})}function z(j,B){u(j,B)}function le(j,B){u(j,B)}function $e(j,B){n.push(function(){var U=u(j,B);j.childLaneSet&&ut(j.childLaneSet,U||B),ee(j)})}function ut(j,B){M(j.lanes,r($e,B))}function q(j,B){M(j,r(ut,B))}function pe(j,B){fe(j.flowElements,B),j.laneSets&&q(j.laneSets,B)}function fe(j,B){M(j,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")?le(U,B):l(`unrecognized flowElement ${sn(U)} in context ${sn(B&&B.businessObject)}`,{element:U,context:B}))})}function se(j,B){var U=u(j,B),Te=j.processRef;Te&&g(Te,U||B)}function ce(j,B){M(j.participants,r(se,B)),n.push(function(){x(j.messageFlows,B)}),A(j.artifacts,B)}function ee(j){M(j.flowNodeRef,function(B){var U=B.get("lanes");U&&U.push(j)})}}function v(e,t){var n=X(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function ke(e,t){return zi(t,function(n){return v(e,n)})}function X(e){return e&&e.businessObject||e}function ze(e){return e&&e.di}function O1(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 D1(p);l=l||u.diagrams&&u.diagrams[0];var d=L1(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 L1(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!v(n,"bpmn:Process")&&!v(n,"bpmn:Collaboration")&&(i=I1(n));var r;v(i,"bpmn:Collaboration")?r=i:r=ot(e.rootElements,function(u){if(v(u,"bpmn:Collaboration"))return ot(u.participants,function(l){return l.processRef===i})});var o=[i];r&&(o=rn(r.participants,function(u){return u.processRef}),o.push(r));var a=Zh(o),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 Zh(e){var t=[];return M(e,function(n){n&&(t.push(n),t=t.concat(Zh(n.flowElements)))}),t}function I1(e){for(var t=e;t;){if(v(t,"bpmn:Process"))return t;t=t.$parent}}var N1='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.02 5.57" width="53" height="21"><path fill="currentColor" d="M1.88.92v.14c0 .41-.13.68-.4.8.33.14.46.44.46.86v.33c0 .61-.33.95-.95.95H0V0h.95c.65 0 .93.3.93.92zM.63.57v1.06h.24c.24 0 .38-.1.38-.43V.98c0-.28-.1-.4-.32-.4zm0 1.63v1.22h.36c.2 0 .32-.1.32-.39v-.35c0-.37-.12-.48-.4-.48H.63zM4.18.99v.52c0 .64-.31.98-.94.98h-.3V4h-.62V0h.92c.63 0 .94.35.94.99zM2.94.57v1.35h.3c.2 0 .3-.09.3-.37v-.6c0-.29-.1-.38-.3-.38h-.3zm2.89 2.27L6.25 0h.88v4h-.6V1.12L6.1 3.99h-.6l-.46-2.82v2.82h-.55V0h.87zM8.14 1.1V4h-.56V0h.79L9 2.4V0h.56v4h-.64zm2.49 2.29v.6h-.6v-.6zM12.12 1c0-.63.33-1 .95-1 .61 0 .95.37.95 1v2.04c0 .64-.34 1-.95 1-.62 0-.95-.37-.95-1zm.62 2.08c0 .28.13.39.33.39s.32-.1.32-.4V.98c0-.29-.12-.4-.32-.4s-.33.11-.33.4z"/><path fill="currentColor" d="M0 4.53h14.02v1.04H0zM11.08 0h.63v.62h-.63zm.63 4V1h-.63v2.98z"/></svg>',Qh=N1,Jh={verticalAlign:"middle"},em={color:"#404040"},B1={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},$1={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},j1={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"},F1='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+Qh+'</a><span>Web-based tooling for BPMN, DMN and forms powered by <a href="https://bpmn.io" target="_blank" rel="noopener">bpmn.io</a>.</span></div></div>',hi;function H1(){hi=ct(F1),fn(hi,B1),fn(tt("svg",hi),Jh),fn(tt(".backdrop",hi),$1),fn(tt(".notice",hi),j1),fn(tt(".link",hi),em,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function z1(){hi||(H1(),Sn.bind(hi,".backdrop","click",function(e){document.body.removeChild(hi)})),document.body.appendChild(hi)}const As=5,tm="djs-outline-hidden";function gt(e){e=O({},G1,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),U1(this._container)}ie(gt,tr),gt.prototype.importXML=async function(t,n){const i=this;function r(a){return i.get("eventBus").createEvent(a)}let o=[];try{t=this._emit("import.parse.start",{xml:t})||t;let a;try{a=await this._moddle.fromXML(t,"bpmn:Definitions")}catch(f){throw this._emit("import.parse.complete",{error:f}),f}let s=a.rootElement;const c=a.references,u=a.warnings,l=a.elementsById;o=o.concat(u),s=this._emit("import.parse.complete",r({error:null,definitions:s,elementsById:l,references:c,warnings:o}))||s;const p=await this.importDefinitions(s,n);return o=o.concat(p.warnings),this._emit("import.done",{error:null,warnings:o}),{warnings:o}}catch(a){let s=a;throw o=o.concat(s.warnings||[]),Ts(s,o),s=V1(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},gt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},gt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw Ts(o,[]),o}if(typeof t=="string"&&(i=W1(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw Ts(o,[]),o}try{this.clear()}catch(o){throw Ts(o,[]),o}const{warnings:r}=await O1(this,n,i);return{warnings:r}},gt.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},gt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=tt(":scope > defs",i._svg),a=_h(r),s=o?"<defs>"+_h(o)+"</defs>":"",c=i.getContainer();dt(c).add(tm);let u;try{u=r.getBBox()}finally{dt(c).remove(tm)}const l=u.x-As,p=u.y-As,f=u.width+As*2,d=u.height+As*2;t=`<?xml version="1.0" encoding="utf-8"?>
|
|
4
|
+
nested error: `+E.message;if(L)return a.addWarning({message:V,error:E}),!0;throw Yi(V)}function l(E,T){return u(E,T,!0)}function p(){var E=a.elementsById,T=a.references,L,A;for(L=0;A=T[L];L++){var F=A.element,H=E[A.id],N=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 V=F.get(N.name),pe=V.indexOf(A);pe===-1&&(pe=V.length),H?V[pe]=H:V.splice(pe,1)}else F.set(N.name,H)}}function f(){s.pop().handleEnd()}var d=/^<\?xml /i,h=/ encoding="([^"]+)"/i,m=/^utf-8$/i;function g(E){if(d.test(E)){var T=h.exec(E),L=T&&T[1];!L||m.test(L)||a.addWarning({message:"unsupported document encoding <"+L+">, falling back to UTF-8"})}}function R(E,T){var L=s.peek();try{s.push(L.handleNode(E))}catch(A){u(A,T,o)&&s.push(new Du)}}function w(E,T){try{s.peek().handleText(E)}catch(L){l(L,T)}}function x(E,T){E.trim()&&w(E,T)}var b=r.getPackages().reduce(function(E,T){return E[T.uri]=T.prefix,E},Object.entries(ku).reduce(function(E,[T,L]){return E[L]=T,E},r.config&&r.config.nsMap||{}));return c.ns(b).on("openTag",function(E,T,L,A){var F=E.attrs||{},H=Object.keys(F).reduce(function(V,pe){var je=T(F[pe]);return V[pe]=je,V},{}),N={name:E.name,originalName:E.originalName,attributes:H,ns:E.ns};R(N,A)}).on("question",g).on("closeTag",f).on("cdata",w).on("text",function(E,T,L){x(T(E),L)}).on("error",u).on("warn",l),new Promise(function(E,T){var L;try{c.parse(e),p()}catch(V){L=V}var A=i.element;!L&&!A&&(L=Yi("failed to parse document as <"+i.type.$descriptor.name+">"));var F=a.warnings,H=a.references,N=a.elementsById;return L?(L.warnings=F,T(L)):E({rootElement:A,elementsById:N,references:H,warnings:F})})},Iu.prototype.handler=function(e){return new Lu(this.model,e)};function u0(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var l0=`<?xml version="1.0" encoding="UTF-8"?>
|
|
5
|
+
`,p0=/<|>|'|"|&|\n\r|\n/g,rd=/<|>|&/g;function ci(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}ci.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},ci.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},ci.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},ci.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)},ci.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},ci.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},ci.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},ci.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},ci.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 f0(e){return e.charAt(0).toLowerCase()+e.slice(1)}function d0(e,t){return ed(t)?f0(e):e}function od(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function ad(e){return xn(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function h0(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 m0(e,t){return t.isGeneric?O({localName:t.ns.localName},e):O({localName:d0(t.ns.localName,t.$pkg)},e)}function g0(e,t){return O({localName:t.ns.localName},e)}function y0(e){var t=e.$descriptor;return Le(t.properties,function(n){var i=n.name;if(n.isVirtual||!wn(e,i))return!1;var r=e[i];return r===n.default||r===null?!1:n.isMany?r.length:!0})}var v0={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},_0={"<":"lt",">":"gt","&":"amp"};function sd(e,t,n){return e=xn(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function b0(e){return sd(e,p0,v0)}function x0(e){return sd(e,rd,_0)}function w0(e){return Le(e,function(t){return t.isAttr})}function E0(e){return Le(e,function(t){return!t.isAttr})}function Nu(e){this.tagName=e}Nu.prototype.build=function(e){return this.element=e,this},Nu.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function Mr(){}Mr.prototype.serializeValue=Mr.prototype.serializeTo=function(e){e.append(this.escape?x0(this.value):this.value)},Mr.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(rd)!==-1&&(this.escape=!0),this};function Bu(e){this.tagName=e}od(Bu,Mr),Bu.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function ft(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}ft.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=y0(e),this.parseAttributes(w0(r)),this.parseContainments(E0(r))),this.parseGenericAttributes(e,i),this},ft.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return m0(t,e)},ft.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return g0(t,e)},ft.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},ft.prototype.nsAttributeName=function(e){var t;if(xn(e)?t=on(e):t=e.ns,e.inherited)return{localName:t.localName};var n=this.logNamespaceUsed(t);return this.getNamespaces().logUsed(n),this.isLocalNs(n)?{localName:t.localName}:O({localName:t.localName},n)},ft.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}))},ft.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new Mr().build({type:"String"},t));var n=e.$children;n&&M(n,i=>{this.body.push(new ft(this).build(i))})},ft.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)}},ft.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},ft.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)}})},ft.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;M(e,function(r){var o=i.get(r.name),a=r.isReference,c=r.isMany;if(c||(o=[o]),r.isBody)n.push(new Mr().build(r,o[0]));else if(Yf(r.type))M(o,function(u){n.push(new Bu(t.addTagName(t.nsPropertyTagName(r))).build(r,u))});else if(a)M(o,function(u){n.push(new Nu(t.addTagName(t.nsPropertyTagName(r))).build(u))});else{var s=nd(r);M(o,function(u){var l;s?s===td?l=new ft(t,r):l=new es(t,r,s):l=new ft(t),n.push(l.build(u))})}})},ft.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new ci(i):t=i),t},ft.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},ft.prototype.logNamespaceUsed=function(e,t){var n=this.getNamespaces(t),i=e.prefix,r=e.uri,o,a,c;if(!i&&!r)return{localName:e.localName};if(c=n.defaultUriByPrefix(i),r=r||c||n.uriByPrefix(i),!r)throw new Error("no namespace uri given for prefix <"+i+">");if(e=n.byUri(r),!e&&!i&&(e=this.logNamespace({uri:r},c===r,!0)),!e){for(o=i,a=1;n.uriByPrefix(o);)o=i+"_"+a++;e=this.logNamespace({prefix:o,uri:r},c===r)}return i&&n.mapPrefix(i,r),e},ft.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)})},ft.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),ad(e)},ft.prototype.addAttribute=function(e,t){var n=this.attrs;xn(t)&&(t=b0(t));var i=Vf(n,function(o){return o.name.localName===e.localName&&o.name.uri===e.uri&&o.name.prefix===e.prefix}),r={name:e,value:t};i!==-1?n.splice(i,1,r):n.push(r)},ft.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=h0(n).concat(t)),M(t,function(i){e.append(" ").append(ad(i.name)).append('="').append(i.value).append('"')})},ft.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==Mr;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),M(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function es(e,t,n){ft.call(this,e,t),this.serialization=n}od(es,ft),es.prototype.parseNsAttributes=function(e){var t=ft.prototype.parseNsAttributes.call(this,e).filter(a=>a.name!==this.serialization),n=e.$descriptor;if(n.name===this.propertyDescriptor.type)return t;var i=this.typeNs=this.nsTagName(n);this.getNamespaces().logUsed(this.typeNs);var r=e.$model.getPackage(i.uri),o=r.xml&&r.xml.typePrefix||"";return this.addAttribute(this.nsAttributeName(this.serialization),(i.prefix?i.prefix+":":"")+o+n.ns.localName),t},es.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function S0(){this.value="",this.write=function(e){this.value+=e}}function R0(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 C0(e){e=O({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new S0,o=new R0(r,e.format);e.preamble&&o.append(l0);var a=new ft,c=n.$model;if(a.getNamespaces().mapDefaultPrefixes(P0(c)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function P0(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in ku)n[i]=ku[i];for(const i in t){const r=t[i];n[r]=i}for(const i of e.getPackages())n[i.prefix]=i.uri;return n}function ts(e,t){jn.call(this,e,t)}ts.prototype=Object.create(jn.prototype),ts.prototype.fromXML=function(e,t,n){xn(t)||(n=t,t="bpmn:Definitions");var i=new Iu(O({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},ts.prototype.toXML=function(e,t){var n=new C0(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var A0="BPMN20",T0="http://www.omg.org/spec/BPMN/20100524/MODEL",M0="bpmn",k0=[],D0=[{name:"Interface",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"operations",type:"Operation",isMany:!0},{name:"implementationRef",isAttr:!0,type:"String"}]},{name:"Operation",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"inMessageRef",type:"Message",isReference:!0},{name:"outMessageRef",type:"Message",isReference:!0},{name:"errorRef",type:"Error",isMany:!0,isReference:!0},{name:"implementationRef",isAttr:!0,type:"String"}]},{name:"EndPoint",superClass:["RootElement"]},{name:"Auditing",superClass:["BaseElement"]},{name:"GlobalTask",superClass:["CallableElement"],properties:[{name:"resources",type:"ResourceRole",isMany:!0}]},{name:"Monitoring",superClass:["BaseElement"]},{name:"Performer",superClass:["ResourceRole"]},{name:"Process",superClass:["FlowElementsContainer","CallableElement"],properties:[{name:"processType",type:"ProcessType",isAttr:!0},{name:"isClosed",isAttr:!0,type:"Boolean"},{name:"auditing",type:"Auditing"},{name:"monitoring",type:"Monitoring"},{name:"properties",type:"Property",isMany:!0},{name:"laneSets",isMany:!0,replaces:"FlowElementsContainer#laneSets",type:"LaneSet"},{name:"flowElements",isMany:!0,replaces:"FlowElementsContainer#flowElements",type:"FlowElement"},{name:"artifacts",type:"Artifact",isMany:!0},{name:"resources",type:"ResourceRole",isMany:!0},{name:"correlationSubscriptions",type:"CorrelationSubscription",isMany:!0},{name:"supports",type:"Process",isMany:!0,isReference:!0},{name:"definitionalCollaborationRef",type:"Collaboration",isAttr:!0,isReference:!0},{name:"isExecutable",isAttr:!0,type:"Boolean"}]},{name:"LaneSet",superClass:["BaseElement"],properties:[{name:"lanes",type:"Lane",isMany:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Lane",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"partitionElementRef",type:"BaseElement",isAttr:!0,isReference:!0},{name:"partitionElement",type:"BaseElement"},{name:"flowNodeRef",type:"FlowNode",isMany:!0,isReference:!0},{name:"childLaneSet",type:"LaneSet",xml:{serialize:"xsi:type"}}]},{name:"GlobalManualTask",superClass:["GlobalTask"]},{name:"ManualTask",superClass:["Task"]},{name:"UserTask",superClass:["Task"],properties:[{name:"renderings",type:"Rendering",isMany:!0},{name:"implementation",isAttr:!0,type:"String"}]},{name:"Rendering",superClass:["BaseElement"]},{name:"HumanPerformer",superClass:["Performer"]},{name:"PotentialOwner",superClass:["HumanPerformer"]},{name:"GlobalUserTask",superClass:["GlobalTask"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"renderings",type:"Rendering",isMany:!0}]},{name:"Gateway",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"gatewayDirection",type:"GatewayDirection",default:"Unspecified",isAttr:!0}]},{name:"EventBasedGateway",superClass:["Gateway"],properties:[{name:"instantiate",default:!1,isAttr:!0,type:"Boolean"},{name:"eventGatewayType",type:"EventBasedGatewayType",isAttr:!0,default:"Exclusive"}]},{name:"ComplexGateway",superClass:["Gateway"],properties:[{name:"activationCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"ExclusiveGateway",superClass:["Gateway"],properties:[{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"InclusiveGateway",superClass:["Gateway"],properties:[{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"ParallelGateway",superClass:["Gateway"]},{name:"RootElement",isAbstract:!0,superClass:["BaseElement"]},{name:"Relationship",superClass:["BaseElement"],properties:[{name:"type",isAttr:!0,type:"String"},{name:"direction",type:"RelationshipDirection",isAttr:!0},{name:"source",isMany:!0,isReference:!0,type:"Element"},{name:"target",isMany:!0,isReference:!0,type:"Element"}]},{name:"BaseElement",isAbstract:!0,properties:[{name:"id",isAttr:!0,type:"String",isId:!0},{name:"documentation",type:"Documentation",isMany:!0},{name:"extensionDefinitions",type:"ExtensionDefinition",isMany:!0,isReference:!0},{name:"extensionElements",type:"ExtensionElements"}]},{name:"Extension",properties:[{name:"mustUnderstand",default:!1,isAttr:!0,type:"Boolean"},{name:"definition",type:"ExtensionDefinition",isAttr:!0,isReference:!0}]},{name:"ExtensionDefinition",properties:[{name:"name",isAttr:!0,type:"String"},{name:"extensionAttributeDefinitions",type:"ExtensionAttributeDefinition",isMany:!0}]},{name:"ExtensionAttributeDefinition",properties:[{name:"name",isAttr:!0,type:"String"},{name:"type",isAttr:!0,type:"String"},{name:"isReference",default:!1,isAttr:!0,type:"Boolean"},{name:"extensionDefinition",type:"ExtensionDefinition",isAttr:!0,isReference:!0}]},{name:"ExtensionElements",properties:[{name:"valueRef",isAttr:!0,isReference:!0,type:"Element"},{name:"values",type:"Element",isMany:!0},{name:"extensionAttributeDefinition",type:"ExtensionAttributeDefinition",isAttr:!0,isReference:!0}]},{name:"Documentation",superClass:["BaseElement"],properties:[{name:"text",type:"String",isBody:!0},{name:"textFormat",default:"text/plain",isAttr:!0,type:"String"}]},{name:"Event",isAbstract:!0,superClass:["FlowNode","InteractionNode"],properties:[{name:"properties",type:"Property",isMany:!0}]},{name:"IntermediateCatchEvent",superClass:["CatchEvent"]},{name:"IntermediateThrowEvent",superClass:["ThrowEvent"]},{name:"EndEvent",superClass:["ThrowEvent"]},{name:"StartEvent",superClass:["CatchEvent"],properties:[{name:"isInterrupting",default:!0,isAttr:!0,type:"Boolean"}]},{name:"ThrowEvent",isAbstract:!0,superClass:["Event"],properties:[{name:"dataInputs",type:"DataInput",isMany:!0},{name:"dataInputAssociations",type:"DataInputAssociation",isMany:!0},{name:"inputSet",type:"InputSet"},{name:"eventDefinitions",type:"EventDefinition",isMany:!0},{name:"eventDefinitionRef",type:"EventDefinition",isMany:!0,isReference:!0}]},{name:"CatchEvent",isAbstract:!0,superClass:["Event"],properties:[{name:"parallelMultiple",isAttr:!0,type:"Boolean",default:!1},{name:"dataOutputs",type:"DataOutput",isMany:!0},{name:"dataOutputAssociations",type:"DataOutputAssociation",isMany:!0},{name:"outputSet",type:"OutputSet"},{name:"eventDefinitions",type:"EventDefinition",isMany:!0},{name:"eventDefinitionRef",type:"EventDefinition",isMany:!0,isReference:!0}]},{name:"BoundaryEvent",superClass:["CatchEvent"],properties:[{name:"cancelActivity",default:!0,isAttr:!0,type:"Boolean"},{name:"attachedToRef",type:"Activity",isAttr:!0,isReference:!0}]},{name:"EventDefinition",isAbstract:!0,superClass:["RootElement"]},{name:"CancelEventDefinition",superClass:["EventDefinition"]},{name:"ErrorEventDefinition",superClass:["EventDefinition"],properties:[{name:"errorRef",type:"Error",isAttr:!0,isReference:!0}]},{name:"TerminateEventDefinition",superClass:["EventDefinition"]},{name:"EscalationEventDefinition",superClass:["EventDefinition"],properties:[{name:"escalationRef",type:"Escalation",isAttr:!0,isReference:!0}]},{name:"Escalation",properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"escalationCode",isAttr:!0,type:"String"}],superClass:["RootElement"]},{name:"CompensateEventDefinition",superClass:["EventDefinition"],properties:[{name:"waitForCompletion",isAttr:!0,type:"Boolean",default:!0},{name:"activityRef",type:"Activity",isAttr:!0,isReference:!0}]},{name:"TimerEventDefinition",superClass:["EventDefinition"],properties:[{name:"timeDate",type:"Expression",xml:{serialize:"xsi:type"}},{name:"timeCycle",type:"Expression",xml:{serialize:"xsi:type"}},{name:"timeDuration",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"LinkEventDefinition",superClass:["EventDefinition"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"target",type:"LinkEventDefinition",isReference:!0},{name:"source",type:"LinkEventDefinition",isMany:!0,isReference:!0}]},{name:"MessageEventDefinition",superClass:["EventDefinition"],properties:[{name:"messageRef",type:"Message",isAttr:!0,isReference:!0},{name:"operationRef",type:"Operation",isReference:!0}]},{name:"ConditionalEventDefinition",superClass:["EventDefinition"],properties:[{name:"condition",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"SignalEventDefinition",superClass:["EventDefinition"],properties:[{name:"signalRef",type:"Signal",isAttr:!0,isReference:!0}]},{name:"Signal",superClass:["RootElement"],properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"ImplicitThrowEvent",superClass:["ThrowEvent"]},{name:"DataState",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"}]},{name:"ItemAwareElement",superClass:["BaseElement"],properties:[{name:"itemSubjectRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"dataState",type:"DataState"}]},{name:"DataAssociation",superClass:["BaseElement"],properties:[{name:"sourceRef",type:"ItemAwareElement",isMany:!0,isReference:!0},{name:"targetRef",type:"ItemAwareElement",isReference:!0},{name:"transformation",type:"FormalExpression",xml:{serialize:"property"}},{name:"assignment",type:"Assignment",isMany:!0}]},{name:"DataInput",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"inputSetRef",type:"InputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"inputSetWithOptional",type:"InputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"inputSetWithWhileExecuting",type:"InputSet",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"DataOutput",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"outputSetRef",type:"OutputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"outputSetWithOptional",type:"OutputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"outputSetWithWhileExecuting",type:"OutputSet",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"InputSet",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"dataInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"optionalInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"whileExecutingInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"outputSetRefs",type:"OutputSet",isMany:!0,isReference:!0}]},{name:"OutputSet",superClass:["BaseElement"],properties:[{name:"dataOutputRefs",type:"DataOutput",isMany:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"inputSetRefs",type:"InputSet",isMany:!0,isReference:!0},{name:"optionalOutputRefs",type:"DataOutput",isMany:!0,isReference:!0},{name:"whileExecutingOutputRefs",type:"DataOutput",isMany:!0,isReference:!0}]},{name:"Property",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"}]},{name:"DataInputAssociation",superClass:["DataAssociation"]},{name:"DataOutputAssociation",superClass:["DataAssociation"]},{name:"InputOutputSpecification",superClass:["BaseElement"],properties:[{name:"dataInputs",type:"DataInput",isMany:!0},{name:"dataOutputs",type:"DataOutput",isMany:!0},{name:"inputSets",type:"InputSet",isMany:!0},{name:"outputSets",type:"OutputSet",isMany:!0}]},{name:"DataObject",superClass:["FlowElement","ItemAwareElement"],properties:[{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"}]},{name:"InputOutputBinding",properties:[{name:"inputDataRef",type:"InputSet",isAttr:!0,isReference:!0},{name:"outputDataRef",type:"OutputSet",isAttr:!0,isReference:!0},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"Assignment",superClass:["BaseElement"],properties:[{name:"from",type:"Expression",xml:{serialize:"xsi:type"}},{name:"to",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"DataStore",superClass:["RootElement","ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"capacity",isAttr:!0,type:"Integer"},{name:"isUnlimited",default:!0,isAttr:!0,type:"Boolean"}]},{name:"DataStoreReference",superClass:["ItemAwareElement","FlowElement"],properties:[{name:"dataStoreRef",type:"DataStore",isAttr:!0,isReference:!0}]},{name:"DataObjectReference",superClass:["ItemAwareElement","FlowElement"],properties:[{name:"dataObjectRef",type:"DataObject",isAttr:!0,isReference:!0}]},{name:"ConversationLink",superClass:["BaseElement"],properties:[{name:"sourceRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"ConversationAssociation",superClass:["BaseElement"],properties:[{name:"innerConversationNodeRef",type:"ConversationNode",isAttr:!0,isReference:!0},{name:"outerConversationNodeRef",type:"ConversationNode",isAttr:!0,isReference:!0}]},{name:"CallConversation",superClass:["ConversationNode"],properties:[{name:"calledCollaborationRef",type:"Collaboration",isAttr:!0,isReference:!0},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0}]},{name:"Conversation",superClass:["ConversationNode"]},{name:"SubConversation",superClass:["ConversationNode"],properties:[{name:"conversationNodes",type:"ConversationNode",isMany:!0}]},{name:"ConversationNode",isAbstract:!0,superClass:["InteractionNode","BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0},{name:"messageFlowRefs",type:"MessageFlow",isMany:!0,isReference:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0}]},{name:"GlobalConversation",superClass:["Collaboration"]},{name:"PartnerEntity",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0}]},{name:"PartnerRole",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0}]},{name:"CorrelationProperty",superClass:["RootElement"],properties:[{name:"correlationPropertyRetrievalExpression",type:"CorrelationPropertyRetrievalExpression",isMany:!0},{name:"name",isAttr:!0,type:"String"},{name:"type",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"Error",superClass:["RootElement"],properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"errorCode",isAttr:!0,type:"String"}]},{name:"CorrelationKey",superClass:["BaseElement"],properties:[{name:"correlationPropertyRef",type:"CorrelationProperty",isMany:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Expression",superClass:["BaseElement"],isAbstract:!1,properties:[{name:"body",isBody:!0,type:"String"}]},{name:"FormalExpression",superClass:["Expression"],properties:[{name:"language",isAttr:!0,type:"String"},{name:"evaluatesToTypeRef",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"Message",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"itemRef",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"ItemDefinition",superClass:["RootElement"],properties:[{name:"itemKind",type:"ItemKind",isAttr:!0},{name:"structureRef",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"import",type:"Import",isAttr:!0,isReference:!0}]},{name:"FlowElement",isAbstract:!0,superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"auditing",type:"Auditing"},{name:"monitoring",type:"Monitoring"},{name:"categoryValueRef",type:"CategoryValue",isMany:!0,isReference:!0}]},{name:"SequenceFlow",superClass:["FlowElement"],properties:[{name:"isImmediate",isAttr:!0,type:"Boolean"},{name:"conditionExpression",type:"Expression",xml:{serialize:"xsi:type"}},{name:"sourceRef",type:"FlowNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"FlowNode",isAttr:!0,isReference:!0}]},{name:"FlowElementsContainer",isAbstract:!0,superClass:["BaseElement"],properties:[{name:"laneSets",type:"LaneSet",isMany:!0},{name:"flowElements",type:"FlowElement",isMany:!0}]},{name:"CallableElement",isAbstract:!0,superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"ioSpecification",type:"InputOutputSpecification",xml:{serialize:"property"}},{name:"supportedInterfaceRef",type:"Interface",isMany:!0,isReference:!0},{name:"ioBinding",type:"InputOutputBinding",isMany:!0,xml:{serialize:"property"}}]},{name:"FlowNode",isAbstract:!0,superClass:["FlowElement"],properties:[{name:"incoming",type:"SequenceFlow",isMany:!0,isReference:!0},{name:"outgoing",type:"SequenceFlow",isMany:!0,isReference:!0},{name:"lanes",type:"Lane",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"CorrelationPropertyRetrievalExpression",superClass:["BaseElement"],properties:[{name:"messagePath",type:"FormalExpression"},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"CorrelationPropertyBinding",superClass:["BaseElement"],properties:[{name:"dataPath",type:"FormalExpression"},{name:"correlationPropertyRef",type:"CorrelationProperty",isAttr:!0,isReference:!0}]},{name:"Resource",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"resourceParameters",type:"ResourceParameter",isMany:!0}]},{name:"ResourceParameter",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isRequired",isAttr:!0,type:"Boolean"},{name:"type",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"CorrelationSubscription",superClass:["BaseElement"],properties:[{name:"correlationKeyRef",type:"CorrelationKey",isAttr:!0,isReference:!0},{name:"correlationPropertyBinding",type:"CorrelationPropertyBinding",isMany:!0}]},{name:"MessageFlow",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"sourceRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"MessageFlowAssociation",superClass:["BaseElement"],properties:[{name:"innerMessageFlowRef",type:"MessageFlow",isAttr:!0,isReference:!0},{name:"outerMessageFlowRef",type:"MessageFlow",isAttr:!0,isReference:!0}]},{name:"InteractionNode",isAbstract:!0,properties:[{name:"incomingConversationLinks",type:"ConversationLink",isMany:!0,isVirtual:!0,isReference:!0},{name:"outgoingConversationLinks",type:"ConversationLink",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"Participant",superClass:["InteractionNode","BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"interfaceRef",type:"Interface",isMany:!0,isReference:!0},{name:"participantMultiplicity",type:"ParticipantMultiplicity"},{name:"endPointRefs",type:"EndPoint",isMany:!0,isReference:!0},{name:"processRef",type:"Process",isAttr:!0,isReference:!0}]},{name:"ParticipantAssociation",superClass:["BaseElement"],properties:[{name:"innerParticipantRef",type:"Participant",isAttr:!0,isReference:!0},{name:"outerParticipantRef",type:"Participant",isAttr:!0,isReference:!0}]},{name:"ParticipantMultiplicity",properties:[{name:"minimum",default:0,isAttr:!0,type:"Integer"},{name:"maximum",default:1,isAttr:!0,type:"Integer"}],superClass:["BaseElement"]},{name:"Collaboration",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isClosed",isAttr:!0,type:"Boolean"},{name:"participants",type:"Participant",isMany:!0},{name:"messageFlows",type:"MessageFlow",isMany:!0},{name:"artifacts",type:"Artifact",isMany:!0},{name:"conversations",type:"ConversationNode",isMany:!0},{name:"conversationAssociations",type:"ConversationAssociation"},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0},{name:"messageFlowAssociations",type:"MessageFlowAssociation",isMany:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0},{name:"choreographyRef",type:"Choreography",isMany:!0,isReference:!0},{name:"conversationLinks",type:"ConversationLink",isMany:!0}]},{name:"ChoreographyActivity",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"participantRef",type:"Participant",isMany:!0,isReference:!0},{name:"initiatingParticipantRef",type:"Participant",isAttr:!0,isReference:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0},{name:"loopType",type:"ChoreographyLoopType",default:"None",isAttr:!0}]},{name:"CallChoreography",superClass:["ChoreographyActivity"],properties:[{name:"calledChoreographyRef",type:"Choreography",isAttr:!0,isReference:!0},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0}]},{name:"SubChoreography",superClass:["ChoreographyActivity","FlowElementsContainer"],properties:[{name:"artifacts",type:"Artifact",isMany:!0}]},{name:"ChoreographyTask",superClass:["ChoreographyActivity"],properties:[{name:"messageFlowRef",type:"MessageFlow",isMany:!0,isReference:!0}]},{name:"Choreography",superClass:["Collaboration","FlowElementsContainer"]},{name:"GlobalChoreographyTask",superClass:["Choreography"],properties:[{name:"initiatingParticipantRef",type:"Participant",isAttr:!0,isReference:!0}]},{name:"TextAnnotation",superClass:["Artifact"],properties:[{name:"text",type:"String"},{name:"textFormat",default:"text/plain",isAttr:!0,type:"String"}]},{name:"Group",superClass:["Artifact"],properties:[{name:"categoryValueRef",type:"CategoryValue",isAttr:!0,isReference:!0}]},{name:"Association",superClass:["Artifact"],properties:[{name:"associationDirection",type:"AssociationDirection",isAttr:!0},{name:"sourceRef",type:"BaseElement",isAttr:!0,isReference:!0},{name:"targetRef",type:"BaseElement",isAttr:!0,isReference:!0}]},{name:"Category",superClass:["RootElement"],properties:[{name:"categoryValue",type:"CategoryValue",isMany:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Artifact",isAbstract:!0,superClass:["BaseElement"]},{name:"CategoryValue",superClass:["BaseElement"],properties:[{name:"categorizedFlowElements",type:"FlowElement",isMany:!0,isVirtual:!0,isReference:!0},{name:"value",isAttr:!0,type:"String"}]},{name:"Activity",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"isForCompensation",default:!1,isAttr:!0,type:"Boolean"},{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0},{name:"ioSpecification",type:"InputOutputSpecification",xml:{serialize:"property"}},{name:"boundaryEventRefs",type:"BoundaryEvent",isMany:!0,isReference:!0},{name:"properties",type:"Property",isMany:!0},{name:"dataInputAssociations",type:"DataInputAssociation",isMany:!0},{name:"dataOutputAssociations",type:"DataOutputAssociation",isMany:!0},{name:"startQuantity",default:1,isAttr:!0,type:"Integer"},{name:"resources",type:"ResourceRole",isMany:!0},{name:"completionQuantity",default:1,isAttr:!0,type:"Integer"},{name:"loopCharacteristics",type:"LoopCharacteristics"}]},{name:"ServiceTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"SubProcess",superClass:["Activity","FlowElementsContainer","InteractionNode"],properties:[{name:"triggeredByEvent",default:!1,isAttr:!0,type:"Boolean"},{name:"artifacts",type:"Artifact",isMany:!0}]},{name:"LoopCharacteristics",isAbstract:!0,superClass:["BaseElement"]},{name:"MultiInstanceLoopCharacteristics",superClass:["LoopCharacteristics"],properties:[{name:"isSequential",default:!1,isAttr:!0,type:"Boolean"},{name:"behavior",type:"MultiInstanceBehavior",default:"All",isAttr:!0},{name:"loopCardinality",type:"Expression",xml:{serialize:"xsi:type"}},{name:"loopDataInputRef",type:"ItemAwareElement",isReference:!0},{name:"loopDataOutputRef",type:"ItemAwareElement",isReference:!0},{name:"inputDataItem",type:"DataInput",xml:{serialize:"property"}},{name:"outputDataItem",type:"DataOutput",xml:{serialize:"property"}},{name:"complexBehaviorDefinition",type:"ComplexBehaviorDefinition",isMany:!0},{name:"completionCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"oneBehaviorEventRef",type:"EventDefinition",isAttr:!0,isReference:!0},{name:"noneBehaviorEventRef",type:"EventDefinition",isAttr:!0,isReference:!0}]},{name:"StandardLoopCharacteristics",superClass:["LoopCharacteristics"],properties:[{name:"testBefore",default:!1,isAttr:!0,type:"Boolean"},{name:"loopCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"loopMaximum",type:"Integer",isAttr:!0}]},{name:"CallActivity",superClass:["Activity","InteractionNode"],properties:[{name:"calledElement",type:"String",isAttr:!0}]},{name:"Task",superClass:["Activity","InteractionNode"]},{name:"SendTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"ReceiveTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"instantiate",default:!1,isAttr:!0,type:"Boolean"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"ScriptTask",superClass:["Task"],properties:[{name:"scriptFormat",isAttr:!0,type:"String"},{name:"script",type:"String"}]},{name:"BusinessRuleTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"}]},{name:"AdHocSubProcess",superClass:["SubProcess"],properties:[{name:"completionCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"ordering",type:"AdHocOrdering",isAttr:!0},{name:"cancelRemainingInstances",default:!0,isAttr:!0,type:"Boolean"}]},{name:"Transaction",superClass:["SubProcess"],properties:[{name:"protocol",isAttr:!0,type:"String"},{name:"method",isAttr:!0,type:"String"}]},{name:"GlobalScriptTask",superClass:["GlobalTask"],properties:[{name:"scriptLanguage",isAttr:!0,type:"String"},{name:"script",isAttr:!0,type:"String"}]},{name:"GlobalBusinessRuleTask",superClass:["GlobalTask"],properties:[{name:"implementation",isAttr:!0,type:"String"}]},{name:"ComplexBehaviorDefinition",superClass:["BaseElement"],properties:[{name:"condition",type:"FormalExpression"},{name:"event",type:"ImplicitThrowEvent"}]},{name:"ResourceRole",superClass:["BaseElement"],properties:[{name:"resourceRef",type:"Resource",isReference:!0},{name:"resourceParameterBindings",type:"ResourceParameterBinding",isMany:!0},{name:"resourceAssignmentExpression",type:"ResourceAssignmentExpression"},{name:"name",isAttr:!0,type:"String"}]},{name:"ResourceParameterBinding",properties:[{name:"expression",type:"Expression",xml:{serialize:"xsi:type"}},{name:"parameterRef",type:"ResourceParameter",isAttr:!0,isReference:!0}],superClass:["BaseElement"]},{name:"ResourceAssignmentExpression",properties:[{name:"expression",type:"Expression",xml:{serialize:"xsi:type"}}],superClass:["BaseElement"]},{name:"Import",properties:[{name:"importType",isAttr:!0,type:"String"},{name:"location",isAttr:!0,type:"String"},{name:"namespace",isAttr:!0,type:"String"}]},{name:"Definitions",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"targetNamespace",isAttr:!0,type:"String"},{name:"expressionLanguage",default:"http://www.w3.org/1999/XPath",isAttr:!0,type:"String"},{name:"typeLanguage",default:"http://www.w3.org/2001/XMLSchema",isAttr:!0,type:"String"},{name:"imports",type:"Import",isMany:!0},{name:"extensions",type:"Extension",isMany:!0},{name:"rootElements",type:"RootElement",isMany:!0},{name:"diagrams",isMany:!0,type:"bpmndi:BPMNDiagram"},{name:"exporter",isAttr:!0,type:"String"},{name:"relationships",type:"Relationship",isMany:!0},{name:"exporterVersion",isAttr:!0,type:"String"}]}],O0=[{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"}]}],L0={tagAlias:"lowerCase",typePrefix:"t"},I0={name:A0,uri:T0,prefix:M0,associations:k0,types:D0,enumerations:O0,xml:L0},N0="BPMNDI",B0="http://www.omg.org/spec/BPMN/20100524/DI",$0="bpmndi",j0=[{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"]}],F0=[{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"}]}],H0=[],z0={name:N0,uri:B0,prefix:$0,types:j0,enumerations:F0,associations:H0},V0="DC",G0="http://www.omg.org/spec/DD/20100524/DC",W0="dc",U0=[{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}]}],Y0=[],q0={name:V0,uri:G0,prefix:W0,types:U0,associations:Y0},K0="DI",X0="http://www.omg.org/spec/DD/20100524/DI",Z0="di",Q0=[{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"}]}],J0=[],ew={tagAlias:"lowerCase"},tw={name:K0,uri:X0,prefix:Z0,types:Q0,associations:J0,xml:ew},nw="bpmn.io colors for BPMN",iw="http://bpmn.io/schema/bpmn/biocolor/1.0",rw="bioc",ow=[{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"}]}],aw=[],sw=[],cw={name:nw,uri:iw,prefix:rw,types:ow,enumerations:aw,associations:sw},uw="BPMN in Color",lw="http://www.omg.org/spec/BPMN/non-normative/color/1.0",pw="color",fw=[{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"}]}],dw=[],hw=[],mw={name:uw,uri:lw,prefix:pw,types:fw,enumerations:dw,associations:hw};const gw={bpmn:I0,bpmndi:z0,dc:q0,di:tw,bioc:cw,color:mw};function cd(e,t){const n=O({},gw,e);return new ts(n,t)}const yw={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"}},vw="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",ud="i18n",ns={[ud]:yw,[bu]:$f};function ld(){return cd(ns)}const pd=ld();async function $u(e){const{rootElement:t,warnings:n}=await pd.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function _w(e){const{xml:t}=await pd.toXML(e,{format:!0});return t}function ju(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const is=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),bw=1,xw=2;function qi(e){switch(e.kind){case"label-over-line":return`L|${e.edge}|${e.line}`;case"edge-crosses-shape":return`x|${e.edge}|${e.shape}`;case"shape-overlap":return`o|${e.shapes[0]}|${e.shapes[1]}`;case"shape-outside-container":return`c|${e.shape}|${e.container}`;case"edge-overlap-opposite":return`p|${e.edges[0]}|${e.edges[1]}`;case"edge-overlap-mixed":return`m|${e.edges[0]}|${e.edges[1]}`;case"label-on-shared-segment":return`l|${e.edge}|${e.other}`;case"annotation-over-label":return`a|${e.annotation}|${e.label}`;case"group-overlap-unintended":return`g|${e.groups[0]}|${e.groups[1]}`;case"group-on-container-boundary":return`gb|${e.group}|${e.container}|${e.side}`}}const fd=20,dd=5,ww=3,hd=1;function pn(e){const t=[];for(let n=0;n+1<e.waypoints.length;n++){const i=e.waypoints[n],r=e.waypoints[n+1];Math.abs(i.y-r.y)<.5&&Math.abs(i.x-r.x)>=.5?t.push({axis:"h",at:i.y,lo:Math.min(i.x,r.x),hi:Math.max(i.x,r.x),dir:r.x>i.x?1:-1}):Math.abs(i.x-r.x)<.5&&Math.abs(i.y-r.y)>=.5&&t.push({axis:"v",at:i.x,lo:Math.min(i.y,r.y),hi:Math.max(i.y,r.y),dir:r.y>i.y?1:-1})}return t}function rs(e,t){let n=null;const i=e.type!==t.type;for(const r of pn(e))for(const o of pn(t)){if(r.axis!==o.axis||Math.abs(r.at-o.at)>hd)continue;const a=r.dir!==o.dir?"opposite":i?"mixed":null;if(!a)continue;const c=Math.min(r.hi,o.hi)-Math.max(r.lo,o.lo);c>=fd&&(!n||c>n.length)&&(n={axis:r.axis,length:c,kind:a})}return n}function md(e,t){const n=rs(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function Ew(e,t){let n=0;for(const i of t)i.id!==e.id&&md(e,i)&&n++;return n}function kr(e,t){let n=0;for(const i of t)i.id!==e.id&&rs(e,i)&&n++;return n}const gd=15,yd=20;function Sw(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-yd||t.at>n[1]+yd)return null;const i=t.axis==="v"?[e.y,e.y+e.height]:[e.x,e.x+e.width],r=Math.max(i[0],t.lo),o=Math.min(i[1],t.hi);return o>r?[r,o]:null}const Fu=20;function os(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>hd)continue;const r=Math.max(e.lo,i.lo),o=Math.min(e.hi,i.hi);o-r<fd||n.push([r-Fu,o+Fu])}return n}function as(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of pn(e)){const o=Sw(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[c,s]of os(r,pn(a)))if(Math.min(s,o[1])>Math.max(c,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const Rw=1,Cw=(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 Pw(e,t,n,i){const r=n.x+i,o=n.y+i,a=n.x+n.width-i,c=n.y+n.height-i;if(a<=r||c<=o)return!1;const s=t.x-e.x,u=t.y-e.y;let l=0,p=1;const f=(d,h)=>{if(h===0)return d<=0;const m=d/h;if(h>0){if(m>p)return!1;m>l&&(l=m)}else{if(m<l)return!1;m<p&&(p=m)}return!0};return f(r-e.x,s)&&f(e.x-a,-s)&&f(o-e.y,u)&&f(e.y-c,-u)&&p>l}function vd(e,t,n){return e.x+n<t.x+t.width-n&&t.x+n<e.x+e.width-n&&e.y+n<t.y+t.height-n&&t.y+n<e.y+e.height-n}const Aw=(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 _d(e,t){const n=e.label;if(!n)return null;if(pn(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(pn(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 Fn(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(Pw(e.waypoints[o],e.waypoints[o+1],r,xw)){i.push(r);break}}return i}function Tw(e,t,n,i){const r=(u,l,p)=>(l.x-u.x)*(p.y-u.y)-(l.y-u.y)*(p.x-u.x),o=r(n,i,e),a=r(n,i,t),c=r(e,t,n),s=r(e,t,i);return o*a<0&&c*s<0}const bd=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function ss(e,t){let n=0;for(const i of t){if(i.id===e.id||bd(e,i))continue;let r=!1;for(let o=0;o+1<e.waypoints.length&&!r;o++)for(let a=0;a+1<i.waypoints.length&&!r;a++)Tw(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function Ci(e,t){let n=0;for(const i of t)i.id===e.id||bd(e,i)||ss(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function xd(e){let t=0;const n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)ss(n[i],[n[r]])>0&&(t+=n[i].type===n[r].type?2:1);return t}function Hu(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(ss(n[i],[n[r]])>0){const o=n[i].id,a=n[r].id;t.push(o<a?[o,a]:[a,o])}return t.sort((i,r)=>`${i[0]}|${i[1]}`.localeCompare(`${r[0]}|${r[1]}`))}function wd(e){var n;const t=(n=mt(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const r=mt(i);if((r==null?void 0:r.$type)!=="bwl:Members"||typeof r.refs!="string")continue;const o=r.refs.split(/\s+/).filter(Boolean);return o.length?o:void 0}}const Ed=e=>e?{members:e}:{},Pi=e=>e.shapes.filter(t=>!t.container);function Mw(e,t,n){if(e.type==="bpmn:TextAnnotation")for(const i of t.edges){if(!/Association$/.test(i.type)||!i.endpoints.includes(e.id))continue;const r=i.endpoints.find(a=>a!==e.id),o=r?n.get(r):void 0;if(o){if(o.container)return o.id;if(o.parent)return o.parent}}}function Sd(e,t){const n=e.label;if(!n)return null;for(const i of[...t.edges].sort((r,o)=>r.id.localeCompare(o.id)))if(pn(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 cs(e){const t=[];for(const n of e.shapes)n.label&&t.push({owner:n.id,rect:n.label});for(const n of e.edges)n.label&&t.push({owner:n.id,rect:n.label});return t}function Ki(e){const t=[],n=e.shapes.filter(s=>!s.container);for(const s of e.edges)for(const u of Fn(s,n))t.push({kind:"edge-crosses-shape",edge:s.id,shape:u.id});const i=n.filter(s=>!s.attached);for(let s=0;s<i.length;s++)for(let u=s+1;u<i.length;u++){const l=i[s],p=i[u];if(!vd(l,p,bw))continue;const f=l.id<p.id?[l.id,p.id]:[p.id,l.id];t.push({kind:"shape-overlap",shapes:f,identical:Aw(l,p)})}const r=e.shapes.filter(s=>s.type==="bpmn:Group"&&Array.isArray(s.members)&&s.members.length>0);for(let s=0;s<r.length;s++)for(let u=s+1;u<r.length;u++){const l=r[s],p=r[u],f=Math.min(l.x+l.width,p.x+p.width)-Math.max(l.x,p.x),d=Math.min(l.y+l.height,p.y+p.height)-Math.max(l.y,p.y);if(f<=dd||d<=dd)continue;const h=new Set(p.members);l.members.some(m=>h.has(m))||t.push({kind:"group-overlap-unintended",groups:l.id<p.id?[l.id,p.id]:[p.id,l.id]})}const o=e.shapes.filter(s=>s.container&&s.type!=="bpmn:Group"&&s.type!=="bpmn:Lane");for(const s of e.shapes.filter(u=>u.type==="bpmn:Group"))for(const u of o){const l=s.x<u.x+u.width&&u.x<s.x+s.width,p=s.y<u.y+u.height&&u.y<s.y+s.height,f=[["top",s.y,u.y,l],["bottom",s.y+s.height,u.y+u.height,l],["left",s.x,u.x,p],["right",s.x+s.width,u.x+u.width,p]];for(const[d,h,m,g]of f)g&&Math.abs(h-m)<=ww&&t.push({kind:"group-on-container-boundary",group:s.id,container:u.id,side:d})}for(let s=0;s<e.edges.length;s++)for(let u=s+1;u<e.edges.length;u++){const l=e.edges[s],p=e.edges[u],f=rs(l,p);if(!f)continue;const d=l.id<p.id?[l.id,p.id]:[p.id,l.id];t.push({kind:f.kind==="opposite"?"edge-overlap-opposite":"edge-overlap-mixed",edges:d,axis:f.axis,length:Math.round(f.length)})}for(const s of e.edges){if(!s.label)continue;const u=as(s,e.edges);u&&t.push({kind:"label-on-shared-segment",edge:s.id,other:u.other,axis:u.axis})}for(const s of e.edges){if(!s.label)continue;const u=_d(s,e);u&&t.push({kind:"label-over-line",edge:s.id,line:u})}for(const s of n){if(!s.label)continue;const u=Sd(s,e);u&&t.push({kind:"label-over-line",edge:s.id,line:u})}const a=cs(e);for(const s of n)if(s.type==="bpmn:TextAnnotation")for(const{owner:u,rect:l}of a)u!==s.id&&vd(s,l,Vo)&&t.push({kind:"annotation-over-label",annotation:s.id,label:u});const c=new Map(e.shapes.map(s=>[s.id,s]));for(const s of n){const u=s.parent??Mw(s,e,c);if(!u)continue;const l=c.get(u);!l||!l.container||Cw(l,s,Rw)||t.push({kind:"shape-outside-container",shape:s.id,container:l.id})}return t.sort((s,u)=>qi(s).localeCompare(qi(u)))}const mt=e=>typeof e=="object"&&e!==null?e:void 0,bt=e=>typeof e=="number"?e:0,Dr=e=>{const t=mt(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function kw(e){const t=mt(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=Dr(o);a&&n.push(a)}}return n}function Dw(e,t){const n=mt(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const r=Dr(n);return r?t.get(r):void 0}if(is.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return Dr(n)}function Rd(e){var o,a,c,s,u;const t=[],n=[],i=((o=mt(e))==null?void 0:o.diagrams)??[],r=new Map;for(const l of((a=mt(e))==null?void 0:a.rootElements)??[]){const p=mt(l);if((p==null?void 0:p.$type)==="bpmn:Collaboration")for(const f of p.participants??[]){const d=mt(f),h=Dr(d),m=Dr(d==null?void 0:d.processRef);h&&m&&r.set(m,h)}}for(const l of i){const p=mt((c=mt(l))==null?void 0:c.plane),f=(p==null?void 0:p.planeElement)??[];for(const d of f){const h=mt(d);if(!h)continue;const m=mt(h.bpmnElement),g=typeof(m==null?void 0:m.id)=="string"?m.id:void 0;if(!g)continue;const R=typeof(m==null?void 0:m.$type)=="string"?m.$type:"",w=mt(h.bounds);if(w){const b=h.isExpanded===!1,E=mt((s=mt(h.label))==null?void 0:s.bounds);t.push({id:g,type:R,x:bt(w.x),y:bt(w.y),width:bt(w.width),height:bt(w.height),container:is.has(R)&&!b,attached:(m==null?void 0:m.attachedToRef)!==void 0,...m?{parent:Dw(m,r)}:{},...E?{label:{x:bt(E.x),y:bt(E.y),width:bt(E.width),height:bt(E.height)}}:{},...R==="bpmn:Group"?Ed(wd(m)):{}});continue}const x=h.waypoint;if(Array.isArray(x)){const b=mt((u=mt(h.label))==null?void 0:u.bounds);n.push({id:g,type:R,waypoints:x.map(E=>{var T,L;return{x:bt((T=mt(E))==null?void 0:T.x),y:bt((L=mt(E))==null?void 0:L.y)}}),endpoints:kw(m),...b?{label:{x:bt(b.x),y:bt(b.y),width:bt(b.width),height:bt(b.height)}}:{}})}}}return{shapes:t,edges:n}}function Cd(e){return Ki(Rd(e))}async function Ow(e){const{definitions:t,warnings:n}=await $u(e);return{findings:Cd(t),warnings:n}}function Vt(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=mt(r.label);n.push({id:r.id,type:o,waypoints:a.map(d=>({x:bt(d.x),y:bt(d.y)})),endpoints:[Dr(r.source),Dr(r.target)].filter(d=>!!d),...f&&typeof f.x=="number"?{label:{x:f.x,y:bt(f.y),width:bt(f.width),height:bt(f.height)}}:{}});continue}if(typeof r.x!="number"||typeof r.y!="number")continue;const c=mt(r.businessObject),s=mt(r.label);let u=mt(r.parent);for(;u&&u.type==="bpmn:Lane";)u=mt(u.parent);const l=typeof(u==null?void 0:u.type)=="string"?u.type:"",p=u&&is.has(l)&&l!=="bpmn:Group"&&typeof u.id=="string"?u.id:void 0;t.push({id:r.id,type:o,x:r.x,y:r.y,width:bt(r.width),height:bt(r.height),container:is.has(o)&&r.collapsed!==!0,attached:(c==null?void 0:c.attachedToRef)!==void 0,...p!==void 0?{parent:p}:{},...s&&typeof s.x=="number"?{label:{x:s.x,y:bt(s.y),width:bt(s.width),height:bt(s.height)}}:{},...o==="bpmn:Group"?Ed(wd(c)):{}})}return{shapes:t,edges:n}}const Lw={"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 Iw(e,t){const n=Lw[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function Pd(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function Ad(e){const t=()=>e.getAll().filter(n=>n.type!=="label"&&!("labelTarget"in n&&n.labelTarget));return{isCollaboration:()=>t().some(n=>n.type==="bpmn:Participant"),categoryOf:n=>{const i=e.get(n);if(!(!i||i.type==="label"))return Iw(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&Pd(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?Pd(i):void 0},endpointsOf:n=>{var r,o;const i=e.get(n);if(!(!i||i.type==="label")&&"waypoints"in i)return{source:(r=i.source)==null?void 0:r.id,target:(o=i.target)==null?void 0:o.id}}}}const Td=20,Nw=4,Rt=(e,t)=>Math.abs(e-t)<.5;function Md(e,t,n,i=Td){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,c=e.x<t.x?n.x+n.width+i:n.x-i,s=u=>[{x:a,y:e.y},{x:a,y:u},{x:c,y:u},{x:c,y:e.y}];return[s(n.y-i),s(n.y+n.height+i)]}if(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,c=e.y<t.y?n.y+n.height+i:n.y-i,s=u=>[{x:e.x,y:a},{x:u,y:a},{x:u,y:c},{x:e.x,y:c}];return[s(n.x-i),s(n.x+n.width+i)]}return null}function kd(e,t,n=Td){if(e.length!==4)return null;const[i,r,o,a]=e;if(Rt(i.y,r.y)&&Rt(r.x,o.x)&&Rt(o.y,a.y)){const c=s=>[i,{x:s,y:i.y},{x:s,y:a.y},a];return[c(t.x-n),c(t.x+t.width+n)]}if(Rt(i.x,r.x)&&Rt(r.y,o.y)&&Rt(o.x,a.x)){const c=s=>[i,{x:i.x,y:s},{x:a.x,y:s},a];return[c(t.y-n),c(t.y+t.height+n)]}return null}function zu(e,t){if(e.endpoints.length!==2)return[];const n=t.find(p=>p.id===e.endpoints[0]),i=t.find(p=>p.id===e.endpoints[1]);if(!n||!i)return[];if(i.x<=n.x+n.width)return[];const r=n.y+n.height/2,o=i.y+i.height/2;if(r>=i.y&&r<=i.y+i.height)return[];const a=i.x+i.width/2,c=n.x+n.width/2,s=r>o,u=[{x:n.x+n.width,y:r},{x:a,y:r},{x:a,y:s?i.y+i.height:i.y}],l=[{x:c,y:s?n.y:n.y+n.height},{x:c,y:o},{x:i.x,y:o}];return[u,l]}const Dd=30,Bw=[0,-25,25,-40,40];function $w(e,t){if(e.type!=="bpmn:MessageFlow"||e.endpoints.length!==2)return[];const n=t.find(f=>f.id===e.endpoints[0]),i=t.find(f=>f.id===e.endpoints[1]);if(!n||!i)return[];const r=n.y+n.height/2,o=i.y+i.height/2;if(i.y<n.y+n.height&&i.y+i.height>n.y)return[];const a=o<r,c=a?n.y+n.height:n.y,s=a?c+Dd:c-Dd,u=a?i.y+i.height:i.y,l=n.x+n.width/2,p=i.x+i.width/2;return Bw.map(f=>[{x:l,y:c},{x:l,y:s},{x:p+f,y:s},{x:p+f,y:u}])}const jw=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],us=(e,t,n)=>Fn({...e,waypoints:t},n).length;function Od(e,t,n,i){let r=[...e.waypoints],o=us(e,r,t);if(o===0)return null;let a=!1;for(const p of zu(e,t))if(us(e,p,t)===0)return p;const c=(i??[]).filter(p=>p.id!==e.id).flatMap(pn),s=p=>pn({...e,waypoints:p}).some(f=>os(f,c).length>0),u=$w(e,t).filter(p=>us(e,p,t)===0);if(u.length)return u.find(p=>!s(p))??u[0];const l=p=>!n||p.every(f=>f.x>=n.x&&f.x<=n.x+n.width&&f.y>=n.y&&f.y<=n.y+n.height);for(let p=0;p<Nw&&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)||Fn({...e,waypoints:[h,m]},[g]).length===0)continue;const R=Md(h,m,g),w=R?R.map(b=>jw(r,d,b)):kd(r,g)??[];if(!w.length)continue;const x=[...w].sort((b,E)=>Number(l(E))-Number(l(b)));for(const b of x){const E=us(e,b,t);if(E<o){r=b,o=E,f=!0,a=!0;break}}if(f)break}}if(!f)break}return a&&o===0?r:null}function Ld(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Vt(n),o=Pi(r),a=Ki(r).filter(s=>s.kind==="edge-crosses-shape"&&!t.has(qi(s)));if(!a.length)return;const c=new Map;for(const s of a){if(s.kind!=="edge-crosses-shape"||c.has(s.edge))continue;const u=r.edges.find(l=>l.id===s.edge);u&&c.set(s.edge,u)}for(const[s,u]of c){const l=n.get(s);if(!l)continue;const p=l.parent,f=p&&typeof p.x=="number"&&typeof p.width=="number"?{x:p.x,y:p.y,width:p.width,height:p.height}:void 0,d=Od(u,o,f,r.edges);d&&i.updateWaypoints(l,d)}}const Fw=10;function Id(e,t){if(e.parent){const r=t.find(o=>o.id===e.parent);if(r)return r}const n=e.x+e.width/2,i=e.y+e.height/2;return t.find(r=>n>=r.x&&n<=r.x+r.width&&i>=r.y&&i<=r.y+r.height)}function Nd(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(V=>V.type==="bpmn:Participant"&&V.container),i=t.shapes.find(V=>V.id===e.endpoints[0]),r=t.shapes.find(V=>V.id===e.endpoints[1]);if(!i||!r)return null;const o=Id(i,n),a=Id(r,n);if(!o||!a||o.id===a.id)return null;const c=a.y>o.y,s=c?o:a,u=c?a:o,l=n.filter(V=>V.id!==o.id&&V.id!==a.id&&V.y>=s.y+s.height&&V.y+V.height<=u.y).sort((V,pe)=>V.y-pe.y);if(!l.length)return null;const p=l[0],f=l[l.length-1],d=(s.y+s.height+p.y)/2,h=(f.y+f.height+u.y)/2,m=c?d:h,g=c?h:d,R=e.waypoints[0],w=e.waypoints[e.waypoints.length-1],x=Pi(t),b=t.edges.filter(V=>V.id!==e.id),E=Ci(e,b),T=Fn(e,x).length;if(E===0&&T===0)return null;const L=Math.min(...l.map(V=>V.x)),A=Math.max(...l.map(V=>V.x+V.width)),F=(R.x+w.x)/2,H=V=>V.filter((pe,je)=>je===0||!(Rt(pe.x,V[je-1].x)&&Rt(pe.y,V[je-1].y)));let N;for(let V=L;V<=A;V+=Fw){const pe=H([R,{x:R.x,y:m},{x:V,y:m},{x:V,y:g},{x:w.x,y:g},w]),je={...e,waypoints:pe};if(Fn(je,x).length>0)continue;const lt=Ci(je,b),Y=Math.abs(V-F);(!N||lt<N.cross||lt===N.cross&&Y<N.detour)&&(N={pts:pe,cross:lt,detour:Y})}return N&&(T>0?N.cross<=E:N.cross<E)?N.pts:null}function Bd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Vt(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=Vt(n),c=a.edges.find(l=>l.id===o.id);if(!c)continue;const s=Nd(c,a);if(!s)continue;const u=n.get(o.id);u&&i.updateWaypoints(u,s)}}const ro=[25,-25,40,-40],ls=35;function $d(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];if(i.x+i.width>n.x)return[];const r=n.y+n.height/2;if(r>=i.y&&r<=i.y+i.height)return[];const o=i.x+i.width/2,a=n.x+n.width/2,c=r<i.y,s=c?i.y:i.y+i.height,u=c?n.y:n.y+n.height,l=c?n.y-ls:n.y+n.height+ls,p=[];for(const w of[0,...ro]){if(Math.abs(w)>=i.width/2-5)continue;const x=o+w;p.push({pts:[{x:n.x,y:r},{x,y:r},{x,y:s}],cost:Math.abs(w)});for(const b of[0,...ro]){if(Math.abs(b)>=n.width/2-5)continue;const E=a+b;p.push({pts:[{x:E,y:u},{x:E,y:l},{x,y:l},{x,y:s}],cost:Math.abs(w)+Math.abs(b)})}}const f=50,d=i.y+i.height/2,h=c?n.y+n.height:n.y;for(const w of[0,...ro]){if(Math.abs(w)>=n.width/2-5)continue;const x=a+w;p.push({pts:[{x,y:h},{x,y:d},{x:i.x+i.width,y:d}],cost:f+Math.abs(w)})}const m=60,g=c?i.y+i.height:i.y,R=c?i.y+i.height+ls:i.y-ls;for(const w of[0,...ro]){if(Math.abs(w)>=i.width/2-5)continue;const x=o+w;for(const b of[0,...ro]){if(Math.abs(b)>=n.width/2-5)continue;const E=a+b;p.push({pts:[{x:E,y:h},{x:E,y:R},{x,y:R},{x,y:g}],cost:m+Math.abs(w)+Math.abs(b)})}}return p}const ps=30;function jd(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],r=e[n+1],o=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 c of t)if(o){const s=Math.min(i.x,r.x);if(Math.max(i.x,r.x)<=c.x||s>=c.x+c.width)continue;if(Math.abs(i.y-c.y)<ps||Math.abs(i.y-(c.y+c.height))<ps)return!0}else{const s=Math.min(i.y,r.y);if(Math.max(i.y,r.y)<=c.y||s>=c.y+c.height)continue;if(Math.abs(i.x-c.x)<ps||Math.abs(i.x-(c.x+c.width))<ps)return!0}}return!1}const fs=40;function Hw(e,t,n){let i=0;for(const r of t){if(r.container||n.includes(r.id))continue;const o=r.x-fs,a=r.x+r.width+fs,c=r.y-fs,s=r.y+r.height+fs;for(let u=1;u<e.length-2;u++){const l=e[u],p=e[u+1],f={x:Math.min(l.x,p.x),y:Math.min(l.y,p.y)},d={x:Math.max(l.x,p.x),y:Math.max(l.y,p.y)};if(f.x<a&&d.x>o&&f.y<s&&d.y>c){i++;break}}}return i}function Fd(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(w=>w.container),i=new Map(t.shapes.map(w=>[w.id,w])),r=Pi(t),o=t.edges.filter(w=>w.id!==e.id),a=kr(e,o),c=Ci(e,o),s=w=>Hw(w,t.shapes,e.endpoints)+(jd(w,n)?1:0),u=s(e.waypoints),l=w=>{if(!w)return;const x=w.x+w.width/2,b=w.y+w.height/2;return n.find(E=>E.type==="bpmn:Lane"&&x>=E.x&&x<=E.x+E.width&&b>=E.y&&b<=E.y+E.height)},p=l(i.get(e.endpoints[0]??"")),f=l(i.get(e.endpoints[1]??"")),d=!!p&&!!f&&p.id!==f.id,h=w=>{if(!d||!f)return!1;for(let x=1;x<w.length-2;x++){const b=w[x],E=w[x+1];if(Rt(b.y,E.y)&&!Rt(b.x,E.x)&&b.y>f.y&&b.y<f.y+f.height)return!0}return!1},m=h(e.waypoints);if(!jd(e.waypoints,n)&&!(d&&!m))return null;const g=w=>w.reduce((x,b,E)=>E?x+Math.abs(b.x-w[E-1].x)+Math.abs(b.y-w[E-1].y):0,0);let R;for(const{pts:w,cost:x}of $d(e,i)){const b={...e,waypoints:w};if(Fn(b,r).length>0||kr(b,o)>a||Ci(b,o)>c)continue;const E=s(w),T=h(w);if(!(T&&!m)&&E>=u)continue;const A=T?0:1,F=g(w);(!R||A<R.lane||A===R.lane&&(E<R.sc||E===R.sc&&(x<R.cost||x===R.cost&&F<R.len)))&&(R={pts:w,sc:E,lane:A,cost:x,len:F})}return(R==null?void 0:R.pts)??null}function zw(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Vt(n).edges.filter(o=>!t.has(o.id)&&o.waypoints.length>=4).map(o=>o.id).sort();for(const o of r){const a=Vt(n),c=a.edges.find(d=>d.id===o);if(!c||c.waypoints.length<4)continue;const s=Pi(a),u=a.edges.filter(d=>d.id!==o),l=Fn(c,s).length,p=kr(c,u),f=Ci(c,u);for(const d of zu(c,a.shapes)){if(d.length>=c.waypoints.length)continue;const h={...c,waypoints:d};if(Fn(h,s).length>l||kr(h,u)>p||Ci(h,u)>f)continue;const m=n.get(o);m&&i.updateWaypoints(m,d);break}}}function Hd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Vt(n).edges.filter(o=>o.type==="bpmn:SequenceFlow"&&!t.has(o.id)).map(o=>o.id).sort();for(const o of r){const a=Vt(n),c=a.edges.find(l=>l.id===o);if(!c)continue;const s=Fd(c,a);if(!s)continue;const u=n.get(o);u&&i.updateWaypoints(u,s)}}function Vw(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),c=Rt(n[n.length-1].x,n[n.length-2].x)&&!Rt(n[n.length-1].y,n[n.length-2].y);for(const s of ro){if(a&&r&&Math.abs(s)<r.width/2-5){const u=n.map(l=>({...l}));u[0].x+=s,u[1].x+=s,i.push({pts:u,cost:Math.abs(s)})}if(c&&o&&Math.abs(s)<o.width/2-5){const u=n.map(l=>({...l}));u[u.length-1].x+=s,u[u.length-2].x+=s,i.push({pts:u,cost:Math.abs(s)})}}return i}function zd(e,t){const n=new Map(t.shapes.map(l=>[l.id,l])),i=Pi(t),r=t.edges.filter(l=>l.id!==e.id),o=kr(e,r);if(o===0)return null;const a=Ci(e,r);let c;const s=l=>l.reduce((p,f,d)=>d?p+Math.abs(f.x-l[d-1].x)+Math.abs(f.y-l[d-1].y):0,0),u=[...$d(e,n),...Vw(e,n)];for(const{pts:l,cost:p}of u){const f={...e,waypoints:l};if(Fn(f,i).length>0)continue;const d=kr(f,r),h=Ci(f,r);if(d>=o||h-a>o-d)continue;const m=s(l);(!c||d<c.opposite||d===c.opposite&&(h<c.cross||h===c.cross&&(p<c.cost||p===c.cost&&m<c.len)))&&(c={pts:l,opposite:d,cross:h,cost:p,len:m})}return(c==null?void 0:c.pts)??null}function Vd(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Vt(i),a=Ki(o).filter(l=>(l.kind==="edge-overlap-opposite"||l.kind==="edge-overlap-mixed")&&!t.has(qi(l)));if(!a.length)return;const c=new Set;for(const l of a)if(!(l.kind!=="edge-overlap-opposite"&&l.kind!=="edge-overlap-mixed"))for(const p of l.edges)n.has(p)||c.add(p);const s=l=>{var p;return((p=o.edges.find(f=>f.id===l))==null?void 0:p.type)??""},u=[...c].sort((l,p)=>{const f=s(l)==="bpmn:SequenceFlow"?0:1,d=s(p)==="bpmn:SequenceFlow"?0:1;return f!==d?f-d:l.localeCompare(p)});for(const l of u){const p=Vt(i),f=p.edges.find(m=>m.id===l);if(!f)continue;const d=zd(f,p);if(!d)continue;const h=i.get(l);h&&r.updateWaypoints(h,d)}}const Gw=10,Ww=(e,t)=>e.x<t.x+t.width&&t.x<e.x+e.width&&e.y<t.y+t.height&&t.y<e.y+e.height;function Gd(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!as(e,i))return null;const r=Pi(t),o=i.flatMap(pn);for(const a of pn(e)){let c=[[a.lo,a.hi]];for(const[d,h]of os(a,o))c=c.flatMap(([m,g])=>{const R=[];return d>m&&R.push([m,Math.min(g,d)]),h<g&&R.push([Math.max(m,h),g]),R.filter(([w,x])=>x>w)});const s=a.axis==="h"?n.width:n.height,u=c.find(([d,h])=>h-d>=s+Gw*2);if(!u)continue;const l=(u[0]+u[1])/2,p=a.axis==="h"?{x:l,y:a.at-gd}:{x:a.at+Sn+n.width/2,y:l},f={x:p.x-n.width/2,y:p.y-n.height/2,width:n.width,height:n.height};if(!as({...e,label:f},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&Ww(f,d)))return f}return null}const Sn=8;function Wd(e,t){const n=e.label;if(!n)return null;const i=pn(e);if(!i.length)return null;const r=n.x+n.width/2,o=n.y+n.height/2,a=f=>{const d=f.axis==="h"?r:o,h=f.axis==="h"?o-f.at:r-f.at,m=d<f.lo?f.lo-d:d>f.hi?d-f.hi:0;return Math.hypot(h,m)},c=i.reduce((f,d)=>a(d)<a(f)?d:f,i[0]),s=[...i,...t.edges.filter(f=>f.id!==e.id).flatMap(pn),...t.shapes.filter(f=>f.container).flatMap(Go)],u=f=>!s.some(d=>Ri(f,d));if(u(n))return null;const l=(c.axis==="v"?n.height:n.width)+Sn,p=[0,-l,l,-2*l,2*l];if(c.axis==="v")for(const f of[c.at+Sn,c.at-Sn-n.width])for(const d of p){const h=n.y+d;if(h<c.lo||h+n.height>c.hi)continue;const m={...n,x:f,y:h};if(u(m))return m}else for(const f of[c.at-Sn-n.height,c.at+Sn])for(const d of p){const h=n.x+d;if(h<c.lo||h+n.width>c.hi)continue;const m={...n,x:h,y:f};if(u(m))return m}return null}function Ud(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Vt(n);for(const o of r.edges){if(!o.label||t.has(o.id))continue;const a=Wd(o,r);if(!a)continue;const c=n.get(o.id),s=c==null?void 0:c.label;s&&i.moveElements([s],{x:a.x-s.x,y:a.y-s.y})}}function Yd(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Vt(i),a=Ki(o).filter(c=>c.kind==="label-on-shared-segment"&&!t.has(qi(c)));for(const c of a){if(c.kind!=="label-on-shared-segment"||n.has(c.edge))continue;const s=o.edges.find(f=>f.id===c.edge);if(!s)continue;const u=Gd(s,o);if(!u)continue;const l=i.get(c.edge),p=l==null?void 0:l.label;p&&r.moveElements([p],{x:u.x-p.x,y:u.y-p.y})}}function qd(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(pn),...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=cs(t).filter(f=>f.owner!==e.id).map(f=>f.rect),c=(f,d)=>f.x<d.x+d.width&&d.x<f.x+f.width&&f.y<d.y+d.height&&d.y<f.y+f.height,s=f=>!i.some(d=>Ri(f,d))&&!o.some(d=>c(f,d))&&!a.some(d=>c(f,d)),u=[];for(const f of r)f.axis==="h"?u.push({...n,y:f.at-Sn-n.height},{...n,y:f.at+Sn}):u.push({...n,x:f.at-Sn-n.width},{...n,x:f.at+Sn});const l=e.x+e.width/2,p=e.y+e.height/2;return u.push({...n,x:l-n.width/2,y:e.y+e.height+Sn},{...n,x:l-n.width/2,y:e.y-Sn-n.height},{...n,x:e.x+e.width+Sn,y:p-n.height/2},{...n,x:e.x-Sn-n.width,y:p-n.height/2}),u.find(s)??null}function Kd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Vt(n);for(const o of r.shapes){if(o.container||!o.label||t.has(o.id))continue;const a=qd(o,Vt(n));if(!a)continue;const c=n.get(o.id),s=c==null?void 0:c.label;s&&i.moveElements([s],{x:a.x-s.x,y:a.y-s.y})}}const Uw=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,Xd=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),Zd={"participant.add":[{path:"participant",shape:["id"]},{path:"participant.lanes[]",shape:["id"],optional:!0}],"participant.update":[{path:"id",shape:null},{path:"lanes[]",shape:["id"],optional:!0}],"node.add":[{path:"node",shape:["id","type"]}],"node.update":[{path:"id",shape:null}],"sequenceFlow.add":[{path:"flow",shape:["id","source","target"]}],"sequenceFlow.update":[{path:"id",shape:null}],"messageFlow.add":[{path:"flow",shape:["id","source","target"]}],"messageFlow.update":[{path:"id",shape:null}],"dataStore.add":[{path:"dataStore",shape:["id"]},{path:"associations[]",shape:["source","target"],optional:!0}],"dataStore.update":[{path:"id",shape:null}],"dataAssociation.add":[{path:"association",shape:["source","target"]}],"association.add":[{path:"association",shape:["source","target"]}],"annotation.add":[{path:"annotation",shape:["id","text"]},{path:"association",shape:["source","target"],optional:!0},{path:"placement",shape:["anchor","side"],optional:!0}],"annotation.update":[{path:"id",shape:null},{path:"placement",shape:["anchor","side"],optional:!0}],"group.add":[{path:"group",shape:["id"]},{path:"group.members[]",shape:null,optional:!0}],"group.update":[{path:"id",shape:null},{path:"members[]",shape:null,optional:!0}],"element.remove":[{path:"id",shape:null}]},ds=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Vu=e=>typeof e=="string"&&e!=="";function Yw(e){const t=[];function n(i,r,o,a){if(a===null){Vu(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!ds(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const c of a)Vu(o[c])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${c}`})}return e.forEach((i,r)=>{if(!ds(i)||!Vu(i.kind)||!(i.kind in Zd)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const o of Zd[i.kind]){const a=o.path.endsWith("[]"),c=a?o.path.slice(0,-2):o.path,s=c.split(".");let u=i;for(const p of s.slice(0,-1)){if(!ds(u))break;u=u[p]}if(!ds(u))continue;const l=u[s[s.length-1]];if(!(l===void 0&&o.optional)&&!(l===null&&o.optional)){if(!a){n(r,o.path,l,o.shape);continue}if(!Array.isArray(l)){t.push({kind:"payload-invalid",opIndex:r,field:o.path});continue}l.forEach((p,f)=>n(r,`${c}[${f}]`,p,o.shape))}}if(i.kind==="node.add"){const o=i.band;o!==void 0&&(!Number.isInteger(o)||o<0)&&t.push({kind:"payload-invalid",opIndex:r,field:"band"})}}),t}function Qd(e,t){const n=Yw(e);if(n.length>0)return n;const i=[],r=new Map,o=new Map;function a(f,d,h){if(!Uw.test(d)){i.push({kind:"id-invalid",opIndex:f,id:d});return}if(t.categoryOf(d)!==void 0||r.has(d)){i.push({kind:"id-duplicate",opIndex:f,id:d});return}r.set(d,{...h,opIndex:f})}e.forEach((f,d)=>{var h;switch(f.kind){case"participant.add":a(d,f.participant.id,{category:"participant",lanes:(f.participant.lanes??[]).map(m=>m.id)});for(const m of f.participant.lanes??[])a(d,m.id,{category:"lane"});break;case"node.add":a(d,f.node.id,{category:"flowNode",participant:f.node.participant});break;case"sequenceFlow.add":a(d,f.flow.id,{category:"sequenceFlow"});break;case"messageFlow.add":a(d,f.flow.id,{category:"messageFlow"});break;case"dataStore.add":a(d,f.dataStore.id,{category:"dataStore"});for(const m of f.associations??[])m.id&&a(d,m.id,{category:"dataAssociation"});break;case"dataAssociation.add":f.association.id&&a(d,f.association.id,{category:"dataAssociation"});break;case"association.add":f.association.id&&a(d,f.association.id,{category:"association"});break;case"annotation.add":a(d,f.annotation.id,{category:"annotation"}),(h=f.association)!=null&&h.id&&a(d,f.association.id,{category:"association"});break;case"group.add":a(d,f.group.id,{category:"group"});break;case"participant.update":if(f.lanes){o.set(f.id,f.lanes.map(m=>m.id));for(const m of f.lanes)t.categoryOf(m.id)===void 0&&a(d,m.id,{category:"lane"})}break}});const c=f=>{var d;return((d=r.get(f))==null?void 0:d.category)??t.categoryOf(f)},s=f=>{const d=r.get(f);return d?d.category==="participant"?f:d.participant:t.categoryOf(f)==="participant"?f:t.participantOf(f)};function u(f,d,h,m){const g=c(d);if(g===void 0){i.push({kind:"ref-missing",opIndex:f,ref:d,role:h});return}if(m&&!m.includes(g)){i.push({kind:"ref-category",opIndex:f,ref:d,role:h,expected:m.join("|"),actual:g});return}return g}const l=t.isCollaboration()||e.some(f=>f.kind==="participant.add");return e.forEach((f,d)=>{var h;switch(f.kind){case"participant.add":break;case"node.add":{const{participant:m,lane:g}=f.node;if(m===void 0){(l||g!==void 0)&&i.push({kind:"participant-required",opIndex:d,id:f.node.id});break}if(u(d,m,"participant",["participant"])===void 0)break;g!==void 0&&((((h=r.get(m))==null?void 0:h.lanes)??o.get(m)??t.lanesOf(m)).includes(g)||i.push({kind:"lane-unknown",opIndex:d,lane:g,participant:m}));break}case"sequenceFlow.add":{const{id:m,source:g,target:R,name:w,condition:x}=f.flow,b=u(d,g,"source",["flowNode"]),E=u(d,R,"target",["flowNode"]);b&&E&&s(g)!==s(R)&&i.push({kind:"flow-cross-pool",opIndex:d,id:m}),w!==void 0&&x!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:m});break}case"messageFlow.add":{const{id:m,source:g,target:R}=f.flow,w=u(d,g,"source",["flowNode","participant"]),x=u(d,R,"target",["flowNode","participant"]);if(w&&x){const b=s(g),E=s(R);b!==void 0&&b===E&&i.push({kind:"message-flow-same-pool",opIndex:d,id:m})}break}case"dataStore.add":{for(const m of f.associations??[]){if([m.source,m.target].filter(w=>w===f.dataStore.id).length!==1){i.push({kind:"data-association-ends",opIndex:d,source:m.source,target:m.target});continue}const R=m.source===f.dataStore.id?m.target:m.source;u(d,R,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:m,target:g}=f.association,R=u(d,m,"source"),w=u(d,g,"target");if(R&&w){const x=new Set([R,w]);x.has("dataStore")&&x.has("flowNode")||i.push({kind:"data-association-ends",opIndex:d,source:m,target:g})}break}case"association.add":{const{id:m,source:g,target:R}=f.association,w=u(d,g,"source"),x=u(d,R,"target");w&&x&&w!=="annotation"&&x!=="annotation"&&i.push({kind:"association-detached",opIndex:d,annotation:m??`${g}->${R}`});break}case"annotation.add":{if(f.association){const{source:m,target:g}=f.association;if(m!==f.annotation.id&&g!==f.annotation.id)i.push({kind:"association-detached",opIndex:d,annotation:f.annotation.id});else{const R=m===f.annotation.id?g:m;u(d,R,"association")}}f.placement&&u(d,f.placement.anchor,"anchor");break}case"group.add":{for(const m of f.group.members??[]){const g=u(d,m,"member");g&&Xd.has(g)&&i.push({kind:"ref-category",opIndex:d,ref:m,role:"member",expected:"shape",actual:g})}break}case"participant.update":{if(p(d,f.id,"participant")===void 0)break;if(f.lanes){const m=t.lanesOf(f.id),g=f.lanes.map(w=>w.id);for(const w of m)g.includes(w)||i.push({kind:"lane-shrink-unsupported",opIndex:d,participant:f.id,lane:w});for(const w of g)t.categoryOf(w)!==void 0&&!m.includes(w)&&i.push({kind:"id-duplicate",opIndex:d,id:w});const R=g.filter(w=>m.includes(w));R.length===m.length&&R.some((w,x)=>w!==m[x])&&i.push({kind:"lane-reorder-unsupported",opIndex:d,participant:f.id})}break}case"node.update":{if(p(d,f.id,"flowNode")===void 0)break;if(f.lane!==void 0){const m=t.participantOf(f.id);(m?o.get(m)??t.lanesOf(m):[]).includes(f.lane)||i.push({kind:"lane-unknown",opIndex:d,lane:f.lane,participant:m??""})}break}case"sequenceFlow.update":{if(p(d,f.id,"sequenceFlow")===void 0)break;if(f.name!==void 0&&f.condition!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:f.id}),f.source!==void 0||f.target!==void 0){const m=f.source===void 0||u(d,f.source,"source",["flowNode"])!==void 0,g=f.target===void 0||u(d,f.target,"target",["flowNode"])!==void 0,R=t.endpointsOf(f.id),w=f.source??(R==null?void 0:R.source),x=f.target??(R==null?void 0:R.target);m&&g&&w!==void 0&&x!==void 0&&new Set([s(w),s(x),s(f.id)]).size>1&&i.push({kind:"flow-cross-pool",opIndex:d,id:f.id})}break}case"messageFlow.update":p(d,f.id,"messageFlow");break;case"dataStore.update":p(d,f.id,"dataStore");break;case"annotation.update":{if(p(d,f.id,"annotation")===void 0)break;f.placement&&u(d,f.placement.anchor,"anchor");break}case"group.update":{if(p(d,f.id,"group")===void 0)break;for(const m of f.members??[]){const g=u(d,m,"member");g&&Xd.has(g)&&i.push({kind:"ref-category",opIndex:d,ref:m,role:"member",expected:"shape",actual:g})}break}case"element.remove":{p(d,f.id)==="lane"&&i.push({kind:"ref-category",opIndex:d,ref:f.id,role:"target",expected:"removable",actual:"lane"});break}}}),i;function p(f,d,h){if(r.has(d)){i.push({kind:"target-added-in-batch",opIndex:f,id:d});return}const m=t.categoryOf(d);if(m===void 0){i.push({kind:"ref-missing",opIndex:f,ref:d,role:"target"});return}if(h&&m!==h){i.push({kind:"ref-category",opIndex:f,ref:d,role:"target",expected:h,actual:m});return}return m}}const oo={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},qw=/[ᄀ-ᇿ -〿-ヿ㐀-鿿가--⦆]/;function Kw(e){const t=oo;return qw.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*Kw(i);return n}function Jd(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&Xw(e),Zw(e),Qw(e),Jw(e)}function Xw(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*oo.ascentEm,fontBoundingBoxDescent:o*oo.descentEm,actualBoundingBoxAscent:o*oo.ascentEm,actualBoundingBoxDescent:o*oo.descentEm}}};t.getContext=()=>n}function Zw(e){if(e.SVGMatrix)return;class t{constructor(){Zr(this,"a",1);Zr(this,"b",0);Zr(this,"c",0);Zr(this,"d",1);Zr(this,"e",0);Zr(this,"f",0)}static of(i,r,o,a,c,s){return Object.assign(new t,{a:i,b:r,c:o,d:a,e:c,f:s})}multiply(i){return t.of(this.a*i.a+this.c*i.b,this.b*i.a+this.d*i.b,this.a*i.c+this.c*i.d,this.b*i.c+this.d*i.d,this.a*i.e+this.c*i.f+this.e,this.b*i.e+this.d*i.f+this.f)}translate(i,r){return this.multiply(t.of(1,0,0,1,i,r))}scale(i,r=i){return this.multiply(t.of(i,0,0,r,0,0))}inverse(){const i=this.a*this.d-this.b*this.c;return t.of(this.d/i,-this.b/i,-this.c/i,this.a/i,(this.c*this.f-this.d*this.e)/i,(this.b*this.e-this.a*this.f)/i)}}e.SVGMatrix=t}function Qw(e){var o;const t=()=>{const a=new e.SVGMatrix;return{type:0,matrix:a,setTranslate(c,s){a.e=c,a.f=s},setScale(c,s){a.a=c,a.d=s},setRotate(c,s=0,u=0){const l=c*Math.PI/180,p=Math.cos(l),f=Math.sin(l);a.a=p,a.b=f,a.c=-f,a.d=p,a.e=s-p*s+f*u,a.f=u-f*s-p*u},setMatrix(c){Object.assign(a,c)}}},n=a=>{const c=t();return Object.assign(c.matrix,a),c},i=(o=e.SVGSVGElement)==null?void 0:o.prototype;i&&!i.createSVGTransform&&(i.createSVGTransform=t,i.createSVGTransformFromMatrix=n,i.createSVGMatrix=()=>new e.SVGMatrix,i.createSVGPoint=()=>({x:0,y:0,matrixTransform:()=>({x:0,y:0})}));const r=e.SVGElement.prototype;Object.getOwnPropertyDescriptor(r,"transform")||Object.defineProperty(r,"transform",{configurable:!0,get(){if(!this.__headlessTransformList){const a=[];this.__headlessTransformList={baseVal:{get numberOfItems(){return a.length},clear:()=>{a.length=0},appendItem:c=>(a.push(c),c),getItem:c=>a[c],createSVGTransformFromMatrix:n,consolidate:()=>a[a.length-1]??null}}}return this.__headlessTransformList}})}function Jw(e){const t=e.SVGElement.prototype;if(!t.getCTM){const n=()=>new e.SVGMatrix;t.getCTM=n,t.getScreenCTM=n}t.getBBox||(t.getBBox=function(){const n=String(this.textContent??"");return{x:0,y:0,width:Wo(n,12),height:14}})}function eh(e){return{modeling:e.get("modeling"),bpmnFactory:e.get("bpmnFactory"),elementFactory:e.get("elementFactory"),elementRegistry:e.get("elementRegistry"),canvas:e.get("canvas"),autoPlace:e.get("autoPlace"),bpmnReplace:e.get("bpmnReplace")}}function hs(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const Gu={"top-left":[-1,-1],top:[0,-1],"top-right":[1,-1],right:[1,0],"bottom-right":[1,1],bottom:[0,1],"bottom-left":[-1,1],left:[-1,0]};function qt(e,t){return e.filter(n=>n.kind===t)}function th(e,t){var vx,_x,bx,xx,wx,Ex;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:c,bpmnReplace:s}=t,u=()=>a.getRootElement(),l=S=>o.get(S),p=S=>{const P=l(S);if(!P)throw new Error(`하강 참조 해소 실패: ${S}`);return P},f=S=>{let P=S.parent;for(;P;){if(P.type==="bpmn:Participant")return P;P=P.parent}},d=qt(e,"participant.add"),h=qt(e,"node.add"),m=qt(e,"sequenceFlow.add"),g=qt(e,"messageFlow.add"),R=qt(e,"dataStore.add"),w=qt(e,"dataAssociation.add"),x=qt(e,"annotation.add"),b=qt(e,"group.add"),E=new Map(h.map(S=>[S.node.id,S])),T=(S,P,k)=>{var le;const z=S.businessObject,G=(((le=z.extensionElements)==null?void 0:le.values)??[]).filter(J=>J.$type!==P),B=k?[...G,i.create(P,k)]:G;if(!B.length){z.extensionElements&&n.updateProperties(S,{extensionElements:void 0});return}const X=i.create("bpmn:ExtensionElements",{values:B});B.forEach(J=>{J.$parent=X}),n.updateProperties(S,{extensionElements:X})},L=S=>({anchor:S.anchor,side:S.side,...S.offset!==void 0?{offset:S.offset}:{}});for(const S of qt(e,"element.remove")){const P=l(S.id);P&&n.removeElements([P])}const A=S=>o.filter(P=>{var k;return P.type==="bpmn:Lane"&&((k=f(P))==null?void 0:k.id)===S}).sort((P,k)=>P.y-k.y);for(const S of qt(e,"participant.update")){const P=p(S.id);if(S.name!==void 0&&n.updateProperties(P,{name:S.name??void 0}),!S.lanes)continue;const k=A(S.id);if(!k.length){n.splitLane(P,S.lanes.length),A(S.id).forEach((G,B)=>{const X=S.lanes[B];X&&n.updateProperties(G,{id:X.id,name:X.name})});continue}const z=new Set(k.map(G=>G.id));S.lanes.forEach((G,B)=>{if(z.has(G.id)){n.updateProperties(p(G.id),{name:G.name});return}const X=B===0?n.addLane(A(S.id)[0],"top"):n.addLane(p(S.lanes[B-1].id),"bottom");n.updateProperties(X,{id:G.id,name:G.name})})}const F=150,H=130,N=80,V=90,pe=180,je=new Set;for(const S of d){je.add(`pool:${S.participant.id}`);for(const P of S.participant.lanes??[])je.add(P.id)}const lt=new Map;for(const S of h){const P=S.node.lane??`pool:${S.node.participant??""}`;let k=lt.get(P);k||lt.set(P,k=new Set([0])),S.band!==void 0&&k.add(S.band)}const Y=new Map;for(const[S,P]of lt){if(!je.has(S))continue;const k=[...P].sort((B,X)=>B-X),z=k.map((B,X)=>X===0?0:X%2===1?Math.ceil(X/2):-(X/2)),G=Math.min(...z);Y.set(S,new Map(k.map((B,X)=>[B,z[X]-G])))}{const S=new Map;for(const P of d)(P.participant.lanes??[]).forEach((k,z)=>S.set(k.id,z));for(const[P,k]of Y){if(!S.has(P)||k.size<2)continue;const z=S.get(P),G=k.get(0)??0,B=new Set;for(const Ee of h){if(Ee.node.lane!==P||(Ee.band??0)!==0||!Ee.node.type.endsWith("Gateway"))continue;const Oe={in:new Set,out:new Set,cross:new Set};for(const xe of m){const ct=xe.flow.source===Ee.node.id;if(!ct&&xe.flow.target!==Ee.node.id)continue;const Ut=E.get(ct?xe.flow.target:xe.flow.source);if(!Ut||Ut.node.participant!==Ee.node.participant||!Ut.node.lane)continue;let ei,un=!1;if(Ut.node.lane!==P){const $n=S.get(Ut.node.lane);if($n===void 0)continue;ei=$n>z?"down":"up",un=!0}else{const $n=k.get(Ut.band??0)??G;ei=$n>G?"down":$n<G?"up":void 0}ei&&(Oe[ct?"out":"in"].add(ei),un&&Oe.cross.add(ei))}for(const xe of["up","down"])Oe.in.has(xe)&&Oe.out.has(xe)&&Oe.cross.has(xe)&&B.add(xe)}if(B.size!==1)continue;const[X]=B,le=Math.max(...k.values()),J=X==="down"?le:0;if(G===J)continue;const de=[...k.entries()].filter(([Ee])=>Ee!==0).sort((Ee,Oe)=>Ee[1]-Oe[1]),Ge=[...Array(le+1).keys()].filter(Ee=>Ee!==J),st=new Map([[0,J]]);de.forEach(([Ee],Oe)=>st.set(Ee,Ge[Oe])),Y.set(P,st)}}const fe=S=>{var P;return(((P=lt.get(S))==null?void 0:P.size)??0)>1},he=S=>S.band??(S.node.lane||!fe(`pool:${S.node.participant??""}`)?void 0:0),se=new Map,ce=S=>se.get(S.node.id)??he(S),ee=new Set,j=new Set;{const S=new Map;for(const z of m)S.set(z.flow.target,(S.get(z.flow.target)??0)+1);const P=z=>{const G=[],B=new Set([z]),X=[z];for(;X.length;){const le=X.shift();G.push(le);for(const J of m)J.flow.source!==le||B.has(J.flow.target)||(S.get(J.flow.target)??0)!==1||(B.add(J.flow.target),X.push(J.flow.target))}return G},k=(z,G)=>{var B;return((B=Y.get(z))==null?void 0:B.get(G))??G};for(const z of h){if(!z.node.type.endsWith("Gateway"))continue;const G=z.node.lane??`pool:${z.node.participant??""}`,B=Y.get(G);if(!B||B.size<2)continue;const X=ce(z);if(X===void 0||k(G,X)!==k(G,0))continue;const le=k(G,X),J=m.filter(xe=>xe.flow.source===z.node.id).map(xe=>E.get(xe.flow.target)).filter(xe=>!!xe&&(xe.node.lane??`pool:${xe.node.participant??""}`)===G),de=J.filter(xe=>{const ct=ce(xe);return ct!==void 0&&k(G,ct)===le&&(S.get(xe.node.id)??0)===1}),Ge=J.some(xe=>{const ct=ce(xe);return ct!==void 0&&k(G,ct)>le});if(de.length!==1||!Ge)continue;const st=new Set(J.flatMap(xe=>P(xe.node.id)));if(!m.some(xe=>xe.flow.target===z.node.id&&st.has(xe.flow.source)))continue;const Oe=new Map;for(const[xe,ct]of B)Oe.set(xe,ct+1);Oe.set(-1,0),Y.set(G,Oe);for(const xe of P(de[0].node.id))E.has(xe)&&(se.set(xe,-1),j.add(xe));ee.add(z.node.id)}}const $=(S,P)=>{var k;return((k=Y.get(S))==null?void 0:k.get(P))??P},U=new Map;for(const[S,P]of lt){let k=0;for(const z of P)k=Math.max(k,$(S,z));U.set(S,k)}const ke=S=>pe+F*S,Dt=d.map((S,P)=>({op:S,declared:P}));Dt.sort((S,P)=>{const k=S.op.order??Number.POSITIVE_INFINITY,z=P.op.order??Number.POSITIVE_INFINITY;return k!==z?k-z:S.declared-P.declared});let C=80;for(const S of o.getAll())S.parent===u()&&"height"in S&&typeof S.y=="number"&&(C=Math.max(C,S.y+S.height+60));for(const{op:S}of Dt){const P=S.participant,k=h.filter(Ee=>Ee.node.participant===P.id).length,z=((vx=P.lanes)==null?void 0:vx.length)??0,G=Math.max(1200,k*160+300),B=(P.lanes??[]).map(Ee=>ke(U.get(Ee.id)??0)),X=B.reduce((Ee,Oe)=>Ee+Oe,0);z&&X<300&&(B[z-1]+=300-X);const le=Math.max(300,F*((U.get(`pool:${P.id}`)??0)+1)),J=P.blackBox||k+z===0?120:z?Math.max(300,X):le,de=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}),Ge=n.createShape(de,{x:100+G/2,y:C+J/2},u()),st=P.lanes??[];if(st.length&&n.splitLane(Ge,st.length),st.length){const Ee=o.filter(Oe=>{var xe;return Oe.type==="bpmn:Lane"&&((xe=f(Oe))==null?void 0:xe.id)===P.id}).sort((Oe,xe)=>Oe.y-xe.y);if(Ee.forEach((Oe,xe)=>{const ct=st[xe];ct&&n.updateProperties(Oe,{id:ct.id,name:ct.name})}),B.some(Oe=>Oe!==Ge.height/z)){let Oe=Ge.y;Ee.forEach((xe,ct)=>{const Ut=B[ct];n.resizeShape(xe,{x:xe.x,y:Oe,width:xe.width,height:Ut}),Oe+=Ut})}}C=Ge.y+Ge.height+60}const _=S=>{var z;const P=E.get(S);if(P)return P.node.participant??"";const k=l(S);return k?k.type==="bpmn:Participant"?k.id:((z=f(k))==null?void 0:z.id)??"":""},y=new Map,D=S=>{let P=y.get(S);return P||y.set(S,P={nodes:[],flows:[]}),P};for(const S of h)D(S.node.participant??"").nodes.push(S);for(const S of m)D(_(S.flow.source)).flows.push(S);const I=S=>{var P;return i.create("bpmn:SequenceFlow",{id:S.id,name:S.name??((P=S.condition)==null?void 0:P.label)})},W=(S,P)=>r.createShape({type:hs(S.type),businessObject:i.create(hs(S.type),{id:S.id,name:S.name,...P!==void 0?{"bwl:band":P}:{}})}),oe=[...Dt.map(({op:S})=>S.participant.id).filter(S=>y.has(S)),...[...y.keys()].filter(S=>!d.some(P=>P.participant.id===S))],Ae=S=>S.endsWith("Gateway");for(const S of oe){const P=y.get(S),k=S?p(S):void 0,z=k?k.x+150:250;let G=k?k.y+80:120;const B=(ne,ge,ue)=>{const Ze=u().children.filter(qe=>!("waypoints"in qe&&qe.waypoints)&&qe.id!==ge&&typeof qe.y=="number"&&qe.y>=ne);Ze.length&&n.moveElements(Ze,{x:0,y:ue})},X=(ne,ge)=>{if(ne){const Te=p(ne),Ke=ke(ge);if(Te.height>=Ke)return;const Ft=Ke-Te.height,ae=f(Te),We=ae?ae.y+ae.height:Te.y+Te.height;n.resizeLane(Te,{x:Te.x,y:Te.y,width:Te.width,height:Ke},!1),B(We,ae==null?void 0:ae.id,Ft);return}if(!k)return;const ue=F*(ge+1);if(k.height>=ue)return;const Ze=ue-k.height,qe=k.y+k.height;n.resizeShape(k,{x:k.x,y:k.y,width:k.width,height:ue}),B(qe,k.id,Ze)},le=(ne,ge,ue)=>{if(ne){const Ze=p(ne);return Ze.y+Math.min(Ze.height/2,V)+$(ne,ge??0)*F}return ge!==void 0&&k?k.y+N+$(`pool:${S}`,ge)*F:ue},J=(ne,ge,ue)=>{if(ne){const Ze=p(ne);return Ze.y+Math.min(Ze.height/2,V)+ge*F}return k?k.y+N+ge*F:ue},de=ne=>ne.participant?p(ne.participant):u(),Ge=30,st=(ne,ge,ue,Ze)=>{const qe=ue-ge.width/2,Te=Ze-ge.height/2;return(ne.children??[]).find(Ke=>!("waypoints"in Ke&&Ke.waypoints)&&Ke.type!=="bpmn:Lane"&&Ke.type!=="label"&&typeof Ke.x=="number"&&qe<Ke.x+Ke.width+Ge&&qe+ge.width+Ge>Ke.x&&Te<Ke.y+Ke.height&&Te+ge.height>Ke.y)},Ee=(ne,ge,ue,Ze,qe,Te)=>{const Ke=ue!==void 0||Ze!==void 0,Ft=$(ue??`pool:${S}`,Ze??0);if(Ke)for(let Ie=0;Ie<4;Ie++){const Be=J(ue,Ft+Ie,Te);if(!st(ne,ge,qe,Be))return X(ue,Ft+Ie),{x:qe,y:Be}}const ae=le(ue,Ze,Te);Ke&&X(ue,Ft);let We=qe;for(let Ie=0;Ie<64;Ie++){const Be=st(ne,ge,We,ae);if(!Be)break;We=Be.x+Be.width+H+ge.width/2}return{x:We,y:ae}},Oe=new Set(P.flows.map(ne=>ne.flow.target)),xe=new Map;for(const ne of P.nodes){if(Oe.has(ne.node.id))continue;const ge=W(ne.node,ne.band),ue=he(ne),Ze=ne.node.lane?`${ne.node.lane}|${ue??""}`:ue!==void 0?`band:${ue}`:"",qe=de(ne.node),Te=Ee(qe,ge,ne.node.lane,ue,xe.get(Ze)??z,G);n.createShape(ge,Te,qe),xe.set(Ze,Te.x+ge.width+H),!ne.node.lane&&ue===void 0&&(G+=160)}const ct=new Set,Ut=new Map,ei=new Map,un=new Map;if(S&&je.has(`pool:${S}`)){const ne=new Map;for(const ae of P.flows)ne.set(ae.flow.target,(ne.get(ae.flow.target)??0)+1);const ge=ae=>le(ae.node.lane,ce(ae),Number.NaN),ue=new Set,Ze=ae=>{var Be;const We=(Be=E.get(ae))==null?void 0:Be.node.participant;if(We)return l(We);const Ie=l(ae);if(Ie)return Ie.type==="bpmn:Participant"?Ie:f(Ie)},qe=ae=>{const We=[],Ie=new Set([ae]),Be=[ae];for(;Be.length;){const ht=Be.shift(),Qe=E.get(ht);Qe&&We.push(Qe);for(const Se of P.flows)Se.flow.source!==ht||Ie.has(Se.flow.target)||(ne.get(Se.flow.target)??0)!==1||(Ie.add(Se.flow.target),Be.push(Se.flow.target))}return We},Te=ae=>{if(!k)return;const We=new Set(ae.map(ht=>ht.node.id));let Ie=!1,Be=!1;for(const ht of g){if(!We.has(ht.flow.source))continue;const Qe=Ze(ht.flow.target);!Qe||Qe.id===k.id||(Qe.y<k.y?Ie=!0:Be=!0)}return Ie&&!Be?"up":Be&&!Ie?"down":void 0};for(const ae of P.nodes){if(!Ae(ae.node.type))continue;const We=le(ae.node.lane,he(ae),Number.NaN);if(Number.isNaN(We))continue;const Ie=[];for(const Se of P.flows){if(Se.flow.source!==ae.node.id)continue;const He=E.get(Se.flow.target);if(!He||He.node.lane!==ae.node.lane||(ne.get(He.node.id)??0)!==1)continue;const et=he(He);if(et===void 0)continue;const gn=le(He.node.lane,et,Number.NaN);if(Number.isNaN(gn))continue;const Xr=qe(He.node.id),Yt=Te(Xr);Yt&&Ie.push({subtree:Xr,band:et,row:gn,dir:Yt})}if(!Ie.some(Se=>Se.dir==="up")||!Ie.some(Se=>Se.dir==="down")||!Ie.some(Se=>Se.dir==="up"&&Ie.some(He=>He.dir==="down"&&He.row<Se.row)))continue;const ht=[...Ie].sort((Se,He)=>Se.row-He.row);[...Ie.filter(Se=>Se.dir==="up"),...Ie.filter(Se=>Se.dir==="down")].sort((Se,He)=>Se.dir===He.dir?Se.row-He.row:Se.dir==="up"?-1:1).forEach((Se,He)=>{const et=ht[He].band;if(et!==Se.band){ue.add(ae.node.id);for(const gn of Se.subtree)he(gn)===Se.band&&se.set(gn.node.id,et)}})}const Ke=ae=>{if(!k)return;const We=new Set(ae.map(ht=>ht.node.id));let Ie=!1,Be=!1;for(const ht of g){if(!We.has(ht.flow.target))continue;const Qe=Ze(ht.flow.source);!Qe||Qe.id===k.id||(Qe.y<k.y?Ie=!0:Be=!0)}return Ie&&!Be?"up":Be&&!Ie?"down":void 0};for(const ae of P.nodes){if(!Ae(ae.node.type))continue;const We=ae.node.lane??`pool:${S}`,Ie=Y.get(We);if(!Ie||Ie.size<2)continue;const Be=Ie.get(0);if(Be===void 0)continue;const ht=Math.max(...Ie.values()),Qe=Be===ht&&Be!==0?"down":void 0;if(!Qe)continue;const Se=[];for(const Yt of P.flows){if(Yt.flow.source!==ae.node.id)continue;const ti=E.get(Yt.flow.target);if(!ti||ti.node.lane!==ae.node.lane||(ne.get(ti.node.id)??0)!==1)continue;const Sx=ce(ti);Sx!==void 0&&Se.push({t:ti,subtree:qe(ti.node.id),band:Sx})}const He=Se.find(Yt=>(Ie.get(Yt.band)??Yt.band)===Be);if(!He||Ke(He.subtree)===Qe||Te(He.subtree)===Qe)continue;const et=Se.find(Yt=>Yt!==He&&Ke(Yt.subtree)===Qe);if(!et)continue;const gn=He.band,Xr=et.band;for(const Yt of He.subtree)ce(Yt)===gn&&se.set(Yt.node.id,Xr);for(const Yt of et.subtree)ce(Yt)===Xr&&se.set(Yt.node.id,gn);ue.add(ae.node.id)}for(const ae of P.nodes){if(!Ae(ae.node.type))continue;const We=ge(ae);if(Number.isNaN(We)||x.some(Se=>{var He,et;return(((He=Se.placement)==null?void 0:He.anchor)??(Se.association?Se.association.source===Se.annotation.id?Se.association.target:Se.association.source:void 0))===ae.node.id&&((et=Se.placement)==null?void 0:et.side.startsWith("bottom"))}))continue;let Be,ht=!1,Qe;for(const Se of P.flows){if(Se.flow.source!==ae.node.id)continue;const He=E.get(Se.flow.target);if(!He||!He.node.lane&&he(He)===void 0)continue;const et=ge(He);Number.isNaN(et)||(Math.abs(et-We)<.5&&(ht=!0),et>We?!Be||et>Be.row?Be={id:He.node.id,row:et,count:1}:et===Be.row&&Be.count++:et<We&&He.node.lane===ae.node.lane&&(!Qe||et>Qe.row?Qe={op:He,row:et,count:1}:et===Qe.row&&Qe.count++))}Be&&Be.count===1&&(ne.get(Be.id)??0)===1&&!ue.has(ae.node.id)&&ct.add(Be.id),!ht&&Qe&&Qe.count===1&&(ne.get(Qe.op.node.id)??0)===1&&!ee.has(ae.node.id)&&Ut.set(Qe.op.node.id,{lane:ae.node.lane,band:ce(ae)})}const Ft=new Map;for(const ae of g)Ft.set(ae.flow.target,[...Ft.get(ae.flow.target)??[],ae]);for(const ae of P.nodes){const We=Ft.get(ae.node.id);if(!We||We.length!==1||!ne.get(ae.node.id)||!ae.node.lane&&he(ae)===void 0||j.has(ae.node.id))continue;const Ie=(_x=E.get(We[0].flow.source))==null?void 0:_x.node.participant,Be=Ie?l(Ie):void 0;if(!Be||!k||Be.id===k.id)continue;const ht=ae.node.lane??`pool:${S}`,Qe=Y.get(ht);if(!Qe)continue;const Se=Qe.get(0)??0,He=(Qe.get(ce(ae)??0)??Se)-Se;if(He===0)continue;const et=Be.y<k.y;if(et&&He<0||!et&&He>0)continue;let gn;for(const[Xr,Yt]of Qe){const ti=Yt-Se;(et&&ti<0&&(!gn||ti<gn.row)||!et&&ti>0&&(!gn||ti>gn.row))&&(gn={band:Xr,row:ti})}gn&&ei.set(ae.node.id,{lane:ae.node.lane,band:gn.band})}}const $n=new Set;let _u=0;for(;_u++<P.nodes.length+2;){for(let ue=0;ue<P.nodes.length+P.flows.length+2;ue++){let Ze=!1;for(const qe of P.flows){const Te=qe.flow;if($n.has(Te.id))continue;const Ke=l(Te.source);if(!Ke)continue;const Ft=l(Te.target),ae=E.get(Te.target);if(!Ft&&ae){const We=W(ae.node,ae.band),Ie=ce(ae);if(ae.node.lane||Ie!==void 0){const Be=de(ae.node),ht=Ke,Qe=ht.x+(un.get(Te.source)??0)+ht.width+H,Se=Ut.get(Te.target)??ei.get(Te.target),He=Ee(Be,We,Se?Se.lane:ae.node.lane,Se?Se.band:Ie,ct.has(Te.target)?ht.x+ht.width/2:Qe,Number.NaN),et=n.createShape(We,He,Be);ct.has(Te.target)&&un.set(Te.target,Qe-(et.x+et.width/2)),n.connect(Ke,et,{type:"bpmn:SequenceFlow",businessObject:I(Te)})}else c.append(Ke,We,{connection:{type:"bpmn:SequenceFlow",businessObject:I(Te)}})}else if(Ft)n.connect(Ke,Ft,{type:"bpmn:SequenceFlow",businessObject:I(Te)});else continue;$n.add(Te.id),Ze=!0}if(!Ze)break}const ne=P.nodes.filter(ue=>!l(ue.node.id));if(!ne.length)break;const ge=ne[0];{const ue=W(ge.node,ge.band),Ze=de(ge.node),qe=he(ge);n.createShape(ue,Ee(Ze,ue,ge.node.lane,qe,z,G),Ze),!ge.node.lane&&qe===void 0&&(G+=160)}}}const Ue=40,pt=(S,P=()=>!0)=>{const k=l(S);if(!k)return[];const z=[k],G=new Set([S]);for(let B=0;B<z.length;B++){const X=z[B].id;for(const le of m){const J=le.flow.target;if(le.flow.source!==X||G.has(J)||!E.has(J))continue;G.add(J);const de=l(J);de&&P(de)&&z.push(de)}}return z};for(const S of qt(e,"sequenceFlow.update")){if(S.target===void 0)continue;const P=E.get(S.target);if(!P)continue;const k=l(S.target),z=l(S.id);if(!k||!z)continue;const G=S.source!==void 0?l(S.source):z.source,B=z.target;if(!G||!B||B.id===k.id)continue;const X=pt(S.target),le=new Set(X.map(Oe=>Oe.id)),J=Math.min(...X.map(Oe=>Oe.x)),de=Math.max(...X.map(Oe=>Oe.x+Oe.width)),Ge=G.x+G.width,st=de-J+Ue*2-(B.x-Ge);if(st>0){const Oe=f(k),xe=(Oe==null?void 0:Oe.children)??[],ct=un=>un.type==="bpmn:Lane",Ut=xe.filter(un=>!("waypoints"in un&&un.waypoints)&&!ct(un)&&!le.has(un.id)&&un.x>=B.x),ei=Oe?[Oe,...xe.filter(un=>ct(un))]:[];Ut.length&&n.createSpace(Ut,ei,{x:st,y:0},"e",B.x-1)}const Ee=P.node.lane||P.band!==void 0?k.y+k.height/2:G.y+G.height/2;n.moveElements(X,{x:Ge+Ue-J,y:Ee-(k.y+k.height/2)})}const Je=(S,P)=>{const k=P.target===S,z=p(P.source),G=p(P.target),B=k?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(z,G,P.id?{type:B,businessObject:i.create(B,{id:P.id})}:{type:B})},jt=100,Jt=S=>{for(const P of d){if(!P.participant.blackBox)continue;const k=l(P.participant.id);if(!k)continue;const z=[];for(const B of g){const X=B.flow.source===P.participant.id?B.flow.target:B.flow.target===P.participant.id?B.flow.source:void 0,le=X?l(X):void 0;le&&typeof le.x=="number"&&le.type!=="bpmn:Participant"&&z.push(le)}if(!z.length)continue;const G=Math.max(...z.map(B=>B.x+B.width/2))+jt;if(G>k.x+k.width&&n.resizeShape(k,{x:k.x,y:k.y,width:G-k.x,height:k.height}),!!S)for(const B of g){const X=l(B.flow.id),le=B.flow.source===P.participant.id?B.flow.target:B.flow.target===P.participant.id?B.flow.source:void 0,J=le?l(le):void 0;if(!X||!J||J.type==="bpmn:Participant")continue;const de=J.x+J.width/2;if(de<k.x+10||de>k.x+k.width-10)continue;const Ge=k.y>J.y,st=Ge?J.y+J.height:J.y,Ee=Ge?k.y:k.y+k.height,Oe=B.flow.source===P.participant.id?[{x:de,y:Ee},{x:de,y:st}]:[{x:de,y:st},{x:de,y:Ee}],xe=Vt(o),ct={...xe.edges.find(Ut=>Ut.id===B.flow.id),waypoints:Oe};Fn(ct,Pi(xe)).length||n.updateWaypoints(X,Oe)}}};Jt(!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 en=100,at=30,Ot=4,hn=S=>!("waypoints"in S&&S.waypoints)&&S.type!=="bpmn:Lane"&&S.type!=="label"&&typeof S.x=="number",oi=()=>{const S=Vt(o);return{bad:Ki(S).filter(P=>P.kind==="edge-crosses-shape"||P.kind==="edge-overlap-opposite"||P.kind==="edge-overlap-mixed").length,crossings:xd(S),straight:S.edges.filter(P=>P.type==="bpmn:MessageFlow"&&P.waypoints.length===2).length}},mn=S=>{const P=Vt(o),k=P.edges.find(z=>z.id===S);return!!k&&Fn(k,Pi(P)).length>0},Jn=(S,P,k)=>{const z=new Set(S.map(de=>de.id)),G=(P.children??[]).filter(hn).filter(de=>!z.has(de.id));if(S.some(de=>G.some(Ge=>de.x+k<Ge.x+Ge.width+at&&de.x+k+de.width+at>Ge.x&&de.y<Ge.y+Ge.height&&de.y+de.height>Ge.y)))return null;const X=P.width;n.moveElements(S,{x:k,y:0});const J=Math.max(...S.map(de=>de.x+de.width))+150-(P.x+P.width);return J>0&&n.resizeShape(P,{x:P.x,y:P.y,width:P.width+J,height:P.height}),()=>{n.moveElements(S,{x:-k,y:0}),J>0&&n.resizeShape(P,{x:P.x,y:P.y,width:X,height:P.height})}},Bn=(S,P)=>P.bad>S.bad||P.crossings>S.crossings&&P.straight<=S.straight,Et=(S,P,k,z=()=>!0)=>{const G=oi(),B=Jn(S,P,k);if(!B)return!1;const X=oi();return Bn(G,X)||!z()?(B(),!1):!0},Sr=S=>{var k;const P=(k=E.get(S))==null?void 0:k.node.participant;return!!P&&je.has(`pool:${P}`)},Rr=new Map;for(const S of g){if(!Sr(S.flow.target))continue;const P=Rr.get(S.flow.target)??[];P.push(S),Rr.set(S.flow.target,P)}const bn=[...Rr.keys()],Ye=new Set(m.map(S=>S.flow.target)),Xe=S=>Dt.findIndex(({op:P})=>P.participant.id===S);bn.sort((S,P)=>{var G,B;const k=Ye.has(S)?1:0,z=Ye.has(P)?1:0;return k!==z?k-z:Xe((G=E.get(S))==null?void 0:G.node.participant)-Xe((B=E.get(P))==null?void 0:B.node.participant)});const Ya=S=>S.x+S.width/2,px=S=>{let P;for(const k of Rr.get(S)??[]){const z=l(k.flow.source);if(!z)continue;const G=Ya(z);(!P||G>P.cx)&&(P={op:k,cx:G})}return P==null?void 0:P.op},FD=S=>{const P=px(S),k=l(S),z=P?l(P.flow.source):void 0;return k&&z?Ya(z)-Ya(k):void 0},HD=S=>{const P=FD(S);return P!==void 0&&Math.abs(P)<en},If=S=>{const P=px(S);if(!P)return null;const k=l(S),z=l(P.flow.source);if(!k||!z)return null;const G=Ya(z)-Ya(k);if(G>=en){const B=p(E.get(S).node.participant);return{subtree:pt(S,X=>X.x>=k.x),pool:B,dx:G}}if(-G>=en&&Sr(P.flow.source)){const B=p(E.get(P.flow.source).node.participant);return{subtree:pt(P.flow.source,X=>X.x>=z.x&&!HD(X.id)),pool:B,dx:-G}}return null},fx=()=>bn.map(S=>({id:S,plan:If(S)})).filter(S=>!!S.plan).sort((S,P)=>Math.min(...S.plan.subtree.map(k=>k.x))-Math.min(...P.plan.subtree.map(k=>k.x))).map(S=>S.id);for(let S=0;S<3;S++){const P=oi(),k=[];for(const G of fx()){const B=If(G);if(!B)continue;const X=Jn(B.subtree,B.pool,B.dx);X&&k.push(X)}if(!k.length)break;if(!Bn(P,oi()))continue;for(const G of k.reverse())G();let z=!1;for(const G of fx()){const B=If(G);B&&Et(B.subtree,B.pool,B.dx)&&(z=!0)}if(!z)break}for(const S of bn.flatMap(P=>Rr.get(P)??[])){if(!mn(S.flow.id))continue;const P=l(S.flow.target);if(!P)continue;const k=p(E.get(S.flow.target).node.participant),z=pt(S.flow.target,B=>B.x>=P.x),G=P.width+H;for(let B=1;B<=Ot&&!Et(z,k,G*B,()=>!mn(S.flow.id));B++);}for(const S of g){if(!mn(S.flow.id))continue;const P=l(S.flow.source),k=l(S.flow.target);if(!P||!k||P.type==="bpmn:Participant"||k.type==="bpmn:Participant")continue;const z=P.x+P.width/2;if(Math.abs(z-(k.x+k.width/2))>15)continue;const[G,B]=P.y<k.y?[P.y+P.height,k.y]:[k.y+k.height,P.y],X=[...E.values()].map(le=>l(le.node.id)).filter(le=>!!le&&le.id!==P.id&&le.id!==k.id).filter(le=>le.x<=z&&z<=le.x+le.width&&le.y+le.height>G&&le.y<B).sort((le,J)=>le.x-J.x);for(const le of X){const J=(bx=E.get(le.id))==null?void 0:bx.node.participant,de=J?l(J):void 0;if(!de)continue;const Ge=[...E.values()].filter(Ee=>Ee.node.participant===J).map(Ee=>l(Ee.node.id)).filter(Ee=>!!Ee);if(!Ge.length)continue;const st=le.width+H;for(let Ee=1;Ee<=Ot&&!Et(Ge,de,st*Ee,()=>!mn(S.flow.id));Ee++);if(!mn(S.flow.id))break}}{const S=k=>k.y+k.height/2,P=[];for(const[k,z]of E){const G=z.node.participant;if(!G||!je.has(`pool:${G}`))continue;const B=m.filter(J=>J.flow.target===k);if(B.length!==1)continue;const X=l(B[0].flow.source),le=l(k);!X||!le||!E.has(X.id)||Math.abs(S(X)-S(le))>1||le.x-(X.x+X.width)<=H+1||P.push({id:k,pred:X,node:le})}P.sort((k,z)=>k.node.x-z.node.x);for(const{id:k}of P){const z=E.get(k),G=l(k),B=l(m.find(Ee=>Ee.flow.target===k).flow.source);if(!G||!B)continue;const X=G.x-(B.x+B.width);if(X<=H+1)continue;const le=p(z.node.participant),J=pt(k,Ee=>Ee.x>=G.x),de=oi(),Ge=Jn(J,le,-(X-H));if(!Ge)continue;const st=oi();(st.bad>de.bad||st.crossings>=de.crossings)&&Ge()}}Jt(!0);for(const S of R){const P=S.associations??[],k=P.map(B=>B.source===S.dataStore.id?B.target:B.source).map(l).find(Boolean),z=k?f(k)??u():u(),G=k?{x:k.x+k.width/2,y:k.y+k.height+110}:{x:200,y:C+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:S.dataStore.id,name:S.dataStore.name})},G,z);for(const B of P)Je(S.dataStore.id,B)}for(const S of w){const k=p(S.association.target).type==="bpmn:DataStoreReference"?S.association.target:S.association.source;Je(k,S.association)}let dx=0;const zD=10,hx=(S,P)=>{for(const k of P.map(z=>f(z)).filter(z=>!!z)){const z=zD,G=k.y,B=k.y+k.height,X=k.x,le=k.x+k.width;if(Math.abs(S.y-G)<z){const J=G+z-S.y;S.y+=J,S.height-=J}if(Math.abs(S.y+S.height-B)<z&&(S.height=B-z-S.y),Math.abs(S.x-X)<z){const J=X+z-S.x;S.x+=J,S.width-=J}Math.abs(S.x+S.width-le)<z&&(S.width=le-z-S.x)}};for(const S of b){const P=(S.group.members??[]).map(l).filter(B=>!!B),k=40;let z;if(P.length){const B=Math.min(...P.map(de=>de.x))-k,X=Math.min(...P.map(de=>de.y))-k,le=Math.max(...P.map(de=>de.x+de.width))+k,J=Math.max(...P.map(de=>de.y+de.height))+k;z={x:B,y:X,width:le-B,height:J-X},hx(z,P)}else z={x:300+dx*350,y:40,width:300,height:200},dx++;const G=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:S.group.id}),width:z.width,height:z.height},{x:z.x+z.width/2,y:z.y+z.height/2},u());S.group.name&&n.updateLabel(G,S.group.name),(xx=S.group.members)!=null&&xx.length&&T(G,"bwl:Members",{refs:S.group.members.join(" ")})}const mx=S=>{const P=S.waypoints;if(P!=null&&P.length){const z=P[Math.floor((P.length-1)/2)];return{x:z.x,y:z.y,width:0,height:0}}const k=S;return{x:k.x,y:k.y,width:k.width,height:k.height}};let qa=0;const gx=12,yx=14,VD=15,GD=300,WD=S=>{const P=S.split(`
|
|
7
|
+
`),k=Math.max(...P.map(B=>Wo(B,gx))),z=Math.max(100,Math.min(GD,Math.ceil(k)+yx)),G=P.reduce((B,X)=>B+Math.max(1,Math.ceil((Wo(X,gx)+yx)/z)),0);return{width:z,height:Math.max(30,G*VD+10)}},tn=10;for(const S of x){const P=S.association,k=((wx=S.placement)==null?void 0:wx.anchor)??(P?P.source===S.annotation.id?P.target:P.source:void 0),z=k?l(k):void 0,G=z?mx(z):void 0,B=WD(S.annotation.text??"");let X;if(G&&S.placement){const[Ge,st]=Gu[S.placement.side],Ee=S.placement.offset??50;X={x:G.x+G.width/2+Ge*(G.width/2+B.width/2+Ee),y:G.y+G.height/2+st*(G.height/2+B.height/2+Ee)}}else G?(X={x:G.x+G.width/2+180+qa%3*260,y:G.y-110-qa%2*95},qa++):(X={x:300+qa*260,y:60},qa++);const le=z?f(z)??u():u(),J=le;if(G&&typeof J.x=="number"&&typeof J.width=="number"&&J.type==="bpmn:Participant"){const Ge=(ne,ge)=>{const[ue,Ze]=Gu[ne];let qe={x:G.x+G.width/2+ue*(G.width/2+B.width/2+ge),y:G.y+G.height/2+Ze*(G.height/2+B.height/2+ge)};const Te=J.x+tn+B.width/2,Ke=J.x+J.width-tn-B.width/2,Ft=J.y+tn+B.height/2,ae=J.y+J.height-tn-B.height/2,We={x:Math.min(Ke,Math.max(Te,qe.x)),y:Math.min(ae,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+B.width)/2+tn&&Math.abs(We.y-(G.y+G.height/2))<(G.height+B.height)/2+tn?{x:G.x+G.width+tn+B.width/2,y:We.y}:We),qe},st=(J.children??[]).filter(ne=>!("waypoints"in ne&&ne.waypoints)&&ne.type!=="bpmn:Lane"&&ne.type!=="label"&&typeof ne.x=="number"),Ee=Vt(o),Oe=Ee.edges.flatMap(pn),xe=cs(Ee).map(ne=>ne.rect),ct=ne=>({x0:ne.x-B.width/2-tn,x1:ne.x+B.width/2+tn,y0:ne.y-B.height/2-tn,y1:ne.y+B.height/2+tn}),Ut=ne=>{const ge=ct(ne);return st.some(ue=>ge.x0<ue.x+ue.width&&ge.x1>ue.x&&ge.y0<ue.y+ue.height&&ge.y1>ue.y)},ei=ne=>{const ge=ct(ne);return Oe.some(ue=>ue.axis==="h"?ue.at>ge.y0&&ue.at<ge.y1&&ue.lo<ge.x1&&ue.hi>ge.x0:ue.at>ge.x0&&ue.at<ge.x1&&ue.lo<ge.y1&&ue.hi>ge.y0)},un=ne=>{const ge=ct(ne);return xe.some(ue=>ge.x0<ue.x+ue.width&&ge.x1>ue.x&&ge.y0<ue.y+ue.height&&ge.y1>ue.y)},$n=ne=>Ut(ne)||ei(ne)||un(ne),_u=ne=>ne.x-B.width/2>=J.x&&ne.x+B.width/2<=J.x+J.width&&ne.y-B.height/2>=J.y&&ne.y+B.height/2<=J.y+J.height;if(S.placement){const ne=Te=>Te.startsWith("top")?Te.replace(/^top/,"bottom"):Te.replace(/^bottom/,"top"),ge=Te=>Te.endsWith("left")?Te.replace(/left$/,"right"):Te.replace(/right$/,"left"),ue=S.placement.side,Ze=[ue,ne(ue),ge(ue),ne(ge(ue)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],qe=S.placement.offset??50;if(X=Ge(ue,qe),$n(X)){const Te=new Set;for(const Ke of Ze){if(Te.has(Ke))continue;Te.add(Ke);const Ft=Ge(Ke,qe);if(_u(Ft)&&!$n(Ft)){X=Ft;break}}}}else{const ne=J.x+tn+B.width/2,ge=J.x+J.width-tn-B.width/2,ue=J.y+tn+B.height/2,Ze=J.y+J.height-tn-B.height/2;if(X={x:Math.min(ge,Math.max(ne,X.x)),y:Math.min(Ze,Math.max(ue,X.y))},$n(X)){const qe=(G.width+B.width)/2+tn,Ke=[{x:X.x+qe,y:X.y},{x:X.x-qe,y:X.y},{x:X.x,y:X.y-B.height-tn},{x:X.x,y:X.y+B.height+tn}].filter(_u).find(Ft=>!$n(Ft));Ke&&(X=Ke)}}}const de=n.createShape({type:"bpmn:TextAnnotation",width:B.width,height:B.height,businessObject:i.create("bpmn:TextAnnotation",{id:S.annotation.id,text:S.annotation.text})},X,le);if(P){const Ge=st=>st===S.annotation.id?de:p(st);n.connect(Ge(P.source),Ge(P.target),P.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:P.id})}:{type:"bpmn:Association"})}S.placement&&T(de,"bwl:Placement",L(S.placement))}for(const S of qt(e,"association.add")){const P=S.association;n.connect(p(P.source),p(P.target),P.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:P.id})}:{type:"bpmn:Association"})}for(const S of qt(e,"node.update")){let P=p(S.id);if(S.type&&hs(S.type)!==P.type&&(P=s.replaceElement(P,{type:hs(S.type)})),S.name!==void 0&&n.updateProperties(P,{name:S.name??void 0}),S.lane){const k=p(S.lane),z=k.y+k.height/2-(P.y+P.height/2);z!==0&&n.moveElements([P],{x:0,y:z})}}for(const S of qt(e,"sequenceFlow.update")){const P=p(S.id);if(S.source!==void 0||S.target!==void 0){const k=P,z=S.source!==void 0?p(S.source):k.source,G=S.target!==void 0?p(S.target):k.target,B=X=>({x:X.x+X.width/2,y:X.y+X.height/2});n.reconnect(k,z,G,[B(z),B(G)])}S.name!==void 0&&n.updateProperties(P,{name:S.name??void 0}),S.condition!==void 0&&n.updateProperties(P,{name:((Ex=S.condition)==null?void 0:Ex.label)??void 0})}for(const S of qt(e,"messageFlow.update"))S.name!==void 0&&n.updateProperties(p(S.id),{name:S.name??void 0});for(const S of qt(e,"dataStore.update"))S.name!==void 0&&n.updateProperties(p(S.id),{name:S.name??void 0});for(const S of qt(e,"annotation.update")){const P=p(S.id);if(S.text!==void 0&&n.updateProperties(P,{text:S.text}),S.placement===null)T(P,"bwl:Placement",null);else if(S.placement){const k=mx(p(S.placement.anchor)),[z,G]=Gu[S.placement.side],B=S.placement.offset??50,X=k.x+k.width/2+z*(k.width/2+P.width/2+B),le=k.y+k.height/2+G*(k.height/2+P.height/2+B);n.moveElements([P],{x:X-(P.x+P.width/2),y:le-(P.y+P.height/2)}),T(P,"bwl:Placement",L(S.placement))}}for(const S of qt(e,"group.update")){const P=p(S.id);if(S.name!==void 0&&n.updateLabel(P,S.name??""),S.members){const k=S.members.map(l).filter(z=>!!z);if(k.length){const G=Math.min(...k.map(de=>de.x))-40,B=Math.min(...k.map(de=>de.y))-40,X=Math.max(...k.map(de=>de.x+de.width))+40,le=Math.max(...k.map(de=>de.y+de.height))+40,J={x:G,y:B,width:X-G,height:le-B};hx(J,k),n.resizeShape(P,J)}T(P,"bwl:Members",{refs:S.members.join(" ")})}}}function nh(e,t,n=th){const i=eh(e),r=Qd(t,Ad(i.elementRegistry)),o={edgeCrossings:{before:0,after:0,pairs:[]}};if(r.length)return{ok:!1,issues:r,findings:[],stats:o};const a=Vt(i.elementRegistry),c=new Set(Ki(a).map(qi)),s=new Set(a.edges.map(m=>m.id)),u=new Set(a.shapes.map(m=>m.id)),l=Hu(a).length,p=e.get("commandStack");try{Ff(p,()=>{n(t,i),Bd(i,s),Ld(i,c),Vd(i,c,s),Hd(i,s),zw(i,s),Yd(i,c,s),Ud(i,s),Kd(i,u)})}catch(m){return{ok:!1,issues:[{kind:"lower-failed",message:m instanceof Error?m.message:String(m)}],findings:[],stats:o}}const f=Vt(i.elementRegistry),d=Ki(f).filter(m=>!c.has(qi(m))),h=Hu(f);return{ok:!0,issues:[],findings:d,stats:{edgeCrossings:{before:l,after:h.length,pairs:h}}}}function eE(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function tE(e,t){return typeof e.get=="function"?e.get(t):e[t]}function ih(e,t){const n=tE(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function rh(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function nE(e){return typeof e=="string"&&xu.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 oh(e){const t=e.rootElements??[],n=t.find(Y=>Y.$type==="bpmn:Collaboration"),i=new Map(t.filter(Y=>Y.$type==="bpmn:Process").map(Y=>[Y.id,Y])),r=[],o=[],a=[],c=[],s=[],u=[],l={poolOrders:{},bands:{},placements:{}},p=[],f=[],d=[],h=[],m=[],g=[],R=new Set,w=new Set,x=Y=>{Y&&R.add(Y)},b=Y=>{R.add(Y),w.add(Y)},E=Y=>{const fe=rh(Y,"bwl:Placement");if(!fe)return;const he=typeof fe.anchor=="string"?fe.anchor:void 0;if(!he||!nE(fe.side))return;const se=typeof fe.offset=="number"?fe.offset:void 0;m.push({owner:Y.id,anchor:he,side:fe.side,...se!==void 0?{offset:se}:{}})},T=Y=>{const fe=rh(Y,"bwl:Members"),he=typeof(fe==null?void 0:fe.refs)=="string"?fe.refs.split(/\s+/).filter(Boolean):[];he.length&&g.push({owner:Y.id,refs:he})},L=Y=>{var fe;for(const he of Y)switch(x(he.id),he.$type){case"bpmn:TextAnnotation":b(he.id),c.push({id:he.id,text:typeof he.text=="string"?he.text:""}),E(he);break;case"bpmn:Association":d.push({id:he.id,type:he.$type,source:ui(he.sourceRef),target:ui(he.targetRef)});break;case"bpmn:Group":{b(he.id);const se=(fe=he.categoryValueRef)==null?void 0:fe.value;s.push({id:he.id,...typeof se=="string"&&se?{name:se}:{}}),T(he);break}default:u.push({id:he.id,type:he.$type,reason:"type-outside-mvp"})}},A=(Y,fe)=>{const he=Y.flowElements??[],se=(Y.laneSets??[]).flatMap(ee=>ee.lanes??[]),ce=new Map;for(const ee of se){x(ee.id);for(const j of ee.flowNodeRef??[]){const $=ui(j);$&&ce.set($,ee.id)}}for(const ee of he){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 j=eE(ee.$type);if(!Nf(j)){u.push({id:ee.id,type:ee.$type,reason:"type-outside-mvp"});continue}b(ee.id),o.push({id:ee.id,type:j,...ee.name?{name:ee.name}:{},...fe?{participant:fe}:{},...ce.has(ee.id)?{lane:ce.get(ee.id)}:{}});const $=ih(ee,"bwl:band");$!==void 0&&(l.bands[ee.id]=$);for(const U of ee.dataOutputAssociations??[])x(U.id),h.push({id:U.id,type:U.$type,source:ee.id,target: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(Y.artifacts??[])};if(n){const Y=new Set;for(const fe of n.participants??[]){b(fe.id);const he=ui(fe.processRef);he&&Y.add(he);const se=he?i.get(he):void 0,ce=((se==null?void 0:se.laneSets)??[]).flatMap(U=>U.lanes??[]),ee=ce.map(U=>({id:U.id,...U.name?{name:U.name}:{}}));for(const U of ee)b(U.id);const j=!se||(se.flowElements??[]).length===0&&ce.length===0&&(se.artifacts??[]).length===0;r.push({id:fe.id,...fe.name?{name:fe.name}:{},...j?{blackBox:!0}:{},...ee.length?{lanes:ee}:{}});const $=ih(fe,"bwl:poolOrder");$!==void 0&&(l.poolOrders[fe.id]=$),se&&A(se,fe.id)}for(const fe of n.messageFlows??[])x(fe.id),f.push({id:fe.id,source:ui(fe.sourceRef),target:ui(fe.targetRef),...typeof fe.name=="string"&&fe.name?{name:fe.name}:{}});L(n.artifacts??[]);for(const[fe,he]of i)!Y.has(fe)&&(he.flowElements??[]).length>0&&u.push({id:fe,type:he.$type,reason:"unreachable-process"})}else for(const Y of i.values())A(Y);const F=[],H=[],N=[],V=[],pe=(Y,fe)=>!!Y&&!!fe&&w.has(Y)&&w.has(fe);for(const Y of p){if(!pe(Y.source,Y.target)){u.push({id:Y.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}F.push({id:Y.id,source:Y.source,target:Y.target,...Y.name?{name:Y.name}:{}}),w.add(Y.id)}for(const Y of f){if(!pe(Y.source,Y.target)){u.push({id:Y.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}H.push({id:Y.id,source:Y.source,target:Y.target,...Y.name?{name:Y.name}:{}}),w.add(Y.id)}for(const Y of h){if(!pe(Y.source,Y.target)){u.push({id:Y.id??"",type:Y.type,reason:"endpoint-outside-mvp"});continue}V.push({...Y.id?{id:Y.id}:{},source:Y.source,target:Y.target}),Y.id&&w.add(Y.id)}for(const Y of d){if(!pe(Y.source,Y.target)){u.push({id:Y.id??"",type:Y.type,reason:"endpoint-outside-mvp"});continue}N.push({...Y.id?{id:Y.id}:{},source:Y.source,target:Y.target})}const je=new Map(s.map(Y=>[Y.id,Y]));for(const{owner:Y,refs:fe}of g){const he=fe.filter(ce=>R.has(ce)),se=je.get(Y);se&&he.length&&(se.members=he)}for(const Y of m)R.has(Y.anchor)&&(l.placements[Y.owner]={anchor:Y.anchor,side:Y.side,...Y.offset!==void 0?{offset:Y.offset}:{}});return{definition:{...r.length?{participants:r}:{},nodes:o,sequenceFlows:F,...H.length?{messageFlows:H}:{},...a.length?{dataStores:a}:{},...V.length?{dataAssociations:V}:{},...c.length?{annotations:c}:{},...N.length?{associations:N}:{},...s.length?{groups:s}:{}},hints:l,omitted:u}}async function iE(e){const{definitions:t,warnings:n}=await $u(e);return{...oh(t),warnings:n}}function rE(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function ah(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=nh(e,t.ops);if(!i.ok)return{status:"rejected",issues:i.issues};const{xml:r}=await e.saveXML({format:!0});return{status:"applied",version:n+1,xml:r??"",findings:i.findings,stats:i.stats}}const oE=Symbol("bpmn-editor");function aE(){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 c(){if(!i)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return i}function s(){return i==null?void 0:i.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,attach(u){i&&this.detach(),i=u,i.get("eventBus").on("commandStack.changed",o),t.value||a(i,!1)},detach(){i==null||i.get("eventBus").off("commandStack.changed",o),i&&!t.value&&a(i,!0),r=void 0,i=void 0},setEditable(u){t.value=u,i&&a(i,u)},async applyAgentBatch(u,l){const p=c();n.value=!0;try{const f=await ah(p,u,{currentVersion:l});return f.status==="applied"&&(e.value=!1),f}finally{n.value=!1}},async importXml(u){const{warnings:l}=await c().importXML(u);return e.value=!1,{warnings:ju(l)}},async saveXml(){const{xml:u}=await c().saveXML({format:!0});return e.value=!1,u??""},undo:()=>{var u;return(u=s())==null?void 0:u.undo()},redo:()=>{var u;return(u=s())==null?void 0:u.redo()},canUndo:()=>{var u;return((u=s())==null?void 0:u.canUndo())??!1},canRedo:()=>{var u;return((u=s())==null?void 0:u.canRedo())??!1}}}function ie(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function sE(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Wu={exports:{}},sh;function cE(){if(sh)return Wu.exports;sh=1;var e=Wu.exports=function(t,n){if(n||(n=16),t===void 0&&(t=128),t<=0)return"0";for(var i=Math.log(Math.pow(2,t))/Math.log(n),r=2;i===1/0;r*=2)i=Math.log(Math.pow(2,t/r))/Math.log(n)*r;for(var o=i-Math.floor(i),a="",r=0;r<Math.floor(i);r++){var c=Math.floor(Math.random()*n).toString(n);a=c+a}if(o){var s=Math.pow(n,o),c=Math.floor(Math.random()*s).toString(n);a=c+a}var u=parseInt(a,n);return u!==1/0&&u>=Math.pow(2,t)?e(t,n):a};return e.rack=function(t,n,i){var r=function(a){var c=0;do{if(c++>10)if(i)t+=i;else throw new Error("too many ID collisions, use more bits");var s=e(t,n)}while(Object.hasOwnProperty.call(o,s));return o[s]=a,s},o=r.hats={};return r.get=function(a){return r.hats[a]},r.set=function(a,c){return r.hats[a]=c,r},r.bits=t||128,r.base=n||16,r},Wu.exports}var uE=cE(),lE=sE(uE);function li(e){if(!(this instanceof li))return new li(e);e=e||[128,36,1],this._seed=e.length?lE.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,c=t.createElement("div");for(c.innerHTML=o+e+a;r--;)c=c.lastChild;if(c.firstChild===c.lastChild){const{firstChild:l}=c;return l.remove(),l}const s=t.createDocumentFragment();return s.append(...c.childNodes),s}function pE(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 an(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const fE=Object.prototype.toString;function dt(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 fE.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 ms(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Or(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function dE(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var gs={},ch;function hE(){if(ch)return gs;ch=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return gs.bind=function(r,o,a,c){return e||i(),r[e](n+o,a,c||!1),a},gs.unbind=function(r,o,a,c){return t||i(),r[t](n+o,a,c||!1),a},gs}var uh=hE(),mE=dE(uh),Re=pE({__proto__:null,default:mE},[uh]),lh=["focus","blur"];function gE(e,t,n,i,r){return lh.indexOf(n)!==-1&&(r=!0),Re.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=Or(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function yE(e,t,n,i){return lh.indexOf(t)!==-1&&(i=!0),Re.unbind(e,t,n,i)}var Rn={bind:gE,unbind:yE};function Uu(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function tt(e,t){return t=t||document,t.querySelector(e)}function ys(e,t){return t=t||document,t.querySelectorAll(e)}function pi(e){e.parentNode&&e.parentNode.removeChild(e)}function vE(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function _E(e,t){return t.appendChild(vE(e,t))}function Ce(e,t){return _E(t,e),e}var Yu=2,ph={"alignment-baseline":1,"baseline-shift":1,clip:1,"clip-path":1,"clip-rule":1,color:1,"color-interpolation":1,"color-interpolation-filters":1,"color-profile":1,"color-rendering":1,cursor:1,direction:1,display:1,"dominant-baseline":1,"enable-background":1,fill:1,"fill-opacity":1,"fill-rule":1,filter:1,"flood-color":1,"flood-opacity":1,font:1,"font-family":1,"font-size":Yu,"font-size-adjust":1,"font-stretch":1,"font-style":1,"font-variant":1,"font-weight":1,"glyph-orientation-horizontal":1,"glyph-orientation-vertical":1,"image-rendering":1,kerning:1,"letter-spacing":1,"lighting-color":1,marker:1,"marker-end":1,"marker-mid":1,"marker-start":1,mask:1,opacity:1,overflow:1,"pointer-events":1,"shape-rendering":1,"stop-color":1,"stop-opacity":1,stroke:1,"stroke-dasharray":1,"stroke-dashoffset":1,"stroke-linecap":1,"stroke-linejoin":1,"stroke-miterlimit":1,"stroke-opacity":1,"stroke-width":Yu,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function bE(e,t){return ph[t]?e.style[t]:e.getAttributeNS(null,t)}function fh(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=ph[i];r?(r===Yu&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function xE(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)fh(e,r,t[r])}function re(e,t,n){if(typeof t=="string")if(n!==void 0)fh(e,t,n);else return bE(e,t);else xE(e,t);return e}const wE=Object.prototype.toString;function Fe(e){return new Zi(e)}function Zi(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Zi.prototype.add=function(e){return this.list.add(e),this},Zi.prototype.remove=function(e){return wE.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Zi.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},Zi.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Zi.prototype.array=function(){return Array.from(this.list)},Zi.prototype.has=Zi.prototype.contains=function(e){return this.list.contains(e)};function vs(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function dh(e){return e.cloneNode(!0)}var qu={svg:"http://www.w3.org/2000/svg"},hh='<svg xmlns="'+qu.svg+'"';function EE(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(qu.svg)===-1&&(e=hh+e.substring(4)):(e=hh+">"+e+"</svg>",t=!0);var n=SE(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function SE(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function me(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=EE(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(qu.svg,e),t&&re(n,t),n}var Ku=null;function mh(){return Ku===null&&(Ku=me("svg")),Ku}function gh(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function RE(e,t,n,i,r,o){var a=mh().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return gh(a,e);case 6:return gh(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function Uo(e){return mh().createSVGTransform()}var yh=/([&<>]{1})/g,CE=/([&<>\n\r"]{1})/g,PE={"&":"&","<":"<",">":">",'"':"'"};function Xu(e,t){function n(i,r){return PE[r]||r}return e.replace(t,n)}function vh(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(Xu(e.textContent,yh));break;case 1:if(t.push("<",e.tagName),e.hasAttributes())for(r=e.attributes,n=0,i=r.length;n<i;++n)o=r.item(n),t.push(" ",o.name,'="',Xu(o.value,CE),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)vh(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",Xu(e.nodeValue,yh),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function AE(e){for(var t=e.firstChild,n=[];t;)vh(t,n),t=t.nextSibling;return n.join("")}function _h(e,t){return AE(e)}function Nt(e){var t=e.parentNode;return t&&t.removeChild(e),e}function TE(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function ME(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(TE(e,i))}function Yo(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),ME(n,t)),n.consolidate()}const kE=/^class[ {]/;function DE(e){return kE.test(e.toString())}function Zu(e){return Array.isArray(e)}function Qu(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function _s(...e){e.length===1&&Zu(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const OE=/constructor\s*[^(]*\(\s*([^)]*)\)/m,LE=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,IE=/\/\*([^*]*)\*\//m;function NE(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(DE(e)?OE:LE);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(IE);return(r&&r[1]||i).trim()})||[]}function bh(e,t){const n=t||{get:function(x,b){if(i.push(x),b===!1)return null;throw c(`No provider for "${x}"!`)}},i=[],r=this._providers=Object.create(n._providers||null),o=this._instances=Object.create(null),a=o.injector=this,c=function(x){const b=i.join(" -> ");return i.length=0,new Error(b?`${x} (Resolving: ${b})`:x)};function s(x,b){if(!r[x]&&x.includes(".")){const E=x.split(".");let T=s(E.shift());for(;E.length;)T=T[E.shift()];return T}if(Qu(o,x))return o[x];if(Qu(r,x)){if(i.indexOf(x)!==-1)throw i.push(x),c("Cannot resolve circular dependency!");return i.push(x),o[x]=r[x][0](r[x][1]),i.pop(),o[x]}return n.get(x,b)}function u(x,b){if(typeof b>"u"&&(b={}),typeof x!="function")if(Zu(x))x=_s(x.slice());else throw c(`Cannot invoke "${x}". Expected a function!`);const T=(x.$inject||NE(x)).map(L=>Qu(b,L)?b[L]:s(L));return{fn:x,dependencies:T}}function l(x){const{fn:b,dependencies:E}=u(x),T=Function.prototype.bind.call(b,null,...E);return new T}function p(x,b,E){const{fn:T,dependencies:L}=u(x,E);return T.apply(b,L)}function f(x){return _s(b=>x.get(b))}function d(x,b){if(b&&b.length){const E=Object.create(null),T=Object.create(null),L=[],A=[],F=[];let H,N,V,pe;for(let je in r)H=r[je],b.indexOf(je)!==-1&&(H[2]==="private"?(N=L.indexOf(H[3]),N===-1?(V=H[3].createChild([],b),pe=f(V),L.push(H[3]),A.push(V),F.push(pe),E[je]=[pe,je,"private",V]):E[je]=[F[N],je,"private",A[N]]):E[je]=[H[2],H[1]],T[je]=!0),(H[2]==="factory"||H[2]==="type")&&H[1].$scope&&b.forEach(lt=>{H[1].$scope.indexOf(lt)!==-1&&(E[je]=[H[2],H[1]],T[lt]=!0)});b.forEach(je=>{if(!T[je])throw new Error('No provider for "'+je+'". Cannot use provider from the parent!')}),x.unshift(E)}return new bh(x,a)}const h={factory:p,type:l,value:function(x){return x}};function m(x,b){const E=x.__init__||[];return function(){E.forEach(T=>{typeof T=="string"?b.get(T):b.invoke(T)})}}function g(x){const b=x.__exports__;if(b){const E=x.__modules__,T=Object.keys(x).reduce((N,V)=>(V!=="__exports__"&&V!=="__modules__"&&V!=="__init__"&&V!=="__depends__"&&(N[V]=x[V]),N),Object.create(null)),L=(E||[]).concat(T),A=d(L),F=_s(function(N){return A.get(N)});b.forEach(function(N){r[N]=[F,N,"private",A]});const H=(x.__init__||[]).slice();return H.unshift(function(){A.init()}),x=Object.assign({},x,{__init__:H}),m(x,A)}return Object.keys(x).forEach(function(E){if(E==="__init__"||E==="__depends__")return;const T=x[E];if(T[2]==="private"){r[E]=T;return}const L=T[0],A=T[1];r[E]=[h[L],BE(L,A),L]}),m(x,a)}function R(x,b){return x.indexOf(b)!==-1||(x=(b.__depends__||[]).reduce(R,x),x.indexOf(b)!==-1)?x:x.concat(b)}function w(x){const b=x.reduce(R,[]).map(g);let E=!1;return function(){E||(E=!0,b.forEach(T=>T()))}}this.get=s,this.invoke=p,this.instantiate=l,this.createChild=d,this.init=w(e)}function BE(e,t){return e!=="value"&&Zu(t)&&(t=_s(t.slice())),t}var $E=1e3;function Ai(e,t){var n=this;t=t||$E,e.on(["render.shape","render.connection"],t,function(i,r){var o=i.type,a=r.element,c=r.gfx,s=r.attrs;if(n.canRender(a))return o==="render.shape"?n.drawShape(c,a,s):n.drawConnection(c,a,s)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(i,r){if(n.canRender(r))return i.type==="render.getShapePath"?n.getShapePath(r):n.getConnectionPath(r)})}Ai.prototype.canRender=function(e){},Ai.prototype.drawShape=function(e,t){},Ai.prototype.drawConnection=function(e,t){},Ai.prototype.getShapePath=function(e){},Ai.prototype.getConnectionPath=function(e){};function Lr(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function jE(e){return["M",e.x,e.y]}function Ju(e){return["L",e.x,e.y]}function FE(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function HE(e,t){const n=e.length,i=[jE(e[0])];for(let r=1;r<n;r++){const o=e[r-1],a=e[r],c=e[r+1];if(!c||!t){i.push(Ju(a));continue}const s=Math.min(t,el(a.x-o.x,a.y-o.y),el(c.x-a.x,c.y-a.y));if(!s){i.push(Ju(a));continue}const u=bs(a,o,s),l=bs(a,o,s*.5),p=bs(a,c,s),f=bs(a,c,s*.5);i.push(Ju(u)),i.push(FE(l,f,p))}return i}function bs(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=el(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function el(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function qo(e,t,n){we(t)&&(n=t,t=null),t||(t={});const i=me("path",t);return we(n)&&(i.dataset.cornerRadius=String(n)),tl(i,e)}function tl(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return re(e,{d:Lr(HE(t,n))}),e}function xs(e){var t=new Set(e);return Le(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function Ir(e,t,n){n=n||0,ve(e)||(e=[e]),M(e,function(i,r){var o=t(i,r,n);ve(o)&&o.length&&Ir(o,t,n+1)})}function nl(e,t,n){var i=new Set,r=new Set;return Ir(e,function(o,a,c){i.add(o);var s=o.children;if(s&&!r.has(s))return r.add(s),s}),Array.from(i)}function Ko(e,t){return nl(e)}function zE(e,t,n){Cr(t)&&(t=!0),Ht(t)&&(n=t,t=!0),n=n||{};var i=Xo(n.allShapes),r=Xo(n.allConnections),o=Xo(n.enclosedElements),a=Xo(n.enclosedConnections),c=Xo(n.topLevel,t&&eo(e,function(l){return l.id}));function s(l){c[l.source.id]&&c[l.target.id]&&(c[l.id]=[l]),i[l.source.id]&&i[l.target.id]&&(a[l.id]=o[l.id]=l),r[l.id]=l}function u(l){if(o[l.id]=l,l.waypoints)a[l.id]=r[l.id]=l;else return i[l.id]=l,M(l.incoming,s),M(l.outgoing,s),l.children}return Ir(e,u),{allShapes:i,allConnections:r,topLevel:c,enclosedConnections:a,enclosedElements:o}}function Ct(e,t){t=!!t,ve(e)||(e=[e]);var n,i,r,o;return M(e,function(a){var c=a;a.waypoints&&!t&&(c=Ct(a.waypoints,!0));var s=c.x,u=c.y,l=c.height||0,p=c.width||0;(s<n||n===void 0)&&(n=s),(u<i||i===void 0)&&(i=u),(s+p>r||r===void 0)&&(r=s+p),(u+l>o||o===void 0)&&(o=u+l)}),{x:n,y:i,height:o-i,width:r-n}}function ao(e,t){var n={};return M(e,function(i){var r=i;r.waypoints&&(r=Ct(r)),!we(t.y)&&r.x>t.x&&(n[i.id]=i),!we(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(we(t.width)&&we(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!we(t.width)||!we(t.height))&&(n[i.id]=i)}),n}function xh(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function wh(e){return!!(e&&e.isFrame)}function Xo(e,t){return O({},e||{},t||{})}var VE=1;function Qi(e,t){Ai.call(this,e,VE),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(Qi,Ai),Qi.prototype.canRender=function(){return!0},Qi.prototype.drawShape=function(t,n,i){var r=me("rect");return re(r,{x:0,y:0,width:n.width||0,height:n.height||0}),wh(n)?re(r,O({},this.FRAME_STYLE,i||{})):re(r,O({},this.SHAPE_STYLE,i||{})),Ce(t,r),r},Qi.prototype.drawConnection=function(t,n,i){var r=qo(n.waypoints,O({},this.CONNECTION_STYLE,i||{}));return Ce(t,r),r},Qi.prototype.getShapePath=function(t){var n=t.x,i=t.y,r=t.width,o=t.height,a=[["M",n,i],["l",r,0],["l",0,o],["l",-r,0],["z"]];return Lr(a)},Qi.prototype.getConnectionPath=function(t){var n=t.waypoints,i,r,o=[];for(i=0;r=n[i];i++)r=r.original||r,o.push([i===0?"M":"L",r.x,r.y]);return Lr(o)},Qi.$inject=["eventBus","styles"];function GE(){var e={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},t=this;this.cls=function(n,i,r){var o=this.style(i,r);return O(o,{class:n})},this.style=function(n,i){!ve(n)&&!i&&(i=n,n=[]);var r=En(n,function(o,a){return O(o,e[a]||{})},{});return i?O(r,i):r},this.computeStyle=function(n,i,r){return ve(i)||(r=i,i=[]),t.style(i||[],O({},r,n||{}))}}const WE={__init__:["defaultRenderer"],defaultRenderer:["type",Qi],styles:["type",GE]};function xt(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function wt(e,t,n){if(!(!e||!t)){typeof n!="number"&&(n=-1);var i=e.indexOf(t);if(i!==-1){if(i===n)return;if(n!==-1)e.splice(i,1);else return}n!==-1?e.splice(n,0,t):e.push(t)}}function il(e,t){return!e||!t?-1:e.indexOf(t)}function Zo(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function rl(e,t,n,i){if(typeof i>"u"&&(i=5),!e||!t||!n)return!1;var r=(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),o=Zo(e,t);return Math.abs(r/o)<=i}var UE=2;function Ti(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(YE(r,n))return o;return!1}function YE(e,t){const n=t[0];return Pr(t,function(i){return Math.abs(n[e]-i[e])<=UE})}function Eh(e,t,n){return n=n||0,e.x>t.x-n&&e.y>t.y-n&&e.x<t.x+t.width+n&&e.y<t.y+t.height+n}function ol(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var qE=/,?([a-z]),?/gi,Sh=parseFloat,Pt=Math,Ji=Pt.PI,fi=Pt.min,di=Pt.max,Rh=Pt.pow,er=Pt.abs,KE=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,XE=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,Ch=Array.isArray||function(e){return e instanceof Array};function ZE(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function QE(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 JE(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 ZE(r,i)?(QE(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function e1(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(KE,function(i,r,o){var a=[],c=r.toLowerCase();for(o.replace(XE,function(s,u){u&&a.push(+u)}),c=="m"&&a.length>2&&(n.push([r,...a.splice(0,2)]),c="l",r=r=="m"?"l":"L");a.length>=t[c]&&(n.push([r,...a.splice(0,t[c])]),!!t[c]););}),n.toString=sl,n}function t1(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 n1(e){for(var t=0,n=e.length;t<n;t++){var i=e[t][0];if(i!=="M"&&i!=="C")return!1}return!0}function al(e,t,n,i){return arguments.length===1&&(t=e.y,n=e.width,i=e.height,e=e.x),{x:e,y:t,width:n,height:i,x2:e+n,y2:t+i}}function sl(){return this.join(",").replace(qE,"$1")}function i1(e){for(var t=new Array(e.length),n=0,i=e.length;n<i;n++)for(var r=e[n],o=t[n]=new Array(r.length),a=0,c=r.length;a<c;a++)o[a]=r[a];return t.toString=sl,t}function Ph(e,t,n,i,r,o,a,c,s){var u=1-s,l=Rh(u,3),p=Rh(u,2),f=s*s,d=f*s,h=l*e+p*3*s*n+u*3*s*s*r+d*a,m=l*t+p*3*s*i+u*3*s*s*o+d*c;return{x:ws(h),y:ws(m)}}function Ah(e){var t=u1(...e);return al(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function tr(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function r1(e,t){return e=al(e),t=al(t),tr(t,e.x,e.y)||tr(t,e.x2,e.y)||tr(t,e.x,e.y2)||tr(t,e.x2,e.y2)||tr(e,t.x,t.y)||tr(e,t.x2,t.y)||tr(e,t.x,t.y2)||tr(e,t.x2,t.y2)||(e.x<t.x2&&e.x>t.x||t.x<e.x2&&t.x>e.x)&&(e.y<t.y2&&e.y>t.y||t.y<e.y2&&t.y>e.y)}function Th(e,t,n,i,r){var o=-3*t+9*n-9*i+3*r,a=e*o+6*t-12*n+6*i;return e*a-3*t+3*n}function Mh(e,t,n,i,r,o,a,c,s){s==null&&(s=1),s=s>1?1:s<0?0:s;for(var u=s/2,l=12,p=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],f=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,h=0;h<l;h++){var m=u*p[h]+u,g=Th(m,e,n,r,a),R=Th(m,t,i,o,c),w=g*g+R*R;d+=f[h]*Pt.sqrt(w)}return u*d}function o1(e,t,n,i,r,o,a,c){if(!(di(e,n)<fi(r,a)||fi(e,n)>di(r,a)||di(t,i)<fi(o,c)||fi(t,i)>di(o,c))){var s=(e*i-t*n)*(r-a)-(e-n)*(r*c-o*a),u=(e*i-t*n)*(o-c)-(t-i)*(r*c-o*a),l=(e-n)*(o-c)-(t-i)*(r-a);if(l){var p=ws(s/l),f=ws(u/l),d=+p.toFixed(2),h=+f.toFixed(2);if(!(d<+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,c).toFixed(2)||h>+di(o,c).toFixed(2)))return{x:p,y:f}}}}function ws(e){return Math.round(e*1e11)/1e11}function a1(e,t,n){var i=Ah(e),r=Ah(t);if(!r1(i,r))return[];var o=Mh(...e),a=Mh(...t),c=Dh(e)?1:~~(o/5)||1,s=Dh(t)?1:~~(a/5)||1,u=new Array(c+1),l=new Array(s+1),p={},f=[],d,h;for(d=0;d<c+1;d++){var m=Ph(...e,d/c);u[d]={x:m.x,y:m.y,t:d/c}}for(d=0;d<s+1;d++)m=Ph(...t,d/s),l[d]={x:m.x,y:m.y,t:d/s};for(d=0;d<c;d++)for(h=0;h<s;h++){var g=u[d],R=u[d+1],w=l[h],x=l[h+1],b=er(R.x-g.x)<.01?"y":"x",E=er(x.x-w.x)<.01?"y":"x",T=o1(g.x,g.y,R.x,R.y,w.x,w.y,x.x,x.y),L;if(T){if(L=T.x.toFixed(9)+"#"+T.y.toFixed(9),p[L])continue;p[L]=!0;var A=g.t+er((T[b]-g[b])/(R[b]-g[b]))*(R.t-g.t),F=w.t+er((T[E]-w[E])/(x[E]-w[E]))*(x.t-w.t);A>=0&&A<=1&&F>=0&&F<=1&&f.push({x:T.x,y:T.y,t1:A,t2:F})}}return f}function kh(e,t,n){e=Ih(e),t=Ih(t);for(var i,r,o,a,c,s,u,l,p,f,d=n?0:[],h=0,m=e.length;h<m;h++){var g=e[h];if(g[0]=="M")i=c=g[1],r=s=g[2];else{g[0]=="C"?(p=[i,r,...g.slice(1)],i=p[6],r=p[7]):(p=[i,r,i,r,c,s,c,s],i=c,r=s);for(var R=0,w=t.length;R<w;R++){var x=t[R];if(x[0]=="M")o=u=x[1],a=l=x[2];else{x[0]=="C"?(f=[o,a,...x.slice(1)],o=f[6],a=f[7]):(f=[o,a,o,a,u,l,u,l],o=u,a=l);var b=a1(p,f);{for(var E=0,T=b.length;E<T;E++)b[E].segment1=h,b[E].segment2=R,b[E].bez1=p,b[E].bez2=f;d=d.concat(b)}}}}}return d}function s1(e){return Ch(e)&&Ch(e[0])}function c1(e){if(t1(e))return e;var t=new Array(e.length),n=0,i=0,r=0,o=0,a=0,c;e[0][0]=="M"&&(n=+e[0][1],i=+e[0][2],r=n,o=i,a++,t[0]=["M",n,i]);for(var s,u,l=a,p=e.length;l<p;l++){if(u=e[l],c=u[0],t[l]=s=new Array(u.length),c!=c.toUpperCase())switch(s[0]=c.toUpperCase(),s[0]){case"A":s[1]=u[1],s[2]=u[2],s[3]=u[3],s[4]=u[4],s[5]=u[5],s[6]=+u[6]+n,s[7]=+u[7]+i;break;case"V":s[1]=+u[1]+i;break;case"H":s[1]=+u[1]+n;break;case"M":r=+u[1]+n,o=+u[2]+i;default:for(var f=1,d=u.length;f<d;f++)s[f]=+u[f]+(f%2?n:i)}else for(var h=0,m=u.length;h<m;h++)s[h]=u[h];switch(c=c.toUpperCase(),s[0]){case"Z":n=+r,i=+o;break;case"H":n=s[1];break;case"V":i=s[1];break;case"M":r=s[s.length-2],o=s[s.length-1];default:n=s[s.length-2],i=s[s.length-1]}}return t.toString=sl,t}function Dh(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Es(e,t,n,i){return[e,t,n,i,n,i]}function Oh(e,t,n,i,r,o){var a=.3333333333333333,c=2/3;return[a*e+c*n,a*t+c*i,a*r+c*n,a*o+c*i,r,o]}function Lh(e,t,n,i,r,o,a,c,s,u){var l=Ji*120/180,p=Ji/180*(+r||0),f=[],d,h=JE(function(C,_,y){var D=C*Pt.cos(y)-_*Pt.sin(y),I=C*Pt.sin(y)+_*Pt.cos(y);return{x:D,y:I}});if(u)L=u[0],A=u[1],E=u[2],T=u[3];else{d=h(e,t,-p),e=d.x,t=d.y,d=h(c,s,-p),c=d.x,s=d.y;var m=(e-c)/2,g=(t-s)/2,R=m*m/(n*n)+g*g/(i*i);R>1&&(R=Pt.sqrt(R),n=R*n,i=R*i);var w=n*n,x=i*i,b=(o==a?-1:1)*Pt.sqrt(er((w*x-w*g*g-x*m*m)/(w*g*g+x*m*m))),E=b*n*g/i+(e+c)/2,T=b*-i*m/n+(t+s)/2,L=Pt.asin(((t-T)/i).toFixed(9)),A=Pt.asin(((s-T)/i).toFixed(9));L=e<E?Ji-L:L,A=c<E?Ji-A:A,L<0&&(L=Ji*2+L),A<0&&(A=Ji*2+A),a&&L>A&&(L=L-Ji*2),!a&&A>L&&(A=A-Ji*2)}var F=A-L;if(er(F)>l){var H=A,N=c,V=s;A=L+l*(a&&A>L?1:-1),c=E+n*Pt.cos(A),s=T+i*Pt.sin(A),f=Lh(c,s,n,i,r,0,a,N,V,[A,H,E,T])}F=A-L;var pe=Pt.cos(L),je=Pt.sin(L),lt=Pt.cos(A),Y=Pt.sin(A),fe=Pt.tan(F/4),he=4/3*n*fe,se=4/3*i*fe,ce=[e,t],ee=[e+he*je,t-se*pe],j=[c+he*Y,s-se*lt],$=[c,s];if(ee[0]=2*ce[0]-ee[0],ee[1]=2*ce[1]-ee[1],u)return[ee,j,$].concat(f);f=[ee,j,$].concat(f).join().split(",");for(var U=[],ke=0,Dt=f.length;ke<Dt;ke++)U[ke]=ke%2?h(f[ke-1],f[ke],p).y:h(f[ke],f[ke+1],p).x;return U}function u1(e,t,n,i,r,o,a,c){for(var s=[],u=[[],[]],l,p,f,d,h,m,g,R,w=0;w<2;++w){if(w==0?(p=6*e-12*n+6*r,l=-3*e+9*n-9*r+3*a,f=3*n-3*e):(p=6*t-12*i+6*o,l=-3*t+9*i-9*o+3*c,f=3*i-3*t),er(l)<1e-12){if(er(p)<1e-12)continue;d=-f/p,0<d&&d<1&&s.push(d);continue}g=p*p-4*f*l,R=Pt.sqrt(g),!(g<0)&&(h=(-p+R)/(2*l),0<h&&h<1&&s.push(h),m=(-p-R)/(2*l),0<m&&m<1&&s.push(m))}for(var x=s.length,b=x,E;x--;)d=s[x],E=1-d,u[0][x]=E*E*E*e+3*E*E*d*n+3*E*d*d*r+d*d*d*a,u[1][x]=E*E*E*t+3*E*E*d*i+3*E*d*d*o+d*d*d*c;return u[0][b]=e,u[1][b]=t,u[0][b+1]=a,u[1][b+1]=c,u[0].length=u[1].length=b+2,{x0:fi(...u[0]),y0:fi(...u[1]),x1:di(...u[0]),y1:di(...u[1])}}function Ih(e){if(s1(e)||(e=e1(e)),n1(e))return e;for(var t=i1(c1(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(f,d,h){var m,g;if(!f)return["C",d.x,d.y,d.x,d.y,d.x,d.y];switch(!(f[0]in{T:1,Q:1})&&(d.qx=d.qy=null),f[0]){case"M":d.X=f[1],d.Y=f[2];break;case"A":f=["C",...Lh(d.x,d.y,...f.slice(1))];break;case"S":h=="C"||h=="S"?(m=d.x*2-d.bx,g=d.y*2-d.by):(m=d.x,g=d.y),f=["C",m,g,...f.slice(1)];break;case"T":h=="Q"||h=="T"?(d.qx=d.x*2-d.qx,d.qy=d.y*2-d.qy):(d.qx=d.x,d.qy=d.y),f=["C",...Oh(d.x,d.y,d.qx,d.qy,f[1],f[2])];break;case"Q":d.qx=f[1],d.qy=f[2],f=["C",...Oh(d.x,d.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...Es(d.x,d.y,f[1],f[2])];break;case"H":f=["C",...Es(d.x,d.y,f[1],d.y)];break;case"V":f=["C",...Es(d.x,d.y,d.x,f[1])];break;case"Z":f=["C",...Es(d.x,d.y,d.X,d.Y)];break}return f},r=function(f,d){if(f[d].length>7){f[d].shift();for(var h=f[d];h.length;)o[d]="A",f.splice(d++,0,["C",...h.splice(0,6)]);f.splice(d,1),u=t.length}},o=[],a="",c="",s=0,u=t.length;s<u;s++){t[s]&&(a=t[s][0]),a!="C"&&(o[s]=a,s&&(c=o[s-1])),t[s]=i(t[s],n,c),o[s]!="A"&&a=="C"&&(o[s]="C"),r(t,s);var l=t[s],p=l.length;n.x=l[p-2],n.y=l[p-1],n.bx=Sh(l[p-4])||n.x,n.by=Sh(l[p-3])||n.y}return t}function nt(e){return Ht(e)&&wn(e,"waypoints")}function Me(e){return Ht(e)&&wn(e,"labelTarget")}function l1(e){return Ht(e)&&Qr(e.parent)}function Nh(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function Mi(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function ye(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Ss(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function p1(e){return Mi({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function f1(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=m1(f,l);u.push({start:f,end:l,startLength:h,endLength:h+m,length:m})}return u},[]),i=n.reduce(function(u,l){return u+l.length},0),r=i/2,o=0,a=n[o];a.endLength<r;)a=n[++o];var c=(r-a.startLength)/a.length,s={x:a.start.x+(a.end.x-a.start.x)*c,y:a.start.y+(a.end.y-a.start.y)*c};return s}function _e(e){return nt(e)?f1(e):p1(e)}function Kt(e,t,n){n=n||0,Ht(n)||(n={x:n,y:n});var i=ye(e),r=ye(t),o=i.bottom+n.y<=r.top,a=i.left-n.x>=r.right,c=i.top-n.y>=r.bottom,s=i.right+n.x<=r.left,u=o?"top":c?"bottom":null,l=s?"left":a?"right":null;return l&&u?u+"-"+l:l||u||"intersect"}function Qo(e,t,n){var i=d1(e,t);return i.length===1||i.length===2&&Zo(i[0],i[1])<1?Mi(i[0]):i.length>1?(i=ai(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),Mi(i[n?0:i.length-1])):null}function d1(e,t){return kh(e,t)}function h1(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],Zo(n,r)===0||rl(i,r,n)?e.splice(t,1):t++;return e}function m1(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Rs(e,t){return Math.round(e*t)/t}function Bh(e){return we(e)?e+"px":e}function g1(e){for(;e.parent;)e=e.parent;return e}function y1(e){e=O({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),fn(n,{position:"relative",overflow:"hidden",width:Bh(e.width),height:Bh(e.height)}),t.appendChild(n),n}function $h(e,t,n){const i=me("g");Fe(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const v1="base",jh=0,_1=1,b1={shape:["x","y","width","height"],connection:["waypoints"]};function be(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||{})}be.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],be.prototype._init=function(e){const t=this._eventBus,n=this._container=y1(e),i=this._svg=me("svg");re(i,{width:"100%",height:"100%"}),an(i,"tabindex",0),e.autoFocus&&t.on("element.hover",()=>{this.restoreFocus()}),t.on("element.mousedown",500,o=>{this.focus()}),i.addEventListener("focusin",()=>{this._setFocused(!0)}),i.addEventListener("focusout",()=>{this._setFocused(!1)}),i.addEventListener("mouseover",()=>{this._eventBus.fire("canvas.mouseover")}),i.addEventListener("mouseout",()=>{this._eventBus.fire("canvas.mouseout")}),Ce(n,i);const r=this._viewport=$h(i,"viewport");e.deferUpdate&&(this._viewboxChanged=Ru(this._viewboxChanged,300)),this._restoreFocus=Ru(this._restoreFocus,0),t.on("diagram.init",()=>{t.fire("canvas.init",{svg:i,viewport:r})}),t.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed","root.set"],()=>{delete this._cachedViewbox}),t.on("diagram.destroy",500,this._destroy,this),t.on("diagram.clear",500,this._clear,this)},be.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},be.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},be.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=xh(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},be.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},be.prototype.restoreFocus=function(){this._restoreFocus()},be.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},be.prototype.isFocused=function(){return this._focused},be.prototype.getDefaultLayer=function(){return this.getLayer(v1,jh)},be.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},be.prototype._getChildIndex=function(e){return En(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},be.prototype._createLayer=function(e,t){typeof t>"u"&&(t=_1);const n=this._getChildIndex(t);return{group:$h(this._viewport,"layer-"+e,n),index:t,visible:!0}},be.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},be.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},be.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],Nt(t.group))},be.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},be.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(g1(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},be.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},be.prototype._findPlaneForRoot=function(e){return ot(this._planes,function(t){return t.rootElement===e})},be.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},be.prototype._resolveElements=function(e){return ve(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},be.prototype.getContainer=function(){return this._container},be.prototype._updateMarker=function(e,t,n){let i;e=this._resolveElement(e),e.markers=e.markers||new Set,i=this._elementRegistry._elements[e.id],i&&(M([i.gfx,i.secondaryGfx],function(r){r&&(n?(e.markers.add(t),Fe(r).add(t)):(e.markers.delete(t),Fe(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},be.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},be.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},be.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},be.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},be.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},be.prototype.addRootElement=function(e){const t=this._rootsIdx++;e||(e={id:"__implicitroot_"+t,children:[],isImplicit:!0});const n=e.layer="root-"+t;this._ensureValid("root",e);const i=this.getLayer(n,jh);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},be.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},be.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},be.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)},be.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})},be.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})},be.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=b1[e];if(!Pr(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},be.prototype._setParent=function(e,t,n){wt(t.children,e,n),e.parent=t},be.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},be.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},be.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},be.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),xt(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},be.prototype.removeShape=function(e){return this._removeElement(e,"shape")},be.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},be.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},be.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},be.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},be.prototype.viewbox=function(e){if(e===void 0&&this._cachedViewbox)return structuredClone(this._cachedViewbox);const t=this._viewport,n=this.getSize();let i,r,o,a,c,s,u;if(e)this._changeViewbox(function(){c=Math.min(n.width/e.width,n.height/e.height);const l=this._svg.createSVGMatrix().scale(c).translate(-e.x,-e.y);Yo(t,l)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=Yo(t),r=a?a.matrix:RE(),c=Rs(r.a,1e3),s=Rs(-r.e||0,1e3),u=Rs(-r.f||0,1e3),e=this._cachedViewbox={x:s?s/c:0,y:u?u/c:0,width:n.width/c,height:n.height/c,scale:c,inner:{width:i.width||0,height:i.height||0,x:i.x||0,y:i.y||0},outer:n},e;return e},be.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=O({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Fh(t,n)}),{x:n.e,y:n.f}},be.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),c=ye(a),s=this.viewbox(),u=this.zoom();let l,p;s.y+=t.top/u,s.x+=t.left/u,s.width-=(t.right+t.left)/u,s.height-=(t.bottom+t.top)/u;const f=ye(s);if(!(a.width<s.width&&a.height<s.height))l=a.x-s.x,p=a.y-s.y;else{const h=Math.max(0,c.right-f.right),m=Math.min(0,c.left-f.left),g=Math.max(0,c.bottom-f.bottom),R=Math.min(0,c.top-f.top);l=h||m,p=g||R}this.scroll({dx:-l*u,dy:-p*u})},be.prototype.zoom=function(e,t){if(!e)return this.viewbox(e).scale;if(e==="fit-viewport")return this._fitViewport(t);let n,i;return this._changeViewbox(function(){typeof t!="object"&&(n=this.viewbox().outer,t={x:n.width/2,y:n.height/2}),i=this._setZoom(e,t)}),Rs(i.a,1e3)};function Fh(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}be.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},be.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,r=n.createSVGMatrix(),o=n.createSVGPoint();let a,c,s,u,l;s=i.getCTM();const p=s.a;return t?(a=O(o,t),c=a.matrixTransform(s.inverse()),u=r.translate(c.x,c.y).scale(1/p*e).translate(-c.x,-c.y),l=s.multiply(u)):l=r.scale(e),Fh(this._viewport,l),l},be.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},be.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}},be.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var so="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,so,i),n&&re(n,so,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,so,""),i.secondaryGfx&&re(i.secondaryGfx,so,""),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,so,i),t},Ln.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&re(e,so);var n=this._elements[t];return n&&n.element},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,c=o.gfx;if(e(a,c))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 x1(e,t,n,i){var r=n.inverse;return Object.defineProperty(e,"remove",{value:function(o){var a=this.indexOf(o);return a!==-1&&(this.splice(a,1),t.unset(o,r,i)),o}}),Object.defineProperty(e,"contains",{value:function(o){return this.indexOf(o)!==-1}}),Object.defineProperty(e,"add",{value:function(o,a){var c=this.indexOf(o);if(typeof a>"u"){if(c!==-1)return;a=this.length}c!==-1&&this.splice(c,1),this.splice(a,0,o),c===-1&&t.set(o,r,i)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e}function w1(e){return e.__refs_collection===!0}function E1(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function Hh(e,t,n){var i=x1(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 S1(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 Hn(e,t){if(!(this instanceof Hn))return new Hn(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Hn.prototype.bind=function(e,t){if(typeof t=="string"){if(!this.props[t])throw new Error("no property <"+t+"> in ref");t=this.props[t]}t.collection?Hh(this,t,e):S1(this,t,e)},Hn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return w1(n)||Hh(this,t,e),n},Hn.prototype.ensureBound=function(e,t){E1(e,t)||this.bind(e,t)},Hn.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Hn.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var cl=new Hn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),zh=new Hn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Vh=new Hn({name:"attachers",collection:!0},{name:"host"}),Gh=new Hn({name:"outgoing",collection:!0},{name:"source"}),Wh=new Hn({name:"incoming",collection:!0},{name:"target"});function co(){Object.defineProperty(this,"businessObject",{writable:!0}),Object.defineProperty(this,"label",{get:function(){return this.labels[0]},set:function(e){var t=this.label,n=this.labels;!e&&t?n.remove(t):n.add(e,0)}}),cl.bind(this,"parent"),zh.bind(this,"labels"),Gh.bind(this,"outgoing"),Wh.bind(this,"incoming")}function Jo(){co.call(this),cl.bind(this,"children"),Vh.bind(this,"host"),Vh.bind(this,"attachers")}ie(Jo,co);function Uh(){co.call(this),cl.bind(this,"children")}ie(Uh,Jo);function Yh(){Jo.call(this),zh.bind(this,"labelTarget")}ie(Yh,Jo);function qh(){co.call(this),Gh.bind(this,"source"),Wh.bind(this,"target")}ie(qh,co);var R1={connection:qh,shape:Jo,label:Yh,root:Uh};function C1(e,t){var n=R1[e];if(!n)throw new Error("unknown type: <"+e+">");return O(new n,t)}function P1(e){return e instanceof co}function ki(){this._uid=12}ki.prototype.createRoot=function(e){return this.create("root",e)},ki.prototype.createLabel=function(e){return this.create("label",e)},ki.prototype.createShape=function(e){return this.create("shape",e)},ki.prototype.createConnection=function(e){return this.create("connection",e)},ki.prototype.create=function(e,t){return t=O({},t||{}),t.id||(t.id=e+"_"+this._uid++),C1(e,t)};var Cs="__fn",Kh=1e3,A1=Array.prototype.slice;function Cn(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}Cn.prototype.on=function(e,t,n,i){if(e=ve(e)?e:[e],zt(t)&&(i=n,n=t,t=Kh),!we(t))throw new Error("priority must be a number");var r=n;i&&(r=yn(n,i),r[Cs]=n[Cs]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},Cn.prototype.once=function(e,t,n,i){var r=this;if(zt(t)&&(i=n,n=t,t=Kh),!we(t))throw new Error("priority must be a number");function o(){o.__isTomb=!0;var a=n.apply(i,arguments);return r.off(e,o),a}o[Cs]=n,this.on(e,t,o)},Cn.prototype.off=function(e,t){e=ve(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},Cn.prototype.createEvent=function(e){var t=new ea;return t.init(e),t},Cn.prototype.fire=function(e,t){var n,i,r,o;if(o=A1.call(arguments),typeof e=="object"&&(t=e,e=t.type),!e)throw new Error("no event type specified");if(i=this._listeners[e],!!i){t instanceof ea?n=t:n=this.createEvent(t),o[0]=n;var a=n.type;e!==a&&(n.type=e);try{r=this._invokeListeners(n,o,i)}finally{e!==a&&(n.type=a)}return r===void 0&&n.defaultPrevented&&(r=!1),r}},Cn.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},Cn.prototype._destroy=function(){this._listeners={}},Cn.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},Cn.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=T1(n.callback,t),i!==void 0&&(e.returnValue=i,e.stopPropagation()),i===!1&&e.preventDefault()}catch(r){if(!this.handleError(r))throw console.error("unhandled error in event listener",r),r}return i},Cn.prototype._addListener=function(e,t){var n=this._getListeners(e),i;if(!n){this._setListeners(e,t);return}for(;n;){if(n.priority<t.priority){t.next=n,i?i.next=t:this._setListeners(e,t);return}i=n,n=n.next}i.next=t},Cn.prototype._getListeners=function(e){return this._listeners[e]},Cn.prototype._setListeners=function(e,t){this._listeners[e]=t},Cn.prototype._removeListener=function(e,t){var n=this._getListeners(e),i,r,o;if(!t){this._setListeners(e,null);return}for(;n;)i=n.next,o=n.callback,(o===t||o[Cs]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function ea(){}ea.prototype.stopPropagation=function(){this.cancelBubble=!0},ea.prototype.preventDefault=function(){this.defaultPrevented=!0},ea.prototype.init=function(e){O(this,e||{})};function T1(e,t){return e.apply(null,t)}function Nr(e){return e.childNodes[0]}function M1(e){return e.parentNode.childNodes[1]}function Ps(e,t,n,i,r){var o=Uo();o.setTranslate(t,n);var a=Uo();a.setRotate(i||0,0,0);var c=Uo();c.setScale(1,1),Yo(e,[o,a,c])}function Xt(e,t,n){var i=Uo();i.setTranslate(t,n),Yo(e,i)}function Xh(e,t){var n=Uo();n.setRotate(t,0,0),Yo(e,n)}function 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=M1(t),n||(n=me("g"),Fe(n).add("djs-children"),Ce(t.parentNode,n))):n=t,n},In.prototype._clear=function(e){var t=Nr(e);return ms(t),t},In.prototype._createContainer=function(e,t,n,i){var r=me("g");Fe(r).add("djs-group"),typeof n<"u"?k1(r,t,t.childNodes[n]):Ce(t,r);var o=me("g");Fe(o).add("djs-element"),Fe(o).add("djs-"+e),i&&Fe(o).add("djs-frame"),Ce(r,o);var a=me("g");return Fe(a).add("djs-visual"),Ce(o,a),o},In.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,wh(t))},In.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=En(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),M(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r),c=a.firstChild;M(o,function(s){var u=n.getGraphics(s).parentNode;u===c?c=c.nextSibling:a.insertBefore(u,c)})}})},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),Xt(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 k1(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const D1={__depends__:[WE],__init__:["canvas"],canvas:["type",be],elementRegistry:["type",Ln],elementFactory:["type",ki],eventBus:["type",Cn],graphicsFactory:["type",In]};function O1(e){var t=new bh(e);return t.init(),t}function L1(e){e=e||{};var t={config:["value",e]},n=[t,D1].concat(e.modules||[]);return O1(n)}function nr(e,t){this._injector=t||L1(e),this.get("eventBus").fire("diagram.init")}nr.prototype.get=function(e,t){return this._injector.get(e,t)},nr.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},nr.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},nr.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function sn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function vn(e,t){return e.$instanceOf(t)}function I1(e){return ot(e.rootElements,function(t){return vn(t,"bpmn:Process")||vn(t,"bpmn:Collaboration")})}function N1(e){var t={},n=[],i={};function r(j,$){return function(U){j(U,$)}}function o(j){t[j.id]=j}function a(j){return t[j.id]}function c(j,$){var U=j.gfx;if(U)throw new Error(`already rendered ${sn(j)}`);return e.element(j,i[j.id],$)}function s(j,$){return e.root(j,i[j.id],$)}function u(j,$){try{var U=i[j.id]&&c(j,$);return o(j),U}catch(ke){l(ke.message,{element:j,error:ke}),console.error(`failed to import ${sn(j)}`,ke)}}function l(j,$){e.error(j,$)}var p=this.registerDi=function($){var U=$.bpmnElement;U?i[U.id]?l(`multiple DI elements defined for ${sn(U)}`,{element:U}):i[U.id]=$:l(`no bpmnElement referenced in ${sn($)}`,{element:$})};function f(j){d(j.plane)}function d(j){p(j),M(j.planeElement,h)}function h(j){p(j)}this.handleDefinitions=function($,U){var ke=$.diagrams;if(U&&ke.indexOf(U)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!U&&ke&&ke.length&&(U=ke[0]),!U)throw new Error("no diagram to display");i={},f(U);var Dt=U.plane;if(!Dt)throw new Error(`no plane for ${sn(U)}`);var C=Dt.bpmnElement;if(!C)if(C=I1($),C)l(`correcting missing bpmnElement on ${sn(Dt)} to ${sn(C)}`),Dt.bpmnElement=C,p(Dt);else throw new Error("no process or collaboration to display");var _=s(C,Dt);if(vn(C,"bpmn:Process")||vn(C,"bpmn:SubProcess"))g(C,_);else if(vn(C,"bpmn:Collaboration"))ce(C,_),R($.rootElements,_);else throw new Error(`unsupported bpmnElement for ${sn(Dt)}: ${sn(C)}`);m(n)};var m=this.handleDeferred=function(){for(var $;n.length;)$=n.shift(),$()};function g(j,$){fe(j,$),F(j.ioSpecification,$),A(j.artifacts,$),o(j)}function R(j,$){var U=Le(j,function(ke){return!a(ke)&&vn(ke,"bpmn:Process")&&ke.laneSets});U.forEach(r(g,$))}function w(j,$){u(j,$)}function x(j,$){M(j,r(w,$))}function b(j,$){u(j,$)}function E(j,$){u(j,$)}function T(j,$){u(j,$)}function L(j,$){u(j,$)}function A(j,$){M(j,function(U){vn(U,"bpmn:Association")?n.push(function(){L(U,$)}):L(U,$)})}function F(j,$){j&&(M(j.dataInputs,r(E,$)),M(j.dataOutputs,r(T,$)))}var H=this.handleSubProcess=function($,U){fe($,U),A($.artifacts,U)};function N(j,$){var U=u(j,$);vn(j,"bpmn:SubProcess")&&H(j,U||$),vn(j,"bpmn:Activity")&&F(j.ioSpecification,$),n.push(function(){M(j.dataInputAssociations,r(b,$)),M(j.dataOutputAssociations,r(b,$))})}function V(j,$){u(j,$)}function pe(j,$){u(j,$)}function je(j,$){n.push(function(){var U=u(j,$);j.childLaneSet&<(j.childLaneSet,U||$),ee(j)})}function lt(j,$){M(j.lanes,r(je,$))}function Y(j,$){M(j,r(lt,$))}function fe(j,$){he(j.flowElements,$),j.laneSets&&Y(j.laneSets,$)}function he(j,$){M(j,function(U){vn(U,"bpmn:SequenceFlow")?n.push(function(){V(U,$)}):vn(U,"bpmn:BoundaryEvent")?n.unshift(function(){N(U,$)}):vn(U,"bpmn:FlowNode")?N(U,$):vn(U,"bpmn:DataObject")||(vn(U,"bpmn:DataStoreReference")||vn(U,"bpmn:DataObjectReference")?pe(U,$):l(`unrecognized flowElement ${sn(U)} in context ${sn($&&$.businessObject)}`,{element:U,context:$}))})}function se(j,$){var U=u(j,$),ke=j.processRef;ke&&g(ke,U||$)}function ce(j,$){M(j.participants,r(se,$)),n.push(function(){x(j.messageFlows,$)}),A(j.artifacts,$)}function ee(j){M(j.flowNodeRef,function($){var U=$.get("lanes");U&&U.push(j)})}}function v(e,t){var n=Z(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function De(e,t){return Gi(t,function(n){return v(e,n)})}function Z(e){return e&&e.businessObject||e}function ze(e){return e&&e.di}function B1(e,t,n){var i,r,o,a,c=[];function s(u,l){var p={root:function(m,g){return i.add(m,g)},element:function(m,g,R){return i.add(m,g,R)},error:function(m,g){c.push({message:m,context:g})}},f=new N1(p);l=l||u.diagrams&&u.diagrams[0];var d=$1(u,l);if(!d)throw new Error("no diagram to display");M(d,function(m){f.handleDefinitions(u,m)});var h=l.plane.bpmnElement.id;o.setRootElement(o.findRoot(h+"_plane")||o.findRoot(h))}return new Promise(function(u,l){try{return i=e.get("bpmnImporter"),r=e.get("eventBus"),o=e.get("canvas"),r.fire("import.render.start",{definitions:t}),s(t,n),r.fire("import.render.complete",{error:a,warnings:c}),u({warnings:c})}catch(p){return p.warnings=c,l(p)}})}function $1(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!v(n,"bpmn:Process")&&!v(n,"bpmn:Collaboration")&&(i=j1(n));var r;v(i,"bpmn:Collaboration")?r=i:r=ot(e.rootElements,function(u){if(v(u,"bpmn:Collaboration"))return ot(u.participants,function(l){return l.processRef===i})});var o=[i];r&&(o=rn(r.participants,function(u){return u.processRef}),o.push(r));var a=Zh(o),c=[t],s=[n];return M(e.diagrams,function(u){if(u.plane){var l=u.plane.bpmnElement;a.indexOf(l)!==-1&&s.indexOf(l)===-1&&(c.push(u),s.push(l))}}),c}}function Zh(e){var t=[];return M(e,function(n){n&&(t.push(n),t=t.concat(Zh(n.flowElements)))}),t}function j1(e){for(var t=e;t;){if(v(t,"bpmn:Process"))return t;t=t.$parent}}var F1='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.02 5.57" width="53" height="21"><path fill="currentColor" d="M1.88.92v.14c0 .41-.13.68-.4.8.33.14.46.44.46.86v.33c0 .61-.33.95-.95.95H0V0h.95c.65 0 .93.3.93.92zM.63.57v1.06h.24c.24 0 .38-.1.38-.43V.98c0-.28-.1-.4-.32-.4zm0 1.63v1.22h.36c.2 0 .32-.1.32-.39v-.35c0-.37-.12-.48-.4-.48H.63zM4.18.99v.52c0 .64-.31.98-.94.98h-.3V4h-.62V0h.92c.63 0 .94.35.94.99zM2.94.57v1.35h.3c.2 0 .3-.09.3-.37v-.6c0-.29-.1-.38-.3-.38h-.3zm2.89 2.27L6.25 0h.88v4h-.6V1.12L6.1 3.99h-.6l-.46-2.82v2.82h-.55V0h.87zM8.14 1.1V4h-.56V0h.79L9 2.4V0h.56v4h-.64zm2.49 2.29v.6h-.6v-.6zM12.12 1c0-.63.33-1 .95-1 .61 0 .95.37.95 1v2.04c0 .64-.34 1-.95 1-.62 0-.95-.37-.95-1zm.62 2.08c0 .28.13.39.33.39s.32-.1.32-.4V.98c0-.29-.12-.4-.32-.4s-.33.11-.33.4z"/><path fill="currentColor" d="M0 4.53h14.02v1.04H0zM11.08 0h.63v.62h-.63zm.63 4V1h-.63v2.98z"/></svg>',Qh=F1,Jh={verticalAlign:"middle"},em={color:"#404040"},H1={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},z1={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},V1={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"},G1='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+Qh+'</a><span>Web-based tooling for BPMN, DMN and forms powered by <a href="https://bpmn.io" target="_blank" rel="noopener">bpmn.io</a>.</span></div></div>',hi;function W1(){hi=ut(G1),fn(hi,H1),fn(tt("svg",hi),Jh),fn(tt(".backdrop",hi),z1),fn(tt(".notice",hi),V1),fn(tt(".link",hi),em,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function U1(){hi||(W1(),Rn.bind(hi,".backdrop","click",function(e){document.body.removeChild(hi)})),document.body.appendChild(hi)}const As=5,tm="djs-outline-hidden";function gt(e){e=O({},q1,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),X1(this._container)}ie(gt,nr),gt.prototype.importXML=async function(t,n){const i=this;function r(a){return i.get("eventBus").createEvent(a)}let o=[];try{t=this._emit("import.parse.start",{xml:t})||t;let a;try{a=await this._moddle.fromXML(t,"bpmn:Definitions")}catch(f){throw this._emit("import.parse.complete",{error:f}),f}let c=a.rootElement;const s=a.references,u=a.warnings,l=a.elementsById;o=o.concat(u),c=this._emit("import.parse.complete",r({error:null,definitions:c,elementsById:l,references:s,warnings:o}))||c;const p=await this.importDefinitions(c,n);return o=o.concat(p.warnings),this._emit("import.done",{error:null,warnings:o}),{warnings:o}}catch(a){let c=a;throw o=o.concat(c.warnings||[]),Ts(c,o),c=Y1(c),this._emit("import.done",{error:c,warnings:c.warnings}),c}},gt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},gt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw Ts(o,[]),o}if(typeof t=="string"&&(i=K1(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw Ts(o,[]),o}try{this.clear()}catch(o){throw Ts(o,[]),o}const{warnings:r}=await B1(this,n,i);return{warnings:r}},gt.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},gt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=tt(":scope > defs",i._svg),a=_h(r),c=o?"<defs>"+_h(o)+"</defs>":"",s=i.getContainer();dt(s).add(tm);let u;try{u=r.getBBox()}finally{dt(s).remove(tm)}const l=u.x-As,p=u.y-As,f=u.width+As*2,d=u.height+As*2;t=`<?xml version="1.0" encoding="utf-8"?>
|
|
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}},gt.prototype._setDefinitions=function(e){this._definitions=e},gt.prototype.getModules=function(){return this._modules},gt.prototype.clear=function(){this.getDefinitions()&&tr.prototype.clear.call(this)},gt.prototype.destroy=function(){tr.prototype.destroy.call(this),pi(this._container)},gt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},gt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},gt.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=tt(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},gt.prototype.getDefinitions=function(){return this._definitions},gt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},gt.prototype._init=function(e,t,n){const i=n.modules||this.getModules(n),r=n.additionalModules||[],o=[{bpmnjs:["value",this],moddle:["value",t]}],a=[].concat(o,i,r),s=O(ai(n,["additionalModules"]),{canvas:O({},n.canvas,{container:e}),modules:a});tr.call(this,s),n&&n.container&&this.attachTo(n.container)},gt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},gt.prototype._createContainer=function(e){const t=ct('<div class="bjs-container"></div>');return fn(t,{width:nm(e.width),height:nm(e.height),position:e.position}),t},gt.prototype._createModdle=function(e){const t=O({},this._moddleExtensions,e.moddleExtensions);return new sd(t)},gt.prototype._modules=[];function Ts(e,t){return e.warnings=t,e}function V1(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 G1={width:"100%",height:"100%",position:"relative"};function nm(e){return e+(be(e)?"px":"")}function W1(e,t){return t&&ot(e.diagrams,function(n){return n.id===t})||null}function U1(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Qh+"</a>",i=ct(n);fn(tt("svg",i),Jh),fn(i,em,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),we.bind(i,"click",function(r){z1(),r.preventDefault()})}function co(e){gt.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(co,gt),co.prototype._createModdle=function(e){var t=gt.prototype._createModdle.call(this,e);return t.ids=new li([32,36,1]),t},co.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||ze(e),t&&v(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):v(e,"bpmn:Participant")?!!X(e).processRef:!0}function Vt(e){if(!(!v(e,"bpmn:Participant")&&!v(e,"bpmn:Lane"))){var t=ze(e).isHorizontal;return t===void 0?!0:t}}function q1(e){return e&&X(e).isInterrupting!==!1}function cn(e){return e&&!!X(e).triggeredByEvent}function uo(e,t){var n=X(e).eventDefinitions;return zi(n,function(i){return v(i,t)})}function Y1(e){return uo(e,"bpmn:ErrorEventDefinition")}function K1(e){return uo(e,"bpmn:EscalationEventDefinition")}function X1(e){return uo(e,"bpmn:CompensateEventDefinition")}var Nr={width:90,height:20},im=15;function nr(e){return v(e,"bpmn:Event")||v(e,"bpmn:Gateway")||v(e,"bpmn:DataStoreReference")||v(e,"bpmn:DataObjectReference")||v(e,"bpmn:DataInput")||v(e,"bpmn:DataOutput")||v(e,"bpmn:SequenceFlow")||v(e,"bpmn:MessageFlow")||v(e,"bpmn:Group")}function Ms(e){return Ae(e.label)}function Z1(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=Q1(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-=im:a+=im,{x:a,y:s}}function Q1(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 cl(e){return e.waypoints?Z1(e.waypoints):v(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Nr.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Nr.height/2}}function J1(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(Nr.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=cl(t),i=Nr),O({x:n.x-i.width/2,y:n.y-i.height/2},i)}function rm(e){if(v(e,"bpmn:FlowElement")||v(e,"bpmn:Participant")||v(e,"bpmn:Lane")||v(e,"bpmn:SequenceFlow")||v(e,"bpmn:MessageFlow")||v(e,"bpmn:DataInput")||v(e,"bpmn:DataOutput"))return"name";if(v(e,"bpmn:TextAnnotation"))return"text";if(v(e,"bpmn:Group"))return"categoryValueRef"}function eS(e){var t=e.categoryValueRef;return t&&t.value||""}function In(e){var t=e.businessObject,n=rm(t);if(n)return n==="categoryValueRef"?eS(t):t[n]||""}function tS(e,t){var n=e.businessObject,i=rm(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function nS(e){return Ae(e)&&nr(e.labelTarget)}var lo=7;function om(e){let t=[];return M(e.incoming,n=>{v(n,"bpmn:Association")&&v(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),M(e.outgoing,n=>{v(n,"bpmn:Association")&&v(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function ta(e){const t=new Map;return M(tl(e),n=>{M(om(n),i=>{t.has(i.annotation)||t.set(i.annotation,{annotation:i.annotation,associations:[]}),t.get(i.annotation).associations.push(i.association)})}),[...t.values()]}var ul="hsl(225, 10%, 15%)",iS="white";function mi(e,t){return zi(e.eventDefinitions,function(n){return n.$type===t})}function rS(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function oS(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function Ie(e,t,n){var i=ze(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||iS}function te(e,t,n){var i=ze(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||ul}function na(e,t,n,i){var r=ze(e),o=r.get("label");return i||o&&o.get("color:color")||t||te(e,n)}function am(e){var t=e.x+e.width/2,n=e.y+e.height/2,i=e.width/2,r=[["M",t,n],["m",0,-i],["a",i,i,0,1,1,0,2*i],["a",i,i,0,1,1,0,-2*i],["z"]];return Or(r)}function ll(e,t){var n=e.x,i=e.y,r=e.width,o=e.height,a=[["M",n+t,i],["l",r-t*2,0],["a",t,t,0,0,1,t,t],["l",0,o-t*2],["a",t,t,0,0,1,-t,t],["l",t*2-r,0],["a",t,t,0,0,1,-t,-t],["l",0,t*2-o],["a",t,t,0,0,1,t,-t],["z"]];return Or(a)}function aS(e){var t=e.width,n=e.height,i=e.x,r=e.y,o=t/2,a=n/2,s=[["M",i+o,r],["l",o,a],["l",-o,a],["l",-o,-a],["z"]];return Or(s)}function sS(e){var t=e.x,n=e.y,i=e.width,r=e.height,o=[["M",t,n],["l",i,0],["l",0,r],["l",-i,0],["z"]];return Or(o)}function ia(e,t={}){return{width:Hn(e,t),height:Cn(e,t)}}function Hn(e,t={}){return xn(t,"width")?t.width:e.width}function Cn(e,t={}){return xn(t,"height")?t.height:e.height}var cS=new li,uS=10,ks=3,lS=1.5,Ds=10,pS=4,po=.95,fS=1,dS=.25;function Br(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:ul,strokeWidth:2,fill:"white"})}function p(C){return n.computeStyle(C,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:ul,strokeWidth:2})}function f(C,_){var{ref:y={x:0,y:0},scale:D=1,element:I,parentGfx:G=r._svg}=_,oe=de("marker",{id:C,viewBox:"0 0 20 20",refX:y.x,refY:y.y,markerWidth:20*D,markerHeight:20*D,orient:"auto"});Se(oe,I);var Ce=tt(":scope > defs",G);Ce||(Ce=de("defs"),Se(G,Ce)),Se(Ce,oe)}function d(C,_,y,D){var I=cS.nextPrefixed("marker-");return h(C,I,_,y,D),"url(#"+I+")"}function h(C,_,y,D,I){if(y==="sequenceflow-end"){var G=de("path",{d:"M 1 5 L 11 10 L 1 15 Z",...l({fill:I,stroke:I,strokeWidth:1})});f(_,{element:G,ref:{x:11,y:10},scale:.5,parentGfx:C})}if(y==="messageflow-start"){var oe=de("circle",{cx:6,cy:6,r:3.5,...l({fill:D,stroke:I,strokeWidth:1,strokeDasharray:[1e4,1]})});f(_,{element:oe,ref:{x:6,y:6},parentGfx:C})}if(y==="messageflow-end"){var Ce=de("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...l({fill:D,stroke:I,strokeWidth:1,strokeDasharray:[1e4,1]})});f(_,{element:Ce,ref:{x:8.5,y:5},parentGfx:C})}if(y==="association-start"){var We=de("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:I,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(_,{element:We,ref:{x:1,y:10},scale:.5,parentGfx:C})}if(y==="association-end"){var pt=de("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:I,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(_,{element:pt,ref:{x:11,y:10},scale:.5,parentGfx:C})}if(y==="conditional-flow-marker"){var Je=de("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...l({fill:D,stroke:I})});f(_,{element:Je,ref:{x:-1,y:10},scale:.5,parentGfx:C})}if(y==="conditional-default-flow-marker"){var $t=de("path",{d:"M 6 4 L 10 16",...l({stroke:I,fill:"none"})});f(_,{element:$t,ref:{x:0,y:10},scale:.5,parentGfx:C})}}function m(C,_,y,D,I={}){Ht(D)&&(I=D,D=0),D=D||0,I=l(I);var G=_/2,oe=y/2,Ce=de("circle",{cx:G,cy:oe,r:Math.round((_+y)/4-D),...I});return Se(C,Ce),Ce}function g(C,_,y,D,I,G){Ht(I)&&(G=I,I=0),I=I||0,G=l(G);var oe=de("rect",{x:I,y:I,width:_-I*2,height:y-I*2,rx:D,ry:D,...G});return Se(C,oe),oe}function S(C,_,y,D){var I=_/2,G=y/2,oe=[{x:I,y:0},{x:_,y:G},{x:I,y},{x:0,y:G}],Ce=oe.map(function(pt){return pt.x+","+pt.y}).join(" ");D=l(D);var We=de("polygon",{...D,points:Ce});return Se(C,We),We}function E(C,_,y,D){y=p(y);var I=Yo(_,y,D);return Se(C,I),I}function x(C,_,y){return E(C,_,y,5)}function b(C,_,y){y=p(y);var D=de("path",{...y,d:_});return Se(C,D),D}function w(C,_,y,D){return b(_,y,O({"data-marker":C},D))}function T(C){return kt[C]}function L(C){return function(_,y,D){return T(C)(_,y,D)}}var A={"bpmn:MessageEventDefinition":function(C,_,y={},D){var I=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.235,my:.315}}),G=D?te(_,c,y.stroke):Ie(_,s,y.fill),oe=D?Ie(_,s,y.fill):te(_,c,y.stroke),Ce=b(C,I,{fill:G,stroke:oe,strokeWidth:1});return Ce},"bpmn:TimerEventDefinition":function(C,_,y={}){var D=y.width||_.width,I=y.height||_.height,G=y.width?1:2,oe=m(C,D,I,.2*I,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:G}),Ce=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:D,containerHeight:I,position:{mx:.5,my:.5}});b(C,Ce,{stroke:te(_,c,y.stroke),strokeWidth:G});for(var We=0;We<12;We++){var pt=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:D,containerHeight:I,position:{mx:.5,my:.5}}),Je=D/2,$t=I/2;b(C,pt,{strokeWidth:1,stroke:te(_,c,y.stroke),transform:"rotate("+We*30+","+$t+","+Je+")"})}return oe},"bpmn:EscalationEventDefinition":function(C,_,y={},D){var I=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.5,my:.2}}),G=D?te(_,c,y.stroke):Ie(_,s,y.fill);return b(C,I,{fill:G,stroke:te(_,c,y.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(C,_,y={}){var D=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.5,my:.222}});return b(C,D,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(C,_,y={},D){var I=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.57,my:.263}}),G=D?te(_,c,y.stroke):Ie(_,s,y.fill);return b(C,I,{fill:G,stroke:te(_,c,y.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(C,_,y={},D){var I=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.2,my:.722}}),G=D?te(_,c,y.stroke):Ie(_,s,y.fill);return b(C,I,{fill:G,stroke:te(_,c,y.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(C,_,y={},D){var I=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.638,my:-.055}}),G=D?te(_,c,y.stroke):"none",oe=b(C,I,{fill:G,stroke:te(_,c,y.stroke),strokeWidth:1});return Xh(oe,45),oe},"bpmn:CompensateEventDefinition":function(C,_,y={},D){var I=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.22,my:.5}}),G=D?te(_,c,y.stroke):Ie(_,s,y.fill);return b(C,I,{fill:G,stroke:te(_,c,y.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(C,_,y={},D){var I=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.5,my:.2}}),G=D?te(_,c,y.stroke):Ie(_,s,y.fill);return b(C,I,{strokeWidth:1,fill:G,stroke:te(_,c,y.stroke)})},"bpmn:MultipleEventDefinition":function(C,_,y={},D){var I=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.211,my:.36}}),G=D?te(_,c,y.stroke):Ie(_,s,y.fill);return b(C,I,{fill:G,stroke:te(_,c,y.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(C,_,y={}){var D=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.458,my:.194}});return b(C,D,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(C,_,y={}){var D=m(C,_.width,_.height,8,{fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke),strokeWidth:4});return D}};function F(C,_,y={},D){var I=X(C),G=rS(I),oe=D||C;return I.get("eventDefinitions")&&I.get("eventDefinitions").length>1?I.get("parallelMultiple")?A["bpmn:ParallelMultipleEventDefinition"](_,oe,y,G):A["bpmn:MultipleEventDefinition"](_,oe,y,G):mi(I,"bpmn:MessageEventDefinition")?A["bpmn:MessageEventDefinition"](_,oe,y,G):mi(I,"bpmn:TimerEventDefinition")?A["bpmn:TimerEventDefinition"](_,oe,y,G):mi(I,"bpmn:ConditionalEventDefinition")?A["bpmn:ConditionalEventDefinition"](_,oe,y,G):mi(I,"bpmn:SignalEventDefinition")?A["bpmn:SignalEventDefinition"](_,oe,y,G):mi(I,"bpmn:EscalationEventDefinition")?A["bpmn:EscalationEventDefinition"](_,oe,y,G):mi(I,"bpmn:LinkEventDefinition")?A["bpmn:LinkEventDefinition"](_,oe,y,G):mi(I,"bpmn:ErrorEventDefinition")?A["bpmn:ErrorEventDefinition"](_,oe,y,G):mi(I,"bpmn:CancelEventDefinition")?A["bpmn:CancelEventDefinition"](_,oe,y,G):mi(I,"bpmn:CompensateEventDefinition")?A["bpmn:CompensateEventDefinition"](_,oe,y,G):mi(I,"bpmn:TerminateEventDefinition")?A["bpmn:TerminateEventDefinition"](_,oe,y,G):null}var H={ParticipantMultiplicityMarker:function(C,_,y={}){var D=Hn(_,y),I=Cn(_,y),G=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:I,position:{mx:(D/2-6)/D,my:(I-15)/I}});w("participant-multiplicity",C,G,{strokeWidth:2,fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke)})},SubProcessMarker:function(C,_,y={}){var D=g(C,14,14,0,{strokeWidth:1,fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke)});Xt(D,_.width/2-7.5,_.height-20);var I=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2-7.5)/_.width,my:(_.height-20)/_.height}});w("sub-process",C,I,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke)})},ParallelMarker:function(C,_,y){var D=Hn(_,y),I=Cn(_,y),G=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:I,position:{mx:(D/2+y.parallel)/D,my:(I-20)/I}});w("parallel",C,G,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke)})},SequentialMarker:function(C,_,y){var D=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2+y.seq)/_.width,my:(_.height-19)/_.height}});w("sequential",C,D,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke)})},CompensationMarker:function(C,_,y){var D=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2+y.compensation)/_.width,my:(_.height-13)/_.height}});w("compensation",C,D,{strokeWidth:1,fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke)})},LoopMarker:function(C,_,y){var D=Hn(_,y),I=Cn(_,y),G=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:I,position:{mx:(D/2+y.loop)/D,my:(I-7)/I}});w("loop",C,G,{strokeWidth:1.5,fill:"none",stroke:te(_,c,y.stroke),strokeMiterlimit:.5})},AdhocMarker:function(C,_,y){var D=Hn(_,y),I=Cn(_,y),G=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:I,position:{mx:(D/2+y.adhoc)/D,my:(I-15)/I}});w("adhoc",C,G,{strokeWidth:1,fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke)})}};function N(C,_,y,D){H[C](_,y,D)}function z(C,_,y=[],D={}){D={fill:D.fill,stroke:D.stroke,width:Hn(_,D),height:Cn(_,D)};var I=X(_),G=y.includes("SubProcessMarker");G?D={...D,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:D={...D,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},I.get("isForCompensation")&&y.push("CompensationMarker"),v(I,"bpmn:AdHocSubProcess")&&(y.push("AdhocMarker"),G||O(D,{compensation:D.compensation-18}));var oe=I.get("loopCharacteristics"),Ce=oe&&oe.get("isSequential");oe&&(O(D,{compensation:D.compensation-18}),y.includes("AdhocMarker")&&O(D,{seq:-23,loop:-18,parallel:-24}),Ce===void 0&&y.push("LoopMarker"),Ce===!1&&y.push("ParallelMarker"),Ce===!0&&y.push("SequentialMarker")),y.includes("CompensationMarker")&&y.length===1&&O(D,{compensation:-8}),M(y,function(We){N(We,C,_,D)})}function le(C,_,y={}){y=O({size:{width:100}},y);var D=o.createText(_||"",y);return Fe(D).add("djs-label"),Se(C,D),D}function $e(C,_,y,D={}){var I=X(_),G=ia({x:_.x,y:_.y,width:_.width,height:_.height},D);return le(C,I.name,{align:y,box:G,padding:7,style:{fill:na(_,u,c,D.stroke)}})}function ut(C,_,y={}){var D={width:_.width,height:_.height,x:_.width/2+_.x,y:_.height/2+_.y};return le(C,In(_),{box:D,style:O({},o.getExternalStyle(),{fill:na(_,u,c,y.stroke)})})}function q(C,_,y,D={}){var I=Vt(y),G=le(C,_,{box:{height:30,width:I?Cn(y,D):Hn(y,D)},align:"center-middle",style:{fill:na(y,u,c,D.stroke)}});if(I){var oe=-1*Cn(y,D);Ps(G,0,-oe,270)}}function pe(C,_,y={}){var{width:D,height:I}=ia(_,y);return g(C,D,I,Ds,{...y,fill:Ie(_,s,y.fill),fillOpacity:po,stroke:te(_,c,y.stroke)})}function fe(C,_,y={}){var D=X(_),I=Ie(_,s,y.fill),G=te(_,c,y.stroke);return(D.get("associationDirection")==="One"||D.get("associationDirection")==="Both")&&(y.markerEnd=d(C,"association-end",I,G)),D.get("associationDirection")==="Both"&&(y.markerStart=d(C,"association-start",I,G)),y=Ve(y,["markerStart","markerEnd"]),x(C,_.waypoints,{...y,stroke:G,strokeDasharray:"0, 5"})}function se(C,_,y={}){var D=Ie(_,s,y.fill),I=te(_,c,y.stroke),G=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}}),oe=b(C,G,{fill:D,fillOpacity:po,stroke:I}),Ce=X(_);if(oS(Ce)){var We=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.33,my:(_.height-18)/_.height}});b(C,We,{strokeWidth:2,fill:D,stroke:I})}return oe}function ce(C,_,y={}){return m(C,_.width,_.height,{fillOpacity:po,...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:po,stroke:te(_,c,y.stroke)})}function j(C,_,y={}){var D=g(C,Hn(_,y),Cn(_,y),0,{fill:Ie(_,s,y.fill),fillOpacity:y.fillOpacity||po,stroke:te(_,c,y.stroke),strokeWidth:1.5}),I=X(_);if(v(I,"bpmn:Lane")){var G=I.get("name");q(C,G,_,y)}return D}function B(C,_,y={}){var D=pe(C,_,y),I=Be(_);if(cn(_)&&(re(D,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!I)){var G=X(_).flowElements||[],oe=G.filter(Ce=>v(Ce,"bpmn:StartEvent"));oe.length===1&&U(oe[0],C,y,_)}return $e(C,_,I?"center-top":"center-middle",y),I?z(C,_,void 0,y):z(C,_,["SubProcessMarker"],y),D}function U(C,_,y,D){var I=22,G={fill:Ie(D,s,y.fill),stroke:te(D,c,y.stroke),width:I,height:I},oe=X(C).isInterrupting,Ce=oe?0:3,We=oe?1:1.2,pt=20,Je=(I-pt)/2,$t="translate("+Je+","+Je+")";m(_,pt,pt,{fill:G.fill,stroke:G.stroke,strokeWidth:We,strokeDasharray:Ce,transform:$t}),F(C,_,G,D)}function Te(C,_,y={}){var D=pe(C,_,y);return $e(C,_,"center-middle",y),z(C,_,void 0,y),D}var kt=this.handlers={"bpmn:AdHocSubProcess":function(C,_,y={}){return Be(_)?y=Ve(y,["fill","stroke","width","height"]):y=Ve(y,["fill","stroke"]),B(C,_,y)},"bpmn:Association":function(C,_,y={}){return y=Ve(y,["fill","stroke"]),fe(C,_,y)},"bpmn:BoundaryEvent":function(C,_,y={}){var{renderIcon:D=!0}=y;y=Ve(y,["fill","stroke"]);var I=X(_),G=I.get("cancelActivity");y={strokeWidth:1.5,fill:Ie(_,s,y.fill),fillOpacity:fS,stroke:te(_,c,y.stroke)},G||(y.strokeDasharray="6");var oe=ce(C,_,y);return m(C,_.width,_.height,ks,{...y,fill:"none"}),D&&F(_,C,y),oe},"bpmn:BusinessRuleTask":function(C,_,y={}){y=Ve(y,["fill","stroke"]);var D=Te(C,_,y),I=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),G=b(C,I);re(G,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1});var oe=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),Ce=b(C,oe);return re(Ce,{fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke),strokeWidth:1}),D},"bpmn:CallActivity":function(C,_,y={}){return y=Ve(y,["fill","stroke"]),B(C,_,{strokeWidth:5,...y})},"bpmn:ComplexGateway":function(C,_,y={}){y=Ve(y,["fill","stroke"]);var D=ee(C,_,y),I=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:_.width,containerHeight:_.height,position:{mx:.46,my:.26}});return b(C,I,{fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke),strokeWidth:1}),D},"bpmn:DataInput":function(C,_,y={}){y=Ve(y,["fill","stroke"]);var D=i.getRawPath("DATA_ARROW"),I=se(C,_,y);return b(C,D,{fill:"none",stroke:te(_,c,y.stroke),strokeWidth:1}),I},"bpmn:DataInputAssociation":function(C,_,y={}){return y=Ve(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=Ve(y,["fill","stroke"]),se(C,_,y)},"bpmn:DataObjectReference":L("bpmn:DataObject"),"bpmn:DataOutput":function(C,_,y={}){y=Ve(y,["fill","stroke"]);var D=i.getRawPath("DATA_ARROW"),I=se(C,_,y);return b(C,D,{strokeWidth:1,fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke)}),I},"bpmn:DataOutputAssociation":function(C,_,y={}){return y=Ve(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=Ve(y,["fill","stroke"]);var D=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:0,my:.133}});return b(C,D,{fill:Ie(_,s,y.fill),fillOpacity:po,stroke:te(_,c,y.stroke),strokeWidth:2})},"bpmn:EndEvent":function(C,_,y={}){var{renderIcon:D=!0}=y;y=Ve(y,["fill","stroke"]);var I=ce(C,_,{...y,strokeWidth:4});return D&&F(_,C,y),I},"bpmn:EventBasedGateway":function(C,_,y={}){y=Ve(y,["fill","stroke"]);var D=X(_),I=ee(C,_,y);m(C,_.width,_.height,_.height*.2,{fill:Ie(_,"none",y.fill),stroke:te(_,c,y.stroke),strokeWidth:1});var G=D.get("eventGatewayType"),oe=!!D.get("instantiate");function Ce(){var pt=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:_.width,containerHeight:_.height,position:{mx:.36,my:.44}});b(C,pt,{fill:"none",stroke:te(_,c,y.stroke),strokeWidth:2})}if(G==="Parallel"){var We=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}});b(C,We,{fill:"none",stroke:te(_,c,y.stroke),strokeWidth:1})}else G==="Exclusive"&&(oe||m(C,_.width,_.height,_.height*.26,{fill:"none",stroke:te(_,c,y.stroke),strokeWidth:1}),Ce());return I},"bpmn:ExclusiveGateway":function(C,_,y={}){y=Ve(y,["fill","stroke"]);var D=ee(C,_,y),I=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:_.width,containerHeight:_.height,position:{mx:.32,my:.3}}),G=ze(_);return G.get("isMarkerVisible")&&b(C,I,{fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke),strokeWidth:1}),D},"bpmn:Gateway":function(C,_,y={}){return y=Ve(y,["fill","stroke"]),ee(C,_,y)},"bpmn:Group":function(C,_,y={}){return y=Ve(y,["fill","stroke","width","height"]),g(C,_.width,_.height,Ds,{stroke:te(_,c,y.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:Hn(_,y),height:Cn(_,y)})},"bpmn:InclusiveGateway":function(C,_,y={}){y=Ve(y,["fill","stroke"]);var D=ee(C,_,y);return m(C,_.width,_.height,_.height*.24,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:2.5}),D},"bpmn:IntermediateEvent":function(C,_,y={}){var{renderIcon:D=!0}=y;y=Ve(y,["fill","stroke"]);var I=ce(C,_,{...y,strokeWidth:1.5});return m(C,_.width,_.height,ks,{fill:"none",stroke:te(_,c,y.stroke),strokeWidth:1.5}),D&&F(_,C,y),I},"bpmn:IntermediateCatchEvent":L("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":L("bpmn:IntermediateEvent"),"bpmn:Lane":function(C,_,y={}){return y=Ve(y,["fill","stroke","width","height"]),j(C,_,{...y,fillOpacity:dS})},"bpmn:ManualTask":function(C,_,y={}){y=Ve(y,["fill","stroke"]);var D=Te(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}),D},"bpmn:MessageFlow":function(C,_,y={}){y=Ve(y,["fill","stroke"]);var D=X(_),I=ze(_),G=Ie(_,s,y.fill),oe=te(_,c,y.stroke),Ce=x(C,_.waypoints,{markerEnd:d(C,"messageflow-end",G,oe),markerStart:d(C,"messageflow-start",G,oe),stroke:oe,strokeDasharray:"10, 11",strokeWidth:1.5});if(D.get("messageRef")){var We=Ce.getPointAtLength(Ce.getTotalLength()/2),pt=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:We.x,y:We.y}}),Je={strokeWidth:1};I.get("messageVisibleKind")==="initiating"?(Je.fill=G,Je.stroke=oe):(Je.fill=oe,Je.stroke=G);var $t=b(C,pt,Je),Jt=D.get("messageRef"),en=Jt.get("name"),at=le(C,en,{align:"center-top",fitBox:!0,style:{fill:oe}}),jt=$t.getBBox(),hn=at.getBBox(),ri=We.x-hn.width/2,Nn=We.y+jt.height/2+uS;Ps(at,ri,Nn,0)}return Ce},"bpmn:ParallelGateway":function(C,_,y={}){y=Ve(y,["fill","stroke"]);var D=ee(C,_,y),I=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:_.width,containerHeight:_.height,position:{mx:.46,my:.2}});return b(C,I,{fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke),strokeWidth:1}),D},"bpmn:Participant":function(C,_,y={}){y=Ve(y,["fill","stroke","width","height"]);var D=j(C,_,y),I=Be(_),G=Vt(_),oe=X(_),Ce=oe.get("name");if(I){var We=G?[{x:30,y:0},{x:30,y:Cn(_,y)}]:[{x:0,y:30},{x:Hn(_,y),y:30}];E(C,We,{stroke:te(_,c,y.stroke),strokeWidth:lS}),q(C,Ce,_,y)}else{var pt=ia(_,y);G||(pt.height=Hn(_,y),pt.width=Cn(_,y));var Je=le(C,Ce,{box:pt,align:"center-middle",style:{fill:na(_,u,c,y.stroke)}});if(!G){var $t=-1*Cn(_,y);Ps(Je,0,-$t,270)}}return oe.get("participantMultiplicity")&&N("ParticipantMultiplicityMarker",C,_,y),D},"bpmn:ReceiveTask":function(C,_,y={}){y=Ve(y,["fill","stroke"]);var D=X(_),I=Te(C,_,y),G;return D.get("instantiate")?(m(C,28,28,20*.22,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1}),G=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):G=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),b(C,G,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1}),I},"bpmn:ScriptTask":function(C,_,y={}){y=Ve(y,["fill","stroke"]);var D=Te(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}),D},"bpmn:SendTask":function(C,_,y={}){y=Ve(y,["fill","stroke"]);var D=Te(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}),D},"bpmn:SequenceFlow":function(C,_,y={}){y=Ve(y,["fill","stroke"]);var D=Ie(_,s,y.fill),I=te(_,c,y.stroke),G=x(C,_.waypoints,{markerEnd:d(C,"sequenceflow-end",D,I),stroke:I}),oe=X(_),{source:Ce}=_;if(Ce){var We=X(Ce);oe.get("conditionExpression")&&v(We,"bpmn:Activity")&&re(G,{markerStart:d(C,"conditional-flow-marker",D,I)}),We.get("default")&&(v(We,"bpmn:Gateway")||v(We,"bpmn:Activity"))&&We.get("default")===oe&&re(G,{markerStart:d(C,"conditional-default-flow-marker",D,I)})}return G},"bpmn:ServiceTask":function(C,_,y={}){y=Ve(y,["fill","stroke"]);var D=Te(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 G=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return b(C,G,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:1}),D},"bpmn:StartEvent":function(C,_,y={}){var{renderIcon:D=!0}=y;y=Ve(y,["fill","stroke"]);var I=X(_);I.get("isInterrupting")||(y={...y,strokeDasharray:"6"});var G=ce(C,_,y);return D&&F(_,C,y),G},"bpmn:SubProcess":function(C,_,y={}){return Be(_)?y=Ve(y,["fill","stroke","width","height"]):y=Ve(y,["fill","stroke"]),B(C,_,y)},"bpmn:Task":function(C,_,y={}){return y=Ve(y,["fill","stroke"]),Te(C,_,y)},"bpmn:TextAnnotation":function(C,_,y={}){y=Ve(y,["fill","stroke"]);var{width:D,height:I}=ia(_,y),G=g(C,D,I,0,0,{fill:"none",stroke:"none"}),oe=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:I,position:{mx:0,my:0}});b(C,oe,{stroke:te(_,c,y.stroke)});var Ce=X(_),We=Ce.get("text")||"";return le(C,We,{align:"left-top",box:ia(_,y),padding:lo,style:{fill:na(_,u,c,y.stroke)}}),G},"bpmn:Transaction":function(C,_,y={}){Be(_)?y=Ve(y,["fill","stroke","width","height"]):y=Ve(y,["fill","stroke"]);var D=B(C,_,{strokeWidth:1.5,...y}),I=n.style(["no-fill","no-events"],{stroke:te(_,c,y.stroke),strokeWidth:1.5}),G=Be(_);return G||(y={}),g(C,Hn(_,y),Cn(_,y),Ds-ks,ks,I),D},"bpmn:UserTask":function(C,_,y={}){y=Ve(y,["fill","stroke"]);var D=Te(C,_,y),I=15,G=12,oe=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:I,y:G}});b(C,oe,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:.5});var Ce=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:I,y:G}});b(C,Ce,{fill:Ie(_,s,y.fill),stroke:te(_,c,y.stroke),strokeWidth:.5});var We=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:I,y:G}});return b(C,We,{fill:te(_,c,y.stroke),stroke:te(_,c,y.stroke),strokeWidth:.5}),D},label:function(C,_,y={}){return ut(C,_,y)}};this._drawPath=b,this._renderer=T}ie(Br,Ci),Br.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Br.prototype.canRender=function(e){return v(e,"bpmn:BaseElement")},Br.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Br.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Br.prototype.getShapePath=function(e){return Ae(e)?ll(e,pS):v(e,"bpmn:Event")?am(e):v(e,"bpmn:Activity")?ll(e,Ds):v(e,"bpmn:Gateway")?aS(e):sS(e)};function Ve(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var hS=0,mS={width:150,height:50};function gS(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function yS(e){return Ht(e)?O({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var pl=null;function vS(){return pl||(pl=document.createElement("canvas").getContext("2d")),pl}function _S(e){var t=[];return e.fontStyle&&t.push(e.fontStyle),e.fontVariant&&t.push(e.fontVariant),e.fontWeight&&t.push(e.fontWeight),e.fontStretch&&t.push(e.fontStretch),t.push(sm(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function sm(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function bS(e,t){var n=vS();if(!n)return{width:0,height:0};n.font=_S(t),"letterSpacing"in n&&(n.letterSpacing=sm(t.letterSpacing)||"0px");var i=e==="",r=i?"dummy":e.replace(/\s+$/,""),o=n.measureText(r);return{width:i?0:o.width,height:"fontBoundingBoxAscent"in o?o.fontBoundingBoxAscent+o.fontBoundingBoxDescent:o.actualBoundingBoxAscent+o.actualBoundingBoxDescent}}function xS(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=bS(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return ES(e,r,i,o);r=SS(r,o.width,t)}}function ES(e,t,n,i){if(t.length<n.length){var r=n.slice(t.length).trim();e.unshift(r)}return{width:i.width,height:i.height,text:t}}var cm="";function wS(e,t){var n=e.split(/(\s|-|\u00AD)/g),i,r=[],o=0;if(n.length>1)for(;i=n.shift();)if(i.length+o<t)r.push(i),o+=i.length;else{(i==="-"||i===cm)&&r.pop();break}var a=r[r.length-1];return a&&a===cm&&(r[r.length-1]="-"),r.join("")}function SS(e,t,n){var i=Math.max(e.length*(n/t),1),r=wS(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function Os(e){this._config=O({},{size:mS,padding:hS,style:{},align:"center-top"},e||{})}Os.prototype.createText=function(e,t){return this.layoutText(e,t).element},Os.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Os.prototype.layoutText=function(e,t){for(var n=O({},this._config.size,t.box),i=O({},this._config.style,t.style),r=gS(t.align||this._config.align),o=yS(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=RS(i),c=e.split(/\u00AD?\r?\n/),u=[],l=n.width-o.left-o.right;c.length;)u.push(xS(c,l,i));r.vertical==="middle"&&(o.top=o.bottom=0);var p=En(u,function(g,S,E){return g+(s||S.height)},0)+o.top+o.bottom,f=En(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=de("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=de("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 RS(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var CS=12,PS=1.2,AS=40;function um(e){var t=O({fontFamily:"Arial, sans-serif",fontSize:CS,fontWeight:"normal",lineHeight:PS},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=O({},t,{fontSize:n},e&&e.externalStyle||{}),r=new Os({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Nr.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:lo});return{x:a.x,y:a.y,width:a.width,height:Math.max(AS,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,O({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}um.$inject=["config.textRenderer"];function TS(){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=OS(i.d,{mx:r,my:o,e:a});return p}}var MS=/\{([^{}]+)\}/g,kS=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function DS(e,t,n){var i=n;return t.replace(kS,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 OS(e,t){return String(e).replace(MS,function(n,i){return DS(n,i,t)})}const LS={__init__:["bpmnRenderer"],bpmnRenderer:["type",Br],textRenderer:["type",um],pathMap:["type",TS]};function IS(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const ra={translate:["value",IS]};function Ls(e,t,n){return O({id:e.id,type:e.$type,businessObject:e,di:t},n)}function NS(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 lm(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(Ls(e,t,a)),this._canvas.addRootElement(i)}else if(v(t,"bpmndi:BPMNShape")){var s=!Be(e,t),c=$S(e);r=n&&(n.hidden||n.collapsed);var u=t.bounds;i=this._elementFactory.createShape(Ls(e,t,{collapsed:s,hidden:r,x:Math.round(u.x),y:Math.round(u.y),width:Math.round(u.width),height:Math.round(u.height),isFrame:c})),v(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),v(e,"bpmn:Lane")&&(o=0),v(e,"bpmn:DataStoreReference")&&(BS(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(Ls(e,t,{hidden:r,source:l,target:p,waypoints:NS(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)&&In(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 lm(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=J1(t,n),r=In(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(Ls(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!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)},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?lm(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 BS(e,t){var n=t.x,i=t.y;return n>=e.x&&n<=e.x+e.width&&i>=e.y&&i<=e.y+e.height}function $S(e){return v(e,"bpmn:Group")}const pm={__depends__:[LS,{__depends__:[ra],bpmnImporter:["type",Mi]}]};function oa(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function ni(e,t){return{x:e.x-t.x,y:e.y-t.y}}function fl(e){return Math.log(e)/Math.log(10)}var jS=1e3;function K(e){this._eventBus=e}K.$inject=["eventBus"];function FS(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}K.prototype.on=function(e,t,n,i,r,o){if((zt(t)||be(t))&&(o=r,r=i,i=n,n=t,t=null),zt(n)&&(o=r,r=i,i=n,n=jS),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?FS(i,o):i,o)})},K.prototype.canExecute=ki("canExecute"),K.prototype.preExecute=ki("preExecute"),K.prototype.preExecuted=ki("preExecuted"),K.prototype.execute=ki("execute"),K.prototype.executed=ki("executed"),K.prototype.postExecute=ki("postExecute"),K.prototype.postExecuted=ki("postExecuted"),K.prototype.revert=ki("revert"),K.prototype.reverted=ki("reverted");function ki(e){return function(n,i,r,o,a){(zt(n)||be(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var dl=["top","bottom","left","right"],Is=10;function hl(e,t){K.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],function(r){var o=r.context,a=o.connection,s=a.source,c=a.target,u=o.hints||{};u.createElementsBehavior!==!1&&(n(s),n(c))}),this.postExecuted(["label.create"],function(r){var o=r.context,a=o.shape,s=o.hints||{};s.createElementsBehavior!==!1&&n(a.labelTarget)}),this.postExecuted(["elements.create"],function(r){var o=r.context,a=o.elements,s=o.hints||{};s.createElementsBehavior!==!1&&a.forEach(function(c){n(c)})});function n(r){if(Ms(r)&&!nt(r)){var o=VS(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-Is-s.height/2};break;case"left":l={x:u.left-Is-s.width/2,y:a.y};break;case"bottom":l={x:a.x,y:u.bottom+Is+s.height/2};break;case"right":l={x:u.right+Is+s.width/2,y:a.y};break}var p=ni(l,c);t.moveShape(s,p)}}}ie(hl,K),hl.$inject=["eventBus","modeling"];function HS(e){var t=e.host,n=ye(e),i=Kt(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=dl.filter(function(a){return r.indexOf(a)===-1});return o}function zS(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 fm(t,i)});return n}function VS(e){var t=ye(e.label),n=ye(e),i=fm(n,t);if(GS(i)){var r=zS(e);if(e.host){var o=HS(e);r=r.concat(o)}var a=dl.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?Kt(e.label,e)!=="intersect"?void 0:i:a[0]}}function fm(e,t){return Kt(t,e,5)}function GS(e){return dl.indexOf(e)!==-1}function ml(e){K.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(ml,K),ml.$inject=["eventBus"];var WS=1500;function gl(e,t,n){e.invoke(K,this),this.preExecute("elements.delete",WS,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(Qr(oo(Array.from(s),Rt(u))));c=c.union(l),s=s.difference(l)}),Array.from(c)}}ie(gl,K),gl.$inject=["injector","eventBus","canvas"];function yl(e,t){e.invoke(K,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(yl,K),yl.$inject=["injector","modeling"];function fo(e,t){for(bn(t)&&(t=[t]);e=e.parent;)if(ke(e,t))return e;return null}function dm(e,t){var n=fo(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=fo(e,i),n)return Vt(n);if(ke(e,i))return Vt(e);var r;for(r=X(e);r&&!v(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find(function(a){var s=X(a);return s&&s.get("processRef")===r});return o?Vt(o):!0}var hm=500;function Ns(e,t){t.invoke(K,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",hm,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return mm(o,a)}),r.length===1&&r.map(function(o){return r.indexOf(o)}).forEach(function(o){var a=r[o];i.elements[o]=n._replaceShape(r[o],a)})},!0),this.preExecute("elements.move",hm,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];mm(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}Ns.$inject=["bpmnReplace","injector"],ie(Ns,K),Ns.prototype._replaceShape=function(e,t){var n=US(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function US(e){var t=X(e),n=t.eventDefinitions;return n&&n[0]}function mm(e,t){return!Ae(e)&&ke(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function vl(e,t){K.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)})})}vl.$inject=["eventBus","modeling"],ie(vl,K);function gm(e){return e.create("bpmn:Category")}function qS(e){return e.create("bpmn:CategoryValue")}function ym(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=qS(e)),n.$parent||(n.$parent=gm(e)),n}function YS(e,t,n){return Et(t.get("categoryValue"),e),e.$parent=t,Et(n.get("rootElements"),t),t.$parent=n,e}function KS(e){var t=e.$parent;return t&&(xt(t.get("categoryValue"),e),e.$parent=null),e}function XS(e){var t=e.$parent;return t&&(xt(t.get("rootElements"),e),e.$parent=null),e}var ZS=500;function _l(e,t,n){n.invoke(K,this);function i(c){return t.filter(function(u){return v(u,"bpmn:Group")&&!u.labelTarget}).map(X).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&&YS(c,u,e.getDefinitions())}function s(c,u,l){u&&!o(u,l)&&XS(u),c&&!r(c,l)&&KS(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,X(u))},!0),this.executed(["shape.move","shape.resize"],ZS,function(c){a(c.categoryValue,c.category)},!0),this.reverted(["shape.move","shape.resize"],function(c){var u=c.shape;c.categoryValue&&s(c.categoryValue,c.category,X(u))},!0),this.executed("group.updateRefs",function(c){vm(c).forEach(function(u){a(u.categoryValue,u.category)})},!0),this.reverted("group.updateRefs",function(c){vm(c).forEach(function(u){s(u.categoryValue,u.category,X(u.groupShape))})},!0),this.executed("shape.delete",function(c){var u=c.shape;!v(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,X(u))},!0),this.reverted("shape.delete",function(c){var u=c.shape;!v(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0)}_l.$inject=["bpmnjs","elementRegistry","injector"],ie(_l,K);function vm(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function bl(e,t,n){K.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;ho(S)&&aa(E)&&l(E)}function r(g){const S=g.connection,E=g.source,x=g.target;ho(E)&&Bs(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),ho(b)&&Bs(S)&&u(S)}}function a(g){const{element:S}=g;aa(S)?(p(S),d(S)):Bs(S)&&h(S)}function s(g){const{newData:S,oldShape:E}=g;if(ho(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(!ho(g.oldShape)&&S.eventDefinitionType==="bpmn:CompensateEventDefinition"&&S.type==="bpmn:BoundaryEvent"){const x=E.outgoing.find(({target:b})=>Bs(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=>ho(E.source));t.removeElements(S)}function m(g){const S=g.outgoing.filter(E=>v(E,"bpmn:SequenceFlow"));t.removeElements(S)}}ie(bl,K),bl.$inject=["eventBus","modeling","bpmnRules"];function aa(e){const t=X(e);return t&&t.get("isForCompensation")}function ho(e){return e&&v(e,"bpmn:BoundaryEvent")&&uo(e,"bpmn:CompensateEventDefinition")}function Bs(e){return e&&v(e,"bpmn:Activity")&&!cn(e)}function xl(e){e.invoke(K,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=fo(i,"bpmn:Participant"))})}xl.$inject=["injector"],ie(xl,K);function El(e,t){K.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,r=i.shape;if(v(r,"bpmn:DataObjectReference")&&r.type!=="label"){var o=t.create("bpmn:DataObject");o.isCollection=((a=r.businessObject.dataObjectRef)==null?void 0:a.isCollection)||!1,r.businessObject.dataObjectRef=o}})}El.$inject=["eventBus","bpmnFactory"],ie(El,K);var wl=20,Sl=20,_m=30,$s=2e3;function Rl(e,t,n){K.call(this,t),t.on(["create.start","shape.move.start"],$s,function(r){var o=r.context,a=o.shape,s=e.getRootElement();if(!(!v(a,"bpmn:Participant")||!v(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(p){return!v(p,"bpmn:Group")&&!Ae(p)&&!nt(p)});if(c.length){var u=Rt(c),l=QS(a,u);O(a,l),o.createConstraints=JS(a,u)}}}),t.on("create.start",$s,function(r){var o=r.context,a=o.shape,s=e.getRootElement(),c=e.getGraphics(s);function u(l){l.element=s,l.gfx=c}v(a,"bpmn:Participant")&&v(s,"bpmn:Process")&&(t.on("element.hover",$s,u),t.once("create.cleanup",function(){t.off("element.hover",u)}))});function i(){var r=e.getRootElement();return v(r,"bpmn:Collaboration")?r:n.makeCollaboration()}this.preExecute("elements.create",$s,function(r){var o=r.elements,a=r.parent,s=eR(o),c;s&&v(a,"bpmn:Process")&&(r.parent=i(),c=r.hints=r.hints||{},c.participant=s,c.process=a,c.processRef=X(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=X(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)&&X(s).set("processRef",X(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)&&X(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)}Rl.$inject=["canvas","eventBus","modeling"],ie(Rl,K);function QS(e,t){t={width:t.width+wl*2+_m,height:t.height+Sl*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 JS(e,t){return t=me(t),{bottom:t.top+e.height/2-Sl,left:t.right-e.width/2+wl,top:t.bottom-e.height/2+Sl,right:t.left+e.width/2-wl-_m}}function eR(e){return ot(e,function(t){return v(t,"bpmn:Participant")})}var bm="__targetRef_placeholder";function Cl(e,t){K.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],xm(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],xm(o));function n(a,s,c){var u=a.get("dataInputAssociations");return ot(u,function(l){return l!==c&&l.targetRef===s})}function i(a,s){var c=a.get("properties"),u=ot(c,function(l){return l.name===bm});return!u&&s&&(u=t.create("bpmn:Property",{name:bm}),Et(c,u)),u}function r(a,s){var c=i(a);c&&(n(a,c,s)||xt(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}}Cl.$inject=["eventBus","bpmnFactory"],ie(Cl,K);function xm(e){return function(t){var n=t.context,i=n.connection;if(v(i,"bpmn:DataInputAssociation"))return e(t)}}function js(e){this._bpmnUpdater=e}js.$inject=["bpmnUpdater"],js.prototype.execute=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.newSemanticParent,r=e.newDiParent;return e.oldSemanticParent=t.$parent,e.oldDiParent=n.$parent,this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,r),[]},js.prototype.revert=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.oldSemanticParent,r=e.oldDiParent;return this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,r),[]};function Pl(e,t,n,i){K.call(this,i),t.registerHandler("dataStore.updateContainment",js);function r(){return n.filter(function(s){return v(s,"bpmn:Participant")&&X(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:ze(s),newSemanticParent:l.processRef||l,newDiParent:ze(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:nR(l,"bpmn:Participant");a(u,f)}}),this.postExecute("shape.delete",function(s){var c=s.context,u=c.shape,l=e.getRootElement();ke(u,["bpmn:Participant","bpmn:SubProcess"])&&v(l,"bpmn:Collaboration")&&o(l).filter(function(p){return tR(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)})})}Pl.$inject=["canvas","commandStack","elementRegistry","eventBus"],ie(Pl,K);function tR(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 nR(e,t){for(;e.parent;){if(v(e.parent,t))return e.parent;e=e.parent}}var Fs=Math.max,Hs=Math.min,iR=20;function Em(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function rR(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 oR(e,t){return{x:e.x+(t.left||0),y:e.y+(t.top||0),width:e.width-(t.left||0)+(t.right||0),height:e.height-(t.top||0)+(t.bottom||0)}}function zs(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return be(r)&&(i=(/top|left/.test(e)?Hs:Fs)(i,r)),be(o)&&(i=(/top|left/.test(e)?Fs:Hs)(i,o)),i}function aR(e,t){if(!t)return e;var n=me(e);return Ss({top:zs("top",n,t),right:zs("right",n,t),bottom:zs("bottom",n,t),left:zs("left",n,t)})}function sR(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:Hs(o.top,a.top),left:Hs(o.left,a.left),bottom:Fs(o.bottom,a.bottom),right:Fs(o.right,a.right)};return Ss(s)}function sa(e,t){return typeof e<"u"?e:iR}function cR(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 uR(e){return!(e.waypoints||e.type==="label")}function wm(e,t){var n;if(e.length===void 0?n=Oe(e.children,uR):n=e,n.length)return cR(Rt(n),t)}var ir=Math.abs;function lR(e,t){return Em(me(t),me(e))}var pR=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],zn=30;function Vs(e,t){return t=t||[],e.children.filter(function(n){v(n,"bpmn:Lane")&&(Vs(n,t),t.push(n))}),t}function rr(e){return e.children.filter(function(t){return v(t,"bpmn:Lane")})}function Vn(e){return fo(e,pR)||e}function fR(e,t){var n=Vn(e),i=v(n,"bpmn:Process")?[]:[n],r=Vs(n,i),o=me(e),a=me(t),s=lR(e,t),c=[],u=Vt(e);return r.forEach(function(l){if(l!==e){var p=u?0:s.top,f=u?s.right:0,d=u?0:s.bottom,h=u?s.left:0,m=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:oR(l,{top:p,right:f,bottom:d,left:h})})}}),c}var dR=500;function Al(e,t){K.call(this,e);function n(i,r){var o=Vt(i),a=rr(r),s=[],c=[],u=[],l=[];if(Lr(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",dR,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))})}Al.$inject=["eventBus","spaceTool"],ie(Al,K);var Sm=500;function Gs(e,t){t.invoke(K,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Sm,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return Rm(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",Sm,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;Rm(a,mR(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}Gs.$inject=["bpmnReplace","injector"],ie(Gs,K),Gs.prototype._replaceShape=function(e){var t=hR(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function hR(e){var t=X(e),n=t.eventDefinitions;return n&&n[0]}function Rm(e,t){return!Ae(e)&&v(e,"bpmn:BoundaryEvent")&&!t}function mR(e,t){return e.indexOf(t)!==-1}var Ws=Math.round,gR=Math.max;function yR(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 vR(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var Cm=10;function _R(e,t){var n,i;for(n=0;i=e[n];n++)if(Zo(i,t)<=Cm)return{point:e[n],bendpoint:!0,index:n};return null}function bR(e,t){var n=kh(yR(t,Cm),vR(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=gR(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:Ws(i.x+r.x)/2,y:Ws(i.y+r.y)/2},index:i.segment2}:{point:{x:Ws(i.x),y:Ws(i.y)},index:i.segment2}:null}function Tl(e,t){return _R(e,t)||bR(e,t)}function Ml(e,t,n){K.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;be(a.width)?S=ye(a):S=a;var E=Tl(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||!Pm(r,c[c.length-1]))&&c.push(Am(l)),(u.length===1||!Pm(r,u[0]))&&u.unshift(Am(l))}p=o.source,f=o.target,t.canConnect(p,r,o)&&(n.reconnectEnd(o,r,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=ot(o.children,function(f){var d=t.canInsert(a,f);return d&&Tl(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(Ml,K),Ml.$inject=["eventBus","bpmnRules","modeling"];function Pm(e,t){var n=t.x,i=t.y;return n>=e.x&&n<=e.x+e.width&&i>=e.y&&i<=e.y+e.height}function Am(e){return O({},e)}function kl(e,t){K.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)&&mo(r)){var c=[];v(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(u=>u!==r&&mo(u)):c=a.incoming.filter(u=>u!==r&&mo(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(mo).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(mo).forEach(function(s){const c=a.incoming.filter(mo).filter(function(u){return u.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}kl.$inject=["eventBus","modeling"],ie(kl,K);function mo(e){return v(e,"bpmn:SequenceFlow")}var Us=1500,Tm=2e3;function Mm(e,t,n){t.on(["create.hover","create.move","create.out","create.end","shape.move.hover","shape.move.move","shape.move.out","shape.move.end"],Us,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;v(a,"bpmn:Lane")&&!ke(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Vn(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||ke(o,["bpmn:Group","bpmn:TextAnnotation"]))&&(i.hover=s,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.hover","connect.out","connect.end","connect.cleanup","global-connect.hover","global-connect.out","global-connect.end","global-connect.cleanup"],Us,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"],Us,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"],Us,function(i){var r=i.context,o=r.start;v(o,"bpmn:Lane")&&(r.start=Vn(o)||o)}),t.on("shape.move.start",Tm,function(i){var r=i.shape;v(r,"bpmn:Lane")&&(i.shape=Vn(r)||r)}),t.on("spaceTool.move",Tm,function(i){var r=i.hover;r&&v(r,"bpmn:Lane")&&(i.hover=Vn(r))})}Mm.$inject=["elementRegistry","eventBus","canvas"];var km=770;function Dl(e,t,n,i){n.invoke(K,this);function r(s,c){var u=X(s),l=c.categoryValue||u.categoryValueRef;l||(l=ym(e,u));var p=c.category||l.$parent||gm(e);u.categoryValueRef=l,l.$parent=p,c.categoryValue=l,c.category=p}function o(s,c){var u=X(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=X(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=X(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&&!X(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&&!X(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||X(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",km,function(s){var c=s.descriptor,u=s.element;if(!(!v(u,"bpmn:Group")||u.labelTarget)){var l=X(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",km,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})}Dl.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],ie(Dl,K);function Ol(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 Dm(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=Ol(i,r,o,a),u=Ol(i,r,o,s),l;c&&u?Om(c,o)>Om(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)})}Dm.$inject=["eventBus"];function Om(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Ll(e){K.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=X(i),o=ze(i);if(ke(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}Ll.$inject=["eventBus"],ie(Ll,K);function Lm(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Im(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function xR(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 ER(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 Il(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=ER([n.x,n.y],[r.x,r.y],[e.x,e.y]);return{x:n.x+o*r.x,y:n.y+o*r.y}}function Nm(e,t){var n=Il(e,t),i={x:n.x-e.x,y:n.y-e.y};return Lm(i)}function ca(e,t){return Lm({x:e.x-t.x,y:e.y-t.y})}var Bm=Math.sqrt,$m=Math.min,wR=Math.max,jm=Math.abs;function Fm(e){return Math.pow(e,2)}function ua(e,t){return Bm(Fm(e.x-t.x)+Fm(e.y-t.y))}function SR(e,t){var n=0,i,r,o,a,s,c,u,l,p,f,d;for(n=0;n<t.length-1;n++){if(i=t[n],r=t[n+1],zm(i,r)?u=[i]:(o=ua(e,i),a=ua(e,r),c=$m(o,a),u=RR(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:zm(i,u[0])?n:n+1}),u.length===2&&(s=PR(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 RR(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=Bm(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 CR(x,e,t)})}function CR(e,t,n){return Hm(e.x,t.x,n.x)&&Hm(e.y,t.y,n.y)}function Hm(e,t,n){return e>=$m(t,n)-qs&&e<=wR(t,n)+qs}function PR(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var qs=.1;function zm(e,t){return jm(e.x-t.x)<=qs&&jm(e.y-t.y)<=qs}function AR(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=Gm(t,u);p<n.relativeLocation&&l++}return l}return o===0?r:i.connectionStart&&r===0?0:i.connectionEnd&&r===e.length-2?t.length-2:Math.floor((t.length-2)/2)}function Vm(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=SR(e,n),c=s.segmentIndex,u=AR(n,t,s,i);if(u<0||u>t.length-2||u===null)return a;var l=Wm(n,c),p=Wm(t,u),f=s.position,d=MR(l,f),h=TR(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=Gm(n,g))}var x={x:(p[1].x-p[0].x)*d+p[0].x,y:(p[1].y-p[0].y)*d+p[0].y},b=xR({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 Gm(e,t){var n=ca(e[t-1],e[t]),i=ca(e[t],e[t+1]),r=n/(n+i);return r}function TR(e,t){var n=Im(e),i=Im(t);return i-n}function Wm(e,t){return[e[t],e[t+1]]}function MR(e,t){var n=ca(e[0],e[1]),i=ca(e[0],t);return n===0?0:i/n}function kR(e,t,n,i){var r=ye(e);return Vm(r,t,n,i).delta}function la(e,t,n){var i=oa(t),r=oa(n),o=ni(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 Um(e,t,n){var i=oa(e),r=oa(t),o=oa(n),a=ni(e,i),s=ni(i,r),c=DR(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 DR(e,t,n){var i=me(t),r=me(n);if(OR(i,r))return null;var o=Kt(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=Kt(n,s),c!==o?null:a}function OR(e,t){return LR(e,t)||IR(e,t)}function LR(e,t){return e.right!==t.right&&e.left!==t.left}function IR(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var qm="name",Ym="text";function Nl(e,t,n,i){K.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{X(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var s=a.context,c=s.element,u=s.properties;if(qm in u&&t.updateLabel(c,u[qm]),Ym in u&&v(c,"bpmn:TextAnnotation")){var l=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},u[Ym]||"");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;Ae(u)||!nr(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=O({},s.hints),p=s.newWaypoints||c.waypoints,f=s.oldWaypoints;return typeof l.startChanged>"u"&&(l.startChanged=!!l.connectionStart),typeof l.endChanged>"u"&&(l.endChanged=!!l.connectionEnd),kR(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=X(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(!(!Ae(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(Ms(c)){var p=c.label,f=ye(p),d=$R(l),h=BR(f,d),m=NR(h,l,u);t.moveShape(p,m)}})}ie(Nl,K),Nl.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function NR(e,t,n){var i=la(e,t,n);return Ai(ni(i,e))}function BR(e,t){if(t.length){var n=jR(e,t);return Il(e,n)}}function $R(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 jR(e,t){var n=t.map(function(r){return{line:r,distance:Nm(e,r)}}),i=oi(n,"distance");return i[0].line}function FR(e,t,n,i){return Vm(e,t,n,i).point}function Bl(e,t){K.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=O({},o.hints),c=o.newWaypoints||a.waypoints,u=o.oldWaypoints;return typeof s.startChanged>"u"&&(s.startChanged=!!s.connectionStart),typeof s.endChanged>"u"&&(s.endChanged=!!s.connectionEnd),FR(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(Bl,K),Bl.$inject=["eventBus","modeling"];function Ys(e,t,n){var i=Xs(e),r=Xm(i,t),o=i[0];return r.length?r[r.length-1]:la(o.original||o,n,t)}function Ks(e,t,n){var i=Xs(e),r=Xm(i,t),o=i[i.length-1];return r.length?r[0]:la(o.original||o,n,t)}function $l(e,t,n){var i=Xs(e),r=Km(t,n),o=i[0];return la(o.original||o,r,t)}function jl(e,t,n){var i=Xs(e),r=Km(t,n),o=i[i.length-1];return la(o.original||o,r,t)}function Km(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Xs(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Xm(e,t){var n=rn(e,zR);return Oe(n,function(i){return HR(i,t)})}function HR(e,t){return Kt(t,e,1)==="intersect"}function zR(e){return e.original||e}function Fl(e,t){K.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(VR(i,r)){var o=GR(i);o.incoming.forEach(function(a){var s=Ks(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=Ys(a,r,i);t.reconnectStart(a,r,s)})}},!0)}Fl.$inject=["eventBus","modeling"],ie(Fl,K);function VR(e,t){return v(e,"bpmn:Participant")&&Be(e)&&v(t,"bpmn:Participant")&&!Be(t)}function GR(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 WR=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Zm(e){const t=X(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:WR.some(i=>v(n[0],i))}function Qm(e){return v(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Hl(e,t){e.invoke(K,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!Zm(r))return;const a=Qm(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=X(i).get(a),u=X(r).get(a);c!==u&&t.updateProperties(r,{[a]:c})})}Hl.$inject=["injector","modeling"],ie(Hl,K);function zl(e,t){K.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=ze(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}ie(zl,K),zl.$inject=["eventBus","modeling"];function Vl(e,t,n){K.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=UR(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}ie(Vl,K),Vl.$inject=["eventBus","bpmnRules","modeling"];function go(e){return e.original||e}function UR(e,t){var n=Ol(go(e[e.length-2]),go(e[e.length-1]),go(t[1]),go(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[go(e[0]),go(t[t.length-1])]}function Gl(e,t){K.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)}Gl.$inject=["eventBus","modeling"],ie(Gl,K);function Wl(e,t,n,i){K.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=ot(p.outgoing,eo({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(Wl,K),Wl.$inject=["eventBus","modeling","bpmnRules","injector"];function Zs(e,t,n,i,r,o){i.invoke(K,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,function(a){var s=a.context,c=s.parent,u=s.elements,l=En(u,function(p,f){var d=t.canReplace([f],f.host||f.parent||c);return d?p.concat(d.replacements):p},[]);l.length&&this._replaceElements(u,l)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,u=s.newHost,l=[];M(s.closure.topLevel,function(f){cn(f)?l=l.concat(f.children):l=l.concat(f)}),l.length===1&&u&&(c=u);var p=t.canReplace(l,c);p&&this._replaceElements(l,p.replacements,u)},this),this.postExecute(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,u=s.newShape,l=c.attachers,p;l&&l.length&&(p=t.canReplace(l,u),this._replaceElements(l,p.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,u=s.newShape;r.unclaimId(c.businessObject.id,c.businessObject),r.updateProperties(u,{id:c.id})})}ie(Zs,K),Zs.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;M(t,function(o){var a={type:o.newElementType},s=n.get(o.oldElementId),c=e.indexOf(s);e[c]=i.replaceElement(s,a,{select:!1})}),t&&r.select(e)},Zs.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var qR=1500,YR={width:140,height:120},Ul={width:300,height:60},ql={width:60,height:300},Qs={width:300,height:150},Js={width:150,height:300},Jm={width:140,height:120},eg={width:100,height:40};function tg(e){e.on("resize.start",qR,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=JR(i,r,o)),v(i,"bpmn:SubProcess")&&Be(i)&&(n.minDimensions=Jm),v(i,"bpmn:TextAnnotation")&&(n.minDimensions=eg)})}tg.$inject=["eventBus"];var or=Math.abs,KR=Math.min,XR=Math.max;function ng(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function yo(e,t,n){return ng(e,t,n,KR)}function vo(e,t,n){return ng(e,t,n,XR)}var ZR={top:20,left:50,right:20,bottom:20},QR={top:50,left:20,right:20,bottom:20};function JR(e,t,n){var i=Vn(e),r=!0,o=!0,a=Vs(i,[i]),s=me(e),c={},u={},l=Vt(e),p=l?Ul:ql;/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&&vo(c,"top",m.top+p.height),or(s.top-m.top)<5&&yo(u,"top",m.bottom-p.height)),/e/.test(t)&&(n&&or(s.right-m.left)<10&&yo(c,"right",m.right-p.width),or(s.right-m.right)<5&&vo(u,"right",m.left+p.width)),/s/.test(t)&&(n&&or(s.bottom-m.top)<10&&yo(c,"bottom",m.bottom-p.height),or(s.bottom-m.bottom)<5&&vo(u,"bottom",m.top+p.height)),/w/.test(t)&&(n&&or(s.left-m.right)<10&&vo(c,"left",m.left+p.width),or(s.left-m.left)<5&&yo(u,"left",m.right-p.width))});var f=i.children.filter(function(h){return!h.hidden&&!h.waypoints&&(v(h,"bpmn:FlowElement")||v(h,"bpmn:Artifact"))}),d=l?ZR:QR;return f.forEach(function(h){var m=me(h);/n/.test(t)&&(!l||r)&&yo(u,"top",m.top-d.top),/e/.test(t)&&(l||o)&&vo(u,"right",m.right+d.right),/s/.test(t)&&(!l||o)&&vo(u,"bottom",m.bottom+d.bottom),/w/.test(t)&&(l||r)&&yo(u,"left",m.left-d.left)}),{min:u,max:c}}function ig(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function _o(e){return e.originalEvent||e.srcEvent}function Yl(e){ig(e),ig(_o(e))}function $r(e){return e.pointers&&e.pointers.length&&(e=e.pointers[0]),e.touches&&e.touches.length&&(e=e.touches[0]),e?{x:e.clientX,y:e.clientY}:null}function rg(){return/mac/i.test(navigator.platform)}function og(e,t){return(_o(e)||e).button===t}function ar(e){return og(e,0)}function eC(e){return og(e,1)}function pa(e){var t=_o(e)||e;return ar(e)?rg()?t.metaKey:t.ctrlKey:!1}function ec(e){var t=_o(e)||e;return ar(e)&&t.shiftKey}var ag=1001;function sg(e,t){e.on("resize.start",ag+500,function(n){var i=n.context,r=i.shape;(v(r,"bpmn:Lane")||v(r,"bpmn:Participant"))&&(i.balanced=!pa(n))}),e.on("resize.end",ag,function(n){var i=n.context,r=i.shape,o=i.canExecute,a=i.newBounds;if(v(r,"bpmn:Lane")||v(r,"bpmn:Participant"))return o&&(a=Nh(a),t.resizeLane(r,a,i.balanced)),!1})}sg.$inject=["eventBus","modeling"];var tC=500;function Kl(e,t,n,i,r){n.invoke(K,this);function o(l){return ke(l,["bpmn:ReceiveTask","bpmn:SendTask"])||nC(l,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(l){var p=e.getDefinitions(),f=p.get("rootElements");return!!ot(f,eo({id:l.id}))}function s(l){if(v(l,"bpmn:ErrorEventDefinition"))return"errorRef";if(v(l,"bpmn:EscalationEventDefinition"))return"escalationRef";if(v(l,"bpmn:MessageEventDefinition"))return"messageRef";if(v(l,"bpmn:SignalEventDefinition"))return"signalRef"}function c(l){if(ke(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.get("messageRef");var p=l.get("eventDefinitions"),f=p[0];return f.get(s(f))}function u(l,p){if(ke(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.set("messageRef",p);var f=l.get("eventDefinitions"),d=f[0];return d.set(s(d),p)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var p=l.shape||l.element;if(o(p)){var f=X(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");xt(f,p)}},!0),t.on("copyPaste.copyElement",function(l){var p=l.descriptor,f=l.element;if(!(f.labelTarget||!o(f))){var d=X(f),h=c(d);h&&(p.referencedRootElement=h)}}),t.on("copyPaste.pasteElement",tC,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)})}Kl.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],ie(Kl,K);function nC(e,t){return ge(t)||(t=[t]),zi(t,function(n){return uo(e,n)})}var cg=Math.max;function ug(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return M(n,function(a){var s=a.id;v(a,"bpmn:Participant")&&(o[s]=rC(a,i,r)),v(a,"bpmn:Lane")&&(o[s]=Vt(a)?Ul:ql),v(a,"bpmn:SubProcess")&&Be(a)&&(o[s]=Jm),v(a,"bpmn:TextAnnotation")&&(o[s]=eg),v(a,"bpmn:Group")&&(o[s]=YR)}),o})}ug.$inject=["eventBus"];function iC(e){return e==="x"}function rC(e,t,n){var i=Vt(e);if(!sC(e))return i?Qs:Js;var r=iC(t),o={};return r?i?o=Qs:o={width:aC(e,n,r),height:Js.height}:i?o={width:Qs.width,height:oC(e,n,r)}:o=Js,o}function oC(e,t,n){var i;return i=cC(e,t,n),cg(Qs.height,i)}function aC(e,t,n){var i;return i=uC(e,t,n),cg(Js.width,i)}function sC(e){return!!rr(e).length}function cC(e,t,n){var i=rr(e),r;return r=Xl(i,t,n),e.height-r.height+Ul.height}function uC(e,t,n){var i=rr(e),r;return r=Xl(i,t,n),e.width-r.width+ql.width}function Xl(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?Xl(o,t,n):r}var lg="_plane";function pg(e){var t=e.id;return lC(t)}function gi(e){var t=e.id;return v(e,"bpmn:SubProcess")?fg(t):t}function jr(e){return fg(e)}function tc(e){var t=ze(e);return v(t,"bpmndi:BPMNPlane")}function fg(e){return e+lg}function lC(e){return e.replace(new RegExp(lg+"$"),"")}var dg=400,pC=600,hg={x:180,y:160};function Di(e,t,n,i,r,o,a){K.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=X(f);d=s._addDiagram(d||h),p.newRootElement=e.addRootElement(d)}function l(p){var f=p.shape,d=X(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=mg(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(tc(f)){a.updateId(f,jr(g)),a.updateId(m,g);return}var S=a.get(jr(m));S&&a.updateId(jr(m),jr(g))}}},!0),this.reverted("element.updateProperties",function(p){var f=p.element;if(v(f,"bpmn:SubProcess")){var d=p.properties,h=p.oldProperties,m=h.id,g=d.id;if(m!==g){if(tc(f)){a.updateId(f,jr(m)),a.updateId(g,m);return}var S=a.get(jr(g));S&&a.updateId(S,jr(m))}}},!0),t.on("element.changed",function(p){var f=p.element;if(tc(f)){var d=f,h=a.get(pg(d));!h||h===d||t.fire("element.changed",{element:h})}}),this.executed("shape.toggleCollapse",dg,function(p){var f=p.shape;v(f,"bpmn:SubProcess")&&(Be(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",dg,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",pC,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=mg(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(ze(m),"bpmndi:BPMNPlane");if(g){var S=pg(m),E=ot(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,K),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=Rt(i),o;if(!t.x)o={x:hg.x-r.x,y:hg.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(om(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=ot(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 fC(e){var t=[];return M(ta(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function mg(e){return e.children.slice().concat(fC(e.children)).concat(dC(e))}function dC(e){return tl(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function Zl(e,t){e.invoke(K,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=hC(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}Zl.$inject=["injector","modeling"],ie(Zl,K);function hC(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function Ql(e,t){K.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(Ql,K),Ql.$inject=["eventBus","textRenderer"];function Jl(e,t){K.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(Jl,K),Jl.$inject=["eventBus","modeling"];var ep=500;function tp(e,t,n){K.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=mC(c).concat([a]),p=wm(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"],ep,function(a){var s=a.context,c=s.shape;v(c,"bpmn:SubProcess")&&(c.collapsed?ze(c).isExpanded=!1:(i(c.children),ze(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],ep,function(a){var s=a.context,c=s.shape;c.collapsed?ze(c).isExpanded=!1:ze(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],ep,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(tp,K),tp.$inject=["eventBus","elementFactory","modeling"];function mC(e){return e.filter(function(t){return!t.hidden})}function np(e,t,n,i){t.invoke(K,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;Ae(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(np,K),np.$inject=["canvas","injector","moddle","modeling"];function ip(e,t){K.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;gC(r,o)&&t.updateProperties(o,{default:null})})}ie(ip,K),ip.$inject=["eventBus","modeling"];function gC(e,t){if(!v(e,"bpmn:SequenceFlow"))return!1;var n=X(t),i=X(e);return n.get("default")===i}var yC=500,vC=5e3,gg=["shape.create","shape.delete","shape.move","shape.resize"],yg=[...gg,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function rp(e,t){K.call(this,e);var n;function i(){return n=n||new _C,n.enter(),n}function r(){if(!n)throw new Error("out of bounds release");return n}function o(){if(!n)throw new Error("out of bounds release");var a=n.leave();return a&&(t.updateLaneRefs(n.flowNodes,n.lanes),n=null),a}this.preExecute(yg,vC,function(){i()}),this.postExecuted(yg,yC,function(){o()}),this.preExecute(gg,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))})}rp.$inject=["eventBus","modeling"],ie(rp,K);function _C(){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 bC=500,xC=5e3,vg=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],_g=[...vg,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function op(e,t){K.call(this,e);var n;function i(){return n=n||new EC,n.enter(),n}function r(){if(!n)throw new Error("out of bounds release");return n}function o(){if(!n)throw new Error("out of bounds release");var a=n.leave();return a&&(t.updateCategoryValueRefs(Array.from(n.affectedFlowElements),Array.from(n.affectedGroupEntries.values())),n=null),a}this.preExecute(_g,xC,function(){i()}),this.postExecuted(_g,bC,function(){o()}),this.preExecute(vg,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)})}op.$inject=["eventBus","modeling"],ie(op,K);function EC(){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 ap(e,t){K.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)wC(o)&&!RC(o)&&t.updateProperties(o,{isForCompensation:void 0})})}ie(ap,K),ap.$inject=["eventBus","modeling"];function wC(e){const t=X(e);return t&&t.isForCompensation}function SC(e){return e&&v(e,"bpmn:BoundaryEvent")&&uo(e,"bpmn:CompensateEventDefinition")}function RC(e){return e.incoming.filter(n=>SC(n.source)).length>0}const CC={__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",hl],appendBehavior:["type",ml],associationBehavior:["type",yl],attachEventBehavior:["type",Ns],artifactBehavior:["type",gl],boundaryEventBehavior:["type",vl],categoryRootElementReferenceBehavior:["type",_l],compensateBoundaryEventBehaviour:["type",bl],createBehavior:["type",xl],createDataObjectBehavior:["type",El],createParticipantBehavior:["type",Rl],dataInputAssociationBehavior:["type",Cl],dataStoreBehavior:["type",Pl],deleteLaneBehavior:["type",Al],detachEventBehavior:["type",Gs],dropOnFlowBehavior:["type",Ml],eventBasedGatewayBehavior:["type",kl],fixHoverBehavior:["type",Mm],groupBehavior:["type",Dl],importDockingFix:["type",Dm],isHorizontalFix:["type",Ll],labelBehavior:["type",Nl],layoutConnectionBehavior:["type",Bl],messageFlowBehavior:["type",Fl],nonInterruptingBehavior:["type",Hl],removeElementBehavior:["type",Vl],removeEmbeddedLabelBoundsBehavior:["type",zl],removeParticipantBehavior:["type",Gl],replaceConnectionBehavior:["type",Wl],replaceElementBehaviour:["type",Zs],resizeBehavior:["type",tg],resizeLaneBehavior:["type",sg],rootElementReferenceBehavior:["type",Kl],spaceToolBehavior:["type",ug],subProcessPlaneBehavior:["type",Di],subProcessStartEventBehavior:["type",Zl],textAnnotationBehavior:["type",Ql],toggleCollapseConnectionBehaviour:["type",Jl],toggleElementCollapseBehaviour:["type",tp],unclaimIdBehavior:["type",np],unsetDefaultFlowBehavior:["type",ip],updateFlowNodeRefsBehavior:["type",rp],updateCategoryValueRefsBehavior:["type",op],setCompensationActivityAfterPasteBehavior:["type",ap]};function sp(e){this._commandStack=e.get("commandStack",!1)}sp.$inject=["injector"],sp.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",sp]};function Gn(e){K.call(this,e),this.init()}Gn.$inject=["eventBus"],ie(Gn,K),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 bg(e,t){var n=Kt(e,t,-15);return n!=="intersect"?n:null}function Zt(e){Gn.call(this,e)}ie(Zt,Gn),Zt.$inject=["eventBus"],Zt.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return PC(t)}),this.addRule("connection.create",function(e){var t=e.source,n=e.target,i=e.hints||{},r=i.targetParent,o=i.targetAttach;if(o)return!1;r&&(n.parent=r);try{return ic(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return ic(n,i,t)}),this.addRule("connection.updateWaypoints",function(e){return{type:e.connection.type}}),this.addRule("shape.resize",function(e){var t=e.shape,n=e.newBounds,i=e.direction;return Og(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return nt(i)&&!rc(t,i)?!1:Cr(t,function(r){return nt(r)?ic(r.source,r.target,r):r.host?fa(r,r.host,null,n):pp(r,i)})}),this.addRule("elements.move",function(e){var t=e.target,n=e.shapes,i=e.position,r=e.hints;return r!=null&&r.keyboardMove&&n.some(function(a){return Pg(a)&&!n.includes(a.host)})?!1:fa(n,t,null,i)||kg(n,t,i)||Dg(n,t)||rc(n,t)}),this.addRule("shape.create",function(e){return pp(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return fa(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return $g(n,t)})},Zt.prototype.canConnectMessageFlow=Ng,Zt.prototype.canConnectSequenceFlow=Bg,Zt.prototype.canConnectDataAssociation=fp,Zt.prototype.canConnectAssociation=Lg,Zt.prototype.canConnectCompensationAssociation=Ig,Zt.prototype.canMove=Dg,Zt.prototype.canAttach=fa,Zt.prototype.canReplace=kg,Zt.prototype.canDrop=bo,Zt.prototype.canInsert=rc,Zt.prototype.canCreate=pp,Zt.prototype.canConnect=ic,Zt.prototype.canResize=Og,Zt.prototype.canCopy=$g;function PC(e){return cp(e)?null:ke(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function cp(e){return!e||Ae(e)}function xg(e){do{if(v(e,"bpmn:Process"))return X(e);if(v(e,"bpmn:Participant"))return X(e).processRef||X(e)}while(e=e.parent)}function up(e){return v(e,"bpmn:TextAnnotation")}function lp(e){return v(e,"bpmn:Group")&&!e.labelTarget}function Eg(e){return v(e,"bpmn:BoundaryEvent")&&vi(e,"bpmn:CompensateEventDefinition")}function nc(e){return X(e).isForCompensation}function AC(e,t){var n=xg(e),i=xg(t);return n===i}function TC(e){return v(e,"bpmn:InteractionNode")&&!v(e,"bpmn:BoundaryEvent")&&(!v(e,"bpmn:Event")||v(e,"bpmn:ThrowEvent")&&Rg(e,"bpmn:MessageEventDefinition"))}function MC(e){return v(e,"bpmn:InteractionNode")&&!nc(e)&&(!v(e,"bpmn:Event")||v(e,"bpmn:CatchEvent")&&Rg(e,"bpmn:MessageEventDefinition"))&&!(v(e,"bpmn:BoundaryEvent")&&!vi(e,"bpmn:MessageEventDefinition"))}function wg(e){for(var t=e;t=t.parent;){if(v(t,"bpmn:FlowElementsContainer"))return X(t);if(v(t,"bpmn:Participant"))return X(t).processRef}return null}function Sg(e,t){var n=wg(e),i=wg(t);return n===i}function vi(e,t){var n=X(e);return!!ot(n.eventDefinitions||[],function(i){return v(i,t)})}function Rg(e,t){var n=X(e);return(n.eventDefinitions||[]).every(function(i){return v(i,t)})}function kC(e){return v(e,"bpmn:FlowNode")&&!v(e,"bpmn:EndEvent")&&!cn(e)&&!(v(e,"bpmn:IntermediateThrowEvent")&&vi(e,"bpmn:LinkEventDefinition"))&&!Eg(e)&&!nc(e)}function DC(e){return v(e,"bpmn:FlowNode")&&!v(e,"bpmn:StartEvent")&&!v(e,"bpmn:BoundaryEvent")&&!cn(e)&&!(v(e,"bpmn:IntermediateCatchEvent")&&vi(e,"bpmn:LinkEventDefinition"))&&!nc(e)}function OC(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 LC(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function Cg(e,t){var n=LC(t);return n.indexOf(e)!==-1}function ic(e,t,n){if(cp(e)||cp(t))return null;if(!v(n,"bpmn:DataAssociation")){if(Ng(e,t))return{type:"bpmn:MessageFlow"};if(Bg(e,t))return{type:"bpmn:SequenceFlow"}}var i=fp(e,t);return i||(Ig(e,t)?{type:"bpmn:Association",associationDirection:"One"}:Lg(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function bo(e,t){return Ae(e)||lp(e)?!0:v(t,"bpmn:Participant")&&!Be(t)?!1:v(e,"bpmn:Participant")?v(t,"bpmn:Process")||v(t,"bpmn:Collaboration"):ke(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:v(e,"bpmn:Lane")?v(t,"bpmn:Participant")||v(t,"bpmn:Lane"):v(e,"bpmn:BoundaryEvent")&&!IC(e)?!1:v(e,"bpmn:FlowElement")&&!v(e,"bpmn:DataStoreReference")?v(t,"bpmn:FlowElementsContainer")?Be(t):ke(t,["bpmn:Participant","bpmn:Lane"]):v(e,"bpmn:DataStoreReference")&&v(t,"bpmn:Collaboration")?zi(X(t).get("participants"),function(n){return!!n.get("processRef")}):ke(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?ke(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):v(e,"bpmn:MessageFlow")?v(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function IC(e){return X(e).cancelActivity&&(Ag(e)||Tg(e))}function Pg(e){return!Ae(e)&&v(e,"bpmn:BoundaryEvent")}function NC(e){return v(e,"bpmn:Lane")}function BC(e){return Pg(e)||v(e,"bpmn:IntermediateThrowEvent")&&Ag(e)?!0:v(e,"bpmn:IntermediateCatchEvent")&&Tg(e)}function Ag(e){var t=X(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Tg(e){return Mg(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Mg(e,t){return t.some(function(n){return vi(e,n)})}function $C(e){return v(e,"bpmn:ReceiveTask")&&ot(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 Ae(r)||!BC(r)||cn(t)||!v(t,"bpmn:Activity")||nc(t)||i&&!bg(i,t)||$C(t)?!1:"attach"}function kg(e,t,n){if(!t)return!1;var i={replacements:[]};return M(e,function(r){cn(t)||v(r,"bpmn:StartEvent")&&r.type!=="label"&&bo(r,t)&&(q1(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(Y1(r)||K1(r)||X1(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),Mg(r,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&v(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"})),v(t,"bpmn:Transaction")||vi(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(v(r,"bpmn:EndEvent")&&bo(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),v(r,"bpmn:BoundaryEvent")&&fa(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function Dg(e,t){return zi(e,NC)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return bo(n,t)})}function pp(e,t,n,i){return t?Ae(e)||lp(e)?!0:bo(e,t)||rc(e,t):!1}function Og(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:up(e)?n?n==="e"||n==="w":!0:lp(e)?!0:Ae(e)?n?n==="e"||n==="w":!0:!1}function jC(e,t){var n=up(e),i=up(t);return(n||i)&&n!==i}function Lg(e,t){return Cg(t,e)||Cg(e,t)?!1:jC(e,t)?!0:!!fp(e,t)}function Ig(e,t){return Sg(e,t)&&Eg(e)&&v(t,"bpmn:Activity")&&!HC(t,e)&&!cn(t)}function Ng(e,t){return Fg(e)&&!Fg(t)?!1:TC(e)&&MC(t)&&!AC(e,t)}function Bg(e,t){return kC(e)&&DC(t)&&Sg(e,t)&&!(v(e,"bpmn:EventBasedGateway")&&!OC(t))}function fp(e,t){return ke(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&ke(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:ke(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&ke(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function rc(e,t,n){if(!t)return!1;if(Array.isArray(e)){if(e.length!==1)return!1;e=e[0]}return t.source===e||t.target===e?!1:ke(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!Ae(t)&&v(e,"bpmn:FlowNode")&&!v(e,"bpmn:BoundaryEvent")&&bo(e,t.parent)}function dp(e,t){return e&&t&&e.indexOf(t)!==-1}function $g(e,t){return Ae(t)?!0:!(v(t,"bpmn:Lane")&&!dp(e,t.parent)||v(t,"bpmn:MessageFlow")&&!FC(e,t))}function FC(e,t){var n=jg(t.source),i=jg(t.target);return dp(e,n)&&dp(e,i)}function jg(e){for(;e;e=e.parent)if(v(e,"bpmn:Participant"))return e;return null}function Fg(e){return fo(e,"bpmn:Process")||fo(e,"bpmn:Collaboration")}function HC(e,t){return e.attachers.includes(t)}const zC={__depends__:[yi],__init__:["bpmnRules"],bpmnRules:["type",Zt]};var VC=2e3;function Hg(e,t){e.on("saveXML.start",VC,n);function n(){var i=t.getRootElements();M(i,function(r){var o=ze(r),a,s;a=Ko([r]),a=Oe(a,function(c){return c!==r&&!c.labelTarget}),s=rn(a,ze),o.set("planeElement",s)})}}Hg.$inject=["eventBus","canvas"];const GC={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Hg]};function oc(e){K.call(this,e);var t=this;this.preExecute(["shape.create","connection.create"],function(n){var i=n.context,r=i.shape||i.connection,o=i.parent,a=t.getOrdering(r,o);a&&(a.parent!==void 0&&(i.parent=a.parent),i.parentIndex=a.index)}),this.preExecute(["shape.move","connection.move"],function(n){var i=n.context,r=i.shape||i.connection,o=i.newParent||r.parent,a=t.getOrdering(r,o);a&&(a.parent!==void 0&&(i.newParent=a.parent),i.newParentIndex=a.index)})}oc.prototype.getOrdering=function(e,t){return null},ie(oc,K);function hp(e,t){oc.call(this,e);var n=[{type:"bpmn:SubProcess",order:{level:6}},{type:"bpmn:SequenceFlow",order:{level:9,containers:["bpmn:Participant","bpmn:FlowElementsContainer"]}},{type:"bpmn:DataAssociation",order:{level:9,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:TextAnnotation",order:{level:9}},{type:"bpmn:MessageFlow",order:{level:9,containers:["bpmn:Collaboration"]}},{type:"bpmn:Association",order:{level:6,containers:["bpmn:Participant","bpmn:FlowElementsContainer","bpmn:Collaboration"]}},{type:"bpmn:BoundaryEvent",order:{level:8}},{type:"bpmn:Group",order:{level:10,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:FlowElement",order:{level:5}},{type:"bpmn:Participant",order:{level:-2}},{type:"bpmn:Lane",order:{level:-1}}];function i(a){if(a.labelTarget)return{level:10};var s=ot(n,function(c){return ke(a,[c.type])});return s&&s.order||{level:1}}function r(a){var s=a.order;if(s||(a.order=s=i(a)),!s)throw new Error(`no order for <${a.id}>`);return s}function o(a,s,c){for(var u=s;u&&!ke(u,c);)u=u.parent;if(!u)throw new Error(`no parent for <${a.id}> in <${s&&s.id}>`);return u}this.getOrdering=function(a,s){if(a.labelTarget||v(a,"bpmn:TextAnnotation"))return{parent:t.findRoot(s)||t.getRootElement(),index:-1};var c=r(a);c.containers&&(s=o(a,s,c.containers));var u=s.children.indexOf(a),l=zf(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}}}hp.$inject=["eventBus","canvas"],ie(hp,oc);const WC={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",hp]};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 UC={clipboard:["type",da]};var zg=1500;function Vg(e,t,n){var i=this,r=n.get("dragging",!1);function o(a){if(!a.hover){var 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",zg,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",zg,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=$r(a),c=document.elementFromPoint(s.x,s.y),qC(c)}}Vg.$inject=["elementRegistry","eventBus","injector"];function qC(e){return Dr(e,"svg, .djs-element",!0)}const YC={__init__:["hoverFix"],hoverFix:["type",Vg]};function KC(e){return!0}function ac(e){return ar(e)||eC(e)}var Gg=500;function Wg(e,t,n){var i=this;function r(A,F,H){if(!s(A,F)){var N,z,le;H?z=t.getGraphics(H):(N=F.delegateTarget||F.target,N&&(z=N,H=t.get(z))),!(!z||!H)&&(le=e.fire(A,{element:H,gfx:z,originalEvent:F}),le===!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":KC,"element.mousedown":ac,"element.mouseup":ac,"element.click":ac,"element.dblclick":ac};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(le){r(H,le)};N&&(u[H]=N),z.$delegate=Sn.bind(A,p,F,z)}function d(A,F,H){var N=a(H);N&&Sn.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"],Gg,function(A){var F=A.element,H=A.gfx;e.fire("interactionEvents.updateHit",{element:F,gfx:H})}),e.on("interactionEvents.createHit",Gg,function(A){var F=A.element,H=A.gfx;i.createDefaultHit(F,H)}),e.on("interactionEvents.updateHit",function(A){var F=A.element,H=A.gfx;i.updateDefaultHit(F,H)});var g=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=O({stroke:"white",strokeWidth:15},F||{}),n.cls(A,["no-fill","no-border"],F)}function T(A,F){var H=b[F];if(!H)throw new Error("invalid hit type <"+F+">");return re(A,H),A}function L(A,F){Se(A,F)}this.removeHits=function(A){var F=ys(".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=Yo(F);return T(H,"stroke"),L(A,H),H},this.createBoxHit=function(A,F,H){H=O({x:0,y:0},H);var N=de("rect");return T(N,F),re(N,H),L(A,N),N},this.updateDefaultHit=function(A,F){var H=tt(".djs-hit",F);if(H)return A.waypoints?el(H,A.waypoints):re(H,{width:A.width,height:A.height}),H},this.fire=r,this.triggerMouseEvent=l,this.mouseHandler=a,this.registerEvent=f,this.unregisterEvent=d}Wg.$inject=["eventBus","elementRegistry","styles"];const sc={__init__:["interactionEvents"],interactionEvents:["type",Wg]};function xo(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)})}xo.$inject=["eventBus","canvas"],xo.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()})}},xo.prototype.get=function(){return Array.from(this._selectedElements)},xo.prototype.isSelected=function(e){return this._selectedElements.has(e)},xo.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 Ug="hover",qg="selected";function Yg(e,t){this._canvas=e;function n(r,o){e.addMarker(r,o)}function i(r,o){e.removeMarker(r,o)}t.on("element.hover",function(r){n(r.element,Ug)}),t.on("element.out",function(r){i(r.element,Ug)}),t.on("selection.changed",function(r){function o(u){i(u,qg)}function a(u){n(u,qg)}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)})}Yg.$inject=["canvas","eventBus"];function Kg(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(XC))}}),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=ot(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(ar(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=ec(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}Kg.$inject=["eventBus","selection","canvas","elementRegistry"];function XC(e){return!e.hidden}const Wn={__init__:["selectionVisuals","selectionBehavior"],__depends__:[sc],selection:["type",xo],selectionVisuals:["type",Yg],selectionBehavior:["type",Kg]};var ZC=/^djs-cursor-.*$/;function cc(e){var t=dt(document.body);t.removeMatching(ZC),e&&t.add("djs-cursor-"+e)}function Xg(){cc(null)}var QC=5e3;function Zg(e,t){t=t||"element.click";function n(){return!1}return e.once(t,QC,n),function(){e.off(t,n)}}var JC=["c","C"],eP=["v","V"],tP=["d","D"],nP=["x","X"],iP=["y","Y"],Qg=["z","Z"];function rP(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Pn(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 mp(e){return e.shiftKey}function oP(e){return Pn(e)&&Nt(JC,e)}function aP(e){return Pn(e)&&Nt(eP,e)}function sP(e){return Pn(e)&&Nt(tP,e)}function cP(e){return Pn(e)&&Nt(nP,e)}function uP(e){return Pn(e)&&!mp(e)&&Nt(Qg,e)}function lP(e){return Pn(e)&&(Nt(iP,e)||Nt(Qg,e)&&mp(e))}var Eo=Math.round,Jg="djs-drag-active";function Fr(e){e.preventDefault()}function pP(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function fP(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function ey(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(x){var b=t.viewbox(),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(O({},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=$r(x),F=ni(A,L),H=o.localStart,N=a(A),z=ni(N,H);if(!o.active&&(b||fP(F)>o.threshold)){if(O(w,{x:Eo(H.x+T.x),y:Eo(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&&cc(o.cursor),t.addMarker(t.getRootElement(),Jg)}Yl(x),o.active&&(O(w,{x:Eo(N.x+T.x),y:Eo(N.y+T.y),dx:Eo(z.x),dy:Eo(z.y)},{originalEvent:x}),s("move"))}function l(x){var b,w=!0;o.active&&(x&&(o.payload.originalEvent=x,Yl(x)),w=s("end")),w===!1&&s("rejected"),b=S(w!==!0),s("ended",b)}function p(x){Nt("Escape",x)&&(Fr(x),g())}function f(x){var b;o.active&&(b=Zg(e),setTimeout(b,400),Fr(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"),Xg(),o.trapClick?w=f:w=l,we.unbind(document,"mousemove",u),we.unbind(document,"dragstart",Fr),we.unbind(document,"selectstart",Fr),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(),Jg);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=O({},r,T||{});var L=T.data||{},A,F,H,N,z;if(T.trapClick?N=f:N=l,x?(A=_o(x)||x,F=$r(x),Yl(x),A.type==="dragstart"&&Fr(A)):(A=null,F={x:0,y:0}),H=a(F),b||(b=H),z=pP(A),o=O({prefix:w,data:L,payload:{},globalStart:F,displacement:ni(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",Fr),we.bind(document,"selectstart",Fr),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){O(r,x)}}ey.$inject=["eventBus","canvas","selection","elementRegistry"];const Oi={__depends__:[YC,Wn],dragging:["type",ey]};function wo(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}wo.prototype.next=function(){return this._prefix+ ++this._counter};const dP=new wo("ps");var hP=["marker-start","marker-mid","marker-end"],mP=["circle","ellipse","line","path","polygon","polyline","path","rect"];function sr(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}sr.$inject=["elementRegistry","eventBus","canvas","styles"],sr.prototype.cleanUp=function(){console.warn("PreviewSupport#cleanUp is deprecated and will be removed in future versions. You do not need to manually clean up previews anymore. cf. https://github.com/bpmn-io/diagram-js/pull/906")},sr.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},sr.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=dh(n);return this._cloneMarkers(Ir(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=de("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)}),_P(e)&&hP.forEach(function(r){if(re(e,r)){var o=gP(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,dP.next()].join("-"),a=tt("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||dh(n);s.id=o,Fe(s).add(r);var c=tt(":scope > defs",e);c||(c=de("defs"),Se(e,c)),Se(c,s);var u=vP(s.id);re(t,i,u)};function gP(e,t,n){var i=yP(re(e,t));return tt("marker#"+i,n||document)}function yP(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function vP(e){return"url(#"+e+")"}function _P(e){return mP.indexOf(e.nodeName)!==-1}const So={__init__:["previewSupport"],previewSupport:["type",sr]};var bP="drop-ok",ty="drop-not-ok",ny="attach-ok",iy="new-parent",ry="create",xP=2e3;function oy(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&&!(Ae(E)&&c.indexOf(x)!==-1)});var d=ot(c,function(E){return!nt(E)}),h=!1,m=!1,g=!1;sy(c)&&(h=r.allowed("shape.attach",{position:l,shape:d,target:u})),h||(sy(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){[ny,bP,ty,iy].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}ay(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,ny):a(p,m?iy:ty))}),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;ay(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,O({},S,{attach:m})),p=ot(f,function(x){return!nt(x)})),O(u,{elements:f,shape:p}),O(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===ry&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],xP,function(){n.off("elements.changed",s)})}),this.start=function(c,u,l){ge(u)||(u=[u]);var p=ot(u,function(h){return!nt(h)});if(p){l=O({elements:u,hints:{},shape:p},l||{}),M(u,function(h){be(h.x)||(h.x=0),be(h.y)||(h.y=0)});var f=Oe(u,function(h){return!h.hidden}),d=Rt(f);M(u,function(h){nt(h)&&(h.waypoints=rn(h.waypoints,function(m){return{x:m.x-d.x-d.width/2,y:m.y-d.y-d.height/2}})),O(h,{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2})}),t.init(c,ry,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:u,context:l}})}}}oy.$inject=["canvas","dragging","eventBus","modeling","rules"];function ay(e){var t=e.context,n=t.createConstraints;n&&(n.left&&(e.x=Math.max(e.x,n.left)),n.right&&(e.x=Math.min(e.x,n.right)),n.top&&(e.y=Math.max(e.y,n.top)),n.bottom&&(e.y=Math.min(e.y,n.bottom)))}function sy(e){return e&&e.length===1&&!nt(e[0])}var EP=750;function cy(e,t,n,i,r){function o(a){var s=de("g");re(s,r.cls("djs-drag-group",["no-events"]));var c=de("g");return a.forEach(function(u){var l;u.hidden||(u.waypoints?(l=n._createContainer("connection",c),n.drawConnection(Ir(l),u)):(l=n._createContainer("shape",c),n.drawShape(Ir(l),u),Xt(l,u.x,u.y)),i.addDragger(u,s,l))}),s}t.on("create.move",EP,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)),Xt(l,a.x,a.y)):It(l)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&It(c)})}cy.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const uc={__depends__:[Oi,So,yi,Wn],__init__:["create","createPreview"],create:["type",oy],createPreview:["type",cy]};function gp(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)})}gp.$inject=["eventBus"],gp.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||wP(0,0)};function wP(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",gp]};var uy=2e3;function An(e,t,n,i,r,o,a,s){this._canvas=e,this._create=t,this._elementFactory=i,this._eventBus=r,this._modeling=o,this._mouse=a,this._rules=s,r.on("copyPaste.copyElement",function(c){var u=c.descriptor,l=c.element,p=c.elementsSet;u.priority=1,u.id=l.id,p.has(l.parent)&&(u.parent=l.parent.id),SP(l)&&(u.priority=2,u.host=l.host.id),nt(l)&&(u.priority=3,u.source=l.source.id,u.target=l.target.id,u.waypoints=RP(l)),Ae(l)&&(u.priority=4,u.labelTarget=l.labelTarget.id),M(["x","y","width","height"],function(f){be(l[f])&&(u[f]=l[f])}),u.hidden=l.hidden,u.collapsed=l.collapsed}),r.on("copyPaste.elementsCopied",uy,function(c){var u;((u=c.hints)==null?void 0:u.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",uy,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var u=c.hints;O(u,{createElementsBehavior:!1})})}An.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],An.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},An.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})}}},An.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},An.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},An.prototype._getElementIdsFromTree=function(e){var t={};return M(e,function(n){M(n,function(i){i.id&&(t[i.id]=!0)})}),t},An.prototype._paste=function(e,t,n,i){M(e,function(o){be(o.x)||(o.x=0),be(o.y)||(o.y=0)});var r=Rt(e);return M(e,function(o){nt(o)&&(o.waypoints=rn(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),O(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,O({},i))},An.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return M(e,function(o,a){o=oi(o,"priority"),M(o,function(s){var c=O({},ai(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var u;if(nt(c)){c.source=i[s.source],c.target=i[s.target],u=i[s.id]=t.createConnection(c),r.push(u);return}if(Ae(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},An.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(ai(e,["id"]));return t},An.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(ai(e,["id"]));return t},An.prototype.createShape=function(e){var t=this._elementFactory.createShape(ai(e,["id"]));return t},An.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(nt(e)&&(!n.has(e.source)||!n.has(e.target))||Ae(e)&&!n.has(e.labelTarget))},An.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=xs(e);function s(p,f){return t.allowed("element.copy",{element:p,elements:f})}function c(p,f){var d=o.get(p);if(!d){var h={element:p,depth:f};r.push(h),o.set(p,h);return}if(d.depth<f){r=u(d,r);var m={element:d.element,depth:f};r.push(m),o.set(p,m)}}function u(p,f){var d=f.indexOf(p);return d!==-1&&f.splice(d,1),f}Lr(a,function(p,f,d){if(Ae(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)){py(p.element,e),l.delete(p.element);return}if(!s(p.element,e)){py(p.element,e),l.delete(p.element);return}i[f]||(i[f]=[]),i[f].push(p.descriptor)}),i};function SP(e){return!!e.host}function RP(e){return rn(e.waypoints,function(t){return t=ly(t),t.original&&(t.original=ly(t.original)),t})}function ly(e){return O({},e)}function py(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const CP={__depends__:[UC,uc,ha,yi],__init__:["copyPaste"],copyPaste:["type",An]};function yp(e,t,n){ge(n)||(n=[n]),M(n,function(i){Rr(e[i])||(t[i]=e[i])})}var vp=750;function fy(e,t,n){function i(c,u){var l=e.create(c.$type);return n.copyElement(c,l,null,u)}t.on("copyPaste.copyElement",vp,function(c){var u=c.descriptor,l=c.element,p=X(l);if(Ae(l))return u;var f=u.businessObject=i(p,!0),d=u.di=i(ze(l),!0);d.bpmnElement=f,yp(f,u,"name"),yp(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=X(c);return c.default&&(l[c.default]={element:p,property:"default"}),c.host&&(X(c).attachedToRef=X(u[c.host])),ai(l,En(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(Ae(l)){l.businessObject=X(u[l.labelTarget]),l.di=ze(u[l.labelTarget]);return}p=l.businessObject=i(p),f=l.di=i(f),f.bpmnElement=p,yp(l,p,["isExpanded","name"]),l.type=p.$type}),t.on("copyPaste.copyElement",vp,function(c){var u=c.descriptor,l=c.element;if(v(l,"bpmn:Participant")){var p=X(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",vp,function(c){var u=c.cache,l=c.descriptor;a(u,s(l,u,o(u)))})}fy.$inject=["bpmnFactory","eventBus","moddleCopy"];const PP=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],AP=["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=Ht(r)&&r.$descriptor;if(a&&AP.includes(a))return o;if(a&&PP.includes(a)||a&&s&&!ot(s.properties,eo({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||_p(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;xn(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},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 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)?En(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},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 _p(e,t){return En(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const dy={__depends__:[CP],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",fy],moddleCopy:["type",ma]};var hy=Math.round;function bp(e,t){this._modeling=e,this._eventBus=t}bp.$inject=["modeling","eventBus"],bp.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=hy(s+o/2),l=hy(c+a/2),p=i.replaceShape(e,O({},t,{x:u,y:l,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:p,hints:n}),p};function my(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}my.$inject=["selection","eventBus"];const TP={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",my],replace:["type",bp]};function MP(e,t,n){ge(n)||(n=[n]),M(n,function(i){Rr(e[i])||(t[i]=e[i])})}var kP=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function DP(e,t){var n=e&&xn(e,"collapsed")?e.collapsed:!Be(e),i;return t&&(xn(t,"collapsed")||xn(t,"isExpanded"))?i=xn(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function gy(e,t,n,i,r,o){function a(s,c,u){u=u||{};var l=c.type,p=s.businessObject;if(lc(p)&&(l==="bpmn:SubProcess"||l==="bpmn:AdHocSubProcess")&&DP(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),MP(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var h=_p(p.$descriptor),m=_p(f.$descriptor,!0),g=OP(h,m);O(f,ti(c,kP));var S=Oe(g,function(b){return b==="eventDefinitions"?yy(s,c.eventDefinitionType):b==="loopCharacteristics"?!cn(f):xn(f,b)||b==="processRef"&&c.isExpanded===!1||b==="triggeredByEvent"?!1:b==="isForCompensation"?!cn(f):!0});if(f=n.copyElement(p,f,S),c.eventDefinitionType&&(yy(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),v(p,"bpmn:Activity")){if(lc(p))d.isExpanded=Be(s);else if(c&&xn(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(lc(p)&&!lc(f)&&(u.moveChildren=!1),v(p,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):u.moveChildren=!1;var x=Vt(s);ze(s).isHorizontal||(ze(d).isHorizontal=x),d.width=x?s.width:t.getDefaultSize(d).width,d.height=x?t.getDefaultSize(d).height:s.height}return o.allowed("shape.resize",{shape:f})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),f.name=p.name,ke(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&ke(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(f.default=p.default),c.host&&!v(p,"bpmn:BoundaryEvent")&&v(f,"bpmn:BoundaryEvent")&&(d.host=c.host),(d.type==="bpmn:DataStoreReference"||d.type==="bpmn:DataObjectReference")&&(d.x=s.x+(s.width-d.width)/2),r.replaceElement(s,d,{...u,targetElement:c})}this.replaceElement=a}gy.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function lc(e){return v(e,"bpmn:SubProcess")}function yy(e,t){var n=X(e);return t&&n.get("eventDefinitions").some(function(i){return v(i,t)})}function OP(e,t){return e.filter(function(n){return t.includes(n)})}const vy={__depends__:[dy,TP,Wn],bpmnReplace:["type",gy]};var LP=250;function Hr(e){this._eventBus=e,this._tools=[],this._active=null}Hr.$inject=["eventBus"],Hr.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)},Hr.prototype.isActive=function(e){return e&&this._active===e},Hr.prototype.length=function(e){return this._tools.length},Hr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Hr.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,LP,function(r){this._active&&(IP(r)||this.setActive(null))},this)};function IP(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Dr(t,'.group[data-group="tools"]')}const pc={__depends__:[Oi],__init__:["toolManager"],toolManager:["type",Hr]};function NP(e,t){if(e==="x"){if(t>0)return"e";if(t<0)return"w"}if(e==="y"){if(t>0)return"s";if(t<0)return"n"}return null}function BP(e,t){var n=[],i=new Set(e);M(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,s=o.outgoing;M(a.concat(s),function(c){var u=c.source,l=c.target;(i.has(u)||i.has(l))&&(r.has(c)||(r.add(c),n.push(c)))})}),n}function $P(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 xp=Math.abs,jP=Math.round,Li={x:"width",y:"height"},_y="crosshair",cr={n:"top",w:"left",s:"bottom",e:"right"},FP=1500,fc={n:"s",w:"e",s:"n",e:"w"},dc=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",FP,function(c){var u=c.context,l=u.initialized;l||(l=u.initialized=s.init(c,u)),l&&xy(c)}),n.on("spaceTool.end",function(c){var u=c.context,l=u.axis,p=u.direction,f=u.movingShapes,d=u.resizingShapes,h=u.start;if(u.initialized){xy(c);var m={x:0,y:0};m[l]=jP(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:_y,data:{context:{reactivate:n}},trapClick:!1})},Un.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:_y,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=xp(e.dx)>xp(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(xp(i)<5)return!1;i<0&&(i*=-1),pa(e)&&(i*=-1);var o=NP(n,i),a=this._canvas.getRootElement();!ec(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=HP(c,n,o,r,u);return O(t,c,{axis:n,direction:o,spaceToolConstraints:l,start:r}),cc("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||Ae(d))){if(nt(d)){l.push(d);return}var h=d[t],m=h+d[Li[t]];if(zP(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 by(e){return{top:e.top-dc,right:e.right+dc,bottom:e.bottom+dc,left:e.left-dc}}function xy(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;be(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),be(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),be(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),be(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function HP(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!nt(z)&&!Ae(z)&&!l.has(z)&&!p.has(z)}),S=Oe(h,function(z){return!nt(z)&&!Ae(z)&&l.has(z)}),E,x,b,w=[],T=[],L,A,F,H;g.length&&(x=by(me(Rt(g))),E=i-m[cr[n]]+x[cr[n]],n==="n"?s.bottom=u=be(u)?Math.min(u,E):E:n==="w"?s.right=u=be(u)?Math.min(u,E):E:n==="s"?s.top=c=be(c)?Math.max(c,E):E:n==="e"&&(s.left=c=be(c)?Math.max(c,E):E)),S.length&&(b=by(me(Rt(S))),E=i-b[cr[fc[n]]]+m[cr[fc[n]]],n==="n"?s.bottom=u=be(u)?Math.min(u,E):E:n==="w"?s.right=u=be(u)?Math.min(u,E):E:n==="s"?s.top=c=be(c)?Math.max(c,E):E:n==="e"&&(s.left=c=be(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[cr[fc[n]]]-(L[cr[fc[n]]]-i)),T.length&&(F=me(Rt(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=be(u)?Math.min(u,E):E):n==="w"?(E=Math.min(A||1/0,H||1/0),s.right=u=be(u)?Math.min(u,E):E):n==="s"?(E=Math.max(A||-1/0,H||-1/0),s.top=c=be(c)?Math.max(c,E):E):n==="e"&&(E=Math.max(A||-1/0,H||-1/0),s.left=c=be(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=be(u)?Math.min(u,E):E):n==="w"?(E=i+f[Li[t]]-N[Li[t]],s.right=u=be(u)?Math.min(u,E):E):n==="s"?(E=i-f[Li[t]]+N[Li[t]],s.top=c=be(c)?Math.max(c,E):E):n==="e"&&(E=i-f[Li[t]]+N[Li[t]],s.left=c=be(c)?Math.max(c,E):E))}),s}}function zP(e){return!!e.host}var Ep="djs-dragging",Ey="djs-resizing",VP=250,hc=Math.max;function wy(e,t,n,i,r){function o(a,s){M(a,function(c){r.addDragger(c,s),n.addMarker(c,Ep)})}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=de("g");re(l,i.cls("djs-crosshair-group",["no-events"])),Se(s,l);var p=de("path");re(p,"d",u.x),Fe(p).add("djs-crosshair"),Se(l,p);var f=de("path");re(f,"d",u.y),Fe(f).add("djs-crosshair"),Se(l,f),c.crosshairGroup=l}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;Xt(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",VP,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=de("path"),re(c,"d","M0,0 L0,0"),Fe(c).add("djs-crosshair"),Se(f,c),s.line=c;var d=de("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)||!nt(L)||!h.has(L.target)||(m.add(L),g.push(L))})}),o(g,d),s.dragGroup=d}if(!s.frameGroup){var S=de("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,Ey)}),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,Xt(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:hc(A.width+w.x,5)}):(F=hc(A.width-w.x,5),re(L,{width:F,x:A.x+A.width-F})),s.direction==="s"?re(L,{height:hc(A.height+w.y,5)}):(H=hc(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,Ep)}),M(u,function(h){n.removeMarker(h,Ep)}),f&&(It(p),It(f)),M(l,function(h){n.removeMarker(h,Ey)}),d&&It(d)})}wy.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const GP={__init__:["spaceToolPreview"],__depends__:[Oi,yi,pc,So,ha],spaceTool:["type",Un],spaceToolPreview:["type",wy]};function mc(e,t){e.invoke(Un,this),this._canvas=t}mc.$inject=["injector","canvas"],ie(mc,Un),mc.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=Qr(oo(r.children.filter(u=>v(u,"bpmn:Artifact")),Rt(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")||WP(u)&&(t==="y"&&Vt(u)||t==="x"&&!Vt(u)))}),c};function WP(e){return v(e,"bpmn:Participant")&&!X(e).processRef}const Sy={__depends__:[GP],spaceTool:["type",mc]};function yt(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)}yt.$inject=["eventBus","injector"],yt.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()},yt.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},yt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},yt.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()}},yt.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()}},yt.prototype.register=function(e,t){this._setHandler(e,t)},yt.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)},yt.prototype.canUndo=function(){return!!this._getUndoAction()},yt.prototype.canRedo=function(){return!!this._getRedoAction()},yt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},yt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},yt.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)})},yt.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},yt.prototype._createId=function(){return this._uid++},yt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},yt.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()},yt.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)},yt.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:Vf("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},yt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=ge(e)?e:[e],t.dirty=t.dirty.concat(e))},yt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},yt.prototype._revertedAction=function(e){this._stackIdx--},yt.prototype._getHandler=function(e){return this._handlerMap[e]},yt.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 UP={commandStack:["type",yt]};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 qP=250,Ry=1400;function wp(e,t,n){K.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",Ry,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=Cy(a),o.validatedShapes=Cy(s)}),i&&t.on("shape.move.start",qP,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",Ry,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=nl(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(wp,K),wp.$inject=["injector","eventBus","modeling"];function Cy(e){var t=new Set(e);return Oe(e,function(n){return!t.has(n.labelTarget)})}const YP={__init__:["labelSupport"],labelSupport:["type",wp]};var KP=251,Py=1401,Ay="attach-ok";function Sp(e,t,n,i,r){K.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",Py,function(a){var s=a.context,c=s.shapes,u=s.validatedShapes;s.shapes=XP(c),s.validatedShapes=ZP(u)}),o&&t.on("shape.move.start",KP,function(a){var s=a.context,c=s.shapes,u=Rp(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,Ay),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(l,Ay)}))}}),this.preExecuted("elements.move",Py,function(a){var s=a.context,c=s.closure,u=s.shapes,l=Rp(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 QP(p)&&!JP(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=Um(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=Um(d,u,l);r.moveShape(d,h,d.parent),M(d.labels,function(m){r.moveShape(m,h,m.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;ur(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}ie(Sp,K),Sp.$inject=["injector","eventBus","canvas","rules","modeling"];function Rp(e){return wu(rn(e,function(t){return t.attachers||[]}))}function XP(e){var t=Rp(e);return Vx("id",e,t)}function ZP(e){var t=Jr(e,"id");return Oe(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function QP(e){return!!e.host}function JP(e,t){return e.indexOf(t)!==-1}const eA={__depends__:[yi],__init__:["attachSupport"],attachSupport:["type",Sp]};function Ty(e,t,n,i){e.on("element.changed",function(r){var o=r.element;(o.parent||o===t.getRootElement())&&(r.gfx=n.getGraphics(o)),r.gfx&&e.fire(xh(o)+".changed",r)}),e.on("elements.changed",function(r){var o=r.elements;o.forEach(function(a){e.fire("element.changed",{element:a})}),i.updateContainments(o)}),e.on("shape.changed",function(r){i.update("shape",r.element,r.gfx)}),e.on("connection.changed",function(r){i.update("connection",r.element,r.gfx)})}Ty.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const Cp={__init__:["changeSupport"],changeSupport:["type",Ty]};function qn(e){this._model=e}qn.$inject=["moddle"],qn.prototype._needsId=function(e){return ke(e,["bpmn:RootElement","bpmn:FlowElement","bpmn:MessageFlow","bpmn:DataAssociation","bpmn:Artifact","bpmn:Participant","bpmn:Lane","bpmn:LaneSet","bpmn:Process","bpmn:Collaboration","bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane","bpmn:Property","bpmn:CategoryValue"])},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":ke(e,["bpmn:SequenceFlow","bpmn:MessageFlow"])?t="Flow":t=(e.$type||"").replace(/^[^:]*:/g,""),t+="_",!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e))},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",O({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",ti(e,["x","y"]))},qn.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",O({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},qn.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",O({bpmnElement:e},t))};function Tn(e,t,n){K.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"],Mn(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Mn(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"],Mn(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],Mn(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"],Mn(u)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],Mn(u));function l(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],Mn(l)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],Mn(l)),this.executed("connection.reconnect",Mn(function(d){var h=d.context,m=h.connection,g=h.oldSource,S=h.newSource,E=X(m),x=X(g),b=X(S);E.conditionExpression&&!ke(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",Mn(function(d){var h=d.context,m=h.connection,g=h.oldSource,S=h.newSource,E=X(m),x=X(g),b=X(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"],Mn(p)),this.reverted(["element.updateAttachment"],Mn(p)),this.executed("element.updateLabel",Mn(f)),this.reverted("element.updateLabel",Mn(f));function f(d){const{element:h}=d.context,m=In(h),g=ze(h),S=g&&g.get("label");nr(h)||tc(h)||(m&&!S?g.set("label",t.create("bpmndi:BPMNLabel")):!m&&S&&g.set("label",void 0))}}ie(Tn,K),Tn.$inject=["eventBus","bpmnFactory","connectionDocking"],Tn.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},Tn.prototype.updateParent=function(e,t){if(!Ae(e)&&!(v(e,"bpmn:DataStoreReference")&&e.parent&&v(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=ze(e),o=n&&n.businessObject,a=ze(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)}},Tn.prototype.updateBounds=function(e){var t=ze(e),n=nA(e);if(n){var i=ni(n,t.get("bounds"));O(n,{x:e.x+i.x,y:e.y+i.y})}var r=Ae(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),O(o,{x:e.x,y:e.y,width:e.width,height:e.height})},Tn.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;v(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),xt(i,e)),v(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),Et(r,e))}},Tn.prototype.updateDiConnection=function(e,t,n){var i=ze(e),r=ze(t),o=ze(n);i.sourceElement&&i.sourceElement.bpmnElement!==X(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==X(n)&&(i.targetElement=n&&o)},Tn.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):(xt(n,e),e.$parent=null)}};function tA(e){for(;e&&!v(e,"bpmn:Definitions");)e=e.$parent;return e}Tn.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)},Tn.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=tA(e.$parent||t),e.$parent&&(xt(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),xt(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);xt(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},Tn.prototype.updateConnectionWaypoints=function(e){var t=ze(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},Tn.prototype.updateConnection=function(e){var t=e.connection,n=X(t),i=t.source,r=X(i),o=t.target,a=X(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&&(xt(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(xt(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)},Tn.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function Mn(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;v(i,"bpmn:BaseElement")&&e(t)}}function nA(e){if(v(e,"bpmn:Activity")){var t=ze(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,O({type:"label",di:n},Nr,t))}return this.createElement(e,t)},lr.prototype.createElement=function(e,t){t=O({},t||{});var n,i=t.businessObject,r=t.di;if(!i){if(!t.type)throw new Error("no shape type specified");i=this._bpmnFactory.create(t.type)}if(!rA(r)){var o=O({},r||{},{id:i.id+"_di"});e==="root"?r=this._bpmnFactory.createDiPlane(i,o):e==="connection"?r=this._bpmnFactory.createDiEdge(i,o):r=this._bpmnFactory.createDiShape(i,o)}v(i,"bpmn:Group")&&(t=O({isFrame:!0},t)),t=iA(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Pp(r,t,"isExpanded")),ke(i,["bpmn:Lane","bpmn:Participant"])&&(t=Pp(r,t,"isHorizontal")),v(i,"bpmn:SubProcess")&&(t.collapsed=!Be(i,r)),v(i,"bpmn:ExclusiveGateway")&&(xn(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=O({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},lr.prototype.getDefaultSize=function(e,t){var n=X(e);if(t=t||ze(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 Ht(e)||(e={isExpanded:e}),e=O({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function iA(e,t,n){return M(n,function(i){t=Pp(e,t,i)}),t}function Pp(e,t,n){return t[n]===void 0?t:(e[n]=t[n],ai(t,[n]))}function rA(e){return ke(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function gc(e,t){this._modeling=e,this._canvas=t}gc.$inject=["modeling","canvas"],gc.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;M(n,function(r){var o={x:0,y:0};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)})},gc.prototype.postExecute=function(e){};function yc(e){this._modeling=e}yc.$inject=["modeling"],yc.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,i=e.shape,r=e.hints||{};i=e.shape=this._modeling.createShape(i,e.position,n,{attach:r.attach}),e.shape=i},yc.prototype.postExecute=function(e){var t=e.hints||{};oA(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 oA(e,t){return zi(e.outgoing,function(n){return n.target===t})}function vc(e,t){this._canvas=e,this._layouter=t}vc.$inject=["canvas","layouter"],vc.prototype.execute=function(e){var t=e.connection,n=e.source,i=e.target,r=e.parent,o=e.parentIndex,a=e.hints;if(!n||!i)throw new Error("source and target required");if(!r)throw new Error("parent required");return t.source=n,t.target=i,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,a)),this._canvas.addConnection(t,r,o),t},vc.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var _c=Math.round;function Ap(e){this._modeling=e}Ap.$inject=["modeling"],Ap.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){be(p.x)||(p.x=0),be(p.y)||(p.y=0)});var s=Oe(t,function(p){return!p.hidden}),c=Rt(s);M(t,function(p){nt(p)&&(p.waypoints=rn(p.waypoints,function(f){return{x:_c(f.x-c.x-c.width/2+r.x),y:_c(f.y-c.y-c.height/2+r.y)}})),O(p,{x:_c(p.x-c.x-c.width/2+r.x),y:_c(p.y-c.y-c.height/2+r.y)})});var u=new Set(xs(t)),l={};M(t,function(p){if(nt(p)){l[p.id]=be(i)?a.createConnection(l[p.source.id],l[p.target.id],i,p,p.parent||n,o):a.createConnection(l[p.source.id],l[p.target.id],p,p.parent||n,o);return}var f=O({},o);u.has(p)||(f.autoResize=!1),Ae(p)&&(f=ai(f,["attach"])),l[p.id]=be(i)?a.createShape(p,ti(p,["x","y","width","height"]),p.parent||n,i,f):a.createShape(p,ti(p,["x","y","width","height"]),p.parent||n,f)}),e.elements=Qr(l)};var My=Math.round;function pr(e){this._canvas=e}pr.$inject=["canvas"],pr.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,r=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?O(t,n):O(t,{x:n.x-My(t.width/2),y:n.y-My(t.height/2)}),this._canvas.addShape(t,i,r),t},pr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function ga(e){pr.call(this,e)}ie(ga,pr),ga.$inject=["canvas"];var aA=pr.prototype.execute;ga.prototype.execute=function(e){var t=e.shape;return cA(t),t.labelTarget=e.labelTarget,aA.call(this,e)};var sA=pr.prototype.revert;ga.prototype.revert=function(e){return e.shape.labelTarget=null,sA.call(this,e)};function cA(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=nl(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 Tp(e,t){this._modeling=e,this._elementRegistry=t}Tp.$inject=["modeling","elementRegistry"],Tp.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){nt(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=nl(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 bc(e){this._modeling=e}bc.$inject=["modeling"];var ky={x:"y",y:"x"};bc.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(g,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[ky[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[ky[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)}))})},bc.prototype.postExecute=function(e){};function xc(e,t){this._layouter=e,this._canvas=t}xc.$inject=["layouter","canvas"],xc.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return O(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},xc.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Mp(){}Mp.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=xt(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},Mp.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return xt(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 kp(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}kp.prototype.add=function(e,t){return this.addAll([e],t)},kp.prototype.addAll=function(e,t){var n=$w(e,!!t,this);return O(this,n),this};function _a(e){this._modeling=e}_a.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},_a.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,a=e.allShapes,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&&$l(p,p.source,t),connectionEnd:d&&jl(p,p.target,t)})})},_a.prototype.getClosure=function(e){return new kp().addAll(e,!0)};function Ec(e){this._helper=new _a(e)}Ec.$inject=["modeling"],Ec.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Ec.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 zr(e){this._modeling=e,this._helper=new _a(e)}zr.$inject=["modeling"],zr.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=ti(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=xt(o.children,t),Et(i.children,t,r),O(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},zr.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:jl(o,t,n)})}),M(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:$l(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},zr.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return Et(n.children,t,i),O(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},zr.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},zr.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||Dy(ge(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||Dy(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 Dy(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,Ks(h,s,l),a)}),M(d,function(h){var m=h.target,g=c(s,m,h);g&&t.reconnectStart(h,s,Ys(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},O(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},xa.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(M(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:Ks(o,n,i)})}),M(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:Ys(o,n,i)})}))},xa.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return O(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function fr(e){this._modeling=e}fr.$inject=["modeling"],fr.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,r=e.resizingShapes,o=e.start,a={};this.moveShapes(i,t),M(r,function(s){a[s.id]=lA(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(BP(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=$P(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=uA(l),h=Ly(n),m={},g=c.has(p)||u.has(p),S=c.has(f)||u.has(f);g&&S?(d=rn(d,function(E){return Iy(E,i,n)&&(E[h]=E[h]+t[h]),E.original&&Iy(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=$l(l,p,t):c.has(f)?m.connectionEnd=jl(l,f,t):u.has(p)?m.connectionStart=Ys(l,p,a[p.id]):u.has(f)&&(m.connectionEnd=Ks(l,f,a[f.id])),s._modeling.layoutConnection(l,m))})};function Oy(e){return O({},e)}function uA(e){return rn(e.waypoints,function(t){return t=Oy(t),t.original&&(t.original=Oy(t.original)),t})}function Ly(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function Iy(e,t,n){var i=Ly(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function lA(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function wc(e){this._modeling=e}wc.$inject=["modeling"],wc.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=Ny(n),t.collapsed=!t.collapsed;var i=By(n,t.collapsed);return[t].concat(i)},wc.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=$y(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function Ny(e){var t={};return M(e,function(n){t[n.id]=n.hidden,n.children&&(t=O({},t,Ny(n.children)))}),t}function By(e,t){var n=[];return M(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(By(i.children,i.collapsed||t)))}),n}function $y(e,t){var n=[];return M(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat($y(i.children,t)))}),n}function Sc(e){this._modeling=e}Sc.$inject=["modeling"],Sc.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=jy(i,t),Fy(n,t),t.host=n,t},Sc.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,jy(n,t),Fy(i,t,r),t};function jy(e,t){return xt(e&&e.attachers,t)}function Fy(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),Et(i,t,n)}}function Dp(){}Dp.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},Dp.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function it(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}it.$inject=["eventBus","elementFactory","commandStack"],it.prototype.getHandlers=function(){return{"shape.append":yc,"shape.create":pr,"shape.delete":va,"shape.move":zr,"shape.resize":xa,"shape.replace":Ii,"shape.toggleCollapse":wc,spaceTool:fr,"label.create":ga,"connection.create":vc,"connection.delete":ya,"connection.move":Mp,"connection.layout":xc,"connection.updateWaypoints":Dp,"connection.reconnect":ba,"elements.create":Ap,"elements.move":Ec,"elements.delete":Tp,"elements.distribute":bc,"elements.align":gc,"element.updateAttachment":Sc}},it.prototype.registerHandlers=function(e){M(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},it.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)},it.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},it.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)},it.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)},it.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},it.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},it.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},it.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},it.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},it.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},it.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},it.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},it.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},it.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},it.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},it.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},it.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},it.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)},it.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},it.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)},it.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,O(i,{docking:"source"}))},it.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,O(i,{docking:"target"}))},it.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},it.prototype._create=function(e,t){return w1(t)?t:this._elementFactory.create(e,t)},it.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||pA(n,Ka(i));return Hy(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 Hy(n,t),i},Ea.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return v(e,"bpmn:DataObject")?fA(e,t):[]};function pA(e,t){return En(t,function(n,i){return n[i]=e.get(i),n},{})}function Hy(e,t){M(t,function(n,i){e.set(i,n)})}function fA(e,t){return t.filter(function(n){return v(n,"bpmn:DataObjectReference")&&X(n).dataObjectRef===e})}var wa="default",Ni="id",zy="di",dA={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=vA(e.properties),s=e.oldProperties||hA(t,a);return Vy(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))),Gy(t,a),e.oldProperties=s,e.changed=n,n},Sa.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&X(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,dA)}},Sa.prototype.revert=function(e){var t=e.element,n=e.properties,i=e.oldProperties,r=t.businessObject,o=this._elementRegistry,a=this._moddle.ids;return Gy(t,i),Vy(n,r)&&(a.unclaim(n[Ni]),o.updateId(t,i[Ni]),a.claim(i[Ni],r)),e.changed};function Vy(e,t){return Ni in e&&e[Ni]!==t[Ni]}function hA(e,t){var n=Ka(t),i=e.businessObject,r=ze(e);return En(n,function(o,a){return a!==zy?o[a]=i.get(a):o[a]=mA(r,Ka(t.di)),o},{})}function mA(e,t){return En(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function Gy(e,t){var n=e.businessObject,i=ze(e);M(t,function(r,o){o!==zy?n.set(o,r):i&&gA(i,r)})}function gA(e,t){M(t,function(n,i){e.set(i,n)})}var yA=["default"];function vA(e){var t=O({},e);return yA.forEach(function(n){n in e&&(t[n]=X(t[n]))}),t}function Rc(e,t){this._canvas=e,this._modeling=t}Rc.$inject=["canvas","modeling"],Rc.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=ze(r);return t.setRootElement(n),t.removeRootElement(r),Et(a.rootElements,i),i.$parent=a,xt(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},Rc.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=ze(n);return t.setRootElement(r),t.removeRootElement(n),xt(a.rootElements,i),i.$parent=null,Et(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function Op(e,t){this._modeling=e,this._spaceTool=t}Op.$inject=["modeling","spaceTool"],Op.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=Vt(i);if(u?r==="left"?r="top":r==="right"&&(r="bottom"):r==="top"?r="left":r==="bottom"&&(r="right"),!c.length){var l=u?{x:i.x+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=[];Lr(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 Lp(e){this._modeling=e}Lp.$inject=["modeling"],Lp.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=Vt(n),s=a?n.height:n.width,c=Math.round(s/i),u,l,p,f;for(f=0;f<i;f++)f===i-1?u=s-c*f:u=c,l=a?{x:n.x+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=fR(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=Em(r,i),a=Vn(e),s=[],c=[];Lr(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",Ip="lanes";function Cc(){}Cc.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]=Vs(p)),r[p.id]}function u(l){if(!l.parent)return[];var p=c(l);return p.filter(function(f){return a(l,f)}).map(function(f){return f.businessObject})}return t.forEach(function(l){var p=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(Ip),d=f.slice(),h=u(l);i.push({flowNode:p,remove:d,add:h})}),t.forEach(function(l){var p=l.businessObject;l.parent||p.get(Ca).forEach(function(f){i.push({flowNode:f,remove:[p],add:[]})})}),i},Cc.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.flowNodeShapes,e.laneShapes)),t.forEach(function(n){var i=n.flowNode,r=i.get(Ip);n.remove.forEach(function(o){xt(r,o),xt(o.get(Ca),i)}),n.add.forEach(function(o){Et(r,o),Et(o.get(Ca),i)})}),[]},Cc.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(Ip);n.add.forEach(function(o){xt(r,o),xt(o.get(Ca),i)}),n.remove.forEach(function(o){Et(r,o),Et(o.get(Ca),i)})}),[]};var Np="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:Bp(E)}:w.past={categoryValue:x}))}}function c(E){r.set(E,X(E))}function u(){n.filter(function(E){return v(E,"bpmn:FlowElement")&&!Ae(E)&&E.parent}).forEach(c)}function l(E){var x=X(E),b=x.get("categoryValueRef");return b||(b=ym(i,x),o.push(_A(E,b))),b}function p(E){return E.reduce(function(x,b){var w=Bp(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")&&!Ae(E)&&E.parent}).forEach(function(E){var x=X(E).get("categoryValueRef");if(!x){var b=Bp(E),w=f.get(b)||[],T=oo(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=oo(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(Np),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)),bA(t.groups),EA(t.flowElements),[]},Pa.prototype.revert=function(e){var t=e.updates;return wA(t.flowElements),xA(t.groups),[]};function _A(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function bA(e){e.forEach(function(t){X(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function xA(e){e.forEach(function(t){X(t.groupShape).categoryValueRef=null})}function EA(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Np);t.categoryValuesToRemove.forEach(function(r){xt(i,r)}),t.categoryValuesToAdd.forEach(function(r){Et(i,r,!0)})})}function wA(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Np);t.categoryValuesToAdd.forEach(function(r){xt(i,r)}),t.categoryValuesToRemove.forEach(function(r){Et(i,r,!0)})})}function Bp(e){for(;e.parent;)e=e.parent;return e}function Pc(e){this._moddle=e}Pc.$inject=["moddle"],Pc.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,i=e.element,r=e.claiming;return r?t.claim(n,i):t.unclaim(n),[]},Pc.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,i=e.element,r=e.claiming;return r?t.unclaim(n):t.claim(n,i),[]};var SA={fill:void 0,stroke:void 0};function $p(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(bn(t)){var n=RA(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}$p.$inject=["commandStack"],$p.prototype.postExecute=function(e){var t=e.elements,n=e.colors||SA,i=this,r={};"fill"in n&&O(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&O(r,{"border-color":this._normalizeColor(n.stroke)}),M(t,function(o){var a=nt(o)?ti(r,["border-color"]):r,s=ze(o);if(CA(a),Ae(o)){if(!s||!v(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:s.label,properties:{color:r["border-color"]}})}else{if(!ke(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function RA(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 CA(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var PA={width:0,height:0};function Wy(e,t,n){function i(c,u){var l=c.label||c,p=c.labelTarget||c;return tS(l,u),[l,p]}function r(c){var u=c.element,l=u.businessObject,p=c.newLabel;if(!Ae(u)&&nr(u)&&!Ms(u)&&!Uy(p)){var f=7,d=cl(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(!(!Ae(l)&&!v(l,"bpmn:TextAnnotation"))){if(Ae(l)&&Uy(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,PA)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}Wy.$inject=["modeling","textRenderer","bpmnFactory"];function Uy(e){return!e||!e.trim()}function Qt(e,t,n,i){it.call(this,e,t,n),this._bpmnRules=i}ie(Qt,it),Qt.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],Qt.prototype.getHandlers=function(){var e=it.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=Ea,e["element.updateProperties"]=Sa,e["canvas.updateRoot"]=Rc,e["lane.add"]=Op,e["lane.resize"]=Ra,e["lane.split"]=Lp,e["lane.updateRefs"]=Cc,e["group.updateRefs"]=Pa,e["id.updateClaim"]=Pc,e["element.setColor"]=$p,e["element.updateLabel"]=Wy,e},Qt.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},Qt.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)},Qt.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},Qt.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},Qt.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},Qt.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},Qt.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},Qt.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Qt.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Qt.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},Qt.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},Qt.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},Qt.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},Qt.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function qy(){}qy.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||ye(t.source||e.source),t.connectionEnd||ye(t.target||e.target)]};var Ac=20,AA=5,Tc=Math.round,Yy=20,TA={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function MA(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function kA(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function Ky(e,t,n){var i=Kt(t,e,AA),r=n.split(":")[0],o=Tc((t.x-e.x)/2+e.x),a=Tc((t.y-e.y)/2+e.y),s,c,u=kA(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=MA(i,r),c=l?"h:v":"v:h",p?l?(f=a===e.y,s={x:e.x+Ac*(/l/.test(r)?-1:1),y:f?a+Ac:a}):(f=o===e.x,s={x:f?o+Ac:o,y:e.y+Ac*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:jp(e,s,c).concat(s),directions:c,turnNextDirections:f}}function DA(e,t,n){return Ky(e,t,n)}function OA(e,t,n){var i=Ky(t,e,Xy(n));return{waypoints:i.waypoints.slice().reverse(),directions:Xy(i.directions),turnNextDirections:i.turnNextDirections}}function LA(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=jp(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function Xy(e){return e.split(":").reverse().join(":")}function IA(e,t,n){var i=Tc((t.x-e.x)/2+e.x),r=Tc((t.y-e.y)/2+e.y);if(n==="h:v")return[{x:t.x,y:e.y}];if(n==="v:h")return[{x:e.x,y:t.y}];if(n==="h:h")return[{x:i,y:e.y},{x:i,y:t.y}];if(n==="v:v")return[{x:e.x,y:r},{x:t.x,y:r}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}function jp(e,t,n){if(n=n||"h:h",!GA(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Qy(n)){var i=DA(e,t,n),r=OA(e,t,n),o=LA(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return IA(e,t,n)}function NA(e,t,n){var i=jp(e,t,n);return i.unshift(e),i.push(t),ev(i)}function BA(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=Hx(o,"straight")[0]||"h:h",s=TA[a]||0,c=Kt(e,t,s),u=VA(c,a);n=n||ye(e),i=i||ye(t);var l=u.split(":"),p=Jy(n,e,l[0],WA(c)),f=Jy(i,t,l[1],c);return NA(p,f,u)}function $A(e,t,n,i,r,o){ge(n)&&(r=n,o=i,n=ye(e),i=ye(t)),o=O({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&FA(e,t,n,i,o),c||(c=o.connectionEnd&&zA(t,e,i,r),c)||(c=o.connectionStart&&HA(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:BA(e,t,n,i,o)}function jA(e,t,n){return e>=t&&e<=n}function Zy(e,t,n){var i={x:"width",y:"height"};return jA(t[e],n[e],n[e]+n[i[e]])}function FA(e,t,n,i,r){var o={},a,s;return s=Kt(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?Zy(a,i,e)?(o[a]=i[a],[{x:o.x!==void 0?o.x:n.x,y:o.y!==void 0?o.y:n.y,original:{x:o.x!==void 0?o.x:n.x,y:o.y!==void 0?o.y:n.y}},{x:i.x,y:i.y}]):null:Zy(a,n,t)?(o[a]=n[a],[{x:n.x,y:n.y},{x:o.x!==void 0?o.x:i.x,y:o.y!==void 0?o.y:i.y,original:{x:o.x!==void 0?o.x:i.x,y:o.y!==void 0?o.y:i.y}}]):null):null}function HA(e,t,n,i){return Fp(e,t,n,i)}function zA(e,t,n,i){var r=i.slice().reverse();return r=Fp(e,t,n,r),r?r.reverse():null}function Fp(e,t,n,i){function r(l){return l.length<3?!0:l.length>4?!1:!!ot(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(wh(l[d],p,Yy)||wh(l[d],f,Yy))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=Fp(e,t,n,u)),c&&Pi(c)?null:c}function VA(e,t){if(Qy(t))return t;switch(e){case"intersect":return"t:t";case"top":case"bottom":return"v:v";case"left":case"right":return"h:h";default:return t}}function GA(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Qy(e){return e&&/t|r|b|l/.test(e)}function WA(e){return{top:"bottom",bottom:"top",left:"right",right:"left","top-left":"bottom-right","bottom-right":"top-left","top-right":"bottom-left","bottom-left":"top-right"}[e]}function Jy(e,t,n,i){if(n==="h"&&(n=/left/.test(i)?"l":"r"),n==="v"&&(n=/top/.test(i)?"t":"b"),n==="t")return{original:e,x:e.x,y:t.y};if(n==="r")return{original:e,x:t.x+t.width,y:e.y};if(n==="b")return{original:e,x:e.x,y:t.y+t.height};if(n==="l")return{original:e,x:t.x,y:e.y};throw new Error("unexpected dockingDirection: <"+n+">")}function ev(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return il(r,o,n,0)||t.push(n),t},[])}var UA=-10,qA=40,YA={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},KA={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},Hp={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Aa={top:"t",right:"r",bottom:"b",left:"l"};function Mc(e){this._elementRegistry=e}ie(Mc,qy),Mc.prototype.layoutConnection=function(e,t){t||(t={});var n=t.source||e.source,i=t.target||e.target,r=t.waypoints||e.waypoints,o=t.connectionStart,a=t.connectionEnd,s=this._elementRegistry,c,u;if(o||(o=tv(r&&r[0],n)),a||(a=tv(r&&r[r.length-1],i)),(v(e,"bpmn:Association")||v(e,"bpmn:DataAssociation"))&&r&&!nv(n,i))return[].concat([o],r.slice(1,-1),[a]);var l=dm(n,s)?YA:KA;return v(e,"bpmn:MessageFlow")?c=ZA(n,i,l):(v(e,"bpmn:SequenceFlow")||nv(n,i))&&(n===i?c={preferredLayouts:iT(n,e,l)}:v(n,"bpmn:BoundaryEvent")?c={preferredLayouts:rT(n,i,a,l)}:Ta(n)||Ta(i)?c={preferredLayouts:l.subProcess,preserveDocking:JA(n)}:v(n,"bpmn:Gateway")?c={preferredLayouts:l.fromGateway}:v(i,"bpmn:Gateway")?c={preferredLayouts:l.toGateway}:c={preferredLayouts:l.default}),c&&(c=O(c,t),u=ev($A(n,i,o,a,r,c))),u||[o,a]};function XA(e){var t=e.host;return Kt(ye(e),t,UA)}function ZA(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:QA(e,t)}}function QA(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 JA(e){return Ta(e)?"target":"source"}function tv(e,t){return e?e.original||e:ye(t)}function nv(e,t){return v(t,"bpmn:Activity")&&v(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Ta(e){return v(e,"bpmn:SubProcess")&&Be(e)}function Vr(e,t){return e===t}function eT(e,t){return t.indexOf(e)!==-1}function Ro(e){var t=/right|left/.exec(e);return t&&t[0]}function Co(e){var t=/top|bottom/.exec(e);return t&&t[0]}function iv(e,t){return Hp[e]===t}function tT(e,t){var n=Ro(e),i=Hp[n];return t.indexOf(i)!==-1}function nT(e,t){var n=Co(e),i=Hp[n];return t.indexOf(i)!==-1}function rv(e){return e==="right"||e==="left"}function iT(e,t,n){var i=t.waypoints,r=i&&i.length&&Kt(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function rT(e,t,n,i){var r=ye(e),o=ye(t),a=XA(e),s,c,u=Vr(e.host,t),l=eT(a,["top","right","bottom","left"]),p=Kt(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?oT(a,l,e,t,n,i):(s=aT(a,p,l,i.isHorizontal),c=sT(a,p,l,i.isHorizontal),[s+":"+c])}function oT(e,t,n,i,r,o){var a=t?e:o.isHorizontal?Co(e):Ro(e),s=Aa[a],c;return t?rv(e)?c=ov("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=ov("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function ov(e,t,n,i){var r=qA;return!(zp(e,i,n,r)||zp(e,i,{x:n.x+n.width,y:n.y+n.height},r)||zp(e,i,ye(t),r))}function zp(e,t,n,i){return Math.abs(t[e]-n[e])<i}function aT(e,t,n,i){if(n)return Aa[e];var r=Co(e),o=Ro(e),a=Co(t),s=Ro(t);if(i){if(Vr(r,a)||iv(o,s))return Aa[r]}else if(Vr(o,s)||iv(r,a))return Aa[o];return Aa[i?o:r]}function sT(e,t,n,i){if(n)return rv(e)?tT(e,t)||Vr(e,t)?"h":"v":nT(e,t)||Vr(e,t)?"v":"h";var r=Co(e),o=Ro(e),a=Co(t),s=Ro(t);return a&&!s?"v":s&&!a?"h":i?Vr(r,a)?"h":"v":Vr(o,s)?"v":"h"}Mc.$inject=["elementRegistry"];function av(e){return O({original:e.point.original||e.point},e.actual)}function dr(e,t){this._elementRegistry=e,this._graphicsFactory=t}dr.$inject=["elementRegistry","graphicsFactory"],dr.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),r=this.getDockingPoint(e,n),o=e.waypoints.slice(i.idx+1,r.idx);return o.unshift(av(i)),o.push(av(r)),o},dr.prototype.getDockingPoint=function(e,t,n){var i=e.waypoints,r,o,a;return r=n?0:i.length-1,o=i[r],a=this._getIntersection(t,e,n),{point:o,actual:a||o,idx:r}},dr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return Qo(i,r,n)},dr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},dr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},dr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const Vp={__init__:["modeling","bpmnUpdater"],__depends__:[CC,zC,GC,WC,vy,UP,YP,eA,Wn,Cp,Sy],bpmnFactory:["type",qn],bpmnUpdater:["type",Tn],elementFactory:["type",lr],modeling:["type",Qt],layouter:["type",Mc],connectionDocking:["type",dr]};var cT=10,sv=50,uT=250;function Gp(e,t,n,i){for(var r;r=lT(e,n,t);)n=i(t,n,r);return n}function Wp(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 lT(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=fT(e);return ot(r,function(o){if(o===n)return!1;var a=Kt(o,i,cT);return a==="intersect"})}function pT(e,t){t||(t={});function n(h){return h.source===e?1:-1}var i=t.defaultDistance||sv,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||uT,c=t.reference||"start";o||(o=mT);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=En(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 fT(e){var t=Up(e);return e.host&&(t=t.concat(Up(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(Up(i))},[]))),t}function Up(e){return hT(e).concat(dT(e))}function dT(e){return e.incoming.map(function(t){return t.source})}function hT(e){return e.outgoing.map(function(t){return t.target})}function mT(){return!0}var gT=100;function cv(e,t,n){e.on("autoPlace",gT,function(i){var r=i.shape,o=i.source;return yT(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}}cv.$inject=["eventBus","modeling","canvas"];function yT(e,t,n){n||(n={});var i=n.defaultDistance||sv,r=ye(e),o=me(e);return{x:o.right+i+t.width/2,y:r.y}}function uv(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}uv.$inject=["eventBus","selection"];const vT={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",cv],autoPlaceSelectionBehavior:["type",uv]};function lv(e,t,n){var i=dm(e,n);if(v(t,"bpmn:TextAnnotation"))return bT(e,t,i);if(ke(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return xT(e,t,i);if(v(t,"bpmn:FlowNode"))return _T(e,t,i)}function _T(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=pT(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=Kt(e,e.host,-25),u.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var l=n?{x:i.right+a+t.width/2,y:r.y+pv(u,c,o)}:{x:r.x+pv(u,c,o),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},f=n?{y:p}:{x:p};return Gp(e,t,l,Wp(f))}function pv(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function bT(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};nt(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 Gp(e,t,r,Wp(a))}function xT(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 Gp(e,t,r,Wp(a))}function fv(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return lv(r,i,t)})}fv.$inject=["eventBus","elementRegistry"];const kc={__depends__:[vT],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",fv]},dv=[pm,ra,Vp,kc];function ET(e={}){Jd(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new co({container:t,moddleExtensions:e.moddleExtensions??ns,additionalModules:[...dv,...e.additionalModules??[]]})}var wT=new wo("ov"),ST=500;function Gt(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=wT,this._overlayDefaults=O({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=RT(n.getContainer()),this._init()}Gt.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Gt.prototype.get=function(e){if(bn(e)&&(e={id:e}),bn(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,eo({type:e.type})):t.overlays.slice():[]}else return e.type?Oe(this._overlays,eo({type:e.type})):e.id?this._overlays[e.id]:null},Gt.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=O({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},Gt.prototype.remove=function(e){var t=this.get(e)||[];ge(t)||(t=[t]);var n=this;M(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(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)}})},Gt.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Gt.prototype.show=function(){Dc(this._overlayRoot)},Gt.prototype.hide=function(){Dc(this._overlayRoot,!1)},Gt.prototype.clear=function(){this._overlays={},this._overlayContainers=[],ms(this._overlayRoot)},Gt.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=Rt(t);i=o.x,r=o.y}hv(n,i,r),an(e.html,"data-container-id",t.id)},Gt.prototype._updateOverlay=function(e){var t=e.position,n=e.htmlContainer,i=e.element,r=t.left,o=t.top;if(t.right!==void 0){var a;i.waypoints?a=Rt(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=Rt(i).height:s=i.height,o=t.bottom*-1+s}hv(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Gt.prototype._createOverlayContainer=function(e){var t=ct('<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},Gt.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";mv(this._overlayRoot,n)},Gt.prototype._getOverlayContainer=function(e,t){var n=ot(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},Gt.prototype._addOverlay=function(e){var t=e.id,n=e.element,i=e.html,r,o;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),bn(i)&&(i=ct(i)),o=this._getOverlayContainer(n),r=ct('<div class="djs-overlay" data-overlay-id="'+t+'">'),fn(r,{position:"absolute"}),r.appendChild(i),e.type&&dt(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();Dc(r,a===s),e.htmlContainer=r,o.overlays.push(e),o.html.appendChild(r),this._overlays[t]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Gt.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=this._canvas.findRoot(e.element),r=n&&n.minZoom,o=n&&n.maxZoom,a=e.htmlContainer,s=this._canvas.getRootElement(),c=!0;(i!==s||n&&(Ot(r)&&r>t.scale||Ot(o)&&o<t.scale))&&(c=!1),Dc(a,c),this._updateOverlayScale(e,t)},Gt.prototype._updateOverlayScale=function(e,t){var n=e.scale,i,r,o=e.htmlContainer,a,s="";n!==!0&&(n===!1?(i=1,r=1):(i=n.min,r=n.max),Ot(i)&&t.scale<i&&(a=(1/t.scale||1)*i),Ot(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),Ot(a)&&(s="scale("+a+","+a+")"),mv(o,s)},Gt.prototype._updateOverlaysVisibilty=function(e){var t=this;M(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},Gt.prototype._init=function(){var e=this._eventBus,t=this;function n(i){t._updateRoot(i),t._updateOverlaysVisibilty(i),t.show()}e.on("canvas.viewbox.changing",function(i){t.hide()}),e.on("canvas.viewbox.changed",function(i){n(i.viewbox)}),e.on(["shape.remove","connection.remove"],function(i){var r=i.element,o=t.get({element:r});M(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){pi(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",ST,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&(M(o.overlays,function(a){t._updateOverlay(a)}),t._updateOverlayContainer(o))}),e.on("element.marker.update",function(i){var r=t._getOverlayContainer(i.element,!0);r&&dt(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 RT(e){var t=ct('<div class="djs-overlay-container" />');return fn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function hv(e,t,n){fn(e,{left:t+"px",top:n+"px"})}function Dc(e,t){e.style.display=t===!1?"none":""}function mv(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Oc={__init__:["overlays"],overlays:["type",Gt]};function qp(e,t){t.invoke(K,this),this.executed(function(n){var i=n.context;i.rootElement?e.setRootElement(i.rootElement):i.rootElement=e.getRootElement()}),this.revert(function(n){var i=n.context;i.rootElement&&e.setRootElement(i.rootElement)})}ie(qp,K),qp.$inject=["canvas","injector"];const CT={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",qp]};function Ma(e){return CSS.escape(e)}var PT={"&":"&","<":"<",">":">",'"':""","'":"'"};function gv(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return PT[t]})}var AT="bjs-breadcrumbs-shown";function yv(e,t,n){var i=ct('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=dt(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var u=c.element,l=X(u),p=ot(a,function(f){return f===l});p&&s()});function s(c){c&&(a=TT(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=X(g);return S&&S.get("processRef")===p});f=d&&n.findRoot(d.id)}if(!f)return[];var h=gv(p.name||p.id),m=ct('<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(AT,l),u.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}yv.$inject=["eventBus","elementRegistry","canvas"];function TT(e){for(var t=X(e),n=[],i=t;i;i=i.$parent)(v(i,"bpmn:SubProcess")||v(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function vv(e,t){var n=null,i=new MT;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})}vv.$inject=["eventBus","canvas"];function MT(){this._entries=[],this.set=function(e,t){var n=!1;for(var i in this._entries)if(this._entries[i][0]===e){this._entries[i][1]=t,n=!0;break}n||this._entries.push([e,t])},this.get=function(e){for(var t in this._entries)if(this._entries[t][0]===e)return this._entries[t][1];return null},this.clear=function(){this._entries.length=0},this.remove=function(e){var t=-1;for(var n in this._entries)if(this._entries[n][0]===e){t=n;break}t!==-1&&this._entries.splice(t,1)}}var _v={x:180,y:160};function Gr(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}Gr.prototype._handleImport=function(e){if(e.diagrams){var t=this;this._definitions=e,this._processToDiagramMap={},e.diagrams.forEach(function(i){!i.plane||!i.plane.bpmnElement||(t._processToDiagramMap[i.plane.bpmnElement.id]=i)});var n=e.diagrams.filter(i=>i.plane).flatMap(i=>t._createNewDiagrams(i.plane));n.forEach(function(i){t._movePlaneElementsToOrigin(i.plane)})}},Gr.prototype._createNewDiagrams=function(e){var t=this,n=[],i=[];e.get("planeElement").forEach(function(o){var a=o.bpmnElement;if(a){var s=a.$parent;v(a,"bpmn:SubProcess")&&!o.isExpanded&&n.push(a),DT(a,e)&&i.push({diElement:o,parent:s})}});var r=[];return n.forEach(function(o){if(!t._processToDiagramMap[o.id]){var a=t._createDiagram(o);t._processToDiagramMap[o.id]=a,r.push(a)}}),i.forEach(function(o){for(var a=o.diElement,s=o.parent;s&&n.indexOf(s)===-1;)s=s.$parent;if(s){var c=t._processToDiagramMap[s.id];t._moveToDiPlane(a,c.plane)}}),r},Gr.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=kT(e),i={x:n.x-_v.x,y:n.y-_v.y};t.forEach(function(r){r.waypoint?r.waypoint.forEach(function(o){o.x=o.x-i.x,o.y=o.y-i.y}):r.bounds&&(r.bounds.x=r.bounds.x-i.x,r.bounds.y=r.bounds.y-i.y)})},Gr.prototype._moveToDiPlane=function(e,t){var n=bv(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},Gr.prototype._createDiagram=function(e){var t=this._moddle.create("bpmndi:BPMNPlane",{bpmnElement:e}),n=this._moddle.create("bpmndi:BPMNDiagram",{plane:t});return t.$parent=n,t.bpmnElement=e,n.$parent=this._definitions,this._definitions.diagrams.push(n),n},Gr.$inject=["eventBus","moddle"];function bv(e){return v(e,"bpmndi:BPMNDiagram")?e:bv(e.$parent)}function kT(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)}}),Ss(t)}function DT(e,t){var n=e.$parent;return!(!v(n,"bpmn:SubProcess")||n===t.bpmnElement||ke(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var Lc=250,OT='<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>',LT="bjs-drilldown-empty";function hr(e,t,n,i,r){K.call(this,t),this._canvas=e,this._eventBus=t,this._elementRegistry=n,this._overlays=i,this._translate=r;var o=this;this.executed("shape.toggleCollapse",Lc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",Lc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],Lc,function(a){var s=a.oldParent,c=a.newParent||a.parent,u=a.shape;o._canDrillDown(u)&&o._addOverlay(u),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(u)},!0),this.reverted(["shape.create","shape.move","shape.delete"],Lc,function(a){var s=a.oldParent,c=a.newParent||a.parent,u=a.shape;o._canDrillDown(u)&&o._addOverlay(u),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(u)},!0),t.on("import.render.complete",function(){n.filter(function(a){return o._canDrillDown(a)}).map(function(a){o._addOverlay(a)})})}ie(hr,K),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=X(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;dt(i.html).toggle(LT,!r)}},hr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=X(e),r=n.get({element:e,type:"drilldown"});r.length&&this._removeOverlay(e);var o=ct('<button type="button" class="bjs-drilldown">'+OT+"</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 IT={__depends__:[Oc,Cp,CT],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",yv],drilldownCentering:["type",vv],drilldownOverlayBehavior:["type",hr],subprocessCompatibility:["type",Gr]};function mr(e){gt.call(this,e)}ie(mr,gt),mr.prototype._modules=[pm,IT,Oc,Wn,ra],mr.prototype._moddleExtensions={};var Ic="keyboard.keydown",NT="keyboard.keyup",BT=1e3,xv="Keyboard binding is now implicit; explicit binding to an element got removed. For more information, see https://github.com/bpmn-io/diagram-js/issues/661";function 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(xv));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,Ic)},dn.prototype._keyupHandler=function(e){this._keyHandler(e,NT)},dn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Ic,i),n&&e.preventDefault()}},dn.prototype._isEventIgnored=function(e){return!1},dn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(xv)),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=BT),this._eventBus.on(n||Ic,e,t)},dn.prototype.removeListener=function(e,t){this._eventBus.off(t||Ic,e)},dn.prototype.hasModifier=rP,dn.prototype.isCmd=Pn,dn.prototype.isShift=mp,dn.prototype.isKey=Nt;var $T=500;function Po(e,t){var n=this;e.on("editorActions.init",$T,function(i){var r=i.editorActions;n.registerBindings(t,r)})}Po.$inject=["eventBus","keyboard"],Po.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(uP(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(lP(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(oP(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(aP(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(sP(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(cP(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Nt(["+","Add","="],r)&&Pn(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Nt(["-","Subtract"],r)&&Pn(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(Nt("0",r)&&Pn(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 Yp={__init__:["keyboard","keyboardBindings"],keyboard:["type",dn],keyboardBindings:["type",Po]};var jT={moveSpeed:50,moveSpeedAccelerated:200};function Ev(e,t,n){var i=this;this._config=O({},jT,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})}}Ev.$inject=["config.keyboardMove","keyboard","canvas"];const wv={__depends__:[Yp],__init__:["keyboardMove"],keyboardMove:["type",Ev]};var FT=15;function Sv(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=$r(s),p=ni(l,c);if(!n.dragging&&HT(p)>FT&&(n.dragging=!0,u===0&&Zg(e),cc("grab")),n.dragging){var f=n.last||n.start;p=ni(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,Xg()}function a(s){if(!Dr(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:$r(s)},we.bind(document,"mousemove",r),we.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}Sv.$inject=["eventBus","canvas"];function HT(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const Rv={__init__:["moveCanvas"],moveCanvas:["type",Sv]};function Cv(e,t){var n=fl(e.min),i=fl(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function zT(e,t){return Math.max(e.min,Math.min(e.max,t))}var VT=Math.sign||function(e){return e>=0?1:-1},Kp={min:.2,max:4},Pv=10,GT=.1,WT=.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||WT;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=Cv(Kp,Pv*2);this._totalDelta+=t,Math.abs(this._totalDelta)>GT&&(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||rg()&&t.metaKey,r=t.shiftKey,o=-1*this._scale,a;if(i?o*=t.deltaMode===0?.02:.32:o*=t.deltaMode===0?1:16,i){var 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))*VT(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=Cv(Kp,Pv);this._zoom(t,n,i)},_i.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=fl(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(zT(Kp,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 Av={__init__:["zoomScroll"],zoomScroll:["type",_i]};function ka(e){mr.call(this,e)}ie(ka,mr),ka.prototype._navigationModules=[wv,Rv,Av],ka.prototype._modules=[].concat(mr.prototype._modules,ka.prototype._navigationModules);function Xp(e){return e&&e[e.length-1]}function Tv(e){return e.y}function Mv(e){return e.x}var UT={left:Mv,center:Mv,right:function(e){return e.x+e.width},top:Tv,middle:Tv,bottom:function(e){return e.y+e.height}};function Ao(e,t){this._modeling=e,this._rules=t}Ao.$inject=["modeling","rules"],Ao.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}},Ao.prototype._isType=function(e,t){return t.indexOf(e)!==-1},Ao.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=Xp(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]=Xp(c).center,o;u=t[0],t=oi(t,function(f){return f[i]+f[r]}),l=Xp(t),o[e]=p(u,l)}return o},Ao.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=UT[t],a=oi(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const qT={__init__:["alignElements"],alignElements:["type",Ao]},YT=new wo;function To(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}To.$inject=["eventBus"],To.prototype.schedule=function(e,t=YT.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},To.prototype._schedule=function(e,t){const n=KT();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}},To.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},To.prototype._cancel=function(e){clearTimeout(e.executionId)};function KT(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const XT={scheduler:["type",To]};var ZT="djs-element-hidden",Nc=".entry",QT=1e3,kv=8,JT=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=ct('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},Pt.prototype.registerProvider=function(e,t){t||(t=e,e=QT),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=an(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},JT);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=ct(r.html||'<div class="entry" draggable="true"></div>'),c;an(s,"data-action",o),c=tt("[data-group="+Ma(a)+"]",n),c||(c=ct('<div class="group"></div>'),an(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&eM(s,r.className),r.title&&an(s,"title",r.title),r.imageUrl&&(i=ct("<img>"),an(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),dt(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=ct('<div class="djs-context-pad"></div>');return Sn.bind(n,Nc,"click",function(i){t.trigger("click",i)}),Sn.bind(n,Nc,"dragstart",function(i){t.trigger("dragstart",i)}),Sn.bind(n,Nc,"mouseover",function(i){t.trigger("mouseover",i)}),Sn.bind(n,Nc,"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()&&nM(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&&Cr(e,function(i){return n.includes(i)}):n===e},Pt.prototype.isShown=function(){return this.isOpen()&&dt(this._current.html).has("open")},Pt.prototype.show=function(){this.isOpen()&&(dt(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},Pt.prototype.hide=function(){this.isOpen()&&(dt(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},Pt.prototype._getPosition=function(e){if(!ge(e)&&nt(e)){var t=this._canvas.viewbox(),n=tM(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+kv*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+kv*this._canvas.zoom(),top:s.top-a.top}},Pt.prototype._updatePosition=function(){const e=()=>{if(this.isOpen()){var t=this._current.html,n=this._getPosition(this._current.target);"x"in n&&"y"in n?(t.style.left=n.x+"px",t.style.top=n.y+"px"):["top","right","bottom","left"].forEach(function(i){i in n&&(t.style[i]=n[i]+"px")})}};this._scheduler.schedule(e,"ContextPad#_updatePosition")},Pt.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=ge(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,ZT)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},Pt.prototype._getTargetBounds=function(e){var t=this,n=ge(e)?e:[e],i=n.map(function(r){return t._canvas.getGraphics(r)});return i.reduce(function(r,o){const a=o.getBoundingClientRect();return r.top=Math.min(r.top,a.top),r.right=Math.max(r.right,a.right),r.bottom=Math.max(r.bottom,a.bottom),r.left=Math.min(r.left,a.left),r.x=r.left,r.y=r.top,r.width=r.right-r.left,r.height=r.bottom-r.top,r},{top:1/0,right:-1/0,bottom:-1/0,left:1/0})};function eM(e,t){var n=dt(e);t=ge(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function tM(e){return e.waypoints[e.waypoints.length-1]}function nM(e,t){return e=ge(e)?e:[e],t=ge(t)?t:[t],e.length===t.length&&Cr(e,function(n){return t.includes(n)})}const Dv={__depends__:[sc,XT,Oc],contextPad:["type",Pt]};var Bc,vt,Ov,gr,Lv,Iv,Nv,Zp,$c,Da,Bv,Qp,Jp,ef,jc={},Fc=[],iM=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Hc=Array.isArray;function Bi(e,t){for(var n in t)e[n]=t[n];return e}function tf(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function $v(e,t,n){var i,r,o,a={};for(o in t)o=="key"?i=t[o]:o=="ref"?r=t[o]:a[o]=t[o];if(arguments.length>2&&(a.children=arguments.length>3?Bc.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)a[o]===void 0&&(a[o]=e.defaultProps[o]);return zc(e,a,i,r,null)}function zc(e,t,n,i,r){var o={type:e,props:t,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++Ov,__i:-1,__u:0};return r==null&&vt.vnode!=null&&vt.vnode(o),o}function Vc(e){return e.children}function Gc(e,t){this.props=e,this.context=t}function Wr(e,t){if(t==null)return e.__?Wr(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"?Wr(e):null}function rM(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=Bi({},t);o.__v=t.__v+1,vt.vnode&&vt.vnode(o),nf(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??Wr(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,Uv(i,o,r),t.__e=t.__=null,o.__e!=n&&jv(o)}}function jv(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),jv(e)}function Fv(e){(!e.__d&&(e.__d=!0)&&gr.push(e)&&!Wc.__r++||Lv!=vt.debounceRendering)&&((Lv=vt.debounceRendering)||Iv)(Wc)}function Wc(){try{for(var e,t=1;gr.length;)gr.length>t&&gr.sort(Nv),e=gr.shift(),t=gr.length,rM(e)}finally{gr.length=Wc.__r=0}}function Hv(e,t,n,i,r,o,a,s,c,u,l){var p,f,d,h,m,g,S=i&&i.__k||Fc,E=t.length;for(c=oM(n,t,S,c,E),p=0;p<E;p++)(d=n.__k[p])!=null&&(f=d.__i!=-1&&S[d.__i]||jc,d.__i=p,g=nf(e,d,f,r,o,a,s,c,u,l),h=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&rf(f.ref,null,d),l.push(d.ref,d.__c||h,d)),m==null&&h!=null&&(m=h),4&d.__u?(c=zv(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 oM(e,t,n,i,r){var o,a,s,c,u,l=n.length,p=l,f=0;for(e.__k=new Array(r),o=0;o<r;o++)(a=t[o])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[o]=zc(null,a,null,null,null):Hc(a)?a=e.__k[o]=zc(Vc,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=zc(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[o]=a,c=o+f,a.__=e,a.__b=e.__b+1,s=null,(u=a.__i=aM(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=Wr(s)),Yv(s,s));return i}function zv(e,t,n){var i,r;if(typeof e.type=="function"){for(i=e.__k,r=0;i&&r<i.length;r++)i[r]&&(i[r].__=e,t=zv(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Wr(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function aM(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 Vv(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||iM.test(t)?n:n+"px"}function Uc(e,t,n,i,r){var o,a;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof i=="string"&&(e.style.cssText=i=""),i)for(t in i)n&&t in n||Vv(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||Vv(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(Bv,"$1")),a=t.toLowerCase(),t=a in e||t=="onFocusOut"||t=="onFocusIn"?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?i?n[Da]=i[Da]:(n[Da]=Qp,e.addEventListener(t,o?ef:Jp,o)):e.removeEventListener(t,o?ef:Jp,o);else{if(r=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function Gv(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[$c]==null)t[$c]=Qp++;else if(t[$c]<n[Da])return;return n(vt.event?vt.event(t):t)}}}function nf(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=vt.__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 Gc(E,w),f.constructor=H,f.render=cM),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)}),Fc.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&a.push(f),s=Wr(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=vt.__r,L=0,x)f.state=f.__s,f.__d=!1,T&&T(t),l=f.render(f.props,f.state,f.context),Fc.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,T&&T(t),l=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++L<25);f.state=f.__s,f.getChildContext!=null&&(i=Bi(Bi({},i),f.getChildContext())),x&&!d&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(h,m)),A=l!=null&&l.type===Vc&&l.key==null?qv(l.props.children):l,s=Hv(e,Hc(A)?A:[A],t,n,i,r,o,a,s,c,u),f.base=t.__e,t.__u&=-161,f.__h.length&&a.push(f),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--;)tf(o[F])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),N.then||Wv(t),vt.__e(N,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=sM(n.__e,t,n,i,r,o,a,c,u);return(l=vt.diffed)&&l(t),128&t.__u?void 0:s}function Wv(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Wv))}function Uv(e,t,n){for(var i=0;i<n.length;i++)rf(n[i],n[++i],n[++i]);vt.__c&&vt.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){vt.__e(o,r.__v)}})}function qv(e){return typeof e!="object"||e==null||e.__b>0?e:Hc(e)?e.map(qv):e.constructor!==void 0?null:Bi({},e)}function sM(e,t,n,i,r,o,a,s,c){var u,l,p,f,d,h,m,g=n.props||jc,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&&(vt.__m&&vt.__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&&Bc.call(e.childNodes),!s&&o!=null)for(g={},u=0;u<e.attributes.length;u++)g[(d=e.attributes[u]).name]=d.value;for(u in g)d=g[u],u=="dangerouslySetInnerHTML"?p=d:u=="children"||u in S||u=="value"&&"defaultValue"in S||u=="checked"&&"defaultChecked"in S||Uc(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||Uc(e,u,d,g[u],r);if(l)s||p&&(l.__html==p.__html||l.__html==e.innerHTML)||(e.innerHTML=l.__html),t.__k=[];else if(p&&(e.innerHTML=""),Hv(t.type=="template"?e.content:e,Hc(f)?f:[f],t,n,i,E=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&Wr(n,0),s,c),o!=null)for(u=o.length;u--;)tf(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])&&Uc(e,u,h,g[u],r),u="checked",m!=null&&m!=e[u]&&Uc(e,u,m,g[u],r))}return e}function rf(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){vt.__e(r,n)}}function Yv(e,t,n){var i,r;if(vt.unmount&&vt.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||rf(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){vt.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&Yv(i[r],t,n||typeof e.type!="function");n||tf(e.__e),e.__c=e.__=e.__e=void 0}function cM(e,t,n){return this.constructor(e,n)}function Kv(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),vt.__&&vt.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],nf(t,e=t.__k=$v(Vc,null,[e]),r||jc,jc,t.namespaceURI,r?null:t.firstChild?Bc.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),Uv(o,e,a),e.props.children=null}Bc=Fc.slice,vt={__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}},Ov=0,Gc.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),Fv(this))},Gc.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Fv(this))},Gc.prototype.render=Vc,gr=[],Iv=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Nv=function(e,t){return e.__v.__b-t.__v.__b},Wc.__r=0,Zp=Math.random().toString(8),$c="__d"+Zp,Da="__a"+Zp,Bv=/(PointerCapture)$|Capture$/i,Qp=0,Jp=Gv(!1),ef=Gv(!0);var Xv=function(e,t,n,i){var r;t[0]=0;for(var o=1;o<t.length;o++){var a=t[o++],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,Xv(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},Zv=new Map;function uM(e){var t=Zv.get(this);return t||(t=new Map,Zv.set(this,t)),(t=Xv(this,t.get(e)||(t.set(e,t=(function(n){for(var i,r,o=1,a="",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,
|
|
10
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="`+f+'" height="'+d+'" viewBox="'+l+" "+p+" "+f+" "+d+'" version="1.1">'+c+a+"</svg>"}catch(i){n=i}if(this._emit("saveSVG.done",{error:n,svg:t}),n)throw n;return{svg:t}},gt.prototype._setDefinitions=function(e){this._definitions=e},gt.prototype.getModules=function(){return this._modules},gt.prototype.clear=function(){this.getDefinitions()&&nr.prototype.clear.call(this)},gt.prototype.destroy=function(){nr.prototype.destroy.call(this),pi(this._container)},gt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},gt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},gt.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=tt(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},gt.prototype.getDefinitions=function(){return this._definitions},gt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},gt.prototype._init=function(e,t,n){const i=n.modules||this.getModules(n),r=n.additionalModules||[],o=[{bpmnjs:["value",this],moddle:["value",t]}],a=[].concat(o,i,r),c=O(si(n,["additionalModules"]),{canvas:O({},n.canvas,{container:e}),modules:a});nr.call(this,c),n&&n.container&&this.attachTo(n.container)},gt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},gt.prototype._createContainer=function(e){const t=ut('<div class="bjs-container"></div>');return fn(t,{width:nm(e.width),height:nm(e.height),position:e.position}),t},gt.prototype._createModdle=function(e){const t=O({},this._moddleExtensions,e.moddleExtensions);return new cd(t)},gt.prototype._modules=[];function Ts(e,t){return e.warnings=t,e}function Y1(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 q1={width:"100%",height:"100%",position:"relative"};function nm(e){return e+(we(e)?"px":"")}function K1(e,t){return t&&ot(e.diagrams,function(n){return n.id===t})||null}function X1(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Qh+"</a>",i=ut(n);fn(tt("svg",i),Jh),fn(i,em,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),Re.bind(i,"click",function(r){U1(),r.preventDefault()})}function uo(e){gt.call(this,e),this.on("import.parse.complete",function(t){t.error||this._collectIds(t.definitions,t.elementsById)},this),this.on("diagram.destroy",function(){this.get("moddle").ids.clear()},this)}ie(uo,gt),uo.prototype._createModdle=function(e){var t=gt.prototype._createModdle.call(this,e);return t.ids=new li([32,36,1]),t},uo.prototype._collectIds=function(e,t){var n=e.$model,i=n.ids,r;i.clear();for(r in t)i.claim(r,t[r])};function $e(e,t){return v(e,"bpmn:CallActivity")?!1:v(e,"bpmn:SubProcess")?(t=t||ze(e),t&&v(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):v(e,"bpmn:Participant")?!!Z(e).processRef:!0}function Gt(e){if(!(!v(e,"bpmn:Participant")&&!v(e,"bpmn:Lane"))){var t=ze(e).isHorizontal;return t===void 0?!0:t}}function Z1(e){return e&&Z(e).isInterrupting!==!1}function cn(e){return e&&!!Z(e).triggeredByEvent}function lo(e,t){var n=Z(e).eventDefinitions;return Gi(n,function(i){return v(i,t)})}function Q1(e){return lo(e,"bpmn:ErrorEventDefinition")}function J1(e){return lo(e,"bpmn:EscalationEventDefinition")}function eS(e){return lo(e,"bpmn:CompensateEventDefinition")}var Br={width:90,height:20},im=15;function ir(e){return v(e,"bpmn:Event")||v(e,"bpmn:Gateway")||v(e,"bpmn:DataStoreReference")||v(e,"bpmn:DataObjectReference")||v(e,"bpmn:DataInput")||v(e,"bpmn:DataOutput")||v(e,"bpmn:SequenceFlow")||v(e,"bpmn:MessageFlow")||v(e,"bpmn:Group")}function Ms(e){return Me(e.label)}function tS(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=nS(e),o=Math.atan((i.y-n.y)/(i.x-n.x)),a=r.x,c=r.y;return Math.abs(o)<Math.PI/2?c-=im:a+=im,{x:a,y:c}}function nS(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)];return{x:n.x+(i.x-n.x)/2,y:n.y+(i.y-n.y)/2}}function ul(e){return e.waypoints?tS(e.waypoints):v(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Br.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Br.height/2}}function iS(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(Br.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=ul(t),i=Br),O({x:n.x-i.width/2,y:n.y-i.height/2},i)}function rm(e){if(v(e,"bpmn:FlowElement")||v(e,"bpmn:Participant")||v(e,"bpmn:Lane")||v(e,"bpmn:SequenceFlow")||v(e,"bpmn:MessageFlow")||v(e,"bpmn:DataInput")||v(e,"bpmn:DataOutput"))return"name";if(v(e,"bpmn:TextAnnotation"))return"text";if(v(e,"bpmn:Group"))return"categoryValueRef"}function rS(e){var t=e.categoryValueRef;return t&&t.value||""}function Nn(e){var t=e.businessObject,n=rm(t);if(n)return n==="categoryValueRef"?rS(t):t[n]||""}function oS(e,t){var n=e.businessObject,i=rm(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function aS(e){return Me(e)&&ir(e.labelTarget)}var po=7;function om(e){let t=[];return M(e.incoming,n=>{v(n,"bpmn:Association")&&v(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),M(e.outgoing,n=>{v(n,"bpmn:Association")&&v(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function ta(e){const t=new Map;return M(nl(e),n=>{M(om(n),i=>{t.has(i.annotation)||t.set(i.annotation,{annotation:i.annotation,associations:[]}),t.get(i.annotation).associations.push(i.association)})}),[...t.values()]}var ll="hsl(225, 10%, 15%)",sS="white";function mi(e,t){return Gi(e.eventDefinitions,function(n){return n.$type===t})}function cS(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function uS(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function Ne(e,t,n){var i=ze(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||sS}function te(e,t,n){var i=ze(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||ll}function na(e,t,n,i){var r=ze(e),o=r.get("label");return i||o&&o.get("color:color")||t||te(e,n)}function am(e){var t=e.x+e.width/2,n=e.y+e.height/2,i=e.width/2,r=[["M",t,n],["m",0,-i],["a",i,i,0,1,1,0,2*i],["a",i,i,0,1,1,0,-2*i],["z"]];return Lr(r)}function pl(e,t){var n=e.x,i=e.y,r=e.width,o=e.height,a=[["M",n+t,i],["l",r-t*2,0],["a",t,t,0,0,1,t,t],["l",0,o-t*2],["a",t,t,0,0,1,-t,t],["l",t*2-r,0],["a",t,t,0,0,1,-t,-t],["l",0,t*2-o],["a",t,t,0,0,1,t,-t],["z"]];return Lr(a)}function lS(e){var t=e.width,n=e.height,i=e.x,r=e.y,o=t/2,a=n/2,c=[["M",i+o,r],["l",o,a],["l",-o,a],["l",-o,-a],["z"]];return Lr(c)}function pS(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 Lr(o)}function ia(e,t={}){return{width:zn(e,t),height:Pn(e,t)}}function zn(e,t={}){return wn(t,"width")?t.width:e.width}function Pn(e,t={}){return wn(t,"height")?t.height:e.height}var fS=new li,dS=10,ks=3,hS=1.5,Ds=10,mS=4,fo=.95,gS=1,yS=.25;function $r(e,t,n,i,r,o,a){Ai.call(this,t,a);var c=e&&e.defaultFillColor,s=e&&e.defaultStrokeColor,u=e&&e.defaultLabelColor;function l(C){return n.computeStyle(C,{strokeLinecap:"round",strokeLinejoin:"round",stroke:ll,strokeWidth:2,fill:"white"})}function p(C){return n.computeStyle(C,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:ll,strokeWidth:2})}function f(C,_){var{ref:y={x:0,y:0},scale:D=1,element:I,parentGfx:W=r._svg}=_,oe=me("marker",{id:C,viewBox:"0 0 20 20",refX:y.x,refY:y.y,markerWidth:20*D,markerHeight:20*D,orient:"auto"});Ce(oe,I);var Ae=tt(":scope > defs",W);Ae||(Ae=me("defs"),Ce(W,Ae)),Ce(Ae,oe)}function d(C,_,y,D){var I=fS.nextPrefixed("marker-");return h(C,I,_,y,D),"url(#"+I+")"}function h(C,_,y,D,I){if(y==="sequenceflow-end"){var W=me("path",{d:"M 1 5 L 11 10 L 1 15 Z",...l({fill:I,stroke:I,strokeWidth:1})});f(_,{element:W,ref:{x:11,y:10},scale:.5,parentGfx:C})}if(y==="messageflow-start"){var oe=me("circle",{cx:6,cy:6,r:3.5,...l({fill:D,stroke:I,strokeWidth:1,strokeDasharray:[1e4,1]})});f(_,{element:oe,ref:{x:6,y:6},parentGfx:C})}if(y==="messageflow-end"){var Ae=me("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...l({fill:D,stroke:I,strokeWidth:1,strokeDasharray:[1e4,1]})});f(_,{element:Ae,ref:{x:8.5,y:5},parentGfx:C})}if(y==="association-start"){var Ue=me("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:I,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(_,{element:Ue,ref:{x:1,y:10},scale:.5,parentGfx:C})}if(y==="association-end"){var pt=me("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:I,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(_,{element:pt,ref:{x:11,y:10},scale:.5,parentGfx:C})}if(y==="conditional-flow-marker"){var Je=me("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...l({fill:D,stroke:I})});f(_,{element:Je,ref:{x:-1,y:10},scale:.5,parentGfx:C})}if(y==="conditional-default-flow-marker"){var jt=me("path",{d:"M 6 4 L 10 16",...l({stroke:I,fill:"none"})});f(_,{element:jt,ref:{x:0,y:10},scale:.5,parentGfx:C})}}function m(C,_,y,D,I={}){Ht(D)&&(I=D,D=0),D=D||0,I=l(I);var W=_/2,oe=y/2,Ae=me("circle",{cx:W,cy:oe,r:Math.round((_+y)/4-D),...I});return Ce(C,Ae),Ae}function g(C,_,y,D,I,W){Ht(I)&&(W=I,I=0),I=I||0,W=l(W);var oe=me("rect",{x:I,y:I,width:_-I*2,height:y-I*2,rx:D,ry:D,...W});return Ce(C,oe),oe}function R(C,_,y,D){var I=_/2,W=y/2,oe=[{x:I,y:0},{x:_,y:W},{x:I,y},{x:0,y:W}],Ae=oe.map(function(pt){return pt.x+","+pt.y}).join(" ");D=l(D);var Ue=me("polygon",{...D,points:Ae});return Ce(C,Ue),Ue}function w(C,_,y,D){y=p(y);var I=qo(_,y,D);return Ce(C,I),I}function x(C,_,y){return w(C,_,y,5)}function b(C,_,y){y=p(y);var D=me("path",{...y,d:_});return Ce(C,D),D}function E(C,_,y,D){return b(_,y,O({"data-marker":C},D))}function T(C){return Dt[C]}function L(C){return function(_,y,D){return T(C)(_,y,D)}}var A={"bpmn:MessageEventDefinition":function(C,_,y={},D){var I=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.235,my:.315}}),W=D?te(_,s,y.stroke):Ne(_,c,y.fill),oe=D?Ne(_,c,y.fill):te(_,s,y.stroke),Ae=b(C,I,{fill:W,stroke:oe,strokeWidth:1});return Ae},"bpmn:TimerEventDefinition":function(C,_,y={}){var D=y.width||_.width,I=y.height||_.height,W=y.width?1:2,oe=m(C,D,I,.2*I,{fill:Ne(_,c,y.fill),stroke:te(_,s,y.stroke),strokeWidth:W}),Ae=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:D,containerHeight:I,position:{mx:.5,my:.5}});b(C,Ae,{stroke:te(_,s,y.stroke),strokeWidth:W});for(var Ue=0;Ue<12;Ue++){var pt=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:D,containerHeight:I,position:{mx:.5,my:.5}}),Je=D/2,jt=I/2;b(C,pt,{strokeWidth:1,stroke:te(_,s,y.stroke),transform:"rotate("+Ue*30+","+jt+","+Je+")"})}return oe},"bpmn:EscalationEventDefinition":function(C,_,y={},D){var I=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.5,my:.2}}),W=D?te(_,s,y.stroke):Ne(_,c,y.fill);return b(C,I,{fill:W,stroke:te(_,s,y.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(C,_,y={}){var D=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.5,my:.222}});return b(C,D,{fill:Ne(_,c,y.fill),stroke:te(_,s,y.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(C,_,y={},D){var I=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.57,my:.263}}),W=D?te(_,s,y.stroke):Ne(_,c,y.fill);return b(C,I,{fill:W,stroke:te(_,s,y.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(C,_,y={},D){var I=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.2,my:.722}}),W=D?te(_,s,y.stroke):Ne(_,c,y.fill);return b(C,I,{fill:W,stroke:te(_,s,y.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(C,_,y={},D){var I=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.638,my:-.055}}),W=D?te(_,s,y.stroke):"none",oe=b(C,I,{fill:W,stroke:te(_,s,y.stroke),strokeWidth:1});return Xh(oe,45),oe},"bpmn:CompensateEventDefinition":function(C,_,y={},D){var I=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.22,my:.5}}),W=D?te(_,s,y.stroke):Ne(_,c,y.fill);return b(C,I,{fill:W,stroke:te(_,s,y.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(C,_,y={},D){var I=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.5,my:.2}}),W=D?te(_,s,y.stroke):Ne(_,c,y.fill);return b(C,I,{strokeWidth:1,fill:W,stroke:te(_,s,y.stroke)})},"bpmn:MultipleEventDefinition":function(C,_,y={},D){var I=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.211,my:.36}}),W=D?te(_,s,y.stroke):Ne(_,c,y.fill);return b(C,I,{fill:W,stroke:te(_,s,y.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(C,_,y={}){var D=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.458,my:.194}});return b(C,D,{fill:Ne(_,c,y.fill),stroke:te(_,s,y.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(C,_,y={}){var D=m(C,_.width,_.height,8,{fill:te(_,s,y.stroke),stroke:te(_,s,y.stroke),strokeWidth:4});return D}};function F(C,_,y={},D){var I=Z(C),W=cS(I),oe=D||C;return I.get("eventDefinitions")&&I.get("eventDefinitions").length>1?I.get("parallelMultiple")?A["bpmn:ParallelMultipleEventDefinition"](_,oe,y,W):A["bpmn:MultipleEventDefinition"](_,oe,y,W):mi(I,"bpmn:MessageEventDefinition")?A["bpmn:MessageEventDefinition"](_,oe,y,W):mi(I,"bpmn:TimerEventDefinition")?A["bpmn:TimerEventDefinition"](_,oe,y,W):mi(I,"bpmn:ConditionalEventDefinition")?A["bpmn:ConditionalEventDefinition"](_,oe,y,W):mi(I,"bpmn:SignalEventDefinition")?A["bpmn:SignalEventDefinition"](_,oe,y,W):mi(I,"bpmn:EscalationEventDefinition")?A["bpmn:EscalationEventDefinition"](_,oe,y,W):mi(I,"bpmn:LinkEventDefinition")?A["bpmn:LinkEventDefinition"](_,oe,y,W):mi(I,"bpmn:ErrorEventDefinition")?A["bpmn:ErrorEventDefinition"](_,oe,y,W):mi(I,"bpmn:CancelEventDefinition")?A["bpmn:CancelEventDefinition"](_,oe,y,W):mi(I,"bpmn:CompensateEventDefinition")?A["bpmn:CompensateEventDefinition"](_,oe,y,W):mi(I,"bpmn:TerminateEventDefinition")?A["bpmn:TerminateEventDefinition"](_,oe,y,W):null}var H={ParticipantMultiplicityMarker:function(C,_,y={}){var D=zn(_,y),I=Pn(_,y),W=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:I,position:{mx:(D/2-6)/D,my:(I-15)/I}});E("participant-multiplicity",C,W,{strokeWidth:2,fill:Ne(_,c,y.fill),stroke:te(_,s,y.stroke)})},SubProcessMarker:function(C,_,y={}){var D=g(C,14,14,0,{strokeWidth:1,fill:Ne(_,c,y.fill),stroke:te(_,s,y.stroke)});Xt(D,_.width/2-7.5,_.height-20);var I=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2-7.5)/_.width,my:(_.height-20)/_.height}});E("sub-process",C,I,{fill:Ne(_,c,y.fill),stroke:te(_,s,y.stroke)})},ParallelMarker:function(C,_,y){var D=zn(_,y),I=Pn(_,y),W=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:I,position:{mx:(D/2+y.parallel)/D,my:(I-20)/I}});E("parallel",C,W,{fill:Ne(_,c,y.fill),stroke:te(_,s,y.stroke)})},SequentialMarker:function(C,_,y){var D=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2+y.seq)/_.width,my:(_.height-19)/_.height}});E("sequential",C,D,{fill:Ne(_,c,y.fill),stroke:te(_,s,y.stroke)})},CompensationMarker:function(C,_,y){var D=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2+y.compensation)/_.width,my:(_.height-13)/_.height}});E("compensation",C,D,{strokeWidth:1,fill:Ne(_,c,y.fill),stroke:te(_,s,y.stroke)})},LoopMarker:function(C,_,y){var D=zn(_,y),I=Pn(_,y),W=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:I,position:{mx:(D/2+y.loop)/D,my:(I-7)/I}});E("loop",C,W,{strokeWidth:1.5,fill:"none",stroke:te(_,s,y.stroke),strokeMiterlimit:.5})},AdhocMarker:function(C,_,y){var D=zn(_,y),I=Pn(_,y),W=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:I,position:{mx:(D/2+y.adhoc)/D,my:(I-15)/I}});E("adhoc",C,W,{strokeWidth:1,fill:te(_,s,y.stroke),stroke:te(_,s,y.stroke)})}};function N(C,_,y,D){H[C](_,y,D)}function V(C,_,y=[],D={}){D={fill:D.fill,stroke:D.stroke,width:zn(_,D),height:Pn(_,D)};var I=Z(_),W=y.includes("SubProcessMarker");W?D={...D,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:D={...D,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},I.get("isForCompensation")&&y.push("CompensationMarker"),v(I,"bpmn:AdHocSubProcess")&&(y.push("AdhocMarker"),W||O(D,{compensation:D.compensation-18}));var oe=I.get("loopCharacteristics"),Ae=oe&&oe.get("isSequential");oe&&(O(D,{compensation:D.compensation-18}),y.includes("AdhocMarker")&&O(D,{seq:-23,loop:-18,parallel:-24}),Ae===void 0&&y.push("LoopMarker"),Ae===!1&&y.push("ParallelMarker"),Ae===!0&&y.push("SequentialMarker")),y.includes("CompensationMarker")&&y.length===1&&O(D,{compensation:-8}),M(y,function(Ue){N(Ue,C,_,D)})}function pe(C,_,y={}){y=O({size:{width:100}},y);var D=o.createText(_||"",y);return Fe(D).add("djs-label"),Ce(C,D),D}function je(C,_,y,D={}){var I=Z(_),W=ia({x:_.x,y:_.y,width:_.width,height:_.height},D);return pe(C,I.name,{align:y,box:W,padding:7,style:{fill:na(_,u,s,D.stroke)}})}function lt(C,_,y={}){var D={width:_.width,height:_.height,x:_.width/2+_.x,y:_.height/2+_.y};return pe(C,Nn(_),{box:D,style:O({},o.getExternalStyle(),{fill:na(_,u,s,y.stroke)})})}function Y(C,_,y,D={}){var I=Gt(y),W=pe(C,_,{box:{height:30,width:I?Pn(y,D):zn(y,D)},align:"center-middle",style:{fill:na(y,u,s,D.stroke)}});if(I){var oe=-1*Pn(y,D);Ps(W,0,-oe,270)}}function fe(C,_,y={}){var{width:D,height:I}=ia(_,y);return g(C,D,I,Ds,{...y,fill:Ne(_,c,y.fill),fillOpacity:fo,stroke:te(_,s,y.stroke)})}function he(C,_,y={}){var D=Z(_),I=Ne(_,c,y.fill),W=te(_,s,y.stroke);return(D.get("associationDirection")==="One"||D.get("associationDirection")==="Both")&&(y.markerEnd=d(C,"association-end",I,W)),D.get("associationDirection")==="Both"&&(y.markerStart=d(C,"association-start",I,W)),y=Ve(y,["markerStart","markerEnd"]),x(C,_.waypoints,{...y,stroke:W,strokeDasharray:"0, 5"})}function se(C,_,y={}){var D=Ne(_,c,y.fill),I=te(_,s,y.stroke),W=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}}),oe=b(C,W,{fill:D,fillOpacity:fo,stroke:I}),Ae=Z(_);if(uS(Ae)){var Ue=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.33,my:(_.height-18)/_.height}});b(C,Ue,{strokeWidth:2,fill:D,stroke:I})}return oe}function ce(C,_,y={}){return m(C,_.width,_.height,{fillOpacity:fo,...y,fill:Ne(_,c,y.fill),stroke:te(_,s,y.stroke)})}function ee(C,_,y={}){return R(C,_.width,_.height,{fill:Ne(_,c,y.fill),fillOpacity:fo,stroke:te(_,s,y.stroke)})}function j(C,_,y={}){var D=g(C,zn(_,y),Pn(_,y),0,{fill:Ne(_,c,y.fill),fillOpacity:y.fillOpacity||fo,stroke:te(_,s,y.stroke),strokeWidth:1.5}),I=Z(_);if(v(I,"bpmn:Lane")){var W=I.get("name");Y(C,W,_,y)}return D}function $(C,_,y={}){var D=fe(C,_,y),I=$e(_);if(cn(_)&&(re(D,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!I)){var W=Z(_).flowElements||[],oe=W.filter(Ae=>v(Ae,"bpmn:StartEvent"));oe.length===1&&U(oe[0],C,y,_)}return je(C,_,I?"center-top":"center-middle",y),I?V(C,_,void 0,y):V(C,_,["SubProcessMarker"],y),D}function U(C,_,y,D){var I=22,W={fill:Ne(D,c,y.fill),stroke:te(D,s,y.stroke),width:I,height:I},oe=Z(C).isInterrupting,Ae=oe?0:3,Ue=oe?1:1.2,pt=20,Je=(I-pt)/2,jt="translate("+Je+","+Je+")";m(_,pt,pt,{fill:W.fill,stroke:W.stroke,strokeWidth:Ue,strokeDasharray:Ae,transform:jt}),F(C,_,W,D)}function ke(C,_,y={}){var D=fe(C,_,y);return je(C,_,"center-middle",y),V(C,_,void 0,y),D}var Dt=this.handlers={"bpmn:AdHocSubProcess":function(C,_,y={}){return $e(_)?y=Ve(y,["fill","stroke","width","height"]):y=Ve(y,["fill","stroke"]),$(C,_,y)},"bpmn:Association":function(C,_,y={}){return y=Ve(y,["fill","stroke"]),he(C,_,y)},"bpmn:BoundaryEvent":function(C,_,y={}){var{renderIcon:D=!0}=y;y=Ve(y,["fill","stroke"]);var I=Z(_),W=I.get("cancelActivity");y={strokeWidth:1.5,fill:Ne(_,c,y.fill),fillOpacity:gS,stroke:te(_,s,y.stroke)},W||(y.strokeDasharray="6");var oe=ce(C,_,y);return m(C,_.width,_.height,ks,{...y,fill:"none"}),D&&F(_,C,y),oe},"bpmn:BusinessRuleTask":function(C,_,y={}){y=Ve(y,["fill","stroke"]);var D=ke(C,_,y),I=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),W=b(C,I);re(W,{fill:Ne(_,c,y.fill),stroke:te(_,s,y.stroke),strokeWidth:1});var oe=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),Ae=b(C,oe);return re(Ae,{fill:te(_,s,y.stroke),stroke:te(_,s,y.stroke),strokeWidth:1}),D},"bpmn:CallActivity":function(C,_,y={}){return y=Ve(y,["fill","stroke"]),$(C,_,{strokeWidth:5,...y})},"bpmn:ComplexGateway":function(C,_,y={}){y=Ve(y,["fill","stroke"]);var D=ee(C,_,y),I=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:_.width,containerHeight:_.height,position:{mx:.46,my:.26}});return b(C,I,{fill:te(_,s,y.stroke),stroke:te(_,s,y.stroke),strokeWidth:1}),D},"bpmn:DataInput":function(C,_,y={}){y=Ve(y,["fill","stroke"]);var D=i.getRawPath("DATA_ARROW"),I=se(C,_,y);return b(C,D,{fill:"none",stroke:te(_,s,y.stroke),strokeWidth:1}),I},"bpmn:DataInputAssociation":function(C,_,y={}){return y=Ve(y,["fill","stroke"]),he(C,_,{...y,markerEnd:d(C,"association-end",Ne(_,c,y.fill),te(_,s,y.stroke))})},"bpmn:DataObject":function(C,_,y={}){return y=Ve(y,["fill","stroke"]),se(C,_,y)},"bpmn:DataObjectReference":L("bpmn:DataObject"),"bpmn:DataOutput":function(C,_,y={}){y=Ve(y,["fill","stroke"]);var D=i.getRawPath("DATA_ARROW"),I=se(C,_,y);return b(C,D,{strokeWidth:1,fill:te(_,s,y.stroke),stroke:te(_,s,y.stroke)}),I},"bpmn:DataOutputAssociation":function(C,_,y={}){return y=Ve(y,["fill","stroke"]),he(C,_,{...y,markerEnd:d(C,"association-end",Ne(_,c,y.fill),te(_,s,y.stroke))})},"bpmn:DataStoreReference":function(C,_,y={}){y=Ve(y,["fill","stroke"]);var D=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:0,my:.133}});return b(C,D,{fill:Ne(_,c,y.fill),fillOpacity:fo,stroke:te(_,s,y.stroke),strokeWidth:2})},"bpmn:EndEvent":function(C,_,y={}){var{renderIcon:D=!0}=y;y=Ve(y,["fill","stroke"]);var I=ce(C,_,{...y,strokeWidth:4});return D&&F(_,C,y),I},"bpmn:EventBasedGateway":function(C,_,y={}){y=Ve(y,["fill","stroke"]);var D=Z(_),I=ee(C,_,y);m(C,_.width,_.height,_.height*.2,{fill:Ne(_,"none",y.fill),stroke:te(_,s,y.stroke),strokeWidth:1});var W=D.get("eventGatewayType"),oe=!!D.get("instantiate");function Ae(){var pt=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:_.width,containerHeight:_.height,position:{mx:.36,my:.44}});b(C,pt,{fill:"none",stroke:te(_,s,y.stroke),strokeWidth:2})}if(W==="Parallel"){var Ue=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}});b(C,Ue,{fill:"none",stroke:te(_,s,y.stroke),strokeWidth:1})}else W==="Exclusive"&&(oe||m(C,_.width,_.height,_.height*.26,{fill:"none",stroke:te(_,s,y.stroke),strokeWidth:1}),Ae());return I},"bpmn:ExclusiveGateway":function(C,_,y={}){y=Ve(y,["fill","stroke"]);var D=ee(C,_,y),I=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:_.width,containerHeight:_.height,position:{mx:.32,my:.3}}),W=ze(_);return W.get("isMarkerVisible")&&b(C,I,{fill:te(_,s,y.stroke),stroke:te(_,s,y.stroke),strokeWidth:1}),D},"bpmn:Gateway":function(C,_,y={}){return y=Ve(y,["fill","stroke"]),ee(C,_,y)},"bpmn:Group":function(C,_,y={}){return y=Ve(y,["fill","stroke","width","height"]),g(C,_.width,_.height,Ds,{stroke:te(_,s,y.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:zn(_,y),height:Pn(_,y)})},"bpmn:InclusiveGateway":function(C,_,y={}){y=Ve(y,["fill","stroke"]);var D=ee(C,_,y);return m(C,_.width,_.height,_.height*.24,{fill:Ne(_,c,y.fill),stroke:te(_,s,y.stroke),strokeWidth:2.5}),D},"bpmn:IntermediateEvent":function(C,_,y={}){var{renderIcon:D=!0}=y;y=Ve(y,["fill","stroke"]);var I=ce(C,_,{...y,strokeWidth:1.5});return m(C,_.width,_.height,ks,{fill:"none",stroke:te(_,s,y.stroke),strokeWidth:1.5}),D&&F(_,C,y),I},"bpmn:IntermediateCatchEvent":L("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":L("bpmn:IntermediateEvent"),"bpmn:Lane":function(C,_,y={}){return y=Ve(y,["fill","stroke","width","height"]),j(C,_,{...y,fillOpacity:yS})},"bpmn:ManualTask":function(C,_,y={}){y=Ve(y,["fill","stroke"]);var D=ke(C,_,y),I=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return b(C,I,{fill:Ne(_,c,y.fill),stroke:te(_,s,y.stroke),strokeWidth:.5}),D},"bpmn:MessageFlow":function(C,_,y={}){y=Ve(y,["fill","stroke"]);var D=Z(_),I=ze(_),W=Ne(_,c,y.fill),oe=te(_,s,y.stroke),Ae=x(C,_.waypoints,{markerEnd:d(C,"messageflow-end",W,oe),markerStart:d(C,"messageflow-start",W,oe),stroke:oe,strokeDasharray:"10, 11",strokeWidth:1.5});if(D.get("messageRef")){var Ue=Ae.getPointAtLength(Ae.getTotalLength()/2),pt=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:Ue.x,y:Ue.y}}),Je={strokeWidth:1};I.get("messageVisibleKind")==="initiating"?(Je.fill=W,Je.stroke=oe):(Je.fill=oe,Je.stroke=W);var jt=b(C,pt,Je),Jt=D.get("messageRef"),en=Jt.get("name"),at=pe(C,en,{align:"center-top",fitBox:!0,style:{fill:oe}}),Ot=jt.getBBox(),hn=at.getBBox(),oi=Ue.x-hn.width/2,mn=Ue.y+Ot.height/2+dS;Ps(at,oi,mn,0)}return Ae},"bpmn:ParallelGateway":function(C,_,y={}){y=Ve(y,["fill","stroke"]);var D=ee(C,_,y),I=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:_.width,containerHeight:_.height,position:{mx:.46,my:.2}});return b(C,I,{fill:te(_,s,y.stroke),stroke:te(_,s,y.stroke),strokeWidth:1}),D},"bpmn:Participant":function(C,_,y={}){y=Ve(y,["fill","stroke","width","height"]);var D=j(C,_,y),I=$e(_),W=Gt(_),oe=Z(_),Ae=oe.get("name");if(I){var Ue=W?[{x:30,y:0},{x:30,y:Pn(_,y)}]:[{x:0,y:30},{x:zn(_,y),y:30}];w(C,Ue,{stroke:te(_,s,y.stroke),strokeWidth:hS}),Y(C,Ae,_,y)}else{var pt=ia(_,y);W||(pt.height=zn(_,y),pt.width=Pn(_,y));var Je=pe(C,Ae,{box:pt,align:"center-middle",style:{fill:na(_,u,s,y.stroke)}});if(!W){var jt=-1*Pn(_,y);Ps(Je,0,-jt,270)}}return oe.get("participantMultiplicity")&&N("ParticipantMultiplicityMarker",C,_,y),D},"bpmn:ReceiveTask":function(C,_,y={}){y=Ve(y,["fill","stroke"]);var D=Z(_),I=ke(C,_,y),W;return D.get("instantiate")?(m(C,28,28,20*.22,{fill:Ne(_,c,y.fill),stroke:te(_,s,y.stroke),strokeWidth:1}),W=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):W=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),b(C,W,{fill:Ne(_,c,y.fill),stroke:te(_,s,y.stroke),strokeWidth:1}),I},"bpmn:ScriptTask":function(C,_,y={}){y=Ve(y,["fill","stroke"]);var D=ke(C,_,y),I=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return b(C,I,{fill:Ne(_,c,y.fill),stroke:te(_,s,y.stroke),strokeWidth:1}),D},"bpmn:SendTask":function(C,_,y={}){y=Ve(y,["fill","stroke"]);var D=ke(C,_,y),I=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return b(C,I,{fill:te(_,s,y.stroke),stroke:Ne(_,c,y.fill),strokeWidth:1}),D},"bpmn:SequenceFlow":function(C,_,y={}){y=Ve(y,["fill","stroke"]);var D=Ne(_,c,y.fill),I=te(_,s,y.stroke),W=x(C,_.waypoints,{markerEnd:d(C,"sequenceflow-end",D,I),stroke:I}),oe=Z(_),{source:Ae}=_;if(Ae){var Ue=Z(Ae);oe.get("conditionExpression")&&v(Ue,"bpmn:Activity")&&re(W,{markerStart:d(C,"conditional-flow-marker",D,I)}),Ue.get("default")&&(v(Ue,"bpmn:Gateway")||v(Ue,"bpmn:Activity"))&&Ue.get("default")===oe&&re(W,{markerStart:d(C,"conditional-default-flow-marker",D,I)})}return W},"bpmn:ServiceTask":function(C,_,y={}){y=Ve(y,["fill","stroke"]);var D=ke(C,_,y);m(C,10,10,{fill:Ne(_,c,y.fill),stroke:"none",transform:"translate(6, 6)"});var I=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});b(C,I,{fill:Ne(_,c,y.fill),stroke:te(_,s,y.stroke),strokeWidth:1}),m(C,10,10,{fill:Ne(_,c,y.fill),stroke:"none",transform:"translate(11, 10)"});var W=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return b(C,W,{fill:Ne(_,c,y.fill),stroke:te(_,s,y.stroke),strokeWidth:1}),D},"bpmn:StartEvent":function(C,_,y={}){var{renderIcon:D=!0}=y;y=Ve(y,["fill","stroke"]);var I=Z(_);I.get("isInterrupting")||(y={...y,strokeDasharray:"6"});var W=ce(C,_,y);return D&&F(_,C,y),W},"bpmn:SubProcess":function(C,_,y={}){return $e(_)?y=Ve(y,["fill","stroke","width","height"]):y=Ve(y,["fill","stroke"]),$(C,_,y)},"bpmn:Task":function(C,_,y={}){return y=Ve(y,["fill","stroke"]),ke(C,_,y)},"bpmn:TextAnnotation":function(C,_,y={}){y=Ve(y,["fill","stroke"]);var{width:D,height:I}=ia(_,y),W=g(C,D,I,0,0,{fill:"none",stroke:"none"}),oe=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:I,position:{mx:0,my:0}});b(C,oe,{stroke:te(_,s,y.stroke)});var Ae=Z(_),Ue=Ae.get("text")||"";return pe(C,Ue,{align:"left-top",box:ia(_,y),padding:po,style:{fill:na(_,u,s,y.stroke)}}),W},"bpmn:Transaction":function(C,_,y={}){$e(_)?y=Ve(y,["fill","stroke","width","height"]):y=Ve(y,["fill","stroke"]);var D=$(C,_,{strokeWidth:1.5,...y}),I=n.style(["no-fill","no-events"],{stroke:te(_,s,y.stroke),strokeWidth:1.5}),W=$e(_);return W||(y={}),g(C,zn(_,y),Pn(_,y),Ds-ks,ks,I),D},"bpmn:UserTask":function(C,_,y={}){y=Ve(y,["fill","stroke"]);var D=ke(C,_,y),I=15,W=12,oe=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:I,y:W}});b(C,oe,{fill:Ne(_,c,y.fill),stroke:te(_,s,y.stroke),strokeWidth:.5});var Ae=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:I,y:W}});b(C,Ae,{fill:Ne(_,c,y.fill),stroke:te(_,s,y.stroke),strokeWidth:.5});var Ue=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:I,y:W}});return b(C,Ue,{fill:te(_,s,y.stroke),stroke:te(_,s,y.stroke),strokeWidth:.5}),D},label:function(C,_,y={}){return lt(C,_,y)}};this._drawPath=b,this._renderer=T}ie($r,Ai),$r.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],$r.prototype.canRender=function(e){return v(e,"bpmn:BaseElement")},$r.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},$r.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},$r.prototype.getShapePath=function(e){return Me(e)?pl(e,mS):v(e,"bpmn:Event")?am(e):v(e,"bpmn:Activity")?pl(e,Ds):v(e,"bpmn:Gateway")?lS(e):pS(e)};function Ve(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var vS=0,_S={width:150,height:50};function bS(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function xS(e){return Ht(e)?O({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var fl=null;function wS(){return fl||(fl=document.createElement("canvas").getContext("2d")),fl}function ES(e){var t=[];return e.fontStyle&&t.push(e.fontStyle),e.fontVariant&&t.push(e.fontVariant),e.fontWeight&&t.push(e.fontWeight),e.fontStretch&&t.push(e.fontStretch),t.push(sm(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function sm(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function SS(e,t){var n=wS();if(!n)return{width:0,height:0};n.font=ES(t),"letterSpacing"in n&&(n.letterSpacing=sm(t.letterSpacing)||"0px");var i=e==="",r=i?"dummy":e.replace(/\s+$/,""),o=n.measureText(r);return{width:i?0:o.width,height:"fontBoundingBoxAscent"in o?o.fontBoundingBoxAscent+o.fontBoundingBoxDescent:o.actualBoundingBoxAscent+o.actualBoundingBoxDescent}}function RS(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=SS(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return CS(e,r,i,o);r=AS(r,o.width,t)}}function CS(e,t,n,i){if(t.length<n.length){var r=n.slice(t.length).trim();e.unshift(r)}return{width:i.width,height:i.height,text:t}}var cm="";function PS(e,t){var n=e.split(/(\s|-|\u00AD)/g),i,r=[],o=0;if(n.length>1)for(;i=n.shift();)if(i.length+o<t)r.push(i),o+=i.length;else{(i==="-"||i===cm)&&r.pop();break}var a=r[r.length-1];return a&&a===cm&&(r[r.length-1]="-"),r.join("")}function AS(e,t,n){var i=Math.max(e.length*(n/t),1),r=PS(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function Os(e){this._config=O({},{size:_S,padding:vS,style:{},align:"center-top"},e||{})}Os.prototype.createText=function(e,t){return this.layoutText(e,t).element},Os.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Os.prototype.layoutText=function(e,t){for(var n=O({},this._config.size,t.box),i=O({},this._config.style,t.style),r=bS(t.align||this._config.align),o=xS(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,c=TS(i),s=e.split(/\u00AD?\r?\n/),u=[],l=n.width-o.left-o.right;s.length;)u.push(RS(s,l,i));r.vertical==="middle"&&(o.top=o.bottom=0);var p=En(u,function(g,R,w){return g+(c||R.height)},0)+o.top+o.bottom,f=En(u,function(g,R,w){return R.width>g?R.width:g},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-p)/2),d-=(c||u[0].height)/4;var h=me("text");re(h,i),M(u,function(g){var R;switch(d+=c||g.height,r.horizontal){case"left":R=o.left;break;case"right":R=(a?f:l)-o.right-g.width;break;default:R=Math.max(((a?f:l)-g.width)/2+o.left,0)}var w=me("tspan");re(w,{x:R,y:d}),w.textContent=g.text,Ce(h,w)});var m={width:f,height:p};return{dimensions:m,element:h}};function TS(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var MS=12,kS=1.2,DS=40;function um(e){var t=O({fontFamily:"Arial, sans-serif",fontSize:MS,fontWeight:"normal",lineHeight:kS},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=O({},t,{fontSize:n},e&&e.externalStyle||{}),r=new Os({style:t});this.getExternalLabelBounds=function(a,c){var s={width:Math.max(a.width,Br.width),height:30},u=o(c,s,{style:i});return{x:Math.round(a.x+a.width/2-u.width/2),y:a.y,width:Math.ceil(u.width),height:Math.ceil(u.height)}},this.getTextAnnotationBounds=function(a,c){var s=o(c,a,{style:t,align:"left-top",padding:po});return{x:a.x,y:a.y,width:a.width,height:Math.max(DS,Math.round(s.height))}},this.getDimensions=function(a,c){return r.getDimensions(a,c||{})};function o(a,c,s){return r.getDimensions(a,O({box:c},s))}this.createText=function(a,c){return r.createText(a,c||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}um.$inject=["config.textRenderer"];function OS(){this.pathMap={EVENT_MESSAGE:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:36,width:36,heightElements:[6,14],widthElements:[10.5,21]},EVENT_SIGNAL:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x1},0 Z",height:36,width:36,heightElements:[18],widthElements:[10,20]},EVENT_ESCALATION:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x0},-{e.y1} l -{e.x0},{e.y1} Z",height:36,width:36,heightElements:[20,7],widthElements:[8]},EVENT_CONDITIONAL:{d:"M {e.x0},{e.y0} l {e.x1},0 l 0,{e.y2} l -{e.x1},0 Z M {e.x2},{e.y3} l {e.x0},0 M {e.x2},{e.y4} l {e.x0},0 M {e.x2},{e.y5} l {e.x0},0 M {e.x2},{e.y6} l {e.x0},0 M {e.x2},{e.y7} l {e.x0},0 M {e.x2},{e.y8} l {e.x0},0 ",height:36,width:36,heightElements:[8.5,14.5,18,11.5,14.5,17.5,20.5,23.5,26.5],widthElements:[10.5,14.5,12.5]},EVENT_LINK:{d:"m {mx},{my} 0,{e.y0} -{e.x1},0 0,{e.y1} {e.x1},0 0,{e.y0} {e.x0},-{e.y2} -{e.x0},-{e.y2} z",height:36,width:36,heightElements:[4.4375,6.75,7.8125],widthElements:[9.84375,13.5]},EVENT_ERROR:{d:"m {mx},{my} {e.x0},-{e.y0} {e.x1},-{e.y1} {e.x2},{e.y2} {e.x3},-{e.y3} -{e.x4},{e.y4} -{e.x5},-{e.y5} z",height:36,width:36,heightElements:[.023,8.737,8.151,16.564,10.591,8.714],widthElements:[.085,6.672,6.97,4.273,5.337,6.636]},EVENT_CANCEL_45:{d:"m {mx},{my} -{e.x1},0 0,{e.x0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:36,width:36,heightElements:[4.75,8.5],widthElements:[4.75,8.5]},EVENT_COMPENSATION:{d:"m {mx},{my} {e.x0},-{e.y0} 0,{e.y1} z m {e.x1},-{e.y2} {e.x2},-{e.y3} 0,{e.y1} -{e.x2},-{e.y3} z",height:36,width:36,heightElements:[6.5,13,.4,6.1],widthElements:[9,9.3,8.7]},EVENT_TIMER_WH:{d:"M {mx},{my} l {e.x0},-{e.y0} m -{e.x0},{e.y0} l {e.x1},{e.y1} ",height:36,width:36,heightElements:[10,2],widthElements:[3,7]},EVENT_TIMER_LINE:{d:"M {mx},{my} m {e.x0},{e.y0} l -{e.x1},{e.y1} ",height:36,width:36,heightElements:[10,3],widthElements:[0,0]},EVENT_MULTIPLE:{d:"m {mx},{my} {e.x1},-{e.y0} {e.x1},{e.y0} -{e.x0},{e.y1} -{e.x2},0 z",height:36,width:36,heightElements:[6.28099,12.56199],widthElements:[3.1405,9.42149,12.56198]},EVENT_PARALLEL_MULTIPLE:{d:"m {mx},{my} {e.x0},0 0,{e.y1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} -{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z",height:36,width:36,heightElements:[2.56228,7.68683],widthElements:[2.56228,7.68683]},GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},GATEWAY_EVENT_BASED:{d:"m {mx},{my} {e.x0},{e.y0} {e.x0},{e.y1} {e.x1},{e.y2} {e.x2},0 z",height:11,width:11,heightElements:[-6,6,12,-12],widthElements:[9,-3,-12]},GATEWAY_COMPLEX:{d:"m {mx},{my} 0,{e.y0} -{e.x0},-{e.y1} -{e.x1},{e.y2} {e.x0},{e.y1} -{e.x2},0 0,{e.y3} {e.x2},0 -{e.x0},{e.y1} l {e.x1},{e.y2} {e.x0},-{e.y1} 0,{e.y0} {e.x3},0 0,-{e.y0} {e.x0},{e.y1} {e.x1},-{e.y2} -{e.x0},-{e.y1} {e.x2},0 0,-{e.y3} -{e.x2},0 {e.x0},-{e.y1} -{e.x1},-{e.y2} -{e.x0},{e.y1} 0,-{e.y0} -{e.x3},0 z",height:17.125,width:17.125,heightElements:[4.875,3.4375,2.125,3],widthElements:[3.4375,2.125,4.875,3]},DATA_OBJECT_PATH:{d:"m 0,0 {e.x1},0 {e.x0},{e.y0} 0,{e.y1} -{e.x2},0 0,-{e.y2} {e.x1},0 0,{e.y0} {e.x0},0",height:61,width:51,heightElements:[10,50,60],widthElements:[10,40,50,60]},DATA_OBJECT_COLLECTION_PATH:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},DATA_ARROW:{d:"m 5,9 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z",height:61,width:51,heightElements:[],widthElements:[]},DATA_STORE:{d:"m {mx},{my} l 0,{e.y2} c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 l 0,-{e.y2} c -{e.x0},-{e.y1} -{e.x1},-{e.y1} -{e.x2},0c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0",height:61,width:61,heightElements:[7,10,45],widthElements:[2,58,60]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_PARALLEL:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},MARKER_SEQUENTIAL:{d:"m{mx},{my} m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_COMPENSATION:{d:"m {mx},{my} 7,-5 0,10 z m 7.1,-0.3 6.9,-4.7 0,10 -6.9,-4.7 z",height:10,width:21,heightElements:[],widthElements:[]},MARKER_LOOP:{d:"m {mx},{my} c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 -6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902",height:13.9,width:13.7,heightElements:[],widthElements:[]},MARKER_ADHOC:{d:"m {mx},{my} m 0.84461,2.64411 c 1.05533,-1.23780996 2.64337,-2.07882 4.29653,-1.97997996 2.05163,0.0805 3.85579,1.15803 5.76082,1.79107 1.06385,0.34139996 2.24454,0.1438 3.18759,-0.43767 0.61743,-0.33642 1.2775,-0.64078 1.7542,-1.17511 0,0.56023 0,1.12046 0,1.6807 -0.98706,0.96237996 -2.29792,1.62393996 -3.6918,1.66181996 -1.24459,0.0927 -2.46671,-0.2491 -3.59505,-0.74812 -1.35789,-0.55965 -2.75133,-1.33436996 -4.27027,-1.18121996 -1.37741,0.14601 -2.41842,1.13685996 -3.44288,1.96782996 z",height:4,width:15,heightElements:[],widthElements:[]},TASK_TYPE_SEND:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:14,width:21,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"},TASK_TYPE_MANUAL:{d:"m {mx},{my} c 0.234,-0.01 5.604,0.008 8.029,0.004 0.808,0 1.271,-0.172 1.417,-0.752 0.227,-0.898 -0.334,-1.314 -1.338,-1.316 -2.467,-0.01 -7.886,-0.004 -8.108,-0.004 -0.014,-0.079 0.016,-0.533 0,-0.61 0.195,-0.042 8.507,0.006 9.616,0.002 0.877,-0.007 1.35,-0.438 1.353,-1.208 0.003,-0.768 -0.479,-1.09 -1.35,-1.091 -2.968,-0.002 -9.619,-0.013 -9.619,-0.013 v -0.591 c 0,0 5.052,-0.016 7.225,-0.016 0.888,-0.002 1.354,-0.416 1.351,-1.193 -0.006,-0.761 -0.492,-1.196 -1.361,-1.196 -3.473,-0.005 -10.86,-0.003 -11.0829995,-0.003 -0.022,-0.047 -0.045,-0.094 -0.069,-0.139 0.3939995,-0.319 2.0409995,-1.626 2.4149995,-2.017 0.469,-0.4870005 0.519,-1.1650005 0.162,-1.6040005 -0.414,-0.511 -0.973,-0.5 -1.48,-0.236 -1.4609995,0.764 -6.5999995,3.6430005 -7.7329995,4.2710005 -0.9,0.499 -1.516,1.253 -1.882,2.19 -0.37000002,0.95 -0.17,2.01 -0.166,2.979 0.004,0.718 -0.27300002,1.345 -0.055,2.063 0.629,2.087 2.425,3.312 4.859,3.318 4.6179995,0.014 9.2379995,-0.139 13.8569995,-0.158 0.755,-0.004 1.171,-0.301 1.182,-1.033 0.012,-0.754 -0.423,-0.969 -1.183,-0.973 -1.778,-0.01 -5.824,-0.004 -6.04,-0.004 10e-4,-0.084 0.003,-0.586 10e-4,-0.67 z"},TASK_TYPE_INSTANTIATING_SEND:{d:"m {mx},{my} l 0,8.4 l 12.6,0 l 0,-8.4 z l 6.3,3.6 l 6.3,-3.6"},TASK_TYPE_SERVICE:{d:"m {mx},{my} v -1.71335 c 0.352326,-0.0705 0.703932,-0.17838 1.047628,-0.32133 0.344416,-0.14465 0.665822,-0.32133 0.966377,-0.52145 l 1.19431,1.18005 1.567487,-1.57688 -1.195028,-1.18014 c 0.403376,-0.61394 0.683079,-1.29908 0.825447,-2.01824 l 1.622133,-0.01 v -2.2196 l -1.636514,0.01 c -0.07333,-0.35153 -0.178319,-0.70024 -0.323564,-1.04372 -0.145244,-0.34406 -0.321407,-0.6644 -0.522735,-0.96217 l 1.131035,-1.13631 -1.583305,-1.56293 -1.129598,1.13589 c -0.614052,-0.40108 -1.302883,-0.68093 -2.022633,-0.82247 l 0.0093,-1.61852 h -2.241173 l 0.0042,1.63124 c -0.353763,0.0736 -0.705369,0.17977 -1.049785,0.32371 -0.344415,0.14437 -0.665102,0.32092 -0.9635006,0.52046 l -1.1698628,-1.15823 -1.5667691,1.5792 1.1684265,1.15669 c -0.4026573,0.61283 -0.68308,1.29797 -0.8247287,2.01713 l -1.6588041,0.003 v 2.22174 l 1.6724648,-0.006 c 0.073327,0.35077 0.1797598,0.70243 0.3242851,1.04472 0.1452428,0.34448 0.3214064,0.6644 0.5227339,0.96066 l -1.1993431,1.19723 1.5840256,1.56011 1.1964668,-1.19348 c 0.6140517,0.40346 1.3028827,0.68232 2.0233517,0.82331 l 7.19e-4,1.69892 h 2.226848 z m 0.221462,-3.9957 c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_SERVICE_FILL:{d:"m {mx},{my} c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_BUSINESS_RULE_HEADER:{d:"m {mx},{my} 0,4 20,0 0,-4 z"},TASK_TYPE_BUSINESS_RULE_MAIN:{d:"m {mx},{my} 0,12 20,0 0,-12 zm 0,8 l 20,0 m -13,-4 l 0,8"},MESSAGE_FLOW_MARKER:{d:"m {mx},{my} m -10.5 ,-7 l 0,14 l 21,0 l 0,-14 z l 10.5,6 l 10.5,-6"}},this.getRawPath=function(t){return this.pathMap[t].d},this.getScaledPath=function(t,n){var i=this.pathMap[t],r,o;n.abspos?(r=n.abspos.x,o=n.abspos.y):(r=n.containerWidth*n.position.mx,o=n.containerHeight*n.position.my);var a={};if(n.position){for(var c=n.containerHeight/i.height*n.yScaleFactor,s=n.containerWidth/i.width*n.xScaleFactor,u=0;u<i.heightElements.length;u++)a["y"+u]=i.heightElements[u]*c;for(var l=0;l<i.widthElements.length;l++)a["x"+l]=i.widthElements[l]*s}var p=BS(i.d,{mx:r,my:o,e:a});return p}}var LS=/\{([^{}]+)\}/g,IS=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function NS(e,t,n){var i=n;return t.replace(IS,function(r,o,a,c,s){o=o||c,i&&(o in i&&(i=i[o]),typeof i=="function"&&s&&(i=i()))}),i=(i==null||i==n?e:i)+"",i}function BS(e,t){return String(e).replace(LS,function(n,i){return NS(n,i,t)})}const $S={__init__:["bpmnRenderer"],bpmnRenderer:["type",$r],textRenderer:["type",um],pathMap:["type",OS]};function jS(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const ra={translate:["value",jS]};function Ls(e,t,n){return O({id:e.id,type:e.$type,businessObject:e,di:t},n)}function FS(e,t,n){var i=e.waypoint;return!i||i.length<2?[_e(t),_e(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function lm(e,t,n){return new Error(`element ${sn(t)} referenced by ${sn(e)}#${n} not yet drawn`)}function Di(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}Di.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],Di.prototype.add=function(e,t,n){var i,r,o;if(v(t,"bpmndi:BPMNPlane")){var a=v(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(Ls(e,t,a)),this._canvas.addRootElement(i)}else if(v(t,"bpmndi:BPMNShape")){var c=!$e(e,t),s=zS(e);r=n&&(n.hidden||n.collapsed);var u=t.bounds;i=this._elementFactory.createShape(Ls(e,t,{collapsed:c,hidden:r,x:Math.round(u.x),y:Math.round(u.y),width:Math.round(u.width),height:Math.round(u.height),isFrame:s})),v(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),v(e,"bpmn:Lane")&&(o=0),v(e,"bpmn:DataStoreReference")&&(HS(n,_e(u))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else if(v(t,"bpmndi:BPMNEdge")){var l=this._getSource(e),p=this._getTarget(e);r=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(Ls(e,t,{hidden:r,source:l,target:p,waypoints:FS(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 ir(e)&&Nn(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},Di.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${sn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw lm(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},Di.prototype.addLabel=function(e,t,n){var i,r,o;return i=iS(t,n),r=Nn(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(Ls(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!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)},Di.prototype._getConnectedElement=function(e,t){var n,i,r=e.$type;if(i=e[t+"Ref"],t==="source"&&r==="bpmn:DataInputAssociation"&&(i=i&&i[0]),(t==="source"&&r==="bpmn:DataOutputAssociation"||t==="target"&&r==="bpmn:DataInputAssociation")&&(i=e.$parent),n=i&&this._getElement(i),n)return n;throw i?lm(e,i,t+"Ref"):new Error(`${sn(e)}#${t} Ref not specified`)},Di.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},Di.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},Di.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function HS(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 zS(e){return v(e,"bpmn:Group")}const pm={__depends__:[$S,{__depends__:[ra],bpmnImporter:["type",Di]}]};function oa(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function ii(e,t){return{x:e.x-t.x,y:e.y-t.y}}function dl(e){return Math.log(e)/Math.log(10)}var VS=1e3;function K(e){this._eventBus=e}K.$inject=["eventBus"];function GS(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}K.prototype.on=function(e,t,n,i,r,o){if((zt(t)||we(t))&&(o=r,r=i,i=n,n=t,t=null),zt(n)&&(o=r,r=i,i=n,n=VS),Ht(r)&&(o=r,r=!1),!zt(i))throw new Error("handlerFn must be a function");ve(e)||(e=[e]);var a=this._eventBus;M(e,function(c){var s=["commandStack",c,t].filter(function(u){return u}).join(".");a.on(s,n,r?GS(i,o):i,o)})},K.prototype.canExecute=Oi("canExecute"),K.prototype.preExecute=Oi("preExecute"),K.prototype.preExecuted=Oi("preExecuted"),K.prototype.execute=Oi("execute"),K.prototype.executed=Oi("executed"),K.prototype.postExecute=Oi("postExecute"),K.prototype.postExecuted=Oi("postExecuted"),K.prototype.revert=Oi("revert"),K.prototype.reverted=Oi("reverted");function Oi(e){return function(n,i,r,o,a){(zt(n)||we(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var hl=["top","bottom","left","right"],Is=10;function ml(e,t){K.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],function(r){var o=r.context,a=o.connection,c=a.source,s=a.target,u=o.hints||{};u.createElementsBehavior!==!1&&(n(c),n(s))}),this.postExecuted(["label.create"],function(r){var o=r.context,a=o.shape,c=o.hints||{};c.createElementsBehavior!==!1&&n(a.labelTarget)}),this.postExecuted(["elements.create"],function(r){var o=r.context,a=o.elements,c=o.hints||{};c.createElementsBehavior!==!1&&a.forEach(function(s){n(s)})});function n(r){if(Ms(r)&&!nt(r)){var o=YS(r);o&&i(r,o)}}function i(r,o){var a=_e(r),c=r.label,s=_e(c);if(c.parent){var u=ye(r),l;switch(o){case"top":l={x:a.x,y:u.top-Is-c.height/2};break;case"left":l={x:u.left-Is-c.width/2,y:a.y};break;case"bottom":l={x:a.x,y:u.bottom+Is+c.height/2};break;case"right":l={x:u.right+Is+c.width/2,y:a.y};break}var p=ii(l,s);t.moveShape(c,p)}}}ie(ml,K),ml.$inject=["eventBus","modeling"];function WS(e){var t=e.host,n=_e(e),i=Kt(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=hl.filter(function(a){return r.indexOf(a)===-1});return o}function US(e){var t=_e(e),n=[].concat(e.incoming.map(function(i){return i.waypoints[i.waypoints.length-2]}),e.outgoing.map(function(i){return i.waypoints[1]})).map(function(i){return fm(t,i)});return n}function YS(e){var t=_e(e.label),n=_e(e),i=fm(n,t);if(qS(i)){var r=US(e);if(e.host){var o=WS(e);r=r.concat(o)}var a=hl.filter(function(c){return r.indexOf(c)===-1});return a.indexOf(i)!==-1?Kt(e.label,e)!=="intersect"?void 0:i:a[0]}}function fm(e,t){return Kt(t,e,5)}function qS(e){return hl.indexOf(e)!==-1}function gl(e){K.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(v(i,"bpmn:TextAnnotation")?t.position={x:n.x+n.width/2+75,y:n.y-50-i.height/2}:t.position={x:n.x+n.width+80+i.width/2,y:n.y+n.height/2})},!0)}ie(gl,K),gl.$inject=["eventBus"];var KS=1500;function yl(e,t,n){e.invoke(K,this),this.preExecute("elements.delete",KS,function(r){var o=r.context,a=o.elements,c=i(a);c.length&&(o.elements=a.concat(c))}),t.on("shape.move.start",function(r){var o=r.context.shapes,a=i(o);a.length&&(r.context.shapes=o.concat(a))});function i(r){var o=Le(r,u=>v(u,"bpmn:Participant")||v(u,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),c=new Set(a.children.filter(u=>v(u,"bpmn:Artifact"))),s=new Set;return M(o,u=>{const l=new Set(Jr(ao(Array.from(c),Ct(u))));s=s.union(l),c=c.difference(l)}),Array.from(s)}}ie(yl,K),yl.$inject=["injector","eventBus","canvas"];function vl(e,t){e.invoke(K,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=Le(r.incoming.concat(r.outgoing),function(a){return v(a,"bpmn:Association")});M(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}ie(vl,K),vl.$inject=["injector","modeling"];function ho(e,t){for(xn(t)&&(t=[t]);e=e.parent;)if(De(e,t))return e;return null}function dm(e,t){var n=ho(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=ho(e,i),n)return Gt(n);if(De(e,i))return Gt(e);var r;for(r=Z(e);r&&!v(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find(function(a){var c=Z(a);return c&&c.get("processRef")===r});return o?Gt(o):!0}var hm=500;function Ns(e,t){t.invoke(K,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",hm,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return mm(o,a)}),r.length===1&&r.map(function(o){return r.indexOf(o)}).forEach(function(o){var a=r[o];i.elements[o]=n._replaceShape(r[o],a)})},!0),this.preExecute("elements.move",hm,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];mm(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}Ns.$inject=["bpmnReplace","injector"],ie(Ns,K),Ns.prototype._replaceShape=function(e,t){var n=XS(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function XS(e){var t=Z(e),n=t.eventDefinitions;return n&&n[0]}function mm(e,t){return!Me(e)&&De(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function _l(e,t){K.call(this,e);function n(i){return Le(i.attachers,function(r){return v(r,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var r=i.context.source,o=i.context.target,a=n(o);v(r,"bpmn:EventBasedGateway")&&v(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var r=i.context.oldSource,o=i.context.newSource;v(r,"bpmn:Gateway")&&v(o,"bpmn:EventBasedGateway")&&M(o.outgoing,function(a){var c=a.target,s=n(c);v(c,"bpmn:ReceiveTask")&&s.length>0&&t.removeElements(s)})})}_l.$inject=["eventBus","modeling"],ie(_l,K);function gm(e){return e.create("bpmn:Category")}function ZS(e){return e.create("bpmn:CategoryValue")}function ym(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=ZS(e)),n.$parent||(n.$parent=gm(e)),n}function QS(e,t,n){return wt(t.get("categoryValue"),e),e.$parent=t,wt(n.get("rootElements"),t),t.$parent=n,e}function JS(e){var t=e.$parent;return t&&(xt(t.get("categoryValue"),e),e.$parent=null),e}function eR(e){var t=e.$parent;return t&&(xt(t.get("rootElements"),e),e.$parent=null),e}var tR=500;function bl(e,t,n){n.invoke(K,this);function i(s){return t.filter(function(u){return v(u,"bpmn:Group")&&!u.labelTarget}).map(Z).filter(function(u){return u!==s})}function r(s,u){return i(u).some(function(l){return l.get("categoryValueRef")===s})}function o(s,u){return i(u).some(function(l){var p=l.get("categoryValueRef");return p&&p.$parent===s})}function a(s,u){s&&u&&QS(s,u,e.getDefinitions())}function c(s,u,l){u&&!o(u,l)&&eR(u),s&&!r(s,l)&&JS(s)}this.executed(["shape.create","label.create"],function(s){var u=s.labelTarget||s.shape;!v(u,"bpmn:Group")||u.labelTarget||a(s.categoryValue,s.category)},!0),this.reverted(["shape.create","label.create"],function(s){var u=s.labelTarget||s.shape;!v(u,"bpmn:Group")||u.labelTarget||c(s.categoryValue,s.category,Z(u))},!0),this.executed(["shape.move","shape.resize"],tR,function(s){a(s.categoryValue,s.category)},!0),this.reverted(["shape.move","shape.resize"],function(s){var u=s.shape;s.categoryValue&&c(s.categoryValue,s.category,Z(u))},!0),this.executed("group.updateRefs",function(s){vm(s).forEach(function(u){a(u.categoryValue,u.category)})},!0),this.reverted("group.updateRefs",function(s){vm(s).forEach(function(u){c(u.categoryValue,u.category,Z(u.groupShape))})},!0),this.executed("shape.delete",function(s){var u=s.shape;!v(u,"bpmn:Group")||u.labelTarget||c(s.categoryValue,s.category,Z(u))},!0),this.reverted("shape.delete",function(s){var u=s.shape;!v(u,"bpmn:Group")||u.labelTarget||a(s.categoryValue,s.category)},!0)}bl.$inject=["bpmnjs","elementRegistry","injector"],ie(bl,K);function vm(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function xl(e,t,n){K.call(this,e),this.preExecute("shape.replace",c,!0),this.postExecuted("shape.replace",s,!0),this.preExecute("connection.create",r,!0),this.postExecuted("connection.delete",i,!0),this.postExecuted("connection.reconnect",o,!0),this.postExecuted("element.updateProperties",a,!0);function i(g){const R=g.source,w=g.target;mo(R)&&aa(w)&&l(w)}function r(g){const R=g.connection,w=g.source,x=g.target;mo(w)&&Bs(x)&&(u(x),f(w,[R]))}function o(g){const R=g.newTarget,w=g.oldSource,x=g.oldTarget;if(x!==R){const b=w;aa(x)&&l(x),mo(b)&&Bs(R)&&u(R)}}function a(g){const{element:R}=g;aa(R)?(p(R),d(R)):Bs(R)&&h(R)}function c(g){const{newData:R,oldShape:w}=g;if(mo(g.oldShape)&&R.eventDefinitionType!=="bpmn:CompensateEventDefinition"||R.type!=="bpmn:BoundaryEvent"){const x=w.outgoing.find(({target:b})=>aa(b));x&&x.target&&(g._connectionTarget=x.target)}else if(!mo(g.oldShape)&&R.eventDefinitionType==="bpmn:CompensateEventDefinition"&&R.type==="bpmn:BoundaryEvent"){const x=w.outgoing.find(({target:b})=>Bs(b));x&&x.target&&(g._connectionTarget=x.target),m(w)}}function s(g){const{_connectionTarget:R,newShape:w}=g;R&&t.connect(w,R)}function u(g){t.updateProperties(g,{isForCompensation:!0})}function l(g){t.updateProperties(g,{isForCompensation:void 0})}function p(g){for(const R of g.incoming)n.canConnect(R.source,g)||t.removeConnection(R);for(const R of g.outgoing)n.canConnect(g,R.target)||t.removeConnection(R)}function f(g,R){g.outgoing.filter(b=>v(b,"bpmn:Association")).filter(b=>aa(b.target)&&!R.includes(b)).forEach(b=>t.removeConnection(b))}function d(g){const R=g.attachers.slice();R.length&&t.removeElements(R)}function h(g){const R=g.incoming.filter(w=>mo(w.source));t.removeElements(R)}function m(g){const R=g.outgoing.filter(w=>v(w,"bpmn:SequenceFlow"));t.removeElements(R)}}ie(xl,K),xl.$inject=["eventBus","modeling","bpmnRules"];function aa(e){const t=Z(e);return t&&t.get("isForCompensation")}function mo(e){return e&&v(e,"bpmn:BoundaryEvent")&&lo(e,"bpmn:CompensateEventDefinition")}function Bs(e){return e&&v(e,"bpmn:Activity")&&!cn(e)}function wl(e){e.invoke(K,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,r=n.shape;v(i,"bpmn:Lane")&&!v(r,"bpmn:Lane")&&(n.parent=ho(i,"bpmn:Participant"))})}wl.$inject=["injector"],ie(wl,K);function El(e,t){K.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,r=i.shape;if(v(r,"bpmn:DataObjectReference")&&r.type!=="label"){var o=t.create("bpmn:DataObject");o.isCollection=((a=r.businessObject.dataObjectRef)==null?void 0:a.isCollection)||!1,r.businessObject.dataObjectRef=o}})}El.$inject=["eventBus","bpmnFactory"],ie(El,K);var Sl=20,Rl=20,_m=30,$s=2e3;function Cl(e,t,n){K.call(this,t),t.on(["create.start","shape.move.start"],$s,function(r){var o=r.context,a=o.shape,c=e.getRootElement();if(!(!v(a,"bpmn:Participant")||!v(c,"bpmn:Process")||!c.children.length)){var s=c.children.filter(function(p){return!v(p,"bpmn:Group")&&!Me(p)&&!nt(p)});if(s.length){var u=Ct(s),l=nR(a,u);O(a,l),o.createConstraints=iR(a,u)}}}),t.on("create.start",$s,function(r){var o=r.context,a=o.shape,c=e.getRootElement(),s=e.getGraphics(c);function u(l){l.element=c,l.gfx=s}v(a,"bpmn:Participant")&&v(c,"bpmn:Process")&&(t.on("element.hover",$s,u),t.once("create.cleanup",function(){t.off("element.hover",u)}))});function i(){var r=e.getRootElement();return v(r,"bpmn:Collaboration")?r:n.makeCollaboration()}this.preExecute("elements.create",$s,function(r){var o=r.elements,a=r.parent,c=rR(o),s;c&&v(a,"bpmn:Process")&&(r.parent=i(),s=r.hints=r.hints||{},s.participant=c,s.process=a,s.processRef=Z(c).get("processRef"))},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;v(a,"bpmn:Participant")&&v(o,"bpmn:Process")&&(r.parent=i(),r.process=o,r.processRef=Z(a).get("processRef"))},!0),this.execute("shape.create",function(r){var o=r.hints||{},a=r.process||o.process,c=r.shape,s=o.participant;a&&(!s||c===s)&&Z(c).set("processRef",Z(a))},!0),this.revert("shape.create",function(r){var o=r.hints||{},a=r.process||o.process,c=r.processRef||o.processRef,s=r.shape,u=o.participant;a&&(!u||s===u)&&Z(s).set("processRef",c)},!0),this.postExecute("shape.create",function(r){var o=r.hints||{},a=r.process||r.hints.process,c=r.shape,s=o.participant;if(a){var u=a.children.slice();s?c===s&&n.moveElements(u,{x:0,y:0},s):n.moveElements(u,{x:0,y:0},c)}},!0)}Cl.$inject=["canvas","eventBus","modeling"],ie(Cl,K);function nR(e,t){t={width:t.width+Sl*2+_m,height:t.height+Rl*2};var n=Math.max(e.width,t.width),i=Math.max(e.height,t.height);return{x:-n/2,y:-i/2,width:n,height:i}}function iR(e,t){return t=ye(t),{bottom:t.top+e.height/2-Rl,left:t.right-e.width/2+Sl,top:t.bottom-e.height/2+Rl,right:t.left+e.width/2-Sl-_m}}function rR(e){return ot(e,function(t){return v(t,"bpmn:Participant")})}var bm="__targetRef_placeholder";function Pl(e,t){K.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],xm(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],xm(o));function n(a,c,s){var u=a.get("dataInputAssociations");return ot(u,function(l){return l!==s&&l.targetRef===c})}function i(a,c){var s=a.get("properties"),u=ot(s,function(l){return l.name===bm});return!u&&c&&(u=t.create("bpmn:Property",{name:bm}),wt(s,u)),u}function r(a,c){var s=i(a);s&&(n(a,s,c)||xt(a.get("properties"),s))}function o(a){var c=a.context,s=c.connection,u=s.businessObject,l=s.target,p=l&&l.businessObject,f=c.newTarget,d=f&&f.businessObject,h=c.oldTarget||c.target,m=h&&h.businessObject,g=s.businessObject,R;m&&m!==p&&r(m,u),d&&d!==p&&r(d,u),p?(R=i(p,!0),g.targetRef=R):g.targetRef=null}}Pl.$inject=["eventBus","bpmnFactory"],ie(Pl,K);function xm(e){return function(t){var n=t.context,i=n.connection;if(v(i,"bpmn:DataInputAssociation"))return e(t)}}function js(e){this._bpmnUpdater=e}js.$inject=["bpmnUpdater"],js.prototype.execute=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.newSemanticParent,r=e.newDiParent;return e.oldSemanticParent=t.$parent,e.oldDiParent=n.$parent,this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,r),[]},js.prototype.revert=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.oldSemanticParent,r=e.oldDiParent;return this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,r),[]};function Al(e,t,n,i){K.call(this,i),t.registerHandler("dataStore.updateContainment",js);function r(){return n.filter(function(c){return v(c,"bpmn:Participant")&&Z(c).processRef})[0]}function o(c){return c.children.filter(function(s){return v(s,"bpmn:DataStoreReference")&&!s.labelTarget})}function a(c,s){var u=c.businessObject||c;if(s=s||r(),s){var l=s.businessObject||s;t.execute("dataStore.updateContainment",{dataStoreBo:u,dataStoreDi:ze(c),newSemanticParent:l.processRef||l,newDiParent:ze(s)})}}this.preExecute("shape.create",function(c){var s=c.context,u=s.shape;v(u,"bpmn:DataStoreReference")&&u.type!=="label"&&(s.hints||(s.hints={}),s.hints.autoResize=!1)}),this.preExecute("elements.move",function(c){var s=c.context,u=s.shapes,l=u.filter(function(p){return v(p,"bpmn:DataStoreReference")});l.length&&(s.hints||(s.hints={}),s.hints.autoResize=u.filter(function(p){return!v(p,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(c){var s=c.context,u=s.shape,l=u.parent;v(u,"bpmn:DataStoreReference")&&u.type!=="label"&&v(l,"bpmn:Collaboration")&&a(u)}),this.postExecute("shape.move",function(c){var s=c.context,u=s.shape,l=s.oldParent,p=u.parent;if(!v(l,"bpmn:Collaboration")&&v(u,"bpmn:DataStoreReference")&&u.type!=="label"&&v(p,"bpmn:Collaboration")){var f=v(l,"bpmn:Participant")?l:aR(l,"bpmn:Participant");a(u,f)}}),this.postExecute("shape.delete",function(c){var s=c.context,u=s.shape,l=e.getRootElement();De(u,["bpmn:Participant","bpmn:SubProcess"])&&v(l,"bpmn:Collaboration")&&o(l).filter(function(p){return oR(p,u)}).forEach(function(p){a(p)})}),this.postExecute("canvas.updateRoot",function(c){var s=c.context,u=s.oldRoot,l=s.newRoot,p=o(u);p.forEach(function(f){v(l,"bpmn:Process")&&a(f,l)})})}Al.$inject=["canvas","commandStack","elementRegistry","eventBus"],ie(Al,K);function oR(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 aR(e,t){for(;e.parent;){if(v(e.parent,t))return e.parent;e=e.parent}}var Fs=Math.max,Hs=Math.min,sR=20;function wm(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function cR(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 uR(e,t){return{x:e.x+(t.left||0),y:e.y+(t.top||0),width:e.width-(t.left||0)+(t.right||0),height:e.height-(t.top||0)+(t.bottom||0)}}function zs(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return we(r)&&(i=(/top|left/.test(e)?Hs:Fs)(i,r)),we(o)&&(i=(/top|left/.test(e)?Fs:Hs)(i,o)),i}function lR(e,t){if(!t)return e;var n=ye(e);return Ss({top:zs("top",n,t),right:zs("right",n,t),bottom:zs("bottom",n,t),left:zs("left",n,t)})}function pR(e,t,n,i){var r=ye(t),o={top:/n/.test(e)?r.bottom-n.height:r.top,left:/w/.test(e)?r.right-n.width:r.left,bottom:/s/.test(e)?r.top+n.height:r.bottom,right:/e/.test(e)?r.left+n.width:r.right},a=i?ye(i):o,c={top:Hs(o.top,a.top),left:Hs(o.left,a.left),bottom:Fs(o.bottom,a.bottom),right:Fs(o.right,a.right)};return Ss(c)}function sa(e,t){return typeof e<"u"?e:sR}function fR(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 dR(e){return!(e.waypoints||e.type==="label")}function Em(e,t){var n;if(e.length===void 0?n=Le(e.children,dR):n=e,n.length)return fR(Ct(n),t)}var rr=Math.abs;function hR(e,t){return wm(ye(t),ye(e))}var mR=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Vn=30;function Vs(e,t){return t=t||[],e.children.filter(function(n){v(n,"bpmn:Lane")&&(Vs(n,t),t.push(n))}),t}function or(e){return e.children.filter(function(t){return v(t,"bpmn:Lane")})}function Gn(e){return ho(e,mR)||e}function gR(e,t){var n=Gn(e),i=v(n,"bpmn:Process")?[]:[n],r=Vs(n,i),o=ye(e),a=ye(t),c=hR(e,t),s=[],u=Gt(e);return r.forEach(function(l){if(l!==e){var p=u?0:c.top,f=u?c.right:0,d=u?0:c.bottom,h=u?c.left:0,m=ye(l);c.top&&(rr(m.bottom-o.top)<10&&(d=a.top-m.bottom),rr(m.top-o.top)<5&&(p=a.top-m.top)),c.left&&(rr(m.right-o.left)<10&&(f=a.left-m.right),rr(m.left-o.left)<5&&(h=a.left-m.left)),c.bottom&&(rr(m.top-o.bottom)<10&&(p=a.bottom-m.top),rr(m.bottom-o.bottom)<5&&(d=a.bottom-m.bottom)),c.right&&(rr(m.left-o.right)<10&&(h=a.right-m.left),rr(m.right-o.right)<5&&(f=a.right-m.right)),(p||f||d||h)&&s.push({shape:l,newBounds:uR(l,{top:p,right:f,bottom:d,left:h})})}}),s}var yR=500;function Tl(e,t){K.call(this,e);function n(i,r){var o=Gt(i),a=or(r),c=[],s=[],u=[],l=[];if(Ir(a,function(g){return o?g.y>i.y?s.push(g):c.push(g):g.x>i.x?l.push(g):u.push(g),g.children}),!!a.length){var p;o?s.length&&c.length?p=i.height/2:p=i.height:l.length&&u.length?p=i.width/2:p=i.width;var f,d,h,m;c.length&&(f=t.calculateAdjustments(c,"y",p,i.y-10),t.makeSpace(f.movingShapes,f.resizingShapes,{x:0,y:p},"s")),s.length&&(d=t.calculateAdjustments(s,"y",-p,i.y+i.height+10),t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:-p},"n")),u.length&&(h=t.calculateAdjustments(u,"x",p,i.x-10),t.makeSpace(h.movingShapes,h.resizingShapes,{x:p,y:0},"e")),l.length&&(m=t.calculateAdjustments(l,"x",-p,i.x+i.width+10),t.makeSpace(m.movingShapes,m.resizingShapes,{x:-p,y:0},"w"))}}this.postExecuted("shape.delete",yR,function(i){var r=i.context,o=r.hints,a=r.shape,c=r.oldParent;v(a,"bpmn:Lane")&&(o&&o.nested||n(a,c))})}Tl.$inject=["eventBus","spaceTool"],ie(Tl,K);var Sm=500;function Gs(e,t){t.invoke(K,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Sm,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return Rm(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",Sm,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,c){var s=a.host;Rm(a,_R(r,s)?s:o)&&(r[c]=n._replaceShape(a))})},!0)}Gs.$inject=["bpmnReplace","injector"],ie(Gs,K),Gs.prototype._replaceShape=function(e){var t=vR(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function vR(e){var t=Z(e),n=t.eventDefinitions;return n&&n[0]}function Rm(e,t){return!Me(e)&&v(e,"bpmn:BoundaryEvent")&&!t}function _R(e,t){return e.indexOf(t)!==-1}var Ws=Math.round,bR=Math.max;function xR(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 wR(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var Cm=10;function ER(e,t){var n,i;for(n=0;i=e[n];n++)if(Zo(i,t)<=Cm)return{point:e[n],bendpoint:!0,index:n};return null}function SR(e,t){var n=kh(xR(t,Cm),wR(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=bR(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:Ws(i.x+r.x)/2,y:Ws(i.y+r.y)/2},index:i.segment2}:{point:{x:Ws(i.x),y:Ws(i.y)},index:i.segment2}:null}function Ml(e,t){return ER(e,t)||SR(e,t)}function kl(e,t,n){K.call(this,e);function i(r,o,a){var c=o.waypoints,s,u,l,p,f,d,h,m=r.outgoing.slice(),g=r.incoming.slice(),R;we(a.width)?R=_e(a):R=a;var w=Ml(c,R);if(w){if(s=c.slice(0,w.index),u=c.slice(w.index+(w.bendpoint?1:0)),!s.length||!u.length)return;l=w.bendpoint?c[w.index]:R,(s.length===1||!Pm(r,s[s.length-1]))&&s.push(Am(l)),(u.length===1||!Pm(r,u[0]))&&u.unshift(Am(l))}p=o.source,f=o.target,t.canConnect(p,r,o)&&(n.reconnectEnd(o,r,s||R),d=o),t.canConnect(r,f,o)&&(d?h=n.connect(r,f,{type:o.type,waypoints:u}):(n.reconnectStart(o,r,u||R),h=o));var x=[].concat(d&&Le(g,function(b){return b.source===d.source})||[],h&&Le(m,function(b){return b.target===h.target})||[]);x.length&&n.removeElements(x)}this.preExecute("elements.move",function(r){var o=r.newParent,a=r.shapes,c=r.delta,s=a[0];if(!(!s||!o)){o&&o.waypoints&&(r.newParent=o=o.parent);var u=_e(s),l={x:u.x+c.x,y:u.y+c.y},p=ot(o.children,function(f){var d=t.canInsert(a,f);return d&&Ml(f.waypoints,l)});p&&(r.targetFlow=p,r.position=l)}},!0),this.postExecuted("elements.move",function(r){var o=r.shapes,a=r.targetFlow,c=r.position;a&&i(o[0],a,c)},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;t.canInsert(a,o)&&(r.targetFlow=o,r.parent=o.parent)},!0),this.postExecuted("shape.create",function(r){var o=r.shape,a=r.targetFlow,c=r.position;a&&i(o,a,c)},!0)}ie(kl,K),kl.$inject=["eventBus","bpmnRules","modeling"];function Pm(e,t){var n=t.x,i=t.y;return n>=e.x&&n<=e.x+e.width&&i>=e.y&&i<=e.y+e.height}function Am(e){return O({},e)}function Dl(e,t){K.call(this,e),this.preExecuted("connection.create",function(n){var i=n.context,r=i.connection,o=i.source,a=i.target,c=i.hints;if(!(c&&c.createElementsBehavior===!1)&&go(r)){var s=[];v(o,"bpmn:EventBasedGateway")?s=a.incoming.filter(u=>u!==r&&go(u)):s=a.incoming.filter(u=>u!==r&&go(u)&&v(u.source,"bpmn:EventBasedGateway")),s.forEach(function(u){t.removeConnection(u)})}}),this.preExecuted("shape.replace",function(n){var i=n.context,r=i.newShape;if(v(r,"bpmn:EventBasedGateway")){var o=r.outgoing.filter(go).reduce(function(a,c){return a.includes(c.target)?a:a.concat(c.target)},[]);o.forEach(function(a){a.incoming.filter(go).forEach(function(c){const s=a.incoming.filter(go).filter(function(u){return u.source===r});(c.source!==r||s.length>1)&&t.removeConnection(c)})})}})}Dl.$inject=["eventBus","modeling"],ie(Dl,K);function go(e){return v(e,"bpmn:SequenceFlow")}var Us=1500,Tm=2e3;function Mm(e,t,n){t.on(["create.hover","create.move","create.out","create.end","shape.move.hover","shape.move.move","shape.move.out","shape.move.end"],Us,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;v(a,"bpmn:Lane")&&!De(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Gn(a),i.hoverGfx=e.getGraphics(i.hover));var c=n.getRootElement();a&&a!==c&&(o.labelTarget||De(o,["bpmn:Group","bpmn:TextAnnotation"]))&&(i.hover=c,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.hover","connect.out","connect.end","connect.cleanup","global-connect.hover","global-connect.out","global-connect.end","global-connect.cleanup"],Us,function(i){var r=i.hover;v(r,"bpmn:Lane")&&(i.hover=Gn(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Us,function(i){var r=i.context,o=i.hover,a=r.type;v(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Gn(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Us,function(i){var r=i.context,o=r.start;v(o,"bpmn:Lane")&&(r.start=Gn(o)||o)}),t.on("shape.move.start",Tm,function(i){var r=i.shape;v(r,"bpmn:Lane")&&(i.shape=Gn(r)||r)}),t.on("spaceTool.move",Tm,function(i){var r=i.hover;r&&v(r,"bpmn:Lane")&&(i.hover=Gn(r))})}Mm.$inject=["elementRegistry","eventBus","canvas"];var km=770;function Ol(e,t,n,i){n.invoke(K,this);function r(c,s){var u=Z(c),l=s.categoryValue||u.categoryValueRef;l||(l=ym(e,u));var p=s.category||l.$parent||gm(e);u.categoryValueRef=l,l.$parent=p,s.categoryValue=l,s.category=p}function o(c,s){var u=Z(c),l=s.categoryValue||u.categoryValueRef,p=s.category||l&&l.$parent;l&&(s.categoryValue=l,s.category=p,u.categoryValueRef=null)}this.execute("label.create",function(c){var s=c.context,u=s.labelTarget;v(u,"bpmn:Group")&&r(u,s)}),this.revert("label.create",function(c){var s=c.context,u=s.labelTarget;v(u,"bpmn:Group")&&o(u,s)}),this.execute("shape.delete",function(c){var s=c.context,u=s.shape,l=Z(u);if(!(!v(u,"bpmn:Group")||u.labelTarget)){var p=s.categoryValue=l.categoryValueRef;p&&(s.category=p.$parent,l.categoryValueRef=null)}}),this.reverted("shape.delete",function(c){var s=c.context,u=s.shape;if(!(!v(u,"bpmn:Group")||u.labelTarget)){var l=s.category,p=s.categoryValue,f=Z(u);p&&(f.categoryValueRef=p,p.$parent=l)}}),this.execute("shape.create",function(c){var s=c.context,u=s.shape,l=s.hints||{};!v(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!Z(u).categoryValueRef&&!s.categoryValue||r(u,s)}),this.reverted("shape.create",function(c){var s=c.context,u=s.shape,l=s.hints||{};!v(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!Z(u).categoryValueRef&&!s.categoryValue||o(u,s)}),this.executed(["shape.move","shape.resize"],function(c){var s=c.context,u=s.shape;!v(u,"bpmn:Group")||u.labelTarget||Z(u).categoryValueRef||r(u,s)}),this.reverted(["shape.move","shape.resize"],function(c){var s=c.context,u=s.shape;!v(u,"bpmn:Group")||u.labelTarget||!s.categoryValue||o(u,s)});function a(c,s){var u=e.create(c.$type);return i.copyElement(c,u,null,s)}t.on("copyPaste.copyElement",km,function(c){var s=c.descriptor,u=c.element;if(!(!v(u,"bpmn:Group")||u.labelTarget)){var l=Z(u);if(l.categoryValueRef){var p=l.categoryValueRef;s.categoryValue=a(p,!0),p.$parent&&(s.category=a(p.$parent,!0))}}}),t.on("copyPaste.pasteElement",km,function(c){var s=c.descriptor,u=s.businessObject,l=s.categoryValue,p=s.category;l&&(l=u.categoryValueRef=a(l)),p&&(l.$parent=a(p)),delete s.category,delete s.categoryValue})}Ol.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],ie(Ol,K);function Ll(e,t,n,i){var r,o,a,c,s;return r=(i.y-n.y)*(t.x-e.x)-(i.x-n.x)*(t.y-e.y),r==0?null:(o=e.y-n.y,a=e.x-n.x,s=(i.x-n.x)*o-(i.y-n.y)*a,c=s/r,{x:Math.round(e.x+c*(t.x-e.x)),y:Math.round(e.y+c*(t.y-e.y))})}function Dm(e){function t(i,r,o){var a={x:o.x,y:o.y-50},c={x:o.x-50,y:o.y},s=Ll(i,r,o,a),u=Ll(i,r,o,c),l;s&&u?Om(s,o)>Om(u,o)?l=u:l=s:l=s||u,i.original=l}function n(i){var r=i.waypoints;t(r[0],r[1],_e(i.source)),t(r[r.length-1],r[r.length-2],_e(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}Dm.$inject=["eventBus"];function Om(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Il(e){K.call(this,e);var t=["bpmn:Participant","bpmn:Lane"];this.executed(["shape.move","shape.create","shape.resize"],function(n){var i=n.context.shape,r=Z(i),o=ze(i);if(De(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}Il.$inject=["eventBus"],ie(Il,K);function Lm(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Im(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function RR(e,t){return t?{x:Math.cos(t)*e.x-Math.sin(t)*e.y,y:Math.sin(t)*e.x+Math.cos(t)*e.y}:e}function CR(e,t,n){var i=[{n:e[0]-n[0],lambda:t[0]},{n:e[1]-n[1],lambda:t[1]}],r=i[0].n*t[0]+i[1].n*t[1],o=i[0].lambda*t[0]+i[1].lambda*t[1];return-r/o}function Nl(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=CR([n.x,n.y],[r.x,r.y],[e.x,e.y]);return{x:n.x+o*r.x,y:n.y+o*r.y}}function Nm(e,t){var n=Nl(e,t),i={x:n.x-e.x,y:n.y-e.y};return Lm(i)}function ca(e,t){return Lm({x:e.x-t.x,y:e.y-t.y})}var Bm=Math.sqrt,$m=Math.min,PR=Math.max,jm=Math.abs;function Fm(e){return Math.pow(e,2)}function ua(e,t){return Bm(Fm(e.x-t.x)+Fm(e.y-t.y))}function AR(e,t){var n=0,i,r,o,a,c,s,u,l,p,f,d;for(n=0;n<t.length-1;n++){if(i=t[n],r=t[n+1],zm(i,r)?u=[i]:(o=ua(e,i),a=ua(e,r),s=$m(o,a),u=TR(i,r,e,s)),u.length<1)throw new Error("expected between [1, 2] circle -> line intersections");u.length===1&&(l={type:"bendpoint",position:u[0],segmentIndex:n,bendpointIndex:zm(i,u[0])?n:n+1}),u.length===2&&(c=kR(u[0],u[1]),l={type:"segment",position:c,segmentIndex:n,relativeLocation:ua(i,c)/ua(i,r)}),p=ua(l.position,e),(!d||f>p)&&(d=l,f=p)}return d}function TR(e,t,n,i){var r=t.x-e.x,o=t.y-e.y,a=n.x-e.x,c=n.y-e.y,s=r*r+o*o,u=r*a+o*c,l=a*a+c*c-i*i,p=u/s,f=l/s,d=p*p-f;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var h=Bm(d),m=-p+h,g=-p-h,R={x:e.x-r*m,y:e.y-o*m};if(d===0)return[R];var w={x:e.x-r*g,y:e.y-o*g};return[R,w].filter(function(x){return MR(x,e,t)})}function MR(e,t,n){return Hm(e.x,t.x,n.x)&&Hm(e.y,t.y,n.y)}function Hm(e,t,n){return e>=$m(t,n)-Ys&&e<=PR(t,n)+Ys}function kR(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Ys=.1;function zm(e,t){return jm(e.x-t.x)<=Ys&&jm(e.y-t.y)<=Ys}function DR(e,t,n,i){var r=n.segmentIndex,o=t.length-e.length;if(i.segmentMove){var a=i.segmentMove.segmentStartIndex,c=i.segmentMove.newSegmentStartIndex;return r===a?c:r>=c?r+o<c?c:r+o:r}if(i.bendpointMove){var s=i.bendpointMove.insert,u=i.bendpointMove.bendpointIndex,l;if(o===0)return r;if(r>=u&&(l=s?r+1:r-1),r<u&&(l=r,s&&n.type!=="bendpoint"&&u-1===r)){var p=Gm(t,u);p<n.relativeLocation&&l++}return l}return o===0?r:i.connectionStart&&r===0?0:i.connectionEnd&&r===e.length-2?t.length-2:Math.floor((t.length-2)/2)}function Vm(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},c=AR(e,n),s=c.segmentIndex,u=DR(n,t,c,i);if(u<0||u>t.length-2||u===null)return a;var l=Wm(n,s),p=Wm(t,u),f=c.position,d=LR(l,f),h=OR(l,p);if(c.type==="bendpoint"){var m=t.length-n.length,g=c.bendpointIndex,R=n[g];if(t.indexOf(R)!==-1)return a;if(m===0){var w=t[g];return r=w.x-c.position.x,o=w.y-c.position.y,{delta:{x:r,y:o},point:{x:e.x+r,y:e.y+o}}}m<0&&g!==0&&g<n.length-1&&(d=Gm(n,g))}var x={x:(p[1].x-p[0].x)*d+p[0].x,y:(p[1].y-p[0].y)*d+p[0].y},b=RR({x:e.x-f.x,y:e.y-f.y},h);return r=x.x+b.x-e.x,o=x.y+b.y-e.y,{point:Mi(x),delta:Mi({x:r,y:o})}}function Gm(e,t){var n=ca(e[t-1],e[t]),i=ca(e[t],e[t+1]),r=n/(n+i);return r}function OR(e,t){var n=Im(e),i=Im(t);return i-n}function Wm(e,t){return[e[t],e[t+1]]}function LR(e,t){var n=ca(e[0],e[1]),i=ca(e[0],t);return n===0?0:i/n}function IR(e,t,n,i){var r=_e(e);return Vm(r,t,n,i).delta}function la(e,t,n){var i=oa(t),r=oa(n),o=ii(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return Mi({x:r.x+a.x,y:r.y+a.y})}function Um(e,t,n){var i=oa(e),r=oa(t),o=oa(n),a=ii(e,i),c=ii(i,r),s=NR(i,t,n);if(s)return s;var u={x:c.x*(n.width/t.width),y:c.y*(n.height/t.height)},l={x:o.x+u.x,y:o.y+u.y};return Mi({x:l.x+a.x-e.x,y:l.y+a.y-e.y})}function NR(e,t,n){var i=ye(t),r=ye(n);if(BR(i,r))return null;var o=Kt(t,e),a,c,s;if(o==="top")a={x:0,y:r.bottom-i.bottom};else if(o==="bottom")a={x:0,y:r.top-i.top};else if(o==="right")a={x:r.left-i.left,y:0};else if(o==="left")a={x:r.right-i.right,y:0};else return null;return c={x:e.x+a.x,y:e.y+a.y},s=Kt(n,c),s!==o?null:a}function BR(e,t){return $R(e,t)||jR(e,t)}function $R(e,t){return e.right!==t.right&&e.left!==t.left}function jR(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var Ym="name",qm="text";function Bl(e,t,n,i){K.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{Z(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var c=a.context,s=c.element,u=c.properties;if(Ym in u&&t.updateLabel(s,u[Ym]),qm in u&&v(s,"bpmn:TextAnnotation")){var l=i.getTextAnnotationBounds({x:s.x,y:s.y,width:s.width,height:s.height},u[qm]||"");t.updateLabel(s,u.text,l)}}this.postExecute(["shape.create","connection.create"],function(a){var c=a.context,s=c.hints||{};if(s.createElementsBehavior!==!1){var u=c.shape||c.connection;Me(u)||!ir(u)||Nn(u)&&t.updateLabel(u,Nn(u))}}),this.postExecute("shape.delete",function(a){var c=a.context,s=c.labelTarget,u=c.hints||{};s&&u.unsetLabel!==!1&&t.updateLabel(s,null,null,{removeShape:!1})});function o(a){var c=a.context,s=c.connection,u=s.label,l=O({},c.hints),p=c.newWaypoints||s.waypoints,f=c.oldWaypoints;return typeof l.startChanged>"u"&&(l.startChanged=!!l.connectionStart),typeof l.endChanged>"u"&&(l.endChanged=!!l.connectionEnd),IR(u,p,f,l)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(a){var c=a.context,s=c.hints||{};if(s.labelBehavior!==!1){var u=c.connection,l=u.label,p;!l||!l.parent||(p=o(a),t.moveShape(l,p))}}),this.postExecute(["shape.replace"],function(a){var c=a.context,s=c.newShape,u=c.oldShape,l=Z(s);l&&ir(l)&&u.label&&s.label&&(s.label.x=u.label.x,s.label.y=u.label.y)}),this.preExecute("shape.resize",function(a){var c=a.context,s=c.shape,u=c.hints||{};if(!(!Me(s)||u.autoResize)){var l=c.newBounds,p=i.getDimensions(Nn(s)||"",{box:l,style:i.getExternalStyle()}),f=Math.ceil(p.height),d=l.y!==s.y,h=s.y+s.height;c.newBounds={width:l.width,height:f,x:l.x,y:d?h-f:l.y}}}),this.postExecute("shape.resize",function(a){var c=a.context,s=c.shape,u=c.newBounds,l=c.oldBounds;if(Ms(s)){var p=s.label,f=_e(p),d=zR(l),h=HR(f,d),m=FR(h,l,u);t.moveShape(p,m)}})}ie(Bl,K),Bl.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function FR(e,t,n){var i=la(e,t,n);return Mi(ii(i,e))}function HR(e,t){if(t.length){var n=VR(e,t);return Nl(e,n)}}function zR(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 VR(e,t){var n=t.map(function(r){return{line:r,distance:Nm(e,r)}}),i=ai(n,"distance");return i[0].line}function GR(e,t,n,i){return Vm(e,t,n,i).point}function $l(e,t){K.call(this,e);function n(i,r){var o=i.context,a=o.connection,c=O({},o.hints),s=o.newWaypoints||a.waypoints,u=o.oldWaypoints;return typeof c.startChanged>"u"&&(c.startChanged=!!c.connectionStart),typeof c.endChanged>"u"&&(c.endChanged=!!c.connectionEnd),GR(r,s,u,c)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(i){var r=i.context,o=r.connection,a=o.outgoing,c=o.incoming;c.forEach(function(s){var u=s.waypoints[s.waypoints.length-1],l=n(i,u),p=[].concat(s.waypoints.slice(0,-1),[l]);t.updateWaypoints(s,p)}),a.forEach(function(s){var u=s.waypoints[0],l=n(i,u),p=[].concat([l],s.waypoints.slice(1));t.updateWaypoints(s,p)})}),this.postExecute(["connection.move"],function(i){var r=i.context,o=r.connection,a=o.outgoing,c=o.incoming,s=r.delta;c.forEach(function(u){var l=u.waypoints[u.waypoints.length-1],p={x:l.x+s.x,y:l.y+s.y},f=[].concat(u.waypoints.slice(0,-1),[p]);t.updateWaypoints(u,f)}),a.forEach(function(u){var l=u.waypoints[0],p={x:l.x+s.x,y:l.y+s.y},f=[].concat([p],u.waypoints.slice(1));t.updateWaypoints(u,f)})})}ie($l,K),$l.$inject=["eventBus","modeling"];function qs(e,t,n){var i=Xs(e),r=Xm(i,t),o=i[0];return r.length?r[r.length-1]:la(o.original||o,n,t)}function Ks(e,t,n){var i=Xs(e),r=Xm(i,t),o=i[i.length-1];return r.length?r[0]:la(o.original||o,n,t)}function jl(e,t,n){var i=Xs(e),r=Km(t,n),o=i[0];return la(o.original||o,r,t)}function Fl(e,t,n){var i=Xs(e),r=Km(t,n),o=i[i.length-1];return la(o.original||o,r,t)}function Km(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Xs(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Xm(e,t){var n=rn(e,UR);return Le(n,function(i){return WR(i,t)})}function WR(e,t){return Kt(t,e,1)==="intersect"}function UR(e){return e.original||e}function Hl(e,t){K.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(YR(i,r)){var o=qR(i);o.incoming.forEach(function(a){var c=Ks(a,r,i);t.reconnectEnd(a,r,c)}),o.outgoing.forEach(function(a){var c=qs(a,r,i);t.reconnectStart(a,r,c)})}},!0)}Hl.$inject=["eventBus","modeling"],ie(Hl,K);function YR(e,t){return v(e,"bpmn:Participant")&&$e(e)&&v(t,"bpmn:Participant")&&!$e(t)}function qR(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 KR=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Zm(e){const t=Z(e);if(!v(t,"bpmn:BoundaryEvent")&&!(v(t,"bpmn:StartEvent")&&cn(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:KR.some(i=>v(n[0],i))}function Qm(e){return v(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function zl(e,t){e.invoke(K,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!Zm(r))return;const a=Qm(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const s=Z(i).get(a),u=Z(r).get(a);s!==u&&t.updateProperties(r,{[a]:s})})}zl.$inject=["injector","modeling"],ie(zl,K);function Vl(e,t){K.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=ze(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}ie(Vl,K),Vl.$inject=["eventBus","modeling"];function Gl(e,t,n){K.call(this,e),this.preExecute("shape.delete",function(i){var r=i.context.shape;if(!(r.incoming.length!==1||r.outgoing.length!==1)){var o=r.incoming[0],a=r.outgoing[0];if(!(!v(o,"bpmn:SequenceFlow")||!v(a,"bpmn:SequenceFlow"))&&t.canConnect(o.source,a.target,o)){var c=XR(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,c)}}})}ie(Gl,K),Gl.$inject=["eventBus","bpmnRules","modeling"];function yo(e){return e.original||e}function XR(e,t){var n=Ll(yo(e[e.length-2]),yo(e[e.length-1]),yo(t[1]),yo(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[yo(e[0]),yo(t[t.length-1])]}function Wl(e,t){K.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,r=i.parent;v(i,"bpmn:Participant")&&(n.collaborationRoot=r)},!0),this.postExecute("shape.delete",function(n){var i=n.collaborationRoot;if(i&&!i.businessObject.participants.length){var r=t.makeProcess(),o=i.children.slice();t.moveElements(o,{x:0,y:0},r)}},!0)}Wl.$inject=["eventBus","modeling"],ie(Wl,K);function Ul(e,t,n,i){K.call(this,e);var r=i.get("dragging",!1);function o(s){var u=s.source,l=s.target,p=s.parent;if(p){var f,d;v(s,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(u,l)||(d=!0),n.canConnectMessageFlow(u,l)&&(f="bpmn:MessageFlow")),v(s,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(u,l)||(d=!0),n.canConnectSequenceFlow(u,l)&&(f="bpmn:SequenceFlow")),d&&t.removeConnection(s),f&&t.connect(u,l,{type:f,waypoints:s.waypoints.slice()})}}function a(s){var u=s.context,l=u.connection,p=u.newSource||l.source,f=u.newTarget||l.target,d,h;d=n.canConnect(p,f),!(!d||d.type===l.type)&&(h=t.connect(p,f,{type:d.type,associationDirection:d.associationDirection,waypoints:l.waypoints.slice()}),l.parent&&t.removeConnection(l),u.connection=h,r&&c(l,h))}function c(s,u){var l=r.context(),p=l&&l.payload.previousSelection,f;!p||!p.length||(f=p.indexOf(s),f!==-1&&p.splice(f,1,u))}this.postExecuted("elements.move",function(s){var u=s.closure,l=u.allConnections;M(l,o)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(s){var u=s.context,l=u.properties,p=u.element,f=p.businessObject,d;l.default&&(d=ot(p.outgoing,to({id:p.businessObject.default.id})),d&&t.updateProperties(d,{conditionExpression:void 0})),l.conditionExpression&&f.sourceRef.default===f&&t.updateProperties(p.source,{default:void 0})})}ie(Ul,K),Ul.$inject=["eventBus","modeling","bpmnRules","injector"];function Zs(e,t,n,i,r,o){i.invoke(K,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,function(a){var c=a.context,s=c.parent,u=c.elements,l=En(u,function(p,f){var d=t.canReplace([f],f.host||f.parent||s);return d?p.concat(d.replacements):p},[]);l.length&&this._replaceElements(u,l)},this),this.postExecuted(["elements.move"],500,function(a){var c=a.context,s=c.newParent,u=c.newHost,l=[];M(c.closure.topLevel,function(f){cn(f)?l=l.concat(f.children):l=l.concat(f)}),l.length===1&&u&&(s=u);var p=t.canReplace(l,s);p&&this._replaceElements(l,p.replacements,u)},this),this.postExecute(["shape.replace"],1500,function(a){var c=a.context,s=c.oldShape,u=c.newShape,l=s.attachers,p;l&&l.length&&(p=t.canReplace(l,u),this._replaceElements(l,p.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var c=a.context,s=c.oldShape,u=c.newShape;r.unclaimId(s.businessObject.id,s.businessObject),r.updateProperties(u,{id:s.id})})}ie(Zs,K),Zs.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;M(t,function(o){var a={type:o.newElementType},c=n.get(o.oldElementId),s=e.indexOf(c);e[s]=i.replaceElement(c,a,{select:!1})}),t&&r.select(e)},Zs.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var ZR=1500,QR={width:140,height:120},Yl={width:300,height:60},ql={width:60,height:300},Qs={width:300,height:150},Js={width:150,height:300},Jm={width:140,height:120},eg={width:100,height:40};function tg(e){e.on("resize.start",ZR,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=iC(i,r,o)),v(i,"bpmn:SubProcess")&&$e(i)&&(n.minDimensions=Jm),v(i,"bpmn:TextAnnotation")&&(n.minDimensions=eg)})}tg.$inject=["eventBus"];var ar=Math.abs,JR=Math.min,eC=Math.max;function ng(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function vo(e,t,n){return ng(e,t,n,JR)}function _o(e,t,n){return ng(e,t,n,eC)}var tC={top:20,left:50,right:20,bottom:20},nC={top:50,left:20,right:20,bottom:20};function iC(e,t,n){var i=Gn(e),r=!0,o=!0,a=Vs(i,[i]),c=ye(e),s={},u={},l=Gt(e),p=l?Yl:ql;/n/.test(t)?u.top=c.bottom-p.height:/e/.test(t)?u.right=c.left+p.width:/s/.test(t)?u.bottom=c.top+p.height:/w/.test(t)&&(u.left=c.right-p.width),a.forEach(function(h){var m=ye(h);l?(m.top<c.top-10&&(r=!1),m.bottom>c.bottom+10&&(o=!1)):(m.left<c.left-10&&(r=!1),m.right>c.right+10&&(o=!1)),/n/.test(t)&&(n&&ar(c.top-m.bottom)<10&&_o(s,"top",m.top+p.height),ar(c.top-m.top)<5&&vo(u,"top",m.bottom-p.height)),/e/.test(t)&&(n&&ar(c.right-m.left)<10&&vo(s,"right",m.right-p.width),ar(c.right-m.right)<5&&_o(u,"right",m.left+p.width)),/s/.test(t)&&(n&&ar(c.bottom-m.top)<10&&vo(s,"bottom",m.bottom-p.height),ar(c.bottom-m.bottom)<5&&_o(u,"bottom",m.top+p.height)),/w/.test(t)&&(n&&ar(c.left-m.right)<10&&_o(s,"left",m.left+p.width),ar(c.left-m.left)<5&&vo(u,"left",m.right-p.width))});var f=i.children.filter(function(h){return!h.hidden&&!h.waypoints&&(v(h,"bpmn:FlowElement")||v(h,"bpmn:Artifact"))}),d=l?tC:nC;return f.forEach(function(h){var m=ye(h);/n/.test(t)&&(!l||r)&&vo(u,"top",m.top-d.top),/e/.test(t)&&(l||o)&&_o(u,"right",m.right+d.right),/s/.test(t)&&(!l||o)&&_o(u,"bottom",m.bottom+d.bottom),/w/.test(t)&&(l||r)&&vo(u,"left",m.left-d.left)}),{min:u,max:s}}function ig(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function bo(e){return e.originalEvent||e.srcEvent}function Kl(e){ig(e),ig(bo(e))}function jr(e){return e.pointers&&e.pointers.length&&(e=e.pointers[0]),e.touches&&e.touches.length&&(e=e.touches[0]),e?{x:e.clientX,y:e.clientY}:null}function rg(){return/mac/i.test(navigator.platform)}function og(e,t){return(bo(e)||e).button===t}function sr(e){return og(e,0)}function rC(e){return og(e,1)}function pa(e){var t=bo(e)||e;return sr(e)?rg()?t.metaKey:t.ctrlKey:!1}function ec(e){var t=bo(e)||e;return sr(e)&&t.shiftKey}var ag=1001;function sg(e,t){e.on("resize.start",ag+500,function(n){var i=n.context,r=i.shape;(v(r,"bpmn:Lane")||v(r,"bpmn:Participant"))&&(i.balanced=!pa(n))}),e.on("resize.end",ag,function(n){var i=n.context,r=i.shape,o=i.canExecute,a=i.newBounds;if(v(r,"bpmn:Lane")||v(r,"bpmn:Participant"))return o&&(a=Nh(a),t.resizeLane(r,a,i.balanced)),!1})}sg.$inject=["eventBus","modeling"];var oC=500;function Xl(e,t,n,i,r){n.invoke(K,this);function o(l){return De(l,["bpmn:ReceiveTask","bpmn:SendTask"])||aC(l,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(l){var p=e.getDefinitions(),f=p.get("rootElements");return!!ot(f,to({id:l.id}))}function c(l){if(v(l,"bpmn:ErrorEventDefinition"))return"errorRef";if(v(l,"bpmn:EscalationEventDefinition"))return"escalationRef";if(v(l,"bpmn:MessageEventDefinition"))return"messageRef";if(v(l,"bpmn:SignalEventDefinition"))return"signalRef"}function s(l){if(De(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.get("messageRef");var p=l.get("eventDefinitions"),f=p[0];return f.get(c(f))}function u(l,p){if(De(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.set("messageRef",p);var f=l.get("eventDefinitions"),d=f[0];return d.set(c(d),p)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var p=l.shape||l.element;if(o(p)){var f=Z(p),d=s(f),h;d&&!a(d)&&(h=e.getDefinitions().get("rootElements"),wt(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");xt(f,p)}},!0),t.on("copyPaste.copyElement",function(l){var p=l.descriptor,f=l.element;if(!(f.labelTarget||!o(f))){var d=Z(f),h=s(d);h&&(p.referencedRootElement=h)}}),t.on("copyPaste.pasteElement",oC,function(l){var p=l.descriptor,f=p.businessObject,d=p.referencedRootElement;d&&(a(d)||(d=i.copyElement(d,r.create(d.$type))),u(f,d),delete p.referencedRootElement)})}Xl.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],ie(Xl,K);function aC(e,t){return ve(t)||(t=[t]),Gi(t,function(n){return lo(e,n)})}var cg=Math.max;function ug(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return M(n,function(a){var c=a.id;v(a,"bpmn:Participant")&&(o[c]=cC(a,i,r)),v(a,"bpmn:Lane")&&(o[c]=Gt(a)?Yl:ql),v(a,"bpmn:SubProcess")&&$e(a)&&(o[c]=Jm),v(a,"bpmn:TextAnnotation")&&(o[c]=eg),v(a,"bpmn:Group")&&(o[c]=QR)}),o})}ug.$inject=["eventBus"];function sC(e){return e==="x"}function cC(e,t,n){var i=Gt(e);if(!pC(e))return i?Qs:Js;var r=sC(t),o={};return r?i?o=Qs:o={width:lC(e,n,r),height:Js.height}:i?o={width:Qs.width,height:uC(e,n,r)}:o=Js,o}function uC(e,t,n){var i;return i=fC(e,t,n),cg(Qs.height,i)}function lC(e,t,n){var i;return i=dC(e,t,n),cg(Js.width,i)}function pC(e){return!!or(e).length}function fC(e,t,n){var i=or(e),r;return r=Zl(i,t,n),e.height-r.height+Yl.height}function dC(e,t,n){var i=or(e),r;return r=Zl(i,t,n),e.width-r.width+ql.width}function Zl(e,t,n){var i,r,o;for(i=0;i<e.length;i++)if(r=e[i],!n&&t>=r.y&&t<=r.y+r.height||n&&t>=r.x&&t<=r.x+r.width)return o=or(r),o.length?Zl(o,t,n):r}var lg="_plane";function pg(e){var t=e.id;return hC(t)}function gi(e){var t=e.id;return v(e,"bpmn:SubProcess")?fg(t):t}function Fr(e){return fg(e)}function tc(e){var t=ze(e);return v(t,"bpmndi:BPMNPlane")}function fg(e){return e+lg}function hC(e){return e.replace(new RegExp(lg+"$"),"")}var dg=400,mC=600,hg={x:180,y:160};function Li(e,t,n,i,r,o,a){K.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=i,this._bpmnFactory=r,this._bpmnjs=o,this._elementRegistry=a;var c=this;function s(p){return v(p,"bpmn:SubProcess")&&!$e(p)}function u(p){var f=p.shape,d=p.newRootElement,h=Z(f);d=c._addDiagram(d||h),p.newRootElement=e.addRootElement(d)}function l(p){var f=p.shape,d=Z(f);c._removeDiagram(d);var h=p.newRootElement=a.get(gi(d));e.removeRootElement(h)}this.executed("shape.create",function(p){var f=p.shape;s(f)&&u(p)},!0),this.postExecuted("elements.create",function(p){var f=p.elements;M(f,function(d){if(s(d)){var h=a.get(gi(d));if(!(!h||!d.children||!d.children.length)){var m=mg(d);c._showRecursively(m),c._moveChildrenToShape(m,h)}}})},!0),this.reverted("shape.create",function(p){var f=p.shape;s(f)&&l(p)},!0),this.preExecute("shape.delete",function(p){var f=p.shape;!v(f,"bpmn:SubProcess")||!$e(f)||M(ta([f]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(p){var f=p.shape;if(s(f)){var d=a.get(gi(f));d&&n.removeElements(d.children.slice())}},!0),this.executed("shape.delete",function(p){var f=p.shape;s(f)&&l(p)},!0),this.reverted("shape.delete",function(p){var f=p.shape;s(f)&&u(p)},!0),this.preExecuted("shape.replace",function(p){var f=p.oldShape,d=p.newShape;!s(f)||!s(d)||(p.oldRoot=e.removeRootElement(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(tc(f)){a.updateId(f,Fr(g)),a.updateId(m,g);return}var R=a.get(Fr(m));R&&a.updateId(Fr(m),Fr(g))}}},!0),this.reverted("element.updateProperties",function(p){var f=p.element;if(v(f,"bpmn:SubProcess")){var d=p.properties,h=p.oldProperties,m=h.id,g=d.id;if(m!==g){if(tc(f)){a.updateId(f,Fr(m)),a.updateId(g,m);return}var R=a.get(Fr(g));R&&a.updateId(R,Fr(m))}}},!0),t.on("element.changed",function(p){var f=p.element;if(tc(f)){var d=f,h=a.get(pg(d));!h||h===d||t.fire("element.changed",{element:h})}}),this.executed("shape.toggleCollapse",dg,function(p){var f=p.shape;v(f,"bpmn:SubProcess")&&($e(f)?l(p):(u(p),c._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",dg,function(p){var f=p.shape;v(f,"bpmn:SubProcess")&&($e(f)?l(p):(u(p),c._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",mC,function(p){var f=p.shape;if(v(f,"bpmn:SubProcess")){var d=p.newRootElement;if(d)if($e(f))c._moveChildrenToShape(d.children.slice(),f),M(ta(f.children),m=>{n.moveShape(m.annotation,{x:0,y:0},f.parent),M(m.associations,g=>{n.moveConnection(g,{x:0,y:0},f.parent)})});else{c._disconnectSharedAnnotations(f);var h=mg(f);c._moveChildrenToShape(h,d)}}},!0),t.on("copyPaste.createTree",function(p){var f=p.element,d=p.children;if(s(f)){var h=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(ze(m),"bpmndi:BPMNPlane");if(g){var R=pg(m),w=ot(h,function(x){return x.id===R});w&&(f.parent=w.id)}}),t.on("copyPaste.pasteElement",function(p){var f=p.descriptor;f.parent&&(s(f.parent)||f.parent.hidden)&&(f.hidden=!0)})}ie(Li,K),Li.prototype._moveChildrenToShape=function(e,t){var n=this._modeling;if(e.length){var i=e.filter(function(s){return!s.hidden});if(!i.length){n.moveElements(e,{x:0,y:0},t,{autoResize:!1});return}var r=Ct(i),o;if(!t.x)o={x:hg.x-r.x,y:hg.y-r.y};else{var a=_e(t),c=_e(r);o={x:a.x-c.x,y:a.y-c.y}}n.moveElements(e,o,t,{autoResize:!1})}},Li.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(om(e).map(i=>i.annotation));n.size&&M(ta(e.children),i=>{n.has(i.annotation)&&M(i.associations,r=>{t.removeConnection(r)})})},Li.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},Li.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},Li.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},Li.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=ot(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},Li.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function gC(e){var t=[];return M(ta(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function mg(e){return e.children.slice().concat(gC(e.children)).concat(yC(e))}function yC(e){return nl(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function Ql(e,t){e.invoke(K,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,r=n.context.newShape;if(!(!v(r,"bpmn:SubProcess")||v(r,"bpmn:AdHocSubProcess")||!(v(i,"bpmn:Task")||v(i,"bpmn:CallActivity"))||!$e(r))){var o=vC(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}Ql.$inject=["injector","modeling"],ie(Ql,K);function vC(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function Jl(e,t){K.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;v(i,"bpmn:TextAnnotation")&&(n.parent=i.parent)},!0),this.preExecute(["shape.create","shape.resize","elements.move"],function(n){const i=n.shapes||[n.shape];i.length===1&&v(i[0],"bpmn:TextAnnotation")&&(n.hints=n.hints||{},n.hints.autoResize=!1)},!0),this.preExecute("shape.resize",function(n){var i=n.context,r=i.shape,o=i.hints||{};if(!(!v(r,"bpmn:TextAnnotation")||o.autoResize)){var a=i.newBounds,c=t.getTextAnnotationBounds(a,Nn(r)||""),s=a.y!==r.y&&Math.abs(a.y+a.height-(r.y+r.height))<=1,u=r.y+r.height;i.newBounds={width:a.width,height:c.height,x:a.x,y:s?u-c.height:a.y}}})}ie(Jl,K),Jl.$inject=["eventBus","textRenderer"];function ep(e,t){K.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if($e(i))return;var r=Ko(i);r.forEach(function(a){var c=a.incoming.slice(),s=a.outgoing.slice();M(c,function(u){o(u,!0)}),M(s,function(u){o(u,!1)})});function o(a,c){r.indexOf(a.source)!==-1&&r.indexOf(a.target)!==-1||v(a,"bpmn:Association")&&(v(a.source,"bpmn:TextAnnotation")||v(a.target,"bpmn:TextAnnotation"))||(c?t.reconnectEnd(a,i,_e(i)):t.reconnectStart(a,i,_e(i)))}},!0)}ie(ep,K),ep.$inject=["eventBus","modeling"];var tp=500;function np(e,t,n){K.call(this,e);function i(a){a.length&&a.forEach(function(c){c.type==="label"&&!c.businessObject.name&&(c.hidden=!0)})}function r(a,c){var s=a.children,u=c,l,p;return l=_C(s).concat([a]),p=Em(l),p?(u.width=Math.max(p.width,u.width),u.height=Math.max(p.height,u.height),u.x=p.x+(p.width-u.width)/2,u.y=p.y+(p.height-u.height)/2):(u.x=a.x+(a.width-u.width)/2,u.y=a.y+(a.height-u.height)/2),u}function o(a,c){return{x:a.x+(a.width-c.width)/2,y:a.y+(a.height-c.height)/2,width:c.width,height:c.height}}this.executed(["shape.toggleCollapse"],tp,function(a){var c=a.context,s=c.shape;v(s,"bpmn:SubProcess")&&(s.collapsed?ze(s).isExpanded=!1:(i(s.children),ze(s).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],tp,function(a){var c=a.context,s=c.shape;s.collapsed?ze(s).isExpanded=!1:ze(s).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],tp,function(a){var c=a.context.shape,s=t.getDefaultSize(c),u;c.collapsed?u=o(c,s):u=r(c,s),n.resizeShape(c,u,null,{autoResize:c.collapsed?!1:"nwse"})})}ie(np,K),np.$inject=["eventBus","elementFactory","modeling"];function _C(e){return e.filter(function(t){return!t.hidden})}function ip(e,t,n,i){t.invoke(K,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,c=a.businessObject;Me(a)||(v(a,"bpmn:Participant")&&$e(a)&&n.ids.unclaim(c.processRef.id),i.unclaimId(c.id,c))}),this.preExecute("connection.delete",function(r){var o=r.context,a=o.connection,c=a.businessObject;i.unclaimId(c.id,c)}),this.preExecute("canvas.updateRoot",function(){var r=e.getRootElement(),o=r.businessObject;v(r,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}ie(ip,K),ip.$inject=["canvas","injector","moddle","modeling"];function rp(e,t){K.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;bC(r,o)&&t.updateProperties(o,{default:null})})}ie(rp,K),rp.$inject=["eventBus","modeling"];function bC(e,t){if(!v(e,"bpmn:SequenceFlow"))return!1;var n=Z(t),i=Z(e);return n.get("default")===i}var xC=500,wC=5e3,gg=["shape.create","shape.delete","shape.move","shape.resize"],yg=[...gg,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function op(e,t){K.call(this,e);var n;function i(){return n=n||new EC,n.enter(),n}function r(){if(!n)throw new Error("out of bounds release");return n}function o(){if(!n)throw new Error("out of bounds release");var a=n.leave();return a&&(t.updateLaneRefs(n.flowNodes,n.lanes),n=null),a}this.preExecute(yg,wC,function(){i()}),this.postExecuted(yg,xC,function(){o()}),this.preExecute(gg,function(a){var c=a.context,s=c.shape,u=r();!s||s.labelTarget||(v(s,"bpmn:Lane")&&u.addLane(s),v(s,"bpmn:FlowNode")&&u.addFlowNode(s))})}op.$inject=["eventBus","modeling"],ie(op,K);function EC(){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 SC=500,RC=5e3,vg=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],_g=[...vg,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function ap(e,t){K.call(this,e);var n;function i(){return n=n||new CC,n.enter(),n}function r(){if(!n)throw new Error("out of bounds release");return n}function o(){if(!n)throw new Error("out of bounds release");var a=n.leave();return a&&(t.updateCategoryValueRefs(Array.from(n.affectedFlowElements),Array.from(n.affectedGroupEntries.values())),n=null),a}this.preExecute(_g,RC,function(){i()}),this.postExecuted(_g,SC,function(){o()}),this.preExecute(vg,function(a){var c=a.context.connection||a.context.shape,s=r();!c||c.labelTarget||(v(c,"bpmn:FlowElement")&&s.addFlowElement(c),v(c,"bpmn:Group")&&s.addGroup(c))}),this.preExecute("label.create",function(a){var c=a.context.labelTarget;v(c,"bpmn:Group")&&r().addGroup(c)})}ap.$inject=["eventBus","modeling"],ie(ap,K);function CC(){this.affectedFlowElements=new Set,this.affectedGroupEntries=new Map,this.counter=0,this.addFlowElement=function(e){this.affectedFlowElements.add(e)},this.addGroup=function(e){this.affectedGroupEntries.has(e)||this.affectedGroupEntries.set(e,{categoryValue:e.businessObject.categoryValueRef,groupShape:e})},this.enter=function(){this.counter++},this.leave=function(){return this.counter--,!this.counter}}function sp(e,t){K.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)PC(o)&&!TC(o)&&t.updateProperties(o,{isForCompensation:void 0})})}ie(sp,K),sp.$inject=["eventBus","modeling"];function PC(e){const t=Z(e);return t&&t.isForCompensation}function AC(e){return e&&v(e,"bpmn:BoundaryEvent")&&lo(e,"bpmn:CompensateEventDefinition")}function TC(e){return e.incoming.filter(n=>AC(n.source)).length>0}const MC={__init__:["adaptiveLabelPositioningBehavior","appendBehavior","artifactBehavior","associationBehavior","attachEventBehavior","boundaryEventBehavior","categoryRootElementReferenceBehavior","compensateBoundaryEventBehaviour","createBehavior","createDataObjectBehavior","createParticipantBehavior","dataInputAssociationBehavior","dataStoreBehavior","deleteLaneBehavior","detachEventBehavior","dropOnFlowBehavior","eventBasedGatewayBehavior","fixHoverBehavior","groupBehavior","importDockingFix","isHorizontalFix","labelBehavior","layoutConnectionBehavior","messageFlowBehavior","nonInterruptingBehavior","removeElementBehavior","removeEmbeddedLabelBoundsBehavior","removeParticipantBehavior","replaceConnectionBehavior","replaceElementBehaviour","resizeBehavior","resizeLaneBehavior","rootElementReferenceBehavior","spaceToolBehavior","subProcessPlaneBehavior","subProcessStartEventBehavior","textAnnotationBehavior","toggleCollapseConnectionBehaviour","toggleElementCollapseBehaviour","unclaimIdBehavior","updateFlowNodeRefsBehavior","updateCategoryValueRefsBehavior","unsetDefaultFlowBehavior","setCompensationActivityAfterPasteBehavior"],adaptiveLabelPositioningBehavior:["type",ml],appendBehavior:["type",gl],associationBehavior:["type",vl],attachEventBehavior:["type",Ns],artifactBehavior:["type",yl],boundaryEventBehavior:["type",_l],categoryRootElementReferenceBehavior:["type",bl],compensateBoundaryEventBehaviour:["type",xl],createBehavior:["type",wl],createDataObjectBehavior:["type",El],createParticipantBehavior:["type",Cl],dataInputAssociationBehavior:["type",Pl],dataStoreBehavior:["type",Al],deleteLaneBehavior:["type",Tl],detachEventBehavior:["type",Gs],dropOnFlowBehavior:["type",kl],eventBasedGatewayBehavior:["type",Dl],fixHoverBehavior:["type",Mm],groupBehavior:["type",Ol],importDockingFix:["type",Dm],isHorizontalFix:["type",Il],labelBehavior:["type",Bl],layoutConnectionBehavior:["type",$l],messageFlowBehavior:["type",Hl],nonInterruptingBehavior:["type",zl],removeElementBehavior:["type",Gl],removeEmbeddedLabelBoundsBehavior:["type",Vl],removeParticipantBehavior:["type",Wl],replaceConnectionBehavior:["type",Ul],replaceElementBehaviour:["type",Zs],resizeBehavior:["type",tg],resizeLaneBehavior:["type",sg],rootElementReferenceBehavior:["type",Xl],spaceToolBehavior:["type",ug],subProcessPlaneBehavior:["type",Li],subProcessStartEventBehavior:["type",Ql],textAnnotationBehavior:["type",Jl],toggleCollapseConnectionBehaviour:["type",ep],toggleElementCollapseBehaviour:["type",np],unclaimIdBehavior:["type",ip],unsetDefaultFlowBehavior:["type",rp],updateFlowNodeRefsBehavior:["type",op],updateCategoryValueRefsBehavior:["type",ap],setCompensationActivityAfterPasteBehavior:["type",sp]};function cp(e){this._commandStack=e.get("commandStack",!1)}cp.$inject=["injector"],cp.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const yi={__init__:["rules"],rules:["type",cp]};function Wn(e){K.call(this,e),this.init()}Wn.$inject=["eventBus"],ie(Wn,K),Wn.prototype.addRule=function(e,t,n){var i=this;typeof e=="string"&&(e=[e]),e.forEach(function(r){i.canExecute(r,t,function(o,a,c){return n(o)},!0)})},Wn.prototype.init=function(){};function bg(e,t){var n=Kt(e,t,-15);return n!=="intersect"?n:null}function Zt(e){Wn.call(this,e)}ie(Zt,Wn),Zt.$inject=["eventBus"],Zt.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return kC(t)}),this.addRule("connection.create",function(e){var t=e.source,n=e.target,i=e.hints||{},r=i.targetParent,o=i.targetAttach;if(o)return!1;r&&(n.parent=r);try{return ic(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return ic(n,i,t)}),this.addRule("connection.updateWaypoints",function(e){return{type:e.connection.type}}),this.addRule("shape.resize",function(e){var t=e.shape,n=e.newBounds,i=e.direction;return Og(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return nt(i)&&!rc(t,i)?!1:Pr(t,function(r){return nt(r)?ic(r.source,r.target,r):r.host?fa(r,r.host,null,n):fp(r,i)})}),this.addRule("elements.move",function(e){var t=e.target,n=e.shapes,i=e.position,r=e.hints;return r!=null&&r.keyboardMove&&n.some(function(a){return Pg(a)&&!n.includes(a.host)})?!1:fa(n,t,null,i)||kg(n,t,i)||Dg(n,t)||rc(n,t)}),this.addRule("shape.create",function(e){return fp(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return fa(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return $g(n,t)})},Zt.prototype.canConnectMessageFlow=Ng,Zt.prototype.canConnectSequenceFlow=Bg,Zt.prototype.canConnectDataAssociation=dp,Zt.prototype.canConnectAssociation=Lg,Zt.prototype.canConnectCompensationAssociation=Ig,Zt.prototype.canMove=Dg,Zt.prototype.canAttach=fa,Zt.prototype.canReplace=kg,Zt.prototype.canDrop=xo,Zt.prototype.canInsert=rc,Zt.prototype.canCreate=fp,Zt.prototype.canConnect=ic,Zt.prototype.canResize=Og,Zt.prototype.canCopy=$g;function kC(e){return up(e)?null:De(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function up(e){return!e||Me(e)}function xg(e){do{if(v(e,"bpmn:Process"))return Z(e);if(v(e,"bpmn:Participant"))return Z(e).processRef||Z(e)}while(e=e.parent)}function lp(e){return v(e,"bpmn:TextAnnotation")}function pp(e){return v(e,"bpmn:Group")&&!e.labelTarget}function wg(e){return v(e,"bpmn:BoundaryEvent")&&vi(e,"bpmn:CompensateEventDefinition")}function nc(e){return Z(e).isForCompensation}function DC(e,t){var n=xg(e),i=xg(t);return n===i}function OC(e){return v(e,"bpmn:InteractionNode")&&!v(e,"bpmn:BoundaryEvent")&&(!v(e,"bpmn:Event")||v(e,"bpmn:ThrowEvent")&&Rg(e,"bpmn:MessageEventDefinition"))}function LC(e){return v(e,"bpmn:InteractionNode")&&!nc(e)&&(!v(e,"bpmn:Event")||v(e,"bpmn:CatchEvent")&&Rg(e,"bpmn:MessageEventDefinition"))&&!(v(e,"bpmn:BoundaryEvent")&&!vi(e,"bpmn:MessageEventDefinition"))}function Eg(e){for(var t=e;t=t.parent;){if(v(t,"bpmn:FlowElementsContainer"))return Z(t);if(v(t,"bpmn:Participant"))return Z(t).processRef}return null}function Sg(e,t){var n=Eg(e),i=Eg(t);return n===i}function vi(e,t){var n=Z(e);return!!ot(n.eventDefinitions||[],function(i){return v(i,t)})}function Rg(e,t){var n=Z(e);return(n.eventDefinitions||[]).every(function(i){return v(i,t)})}function IC(e){return v(e,"bpmn:FlowNode")&&!v(e,"bpmn:EndEvent")&&!cn(e)&&!(v(e,"bpmn:IntermediateThrowEvent")&&vi(e,"bpmn:LinkEventDefinition"))&&!wg(e)&&!nc(e)}function NC(e){return v(e,"bpmn:FlowNode")&&!v(e,"bpmn:StartEvent")&&!v(e,"bpmn:BoundaryEvent")&&!cn(e)&&!(v(e,"bpmn:IntermediateCatchEvent")&&vi(e,"bpmn:LinkEventDefinition"))&&!nc(e)}function BC(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 $C(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function Cg(e,t){var n=$C(t);return n.indexOf(e)!==-1}function ic(e,t,n){if(up(e)||up(t))return null;if(!v(n,"bpmn:DataAssociation")){if(Ng(e,t))return{type:"bpmn:MessageFlow"};if(Bg(e,t))return{type:"bpmn:SequenceFlow"}}var i=dp(e,t);return i||(Ig(e,t)?{type:"bpmn:Association",associationDirection:"One"}:Lg(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function xo(e,t){return Me(e)||pp(e)?!0:v(t,"bpmn:Participant")&&!$e(t)?!1:v(e,"bpmn:Participant")?v(t,"bpmn:Process")||v(t,"bpmn:Collaboration"):De(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:v(e,"bpmn:Lane")?v(t,"bpmn:Participant")||v(t,"bpmn:Lane"):v(e,"bpmn:BoundaryEvent")&&!jC(e)?!1:v(e,"bpmn:FlowElement")&&!v(e,"bpmn:DataStoreReference")?v(t,"bpmn:FlowElementsContainer")?$e(t):De(t,["bpmn:Participant","bpmn:Lane"]):v(e,"bpmn:DataStoreReference")&&v(t,"bpmn:Collaboration")?Gi(Z(t).get("participants"),function(n){return!!n.get("processRef")}):De(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?De(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):v(e,"bpmn:MessageFlow")?v(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function jC(e){return Z(e).cancelActivity&&(Ag(e)||Tg(e))}function Pg(e){return!Me(e)&&v(e,"bpmn:BoundaryEvent")}function FC(e){return v(e,"bpmn:Lane")}function HC(e){return Pg(e)||v(e,"bpmn:IntermediateThrowEvent")&&Ag(e)?!0:v(e,"bpmn:IntermediateCatchEvent")&&Tg(e)}function Ag(e){var t=Z(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Tg(e){return Mg(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Mg(e,t){return t.some(function(n){return vi(e,n)})}function zC(e){return v(e,"bpmn:ReceiveTask")&&ot(e.incoming,function(t){return v(t.source,"bpmn:EventBasedGateway")})}function fa(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return Me(r)||!HC(r)||cn(t)||!v(t,"bpmn:Activity")||nc(t)||i&&!bg(i,t)||zC(t)?!1:"attach"}function kg(e,t,n){if(!t)return!1;var i={replacements:[]};return M(e,function(r){cn(t)||v(r,"bpmn:StartEvent")&&r.type!=="label"&&xo(r,t)&&(Z1(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(Q1(r)||J1(r)||eS(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),Mg(r,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&v(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"})),v(t,"bpmn:Transaction")||vi(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(v(r,"bpmn:EndEvent")&&xo(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),v(r,"bpmn:BoundaryEvent")&&fa(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function Dg(e,t){return Gi(e,FC)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return xo(n,t)})}function fp(e,t,n,i){return t?Me(e)||pp(e)?!0:xo(e,t)||rc(e,t):!1}function Og(e,t,n){return v(e,"bpmn:SubProcess")?$e(e)&&(!t||t.width>=100&&t.height>=80):v(e,"bpmn:Lane")||v(e,"bpmn:Participant")?!0:lp(e)?n?n==="e"||n==="w":!0:pp(e)?!0:Me(e)?n?n==="e"||n==="w":!0:!1}function VC(e,t){var n=lp(e),i=lp(t);return(n||i)&&n!==i}function Lg(e,t){return Cg(t,e)||Cg(e,t)?!1:VC(e,t)?!0:!!dp(e,t)}function Ig(e,t){return Sg(e,t)&&wg(e)&&v(t,"bpmn:Activity")&&!WC(t,e)&&!cn(t)}function Ng(e,t){return Fg(e)&&!Fg(t)?!1:OC(e)&&LC(t)&&!DC(e,t)}function Bg(e,t){return IC(e)&&NC(t)&&Sg(e,t)&&!(v(e,"bpmn:EventBasedGateway")&&!BC(t))}function dp(e,t){return De(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&De(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:De(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&De(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function rc(e,t,n){if(!t)return!1;if(Array.isArray(e)){if(e.length!==1)return!1;e=e[0]}return t.source===e||t.target===e?!1:De(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!Me(t)&&v(e,"bpmn:FlowNode")&&!v(e,"bpmn:BoundaryEvent")&&xo(e,t.parent)}function hp(e,t){return e&&t&&e.indexOf(t)!==-1}function $g(e,t){return Me(t)?!0:!(v(t,"bpmn:Lane")&&!hp(e,t.parent)||v(t,"bpmn:MessageFlow")&&!GC(e,t))}function GC(e,t){var n=jg(t.source),i=jg(t.target);return hp(e,n)&&hp(e,i)}function jg(e){for(;e;e=e.parent)if(v(e,"bpmn:Participant"))return e;return null}function Fg(e){return ho(e,"bpmn:Process")||ho(e,"bpmn:Collaboration")}function WC(e,t){return e.attachers.includes(t)}const UC={__depends__:[yi],__init__:["bpmnRules"],bpmnRules:["type",Zt]};var YC=2e3;function Hg(e,t){e.on("saveXML.start",YC,n);function n(){var i=t.getRootElements();M(i,function(r){var o=ze(r),a,c;a=Ko([r]),a=Le(a,function(s){return s!==r&&!s.labelTarget}),c=rn(a,ze),o.set("planeElement",c)})}}Hg.$inject=["eventBus","canvas"];const qC={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Hg]};function oc(e){K.call(this,e);var t=this;this.preExecute(["shape.create","connection.create"],function(n){var i=n.context,r=i.shape||i.connection,o=i.parent,a=t.getOrdering(r,o);a&&(a.parent!==void 0&&(i.parent=a.parent),i.parentIndex=a.index)}),this.preExecute(["shape.move","connection.move"],function(n){var i=n.context,r=i.shape||i.connection,o=i.newParent||r.parent,a=t.getOrdering(r,o);a&&(a.parent!==void 0&&(i.newParent=a.parent),i.newParentIndex=a.index)})}oc.prototype.getOrdering=function(e,t){return null},ie(oc,K);function mp(e,t){oc.call(this,e);var n=[{type:"bpmn:SubProcess",order:{level:6}},{type:"bpmn:SequenceFlow",order:{level:9,containers:["bpmn:Participant","bpmn:FlowElementsContainer"]}},{type:"bpmn:DataAssociation",order:{level:9,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:TextAnnotation",order:{level:9}},{type:"bpmn:MessageFlow",order:{level:9,containers:["bpmn:Collaboration"]}},{type:"bpmn:Association",order:{level:6,containers:["bpmn:Participant","bpmn:FlowElementsContainer","bpmn:Collaboration"]}},{type:"bpmn:BoundaryEvent",order:{level:8}},{type:"bpmn:Group",order:{level:10,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:FlowElement",order:{level:5}},{type:"bpmn:Participant",order:{level:-2}},{type:"bpmn:Lane",order:{level:-1}}];function i(a){if(a.labelTarget)return{level:10};var c=ot(n,function(s){return De(a,[s.type])});return c&&c.order||{level:1}}function r(a){var c=a.order;if(c||(a.order=c=i(a)),!c)throw new Error(`no order for <${a.id}>`);return c}function o(a,c,s){for(var u=c;u&&!De(u,s);)u=u.parent;if(!u)throw new Error(`no parent for <${a.id}> in <${c&&c.id}>`);return u}this.getOrdering=function(a,c){if(a.labelTarget||v(a,"bpmn:TextAnnotation"))return{parent:t.findRoot(c)||t.getRootElement(),index:-1};var s=r(a);s.containers&&(c=o(a,c,s.containers));var u=c.children.indexOf(a),l=Vf(c.children,function(p){return!a.labelTarget&&p.labelTarget?!1:s.level<r(p).level});return l!==-1&&u!==-1&&u<l&&(l-=1),{index:l,parent:c}}}mp.$inject=["eventBus","canvas"],ie(mp,oc);const KC={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",mp]};function da(){}da.prototype.get=function(){return this._data},da.prototype.set=function(e){this._data=e},da.prototype.clear=function(){var e=this._data;return delete this._data,e},da.prototype.isEmpty=function(){return!this._data};const XC={clipboard:["type",da]};var zg=1500;function Vg(e,t,n){var i=this,r=n.get("dragging",!1);function o(a){if(!a.hover){var c=a.originalEvent,s=i._findTargetGfx(c),u=s&&e.get(s);s&&u&&(a.stopPropagation(),r.hover({element:u,gfx:s}),r.move(c))}}r&&t.on("drag.start",function(a){t.once("drag.move",zg,function(c){o(c)})}),(function(){var a,c;t.on("element.hover",function(s){a=s.gfx,c=s.element}),t.on("element.hover",zg,function(s){c&&t.fire("element.out",{element:c,gfx:a})}),t.on("element.out",function(){a=null,c=null})})(),this._findTargetGfx=function(a){var c,s;if(a instanceof MouseEvent)return c=jr(a),s=document.elementFromPoint(c.x,c.y),ZC(s)}}Vg.$inject=["elementRegistry","eventBus","injector"];function ZC(e){return Or(e,"svg, .djs-element",!0)}const QC={__init__:["hoverFix"],hoverFix:["type",Vg]};function JC(e){return!0}function ac(e){return sr(e)||rC(e)}var Gg=500;function Wg(e,t,n){var i=this;function r(A,F,H){if(!c(A,F)){var N,V,pe;H?V=t.getGraphics(H):(N=F.delegateTarget||F.target,N&&(V=N,H=t.get(V))),!(!V||!H)&&(pe=e.fire(A,{element:H,gfx:V,originalEvent:F}),pe===!1&&(F.stopPropagation(),F.preventDefault()))}}var o={};function a(A){return o[A]}function c(A,F){var H=u[A]||sr;return!H(F)}var s={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},u={"element.contextmenu":JC,"element.mousedown":ac,"element.mouseup":ac,"element.click":ac,"element.dblclick":ac};function l(A,F,H){var N=s[A];if(!N)throw new Error("unmapped DOM event name <"+A+">");return r(N,F,H)}var p="svg, .djs-element";function f(A,F,H,N){var V=o[H]=function(pe){r(H,pe)};N&&(u[H]=N),V.$delegate=Rn.bind(A,p,F,V)}function d(A,F,H){var N=a(H);N&&Rn.unbind(A,F,N.$delegate)}function h(A){M(s,function(F,H){f(A,H,F)})}function m(A){M(s,function(F,H){d(A,H,F)})}e.on("canvas.destroy",function(A){m(A.svg)}),e.on("canvas.init",function(A){h(A.svg)}),e.on(["shape.added","connection.added"],function(A){var F=A.element,H=A.gfx;e.fire("interactionEvents.createHit",{element:F,gfx:H})}),e.on(["shape.changed","connection.changed"],Gg,function(A){var F=A.element,H=A.gfx;e.fire("interactionEvents.updateHit",{element:F,gfx:H})}),e.on("interactionEvents.createHit",Gg,function(A){var F=A.element,H=A.gfx;i.createDefaultHit(F,H)}),e.on("interactionEvents.updateHit",function(A){var F=A.element,H=A.gfx;i.updateDefaultHit(F,H)});var g=E("djs-hit djs-hit-stroke"),R=E("djs-hit djs-hit-click-stroke"),w=E("djs-hit djs-hit-all"),x=E("djs-hit djs-hit-no-move"),b={all:w,"click-stroke":R,stroke:g,"no-move":x};function E(A,F){return F=O({stroke:"white",strokeWidth:15},F||{}),n.cls(A,["no-fill","no-border"],F)}function T(A,F){var H=b[F];if(!H)throw new Error("invalid hit type <"+F+">");return re(A,H),A}function L(A,F){Ce(A,F)}this.removeHits=function(A){var F=ys(".djs-hit",A);M(F,Nt)},this.createDefaultHit=function(A,F){var H=A.waypoints,N=A.isFrame,V;return H?this.createWaypointsHit(F,H):(V=N?"stroke":"all",this.createBoxHit(F,V,{width:A.width,height:A.height}))},this.createWaypointsHit=function(A,F){var H=qo(F);return T(H,"stroke"),L(A,H),H},this.createBoxHit=function(A,F,H){H=O({x:0,y:0},H);var N=me("rect");return T(N,F),re(N,H),L(A,N),N},this.updateDefaultHit=function(A,F){var H=tt(".djs-hit",F);if(H)return A.waypoints?tl(H,A.waypoints):re(H,{width:A.width,height:A.height}),H},this.fire=r,this.triggerMouseEvent=l,this.mouseHandler=a,this.registerEvent=f,this.unregisterEvent=d}Wg.$inject=["eventBus","elementRegistry","styles"];const sc={__init__:["interactionEvents"],interactionEvents:["type",Wg]};function wo(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=new Set;var n=this;e.on(["shape.remove","connection.remove"],function(i){var r=i.element;n.deselect(r)}),e.on(["diagram.clear","root.set"],function(i){n.select(null)})}wo.$inject=["eventBus","canvas"],wo.prototype.deselect=function(e){if(this._selectedElements.has(e)){var t=this.get();this._selectedElements.delete(e),this._eventBus.fire("selection.changed",{oldSelection:t,newSelection:this.get()})}},wo.prototype.get=function(){return Array.from(this._selectedElements)},wo.prototype.isSelected=function(e){return this._selectedElements.has(e)},wo.prototype.select=function(e,t){var n=this.get();ve(e)||(e=e?[e]:[]);var i=this._canvas,r=i.getRootElement();e=e.filter(function(o){var a=i.findRoot(o);return r===a}),t?M(e,o=>{this._selectedElements.add(o)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var Ug="hover",Yg="selected";function qg(e,t){this._canvas=e;function n(r,o){e.addMarker(r,o)}function i(r,o){e.removeMarker(r,o)}t.on("element.hover",function(r){n(r.element,Ug)}),t.on("element.out",function(r){i(r.element,Ug)}),t.on("selection.changed",function(r){function o(u){i(u,Yg)}function a(u){n(u,Yg)}var c=new Set(r.oldSelection),s=new Set(r.newSelection);for(let u of c)s.has(u)||o(u);for(let u of s)c.has(u)||a(u)})}qg.$inject=["canvas","eventBus"];function Kg(e,t,n,i){e.on("create.end",500,function(r){var o=r.context,a=o.canExecute,c=o.elements,s=o.hints||{},u=s.autoSelect;if(a){if(u===!1)return;ve(u)?t.select(u):t.select(c.filter(eP))}}),e.on("connect.end",500,function(r){var o=r.context,a=o.connection;a&&t.select(a)}),e.on("shape.move.end",500,function(r){var o=r.previousSelection||[],a=i.get(r.context.shape.id),c=ot(o,function(s){return a.id===s.id});c||t.select(a)}),e.on("element.click",function(r){if(sr(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),c=t.get().length>1,s=ec(r);if(a&&c)return s?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,s)}})}Kg.$inject=["eventBus","selection","canvas","elementRegistry"];function eP(e){return!e.hidden}const Un={__init__:["selectionVisuals","selectionBehavior"],__depends__:[sc],selection:["type",wo],selectionVisuals:["type",qg],selectionBehavior:["type",Kg]};var tP=/^djs-cursor-.*$/;function cc(e){var t=dt(document.body);t.removeMatching(tP),e&&t.add("djs-cursor-"+e)}function Xg(){cc(null)}var nP=5e3;function Zg(e,t){t=t||"element.click";function n(){return!1}return e.once(t,nP,n),function(){e.off(t,n)}}var iP=["c","C"],rP=["v","V"],oP=["d","D"],aP=["x","X"],sP=["y","Y"],Qg=["z","Z"];function cP(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function An(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function Bt(e,t){return e=ve(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function gp(e){return e.shiftKey}function uP(e){return An(e)&&Bt(iP,e)}function lP(e){return An(e)&&Bt(rP,e)}function pP(e){return An(e)&&Bt(oP,e)}function fP(e){return An(e)&&Bt(aP,e)}function dP(e){return An(e)&&!gp(e)&&Bt(Qg,e)}function hP(e){return An(e)&&(Bt(sP,e)||Bt(Qg,e)&&gp(e))}var Eo=Math.round,Jg="djs-drag-active";function Hr(e){e.preventDefault()}function mP(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function gP(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function ey(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(x){var b=t.viewbox(),E=t._container.getBoundingClientRect();return{x:b.x+(x.x-E.left)/b.scale,y:b.y+(x.y-E.top)/b.scale}}function c(x,b){b=b||o;var E=e.createEvent(O({},b.payload,b.data,{isTouch:b.isTouch}));return e.fire("drag."+x,E)===!1?!1:e.fire(b.prefix+"."+x,E)}function s(x){var b=x.filter(function(E){return i.get(E.id)});b.length&&n.select(b)}function u(x,b){var E=o.payload,T=o.displacement,L=o.globalStart,A=jr(x),F=ii(A,L),H=o.localStart,N=a(A),V=ii(N,H);if(!o.active&&(b||gP(F)>o.threshold)){if(O(E,{x:Eo(H.x+T.x),y:Eo(H.y+T.y),dx:0,dy:0},{originalEvent:x}),c("start")===!1)return g();o.active=!0,o.keepSelection||(E.previousSelection=n.get(),n.select(null)),o.cursor&&cc(o.cursor),t.addMarker(t.getRootElement(),Jg)}Kl(x),o.active&&(O(E,{x:Eo(N.x+T.x),y:Eo(N.y+T.y),dx:Eo(V.x),dy:Eo(V.y)},{originalEvent:x}),c("move"))}function l(x){var b,E=!0;o.active&&(x&&(o.payload.originalEvent=x,Kl(x)),E=c("end")),E===!1&&c("rejected"),b=R(E!==!0),c("ended",b)}function p(x){Bt("Escape",x)&&(Hr(x),g())}function f(x){var b;o.active&&(b=Zg(e),setTimeout(b,400),Hr(x)),l(x)}function d(x){u(x)}function h(x){var b=o.payload;b.hoverGfx=x.gfx,b.hover=x.element,c("hover")}function m(x){c("out");var b=o.payload;b.hoverGfx=null,b.hover=null}function g(x){var b;if(o){var E=o.active;E&&c("cancel"),b=R(x),E&&c("canceled",b)}}function R(x){var b,E;c("cleanup"),Xg(),o.trapClick?E=f:E=l,Re.unbind(document,"mousemove",u),Re.unbind(document,"dragstart",Hr),Re.unbind(document,"selectstart",Hr),Re.unbind(document,"mousedown",E,!0),Re.unbind(document,"mouseup",E,!0),Re.unbind(document,"keyup",p),Re.unbind(document,"touchstart",d,!0),Re.unbind(document,"touchcancel",g,!0),Re.unbind(document,"touchmove",u,!0),Re.unbind(document,"touchend",l,!0),e.off("element.hover",h),e.off("element.out",m),t.removeMarker(t.getRootElement(),Jg);var T=o.payload.previousSelection;return x!==!1&&T&&!n.get().length&&s(T),b=o,o=null,b}function w(x,b,E,T){o&&g(!1),typeof b=="string"&&(T=E,E=b,b=null),T=O({},r,T||{});var L=T.data||{},A,F,H,N,V;if(T.trapClick?N=f:N=l,x?(A=bo(x)||x,F=jr(x),Kl(x),A.type==="dragstart"&&Hr(A)):(A=null,F={x:0,y:0}),H=a(F),b||(b=H),V=mP(A),o=O({prefix:E,data:L,payload:{},globalStart:F,displacement:ii(b,H),localStart:H,isTouch:V},T),T.manual||(V?(Re.bind(document,"touchstart",d,!0),Re.bind(document,"touchcancel",g,!0),Re.bind(document,"touchmove",u,!0),Re.bind(document,"touchend",l,!0)):(Re.bind(document,"mousemove",u),Re.bind(document,"dragstart",Hr),Re.bind(document,"selectstart",Hr),Re.bind(document,"mousedown",N,!0),Re.bind(document,"mouseup",N,!0)),Re.bind(document,"keyup",p),e.on("element.hover",h),e.on("element.out",m)),c("init")===!1)return g(),!1;T.autoActivate&&u(x,!0)}e.on("diagram.destroy",g),this.init=w,this.move=u,this.hover=h,this.out=m,this.end=l,this.cancel=g,this.context=function(){return o},this.setOptions=function(x){O(r,x)}}ey.$inject=["eventBus","canvas","selection","elementRegistry"];const Ii={__depends__:[QC,Un],dragging:["type",ey]};function So(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}So.prototype.next=function(){return this._prefix+ ++this._counter};const yP=new So("ps");var vP=["marker-start","marker-mid","marker-end"],_P=["circle","ellipse","line","path","polygon","polyline","path","rect"];function cr(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}cr.$inject=["elementRegistry","eventBus","canvas","styles"],cr.prototype.cleanUp=function(){console.warn("PreviewSupport#cleanUp is deprecated and will be removed in future versions. You do not need to manually clean up previews anymore. cf. https://github.com/bpmn-io/diagram-js/pull/906")},cr.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},cr.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=dh(n);return this._cloneMarkers(Nr(r),i),re(r,this._styles.cls(i,[])),Ce(t,r),re(r,"data-preview-support-element-id",e.id),r},cr.prototype.addFrame=function(e,t){var n=me("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return Ce(t,n),re(n,"data-preview-support-element-id",e.id),n},cr.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),EP(e)&&vP.forEach(function(r){if(re(e,r)){var o=bP(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},cr.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,yP.next()].join("-"),a=tt("marker#"+n.id,e);e=e||this._canvas._svg;var c=a||dh(n);c.id=o,Fe(c).add(r);var s=tt(":scope > defs",e);s||(s=me("defs"),Ce(e,s)),Ce(s,c);var u=wP(c.id);re(t,i,u)};function bP(e,t,n){var i=xP(re(e,t));return tt("marker#"+i,n||document)}function xP(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function wP(e){return"url(#"+e+")"}function EP(e){return _P.indexOf(e.nodeName)!==-1}const Ro={__init__:["previewSupport"],previewSupport:["type",cr]};var SP="drop-ok",ty="drop-not-ok",ny="attach-ok",iy="new-parent",ry="create",RP=2e3;function oy(e,t,n,i,r){function o(s,u,l,p,f){if(!u)return!1;s=Le(s,function(w){var x=w.labelTarget;return!w.parent&&!(Me(w)&&s.indexOf(x)!==-1)});var d=ot(s,function(w){return!nt(w)}),h=!1,m=!1,g=!1;sy(s)&&(h=r.allowed("shape.attach",{position:l,shape:d,target:u})),h||(sy(s)?g=r.allowed("shape.create",{position:l,shape:d,source:p,target:u}):g=r.allowed("elements.create",{elements:s,position:l,target:u}));var R=f.connectionTarget;return g||h?(d&&p&&(m=r.allowed("connection.create",{source:R===p?d:p,target:R===p?p:d,hints:{targetParent:u,targetAttach:h}})),{attach:h,connect:m}):g===null||h===null?null:!1}function a(s,u){[ny,SP,ty,iy].forEach(function(l){l===u?e.addMarker(s,l):e.removeMarker(s,l)})}n.on(["create.move","create.hover"],function(s){var u=s.context,l=u.elements,p=s.hover,f=u.source,d=u.hints||{};if(!p){u.canExecute=!1,u.target=null;return}ay(s);var h={x:s.x,y:s.y},m=u.canExecute=p&&o(l,p,h,f,d);p&&m!==null&&(u.target=p,m&&m.attach?a(p,ny):a(p,m?iy:ty))}),n.on(["create.end","create.out","create.cleanup"],function(s){var u=s.hover;u&&a(u,null)}),n.on("create.end",function(s){var u=s.context,l=u.source,p=u.shape,f=u.elements,d=u.target,h=u.canExecute,m=h&&h.attach,g=h&&h.connect,R=u.hints||{};if(h===!1||!d)return!1;ay(s);var w={x:s.x,y:s.y};g?p=i.appendShape(l,p,w,d,{attach:m,connection:g===!0?{}:g,connectionTarget:R.connectionTarget}):(f=i.createElements(f,w,d,O({},R,{attach:m})),p=ot(f,function(x){return!nt(x)})),O(u,{elements:f,shape:p}),O(s,{elements:f,shape:p})});function c(){var s=t.context();s&&s.prefix===ry&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",c),n.once(["create.cancel","create.end"],RP,function(){n.off("elements.changed",c)})}),this.start=function(s,u,l){ve(u)||(u=[u]);var p=ot(u,function(h){return!nt(h)});if(p){l=O({elements:u,hints:{},shape:p},l||{}),M(u,function(h){we(h.x)||(h.x=0),we(h.y)||(h.y=0)});var f=Le(u,function(h){return!h.hidden}),d=Ct(f);M(u,function(h){nt(h)&&(h.waypoints=rn(h.waypoints,function(m){return{x:m.x-d.x-d.width/2,y:m.y-d.y-d.height/2}})),O(h,{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2})}),t.init(s,ry,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:u,context:l}})}}}oy.$inject=["canvas","dragging","eventBus","modeling","rules"];function ay(e){var t=e.context,n=t.createConstraints;n&&(n.left&&(e.x=Math.max(e.x,n.left)),n.right&&(e.x=Math.min(e.x,n.right)),n.top&&(e.y=Math.max(e.y,n.top)),n.bottom&&(e.y=Math.min(e.y,n.bottom)))}function sy(e){return e&&e.length===1&&!nt(e[0])}var CP=750;function cy(e,t,n,i,r){function o(a){var c=me("g");re(c,r.cls("djs-drag-group",["no-events"]));var s=me("g");return a.forEach(function(u){var l;u.hidden||(u.waypoints?(l=n._createContainer("connection",s),n.drawConnection(Nr(l),u)):(l=n._createContainer("shape",s),n.drawShape(Nr(l),u),Xt(l,u.x,u.y)),i.addDragger(u,c,l))}),c}t.on("create.move",CP,function(a){var c=a.hover,s=a.context,u=s.elements,l=s.dragGroup;l||(l=s.dragGroup=o(u));var p;c?(l.parentNode||(p=e.getActiveLayer(),Ce(p,l)),Xt(l,a.x,a.y)):Nt(l)}),t.on("create.cleanup",function(a){var c=a.context,s=c.dragGroup;s&&Nt(s)})}cy.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const uc={__depends__:[Ii,Ro,yi,Un],__init__:["create","createPreview"],create:["type",oy],createPreview:["type",cy]};function yp(e){var t=this;this._lastMoveEvent=null;function n(i){t._lastMoveEvent=i}e.on("canvas.init",function(i){var r=t._svg=i.svg;r.addEventListener("mousemove",n)}),e.on("canvas.destroy",function(){t._lastMouseEvent=null,t._svg.removeEventListener("mousemove",n)})}yp.$inject=["eventBus"],yp.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||PP(0,0)};function PP(e,t){var n=document.createEvent("MouseEvent"),i=e,r=t,o=e,a=t;return n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,i,r,o,a,!1,!1,!1,!1,0,null),n}const ha={__init__:["mouse"],mouse:["type",yp]};var uy=2e3;function Tn(e,t,n,i,r,o,a,c){this._canvas=e,this._create=t,this._elementFactory=i,this._eventBus=r,this._modeling=o,this._mouse=a,this._rules=c,r.on("copyPaste.copyElement",function(s){var u=s.descriptor,l=s.element,p=s.elementsSet;u.priority=1,u.id=l.id,p.has(l.parent)&&(u.parent=l.parent.id),AP(l)&&(u.priority=2,u.host=l.host.id),nt(l)&&(u.priority=3,u.source=l.source.id,u.target=l.target.id,u.waypoints=TP(l)),Me(l)&&(u.priority=4,u.labelTarget=l.labelTarget.id),M(["x","y","width","height"],function(f){we(l[f])&&(u[f]=l[f])}),u.hidden=l.hidden,u.collapsed=l.collapsed}),r.on("copyPaste.elementsCopied",uy,function(s){var u;((u=s.hints)==null?void 0:u.clip)!==!1&&n.set(s.tree)}),r.on("copyPaste.pasteElements",uy,function(s){s.tree||(s.tree=n.get())}),r.on("copyPaste.pasteElements",function(s){var u=s.hints;O(u,{createElementsBehavior:!1})})}Tn.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],Tn.prototype.copy=function(e,t={}){var n,i;return ve(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(ve(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},Tn.prototype.paste=function(e={}){var t=this._eventBus.createEvent({type:"copyPaste.pasteElements",hints:{},...e}),n=this._eventBus.fire(t);if(n!==!1){var i=t.tree;if(i){var r=t.hints,o=this._createElements(i);if(t.element&&t.point)return this._paste(o,t.element,t.point,r);this._create.start(this._mouse.getLastMoveEvent(),o,{hints:r})}}},Tn.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},Tn.prototype.cut=function(e){var t=this.copy(e),n=this._getElementIdsFromTree(t),i=e.filter(function(r){return n[r.id]});return i.length>0&&this._modeling.removeElements(i),t},Tn.prototype._getElementIdsFromTree=function(e){var t={};return M(e,function(n){M(n,function(i){i.id&&(t[i.id]=!0)})}),t},Tn.prototype._paste=function(e,t,n,i){M(e,function(o){we(o.x)||(o.x=0),we(o.y)||(o.y=0)});var r=Ct(e);return M(e,function(o){nt(o)&&(o.waypoints=rn(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),O(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,O({},i))},Tn.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return M(e,function(o,a){o=ai(o,"priority"),M(o,function(c){var s=O({},si(c,["priority"]));i[c.parent]?s.parent=i[c.parent]:delete s.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:s});var u;if(nt(s)){s.source=i[c.source],s.target=i[c.target],u=i[c.id]=t.createConnection(s),r.push(u);return}if(Me(s)){s.labelTarget=i[s.labelTarget],u=i[c.id]=t.createLabel(s),r.push(u);return}s.host&&(s.host=i[s.host]),u=i[c.id]=t.createShape(s),r.push(u)})}),r},Tn.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(si(e,["id"]));return t},Tn.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(si(e,["id"]));return t},Tn.prototype.createShape=function(e){var t=this._elementFactory.createShape(si(e,["id"]));return t},Tn.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(nt(e)&&(!n.has(e.source)||!n.has(e.target))||Me(e)&&!n.has(e.labelTarget))},Tn.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=xs(e);function c(p,f){return t.allowed("element.copy",{element:p,elements:f})}function s(p,f){var d=o.get(p);if(!d){var h={element:p,depth:f};r.push(h),o.set(p,h);return}if(d.depth<f){r=u(d,r);var m={element:d.element,depth:f};r.push(m),o.set(p,m)}}function u(p,f){var d=f.indexOf(p);return d!==-1&&f.splice(d,1),f}Ir(a,function(p,f,d){if(Me(p))return;M(p.labels,function(g){s(g,d)});function h(g){g&&g.length&&M(g,function(R){M(R.labels,function(w){s(w,d)}),s(R,d)})}M([p.attachers,p.incoming,p.outgoing],h),s(p,d);var m=[];return p.children&&(m=p.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:p,children:m}),m}),e=rn(r,function(p){return p.element});var l=new Set(e);return r=rn(r,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:l}),p}),r=ai(r,function(p){return p.descriptor.priority}),e=rn(r,function(p){return p.element}),M(r,function(p){var f=p.depth;if(!n.hasRelations(p.element,e,l)){py(p.element,e),l.delete(p.element);return}if(!c(p.element,e)){py(p.element,e),l.delete(p.element);return}i[f]||(i[f]=[]),i[f].push(p.descriptor)}),i};function AP(e){return!!e.host}function TP(e){return rn(e.waypoints,function(t){return t=ly(t),t.original&&(t.original=ly(t.original)),t})}function ly(e){return O({},e)}function py(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const MP={__depends__:[XC,uc,ha,yi],__init__:["copyPaste"],copyPaste:["type",Tn]};function vp(e,t,n){ve(n)||(n=[n]),M(n,function(i){Cr(e[i])||(t[i]=e[i])})}var _p=750;function fy(e,t,n){function i(s,u){var l=e.create(s.$type);return n.copyElement(s,l,null,u)}t.on("copyPaste.copyElement",_p,function(s){var u=s.descriptor,l=s.element,p=Z(l);if(Me(l))return u;var f=u.businessObject=i(p,!0),d=u.di=i(ze(l),!0);d.bpmnElement=f,vp(f,u,"name"),vp(d,u,"isExpanded"),p.default&&(u.default=p.default.id)});var r="-bpmn-js-refs";function o(s){return s[r]=s[r]||{}}function a(s,u){s[r]=u}function c(s,u,l){var p=Z(s);return s.default&&(l[s.default]={element:p,property:"default"}),s.host&&(Z(s).attachedToRef=Z(u[s.host])),si(l,En(l,function(f,d,h){var m=d.element,g=d.property;return h===s.id&&(m.set(g,p),f.push(s.id)),f},[]))}t.on("copyPaste.pasteElement",function(s){var u=s.cache,l=s.descriptor,p=l.businessObject,f=l.di;if(Me(l)){l.businessObject=Z(u[l.labelTarget]),l.di=ze(u[l.labelTarget]);return}p=l.businessObject=i(p),f=l.di=i(f),f.bpmnElement=p,vp(l,p,["isExpanded","name"]),l.type=p.$type}),t.on("copyPaste.copyElement",_p,function(s){var u=s.descriptor,l=s.element;if(v(l,"bpmn:Participant")){var p=Z(l);p.processRef&&(u.processRef=i(p.processRef,!0))}}),t.on("copyPaste.pasteElement",function(s){var u=s.descriptor,l=u.processRef;l&&(u.processRef=i(l))}),t.on("copyPaste.createTree",function(s){var u=s.element,l=s.children;v(u,"bpmn:SubProcess")&&M(ta(l),p=>{l.push(p.annotation)})}),t.on("copyPaste.pasteElement",_p,function(s){var u=s.cache,l=s.descriptor;a(u,c(l,u,o(u)))})}fy.$inject=["bpmnFactory","eventBus","moddleCopy"];const kP=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],DP=["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 ai(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,c=Ht(r)&&r.$descriptor;if(a&&DP.includes(a))return o;if(a&&kP.includes(a)||a&&c&&!ot(c.properties,to({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&&!ve(n)&&(n=[n]),n=n||bp(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(ve(r)&&(n=r),M(n,o=>{let a;wn(e,o)&&(a=e.get(o));const c=this.copyProperty(a,t,o,i);!Lt(c)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:c,propertyName:o})===!1||t.set(o,c)})),t},ma.prototype.copyProperty=function(e,t,n,i=!1){let r=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n,clone:i});if(r===!1)return;if(r)return 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):ve(e)?En(e,(a,c)=>{const s=this.copyProperty(c,t,n,i);return s?a.concat(s):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},ma.prototype._copyId=function(e,t,n=!1){if(n)return e;if(!this._moddle.ids.assigned(e))return this._moddle.ids.claim(e,t),e};function bp(e,t){return En(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const dy={__depends__:[MP],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",fy],moddleCopy:["type",ma]};var hy=Math.round;function xp(e,t){this._modeling=e,this._eventBus=t}xp.$inject=["modeling","eventBus"],xp.prototype.replaceElement=function(e,t,n){if(e.waypoints)return null;var i=this._modeling,r=this._eventBus;r.fire("replace.start",{element:e,attrs:t,hints:n});var o=t.width||e.width,a=t.height||e.height,c=t.x||e.x,s=t.y||e.y,u=hy(c+o/2),l=hy(s+a/2),p=i.replaceShape(e,O({},t,{x:u,y:l,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:p,hints:n}),p};function my(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}my.$inject=["selection","eventBus"];const OP={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",my],replace:["type",xp]};function LP(e,t,n){ve(n)||(n=[n]),M(n,function(i){Cr(e[i])||(t[i]=e[i])})}var IP=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function NP(e,t){var n=e&&wn(e,"collapsed")?e.collapsed:!$e(e),i;return t&&(wn(t,"collapsed")||wn(t,"isExpanded"))?i=wn(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function gy(e,t,n,i,r,o){function a(c,s,u){u=u||{};var l=s.type,p=c.businessObject;if(lc(p)&&(l==="bpmn:SubProcess"||l==="bpmn:AdHocSubProcess")&&NP(c,s))return i.toggleCollapse(c),c;var f=e.create(l),d={type:l,businessObject:f};d.di={},l==="bpmn:ExclusiveGateway"&&(d.di.isMarkerVisible=!0),LP(c.di,d.di,["fill","stroke","background-color","border-color","color"]);var h=bp(p.$descriptor),m=bp(f.$descriptor,!0),g=BP(h,m);O(f,ni(s,IP));var R=Le(g,function(b){return b==="eventDefinitions"?yy(c,s.eventDefinitionType):b==="loopCharacteristics"?!cn(f):wn(f,b)||b==="processRef"&&s.isExpanded===!1||b==="triggeredByEvent"?!1:b==="isForCompensation"?!cn(f):!0});if(f=n.copyElement(p,f,R),s.eventDefinitionType&&(yy(f,s.eventDefinitionType)||(d.eventDefinitionType=s.eventDefinitionType,d.eventDefinitionAttrs=s.eventDefinitionAttrs)),v(p,"bpmn:Activity")){if(lc(p))d.isExpanded=$e(c);else if(s&&wn(s,"isExpanded")){d.isExpanded=s.isExpanded;var w=t.getDefaultSize(f,{isExpanded:d.isExpanded});d.width=w.width,d.height=w.height,d.x=c.x-(d.width-c.width)/2,d.y=c.y-(d.height-c.height)/2}$e(c)&&!v(p,"bpmn:Task")&&d.isExpanded&&(d.width=c.width,d.height=c.height)}if(lc(p)&&!lc(f)&&(u.moveChildren=!1),v(p,"bpmn:Participant")){s.isExpanded===!0?f.processRef=e.create("bpmn:Process"):u.moveChildren=!1;var x=Gt(c);ze(c).isHorizontal||(ze(d).isHorizontal=x),d.width=x?c.width:t.getDefaultSize(d).width,d.height=x?t.getDefaultSize(d).height:c.height}return o.allowed("shape.resize",{shape:f})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),f.name=p.name,De(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&De(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(f.default=p.default),s.host&&!v(p,"bpmn:BoundaryEvent")&&v(f,"bpmn:BoundaryEvent")&&(d.host=s.host),(d.type==="bpmn:DataStoreReference"||d.type==="bpmn:DataObjectReference")&&(d.x=c.x+(c.width-d.width)/2),r.replaceElement(c,d,{...u,targetElement:s})}this.replaceElement=a}gy.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function lc(e){return v(e,"bpmn:SubProcess")}function yy(e,t){var n=Z(e);return t&&n.get("eventDefinitions").some(function(i){return v(i,t)})}function BP(e,t){return e.filter(function(n){return t.includes(n)})}const vy={__depends__:[dy,OP,Un],bpmnReplace:["type",gy]};var $P=250;function zr(e){this._eventBus=e,this._tools=[],this._active=null}zr.$inject=["eventBus"],zr.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)},zr.prototype.isActive=function(e){return e&&this._active===e},zr.prototype.length=function(e){return this._tools.length},zr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},zr.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,$P,function(r){this._active&&(jP(r)||this.setActive(null))},this)};function jP(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Or(t,'.group[data-group="tools"]')}const pc={__depends__:[Ii],__init__:["toolManager"],toolManager:["type",zr]};function FP(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 HP(e,t){var n=[],i=new Set(e);M(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,c=o.outgoing;M(a.concat(c),function(s){var u=s.source,l=s.target;(i.has(u)||i.has(l))&&(r.has(s)||(r.add(s),n.push(s)))})}),n}function zP(e,t,n){var i=e.x,r=e.y,o=e.width,a=e.height,c=n.x,s=n.y;switch(t){case"n":return{x:i,y:r+s,width:o,height:a-s};case"s":return{x:i,y:r,width:o,height:a+s};case"w":return{x:i+c,y:r,width:o-c,height:a};case"e":return{x:i,y:r,width:o+c,height:a};default:throw new Error("unknown direction: "+t)}}var wp=Math.abs,VP=Math.round,Ni={x:"width",y:"height"},_y="crosshair",ur={n:"top",w:"left",s:"bottom",e:"right"},GP=1500,fc={n:"s",w:"e",s:"n",e:"w"},dc=20;function Yn(e,t,n,i,r,o,a){this._canvas=e,this._dragging=t,this._eventBus=n,this._modeling=i,this._rules=r,this._toolManager=o,this._mouse=a;var c=this;o.registerTool("space",{tool:"spaceTool.selection",dragging:"spaceTool"}),n.on("spaceTool.selection.end",function(s){n.once("spaceTool.selection.ended",function(){c.activateMakeSpace(s.originalEvent)})}),n.on("spaceTool.move",GP,function(s){var u=s.context,l=u.initialized;l||(l=u.initialized=c.init(s,u)),l&&xy(s)}),n.on("spaceTool.end",function(s){var u=s.context,l=u.axis,p=u.direction,f=u.movingShapes,d=u.resizingShapes,h=u.start;if(u.initialized){xy(s);var m={x:0,y:0};m[l]=VP(s["d"+l]),c.makeSpace(f,d,m,p,h),n.once("spaceTool.ended",function(g){c.activateSelection(g.originalEvent,!0,!0)})}})}Yn.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Yn.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:_y,data:{context:{reactivate:n}},trapClick:!1})},Yn.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:_y,data:{context:{}}})},Yn.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},Yn.prototype.init=function(e,t){var n=wp(e.dx)>wp(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(wp(i)<5)return!1;i<0&&(i*=-1),pa(e)&&(i*=-1);var o=FP(n,i),a=this._canvas.getRootElement();!ec(e)&&e.hover&&(a=e.hover);var c=[...Ko(a),...a.attachers||[]],s=this.calculateAdjustments(c,n,i,r),u=this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:s.resizingShapes,start:r}),l=WP(s,n,o,r,u);return O(t,s,{axis:n,direction:o,spaceToolConstraints:l,start:r}),cc("resize-"+(n==="x"?"ew":"ns")),!0},Yn.prototype.calculateAdjustments=function(e,t,n,i){var r=this._rules,o=[],a=[],c=new Set,s=new Set,u=[],l=[];function p(d){c.has(d)||(c.add(d),o.push(d));var h=d.label;h&&!c.has(h)&&(c.add(h),o.push(h))}function f(d){s.has(d)||(s.add(d),a.push(d))}return M(e,function(d){if(!(!d.parent||Me(d))){if(nt(d)){l.push(d);return}var h=d[t],m=h+d[Ni[t]];if(UP(d)&&(n>0&&_e(d)[t]>i||n<0&&_e(d)[t]<i)){u.push(d);return}if(n>0&&h>i||n<0&&m<i){p(d);return}if(h<i&&m>i&&r.allowed("shape.resize",{shape:d})){f(d);return}}}),M(o,function(d){var h=d.attachers;h&&M(h,function(m){p(m)})}),M(u,function(d){var h=d.host;(c.has(h)||s.has(h))&&p(d)}),M(l,function(d){var h=d.source,m=d.target,g=d.label;(c.has(h)||s.has(h))&&(c.has(m)||s.has(m))&&g&&p(g)}),{movingShapes:o,resizingShapes:a}},Yn.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Yn.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function by(e){return{top:e.top-dc,right:e.right+dc,bottom:e.bottom+dc,left:e.left-dc}}function xy(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;we(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),we(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),we(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),we(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function WP(e,t,n,i,r){var o=e.movingShapes,a=e.resizingShapes;if(a.length){var c={},s,u,l=new Set(o),p=new Set(a);return M(a,function(f){var d=f.attachers,h=f.children,m=ye(f),g=Le(h,function(V){return!nt(V)&&!Me(V)&&!l.has(V)&&!p.has(V)}),R=Le(h,function(V){return!nt(V)&&!Me(V)&&l.has(V)}),w,x,b,E=[],T=[],L,A,F,H;g.length&&(x=by(ye(Ct(g))),w=i-m[ur[n]]+x[ur[n]],n==="n"?c.bottom=u=we(u)?Math.min(u,w):w:n==="w"?c.right=u=we(u)?Math.min(u,w):w:n==="s"?c.top=s=we(s)?Math.max(s,w):w:n==="e"&&(c.left=s=we(s)?Math.max(s,w):w)),R.length&&(b=by(ye(Ct(R))),w=i-b[ur[fc[n]]]+m[ur[fc[n]]],n==="n"?c.bottom=u=we(u)?Math.min(u,w):w:n==="w"?c.right=u=we(u)?Math.min(u,w):w:n==="s"?c.top=s=we(s)?Math.max(s,w):w:n==="e"&&(c.left=s=we(s)?Math.max(s,w):w)),d&&d.length&&(d.forEach(function(V){l.has(V)?E.push(V):T.push(V)}),E.length&&(L=ye(Ct(E.map(_e))),A=m[ur[fc[n]]]-(L[ur[fc[n]]]-i)),T.length&&(F=ye(Ct(T.map(_e))),H=F[ur[n]]-(m[ur[n]]-i)),n==="n"?(w=Math.min(A||1/0,H||1/0),c.bottom=u=we(u)?Math.min(u,w):w):n==="w"?(w=Math.min(A||1/0,H||1/0),c.right=u=we(u)?Math.min(u,w):w):n==="s"?(w=Math.max(A||-1/0,H||-1/0),c.top=s=we(s)?Math.max(s,w):w):n==="e"&&(w=Math.max(A||-1/0,H||-1/0),c.left=s=we(s)?Math.max(s,w):w));var N=r&&r[f.id];N&&(n==="n"?(w=i+f[Ni[t]]-N[Ni[t]],c.bottom=u=we(u)?Math.min(u,w):w):n==="w"?(w=i+f[Ni[t]]-N[Ni[t]],c.right=u=we(u)?Math.min(u,w):w):n==="s"?(w=i-f[Ni[t]]+N[Ni[t]],c.top=s=we(s)?Math.max(s,w):w):n==="e"&&(w=i-f[Ni[t]]+N[Ni[t]],c.left=s=we(s)?Math.max(s,w):w))}),c}}function UP(e){return!!e.host}var Ep="djs-dragging",wy="djs-resizing",YP=250,hc=Math.max;function Ey(e,t,n,i,r){function o(a,c){M(a,function(s){r.addDragger(s,c),n.addMarker(s,Ep)})}e.on("spaceTool.selection.start",function(a){var c=n.getLayer("space"),s=a.context,u={x:"M 0,-10000 L 0,10000",y:"M -10000,0 L 10000,0"},l=me("g");re(l,i.cls("djs-crosshair-group",["no-events"])),Ce(c,l);var p=me("path");re(p,"d",u.x),Fe(p).add("djs-crosshair"),Ce(l,p);var f=me("path");re(f,"d",u.y),Fe(f).add("djs-crosshair"),Ce(l,f),s.crosshairGroup=l}),e.on("spaceTool.selection.move",function(a){var c=a.context.crosshairGroup;Xt(c,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var c=a.context,s=c.crosshairGroup;s&&Nt(s)}),e.on("spaceTool.move",YP,function(a){var c=a.context,s=c.line,u=c.axis,l=c.movingShapes,p=c.resizingShapes;if(c.initialized){if(!c.dragGroup){var f=n.getLayer("space");s=me("path"),re(s,"d","M0,0 L0,0"),Fe(s).add("djs-crosshair"),Ce(f,s),c.line=s;var d=me("g");re(d,i.cls("djs-drag-group",["no-events"])),Ce(n.getActiveLayer(),d),o(l,d);var h=new Set(l);M(p,function(T){h.add(T)});var m=new Set,g=c.movingConnections=[];h.forEach(function(T){M(T.outgoing,function(L){m.has(L)||!nt(L)||!h.has(L.target)||(m.add(L),g.push(L))})}),o(g,d),c.dragGroup=d}if(!c.frameGroup){var R=me("g");re(R,i.cls("djs-frame-group",["no-events"])),Ce(n.getActiveLayer(),R);var w=[];M(p,function(T){var L=r.addFrame(T,R),A=L.getBBox();w.push({element:L,initialBounds:A}),n.addMarker(T,wy)}),c.frameGroup=R,c.frames=w}var x={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};re(s,{d:x[u]});var b={x:"y",y:"x"},E={x:a.dx,y:a.dy};E[b[c.axis]]=0,Xt(c.dragGroup,E.x,E.y),M(c.frames,function(T){var L=T.element,A=T.initialBounds,F,H;c.direction==="e"?re(L,{width:hc(A.width+E.x,5)}):(F=hc(A.width-E.x,5),re(L,{width:F,x:A.x+A.width-F})),c.direction==="s"?re(L,{height:hc(A.height+E.y,5)}):(H=hc(A.height-E.y,5),re(L,{height:H,y:A.y+A.height-H}))})}}),e.on("spaceTool.cleanup",function(a){var c=a.context,s=c.movingShapes,u=c.movingConnections,l=c.resizingShapes,p=c.line,f=c.dragGroup,d=c.frameGroup;M(s,function(h){n.removeMarker(h,Ep)}),M(u,function(h){n.removeMarker(h,Ep)}),f&&(Nt(p),Nt(f)),M(l,function(h){n.removeMarker(h,wy)}),d&&Nt(d)})}Ey.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const qP={__init__:["spaceToolPreview"],__depends__:[Ii,yi,pc,Ro,ha],spaceTool:["type",Yn],spaceToolPreview:["type",Ey]};function mc(e,t){e.invoke(Yn,this),this._canvas=t}mc.$inject=["injector","canvas"],ie(mc,Yn),mc.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=Jr(ao(r.children.filter(u=>v(u,"bpmn:Artifact")),Ct(o))));const c=[...e,...a];var s=Yn.prototype.calculateAdjustments.call(this,c,t,n,i);return s.resizingShapes=s.resizingShapes.filter(function(u){return!(v(u,"bpmn:TextAnnotation")||KP(u)&&(t==="y"&&Gt(u)||t==="x"&&!Gt(u)))}),s};function KP(e){return v(e,"bpmn:Participant")&&!Z(e).processRef}const Sy={__depends__:[qP],spaceTool:["type",mc]};function yt(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)}yt.$inject=["eventBus","injector"],yt.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()},yt.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},yt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},yt.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()}},yt.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()}},yt.prototype.register=function(e,t){this._setHandler(e,t)},yt.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)},yt.prototype.canUndo=function(){return!!this._getUndoAction()},yt.prototype.canRedo=function(){return!!this._getRedoAction()},yt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},yt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},yt.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)})},yt.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},yt.prototype._createId=function(){return this._uid++},yt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},yt.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()},yt.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)},yt.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,n=e.actions,i=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:Gf("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},yt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=ve(e)?e:[e],t.dirty=t.dirty.concat(e))},yt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},yt.prototype._revertedAction=function(e){this._stackIdx--},yt.prototype._getHandler=function(e){return this._handlerMap[e]},yt.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 XP={commandStack:["type",yt]};function lr(e,t){if(typeof t!="function")throw new Error("removeFn iterator must be a function");if(!e)return[];for(var n;n=e[0];)t(n);return e}var ZP=250,Ry=1400;function Sp(e,t,n){K.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",Ry,function(r){var o=r.context,a=o.shapes,c=o.validatedShapes;o.shapes=Cy(a),o.validatedShapes=Cy(c)}),i&&t.on("shape.move.start",ZP,function(r){var o=r.context,a=new Set(o.shapes),c=new Set;for(const s of a)for(const u of s.labels)!u.hidden&&!a.has(u)&&c.add(u),s.labelTarget&&c.add(s);for(const s of c)i.makeDraggable(o,s,!0)}),this.preExecuted("elements.move",Ry,function(r){var o=r.context,a=o.closure,c=a.enclosedElements,s=[];M(c,function(u){M(u.labels,function(l){c[l.id]||s.push(l)})}),a.addAll(s)}),this.preExecute(["connection.delete","shape.delete"],function(r){var o=r.context,a=o.connection||o.shape;lr(a.labels,function(c){n.removeShape(c,{nested:!0})})}),this.execute("shape.delete",function(r){var o=r.context,a=o.shape,c=a.labelTarget;c&&(o.labelTargetIndex=il(c.labels,a),o.labelTarget=c,a.labelTarget=null)}),this.revert("shape.delete",function(r){var o=r.context,a=o.shape,c=o.labelTarget,s=o.labelTargetIndex;c&&(wt(c.labels,a,s),a.labelTarget=c)})}ie(Sp,K),Sp.$inject=["injector","eventBus","modeling"];function Cy(e){var t=new Set(e);return Le(e,function(n){return!t.has(n.labelTarget)})}const QP={__init__:["labelSupport"],labelSupport:["type",Sp]};var JP=251,Py=1401,Ay="attach-ok";function Rp(e,t,n,i,r){K.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",Py,function(a){var c=a.context,s=c.shapes,u=c.validatedShapes;c.shapes=eA(s),c.validatedShapes=tA(u)}),o&&t.on("shape.move.start",JP,function(a){var c=a.context,s=c.shapes,u=Cp(s);M(u,function(l){o.makeDraggable(c,l,!0),M(l.labels,function(p){o.makeDraggable(c,p,!0)})})}),o&&t.on("shape.move.start",function(a){var c=a.context,s=c.shapes;if(s.length===1){var u=s[0],l=u.host;l&&(n.addMarker(l,Ay),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(l,Ay)}))}}),this.preExecuted("elements.move",Py,function(a){var c=a.context,s=c.closure,u=c.shapes,l=Cp(u);M(l,function(p){s.add(p,s.topLevel[p.host.id])})}),this.postExecuted("elements.move",function(a){var c=a.context,s=c.shapes,u=c.newHost,l;u&&s.length!==1||(u?l=s:l=Le(s,function(p){var f=p.host;return nA(p)&&!iA(s,f)}),M(l,function(p){r.updateAttachment(p,u)}))}),this.postExecuted("elements.move",function(a){var c=a.context.shapes;M(c,function(s){M(s.attachers,function(u){M(u.outgoing.slice(),function(l){var p=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});p||r.removeConnection(l)}),M(u.incoming.slice(),function(l){var p=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});p||r.removeConnection(l)})})})}),this.postExecute("shape.create",function(a){var c=a.context,s=c.shape,u=c.host;u&&r.updateAttachment(s,u)}),this.postExecute("shape.replace",function(a){var c=a.context,s=c.oldShape,u=c.newShape;lr(s.attachers,function(l){var p=i.allowed("elements.move",{target:u,shapes:[l]});p==="attach"?r.updateAttachment(l,u):r.removeShape(l)}),u.attachers.length&&M(u.attachers,function(l){var p=Um(l,s,u);r.moveShape(l,p,l.parent)})}),this.postExecute("shape.resize",function(a){var c=a.context,s=c.shape,u=c.oldBounds,l=c.newBounds,p=s.attachers,f=c.hints||{};f.attachSupport!==!1&&M(p,function(d){var h=Um(d,u,l);r.moveShape(d,h,d.parent),M(d.labels,function(m){r.moveShape(m,h,m.parent)})})}),this.preExecute("shape.delete",function(a){var c=a.context.shape;lr(c.attachers,function(s){r.removeShape(s)}),c.host&&r.updateAttachment(c,null)})}ie(Rp,K),Rp.$inject=["injector","eventBus","canvas","rules","modeling"];function Cp(e){return Eu(rn(e,function(t){return t.attachers||[]}))}function eA(e){var t=Cp(e);return Wx("id",e,t)}function tA(e){var t=eo(e,"id");return Le(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function nA(e){return!!e.host}function iA(e,t){return e.indexOf(t)!==-1}const rA={__depends__:[yi],__init__:["attachSupport"],attachSupport:["type",Rp]};function Ty(e,t,n,i){e.on("element.changed",function(r){var o=r.element;(o.parent||o===t.getRootElement())&&(r.gfx=n.getGraphics(o)),r.gfx&&e.fire(xh(o)+".changed",r)}),e.on("elements.changed",function(r){var o=r.elements;o.forEach(function(a){e.fire("element.changed",{element:a})}),i.updateContainments(o)}),e.on("shape.changed",function(r){i.update("shape",r.element,r.gfx)}),e.on("connection.changed",function(r){i.update("connection",r.element,r.gfx)})}Ty.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const Pp={__init__:["changeSupport"],changeSupport:["type",Ty]};function 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",O({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",ni(e,["x","y"]))},qn.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",O({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},qn.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",O({bpmnElement:e},t))};function Mn(e,t,n){K.call(this,e),this._bpmnFactory=t;var i=this;function r(d){var h=d.context,m=h.hints||{},g;!h.cropped&&m.createElementsBehavior!==!1&&(g=h.connection,g.waypoints=n.getCroppedWaypoints(g),h.cropped=!0)}this.executed(["connection.layout","connection.create"],r),this.reverted(["connection.layout"],function(d){delete d.context.cropped});function o(d){var h=d.context;i.updateParent(h.shape||h.connection,h.oldParent)}function a(d){var h=d.context,m=h.shape||h.connection,g=h.parent||h.newParent;i.updateParent(m,g)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],kn(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],kn(a));function c(d){var h=d.context,m=h.oldRoot,g=m.children;M(g,function(R){v(R,"bpmn:BaseElement")&&i.updateParent(R)})}this.executed(["canvas.updateRoot"],c),this.reverted(["canvas.updateRoot"],c);function s(d){var h=d.context.shape;v(h,"bpmn:BaseElement")&&i.updateBounds(h)}this.executed(["shape.move","shape.create","shape.resize"],kn(function(d){d.context.shape.type!=="label"&&s(d)})),this.reverted(["shape.move","shape.create","shape.resize"],kn(function(d){d.context.shape.type!=="label"&&s(d)})),e.on("shape.changed",function(d){d.element.type==="label"&&s({context:{shape:d.element}})});function u(d){i.updateConnection(d.context)}this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],kn(u)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],kn(u));function l(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],kn(l)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],kn(l)),this.executed("connection.reconnect",kn(function(d){var h=d.context,m=h.connection,g=h.oldSource,R=h.newSource,w=Z(m),x=Z(g),b=Z(R);w.conditionExpression&&!De(b,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(h.oldConditionExpression=w.conditionExpression,delete w.conditionExpression),g!==R&&x.default===w&&(h.oldDefault=x.default,delete x.default)})),this.reverted("connection.reconnect",kn(function(d){var h=d.context,m=h.connection,g=h.oldSource,R=h.newSource,w=Z(m),x=Z(g),b=Z(R);h.oldConditionExpression&&(w.conditionExpression=h.oldConditionExpression),h.oldDefault&&(x.default=h.oldDefault,delete b.default)}));function p(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],kn(p)),this.reverted(["element.updateAttachment"],kn(p)),this.executed("element.updateLabel",kn(f)),this.reverted("element.updateLabel",kn(f));function f(d){const{element:h}=d.context,m=Nn(h),g=ze(h),R=g&&g.get("label");ir(h)||tc(h)||(m&&!R?g.set("label",t.create("bpmndi:BPMNLabel")):!m&&R&&g.set("label",void 0))}}ie(Mn,K),Mn.$inject=["eventBus","bpmnFactory","connectionDocking"],Mn.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},Mn.prototype.updateParent=function(e,t){if(!Me(e)&&!(v(e,"bpmn:DataStoreReference")&&e.parent&&v(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=ze(e),o=n&&n.businessObject,a=ze(n);v(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),v(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),v(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(i,o),v(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},Mn.prototype.updateBounds=function(e){var t=ze(e),n=aA(e);if(n){var i=ii(n,t.get("bounds"));O(n,{x:e.x+i.x,y:e.y+i.y})}var r=Me(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),O(o,{x:e.x,y:e.y,width:e.width,height:e.height})},Mn.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;v(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),xt(i,e)),v(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),wt(r,e))}},Mn.prototype.updateDiConnection=function(e,t,n){var i=ze(e),r=ze(t),o=ze(n);i.sourceElement&&i.sourceElement.bpmnElement!==Z(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==Z(n)&&(i.targetElement=n&&o)},Mn.prototype.updateDiParent=function(e,t){if(t&&!v(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(xt(n,e),e.$parent=null)}};function oA(e){for(;e&&!v(e,"bpmn:Definitions");)e=e.$parent;return e}Mn.prototype.getLaneSet=function(e){var t,n;return v(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(v(e,"bpmn:Participant")&&(e=e.processRef),n=e.get("laneSets"),t=n[0],t||(t=this._bpmnFactory.create("bpmn:LaneSet"),t.$parent=e,n.push(t)),t)},Mn.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((v(e,"bpmn:DataInput")||v(e,"bpmn:DataOutput"))&&(v(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(v(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(v(e,"bpmn:FlowElement")){if(t){if(v(t,"bpmn:Participant"))t=t.processRef;else if(v(t,"bpmn:Lane"))do t=t.$parent.$parent;while(v(t,"bpmn:Lane"))}i="flowElements"}else if(v(e,"bpmn:Artifact")){for(;t&&!v(t,"bpmn:Process")&&!v(t,"bpmn:SubProcess")&&!v(t,"bpmn:Collaboration");)if(v(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(v(e,"bpmn:MessageFlow"))i="messageFlows";else if(v(e,"bpmn:Participant")){i="participants";var r=e.processRef,o;r&&(o=oA(e.$parent||t),e.$parent&&(xt(o.get("rootElements"),r),r.$parent=null),t&&(wt(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),xt(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var c=n.get(i);xt(a,e),t&&(c||(c=[],t.set(i,c)),c.push(e))}}},Mn.prototype.updateConnectionWaypoints=function(e){var t=ze(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},Mn.prototype.updateConnection=function(e){var t=e.connection,n=Z(t),i=t.source,r=Z(i),o=t.target,a=Z(t.target),c;if(v(n,"bpmn:DataAssociation"))v(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=r,c=e.parent||e.newParent||a,this.updateSemanticParent(n,a,c)):v(n,"bpmn:DataOutputAssociation")&&(c=e.parent||e.newParent||r,this.updateSemanticParent(n,r,c),n.targetRef=a);else{var s=v(n,"bpmn:SequenceFlow");n.sourceRef!==r&&(s&&(xt(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(s&&(xt(n.targetRef&&n.targetRef.get("incoming"),n),a&&a.get("incoming")&&a.get("incoming").push(n)),n.targetRef=a)}this.updateConnectionWaypoints(t),this.updateDiConnection(t,i,o)},Mn.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function kn(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;v(i,"bpmn:BaseElement")&&e(t)}}function aA(e){if(v(e,"bpmn:Activity")){var t=ze(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function pr(e,t){ki.call(this),this._bpmnFactory=e,this._moddle=t}ie(pr,ki),pr.$inject=["bpmnFactory","moddle"],pr.prototype._baseCreate=ki.prototype.create,pr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,O({type:"label",di:n},Br,t))}return this.createElement(e,t)},pr.prototype.createElement=function(e,t){t=O({},t||{});var n,i=t.businessObject,r=t.di;if(!i){if(!t.type)throw new Error("no shape type specified");i=this._bpmnFactory.create(t.type)}if(!cA(r)){var o=O({},r||{},{id:i.id+"_di"});e==="root"?r=this._bpmnFactory.createDiPlane(i,o):e==="connection"?r=this._bpmnFactory.createDiEdge(i,o):r=this._bpmnFactory.createDiShape(i,o)}v(i,"bpmn:Group")&&(t=O({isFrame:!0},t)),t=sA(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Ap(r,t,"isExpanded")),De(i,["bpmn:Lane","bpmn:Participant"])&&(t=Ap(r,t,"isHorizontal")),v(i,"bpmn:SubProcess")&&(t.collapsed=!$e(i,r)),v(i,"bpmn:ExclusiveGateway")&&(wn(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),Lt(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),Lt(t.cancelActivity)&&(i.cancelActivity=t.cancelActivity,delete t.cancelActivity);var a,c;return t.eventDefinitionType&&(a=i.get("eventDefinitions")||[],c=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),t.eventDefinitionType==="bpmn:ConditionalEventDefinition"&&(c.condition=this._bpmnFactory.create("bpmn:FormalExpression")),a.push(c),c.$parent=i,i.eventDefinitions=a,delete t.eventDefinitionType),n=this.getDefaultSize(i,r),t=O({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},pr.prototype.getDefaultSize=function(e,t){var n=Z(e);if(t=t||ze(e),v(n,"bpmn:SubProcess"))return $e(n,t)?{width:350,height:200}:{width:100,height:80};if(v(n,"bpmn:Task"))return{width:100,height:80};if(v(n,"bpmn:Gateway"))return{width:50,height:50};if(v(n,"bpmn:Event"))return{width:36,height:36};if(v(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return $e(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return v(n,"bpmn:Lane")?{width:400,height:100}:v(n,"bpmn:DataObjectReference")?{width:36,height:50}:v(n,"bpmn:DataStoreReference")?{width:50,height:50}:v(n,"bpmn:TextAnnotation")?{width:100,height:40}:v(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},pr.prototype.createParticipantShape=function(e){return Ht(e)||(e={isExpanded:e}),e=O({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function sA(e,t,n){return M(n,function(i){t=Ap(e,t,i)}),t}function Ap(e,t,n){return t[n]===void 0?t:(e[n]=t[n],si(t,[n]))}function cA(e){return De(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function gc(e,t){this._modeling=e,this._canvas=t}gc.$inject=["modeling","canvas"],gc.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;M(n,function(r){var o={x:0,y:0};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)})},gc.prototype.postExecute=function(e){};function yc(e){this._modeling=e}yc.$inject=["modeling"],yc.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,i=e.shape,r=e.hints||{};i=e.shape=this._modeling.createShape(i,e.position,n,{attach:r.attach}),e.shape=i},yc.prototype.postExecute=function(e){var t=e.hints||{};uA(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 uA(e,t){return Gi(e.outgoing,function(n){return n.target===t})}function vc(e,t){this._canvas=e,this._layouter=t}vc.$inject=["canvas","layouter"],vc.prototype.execute=function(e){var t=e.connection,n=e.source,i=e.target,r=e.parent,o=e.parentIndex,a=e.hints;if(!n||!i)throw new Error("source and target required");if(!r)throw new Error("parent required");return t.source=n,t.target=i,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,a)),this._canvas.addConnection(t,r,o),t},vc.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var _c=Math.round;function Tp(e){this._modeling=e}Tp.$inject=["modeling"],Tp.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;M(t,function(p){we(p.x)||(p.x=0),we(p.y)||(p.y=0)});var c=Le(t,function(p){return!p.hidden}),s=Ct(c);M(t,function(p){nt(p)&&(p.waypoints=rn(p.waypoints,function(f){return{x:_c(f.x-s.x-s.width/2+r.x),y:_c(f.y-s.y-s.height/2+r.y)}})),O(p,{x:_c(p.x-s.x-s.width/2+r.x),y:_c(p.y-s.y-s.height/2+r.y)})});var u=new Set(xs(t)),l={};M(t,function(p){if(nt(p)){l[p.id]=we(i)?a.createConnection(l[p.source.id],l[p.target.id],i,p,p.parent||n,o):a.createConnection(l[p.source.id],l[p.target.id],p,p.parent||n,o);return}var f=O({},o);u.has(p)||(f.autoResize=!1),Me(p)&&(f=si(f,["attach"])),l[p.id]=we(i)?a.createShape(p,ni(p,["x","y","width","height"]),p.parent||n,i,f):a.createShape(p,ni(p,["x","y","width","height"]),p.parent||n,f)}),e.elements=Jr(l)};var My=Math.round;function fr(e){this._canvas=e}fr.$inject=["canvas"],fr.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,r=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?O(t,n):O(t,{x:n.x-My(t.width/2),y:n.y-My(t.height/2)}),this._canvas.addShape(t,i,r),t},fr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function ga(e){fr.call(this,e)}ie(ga,fr),ga.$inject=["canvas"];var lA=fr.prototype.execute;ga.prototype.execute=function(e){var t=e.shape;return fA(t),t.labelTarget=e.labelTarget,lA.call(this,e)};var pA=fr.prototype.revert;ga.prototype.revert=function(e){return e.shape.labelTarget=null,pA.call(this,e)};function fA(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;lr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),lr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},ya.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=il(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},ya.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,wt(n.children,t,i),this._canvas.addConnection(t,n),t};function Mp(e,t){this._modeling=e,this._elementRegistry=t}Mp.$inject=["modeling","elementRegistry"],Mp.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;M(i,function(r){n.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};function va(e,t){this._canvas=e,this._modeling=t}va.$inject=["canvas","modeling"],va.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;lr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),lr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),lr(n.children,function(i){nt(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},va.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=il(i.children,n),t.removeShape(n),n},va.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return wt(i.children,n,r),t.addShape(n,i),n};function bc(e){this._modeling=e}bc.$inject=["modeling"];var ky={x:"y",y:"x"};bc.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(g,R){g.range.min=Math.min(R[i],g.range.min),g.range.max=Math.max(R[i]+R[r],g.range.max)}function a(g){return g[i]+g[r]/2}function c(g){return g.length-1}function s(g){return g.max-g.min}function u(g,R){var w={y:0};w[i]=g-a(R),w[i]&&(w[ky[i]]=0,t.moveElements([R],w,R.parent))}var l=n[0],p=c(n),f=n[p],d,h,m=0;M(n,function(g,R){var w,x,b;if(g.elements.length<2){R&&R!==n.length-1&&(o(g,g.elements[0]),m+=s(g.range));return}w=ai(g.elements,i),x=w[0],R===p&&(x=w[c(w)]),b=a(x),g.range=null,M(w,function(E){if(u(b,E),g.range===null){g.range={min:E[i],max:E[i]+E[r]};return}o(g,E)}),R&&R!==n.length-1&&(m+=s(g.range))}),h=Math.abs(f.range.min-l.range.max),d=Math.round((h-m)/(n.length-1)),!(d<n.length-1)&&M(n,function(g,R){var w={},x;g===l||g===f||(x=n[R-1],g.range.max=0,M(g.elements,function(b,E){w[ky[i]]=0,w[i]=x.range.max-b[i]+d,g.range.min!==b[i]&&(w[i]+=b[i]-g.range.min),w[i]&&t.moveElements([b],w,b.parent),g.range.max=Math.max(b[i]+b[r],E?g.range.max:0)}))})},bc.prototype.postExecute=function(e){};function xc(e,t){this._layouter=e,this._canvas=t}xc.$inject=["layouter","canvas"],xc.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return O(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},xc.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function kp(){}kp.prototype.execute=function(e){var t=e.connection,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldParent=o,e.oldParentIndex=xt(o.children,t),wt(i.children,t,r),t.parent=i,M(t.waypoints,function(a){a.x+=n.x,a.y+=n.y,a.original&&(a.original.x+=n.x,a.original.y+=n.y)}),t},kp.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return xt(n.children,t),wt(i.children,t,r),t.parent=i,M(t.waypoints,function(a){a.x-=o.x,a.y-=o.y,a.original&&(a.original.x-=o.x,a.original.y-=o.y)}),t};function Dp(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Dp.prototype.add=function(e,t){return this.addAll([e],t)},Dp.prototype.addAll=function(e,t){var n=zE(e,!!t,this);return O(this,n),this};function _a(e){this._modeling=e}_a.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},_a.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,a=e.allShapes,c=e.allConnections,s=e.enclosedConnections,u=e.topLevel,l=!1;r&&r.parent===n&&(l=!0),M(a,function(p){o.moveShape(p,t,u[p.id]&&!l&&n,{recurse:!1,layout:!1})}),M(c,function(p){var f=!!a[p.source.id],d=!!a[p.target.id];s[p.id]&&f&&d?o.moveConnection(p,t,u[p.id]&&!l&&n):o.layoutConnection(p,{connectionStart:f&&jl(p,p.source,t),connectionEnd:d&&Fl(p,p.target,t)})})},_a.prototype.getClosure=function(e){return new Dp().addAll(e,!0)};function wc(e){this._helper=new _a(e)}wc.$inject=["modeling"],wc.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},wc.prototype.postExecute=function(e){var t=e.hints,n;t&&t.primaryShape&&(n=t.primaryShape,t.oldParent=n.parent),this._helper.moveClosure(e.closure,e.delta,e.newParent,e.newHost,n)};function Vr(e){this._modeling=e,this._helper=new _a(e)}Vr.$inject=["modeling"],Vr.prototype.execute=function(e){var t=e.shape,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldBounds=ni(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=xt(o.children,t),wt(i.children,t,r),O(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Vr.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;i.layout!==!1&&(M(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:Fl(o,t,n)})}),M(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:jl(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},Vr.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return wt(n.children,t,i),O(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},Vr.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Vr.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 ve(r)&&(e.oldWaypoints=i.waypoints,i.waypoints=r),t&&(e.oldSource=i.source,i.source=t),n&&(e.oldTarget=i.target,i.target=n),i},ba.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,i=e.newTarget,r=e.dockingOrPoints,o=e.hints||{},a={};o.connectionStart&&(a.connectionStart=o.connectionStart),o.connectionEnd&&(a.connectionEnd=o.connectionEnd),o.layoutConnection!==!1&&(n&&(!i||o.docking==="source")&&(a.connectionStart=a.connectionStart||Dy(ve(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||Dy(ve(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},ba.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,i=e.oldWaypoints,r=e.connection;return t&&(r.source=t),n&&(r.target=n),i&&(r.waypoints=i),r};function Dy(e){return e.original||e}function Bi(e,t){this._modeling=e,this._rules=t}Bi.$inject=["modeling","rules"],Bi.prototype.preExecute=function(e){var t=this,n=this._modeling,i=this._rules,r=e.oldShape,o=e.newData,a=e.hints||{},c;function s(h,m,g){return i.allowed("connection.reconnect",{connection:g,source:h,target:m})}var u={x:o.x,y:o.y},l={x:r.x,y:r.y,width:r.width,height:r.height};c=e.newShape=e.newShape||t.createShape(o,u,r.parent,a),r.host&&n.updateAttachment(c,r.host);var p;a.moveChildren!==!1&&(p=r.children.slice(),n.moveElements(p,{x:0,y:0},c,a));var f=r.incoming.slice(),d=r.outgoing.slice();M(f,function(h){var m=h.source,g=s(m,c,h);g&&t.reconnectEnd(h,c,Ks(h,c,l),a)}),M(d,function(h){var m=h.target,g=s(c,m,h);g&&t.reconnectStart(h,c,qs(h,c,l),a)})},Bi.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Bi.prototype.execute=function(e){},Bi.prototype.revert=function(e){},Bi.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},Bi.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},Bi.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function xa(e){this._modeling=e}xa.$inject=["modeling"],xa.prototype.execute=function(e){var t=e.shape,n=e.newBounds,i=e.minBounds;if(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)throw new Error("newBounds must have {x, y, width, height} properties");if(i&&(n.width<i.width||n.height<i.height))throw new Error("width and height cannot be less than minimum height and width");if(!i&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},O(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},xa.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(M(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:Ks(o,n,i)})}),M(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:qs(o,n,i)})}))},xa.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return O(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function dr(e){this._modeling=e}dr.$inject=["modeling"],dr.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,r=e.resizingShapes,o=e.start,a={};this.moveShapes(i,t),M(r,function(c){a[c.id]=hA(c)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(HP(i,r),t,n,o,i,r,a)},dr.prototype.execute=function(){},dr.prototype.revert=function(){},dr.prototype.moveShapes=function(e,t){var n=this;M(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},dr.prototype.resizeShapes=function(e,t,n){var i=this;M(e,function(r){var o=zP(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},dr.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var c=this,s=new Set(r),u=new Set(o);M(e,function(l){var p=l.source,f=l.target,d=dA(l),h=Ly(n),m={},g=s.has(p)||u.has(p),R=s.has(f)||u.has(f);g&&R?(d=rn(d,function(w){return Iy(w,i,n)&&(w[h]=w[h]+t[h]),w.original&&Iy(w.original,i,n)&&(w.original[h]=w.original[h]+t[h]),w}),c._modeling.updateWaypoints(l,d,{labelBehavior:!1})):(g||R)&&(s.has(p)?m.connectionStart=jl(l,p,t):s.has(f)?m.connectionEnd=Fl(l,f,t):u.has(p)?m.connectionStart=qs(l,p,a[p.id]):u.has(f)&&(m.connectionEnd=Ks(l,f,a[f.id])),c._modeling.layoutConnection(l,m))})};function Oy(e){return O({},e)}function dA(e){return rn(e.waypoints,function(t){return t=Oy(t),t.original&&(t.original=Oy(t.original)),t})}function Ly(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function Iy(e,t,n){var i=Ly(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function hA(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Ec(e){this._modeling=e}Ec.$inject=["modeling"],Ec.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=Ny(n),t.collapsed=!t.collapsed;var i=By(n,t.collapsed);return[t].concat(i)},Ec.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=$y(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function Ny(e){var t={};return M(e,function(n){t[n.id]=n.hidden,n.children&&(t=O({},t,Ny(n.children)))}),t}function By(e,t){var n=[];return M(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(By(i.children,i.collapsed||t)))}),n}function $y(e,t){var n=[];return M(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat($y(i.children,t)))}),n}function Sc(e){this._modeling=e}Sc.$inject=["modeling"],Sc.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=jy(i,t),Fy(n,t),t.host=n,t},Sc.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,jy(n,t),Fy(i,t,r),t};function jy(e,t){return xt(e&&e.attachers,t)}function Fy(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),wt(i,t,n)}}function Op(){}Op.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},Op.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function it(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}it.$inject=["eventBus","elementFactory","commandStack"],it.prototype.getHandlers=function(){return{"shape.append":yc,"shape.create":fr,"shape.delete":va,"shape.move":Vr,"shape.resize":xa,"shape.replace":Bi,"shape.toggleCollapse":Ec,spaceTool:dr,"label.create":ga,"connection.create":vc,"connection.delete":ya,"connection.move":kp,"connection.layout":xc,"connection.updateWaypoints":Op,"connection.reconnect":ba,"elements.create":Tp,"elements.move":wc,"elements.delete":Mp,"elements.distribute":bc,"elements.align":gc,"element.updateAttachment":Sc}},it.prototype.registerHandlers=function(e){M(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},it.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)},it.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},it.prototype.moveElements=function(e,t,n,i){i=i||{};var r=i.attach,o=n,a;r===!0?(a=n,o=n.parent):r===!1&&(a=null);var c={shapes:e,delta:t,newParent:o,newHost:a,hints:i};this._commandStack.execute("elements.move",c)},it.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)},it.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},it.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},it.prototype.createShape=function(e,t,n,i,r){typeof i!="number"&&(r=i,i=void 0),r=r||{};var o=r.attach,a,c;e=this._create("shape",e),o?(a=n.parent,c=n):a=n;var s={position:t,shape:e,parent:a,parentIndex:i,host:c,hints:r};return this._commandStack.execute("shape.create",s),s.shape},it.prototype.createElements=function(e,t,n,i,r){ve(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},it.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},it.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},it.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},it.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},it.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},it.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},it.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},it.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},it.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},it.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)},it.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},it.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)},it.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,O(i,{docking:"source"}))},it.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,O(i,{docking:"target"}))},it.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},it.prototype._create=function(e,t){return P1(t)?t:this._elementFactory.create(e,t)},it.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function wa(e){this._elementRegistry=e}wa.$inject=["elementRegistry"],wa.prototype.execute=function(e){var t=e.element,n=e.moddleElement,i=e.properties;if(!n)throw new Error("<moddleElement> required");var r=e.changed||this._getVisualReferences(n).concat(t),o=e.oldProperties||mA(n,Ka(i));return Hy(n,i),e.oldProperties=o,e.changed=r,r},wa.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return Hy(n,t),i},wa.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return v(e,"bpmn:DataObject")?gA(e,t):[]};function mA(e,t){return En(t,function(n,i){return n[i]=e.get(i),n},{})}function Hy(e,t){M(t,function(n,i){e.set(i,n)})}function gA(e,t){return t.filter(function(n){return v(n,"bpmn:DataObjectReference")&&Z(n).dataObjectRef===e})}var Ea="default",$i="id",zy="di",yA={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=wA(e.properties),c=e.oldProperties||vA(t,a);return Vy(a,o)&&(r.unclaim(o[$i]),i.updateId(t,a[$i]),r.claim(a[$i],o)),Ea in a&&(a[Ea]&&n.push(i.get(a[Ea].id)),o[Ea]&&n.push(i.get(o[Ea].id))),Gy(t,a),e.oldProperties=c,e.changed=n,n},Sa.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&Z(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,yA)}},Sa.prototype.revert=function(e){var t=e.element,n=e.properties,i=e.oldProperties,r=t.businessObject,o=this._elementRegistry,a=this._moddle.ids;return Gy(t,i),Vy(n,r)&&(a.unclaim(n[$i]),o.updateId(t,i[$i]),a.claim(i[$i],r)),e.changed};function Vy(e,t){return $i in e&&e[$i]!==t[$i]}function vA(e,t){var n=Ka(t),i=e.businessObject,r=ze(e);return En(n,function(o,a){return a!==zy?o[a]=i.get(a):o[a]=_A(r,Ka(t.di)),o},{})}function _A(e,t){return En(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function Gy(e,t){var n=e.businessObject,i=ze(e);M(t,function(r,o){o!==zy?n.set(o,r):i&&bA(i,r)})}function bA(e,t){M(t,function(n,i){e.set(i,n)})}var xA=["default"];function wA(e){var t=O({},e);return xA.forEach(function(n){n in e&&(t[n]=Z(t[n]))}),t}function Rc(e,t){this._canvas=e,this._modeling=t}Rc.$inject=["canvas","modeling"],Rc.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,c=ze(r);return t.setRootElement(n),t.removeRootElement(r),wt(a.rootElements,i),i.$parent=a,xt(a.rootElements,o),o.$parent=null,r.di=null,c.bpmnElement=i,n.di=c,e.oldRoot=r,[]},Rc.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,c=ze(n);return t.setRootElement(r),t.removeRootElement(n),xt(a.rootElements,i),i.$parent=null,wt(a.rootElements,o),o.$parent=a,n.di=null,c.bpmnElement=o,r.di=c,[]};function Lp(e,t){this._modeling=e,this._spaceTool=t}Lp.$inject=["modeling","spaceTool"],Lp.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=Gn(i),a=o===i,c=a?i:i.parent,s=or(c),u=Gt(i);if(u?r==="left"?r="top":r==="right"&&(r="bottom"):r==="top"?r="left":r==="bottom"&&(r="right"),!s.length){var l=u?{x:i.x+Vn,y:i.y,width:i.width-Vn,height:i.height}:{x:i.x,y:i.y+Vn,width:i.width,height:i.height-Vn};n.createShape({type:"bpmn:Lane",isHorizontal:u},l,c)}var p=[];Ir(o,function(b){return p.push(b),b.label&&p.push(b.label),b===i?[]:Le(b.children,function(E){return E!==i})});var f,d,h,m,g;r==="top"?(f=-120,d=i.y,h=d+10,m="n",g="y"):r==="left"?(f=-120,d=i.x,h=d+10,m="w",g="x"):r==="bottom"?(f=120,d=i.y+i.height,h=d-10,m="s",g="y"):r==="right"&&(f=120,d=i.x+i.width,h=d-10,m="e",g="x");var R=t.calculateAdjustments(p,g,f,h),w=u?{x:0,y:f}:{x:f,y:0};t.makeSpace(R.movingShapes,R.resizingShapes,w,m,h);var x=u?{x:i.x+(a?Vn:0),y:d-(r==="top"?120:0),width:i.width-(a?Vn:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?Vn:0),width:120,height:i.height-(a?Vn:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:u},x,c)};function Ip(e){this._modeling=e}Ip.$inject=["modeling"],Ip.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=or(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=Gt(n),c=a?n.height:n.width,s=Math.round(c/i),u,l,p,f;for(f=0;f<i;f++)f===i-1?u=c-s*f:u=s,l=a?{x:n.x+Vn,y:n.y+f*s,width:n.width-Vn,height:u}:{x:n.x+f*s,y:n.y+Vn,width:u,height:n.height-Vn},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=gR(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},Ra.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=ye(e),r=ye(t),o=wm(r,i),a=Gn(e),c=[],s=[];Ir(a,function(h){return c.push(h),(v(h,"bpmn:Lane")||v(h,"bpmn:Participant"))&&s.push(h),h.children});var u,l,p,f,d;(o.bottom||o.top)&&(u=o.bottom||o.top,l=e.y+(o.bottom?e.height:0)+(o.bottom?-10:10),p=o.bottom?"s":"n",f=o.top>0||o.bottom<0?-u:u,d=n.calculateAdjustments(c,"y",f,l),n.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:u},p)),(o.left||o.right)&&(u=o.right||o.left,l=e.x+(o.right?e.width:0)+(o.right?-10:100),p=o.right?"e":"w",f=o.left>0||o.right<0?-u:u,d=n.calculateAdjustments(s,"x",f,l),n.makeSpace(d.movingShapes,d.resizingShapes,{x:u,y:0},p))};var Ca="flowNodeRef",Np="lanes";function Cc(){}Cc.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(l,p){var f=ye(p),d={x:l.x+l.width/2,y:l.y+l.height/2};return d.x>f.left&&d.x<f.right&&d.y>f.top&&d.y<f.bottom}function c(l){n.indexOf(l)===-1&&(o.push(l),n.push(l))}function s(l){var p=Gn(l);return r[p.id]||(r[p.id]=Vs(p)),r[p.id]}function u(l){if(!l.parent)return[];var p=s(l);return p.filter(function(f){return a(l,f)}).map(function(f){return f.businessObject})}return t.forEach(function(l){var p=Gn(l);if(!(!p||n.indexOf(p)!==-1)){var f=p.children.filter(function(d){return v(d,"bpmn:FlowNode")});f.forEach(c),n.push(p)}}),e.forEach(c),o.forEach(function(l){var p=l.businessObject,f=p.get(Np),d=f.slice(),h=u(l);i.push({flowNode:p,remove:d,add:h})}),t.forEach(function(l){var p=l.businessObject;l.parent||p.get(Ca).forEach(function(f){i.push({flowNode:f,remove:[p],add:[]})})}),i},Cc.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.flowNodeShapes,e.laneShapes)),t.forEach(function(n){var i=n.flowNode,r=i.get(Np);n.remove.forEach(function(o){xt(r,o),xt(o.get(Ca),i)}),n.add.forEach(function(o){wt(r,o),wt(o.get(Ca),i)})}),[]},Cc.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(Np);n.add.forEach(function(o){xt(r,o),xt(o.get(Ca),i)}),n.remove.forEach(function(o){wt(r,o),wt(o.get(Ca),i)})}),[]};var Bp="categoryValueRef";function Pa(e,t){this._bpmnFactory=e,this._elementRegistry=t}Pa.$inject=["bpmnFactory","elementRegistry"],Pa.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,r=new Map,o=[],a=new Map;function c(w,x,b){if(x){var E=a.get(w);E||(E={},a.set(w,E)),!(b&&E.present)&&(!b&&E.past||(b?E.present={categoryValue:x,root:$p(w)}:E.past={categoryValue:x}))}}function s(w){r.set(w,Z(w))}function u(){n.filter(function(w){return v(w,"bpmn:FlowElement")&&!Me(w)&&w.parent}).forEach(s)}function l(w){var x=Z(w),b=x.get("categoryValueRef");return b||(b=ym(i,x),o.push(EA(w,b))),b}function p(w){return w.reduce(function(x,b){var E=$p(b),T=x.get(E);return T||(T=[],x.set(E,T)),T.push(b),x},new Map)}e=Array.from(e||[]);var f=p(e);t.length&&u(),e.forEach(s),n.filter(function(w){return v(w,"bpmn:Group")&&!Me(w)&&w.parent}).forEach(function(w){var x=Z(w).get("categoryValueRef");if(!x){var b=$p(w),E=f.get(b)||[],T=ao(E,w),L=Object.keys(T).length>0;L&&(x=l(w))}c(w,x,!0)}),t.forEach(function(w){c(w.groupShape,w.categoryValue,!1)}),o.length&&u();var d=Array.from(r.keys()),h=Array.from(a.values()).reduce(function(w,x){return x.present&&w.add(x.present.categoryValue),x.past&&w.add(x.past.categoryValue),w},new Set),m=new Map,g=p(d);a.forEach(function(w,x){var b=w.present;if(b){var E=g.get(b.root)||[],T=ao(E,x);E.forEach(function(L){if(T[L.id]){var A=m.get(L);A||(A=new Set,m.set(L,A)),A.add(b.categoryValue)}})}});var R=d.reduce(function(w,x){var b=r.get(x),E=b.get(Bp),T=new Set(E),L=m.get(x)||new Set,A=Array.from(L).filter(function(H){return!T.has(H)}),F=E.filter(function(H){return h.has(H)&&!L.has(H)});return(A.length||F.length)&&w.push({businessObject:b,categoryValuesToAdd:A,categoryValuesToRemove:F}),w},[]);return{flowElements:R,groups:o}},Pa.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),SA(t.groups),CA(t.flowElements),[]},Pa.prototype.revert=function(e){var t=e.updates;return PA(t.flowElements),RA(t.groups),[]};function EA(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function SA(e){e.forEach(function(t){Z(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function RA(e){e.forEach(function(t){Z(t.groupShape).categoryValueRef=null})}function CA(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Bp);t.categoryValuesToRemove.forEach(function(r){xt(i,r)}),t.categoryValuesToAdd.forEach(function(r){wt(i,r,!0)})})}function PA(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Bp);t.categoryValuesToAdd.forEach(function(r){xt(i,r)}),t.categoryValuesToRemove.forEach(function(r){wt(i,r,!0)})})}function $p(e){for(;e.parent;)e=e.parent;return e}function Pc(e){this._moddle=e}Pc.$inject=["moddle"],Pc.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,i=e.element,r=e.claiming;return r?t.claim(n,i):t.unclaim(n),[]},Pc.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,i=e.element,r=e.claiming;return r?t.unclaim(n):t.claim(n,i),[]};var AA={fill:void 0,stroke:void 0};function jp(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(xn(t)){var n=TA(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}jp.$inject=["commandStack"],jp.prototype.postExecute=function(e){var t=e.elements,n=e.colors||AA,i=this,r={};"fill"in n&&O(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&O(r,{"border-color":this._normalizeColor(n.stroke)}),M(t,function(o){var a=nt(o)?ni(r,["border-color"]):r,c=ze(o);if(MA(a),Me(o)){if(!c||!v(c.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:c.label,properties:{color:r["border-color"]}})}else{if(!De(c,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function TA(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 MA(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var kA={width:0,height:0};function Wy(e,t,n){function i(s,u){var l=s.label||s,p=s.labelTarget||s;return oS(l,u),[l,p]}function r(s){var u=s.element,l=u.businessObject,p=s.newLabel;if(!Me(u)&&ir(u)&&!Ms(u)&&!Uy(p)){var f=7,d=ul(u);d={x:d.x,y:d.y+f},e.createLabel(u,d,{id:l.id+"_label",businessObject:l,di:u.di})}}function o(s){return s.oldLabel=Nn(s.element),i(s.element,s.newLabel)}function a(s){return i(s.element,s.oldLabel)}function c(s){var u=s.element,l=u.label||u,p=s.newLabel,f=s.newBounds,d=s.hints||{};if(!(!Me(l)&&!v(l,"bpmn:TextAnnotation"))){if(Me(l)&&Uy(p)){d.removeShape!==!1&&e.removeShape(l,{unsetLabel:!1});return}var h=Nn(u);typeof f>"u"&&(f=t.getExternalLabelBounds(l,h)),f&&e.resizeShape(l,f,kA)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=c}Wy.$inject=["modeling","textRenderer","bpmnFactory"];function Uy(e){return!e||!e.trim()}function Qt(e,t,n,i){it.call(this,e,t,n),this._bpmnRules=i}ie(Qt,it),Qt.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],Qt.prototype.getHandlers=function(){var e=it.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=wa,e["element.updateProperties"]=Sa,e["canvas.updateRoot"]=Rc,e["lane.add"]=Lp,e["lane.resize"]=Ra,e["lane.split"]=Ip,e["lane.updateRefs"]=Cc,e["group.updateRefs"]=Pa,e["id.updateClaim"]=Pc,e["element.setColor"]=jp,e["element.updateLabel"]=Wy,e},Qt.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},Qt.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)},Qt.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},Qt.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},Qt.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},Qt.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},Qt.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},Qt.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Qt.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Qt.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},Qt.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},Qt.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},Qt.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},Qt.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function Yy(){}Yy.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||_e(t.source||e.source),t.connectionEnd||_e(t.target||e.target)]};var Ac=20,DA=5,Tc=Math.round,qy=20,OA={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function LA(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function IA(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function Ky(e,t,n){var i=Kt(t,e,DA),r=n.split(":")[0],o=Tc((t.x-e.x)/2+e.x),a=Tc((t.y-e.y)/2+e.y),c,s,u=IA(r,i),l=/h|r|l/.test(r),p=!1,f=!1;return u?(c=l?{x:o,y:e.y}:{x:e.x,y:a},s=l?"h:h":"v:v"):(p=LA(i,r),s=l?"h:v":"v:h",p?l?(f=a===e.y,c={x:e.x+Ac*(/l/.test(r)?-1:1),y:f?a+Ac:a}):(f=o===e.x,c={x:f?o+Ac:o,y:e.y+Ac*(/t/.test(r)?-1:1)}):c={x:o,y:a}),{waypoints:Fp(e,c,s).concat(c),directions:s,turnNextDirections:f}}function NA(e,t,n){return Ky(e,t,n)}function BA(e,t,n){var i=Ky(t,e,Xy(n));return{waypoints:i.waypoints.slice().reverse(),directions:Xy(i.directions),turnNextDirections:i.turnNextDirections}}function $A(e,t){var n=e.directions.split(":")[1],i=t.directions.split(":")[0];e.turnNextDirections&&(n=n=="h"?"v":"h"),t.turnNextDirections&&(i=i=="h"?"v":"h");var r=n+":"+i,o=Fp(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function Xy(e){return e.split(":").reverse().join(":")}function jA(e,t,n){var i=Tc((t.x-e.x)/2+e.x),r=Tc((t.y-e.y)/2+e.y);if(n==="h:v")return[{x:t.x,y:e.y}];if(n==="v:h")return[{x:e.x,y:t.y}];if(n==="h:h")return[{x:i,y:e.y},{x:i,y:t.y}];if(n==="v:v")return[{x:e.x,y:r},{x:t.x,y:r}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}function Fp(e,t,n){if(n=n||"h:h",!qA(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Qy(n)){var i=NA(e,t,n),r=BA(e,t,n),o=$A(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return jA(e,t,n)}function FA(e,t,n){var i=Fp(e,t,n);return i.unshift(e),i.push(t),ev(i)}function HA(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=Vx(o,"straight")[0]||"h:h",c=OA[a]||0,s=Kt(e,t,c),u=YA(s,a);n=n||_e(e),i=i||_e(t);var l=u.split(":"),p=Jy(n,e,l[0],KA(s)),f=Jy(i,t,l[1],s);return FA(p,f,u)}function zA(e,t,n,i,r,o){ve(n)&&(r=n,o=i,n=_e(e),i=_e(t)),o=O({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,c=a.indexOf("straight")!==-1,s;return s=c&&GA(e,t,n,i,o),s||(s=o.connectionEnd&&UA(t,e,i,r),s)||(s=o.connectionStart&&WA(e,t,n,r),s)?s:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:HA(e,t,n,i,o)}function VA(e,t,n){return e>=t&&e<=n}function Zy(e,t,n){var i={x:"width",y:"height"};return VA(t[e],n[e],n[e]+n[i[e]])}function GA(e,t,n,i,r){var o={},a,c;return c=Kt(e,t),/^(top|bottom|left|right)$/.test(c)?(/top|bottom/.test(c)&&(a="x"),/left|right/.test(c)&&(a="y"),r.preserveDocking==="target"?Zy(a,i,e)?(o[a]=i[a],[{x:o.x!==void 0?o.x:n.x,y:o.y!==void 0?o.y:n.y,original:{x:o.x!==void 0?o.x:n.x,y:o.y!==void 0?o.y:n.y}},{x:i.x,y:i.y}]):null:Zy(a,n,t)?(o[a]=n[a],[{x:n.x,y:n.y},{x:o.x!==void 0?o.x:i.x,y:o.y!==void 0?o.y:i.y,original:{x:o.x!==void 0?o.x:i.x,y:o.y!==void 0?o.y:i.y}}]):null):null}function WA(e,t,n,i){return Hp(e,t,n,i)}function UA(e,t,n,i){var r=i.slice().reverse();return r=Hp(e,t,n,r),r?r.reverse():null}function Hp(e,t,n,i){function r(l){return l.length<3?!0:l.length>4?!1:!!ot(l,function(p,f){var d=l[f-1];return d&&Zo(p,d)<3})}function o(l,p,f){var d=Ti(p,l);switch(d){case"v":return{x:f.x,y:l.y};case"h":return{x:l.x,y:f.y}}return{x:l.x,y:l.y}}function a(l,p,f){var d;for(d=l.length-2;d!==0;d--)if(Eh(l[d],p,qy)||Eh(l[d],f,qy))return l.slice(d);return l}if(r(i))return null;var c=i[0],s=i.slice(),u;return s[0]=n,s[1]=o(s[1],c,n),u=a(s,e,t),u!==s&&(s=Hp(e,t,n,u)),s&&Ti(s)?null:s}function YA(e,t){if(Qy(t))return t;switch(e){case"intersect":return"t:t";case"top":case"bottom":return"v:v";case"left":case"right":return"h:h";default:return t}}function qA(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Qy(e){return e&&/t|r|b|l/.test(e)}function KA(e){return{top:"bottom",bottom:"top",left:"right",right:"left","top-left":"bottom-right","bottom-right":"top-left","top-right":"bottom-left","bottom-left":"top-right"}[e]}function Jy(e,t,n,i){if(n==="h"&&(n=/left/.test(i)?"l":"r"),n==="v"&&(n=/top/.test(i)?"t":"b"),n==="t")return{original:e,x:e.x,y:t.y};if(n==="r")return{original:e,x:t.x+t.width,y:e.y};if(n==="b")return{original:e,x:e.x,y:t.y+t.height};if(n==="l")return{original:e,x:t.x,y:e.y};throw new Error("unexpected dockingDirection: <"+n+">")}function ev(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return rl(r,o,n,0)||t.push(n),t},[])}var XA=-10,ZA=40,QA={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},JA={default:["v:v"],fromGateway:["h:v"],toGateway:["v:h"],loop:{fromTop:["t:l"],fromRight:["r:t"],fromLeft:["l:b"],fromBottom:["b:r"]},boundaryLoop:{alternateHorizontalSide:"t",alternateVerticalSide:"r",default:"h"},messageFlow:["straight","h:h"],subProcess:["straight","v:v"],isHorizontal:!1},zp={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Aa={top:"t",right:"r",bottom:"b",left:"l"};function Mc(e){this._elementRegistry=e}ie(Mc,Yy),Mc.prototype.layoutConnection=function(e,t){t||(t={});var n=t.source||e.source,i=t.target||e.target,r=t.waypoints||e.waypoints,o=t.connectionStart,a=t.connectionEnd,c=this._elementRegistry,s,u;if(o||(o=tv(r&&r[0],n)),a||(a=tv(r&&r[r.length-1],i)),(v(e,"bpmn:Association")||v(e,"bpmn:DataAssociation"))&&r&&!nv(n,i))return[].concat([o],r.slice(1,-1),[a]);var l=dm(n,c)?QA:JA;return v(e,"bpmn:MessageFlow")?s=tT(n,i,l):(v(e,"bpmn:SequenceFlow")||nv(n,i))&&(n===i?s={preferredLayouts:sT(n,e,l)}:v(n,"bpmn:BoundaryEvent")?s={preferredLayouts:cT(n,i,a,l)}:Ta(n)||Ta(i)?s={preferredLayouts:l.subProcess,preserveDocking:iT(n)}:v(n,"bpmn:Gateway")?s={preferredLayouts:l.fromGateway}:v(i,"bpmn:Gateway")?s={preferredLayouts:l.toGateway}:s={preferredLayouts:l.default}),s&&(s=O(s,t),u=ev(zA(n,i,o,a,r,s))),u||[o,a]};function eT(e){var t=e.host;return Kt(_e(e),t,XA)}function tT(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:nT(e,t)}}function nT(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 iT(e){return Ta(e)?"target":"source"}function tv(e,t){return e?e.original||e:_e(t)}function nv(e,t){return v(t,"bpmn:Activity")&&v(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Ta(e){return v(e,"bpmn:SubProcess")&&$e(e)}function Gr(e,t){return e===t}function rT(e,t){return t.indexOf(e)!==-1}function Co(e){var t=/right|left/.exec(e);return t&&t[0]}function Po(e){var t=/top|bottom/.exec(e);return t&&t[0]}function iv(e,t){return zp[e]===t}function oT(e,t){var n=Co(e),i=zp[n];return t.indexOf(i)!==-1}function aT(e,t){var n=Po(e),i=zp[n];return t.indexOf(i)!==-1}function rv(e){return e==="right"||e==="left"}function sT(e,t,n){var i=t.waypoints,r=i&&i.length&&Kt(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function cT(e,t,n,i){var r=_e(e),o=_e(t),a=eT(e),c,s,u=Gr(e.host,t),l=rT(a,["top","right","bottom","left"]),p=Kt(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?uT(a,l,e,t,n,i):(c=lT(a,p,l,i.isHorizontal),s=pT(a,p,l,i.isHorizontal),[c+":"+s])}function uT(e,t,n,i,r,o){var a=t?e:o.isHorizontal?Po(e):Co(e),c=Aa[a],s;return t?rv(e)?s=ov("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:s=ov("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:s=o.boundaryLoop.default,[c+":"+s]}function ov(e,t,n,i){var r=ZA;return!(Vp(e,i,n,r)||Vp(e,i,{x:n.x+n.width,y:n.y+n.height},r)||Vp(e,i,_e(t),r))}function Vp(e,t,n,i){return Math.abs(t[e]-n[e])<i}function lT(e,t,n,i){if(n)return Aa[e];var r=Po(e),o=Co(e),a=Po(t),c=Co(t);if(i){if(Gr(r,a)||iv(o,c))return Aa[r]}else if(Gr(o,c)||iv(r,a))return Aa[o];return Aa[i?o:r]}function pT(e,t,n,i){if(n)return rv(e)?oT(e,t)||Gr(e,t)?"h":"v":aT(e,t)||Gr(e,t)?"v":"h";var r=Po(e),o=Co(e),a=Po(t),c=Co(t);return a&&!c?"v":c&&!a?"h":i?Gr(r,a)?"h":"v":Gr(o,c)?"v":"h"}Mc.$inject=["elementRegistry"];function av(e){return O({original:e.point.original||e.point},e.actual)}function hr(e,t){this._elementRegistry=e,this._graphicsFactory=t}hr.$inject=["elementRegistry","graphicsFactory"],hr.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),r=this.getDockingPoint(e,n),o=e.waypoints.slice(i.idx+1,r.idx);return o.unshift(av(i)),o.push(av(r)),o},hr.prototype.getDockingPoint=function(e,t,n){var i=e.waypoints,r,o,a;return r=n?0:i.length-1,o=i[r],a=this._getIntersection(t,e,n),{point:o,actual:a||o,idx:r}},hr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return Qo(i,r,n)},hr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},hr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},hr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const Gp={__init__:["modeling","bpmnUpdater"],__depends__:[MC,UC,qC,KC,vy,XP,QP,rA,Un,Pp,Sy],bpmnFactory:["type",qn],bpmnUpdater:["type",Mn],elementFactory:["type",pr],modeling:["type",Qt],layouter:["type",Mc],connectionDocking:["type",hr]};var fT=10,sv=50,dT=250;function Wp(e,t,n,i){for(var r;r=hT(e,n,t);)n=i(t,n,r);return n}function Up(e){return function(t,n,i){var r={x:n.x,y:n.y};return["x","y"].forEach(function(o){var a=e[o];if(a){var c=o==="x"?"width":"height",s=a.margin,u=a.minDistance;s<0?r[o]=Math.min(i[o]+s-t[c]/2,n[o]-u+s):r[o]=Math.max(i[o]+i[c]+s+t[c]/2,n[o]+u+s)}}),r}}function hT(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=gT(e);return ot(r,function(o){if(o===n)return!1;var a=Kt(o,i,fT);return a==="intersect"})}function mT(e,t){t||(t={});function n(h){return h.source===e?1:-1}var i=t.defaultDistance||sv,r=t.direction||"e",o=t.filter,a=t.getWeight||n,c=t.maxDistance||dT,s=t.reference||"start";o||(o=_T);function u(h,m){return r==="n"?s==="start"?ye(h).top-ye(m).bottom:s==="center"?ye(h).top-_e(m).y:ye(h).top-ye(m).top:r==="w"?s==="start"?ye(h).left-ye(m).right:s==="center"?ye(h).left-_e(m).x:ye(h).left-ye(m).left:r==="s"?s==="start"?ye(m).top-ye(h).bottom:s==="center"?_e(m).y-ye(h).bottom:ye(m).bottom-ye(h).bottom:s==="start"?ye(m).left-ye(h).right:s==="center"?_e(m).x-ye(h).right:ye(m).right-ye(h).right}var l=e.incoming.filter(o).map(function(h){var m=a(h),g=m<0?u(h.source,e):u(e,h.source);return{id:h.source.id,distance:g,weight:m}}),p=e.outgoing.filter(o).map(function(h){var m=a(h),g=m>0?u(e,h.target):u(h.target,e);return{id:h.target.id,distance:g,weight:m}}),f=l.concat(p).reduce(function(h,m){return h[m.id+"__weight_"+m.weight]=m,h},{}),d=En(f,function(h,m){var g=m.distance,R=m.weight;return g<0||g>c||(h[String(g)]||(h[String(g)]=0),h[String(g)]+=1*R,(!h.distance||h[h.distance]<h[String(g)])&&(h.distance=g)),h},{});return d.distance||i}function gT(e){var t=Yp(e);return e.host&&(t=t.concat(Yp(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(Yp(i))},[]))),t}function Yp(e){return vT(e).concat(yT(e))}function yT(e){return e.incoming.map(function(t){return t.source})}function vT(e){return e.outgoing.map(function(t){return t.target})}function _T(){return!0}var bT=100;function cv(e,t,n){e.on("autoPlace",bT,function(i){var r=i.shape,o=i.source;return xT(o,r)}),e.on("autoPlace.end",function(i){n.scrollToElement(i.shape)}),this.append=function(i,r,o){e.fire("autoPlace.start",{source:i,shape:r});var a=e.fire("autoPlace",{source:i,shape:r}),c=t.appendShape(i,r,a,i.parent,o);return e.fire("autoPlace.end",{source:i,shape:c}),c}}cv.$inject=["eventBus","modeling","canvas"];function xT(e,t,n){n||(n={});var i=n.defaultDistance||sv,r=_e(e),o=ye(e);return{x:o.right+i+t.width/2,y:r.y}}function uv(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}uv.$inject=["eventBus","selection"];const wT={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",cv],autoPlaceSelectionBehavior:["type",uv]};function lv(e,t,n){var i=dm(e,n);if(v(t,"bpmn:TextAnnotation"))return ST(e,t,i);if(De(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return RT(e,t,i);if(v(t,"bpmn:FlowNode"))return ET(e,t,i)}function ET(e,t,n){var i=ye(e),r=_e(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=mT(e,{filter:function(d){return v(d,"bpmn:SequenceFlow")},direction:o.directionHint}),c=30,s=o.minDistance,u=o.baseOrientation;v(e,"bpmn:BoundaryEvent")&&(u=Kt(e,e.host,-25),u.indexOf(o.boundaryOrientation)!==-1&&(c*=-1));var l=n?{x:i.right+a+t.width/2,y:r.y+pv(u,s,o)}:{x:r.x+pv(u,s,o),y:i.bottom+a+t.height/2},p={margin:c,minDistance:s},f=n?{y:p}:{x:p};return Wp(e,t,l,Up(f))}function pv(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function ST(e,t,n){var i=ye(e),r=n?{x:i.right+t.width/2,y:i.top-50-t.height/2}:{x:i.right+50+t.width/2,y:i.bottom+t.height/2};nt(e)&&(r=_e(e),n?(r.x+=100,r.y-=50):(r.x+=100,r.y+=50));var o={margin:n?-30:30,minDistance:20},a=n?{y:o}:{x:o};return Wp(e,t,r,Up(a))}function RT(e,t,n){var i=ye(e),r=n?{x:i.right-10+t.width/2,y:i.bottom+40+t.width/2}:{x:i.left-40-t.width/2,y:i.bottom-10+t.height/2},o={margin:30,minDistance:30},a=n?{x:o}:{y:o};return Wp(e,t,r,Up(a))}function fv(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return lv(r,i,t)})}fv.$inject=["eventBus","elementRegistry"];const kc={__depends__:[wT],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",fv]},dv=[pm,ra,Gp,kc];function CT(e={}){Jd(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new uo({container:t,moddleExtensions:e.moddleExtensions??ns,additionalModules:[...dv,...e.additionalModules??[]]})}var PT=new So("ov"),AT=500;function Wt(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=PT,this._overlayDefaults=O({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=TT(n.getContainer()),this._init()}Wt.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Wt.prototype.get=function(e){if(xn(e)&&(e={id:e}),xn(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?Le(t.overlays,to({type:e.type})):t.overlays.slice():[]}else return e.type?Le(this._overlays,to({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=O({},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)||[];ve(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(){Dc(this._overlayRoot)},Wt.prototype.hide=function(){Dc(this._overlayRoot,!1)},Wt.prototype.clear=function(){this._overlays={},this._overlayContainers=[],ms(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}hv(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 c;i.waypoints?c=Ct(i).height:c=i.height,o=t.bottom*-1+c}hv(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(",")+")";mv(this._overlayRoot,n)},Wt.prototype._getOverlayContainer=function(e,t){var n=ot(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)),xn(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&&dt(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),c=this._canvas.getRootElement();Dc(r,a===c),e.htmlContainer=r,o.overlays.push(e),o.html.appendChild(r),this._overlays[t]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},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,c=this._canvas.getRootElement(),s=!0;(i!==c||n&&(Lt(r)&&r>t.scale||Lt(o)&&o<t.scale))&&(s=!1),Dc(a,s),this._updateOverlayScale(e,t)},Wt.prototype._updateOverlayScale=function(e,t){var n=e.scale,i,r,o=e.htmlContainer,a,c="";n!==!0&&(n===!1?(i=1,r=1):(i=n.min,r=n.max),Lt(i)&&t.scale<i&&(a=(1/t.scale||1)*i),Lt(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),Lt(a)&&(c="scale("+a+","+a+")"),mv(o,c)},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(s){t.remove(s.id)});var a=t._getOverlayContainer(r);if(a){pi(a.html);var c=t._overlayContainers.indexOf(a);c!==-1&&t._overlayContainers.splice(c,1)}}),e.on("element.changed",AT,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&&dt(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 TT(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 hv(e,t,n){fn(e,{left:t+"px",top:n+"px"})}function Dc(e,t){e.style.display=t===!1?"none":""}function mv(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Oc={__init__:["overlays"],overlays:["type",Wt]};function qp(e,t){t.invoke(K,this),this.executed(function(n){var i=n.context;i.rootElement?e.setRootElement(i.rootElement):i.rootElement=e.getRootElement()}),this.revert(function(n){var i=n.context;i.rootElement&&e.setRootElement(i.rootElement)})}ie(qp,K),qp.$inject=["canvas","injector"];const MT={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",qp]};function Ma(e){return CSS.escape(e)}var kT={"&":"&","<":"<",">":">",'"':""","'":"'"};function gv(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return kT[t]})}var DT="bjs-breadcrumbs-shown";function yv(e,t,n){var i=ut('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=dt(r);r.appendChild(i);var a=[];e.on("element.changed",function(s){var u=s.element,l=Z(u),p=ot(a,function(f){return f===l});p&&c()});function c(s){s&&(a=OT(s));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 R=Z(g);return R&&R.get("processRef")===p});f=d&&n.findRoot(d.id)}if(!f)return[];var h=gv(p.name||p.id),m=ut('<li><span class="bjs-crumb"><a title="'+h+'">'+h+"</a></span></li>");return m.addEventListener("click",function(){n.setRootElement(f)}),m});i.innerHTML="";var l=u.length>1;o.toggle(DT,l),u.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(s){c(s.element)})}yv.$inject=["eventBus","elementRegistry","canvas"];function OT(e){for(var t=Z(e),n=[],i=t;i;i=i.$parent)(v(i,"bpmn:SubProcess")||v(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function vv(e,t){var n=null,i=new LT;e.on("root.set",function(r){var o=r.element,a=t.viewbox(),c=i.get(o);if(i.set(n,{x:a.x,y:a.y,zoom:a.scale}),n=o,!(!v(o,"bpmn:SubProcess")&&!c)){c=c||{x:0,y:0,zoom:1};var s=(a.x-c.x)*a.scale,u=(a.y-c.y)*a.scale;(s!==0||u!==0)&&t.scroll({dx:s,dy:u}),c.zoom!==a.scale&&t.zoom(c.zoom,{x:0,y:0})}}),e.on("diagram.clear",function(){i.clear(),n=null})}vv.$inject=["eventBus","canvas"];function LT(){this._entries=[],this.set=function(e,t){var n=!1;for(var i in this._entries)if(this._entries[i][0]===e){this._entries[i][1]=t,n=!0;break}n||this._entries.push([e,t])},this.get=function(e){for(var t in this._entries)if(this._entries[t][0]===e)return this._entries[t][1];return null},this.clear=function(){this._entries.length=0},this.remove=function(e){var t=-1;for(var n in this._entries)if(this._entries[n][0]===e){t=n;break}t!==-1&&this._entries.splice(t,1)}}var _v={x:180,y:160};function Wr(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}Wr.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)})}},Wr.prototype._createNewDiagrams=function(e){var t=this,n=[],i=[];e.get("planeElement").forEach(function(o){var a=o.bpmnElement;if(a){var c=a.$parent;v(a,"bpmn:SubProcess")&&!o.isExpanded&&n.push(a),NT(a,e)&&i.push({diElement:o,parent:c})}});var r=[];return n.forEach(function(o){if(!t._processToDiagramMap[o.id]){var a=t._createDiagram(o);t._processToDiagramMap[o.id]=a,r.push(a)}}),i.forEach(function(o){for(var a=o.diElement,c=o.parent;c&&n.indexOf(c)===-1;)c=c.$parent;if(c){var s=t._processToDiagramMap[c.id];t._moveToDiPlane(a,s.plane)}}),r},Wr.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=IT(e),i={x:n.x-_v.x,y:n.y-_v.y};t.forEach(function(r){r.waypoint?r.waypoint.forEach(function(o){o.x=o.x-i.x,o.y=o.y-i.y}):r.bounds&&(r.bounds.x=r.bounds.x-i.x,r.bounds.y=r.bounds.y-i.y)})},Wr.prototype._moveToDiPlane=function(e,t){var n=bv(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},Wr.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},Wr.$inject=["eventBus","moddle"];function bv(e){return v(e,"bpmndi:BPMNDiagram")?e:bv(e.$parent)}function IT(e){var t={top:1/0,right:-1/0,bottom:-1/0,left:1/0};return e.planeElement.forEach(function(n){if(n.bounds){var i=ye(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),Ss(t)}function NT(e,t){var n=e.$parent;return!(!v(n,"bpmn:SubProcess")||n===t.bpmnElement||De(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var Lc=250,BT='<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>',$T="bjs-drilldown-empty";function mr(e,t,n,i,r){K.call(this,t),this._canvas=e,this._eventBus=t,this._elementRegistry=n,this._overlays=i,this._translate=r;var o=this;this.executed("shape.toggleCollapse",Lc,function(a){var c=a.shape;o._canDrillDown(c)?o._addOverlay(c):o._removeOverlay(c)},!0),this.reverted("shape.toggleCollapse",Lc,function(a){var c=a.shape;o._canDrillDown(c)?o._addOverlay(c):o._removeOverlay(c)},!0),this.executed(["shape.create","shape.move","shape.delete"],Lc,function(a){var c=a.oldParent,s=a.newParent||a.parent,u=a.shape;o._canDrillDown(u)&&o._addOverlay(u),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(u)},!0),this.reverted(["shape.create","shape.move","shape.delete"],Lc,function(a){var c=a.oldParent,s=a.newParent||a.parent,u=a.shape;o._canDrillDown(u)&&o._addOverlay(u),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(u)},!0),t.on("import.render.complete",function(){n.filter(function(a){return o._canDrillDown(a)}).map(function(a){o._addOverlay(a)})})}ie(mr,K),mr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},mr.prototype._canDrillDown=function(e){var t=this._canvas;return v(e,"bpmn:SubProcess")&&t.findRoot(gi(e))},mr.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=Z(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;dt(i.html).toggle($T,!r)}},mr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=Z(e),r=n.get({element:e,type:"drilldown"});r.length&&this._removeOverlay(e);var o=ut('<button type="button" class="bjs-drilldown">'+BT+"</button>"),a=i.get("name")||i.get("id"),c=this._translate("Open {element}",{element:a});o.setAttribute("title",c),o.addEventListener("click",function(){t.setRootElement(t.findRoot(gi(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},mr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},mr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const jT={__depends__:[Oc,Pp,MT],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",yv],drilldownCentering:["type",vv],drilldownOverlayBehavior:["type",mr],subprocessCompatibility:["type",Wr]};function gr(e){gt.call(this,e)}ie(gr,gt),gr.prototype._modules=[pm,jT,Oc,Un,ra],gr.prototype._moddleExtensions={};var Ic="keyboard.keydown",FT="keyboard.keyup",HT=1e3,xv="Keyboard binding is now implicit; explicit binding to an element got removed. For more information, see https://github.com/bpmn-io/diagram-js/issues/661";function 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(xv));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,Ic)},dn.prototype._keyupHandler=function(e){this._keyHandler(e,FT)},dn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Ic,i),n&&e.preventDefault()}},dn.prototype._isEventIgnored=function(e){return!1},dn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(xv)),this.unbind(),e=this._node=this._target,Re.bind(e,"keydown",this._keydownHandler),Re.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"),Re.unbind(e,"keydown",this._keydownHandler),Re.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=HT),this._eventBus.on(n||Ic,e,t)},dn.prototype.removeListener=function(e,t){this._eventBus.off(t||Ic,e)},dn.prototype.hasModifier=cP,dn.prototype.isCmd=An,dn.prototype.isShift=gp,dn.prototype.isKey=Bt;var zT=500;function Ao(e,t){var n=this;e.on("editorActions.init",zT,function(i){var r=i.editorActions;n.registerBindings(t,r)})}Ao.$inject=["eventBus","keyboard"],Ao.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(dP(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(hP(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(uP(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(lP(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(pP(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(fP(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Bt(["+","Add","="],r)&&An(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Bt(["-","Subtract"],r)&&An(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(Bt("0",r)&&An(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 Kp={__init__:["keyboard","keyboardBindings"],keyboard:["type",dn],keyboardBindings:["type",Ao]};var VT={moveSpeed:50,moveSpeedAccelerated:200};function wv(e,t,n){var i=this;this._config=O({},VT,e||{}),t.addListener(r);function r(o){var a=o.keyEvent,c=i._config;if(t.isCmd(a)&&t.isKey(["ArrowLeft","Left","ArrowUp","Up","ArrowDown","Down","ArrowRight","Right"],a)){var s=t.isShift(a)?c.moveSpeedAccelerated:c.moveSpeed,u;switch(a.key){case"ArrowLeft":case"Left":u="left";break;case"ArrowUp":case"Up":u="up";break;case"ArrowRight":case"Right":u="right";break;case"ArrowDown":case"Down":u="down";break}return i.moveCanvas({speed:s,direction:u}),!0}}this.moveCanvas=function(o){var a=0,c=0,s=o.speed,u=s/Math.min(Math.sqrt(n.viewbox().scale),1);switch(o.direction){case"left":a=u;break;case"up":c=u;break;case"right":a=-u;break;case"down":c=-u;break}n.scroll({dx:a,dy:c})}}wv.$inject=["config.keyboardMove","keyboard","canvas"];const Ev={__depends__:[Kp],__init__:["keyboardMove"],keyboardMove:["type",wv]};var GT=15;function Sv(e,t){var n;function i(c){return a(c.originalEvent)}e.on("canvas.focus.changed",function(c){c.focused?e.on("element.mousedown",500,i):e.off("element.mousedown",i)});function r(c){var s=n.start,u=n.button,l=jr(c),p=ii(l,s);if(!n.dragging&&WT(p)>GT&&(n.dragging=!0,u===0&&Zg(e),cc("grab")),n.dragging){var f=n.last||n.start;p=ii(l,f),t.scroll({dx:p.x,dy:p.y}),n.last=l}c.preventDefault()}function o(c){Re.unbind(document,"mousemove",r),Re.unbind(document,"mouseup",o),n=null,Xg()}function a(c){if(!Or(c.target,".djs-draggable")){var s=c.button;if(!(s>=2||c.ctrlKey||c.shiftKey||c.altKey))return n={button:s,start:jr(c)},Re.bind(document,"mousemove",r),Re.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}Sv.$inject=["eventBus","canvas"];function WT(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const Rv={__init__:["moveCanvas"],moveCanvas:["type",Sv]};function Cv(e,t){var n=dl(e.min),i=dl(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function UT(e,t){return Math.max(e.min,Math.min(e.max,t))}var YT=Math.sign||function(e){return e>=0?1:-1},Xp={min:.2,max:4},Pv=10,qT=.1,KT=.75;function _i(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=yn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||KT;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=Cv(Xp,Pv*2);this._totalDelta+=t,Math.abs(this._totalDelta)>qT&&(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||rg()&&t.metaKey,r=t.shiftKey,o=-1*this._scale,a;if(i?o*=t.deltaMode===0?.02:.32:o*=t.deltaMode===0?1:16,i){var c=n.getBoundingClientRect(),s={x:t.clientX-c.left,y:t.clientY-c.top};a=Math.sqrt(Math.pow(t.deltaY,2)+Math.pow(t.deltaX,2))*YT(t.deltaY)*o,this.zoom(a,s)}else r?a={dx:o*t.deltaY,dy:0}:a={dx:o*t.deltaX,dy:o*t.deltaY},this.scroll(a)}},_i.prototype.stepZoom=function(t,n){var i=Cv(Xp,Pv);this._zoom(t,n,i)},_i.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=dl(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var c=Math.pow(10,a);i.zoom(UT(Xp,c),t)},_i.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&Re[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},_i.prototype._init=function(e){this.toggle(e)};const Av={__init__:["zoomScroll"],zoomScroll:["type",_i]};function ka(e){gr.call(this,e)}ie(ka,gr),ka.prototype._navigationModules=[Ev,Rv,Av],ka.prototype._modules=[].concat(gr.prototype._modules,ka.prototype._navigationModules);function Zp(e){return e&&e[e.length-1]}function Tv(e){return e.y}function Mv(e){return e.x}var XT={left:Mv,center:Mv,right:function(e){return e.x+e.width},top:Tv,middle:Tv,bottom:function(e){return e.y+e.height}};function To(e,t){this._modeling=e,this._rules=t}To.$inject=["modeling","rules"],To.prototype._getOrientationDetails=function(e){var t=["top","bottom","middle"],n="x",i="width";return t.indexOf(e)!==-1&&(n="y",i="height"),{axis:n,dimension:i}},To.prototype._isType=function(e,t){return t.indexOf(e)!==-1},To.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),i=n.axis,r=n.dimension,o={},a={},c=!1,s,u,l;function p(f,d){return Math.round((f[i]+d[i]+d[r])/2)}if(this._isType(e,["left","top"]))o[e]=t[0][i];else if(this._isType(e,["right","bottom"]))l=Zp(t),o[e]=l[i]+l[r];else if(this._isType(e,["center","middle"])){if(M(t,function(f){var d=f[i]+Math.round(f[r]/2);a[d]?a[d].elements.push(f):a[d]={elements:[f],center:d}}),s=ai(a,function(f){return f.elements.length>1&&(c=!0),f.elements.length}),c)return o[e]=Zp(s).center,o;u=t[0],t=ai(t,function(f){return f[i]+f[r]}),l=Zp(t),o[e]=p(u,l)}return o},To.prototype.trigger=function(e,t){var n=this._modeling,i,r=Le(e,function(s){return!(s.waypoints||s.host||s.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),ve(i)&&(r=i),!(r.length<2||!i)){var o=XT[t],a=ai(r,o),c=this._alignmentPosition(t,a);n.alignElements(a,c)}};const ZT={__init__:["alignElements"],alignElements:["type",To]},QT=new So;function Mo(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Mo.$inject=["eventBus"],Mo.prototype.schedule=function(e,t=QT.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},Mo.prototype._schedule=function(e,t){const n=JT();return{executionId:setTimeout(()=>{try{this._scheduled[t]=null;try{n.resolve(e())}catch(r){n.reject(r)}}catch(r){console.error("Scheduler#_schedule execution failed",r)}}),promise:n.promise}},Mo.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Mo.prototype._cancel=function(e){clearTimeout(e.executionId)};function JT(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const eM={scheduler:["type",Mo]};var tM="djs-element-hidden",Nc=".entry",nM=1e3,kv=8,iM=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=ve(r)?r:[r],a=o.filter(function(s){return n.includes(s)});if(a.length){e.close();var c=o.filter(function(s){return e._elementRegistry.get(s.id)});c.length&&e._updateAndOpen(c.length>1?c:c[0])}}}),this._eventBus.on("canvas.viewbox.changed",function(){e._updatePosition()}),this._eventBus.on("element.marker.update",function(t){if(e.isOpen()){var n=t.element,i=e._current,r=ve(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=nM),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},At.prototype.getEntries=function(e){var t=this._getProviders(),n=ve(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,c){i[c]=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)},iM);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 c=a.action;if(this._eventBus.fire("contextPad.trigger",{entry:a,event:n})!==!1){if(zt(c)){if(t==="click")return c(n,r,i)}else if(c[t])return c[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",c=ut(r.html||'<div class="entry" draggable="true"></div>'),s;an(c,"data-action",o),s=tt("[data-group="+Ma(a)+"]",n),s||(s=ut('<div class="group"></div>'),an(s,"data-group",a),n.appendChild(s)),s.appendChild(c),r.className&&rM(c,r.className),r.title&&an(c,"title",r.title),r.imageUrl&&(i=ut("<img>"),an(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",c.appendChild(i))}),dt(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 Rn.bind(n,Nc,"click",function(i){t.trigger("click",i)}),Rn.bind(n,Nc,"dragstart",function(i){t.trigger("dragstart",i)}),Rn.bind(n,Nc,"mouseover",function(i){t.trigger("mouseover",i)}),Rn.bind(n,Nc,"mouseout",function(i){t.trigger("mouseout",i)}),Re.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()&&aM(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 ve(e)!==ve(n)?!1:ve(e)?e.length===n.length&&Pr(e,function(i){return n.includes(i)}):n===e},At.prototype.isShown=function(){return this.isOpen()&&dt(this._current.html).has("open")},At.prototype.show=function(){this.isOpen()&&(dt(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},At.prototype.hide=function(){this.isOpen()&&(dt(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},At.prototype._getPosition=function(e){if(!ve(e)&&nt(e)){var t=this._canvas.viewbox(),n=oM(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+kv*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),c=this._getTargetBounds(e);return{left:c.right-a.left+kv*this._canvas.zoom(),top:c.top-a.top}},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=ve(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,tM)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},At.prototype._getTargetBounds=function(e){var t=this,n=ve(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 rM(e,t){var n=dt(e);t=ve(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function oM(e){return e.waypoints[e.waypoints.length-1]}function aM(e,t){return e=ve(e)?e:[e],t=ve(t)?t:[t],e.length===t.length&&Pr(e,function(n){return t.includes(n)})}const Dv={__depends__:[sc,eM,Oc],contextPad:["type",At]};var Bc,vt,Ov,yr,Lv,Iv,Nv,Qp,$c,Da,Bv,Jp,ef,tf,jc={},Fc=[],sM=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Hc=Array.isArray;function ji(e,t){for(var n in t)e[n]=t[n];return e}function nf(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function $v(e,t,n){var i,r,o,a={};for(o in t)o=="key"?i=t[o]:o=="ref"?r=t[o]:a[o]=t[o];if(arguments.length>2&&(a.children=arguments.length>3?Bc.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)a[o]===void 0&&(a[o]=e.defaultProps[o]);return zc(e,a,i,r,null)}function zc(e,t,n,i,r){var o={type:e,props:t,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++Ov,__i:-1,__u:0};return r==null&&vt.vnode!=null&&vt.vnode(o),o}function Vc(e){return e.children}function Gc(e,t){this.props=e,this.context=t}function Ur(e,t){if(t==null)return e.__?Ur(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"?Ur(e):null}function cM(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=ji({},t);o.__v=t.__v+1,vt.vnode&&vt.vnode(o),rf(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??Ur(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,Uv(i,o,r),t.__e=t.__=null,o.__e!=n&&jv(o)}}function jv(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),jv(e)}function Fv(e){(!e.__d&&(e.__d=!0)&&yr.push(e)&&!Wc.__r++||Lv!=vt.debounceRendering)&&((Lv=vt.debounceRendering)||Iv)(Wc)}function Wc(){try{for(var e,t=1;yr.length;)yr.length>t&&yr.sort(Nv),e=yr.shift(),t=yr.length,cM(e)}finally{yr.length=Wc.__r=0}}function Hv(e,t,n,i,r,o,a,c,s,u,l){var p,f,d,h,m,g,R=i&&i.__k||Fc,w=t.length;for(s=uM(n,t,R,s,w),p=0;p<w;p++)(d=n.__k[p])!=null&&(f=d.__i!=-1&&R[d.__i]||jc,d.__i=p,g=rf(e,d,f,r,o,a,c,s,u,l),h=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&of(f.ref,null,d),l.push(d.ref,d.__c||h,d)),m==null&&h!=null&&(m=h),4&d.__u?(s=zv(d,s,e),f.__e&&(f.__e=null)):typeof d.type=="function"&&g!==void 0?s=g:h&&(s=h.nextSibling),d.__u&=-7);return n.__e=m,s}function uM(e,t,n,i,r){var o,a,c,s,u,l=n.length,p=l,f=0;for(e.__k=new Array(r),o=0;o<r;o++)(a=t[o])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[o]=zc(null,a,null,null,null):Hc(a)?a=e.__k[o]=zc(Vc,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=zc(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[o]=a,s=o+f,a.__=e,a.__b=e.__b+1,c=null,(u=a.__i=lM(a,n,s,p))!=-1&&(p--,(c=n[u])&&(c.__u|=2)),c==null||c.__v==null?(u==-1&&(r>l?f--:r<l&&f++),typeof a.type!="function"&&(a.__u|=4)):u!=s&&(u==s-1?f--:u==s+1?f++:(u>s?f--:f++,a.__u|=4))):e.__k[o]=null;if(p)for(o=0;o<l;o++)(c=n[o])!=null&&(2&c.__u)==0&&(c.__e==i&&(i=Ur(c)),qv(c,c));return i}function zv(e,t,n){var i,r;if(typeof e.type=="function"){for(i=e.__k,r=0;i&&r<i.length;r++)i[r]&&(i[r].__=e,t=zv(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Ur(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function lM(e,t,n,i){var r,o,a,c=e.key,s=e.type,u=t[n],l=u!=null&&(2&u.__u)==0;if(u===null&&c==null||l&&c==u.key&&s==u.type)return n;if(i>(l?1:0)){for(r=n-1,o=n+1;r>=0||o<t.length;)if((u=t[a=r>=0?r--:o++])!=null&&(2&u.__u)==0&&c==u.key&&s==u.type)return a}return-1}function Vv(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||sM.test(t)?n:n+"px"}function Uc(e,t,n,i,r){var o,a;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof i=="string"&&(e.style.cssText=i=""),i)for(t in i)n&&t in n||Vv(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||Vv(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(Bv,"$1")),a=t.toLowerCase(),t=a in e||t=="onFocusOut"||t=="onFocusIn"?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?i?n[Da]=i[Da]:(n[Da]=Jp,e.addEventListener(t,o?tf:ef,o)):e.removeEventListener(t,o?tf:ef,o);else{if(r=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function Gv(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[$c]==null)t[$c]=Jp++;else if(t[$c]<n[Da])return;return n(vt.event?vt.event(t):t)}}}function rf(e,t,n,i,r,o,a,c,s,u){var l,p,f,d,h,m,g,R,w,x,b,E,T,L,A,F,H=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(s=!!(32&n.__u),o=[c=t.__e=n.__e]),(l=vt.__b)&&l(t);e:if(typeof H=="function"){p=a.length;try{if(w=t.props,x=H.prototype&&H.prototype.render,b=(l=H.contextType)&&i[l.__c],E=l?b?b.props.value:l.__:i,n.__c?R=(f=t.__c=n.__c).__=f.__E:(x?t.__c=f=new H(w,E):(t.__c=f=new Gc(w,E),f.constructor=H,f.render=fM),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=ji({},f.__s)),ji(f.__s,H.getDerivedStateFromProps(w,f.__s))),h=f.props,m=f.state,f.__v=t,d)x&&H.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),x&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(x&&H.getDerivedStateFromProps==null&&w!==h&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(w,E),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(w,f.__s,E)===!1){t.__v!=n.__v&&(f.props=w,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(N){N&&(N.__=t)}),Fc.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&a.push(f),c=Ur(n);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(w,f.__s,E),x&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(h,m,g)})}if(f.context=E,f.props=w,f.__P=e,f.__e=!1,T=vt.__r,L=0,x)f.state=f.__s,f.__d=!1,T&&T(t),l=f.render(f.props,f.state,f.context),Fc.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,T&&T(t),l=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++L<25);f.state=f.__s,f.getChildContext!=null&&(i=ji(ji({},i),f.getChildContext())),x&&!d&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(h,m)),A=l!=null&&l.type===Vc&&l.key==null?Yv(l.props.children):l,c=Hv(e,Hc(A)?A:[A],t,n,i,r,o,a,c,s,u),f.base=t.__e,t.__u&=-161,f.__h.length&&a.push(f),R&&(f.__E=f.__=null)}catch(N){if(a.length=p,t.__v=null,s||o!=null){if(N.then){for(t.__u|=s?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;o!=null&&(o[o.indexOf(c)]=null),t.__e=c}else if(o!=null)for(F=o.length;F--;)nf(o[F])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),N.then||Wv(t),vt.__e(N,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):c=t.__e=pM(n.__e,t,n,i,r,o,a,s,u);return(l=vt.diffed)&&l(t),128&t.__u?void 0:c}function Wv(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Wv))}function Uv(e,t,n){for(var i=0;i<n.length;i++)of(n[i],n[++i],n[++i]);vt.__c&&vt.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){vt.__e(o,r.__v)}})}function Yv(e){return typeof e!="object"||e==null||e.__b>0?e:Hc(e)?e.map(Yv):e.constructor!==void 0?null:ji({},e)}function pM(e,t,n,i,r,o,a,c,s){var u,l,p,f,d,h,m,g=n.props||jc,R=t.props,w=t.type;if(w=="svg"?r="http://www.w3.org/2000/svg":w=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),o!=null){for(u=0;u<o.length;u++)if((d=o[u])&&"setAttribute"in d==!!w&&(w?d.localName==w:d.nodeType==3)){e=d,o[u]=null;break}}if(e==null){if(w==null)return document.createTextNode(R);e=document.createElementNS(r,w,R.is&&R),c&&(vt.__m&&vt.__m(t,o),c=!1),o=null}if(w==null)g===R||c&&e.data==R||(e.data=R);else{if(o=w=="textarea"&&R.defaultValue!=null?null:o&&Bc.call(e.childNodes),!c&&o!=null)for(g={},u=0;u<e.attributes.length;u++)g[(d=e.attributes[u]).name]=d.value;for(u in g)d=g[u],u=="dangerouslySetInnerHTML"?p=d:u=="children"||u in R||u=="value"&&"defaultValue"in R||u=="checked"&&"defaultChecked"in R||Uc(e,u,null,d,r);for(u in R)d=R[u],u=="children"?f=d:u=="dangerouslySetInnerHTML"?l=d:u=="value"?h=d:u=="checked"?m=d:c&&typeof d!="function"||g[u]===d||Uc(e,u,d,g[u],r);if(l)c||p&&(l.__html==p.__html||l.__html==e.innerHTML)||(e.innerHTML=l.__html),t.__k=[];else if(p&&(e.innerHTML=""),Hv(t.type=="template"?e.content:e,Hc(f)?f:[f],t,n,i,w=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&Ur(n,0),c,s),o!=null)for(u=o.length;u--;)nf(o[u]);c&&w!="textarea"||(u="value",w=="progress"&&h==null?e.removeAttribute("value"):h!=null&&(h!==e[u]||w=="progress"&&!h||w=="option"&&h!=g[u])&&Uc(e,u,h,g[u],r),u="checked",m!=null&&m!=e[u]&&Uc(e,u,m,g[u],r))}return e}function of(e,t,n){try{if(typeof e=="function"){var i=typeof e.__u=="function";i&&e.__u(),i&&t==null||(e.__u=e(t))}else e.current=t}catch(r){vt.__e(r,n)}}function qv(e,t,n){var i,r;if(vt.unmount&&vt.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||of(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){vt.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&qv(i[r],t,n||typeof e.type!="function");n||nf(e.__e),e.__c=e.__=e.__e=void 0}function fM(e,t,n){return this.constructor(e,n)}function Kv(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),vt.__&&vt.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],rf(t,e=t.__k=$v(Vc,null,[e]),r||jc,jc,t.namespaceURI,r?null:t.firstChild?Bc.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),Uv(o,e,a),e.props.children=null}Bc=Fc.slice,vt={__e:function(e,t,n,i){for(var r,o,a;t=t.__;)if((r=t.__c)&&!r.__)try{if((o=r.constructor)&&o.getDerivedStateFromError!=null&&(r.setState(o.getDerivedStateFromError(e)),a=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e,i||{}),a=r.__d),a)return r.__E=r}catch(c){e=c}throw e}},Ov=0,Gc.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=ji({},this.state),typeof e=="function"&&(e=e(ji({},n),this.props)),e&&ji(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Fv(this))},Gc.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Fv(this))},Gc.prototype.render=Vc,yr=[],Iv=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Nv=function(e,t){return e.__v.__b-t.__v.__b},Wc.__r=0,Qp=Math.random().toString(8),$c="__d"+Qp,Da="__a"+Qp,Bv=/(PointerCapture)$|Capture$/i,Jp=0,ef=Gv(!1),tf=Gv(!0);var Xv=function(e,t,n,i){var r;t[0]=0;for(var o=1;o<t.length;o++){var a=t[o++],c=t[o]?(t[0]|=a?1:2,n[t[o++]]):t[++o];a===3?i[0]=c:a===4?i[1]=Object.assign(i[1]||{},c):a===5?(i[1]=i[1]||{})[t[++o]]=c:a===6?i[1][t[++o]]+=c+"":a?(r=e.apply(c,Xv(e,c,n,["",null])),i.push(r),c[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(c)}return i},Zv=new Map;function dM(e){var t=Zv.get(this);return t||(t=new Map,Zv.set(this,t)),(t=Xv(this,t.get(e)||(t.set(e,t=(function(n){for(var i,r,o=1,a="",c="",s=[0],u=function(f){o===1&&(f||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?s.push(0,f,a):o===3&&(f||a)?(s.push(3,f,a),o=2):o===2&&a==="..."&&f?s.push(4,f,0):o===2&&a&&!f?s.push(5,0,!0,a):o>=5&&((a||!f&&o===5)&&(s.push(o,0,a,r),o=6),f&&(s.push(o,f,0,r),o=6)),a=""},l=0;l<n.length;l++){l&&(o===1&&u(),u(l));for(var p=0;p<n[l].length;p++)i=n[l][p],o===1?i==="<"?(u(),s=[s],o=3):a+=i:o===4?a==="--"&&i===">"?(o=1,a=""):a=i+a[0]:c?i===c?c="":a+=i:i==='"'||i==="'"?c=i:i===">"?(u(),o=1):o&&(i==="="?(o=5,r=a,a=""):i==="/"&&(o<5||n[l][p+1]===">")?(u(),o===3&&(s=s[0]),o=s,(s=s[0]).push(2,0,o),o=0):i===" "||i===" "||i===`
|
|
11
|
+
`||i==="\r"?(u(),o=2):a+=i),o===3&&a==="!--"&&(o=4,s=s[0])}return u(),s})(e)),t),arguments,[])).length>1?t:t[0]}var rt=dM.bind($v),ko,Tt,af,Qv,Oa=0,Jv=[],$t=vt,e_=$t.__b,t_=$t.__r,n_=$t.diffed,i_=$t.__c,r_=$t.unmount,o_=$t.__;function Yc(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 sf(e){return Oa=1,hM(s_,e)}function hM(e,t,n){var i=Yc(ko++,2);if(i.t=e,!i.__c&&(i.__=[s_(void 0,t),function(c){var s=i.__N?i.__N[0]:i.__[0],u=i.t(s,c);s!==u&&(i.__N=[u,i.__[1]],i.__c.setState({}))}],i.__c=Tt,!Tt.__f)){var r=function(c,s,u){if(!i.__c.__H)return!0;var l=!1,p=i.__c.props!==c;if(i.__c.__H.__.some(function(d){if(d.__N){l=!0;var h=d.__[0];d.__=d.__N,d.__N=void 0,h!==d.__[0]&&(p=!0)}}),o){var f=o.call(this,c,s,u);return l?f||p:f}return!l||p};Tt.__f=!0;var o=Tt.shouldComponentUpdate,a=Tt.componentWillUpdate;Tt.componentWillUpdate=function(c,s,u){if(this.__e){var l=o;o=void 0,r(c,s,u),o=l}a&&a.call(this,c,s,u)},Tt.shouldComponentUpdate=r}return i.__N||i.__}function qc(e,t){var n=Yc(ko++,3);!$t.__s&&lf(n.__H,t)&&(n.__=e,n.u=t,Tt.__H.__h.push(n))}function cf(e,t){var n=Yc(ko++,4);!$t.__s&&lf(n.__H,t)&&(n.__=e,n.u=t,Tt.__h.push(n))}function Kc(e){return Oa=5,Fi(function(){return{current:e}},[])}function Fi(e,t){var n=Yc(ko++,7);return lf(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function La(e,t){return Oa=8,Fi(function(){return e},t)}function mM(){for(var e;e=Jv.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Xc),t.__h.some(uf),t.__h=[]}catch(n){t.__h=[],$t.__e(n,e.__v)}}}$t.__b=function(e){Tt=null,e_&&e_(e)},$t.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),o_&&o_(e,t)},$t.__r=function(e){t_&&t_(e),ko=0;var t=(Tt=e.__c).__H;t&&(af===Tt?(t.__h=[],Tt.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(Xc),t.__h.some(uf),t.__h=[],ko=0)),af=Tt},$t.diffed=function(e){n_&&n_(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Jv.push(t)!==1&&Qv===$t.requestAnimationFrame||((Qv=$t.requestAnimationFrame)||gM)(mM)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),af=Tt=null},$t.__c=function(e,t){t.some(function(n){try{n.__h.some(Xc),n.__h=n.__h.filter(function(i){return!i.__||uf(i)})}catch(i){t.some(function(r){r.__h&&(r.__h=[])}),t=[],$t.__e(i,n.__v)}}),i_&&i_(e,t)},$t.unmount=function(e){r_&&r_(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{Xc(i)}catch(r){t=r}}),n.__H=void 0,t&&$t.__e(t,n.__v))};var a_=typeof requestAnimationFrame=="function";function gM(e){var t,n=function(){clearTimeout(i),a_&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);a_&&(t=requestAnimationFrame(n))}function Xc(e){var t=Tt,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),Tt=t}function uf(e){var t=Tt;e.__c=e.__(),Tt=t}function lf(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function s_(e,t){return typeof t=="function"?t(e):t}function yM(e){const{navigationStack:t,setNavigationStack:n}=e,i=Fi(()=>t.length<=1?[]:t.slice(0,-1).map((a,c)=>({label:a.label,onClick:()=>n(s=>s.slice(0,c+1))})),[t,n]),r=t.length>0?()=>n([]):null,o=t.length>0?t[t.length-1].label:null;return rt`
|
|
12
12
|
<div class="djs-popup-breadcrumbs">
|
|
13
13
|
${r&&rt`
|
|
14
14
|
<button
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
</svg>
|
|
24
24
|
</button>
|
|
25
25
|
`}
|
|
26
|
-
${i.map((a,
|
|
26
|
+
${i.map((a,c)=>rt`
|
|
27
27
|
<button
|
|
28
|
-
key=${
|
|
28
|
+
key=${c}
|
|
29
29
|
type="button"
|
|
30
30
|
class="djs-popup-breadcrumbs-item"
|
|
31
31
|
onClick=${a.onClick}
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
</span>
|
|
42
42
|
`}
|
|
43
43
|
</div>
|
|
44
|
-
`}function c_(e){var t,n,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=c_(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function Zc(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=c_(e))&&(i&&(i+=" "),i+=t);return i}function
|
|
44
|
+
`}function c_(e){var t,n,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=c_(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function Zc(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=c_(e))&&(i&&(i+=" "),i+=t);return i}function vM(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:r,title:o}=e,a=Fi(()=>_M(t),[t]),c=u=>u.action&&!u.disabled,s=(u,l)=>{if(c(l))return n(u,l)};return rt`
|
|
45
45
|
<div class="djs-popup-header">
|
|
46
46
|
<h3 class="djs-popup-title" title=${o}>${o}</h3>
|
|
47
47
|
${a.map(u=>rt`
|
|
@@ -49,16 +49,16 @@
|
|
|
49
49
|
|
|
50
50
|
${u.entries.map(l=>rt`
|
|
51
51
|
<li key=${l.id}>
|
|
52
|
-
<${
|
|
53
|
-
class=${
|
|
54
|
-
onClick=${p=>
|
|
52
|
+
<${c(l)?"button":"span"}
|
|
53
|
+
class=${bM(l,l===i)}
|
|
54
|
+
onClick=${p=>s(p,l)}
|
|
55
55
|
title=${l.title||l.label}
|
|
56
56
|
data-id=${l.id}
|
|
57
57
|
aria-disabled=${l.disabled||void 0}
|
|
58
|
-
onMouseEnter=${()=>
|
|
59
|
-
onMouseLeave=${()=>
|
|
60
|
-
onFocus=${()=>
|
|
61
|
-
onBlur=${()=>
|
|
58
|
+
onMouseEnter=${()=>c(l)&&r(l)}
|
|
59
|
+
onMouseLeave=${()=>c(l)&&r(null)}
|
|
60
|
+
onFocus=${()=>c(l)&&r(l)}
|
|
61
|
+
onBlur=${()=>c(l)&&r(null)}
|
|
62
62
|
>
|
|
63
63
|
${l.imageUrl&&rt`<img class="djs-popup-entry-icon" src=${l.imageUrl} alt="" />`||l.imageHtml&&rt`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:l.imageHtml}} />`}
|
|
64
64
|
${l.label?rt`
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
</ul>
|
|
71
71
|
`)}
|
|
72
72
|
</div>
|
|
73
|
-
`}function
|
|
73
|
+
`}function _M(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 bM(e,t){return Zc("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function u_(e,t){return`${e}-entry-${t.id}`}function xM(e){const{idPrefix:t,entry:n,selected:i,onMouseEnter:r,onMouseLeave:o,onAction:a}=e,c=(u,l)=>{if(!n.disabled)return a(u,n,l)},s=!n.entries;return rt`
|
|
74
74
|
<li
|
|
75
75
|
class=${Zc("entry",{selected:i,disabled:n.disabled})}
|
|
76
76
|
data-id=${n.id}
|
|
@@ -80,11 +80,11 @@
|
|
|
80
80
|
aria-haspopup=${n.entries?"true":void 0}
|
|
81
81
|
title=${n.title}
|
|
82
82
|
aria-disabled=${n.disabled||void 0}
|
|
83
|
-
onClick=${
|
|
83
|
+
onClick=${c}
|
|
84
84
|
onMouseEnter=${r}
|
|
85
85
|
onMouseLeave=${o}
|
|
86
|
-
onDragStart=${u=>c
|
|
87
|
-
draggable=${
|
|
86
|
+
onDragStart=${u=>s&&c(u,"dragstart")}
|
|
87
|
+
draggable=${s}
|
|
88
88
|
>
|
|
89
89
|
<div class="djs-popup-entry-content">
|
|
90
90
|
<span
|
|
@@ -131,14 +131,14 @@
|
|
|
131
131
|
</div>
|
|
132
132
|
`}
|
|
133
133
|
</li>
|
|
134
|
-
`}function
|
|
134
|
+
`}function wM(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:r,idPrefix:o,id:a,ariaLabel:c,tabIndex:s,ariaActivedescendant:u,...l}=e,p=Kc();cf(()=>{if(!r||!r.current)return;const m=p.current;if(!m)return;const g=m.querySelector(".selected");g&&EM(g)},[t]);const f=()=>{r.current=!1},d=m=>{r.current||n(m)},h=()=>{r.current||n(null)};return rt`
|
|
135
135
|
<div
|
|
136
136
|
class="djs-popup-results"
|
|
137
137
|
ref=${p}
|
|
138
138
|
id=${a}
|
|
139
139
|
role="listbox"
|
|
140
|
-
aria-label=${
|
|
141
|
-
tabIndex=${
|
|
140
|
+
aria-label=${c}
|
|
141
|
+
tabIndex=${s}
|
|
142
142
|
aria-activedescendant=${u}
|
|
143
143
|
onMouseMove=${f}
|
|
144
144
|
>
|
|
@@ -155,7 +155,7 @@
|
|
|
155
155
|
aria-labelledby=${m.name?l_(o,m):void 0}
|
|
156
156
|
>
|
|
157
157
|
${m.entries.map(g=>rt`
|
|
158
|
-
<${
|
|
158
|
+
<${xM}
|
|
159
159
|
key=${g.id}
|
|
160
160
|
idPrefix=${o}
|
|
161
161
|
entry=${g}
|
|
@@ -168,19 +168,19 @@
|
|
|
168
168
|
</ul>
|
|
169
169
|
`)}
|
|
170
170
|
</div>
|
|
171
|
-
`}function l_(e,t){return`${e}-group-${t.id}`}function
|
|
171
|
+
`}function l_(e,t){return`${e}-group-${t.id}`}function EM(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const SM=new So("djs-popup");function RM(e){const{onClose:t,onSelect:n,className:i,headerEntries:r,position:o,title:a,width:c,scale:s,search:u,emptyPlaceholder:l,searchFn:p,entries:f,onOpened:d,onClosed:h}=e,[m,g]=sf([]);qc(()=>{g([])},[f]);const[R,w]=sf(""),x=R.trim().length>0,b=Fi(()=>AM(f),[f]),E=Fi(()=>Lt(u)?b.length>5:!1,[u,b]),T=Fi(()=>{const j=m.length?m[m.length-1].entries:f;return E?x?p(b.filter(({searchable:$})=>$!==!1),R,{keys:["label","search","description"]}).map(({item:$})=>$):j.filter(({rank:$=0})=>$>=0):j},[E,x,b,R,p,m,f]),L=Fi(()=>x?T.length?[{id:"default",entries:T}]:[]:TM(T),[T,x]),[A,F]=sf(T[0]),H=Kc(null),N=Kc(!1),V=Fi(()=>SM.next(),[]),pe=`${V}-results`,je=A&&u_(V,A);qc(()=>{const j=H.current;j&&T.includes(j)?F(j):F(T[0]),H.current=null},[T]);const lt=La(j=>{const $=PM(L);let ke=$.indexOf(A)+j;ke<0&&(ke=$.length-1),ke>=$.length&&(ke=0),N.current=!0,F($[ke])},[L,A]),Y=La(j=>{j>0&&A&&A.entries&&(N.current=!0,g($=>[...$,A])),j<0&&m.length>0&&(N.current=!0,H.current=m[m.length+j],g($=>$.slice(0,j)))},[A,m]),fe=La((j,$,U)=>{if(!(!$||$.disabled))return $.entries?(j.preventDefault(),Y(1)):n(j,$,U)},[n,Y]),he=La(j=>{if(j.key==="Enter"&&A){const $=j.target;return!!Or($,"a, button",!0)||A.disabled?void 0:fe(j,A)}if(j.key==="Backspace"){const $=j.target;if(!(Uu($,"input")&&$.value!==""))return Y(-1),j.preventDefault()}if(j.key==="ArrowUp")return lt(-1),j.preventDefault();if(j.key==="ArrowDown")return lt(1),j.preventDefault();if(j.key==="ArrowRight")return Y(1),j.preventDefault();if(j.key==="ArrowLeft")return Y(-1),j.preventDefault()},[A,lt,Y,fe]),se=La(j=>{Uu(j.target,"input")&&w(()=>j.target.value)},[w]);qc(()=>(d(),()=>{h()}),[]);const ce=!x&&m.length>0,ee=(a||r.length>0)&&!ce;return rt`
|
|
172
172
|
<${p_}
|
|
173
173
|
onClose=${t}
|
|
174
174
|
onKeyup=${se}
|
|
175
|
-
onKeydown=${
|
|
175
|
+
onKeydown=${he}
|
|
176
176
|
className=${i}
|
|
177
177
|
position=${o}
|
|
178
|
-
width=${
|
|
179
|
-
scale=${
|
|
178
|
+
width=${c}
|
|
179
|
+
scale=${s}
|
|
180
180
|
navigationStack=${m}
|
|
181
181
|
>
|
|
182
182
|
${ee&&rt`
|
|
183
|
-
<${
|
|
183
|
+
<${vM}
|
|
184
184
|
headerEntries=${r}
|
|
185
185
|
onSelect=${n}
|
|
186
186
|
selectedEntry=${A}
|
|
@@ -189,7 +189,7 @@
|
|
|
189
189
|
/>
|
|
190
190
|
`}
|
|
191
191
|
${ce&&rt`
|
|
192
|
-
<${
|
|
192
|
+
<${yM}
|
|
193
193
|
navigationStack=${m}
|
|
194
194
|
setNavigationStack=${g}
|
|
195
195
|
/>
|
|
@@ -197,7 +197,7 @@
|
|
|
197
197
|
${f.length>0&&rt`
|
|
198
198
|
<div class="djs-popup-body">
|
|
199
199
|
|
|
200
|
-
${
|
|
200
|
+
${E&&rt`
|
|
201
201
|
<div class="djs-popup-search">
|
|
202
202
|
<svg class="djs-popup-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
203
203
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.0325 8.5H9.625L13.3675 12.25L12.25 13.3675L8.5 9.625V9.0325L8.2975 8.8225C7.4425 9.5575 6.3325 10 5.125 10C2.4325 10 0.25 7.8175 0.25 5.125C0.25 2.4325 2.4325 0.25 5.125 0.25C7.8175 0.25 10 2.4325 10 5.125C10 6.3325 9.5575 7.4425 8.8225 8.2975L9.0325 8.5ZM1.75 5.125C1.75 6.9925 3.2575 8.5 5.125 8.5C6.9925 8.5 8.5 6.9925 8.5 5.125C8.5 3.2575 6.9925 1.75 5.125 1.75C3.2575 1.75 1.75 3.2575 1.75 5.125Z" fill="#22242A"/>
|
|
@@ -208,8 +208,8 @@
|
|
|
208
208
|
role="combobox"
|
|
209
209
|
aria-label="${a||"Search"}"
|
|
210
210
|
aria-expanded="true"
|
|
211
|
-
aria-controls=${
|
|
212
|
-
aria-activedescendant=${
|
|
211
|
+
aria-controls=${pe}
|
|
212
|
+
aria-activedescendant=${je||void 0}
|
|
213
213
|
aria-autocomplete="list"
|
|
214
214
|
/>
|
|
215
215
|
</div>
|
|
@@ -221,17 +221,17 @@
|
|
|
221
221
|
</div>
|
|
222
222
|
`}
|
|
223
223
|
|
|
224
|
-
<${
|
|
224
|
+
<${wM}
|
|
225
225
|
groupedEntries=${L}
|
|
226
226
|
selectedEntry=${A}
|
|
227
227
|
setSelectedEntry=${F}
|
|
228
228
|
keyboardSelection=${N}
|
|
229
|
-
onAction=${
|
|
230
|
-
idPrefix=${
|
|
231
|
-
id=${
|
|
229
|
+
onAction=${fe}
|
|
230
|
+
idPrefix=${V}
|
|
231
|
+
id=${pe}
|
|
232
232
|
ariaLabel=${a||"Results"}
|
|
233
|
-
tabIndex=${
|
|
234
|
-
ariaActivedescendant=${
|
|
233
|
+
tabIndex=${E?-1:0}
|
|
234
|
+
ariaActivedescendant=${E?void 0:je||void 0}
|
|
235
235
|
/>
|
|
236
236
|
|
|
237
237
|
${A&&A.documentationRef&&rt`
|
|
@@ -255,28 +255,28 @@
|
|
|
255
255
|
</div>
|
|
256
256
|
`}
|
|
257
257
|
${l&&T.length===0&&rt`
|
|
258
|
-
<div class="djs-popup-no-results">${zt(l)?l(
|
|
258
|
+
<div class="djs-popup-no-results">${zt(l)?l(R):l}</div>
|
|
259
259
|
`}
|
|
260
260
|
</${p_}>
|
|
261
|
-
`}function p_(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,navigationStack:a,position:
|
|
261
|
+
`}function p_(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,navigationStack:a,position:c}=e,s=Kc();return cf(()=>{if(typeof c!="function")return;const u=s.current,l=c(u);u.style.left=`${l.x}px`,u.style.top=`${l.y}px`},[s.current,c]),cf(()=>{const u=s.current;if(!u)return;(u.querySelector("input")||u.querySelector('[role="listbox"]')||u).focus()},[a]),qc(()=>{const u=p=>{if(p.key==="Escape")return p.preventDefault(),t()},l=p=>{if(!Or(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)}},[]),rt`
|
|
262
262
|
<div
|
|
263
263
|
class=${Zc("djs-popup",r)}
|
|
264
|
-
style=${
|
|
264
|
+
style=${CM(e)}
|
|
265
265
|
onKeydown=${n}
|
|
266
266
|
onKeyup=${i}
|
|
267
|
-
ref=${
|
|
267
|
+
ref=${s}
|
|
268
268
|
tabIndex="-1"
|
|
269
269
|
>
|
|
270
270
|
${o}
|
|
271
271
|
</div>
|
|
272
|
-
`}function
|
|
273
|
-
<${
|
|
272
|
+
`}function CM(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 PM(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function AM(e){const t=[];function n(i){i.forEach(r=>{if(r.entries){n(r.entries);return}t.push(r)})}return n(e),t}function TM(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 MM="data-id",f_=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],kM=1e3;function _t(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()})}_t.$inject=["config.popupMenu","eventBus","canvas","search"],_t.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:r,options:o}=this._current,a=d_(n),c=Object.entries(i).map(([f,d])=>({id:f,...d})),s=e&&(f=>this._ensureVisible(f,e)),u=this._updateScale(this._current.container);Kv(rt`
|
|
273
|
+
<${RM}
|
|
274
274
|
onClose=${f=>this.close(f)}
|
|
275
275
|
onSelect=${(f,d,h)=>this.trigger(f,d,h)}
|
|
276
|
-
position=${
|
|
276
|
+
position=${s}
|
|
277
277
|
className=${t}
|
|
278
278
|
entries=${a}
|
|
279
|
-
headerEntries=${
|
|
279
|
+
headerEntries=${c}
|
|
280
280
|
emptyPlaceholder=${r}
|
|
281
281
|
scale=${u}
|
|
282
282
|
onOpened=${this._onOpened.bind(this)}
|
|
@@ -284,7 +284,7 @@
|
|
|
284
284
|
searchFn=${this._search}
|
|
285
285
|
...${{...o}}
|
|
286
286
|
/>
|
|
287
|
-
`,this._current.container)},_t.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:
|
|
287
|
+
`,this._current.container)},_t.prototype.open=function(e,t,n,i){if(!e)throw new Error("target is missing");if(!t)throw new Error("providers for <"+t+"> not found");if(!n)throw new Error("position is missing");var r=this._eventBus.fire("popupMenu.open.allowed",{target:e,providerId:t});if(r===!1)return;this.isOpen()&&this.close();const{entries:o,headerEntries:a,emptyPlaceholder:c}=this._getContext(e,t);this._current={position:n,providerId:t,target:e,entries:o,headerEntries:a,emptyPlaceholder:c,container:this._createContainer({provider:t}),options:i},this._emit("open"),this._bindAutoClose(),this._render()},_t.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()},_t.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)}},_t.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},_t.prototype.reset=function(){const e=this._current.container;Kv(null,e),pi(e)},_t.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},_t.prototype._onOpened=function(){this._emit("opened")},_t.prototype._onClosed=function(){this._emit("closed")},_t.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},_t.prototype._bindAutoClose=function(){this._eventBus.once(f_,this.close,this)},_t.prototype._unbindAutoClose=function(){this._eventBus.off(f_,this.close,this)},_t.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},_t.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}},_t.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},_t.prototype.registerProvider=function(e,t,n){n||(n=t,t=kM),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},_t.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},_t.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]=si(o,["id"])});return}var r=i.getPopupMenuEntries(e);zt(r)?n=r(n):M(r,function(o,a){n[a]=o})}),n},_t.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]=si(o,["id"])});return}var r=i.getPopupMenuHeaderEntries(e);zt(r)?n=r(n):M(r,function(o,a){n[a]=o})}),n},_t.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>zt(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},_t.prototype.isOpen=function(){return!!this._current},_t.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let r=Or(e.delegateTarget||e.target,".entry",!0),o=an(r,MM);t={id:o,...this._getEntry(o)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(zt(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},_t.prototype._getEntry=function(e){var t=this._current.entries[e]||this._current.headerEntries[e];if(!t)throw new Error("entry not found");return t};function d_(e,t=[]){return Object.entries(e).map(([n,i])=>{const r={id:n,...i};return r.entries?r.entries=d_(r.entries,[...t,...h_(r.search)]):t.length&&(r.search=[...t,...h_(r.search)]),r})}function h_(e){return e?ve(e)?e:[e]:[]}function DM(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=OM(o,r,i);return a?{item:o,tokens:a}:[]}).sort(LM(i))}function OM(e,t,n){const{matchedWords:i,tokens:r}=n.reduce((o,a)=>{const c=e[a],{tokens:s,matchedWords:u}=ve(c)?c.reduce((l,p)=>{const{tokens:f,matchedWords:d}=__(p,t);return{tokens:[...l.tokens,f],matchedWords:{...l.matchedWords,...d}}},{matchedWords:{},tokens:[]}):__(c,t);return{tokens:{...o.tokens,[a]:s},matchedWords:{...o.matchedWords,...u}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:r}function LM(e){return(t,n)=>{let i=0,r=1;for(const o of e){const a=IM(t.tokens[o],n.tokens[o]);if(a!==0){i+=a*r,r*=m_;continue}const c=NM(t.item[o],n.item[o]);if(c!==0){i+=c*r,r*=m_;continue}}return i}}function IM(e,t){return g_(t)-g_(e)}const m_=.5,Do={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function g_(e){const t=e.reduce((c,s)=>c+y_(s),0),n=e.flat(),i=n.reduce((c,s)=>c+s.value.length,0),r=n.reduce((c,s)=>c+(s.match?s.value.length:0),0),o=i?r/i:0;return t*(1+o)}function y_(e){if(ve(e))return Math.max(...e.map(y_));const t=Math.log(e.value.length);return e.match?(e.start?e.end?Do.FULL:e.wordEnd?Do.START_FULL_WORD:Do.START_WORD_PART:e.wordStart?Do.WORD_START:Do.WORD_PART)*t:Do.NO_MATCH*t}function v_(e=""){return ve(e)?e.join(", "):e}function NM(e,t){return v_(e).localeCompare(v_(t))}function __(e,t){var u;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map(BM),o=[`(?<all>${r.join("\\s+")})`,...r].join("|"),a=new RegExp(o,"ig");let c,s=0;for(;c=a.exec(e);){const[l]=c,p=c.index,f=c.index+l.length,d=p===0,h=f===e.length,m=!!((u=c.groups)!=null&&u.all),g=d||/\s/.test(e.charAt(p-1)),R=h||/\s/.test(e.charAt(f));c.index>s&&n.push({value:e.slice(s,c.index),index:s}),n.push({value:l,index:c.index,match:!0,wordStart:g,wordEnd:R,start:d,end:h,all:m});const w=m?t:[l];for(const x of w)i[x.toLowerCase()]=!0;s=c.index+l.length}return s<e.length&&n.push({value:e.slice(s),index:s}),{tokens:n,matchedWords:i}}function BM(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const b_={search:["value",DM]},pf={__depends__:[b_],__init__:["popupMenu"],popupMenu:["type",_t]};var x_={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>`},LM=900;function Do(e,t,n,i){e.registerProvider(LM,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}Do.$inject=["contextPad","popupMenu","translate","canvas"],Do.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&O(t,this._getEntries(e)),t},Do.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Do.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${x_.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);O(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},Do.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 IM=["left","center","right","top","middle","bottom"];function Ia(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}Ia.$inject=["popupMenu","alignElements","translate","rules"],Ia.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&O(t,this._getEntries(e)),t},Ia.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Ia.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return M(IM,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:x_[o],action:function(){t.trigger(e,o),i.close()}}}),r};function Qc(e){Gn.call(this,e)}Qc.$inject=["eventBus"],ie(Qc,Gn),Qc.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=Oe(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=xs(n),n.length<2?!1:n})};const NM={__depends__:[qT,Dv,lf],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Do],alignElementsMenuProvider:["type",Ia],bpmnAlignElements:["type",Qc]};function ji(e,t,n,i){K.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=wu(Qr(a.closure.topLevel)),c=a.hints,u=c?c.autoResize:!0;if(u!==!1){var l=Jr(s,function(p){return p.parent.id});M(l,function(p,f){ge(u)&&(p=p.filter(function(d){return ot(u,eo({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,K),ji.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),Ss(O({},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(BM(i,t)){var r=$M(ti(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 BM(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function $M(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 Jc(e){e.invoke(ji,this)}Jc.$inject=["injector"],ie(Jc,ji),Jc.prototype.resize=function(e,t,n){v(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function Na(e){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 eu(e,t){Na.call(this,e),this._modeling=t}ie(eu,Na),eu.$inject=["eventBus","modeling"],eu.prototype.canResize=function(e,t){if(v(t.di,"bpmndi:BPMNPlane")||!v(t,"bpmn:Participant")&&!v(t,"bpmn:Lane")&&!v(t,"bpmn:SubProcess"))return!1;var n=!0;return M(e,function(i){if(v(i,"bpmn:Lane")||Ae(i)){n=!1;return}}),n};const jM={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Jc],bpmnAutoResizeProvider:["type",eu]};function Oo(e,t,n){this._canvas=n,this._opts=O({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var i=this;t.on("drag.move",function(r){var o=i._toBorderPoint(r);i.startScroll(o)}),t.on(["drag.cleanup"],function(){i.stopScroll()})}Oo.$inject=["config.autoScroll","eventBus","canvas"],Oo.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++)FM(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 FM(e,t,n){return t<e&&e<n}Oo.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Oo.prototype.setOptions=function(e){this._opts=O({},this._opts,e)},Oo.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=$r(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const HM={__depends__:[Oi],__init__:["autoScroll"],autoScroll:["type",Oo]};var E_="djs-bendpoint",w_="djs-segment-dragger";function zM(e,t){var n=$r(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 pf(e,t,n){var i=zM(e,n),r=Tl(t,i);return r}function ff(e,t){var n=de("g");Fe(n).add(E_),Se(e,n);var i=de("circle");re(i,{cx:0,cy:0,r:4}),Fe(i).add("djs-visual"),Se(n,i);var r=de("circle");return re(r,{cx:0,cy:0,r:10}),Fe(r).add("djs-hit"),Se(n,r),t&&Fe(n).add(t),n}function VM(e,t,n,i){var r=de("g");Se(e,r);var o=18,a=6,s=11,c=WM(t,n,i),u=a+s,l=de("rect");re(l,{x:-o/2,y:-a/2,width:o,height:a}),Fe(l).add("djs-visual"),Se(r,l);var p=de("rect");return re(p,{x:-c/2,y:-u/2,width:c,height:u}),Fe(p).add("djs-hit"),Se(r,p),Xh(r,i==="v"?90:0),r}function S_(e,t,n){var i=de("g"),r=rl(t,n),o=Pi(t,n);return Se(e,i),VM(i,t,n,o),Fe(i).add(w_),Fe(i).add(o==="h"?"horizontal":"vertical"),Xt(i,r.x,r.y),i}function df(e){return Math.abs(Math.round(e*2/3))}function GM(e,t){var n=UM(e,t);return Il(e,n)}function WM(e,t,n){var i=t.x-e.x,r=t.y-e.y;return df(n==="h"?i:r)}function UM(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=Nm(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function R_(e,t,n,i,r){function o(x,b,w){var T=x.index,L=x.point,A,F,H,N,z,le;return T<=0||x.bendpoint?!1:(A=b[T-1],F=b[T],H=rl(A,F),N=Pi(A,F),z=Math.abs(L.x-H.x),le=Math.abs(L.y-H.y),N&&z<=w&&le<=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=df(A)/2,F)}function s(x,b){var w=b.waypoints,T=pf(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=tt('.djs-bendpoints[data-element-id="'+Ma(x.id)+'"]',w);return!T&&b&&(T=de("g"),re(T,{"data-element-id":x.id}),Fe(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 tt('.djs-segment-dragger[data-segment-idx="'+x+'"]',b)}function p(x,b){b.waypoints.forEach(function(w,T){var L=ff(x);Se(x,L),Xt(L,w.x,w.y)}),ff(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=S_(x,T,L),re(A,{"data-segment-idx":F}),c(A,"mousemove",b))}function d(x){M(ys("."+E_,x),function(b){It(b)})}function h(x){M(ys("."+w_,x),function(b){It(b)})}function m(x){var b=u(x);return b||(b=u(x,!0),p(b,x),f(b,x)),b}function g(x){var b=u(x);b&&(h(b),d(b),f(b,x),p(b,x))}function S(x,b){var w=tt(".floating",x),T=b.point;w&&(Xt(w,T.x,T.y),Fe(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=rl(L,A),N=Pi(L,A),z,le;T&&(z=qM(T),le={x:F.x-H.x,y:F.y-H.y},N==="v"&&(le={x:le.y,y:le.x}),Xt(z,le.x,le.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?Fe(w).add(x.marker):Fe(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=pf(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=tt(".floating",w);T&&Fe(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}R_.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function qM(e){return tt(".djs-visual",e)}var C_=Math.round,Ur="reconnectStart",qr="reconnectEnd",Ba="updateWaypoints";function hf(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=Ur:!u&&c===d.length-1?h=qr: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===Ur?p:u,target:f===qr?p:l}),d){s.source=f===Ur?p:u,s.target=f===qr?p:l;return}d===!1&&(d=s.allowed=r.allowed(h,{connection:c,source:f===qr?p:l,target:f===Ur?p:u})),d&&(s.source=f===qr?p:l,s.target=f===Ur?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:C_(a.x),y:C_(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,l1(f),g)):(m===Ur?(g.docking="source",tu(s)&&(g.docking="target",g.newWaypoints=f.reverse())):m===qr&&(g.docking="target",tu(s)&&(g.docking="source",g.newWaypoints=f.reverse())),o.reconnect(l,d,h,S,g))},this)}hf.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],hf.prototype.cropWaypoints=function(e,t){var n=this._injector.get("connectionDocking",!1);if(!n)return t;var i=e.waypoints;return e.waypoints=t,e.waypoints=n.getCroppedWaypoints(e),t=e.waypoints,e.waypoints=i,t};function tu(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===Ur)return t&&i&&t===i&&n!==i;if(r===qr)return t&&n&&t===n&&n!==i}var YM="reconnectStart",KM="reconnectEnd",P_="updateWaypoints",$a="connect-ok",nu="connect-not-ok",A_="connect-hover",T_="djs-updating",M_="djs-dragging",k_=1100;function D_(e,t,n,i){this._injector=t;var r=t.get("connectionPreview",!1);n.on("bendpoint.move.start",function(o){var a=o.context,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=ff(i.getLayer("overlays"));Fe(f).add("djs-dragging"),i.addMarker(c,M_),i.addMarker(c,T_)}),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,A_),u===P_)return;s?(i.removeMarker(c,nu),i.addMarker(c,$a)):s===!1&&(i.removeMarker(c,$a),i.addMarker(c,nu))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],k_,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,A_),i.removeMarker(s,c?$a:nu))}),n.on("bendpoint.move.move",function(o){var a=o.context,s=a.allowed,c=a.bendpointIndex,u=a.draggerGfx,l=a.hover,p=a.type,f=a.connection,d=f.source,h=f.target,m=f.waypoints.slice(),g={x:o.x,y:o.y},S=a.hints||{},E={};r&&(S.connectionStart&&(E.connectionStart=S.connectionStart),S.connectionEnd&&(E.connectionEnd=S.connectionEnd),p===YM?tu(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===KM?tu(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===P_&&(m=e.cropWaypoints(f,m)),E.waypoints=m,r.drawPreview(a,s,E)),Xt(u,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],k_,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,T_),i.removeMarker(s,M_),u&&(i.removeMarker(u,$a),i.removeMarker(u,l?$a:nu)),r&&r.cleanUp(a)})}D_.$inject=["bendpointMove","injector","eventBus","canvas"];var O_="connect-hover",L_="djs-updating";function I_(e,t,n){return mf(e,t,e[t]+n)}function mf(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function XM(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 mf(t,i,s)}function N_(e){return e==="x"?"y":"x"}function B_(e,t,n){var i,r;return e.original?e.original:(i=ye(t),r=N_(n),mf(e,r,i[r]))}function $_(e,t,n,i,r,o){var a=e.get("connectionDocking",!1);this.start=function(p,f,d){var h,m=n.getGraphics(f),g=d-1,S=d,E=f.waypoints,x=E[g],b=E[S],w=pf(n,E,p),T,L,A;if(T=Pi(x,b),!!T)return L=T==="v"?"x":"y",g===0&&(x=B_(x,f.source,L)),S===E.length-1&&(b=B_(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=N_(p.axis),b=XM(d,g,E,x);Xt(p.draggerGfx,b.x,b.y)}function l(p,f){var d=0,h=p.filter(function(m,g){return il(p[g-1],p[g+1],m)?(d=g<=f?d-1:d,!1):!0});return{waypoints:h,segmentOffset:d}}t.on("connectionSegment.move.start",function(p){var f=p.context,d=p.connection,h=n.getLayer("overlays");f.originalWaypoints=d.waypoints.slice(),f.draggerGfx=S_(h,f.segmentStart,f.segmentEnd),Fe(f.draggerGfx).add("djs-dragging"),n.addMarker(d,L_)}),t.on("connectionSegment.move.move",function(p){var f=p.context,d=f.connection,h=f.segmentStartIndex,m=f.segmentEndIndex,g=f.segmentStart,S=f.segmentEnd,E=f.axis,x=f.originalWaypoints.slice(),b=I_(g,E,p["d"+E]),w=I_(S,E,p["d"+E]),T=x.length,L=0;x[h]=b,x[m]=w;var A,F;h<2&&(A=Kt(d.source,b),h===1?A==="intersect"&&(x.shift(),x[0]=b,L--):A!=="intersect"&&(x.unshift(g),L++)),m>T-3&&(F=Kt(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,O_)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,O_)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,d=f.connection;f.draggerGfx&&It(f.draggerGfx),n.removeMarker(d,L_)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(p){var f=p.context,d=f.connection;d.waypoints=f.originalWaypoints,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)})}$_.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var ZM=Math.abs,j_=Math.round;function QM(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],ZM(r-e)<=n)return r}function F_(e){return{x:e.x,y:e.y}}function H_(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:j_(e.x+e.width/2),y:j_(e.y+e.height/2)}}function Lo(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 z_(e){return e.children||[]}var JM=Math.abs,V_=Math.round,gf=10;function G_(e){function t(o,a){if(ge(o)){for(var s=o.length;s--;)if(JM(o[s]-a)<=gf)return o[s]}else{o=+o;var c=a%o;if(c<gf)return a-c;if(c>o-gf)return a-c+o}return a}function n(o,a){if(o.waypoints)return GM(a,o);if(o.width)return{x:V_(o.width/2+o.x),y:V_(o.height/2+o.y)}}function i(o){var a=o.context,s=a.snapPoints,c=a.connection,u=c.waypoints,l=a.segmentStart,p=a.segmentStartIndex,f=a.segmentEnd,d=a.segmentEndIndex,h=a.axis;if(s)return s;var m=[u[p-1],l,f,u[d+1]];return p<2&&m.unshift(n(c.source,o)),d>u.length-3&&m.unshift(n(c.target,o)),a.snapPoints=s={horizontal:[],vertical:[]},M(m,function(g){g&&(g=g.original||g,h==="y"&&s.horizontal.push(g.y),h==="x"&&s.vertical.push(g.x))}),s}e.on("connectionSegment.move.move",1500,function(o){var a=i(o),s=o.x,c=o.y,u,l;if(a){u=t(a.vertical,s),l=t(a.horizontal,c);var p=s-u,f=c-l;O(o,{dx:o.dx-p,dy:o.dy-f,x:u,y:l}),(p||a.vertical.indexOf(s)!==-1)&&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);!nt(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;O(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)}})}G_.$inject=["eventBus"];const e2={__depends__:[Oi,yi],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",R_],bendpointMove:["type",hf],bendpointMovePreview:["type",D_],connectionSegmentMove:["type",$_],bendpointSnapping:["type",G_]};function W_(e,t,n,i){function r(a,s){return i.allowed("connection.create",{source:a,target:s})}function o(a,s){return r(s,a)}e.on("connect.hover",function(a){var s=a.context,c=s.start,u=a.hover,l;if(s.hover=u,l=s.canExecute=r(c,u),!Zr(l)){if(l!==!1){s.source=c,s.target=u;return}l=s.canExecute=o(c,u),!Zr(l)&&l!==!1&&(s.source=u,s.target=c)}}),e.on(["connect.out","connect.cleanup"],function(a){var s=a.context;s.hover=null,s.source=null,s.target=null,s.canExecute=!1}),e.on("connect.end",function(a){var s=a.context,c=s.canExecute,u=s.connectionStart,l={x:a.x,y:a.y},p=s.source,f=s.target;if(!c)return!1;var d=null,h={connectionStart:yf(s)?l:u,connectionEnd:yf(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}}})}}W_.$inject=["eventBus","dragging","modeling","rules"];function yf(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var t2=1100,n2=900,U_="connect-ok",q_="connect-not-ok";function Y_(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;yf(o)&&(h=d,m=f),i.drawPreview(o,a,{source:c||u,target:p||s,connectionStart:h,connectionEnd:m})}),t.on("connect.hover",n2,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?U_:q_)}),t.on(["connect.out","connect.cleanup"],t2,function(r){var o=r.hover;o&&(n.removeMarker(o,U_),n.removeMarker(o,q_))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}Y_.$inject=["injector","eventBus","canvas"];const vf={__depends__:[Wn,yi,Oi],__init__:["connectPreview"],connect:["type",W_],connectPreview:["type",Y_]};var i2="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()),vs(i),r||(r=e.getConnection=r2(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&&It(e.connectionPreviewGfx)},Fi.prototype.getConnection=function(e){var t=o2(e);return this._elementFactory.createConnection(t)},Fi.prototype.createConnectionPreviewGfx=function(){var e=de("g");return re(e,{pointerEvents:"none"}),Fe(e).add(i2),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 r2(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 o2(e){return Ht(e)?e:{}}const a2={__init__:["connectionPreview"],connectionPreview:["type",Fi]},iu="complex-preview";class K_{constructor(t,n,i){this._canvas=t,this._graphicsFactory=n,this._previewSupport=i,this._markers=[]}create(t){this.cleanUp();const{created:n=[],moved:i=[],removed:r=[],resized:o=[]}=t,a=this._canvas.getLayer(iu);n.filter(s=>!s2(s)).forEach(s=>{let c;nt(s)?(c=this._graphicsFactory._createContainer("connection",de("g")),this._graphicsFactory.drawConnection(Ir(c),s)):(c=this._graphicsFactory._createContainer("shape",de("g")),this._graphicsFactory.drawShape(Ir(c),s),Xt(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);nt(s)?Xt(u,c.x,c.y):Xt(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",de("g"));this._graphicsFactory.drawShape(Ir(u),s,{width:c.width,height:c.height}),Xt(u,c.x,c.y),this._previewSupport.addDragger(s,a,u)})}cleanUp(){vs(this._canvas.getLayer(iu)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(iu)}hide(){this._canvas.hideLayer(iu)}}K_.$inject=["canvas","graphicsFactory","previewSupport"];function s2(e){return e.hidden}const c2={__depends__:[So],__init__:["complexPreview"],complexPreview:["type",K_]},X_=Math.round;function ru(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}ru.prototype.create=function(e,t,n){const i=this._complexPreview,r=this._connectionDocking,o=this._elementFactory,a=this._eventBus,s=this._layouter,c=this._rules,u=o.createShape(O({type:t},n)),l=a.fire("autoPlace",{source:e,shape:u});if(!l)return;O(u,{x:l.x-X_(u.width/2),y:l.y-X_(u.height/2)});const p=c.allowed("connection.create",{source:e,target:u,hints:{targetParent:e.parent}});let f=null;p&&(f=o.createConnection(p),f.waypoints=s.layoutConnection(f,{source:e,target:u}),f.waypoints=r.getCroppedWaypoints(f,e,u)),i.create({created:[u,f].filter(d=>!Zr(d))})},ru.prototype.cleanUp=function(){this._complexPreview.cleanUp()},ru.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const u2={__depends__:[kc,c2,Vp],__init__:["appendPreview"],appendPreview:["type",ru]};var Z_=Math.min,Q_=Math.max;function _f(e){e.preventDefault()}function ja(e){e.stopPropagation()}function l2(e){return e.nodeType===Node.TEXT_NODE}function p2(e){return[].slice.call(e)}function ii(e){this.container=e.container,this.parent=ct('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=tt("[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)}ii.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=ti(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);O(o.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},c);var u=ti(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return O(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},u),i.centerVertically&&O(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},u),a.innerText=n,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},ii.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)}},ii.prototype.insertText=function(e){e=f2(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},ii.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=p2(a.childNodes),c,u;if(l2(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)})},ii.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})}},ii.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=ct('<div class="djs-direct-editing-resize-handle"></div>');var s,c,u,l,p=function(h){_f(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){_f(h),ja(h);var m=Z_(Q_(u+h.clientX-s,i),o),g=Z_(Q_(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){_f(h),ja(h),we.unbind(document,"mousemove",f,!1),we.unbind(document,"mouseup",d,!1)};we.bind(n,"mousedown",p)}O(n.style,{position:"absolute",bottom:"0px",right:"0px",cursor:"nwse-resize",width:"0",height:"0",borderTop:(parseInt(this.style.fontSize)/4||3)+"px solid transparent",borderRight:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderBottom:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderLeft:(parseInt(this.style.fontSize)/4||3)+"px solid transparent"}),t.appendChild(n)},ii.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)},ii.prototype.getValue=function(){return this.content.innerText.trim()},ii.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},ii.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 f2(e){return e.replace(/\r\n|\r|\n/g,`
|
|
316
|
-
`)}function kn(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new ii({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())}kn.$inject=["eventBus","canvas"],kn.prototype.registerProvider=function(e){this._providers.push(e)},kn.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},kn.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},kn.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},kn.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},kn.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},kn.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()}},kn.prototype.getValue=function(){return this._textbox.getValue()},kn.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()},kn.prototype._handleResize=function(e){this._fire("resize",e)},kn.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},kn.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=ot(this._providers,function(i){return(t=i.activate(e))?i:null});return t&&(this.$textbox=this._textbox.create(t.bounds,t.style,t.text,t.options),this._active={element:e,context:t,provider:n},t.options&&t.options.resizable&&(this.resizable=!0),this._fire("activate")),!!t};const J_={__depends__:[sc],__init__:["directEditing"],directEditing:["type",kn]};function d2(e){return function(t){var n=t.target,i=X(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 h2={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 Y(e,t={}){var n=h2[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var m2=[Y("none-start-event",{actionName:"replace-with-none-start"}),Y("none-intermediate-throwing"),Y("none-end-event",{actionName:"replace-with-none-end"}),Y("message-start"),Y("timer-start"),Y("conditional-start"),Y("signal-start")],g2=[Y("none-start-event",{actionName:"replace-with-none-start"}),Y("none-intermediate-throwing"),Y("none-end-event",{actionName:"replace-with-none-end"})],y2=[Y("none-start-event",{actionName:"replace-with-none-start"}),Y("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),Y("none-end-event",{actionName:"replace-with-none-end"}),Y("message-intermediate-catch"),Y("message-intermediate-throw"),Y("timer-intermediate-catch"),Y("escalation-intermediate-throw"),Y("conditional-intermediate-catch"),Y("link-intermediate-catch"),Y("link-intermediate-throw"),Y("compensation-intermediate-throw"),Y("signal-intermediate-catch"),Y("signal-intermediate-throw")],v2=[Y("none-start-event",{actionName:"replace-with-none-start"}),Y("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),Y("none-end-event",{actionName:"replace-with-none-end"}),Y("message-end"),Y("escalation-end"),Y("error-end"),Y("cancel-end"),Y("compensation-end"),Y("signal-end"),Y("terminate-end")],_2=[Y("exclusive-gateway"),Y("parallel-gateway"),Y("inclusive-gateway"),Y("complex-gateway"),Y("event-based-gateway")],b2=[Y("transaction"),Y("event-subprocess"),Y("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),Y("collapsed-subprocess")],x2=[Y("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),Y("transaction"),Y("event-subprocess"),Y("collapsed-ad-hoc-subprocess")],eb=[Y("transaction"),Y("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),Y("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),Y("event-subprocess")],E2=eb,tb=[Y("task"),Y("user-task"),Y("service-task"),Y("send-task"),Y("receive-task"),Y("manual-task"),Y("rule-task"),Y("script-task"),Y("call-activity"),Y("collapsed-subprocess"),Y("expanded-subprocess"),Y("collapsed-ad-hoc-subprocess"),Y("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],w2=[Y("data-store-reference")],S2=[Y("data-object-reference")],R2=[Y("message-boundary"),Y("timer-boundary"),Y("escalation-boundary"),Y("conditional-boundary"),Y("error-boundary"),Y("cancel-boundary"),Y("signal-boundary"),Y("compensation-boundary"),Y("non-interrupting-message-boundary"),Y("non-interrupting-timer-boundary"),Y("non-interrupting-escalation-boundary"),Y("non-interrupting-conditional-boundary"),Y("non-interrupting-signal-boundary")],C2=[Y("message-start"),Y("timer-start"),Y("conditional-start"),Y("signal-start"),Y("error-start"),Y("escalation-start"),Y("compensation-start"),Y("non-interrupting-message-start"),Y("non-interrupting-timer-start"),Y("non-interrupting-conditional-start"),Y("non-interrupting-signal-start"),Y("non-interrupting-escalation-start")],P2=[{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"}],A2=[Y("expanded-pool"),Y("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],T2={"bpmn:MessageEventDefinition":[Y("message-start"),Y("message-intermediate-catch"),Y("message-intermediate-throw"),Y("message-end")],"bpmn:TimerEventDefinition":[Y("timer-start"),Y("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[Y("conditional-start"),Y("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[Y("signal-start"),Y("signal-intermediate-catch"),Y("signal-intermediate-throw"),Y("signal-end")],"bpmn:ErrorEventDefinition":[Y("error-start"),Y("error-end")],"bpmn:EscalationEventDefinition":[Y("escalation-start"),Y("escalation-intermediate-throw"),Y("escalation-end")],"bpmn:CompensateEventDefinition":[Y("compensation-start"),Y("compensation-intermediate-throw"),Y("compensation-end")]};const nb={"start-event-non-interrupting":`
|
|
315
|
+
</svg>`},$M=900;function Oo(e,t,n,i){e.registerProvider($M,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}Oo.$inject=["contextPad","popupMenu","translate","canvas"],Oo.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&O(t,this._getEntries(e)),t},Oo.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Oo.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${x_.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);O(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},Oo.prototype._getMenuPosition=function(e){var t=5,n=this._contextPad.getPad(e).html,i=n.getBoundingClientRect(),r={x:i.left,y:i.bottom+t};return r};var jM=["left","center","right","top","middle","bottom"];function Ia(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}Ia.$inject=["popupMenu","alignElements","translate","rules"],Ia.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&O(t,this._getEntries(e)),t},Ia.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Ia.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return M(jM,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:x_[o],action:function(){t.trigger(e,o),i.close()}}}),r};function Qc(e){Wn.call(this,e)}Qc.$inject=["eventBus"],ie(Qc,Wn),Qc.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=Le(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=xs(n),n.length<2?!1:n})};const FM={__depends__:[ZT,Dv,pf],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Oo],alignElementsMenuProvider:["type",Ia],bpmnAlignElements:["type",Qc]};function Hi(e,t,n,i){K.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=i;var r=this;this.postExecuted(["shape.create"],function(o){var a=o.context,c=a.hints||{},s=a.shape,u=a.parent||a.newParent;c.autoResize!==!1&&r._expand([s],u)}),this.postExecuted(["elements.move"],function(o){var a=o.context,c=Eu(Jr(a.closure.topLevel)),s=a.hints,u=s?s.autoResize:!0;if(u!==!1){var l=eo(c,function(p){return p.parent.id});M(l,function(p,f){ve(u)&&(p=p.filter(function(d){return ot(u,to({id:d.id}))})),r._expand(p,f)})}}),this.postExecuted(["shape.toggleCollapse"],function(o){var a=o.context,c=a.hints,s=a.shape;c&&c.autoResize===!1||s.collapsed||r._expand(s.children||[],s)}),this.postExecuted(["shape.resize"],function(o){var a=o.context,c=a.hints,s=a.shape,u=s.parent;c&&c.autoResize===!1||u&&r._expand([s],u)})}Hi.$inject=["eventBus","elementRegistry","modeling","rules"],ie(Hi,K),Hi.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=ye(Ct(e)),o=ye(t),a={};return r.top-o.top<i.top&&(a.top=r.top-n.top),r.left-o.left<i.left&&(a.left=r.left-n.left),o.right-r.right<i.right&&(a.right=r.right+n.right),o.bottom-r.bottom<i.bottom&&(a.bottom=r.bottom+n.bottom),Ss(O({},o,a))},Hi.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(HM(i,t)){var r=zM(ni(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},Hi.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Hi.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Hi.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function HM(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function zM(e,t){var n="";return e=ye(e),t=ye(t),e.top>t.top&&(n=n.concat("n")),e.right<t.right&&(n=n.concat("w")),e.bottom<t.bottom&&(n=n.concat("s")),e.left>t.left&&(n=n.concat("e")),n}function Jc(e){e.invoke(Hi,this)}Jc.$inject=["injector"],ie(Jc,Hi),Jc.prototype.resize=function(e,t,n){v(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function Na(e){Wn.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}Na.$inject=["eventBus"],ie(Na,Wn),Na.prototype.canResize=function(e,t){return!1};function eu(e,t){Na.call(this,e),this._modeling=t}ie(eu,Na),eu.$inject=["eventBus","modeling"],eu.prototype.canResize=function(e,t){if(v(t.di,"bpmndi:BPMNPlane")||!v(t,"bpmn:Participant")&&!v(t,"bpmn:Lane")&&!v(t,"bpmn:SubProcess"))return!1;var n=!0;return M(e,function(i){if(v(i,"bpmn:Lane")||Me(i)){n=!1;return}}),n};const VM={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Jc],bpmnAutoResizeProvider:["type",eu]};function Lo(e,t,n){this._canvas=n,this._opts=O({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var i=this;t.on("drag.move",function(r){var o=i._toBorderPoint(r);i.startScroll(o)}),t.on(["drag.cleanup"],function(){i.stopScroll()})}Lo.$inject=["config.autoScroll","eventBus","canvas"],Lo.prototype.startScroll=function(e){var t=this._canvas,n=this._opts,i=this,r=t.getContainer().getBoundingClientRect(),o=[e.x,e.y,r.width-e.x,r.height-e.y];this.stopScroll();for(var a=0,c=0,s=0;s<4;s++)GM(o[s],n.scrollThresholdOut[s],n.scrollThresholdIn[s])&&(s===0?a=n.scrollStep:s==1?c=n.scrollStep:s==2?a=-n.scrollStep:s==3&&(c=-n.scrollStep));(a!==0||c!==0)&&(t.scroll({dx:a,dy:c}),this._scrolling=setTimeout(function(){i.startScroll(e)},n.scrollRepeatTimeout))};function GM(e,t,n){return t<e&&e<n}Lo.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Lo.prototype.setOptions=function(e){this._opts=O({},this._opts,e)},Lo.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=jr(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const WM={__depends__:[Ii],__init__:["autoScroll"],autoScroll:["type",Lo]};var w_="djs-bendpoint",E_="djs-segment-dragger";function UM(e,t){var n=jr(t),i=e._container.getBoundingClientRect(),r;r={x:i.left,y:i.top};var o=e.viewbox();return{x:o.x+(n.x-r.x)/o.scale,y:o.y+(n.y-r.y)/o.scale}}function ff(e,t,n){var i=UM(e,n),r=Ml(t,i);return r}function df(e,t){var n=me("g");Fe(n).add(w_),Ce(e,n);var i=me("circle");re(i,{cx:0,cy:0,r:4}),Fe(i).add("djs-visual"),Ce(n,i);var r=me("circle");return re(r,{cx:0,cy:0,r:10}),Fe(r).add("djs-hit"),Ce(n,r),t&&Fe(n).add(t),n}function YM(e,t,n,i){var r=me("g");Ce(e,r);var o=18,a=6,c=11,s=KM(t,n,i),u=a+c,l=me("rect");re(l,{x:-o/2,y:-a/2,width:o,height:a}),Fe(l).add("djs-visual"),Ce(r,l);var p=me("rect");return re(p,{x:-s/2,y:-u/2,width:s,height:u}),Fe(p).add("djs-hit"),Ce(r,p),Xh(r,i==="v"?90:0),r}function S_(e,t,n){var i=me("g"),r=ol(t,n),o=Ti(t,n);return Ce(e,i),YM(i,t,n,o),Fe(i).add(E_),Fe(i).add(o==="h"?"horizontal":"vertical"),Xt(i,r.x,r.y),i}function hf(e){return Math.abs(Math.round(e*2/3))}function qM(e,t){var n=XM(e,t);return Nl(e,n)}function KM(e,t,n){var i=t.x-e.x,r=t.y-e.y;return hf(n==="h"?i:r)}function XM(e,t){for(var n=t.waypoints,i=1/0,r,o=0;o<n.length-1;o++){var a=n[o],c=n[o+1],s=Nm(e,[a,c]);s<i&&(i=s,r=o)}return[n[r],n[r+1]]}function R_(e,t,n,i,r){function o(x,b,E){var T=x.index,L=x.point,A,F,H,N,V,pe;return T<=0||x.bendpoint?!1:(A=b[T-1],F=b[T],H=ol(A,F),N=Ti(A,F),V=Math.abs(L.x-H.x),pe=Math.abs(L.y-H.y),N&&V<=E&&pe<=E)}function a(x,b){var E=x.waypoints,T,L,A,F;return b.index<=0||b.bendpoint||(T={start:E[b.index-1],end:E[b.index]},L=Ti(T.start,T.end),!L)?null:(L==="h"?A=T.end.x-T.start.x:A=T.end.y-T.start.y,F=hf(A)/2,F)}function c(x,b){var E=b.waypoints,T=ff(t,E,x),L;if(T){L=a(b,T);var A;if(o(T,E,L)?A=r.start(x,b,T.index):A=i.start(x,b,T.index,!T.bendpoint),A!==!1)return!0}}function s(x,b,E){Re.bind(x,b,function(T){n.triggerMouseEvent(b,T,E),T.stopPropagation()})}function u(x,b){var E=t.getLayer("overlays"),T=tt('.djs-bendpoints[data-element-id="'+Ma(x.id)+'"]',E);return!T&&b&&(T=me("g"),re(T,{"data-element-id":x.id}),Fe(T).add("djs-bendpoints"),Ce(E,T),s(T,"mousedown",x),s(T,"click",x),s(T,"dblclick",x)),T}function l(x,b){return tt('.djs-segment-dragger[data-segment-idx="'+x+'"]',b)}function p(x,b){b.waypoints.forEach(function(E,T){var L=df(x);Ce(x,L),Xt(L,E.x,E.y)}),df(x,"floating")}function f(x,b){for(var E=b.waypoints,T,L,A,F=1;F<E.length;F++)T=E[F-1],L=E[F],Ti(T,L)&&(A=S_(x,T,L),re(A,{"data-segment-idx":F}),s(A,"mousemove",b))}function d(x){M(ys("."+w_,x),function(b){Nt(b)})}function h(x){M(ys("."+E_,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 R(x,b){var E=tt(".floating",x),T=b.point;E&&(Xt(E,T.x,T.y),Fe(E).add("positioned"))}function w(x,b,E){var T=l(b.index,x),L=E[b.index-1],A=E[b.index],F=b.point,H=ol(L,A),N=Ti(L,A),V,pe;T&&(V=ZM(T),pe={x:F.x-H.x,y:F.y-H.y},N==="v"&&(pe={x:pe.y,y:pe.x}),Xt(V,pe.x,pe.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,E;b.waypoints&&(E=m(b),x.add?Fe(E).add(x.marker):Fe(E).remove(x.marker))}),e.on("element.mousemove",function(x){var b=x.element,E=b.waypoints,T,L;if(E){if(T=u(b,!0),L=ff(t,E,x.originalEvent),!L)return;R(T,L),L.bendpoint||w(T,L,E)}}),e.on("element.mousedown",function(x){if(sr(x)){var b=x.originalEvent,E=x.element;if(E.waypoints)return c(b,E)}}),e.on("selection.changed",function(x){var b=x.newSelection,E=b[0];E&&E.waypoints&&m(E)}),e.on("element.hover",function(x){var b=x.element;b.waypoints&&m(b)}),e.on("element.out",function(x){var b=x.element;if(b.waypoints){var E=u(b);if(E){var T=tt(".floating",E);T&&Fe(T).remove("positioned")}}}),e.on("element.updateId",function(x){var b=x.element,E=x.newId;if(b.waypoints){var T=u(b);T&&re(T,{"data-element-id":E})}}),this.addHandles=m,this.updateHandles=g,this.getBendpointsContainer=u,this.getSegmentDragger=l}R_.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function ZM(e){return tt(".djs-visual",e)}var C_=Math.round,Yr="reconnectStart",qr="reconnectEnd",Ba="updateWaypoints";function mf(e,t,n,i,r,o){this._injector=e,this.start=function(a,c,s,u){var l=n.getGraphics(c),p=c.source,f=c.target,d=c.waypoints,h;!u&&s===0?h=Yr:!u&&s===d.length-1?h=qr:h=Ba;var m=h===Ba?"connection.updateWaypoints":"connection.reconnect",g=r.allowed(m,{connection:c,source:p,target:f});if(g===!1&&(g=r.allowed(m,{connection:c,source:f,target:p})),g!==!1)return i.init(a,"bendpoint.move",{data:{connection:c,connectionGfx:l,context:{allowed:g,bendpointIndex:s,connection:c,source:p,target:f,insert:u,type:h}}})},t.on("bendpoint.move.hover",function(a){var c=a.context,s=c.connection,u=s.source,l=s.target,p=a.hover,f=c.type;c.hover=p;var d;if(p){var h=f===Ba?"connection.updateWaypoints":"connection.reconnect";if(d=c.allowed=r.allowed(h,{connection:s,source:f===Yr?p:u,target:f===qr?p:l}),d){c.source=f===Yr?p:u,c.target=f===qr?p:l;return}d===!1&&(d=c.allowed=r.allowed(h,{connection:s,source:f===qr?p:l,target:f===Yr?p:u})),d&&(c.source=f===qr?p:l,c.target=f===Yr?p:u)}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(a){var c=a.context,s=c.type;c.hover=null,c.source=null,c.target=null,s!==Ba&&(c.allowed=!1)}),t.on("bendpoint.move.end",function(a){var c=a.context,s=c.allowed,u=c.bendpointIndex,l=c.connection,p=c.insert,f=l.waypoints.slice(),d=c.source,h=c.target,m=c.type,g=c.hints||{},R={x:C_(a.x),y:C_(a.y)};if(!s)return!1;m===Ba?(p?f.splice(u,0,R):f[u]=R,g.bendpointMove={insert:p,bendpointIndex:u},f=this.cropWaypoints(l,f),o.updateWaypoints(l,h1(f),g)):(m===Yr?(g.docking="source",tu(c)&&(g.docking="target",g.newWaypoints=f.reverse())):m===qr&&(g.docking="target",tu(c)&&(g.docking="source",g.newWaypoints=f.reverse())),o.reconnect(l,d,h,R,g))},this)}mf.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],mf.prototype.cropWaypoints=function(e,t){var n=this._injector.get("connectionDocking",!1);if(!n)return t;var i=e.waypoints;return e.waypoints=t,e.waypoints=n.getCroppedWaypoints(e),t=e.waypoints,e.waypoints=i,t};function tu(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===Yr)return t&&i&&t===i&&n!==i;if(r===qr)return t&&n&&t===n&&n!==i}var QM="reconnectStart",JM="reconnectEnd",P_="updateWaypoints",$a="connect-ok",nu="connect-not-ok",A_="connect-hover",T_="djs-updating",M_="djs-dragging",k_=1100;function D_(e,t,n,i){this._injector=t;var r=t.get("connectionPreview",!1);n.on("bendpoint.move.start",function(o){var a=o.context,c=a.bendpointIndex,s=a.connection,u=a.insert,l=s.waypoints,p=l.slice();a.waypoints=l,u&&p.splice(c,0,{x:o.x,y:o.y}),s.waypoints=p;var f=a.draggerGfx=df(i.getLayer("overlays"));Fe(f).add("djs-dragging"),i.addMarker(s,M_),i.addMarker(s,T_)}),n.on("bendpoint.move.hover",function(o){var a=o.context,c=a.allowed,s=a.hover,u=a.type;if(s){if(i.addMarker(s,A_),u===P_)return;c?(i.removeMarker(s,nu),i.addMarker(s,$a)):c===!1&&(i.removeMarker(s,$a),i.addMarker(s,nu))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],k_,function(o){var a=o.context,c=a.hover,s=a.target;c&&(i.removeMarker(c,A_),i.removeMarker(c,s?$a:nu))}),n.on("bendpoint.move.move",function(o){var a=o.context,c=a.allowed,s=a.bendpointIndex,u=a.draggerGfx,l=a.hover,p=a.type,f=a.connection,d=f.source,h=f.target,m=f.waypoints.slice(),g={x:o.x,y:o.y},R=a.hints||{},w={};r&&(R.connectionStart&&(w.connectionStart=R.connectionStart),R.connectionEnd&&(w.connectionEnd=R.connectionEnd),p===QM?tu(a)?(w.connectionEnd=w.connectionEnd||g,w.source=h,w.target=l||d,m=m.reverse()):(w.connectionStart=w.connectionStart||g,w.source=l||d,w.target=h):p===JM?tu(a)?(w.connectionStart=w.connectionStart||g,w.source=l||h,w.target=d,m=m.reverse()):(w.connectionEnd=w.connectionEnd||g,w.source=d,w.target=l||h):(w.noCropping=!0,w.noLayout=!0,m[s]=g),p===P_&&(m=e.cropWaypoints(f,m)),w.waypoints=m,r.drawPreview(a,c,w)),Xt(u,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],k_,function(o){var a=o.context,c=a.connection,s=a.draggerGfx,u=a.hover,l=a.target,p=a.waypoints;c.waypoints=p,Nt(s),i.removeMarker(c,T_),i.removeMarker(c,M_),u&&(i.removeMarker(u,$a),i.removeMarker(u,l?$a:nu)),r&&r.cleanUp(a)})}D_.$inject=["bendpointMove","injector","eventBus","canvas"];var O_="connect-hover",L_="djs-updating";function I_(e,t,n){return gf(e,t,e[t]+n)}function gf(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function e2(e,t,n,i){var r=Math.max(t[i],n[i]),o=Math.min(t[i],n[i]),a=20,c=Math.min(Math.max(o+a,e[i]),r-a);return gf(t,i,c)}function N_(e){return e==="x"?"y":"x"}function B_(e,t,n){var i,r;return e.original?e.original:(i=_e(t),r=N_(n),gf(e,r,i[r]))}function $_(e,t,n,i,r,o){var a=e.get("connectionDocking",!1);this.start=function(p,f,d){var h,m=n.getGraphics(f),g=d-1,R=d,w=f.waypoints,x=w[g],b=w[R],E=ff(n,w,p),T,L,A;if(T=Ti(x,b),!!T)return L=T==="v"?"x":"y",g===0&&(x=B_(x,f.source,L)),R===w.length-1&&(b=B_(b,f.target,L)),E?A=E.point:A={x:(x.x+b.x)/2,y:(x.y+b.y)/2},h={connection:f,segmentStartIndex:g,segmentEndIndex:R,segmentStart:x,segmentEnd:b,axis:L,dragPosition:A},i.init(p,A,"connectionSegment.move",{cursor:L==="x"?"resize-ew":"resize-ns",data:{connection:f,connectionGfx:m,context:h}})};function c(p,f){if(!a)return f;var d=p.waypoints,h;return p.waypoints=f,h=a.getCroppedWaypoints(p),p.waypoints=d,h}function s(p){r.update("connection",p.connection,p.connectionGfx)}function u(p,f,d){var h=p.newWaypoints,m=p.segmentStartIndex+f,g=h[m],R=p.segmentEndIndex+f,w=h[R],x=N_(p.axis),b=e2(d,g,w,x);Xt(p.draggerGfx,b.x,b.y)}function l(p,f){var d=0,h=p.filter(function(m,g){return rl(p[g-1],p[g+1],m)?(d=g<=f?d-1:d,!1):!0});return{waypoints:h,segmentOffset:d}}t.on("connectionSegment.move.start",function(p){var f=p.context,d=p.connection,h=n.getLayer("overlays");f.originalWaypoints=d.waypoints.slice(),f.draggerGfx=S_(h,f.segmentStart,f.segmentEnd),Fe(f.draggerGfx).add("djs-dragging"),n.addMarker(d,L_)}),t.on("connectionSegment.move.move",function(p){var f=p.context,d=f.connection,h=f.segmentStartIndex,m=f.segmentEndIndex,g=f.segmentStart,R=f.segmentEnd,w=f.axis,x=f.originalWaypoints.slice(),b=I_(g,w,p["d"+w]),E=I_(R,w,p["d"+w]),T=x.length,L=0;x[h]=b,x[m]=E;var A,F;h<2&&(A=Kt(d.source,b),h===1?A==="intersect"&&(x.shift(),x[0]=b,L--):A!=="intersect"&&(x.unshift(g),L++)),m>T-3&&(F=Kt(d.target,E),m===T-2?F==="intersect"&&(x.pop(),x[x.length-1]=E):F!=="intersect"&&x.push(R)),f.newWaypoints=d.waypoints=c(d,x),u(f,L,p),f.newSegmentStartIndex=h+L,s(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,O_)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,O_)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,d=f.connection;f.draggerGfx&&Nt(f.draggerGfx),n.removeMarker(d,L_)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(p){var f=p.context,d=f.connection;d.waypoints=f.originalWaypoints,s(p)}),t.on("connectionSegment.move.end",function(p){var f=p.context,d=f.connection,h=f.newWaypoints,m=f.newSegmentStartIndex;h=h.map(function(E){return{original:E.original,x:Math.round(E.x),y:Math.round(E.y)}});var g=l(h,m),R=g.waypoints,w=c(d,R),x=g.segmentOffset,b={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:m+x}};o.updateWaypoints(d,w,b)})}$_.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var t2=Math.abs,j_=Math.round;function n2(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],t2(r-e)<=n)return r}function F_(e){return{x:e.x,y:e.y}}function H_(e){return{x:e.x+e.width,y:e.y+e.height}}function Kn(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:j_(e.x+e.width/2),y:j_(e.y+e.height/2)}}function Io(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 z_(e){return e.children||[]}var i2=Math.abs,V_=Math.round,yf=10;function G_(e){function t(o,a){if(ve(o)){for(var c=o.length;c--;)if(i2(o[c]-a)<=yf)return o[c]}else{o=+o;var s=a%o;if(s<yf)return a-s;if(s>o-yf)return a-s+o}return a}function n(o,a){if(o.waypoints)return qM(a,o);if(o.width)return{x:V_(o.width/2+o.x),y:V_(o.height/2+o.y)}}function i(o){var a=o.context,c=a.snapPoints,s=a.connection,u=s.waypoints,l=a.segmentStart,p=a.segmentStartIndex,f=a.segmentEnd,d=a.segmentEndIndex,h=a.axis;if(c)return c;var m=[u[p-1],l,f,u[d+1]];return p<2&&m.unshift(n(s.source,o)),d>u.length-3&&m.unshift(n(s.target,o)),a.snapPoints=c={horizontal:[],vertical:[]},M(m,function(g){g&&(g=g.original||g,h==="y"&&c.horizontal.push(g.y),h==="x"&&c.vertical.push(g.x))}),c}e.on("connectionSegment.move.move",1500,function(o){var a=i(o),c=o.x,s=o.y,u,l;if(a){u=t(a.vertical,c),l=t(a.horizontal,s);var p=c-u,f=s-l;O(o,{dx:o.dx-p,dy:o.dy-f,x:u,y:l}),(p||a.vertical.indexOf(c)!==-1)&&Mt(o,"x",u),(f||a.horizontal.indexOf(s)!==-1)&&Mt(o,"y",l)}});function r(o){var a=o.snapPoints,c=o.connection.waypoints,s=o.bendpointIndex;if(a)return a;var u=[c[s-1],c[s+1]];return o.snapPoints=a={horizontal:[],vertical:[]},M(u,function(l){l&&(l=l.original||l,a.horizontal.push(l.y),a.vertical.push(l.x))}),a}e.on(["connect.hover","connect.move","connect.end"],1500,function(o){var a=o.context,c=a.hover,s=c&&n(c,o);!nt(c)||!s||!s.x||!s.y||(Mt(o,"x",s.x),Mt(o,"y",s.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(o){var a=o.context,c=r(a),s=a.hover,u=s&&n(s,o),l=o.x,p=o.y,f,d;if(c){f=t(u?c.vertical.concat([u.x]):c.vertical,l),d=t(u?c.horizontal.concat([u.y]):c.horizontal,p);var h=l-f,m=p-d;O(o,{dx:o.dx-h,dy:o.dy-m,x:o.x-h,y:o.y-m}),(h||c.vertical.indexOf(l)!==-1)&&Mt(o,"x",f),(m||c.horizontal.indexOf(p)!==-1)&&Mt(o,"y",d)}})}G_.$inject=["eventBus"];const r2={__depends__:[Ii,yi],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",R_],bendpointMove:["type",mf],bendpointMovePreview:["type",D_],connectionSegmentMove:["type",$_],bendpointSnapping:["type",G_]};function W_(e,t,n,i){function r(a,c){return i.allowed("connection.create",{source:a,target:c})}function o(a,c){return r(c,a)}e.on("connect.hover",function(a){var c=a.context,s=c.start,u=a.hover,l;if(c.hover=u,l=c.canExecute=r(s,u),!Qr(l)){if(l!==!1){c.source=s,c.target=u;return}l=c.canExecute=o(s,u),!Qr(l)&&l!==!1&&(c.source=u,c.target=s)}}),e.on(["connect.out","connect.cleanup"],function(a){var c=a.context;c.hover=null,c.source=null,c.target=null,c.canExecute=!1}),e.on("connect.end",function(a){var c=a.context,s=c.canExecute,u=c.connectionStart,l={x:a.x,y:a.y},p=c.source,f=c.target;if(!s)return!1;var d=null,h={connectionStart:vf(c)?l:u,connectionEnd:vf(c)?u:l};Ht(s)&&(d=s),c.connection=n.connect(p,f,d,h)}),this.start=function(a,c,s,u){Ht(s)||(u=s,s=_e(c)),t.init(a,"connect",{autoActivate:u,data:{shape:c,context:{start:c,connectionStart:s}}})}}W_.$inject=["eventBus","dragging","modeling","rules"];function vf(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var o2=1100,a2=900,U_="connect-ok",Y_="connect-not-ok";function q_(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",function(r){var o=r.context,a=o.canExecute,c=o.hover,s=o.source,u=o.start,l=o.startPosition,p=o.target,f=o.connectionStart||l,d=o.connectionEnd||{x:r.x,y:r.y},h=f,m=d;vf(o)&&(h=d,m=f),i.drawPreview(o,a,{source:s||u,target:p||c,connectionStart:h,connectionEnd:m})}),t.on("connect.hover",a2,function(r){var o=r.context,a=r.hover,c=o.canExecute;c!==null&&n.addMarker(a,c?U_:Y_)}),t.on(["connect.out","connect.cleanup"],o2,function(r){var o=r.hover;o&&(n.removeMarker(o,U_),n.removeMarker(o,Y_))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}q_.$inject=["injector","eventBus","canvas"];const _f={__depends__:[Un,yi,Ii],__init__:["connectPreview"],connect:["type",W_],connectPreview:["type",q_]};var s2="djs-dragger";function zi(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)}zi.$inject=["injector","canvas","graphicsFactory","elementFactory"],zi.prototype.drawPreview=function(e,t,n){n=n||{};var i=e.connectionPreviewGfx,r=e.getConnection,o=n.source,a=n.target,c=n.waypoints,s=n.connectionStart,u=n.connectionEnd,l=n.noLayout,p=n.noCropping,f=n.noNoop,d,h=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),vs(i),r||(r=e.getConnection=c2(function(m,g,R){return h.getConnection(m,g,R)})),t&&(d=r(t,o,a)),!d){!f&&this.drawNoopPreview(i,n);return}d.waypoints=c||[],this._layouter&&!l&&(d.waypoints=this._layouter.layoutConnection(d,{source:o,target:a,connectionStart:s,connectionEnd:u,waypoints:n.waypoints||d.waypoints})),(!d.waypoints||!d.waypoints.length)&&(d.waypoints=[o?_e(o):s,a?_e(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)"})},zi.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||_e(n),o=t.connectionEnd||_e(i),a=this.cropWaypoints(r,o,n,i),c=this.createNoopConnection(a[0],a[1]);Ce(e,c)},zi.prototype.cropWaypoints=function(e,t,n,i){var r=this._graphicsFactory,o=n&&r.getShapePath(n),a=i&&r.getShapePath(i),c=r.getConnectionPath({waypoints:[e,t]});return e=n&&Qo(o,c,!0)||e,t=i&&Qo(a,c,!1)||t,[e,t]},zi.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&Nt(e.connectionPreviewGfx)},zi.prototype.getConnection=function(e){var t=u2(e);return this._elementFactory.createConnection(t)},zi.prototype.createConnectionPreviewGfx=function(){var e=me("g");return re(e,{pointerEvents:"none"}),Fe(e).add(s2),Ce(this._canvas.getActiveLayer(),e),e},zi.prototype.createNoopConnection=function(e,t){return qo([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function c2(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 u2(e){return Ht(e)?e:{}}const l2={__init__:["connectionPreview"],connectionPreview:["type",zi]},iu="complex-preview";class K_{constructor(t,n,i){this._canvas=t,this._graphicsFactory=n,this._previewSupport=i,this._markers=[]}create(t){this.cleanUp();const{created:n=[],moved:i=[],removed:r=[],resized:o=[]}=t,a=this._canvas.getLayer(iu);n.filter(c=>!p2(c)).forEach(c=>{let s;nt(c)?(s=this._graphicsFactory._createContainer("connection",me("g")),this._graphicsFactory.drawConnection(Nr(s),c)):(s=this._graphicsFactory._createContainer("shape",me("g")),this._graphicsFactory.drawShape(Nr(s),c),Xt(s,c.x,c.y)),this._previewSupport.addDragger(c,a,s)}),i.forEach(({element:c,delta:s})=>{this._previewSupport.addDragger(c,a,void 0,"djs-dragging"),this._canvas.addMarker(c,"djs-element-hidden"),this._markers.push([c,"djs-element-hidden"]);const u=this._previewSupport.addDragger(c,a);nt(c)?Xt(u,s.x,s.y):Xt(u,c.x+s.x,c.y+s.y)}),r.forEach(c=>{this._previewSupport.addDragger(c,a,void 0,"djs-dragging"),this._canvas.addMarker(c,"djs-element-hidden"),this._markers.push([c,"djs-element-hidden"])}),o.forEach(({shape:c,bounds:s})=>{this._canvas.addMarker(c,"djs-hidden"),this._markers.push([c,"djs-hidden"]),this._previewSupport.addDragger(c,a,void 0,"djs-dragging");const u=this._graphicsFactory._createContainer("shape",me("g"));this._graphicsFactory.drawShape(Nr(u),c,{width:s.width,height:s.height}),Xt(u,s.x,s.y),this._previewSupport.addDragger(c,a,u)})}cleanUp(){vs(this._canvas.getLayer(iu)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(iu)}hide(){this._canvas.hideLayer(iu)}}K_.$inject=["canvas","graphicsFactory","previewSupport"];function p2(e){return e.hidden}const f2={__depends__:[Ro],__init__:["complexPreview"],complexPreview:["type",K_]},X_=Math.round;function ru(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}ru.prototype.create=function(e,t,n){const i=this._complexPreview,r=this._connectionDocking,o=this._elementFactory,a=this._eventBus,c=this._layouter,s=this._rules,u=o.createShape(O({type:t},n)),l=a.fire("autoPlace",{source:e,shape:u});if(!l)return;O(u,{x:l.x-X_(u.width/2),y:l.y-X_(u.height/2)});const p=s.allowed("connection.create",{source:e,target:u,hints:{targetParent:e.parent}});let f=null;p&&(f=o.createConnection(p),f.waypoints=c.layoutConnection(f,{source:e,target:u}),f.waypoints=r.getCroppedWaypoints(f,e,u)),i.create({created:[u,f].filter(d=>!Qr(d))})},ru.prototype.cleanUp=function(){this._complexPreview.cleanUp()},ru.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const d2={__depends__:[kc,f2,Gp],__init__:["appendPreview"],appendPreview:["type",ru]};var Z_=Math.min,Q_=Math.max;function bf(e){e.preventDefault()}function ja(e){e.stopPropagation()}function h2(e){return e.nodeType===Node.TEXT_NODE}function m2(e){return[].slice.call(e)}function ri(e){this.container=e.container,this.parent=ut('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=tt("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=yn(this.autoResize,this),this.handlePaste=yn(this.handlePaste,this)}ri.prototype.create=function(e,t,n,i){var r=this,o=this.parent,a=this.content,c=this.container;i=this.options=i||{},t=this.style=t||{};var s=ni(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);O(o.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},s);var u=ni(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return O(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},u),i.centerVertically&&O(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},u),a.innerText=n,Re.bind(a,"keydown",this.keyHandler),Re.bind(a,"mousedown",ja),Re.bind(a,"paste",r.handlePaste),Re.bind(a,"focusout",this.focusoutHandler),i.autoResize&&Re.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),c.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},ri.prototype.handlePaste=function(e){var t=this.options,n=this.style;e.preventDefault();var i;if(e.clipboardData?i=e.clipboardData.getData("text/plain"):i=window.clipboardData.getData("Text"),this.insertText(i),t.autoResize){var r=this.autoResize(n);r&&this.resizeHandler(r)}},ri.prototype.insertText=function(e){e=g2(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},ri.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,c=m2(a.childNodes),s,u;if(h2(a)){var l=n.textContent;n.textContent=l.substring(0,r)+e+l.substring(o),s=n,u=r+e.length}else if(n===this.content&&i===this.content){var p=document.createTextNode(e);this.content.insertBefore(p,c[r]),s=p,u=p.textContent.length}else{var f=c.indexOf(n),d=c.indexOf(i);c.forEach(function(h,m){m===f?h.textContent=n.textContent.substring(0,r)+e+i.textContent.substring(o):m>f&&m<=d&&pi(h)}),s=n,u=r+e.length}s&&u!==void 0&&setTimeout(function(){self.setSelection(s,u)})},ri.prototype.autoResize=function(){var e=this.parent,t=this.content,n=parseInt(this.style.fontSize)||12;if(t.scrollHeight>e.offsetHeight||t.scrollHeight<e.offsetHeight-n){var i=e.getBoundingClientRect(),r=t.scrollHeight;e.style.height=r+"px",this.resizeHandler({width:i.width,height:i.height,dx:0,dy:r-i.height})}},ri.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,i=parseInt(this.style.minWidth)||0,r=parseInt(this.style.minHeight)||0,o=parseInt(this.style.maxWidth)||1/0,a=parseInt(this.style.maxHeight)||1/0;if(!n){n=this.resizeHandle=ut('<div class="djs-direct-editing-resize-handle"></div>');var c,s,u,l,p=function(h){bf(h),ja(h),c=h.clientX,s=h.clientY;var m=t.getBoundingClientRect();u=m.width,l=m.height,Re.bind(document,"mousemove",f),Re.bind(document,"mouseup",d)},f=function(h){bf(h),ja(h);var m=Z_(Q_(u+h.clientX-c,i),o),g=Z_(Q_(l+h.clientY-s,r),a);t.style.width=m+"px",t.style.height=g+"px",e.resizeHandler({width:u,height:l,dx:h.clientX-c,dy:h.clientY-s})},d=function(h){bf(h),ja(h),Re.unbind(document,"mousemove",f,!1),Re.unbind(document,"mouseup",d,!1)};Re.bind(n,"mousedown",p)}O(n.style,{position:"absolute",bottom:"0px",right:"0px",cursor:"nwse-resize",width:"0",height:"0",borderTop:(parseInt(this.style.fontSize)/4||3)+"px solid transparent",borderRight:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderBottom:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderLeft:(parseInt(this.style.fontSize)/4||3)+"px solid transparent"}),t.appendChild(n)},ri.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),Re.unbind(t,"keydown",this.keyHandler),Re.unbind(t,"mousedown",ja),Re.unbind(t,"input",this.autoResize),Re.unbind(t,"paste",this.handlePaste),Re.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),pi(n)),pi(e)},ri.prototype.getValue=function(){return this.content.innerText.trim()},ri.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},ri.prototype.setSelection=function(e,t){var n=document.createRange();e===null?n.selectNodeContents(this.content):(n.setStart(e,t),n.setEnd(e,t));var i=window.getSelection();i.removeAllRanges(),i.addRange(n)};function g2(e){return e.replace(/\r\n|\r|\n/g,`
|
|
316
|
+
`)}function Dn(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new ri({container:t.getContainer(),keyHandler:yn(this._handleKey,this),resizeHandler:yn(this._handleResize,this),focusoutHandler:yn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}Dn.$inject=["eventBus","canvas"],Dn.prototype.registerProvider=function(e){this._providers.push(e)},Dn.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},Dn.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},Dn.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},Dn.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},Dn.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},Dn.prototype.complete=function(){var e=this._active;if(e){var t,n=e.context.bounds,i=this.$textbox.getBoundingClientRect(),r=this.getValue(),o=e.context.text;(r!==o||i.height!==n.height||i.width!==n.width)&&(t=this._textbox.container.getBoundingClientRect(),e.provider.update(e.element,r,e.context.text,{x:i.left-t.left,y:i.top-t.top,width:i.width,height:i.height})),this._fire("complete"),this.close()}},Dn.prototype.getValue=function(){return this._textbox.getValue()},Dn.prototype._handleKey=function(e){e.stopPropagation();var t=e.keyCode||e.charCode;if(t===27)return e.preventDefault(),this.cancel();if(t===13&&!e.shiftKey)return e.preventDefault(),this.complete()},Dn.prototype._handleResize=function(e){this._fire("resize",e)},Dn.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},Dn.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=ot(this._providers,function(i){return(t=i.activate(e))?i:null});return t&&(this.$textbox=this._textbox.create(t.bounds,t.style,t.text,t.options),this._active={element:e,context:t,provider:n},t.options&&t.options.resizable&&(this.resizable=!0),this._fire("activate")),!!t};const J_={__depends__:[sc],__init__:["directEditing"],directEditing:["type",Dn]};function y2(e){return function(t){var n=t.target,i=Z(e),r=i.eventDefinitions&&i.eventDefinitions[0],o=i.$type===n.type,a=(r&&r.$type)===n.eventDefinitionType,c=!!n.triggeredByEvent==!!i.triggeredByEvent,s=n.isExpanded===void 0||n.isExpanded===$e(e);return!o||!a||!c||!s}}const v2={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=v2[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var _2=[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")],b2=[q("none-start-event",{actionName:"replace-with-none-start"}),q("none-intermediate-throwing"),q("none-end-event",{actionName:"replace-with-none-end"})],x2=[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")],w2=[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")],E2=[q("exclusive-gateway"),q("parallel-gateway"),q("inclusive-gateway"),q("complex-gateway"),q("event-based-gateway")],S2=[q("transaction"),q("event-subprocess"),q("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),q("collapsed-subprocess")],R2=[q("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),q("transaction"),q("event-subprocess"),q("collapsed-ad-hoc-subprocess")],eb=[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")],C2=eb,tb=[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"})],P2=[q("data-store-reference")],A2=[q("data-object-reference")],T2=[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")],M2=[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")],k2=[{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"}],D2=[q("expanded-pool"),q("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],O2={"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 nb={"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 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=d2(e);return v(t,"bpmn:DataObjectReference")?this._createEntries(e,w2):v(t,"bpmn:DataStoreReference")&&!v(e.parent,"bpmn:Collaboration")?this._createEntries(e,S2):(v(t,"bpmn:Event")&&!v(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=T2[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(m2.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:Participant")?(o=Oe(A2,function(c){return Be(e)!==c.target.isExpanded}),this._createEntries(e,o)):v(t,"bpmn:StartEvent")&&cn(t.$parent)?(o=Oe(C2.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(g2.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:EndEvent")?(o=Oe(v2.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(R2,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(y2.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:Gateway")?(o=Oe(_2,a),this._createEntries(e,o)):v(t,"bpmn:Transaction")?(o=Oe(eb,a),this._createEntries(e,o)):cn(t)&&Be(e)?(o=Oe(E2,a),this._createEntries(e,o)):v(t,"bpmn:AdHocSubProcess")&&Be(e)?(o=Oe(x2,a),this._createEntries(e,o)):v(t,"bpmn:SubProcess")&&Be(e)?(o=Oe(b2,a),this._createEntries(e,o)):v(t,"bpmn:SubProcess")&&!Be(e)?(o=Oe(tb,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,P2):v(t,"bpmn:FlowNode")?(o=Oe(tb,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)}),Zm(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=X(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=X(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=X(e),i=this,r=Qm(e),o=v(e,"bpmn:BoundaryEvent")?nb["intermediate-event-non-interrupting"]:nb["start-event-non-interrupting"],a=!n[r];return{"toggle-non-interrupting":{imageHtml:o,title:t("Toggle non-interrupting"),active:a,action:function(){i._modeling.updateProperties(e,{[r]:!!a})}}}};const M2={__depends__:[lf,vy,kc],__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)&&O(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},Fa.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return ge(t)?Cr(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])&&O(l,h()),l;var p=e.businessObject;function f(x,b){r.start(x,b)}function d(x,b){n.removeElements([b])}function h(){return{delete:{group:"edit",className:"bpmn-icon-trash",title: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(O({type:x},T));o.start(H,z,{source:N})}var A=s?function(H,N){var z=i.createShape(O({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(ke(p,["bpmn:Lane","bpmn:Participant"])&&Be(e)){var E=rr(e);O(l,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(x,b){n.addLane(b,"top")}}}}),E.length<2&&((Vt(e)?e.height>=120:e.width>=120)&&O(l,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:S(2)}}}),(Vt(e)?e.height>=180:e.width>=180)&&O(l,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:S(3)}}})),O(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")?O(l,{"append.receive-task":g("bpmn:ReceiveTask","bpmn-icon-receive-task",c("Append receive task")),"append.message-intermediate-event":g("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":g("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":g("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":g("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):ib(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?O(l,{"append.compensation-activity":g("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!v(p,"bpmn:EndEvent")&&!p.isForCompensation&&!ib(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!cn(p)&&O(l,{"append.end-event":g("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append end event")),"append.gateway":g("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append gateway")),"append.append-task":g("bpmn:Task","bpmn-icon-task",c("Append task")),"append.intermediate-event":g("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append intermediate/boundary event"))})),a.isEmpty(e,"bpmn-replace")||O(l,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(x,b){var w=O(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")&&O(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),v(p,"bpmn:MessageFlow")&&O(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),ke(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&O(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect to other element"),action:{click:f,dragstart:f}}}),v(p,"bpmn:TextAnnotation")&&O(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:f,dragstart:f}}}),ke(p,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&O(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:f,dragstart:f}}}),v(p,"bpmn:Group")&&O(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&O(l,h()),l};function ib(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return M(o,function(a){a.$type===n&&(r=!0)}),i&&r}const k2={__depends__:[u2,J_,Dv,Wn,vf,uc,M2],__init__:["contextPadProvider"],contextPadProvider:["type",Fa]};var D2={horizontal:["x","width"],vertical:["y","height"]},rb=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=D2[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+rb,max:t+n-rb}};const O2={__init__:["distributeElements"],distributeElements:["type",Hi]};function ou(e){Gn.call(this,e)}ou.$inject=["eventBus"],ie(ou,Gn),ou.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=Oe(t,function(n){var i=ke(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=xs(t),t.length<3?!1:t})};var ob={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
|
|
327
|
+
</svg>`};function Xn(e,t,n,i,r,o,a,c){this._bpmnFactory=e,this._popupMenu=t,this._modeling=n,this._moddle=i,this._bpmnReplace=r,this._rules=o,this._translate=a,this._moddleCopy=c,this._register()}Xn.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Xn.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Xn.prototype.getPopupMenuEntries=function(e){var c;var t=e.businessObject,n=this._rules,i=[],r,o=[];if(ve(e)||!n.allowed("shape.replace",{element:e}))return{};var a=y2(e);return v(t,"bpmn:DataObjectReference")?this._createEntries(e,P2):v(t,"bpmn:DataStoreReference")&&!v(e.parent,"bpmn:Collaboration")?this._createEntries(e,A2):(v(t,"bpmn:Event")&&!v(t,"bpmn:BoundaryEvent")&&(r=(c=t.get("eventDefinitions")[0])==null?void 0:c.$type,i=O2[r]||[],!cn(t.$parent)&&v(t.$parent,"bpmn:SubProcess")&&(i=Le(i,function(s){return s.target.type!=="bpmn:StartEvent"}))),v(t,"bpmn:StartEvent")&&!v(t.$parent,"bpmn:SubProcess")?(o=Le(_2.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:Participant")?(o=Le(D2,function(s){return $e(e)!==s.target.isExpanded}),this._createEntries(e,o)):v(t,"bpmn:StartEvent")&&cn(t.$parent)?(o=Le(M2.concat(i),function(s){var u=s.target,l=u.isInterrupting!==!1,p=t.isInterrupting===l;return a(s)||!a(s)&&!p}),this._createEntries(e,o)):v(t,"bpmn:StartEvent")&&!cn(t.$parent)&&v(t.$parent,"bpmn:SubProcess")?(o=Le(b2.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:EndEvent")?(o=Le(w2.concat(i),function(s){var u=s.target;return u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!v(t.$parent,"bpmn:Transaction")?!1:a(s)}),this._createEntries(e,o)):v(t,"bpmn:BoundaryEvent")?(o=Le(T2,function(s){var u=s.target;if(u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!v(t.attachedToRef,"bpmn:Transaction"))return!1;var l=u.cancelActivity!==!1,p=t.cancelActivity==l;return a(s)||!a(s)&&!p}),this._createEntries(e,o)):v(t,"bpmn:IntermediateCatchEvent")||v(t,"bpmn:IntermediateThrowEvent")?(o=Le(x2.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:Gateway")?(o=Le(E2,a),this._createEntries(e,o)):v(t,"bpmn:Transaction")?(o=Le(eb,a),this._createEntries(e,o)):cn(t)&&$e(e)?(o=Le(C2,a),this._createEntries(e,o)):v(t,"bpmn:AdHocSubProcess")&&$e(e)?(o=Le(R2,a),this._createEntries(e,o)):v(t,"bpmn:SubProcess")&&$e(e)?(o=Le(S2,a),this._createEntries(e,o)):v(t,"bpmn:SubProcess")&&!$e(e)?(o=Le(tb,function(s){var u=s.target.type===e.type,l=s.target.isExpanded===!0;return u===l}),this._createEntries(e,o)):v(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,k2):v(t,"bpmn:FlowNode")?(o=Le(tb,a),this._createEntries(e,o)):{})},Xn.prototype.getPopupMenuHeaderEntries=function(e){var t={};return v(e,"bpmn:Activity")&&!cn(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),v(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),v(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),Zm(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Xn.prototype._createEntries=function(e,t){var n={},i=this;return M(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},Xn.prototype._createSequenceFlowEntries=function(e,t){var n=Z(e),i={},r=this._modeling,o=this._moddle,a=this;return M(t,function(c){switch(c.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(v(n.sourceRef,"bpmn:ExclusiveGateway")||v(n.sourceRef,"bpmn:InclusiveGateway")||v(n.sourceRef,"bpmn:ComplexGateway")||v(n.sourceRef,"bpmn:Activity"))&&(i={...i,[c.actionName]:a._createEntry(c,e,function(){r.updateProperties(e.source,{default:n})})});break;case"replace-with-conditional-flow":!n.conditionExpression&&v(n.sourceRef,"bpmn:Activity")&&(i={...i,[c.actionName]:a._createEntry(c,e,function(){var s=o.create("bpmn:FormalExpression",{body:""});r.updateProperties(e,{conditionExpression:s})})});break;default:v(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[c.actionName]:a._createEntry(c,e,function(){r.updateProperties(e,{conditionExpression:void 0})})}),(v(n.sourceRef,"bpmn:ExclusiveGateway")||v(n.sourceRef,"bpmn:InclusiveGateway")||v(n.sourceRef,"bpmn:ComplexGateway")||v(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n&&(i={...i,[c.actionName]:a._createEntry(c,e,function(){r.updateProperties(e.source,{default:void 0})})})}}),i},Xn.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}},Xn.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(u,l){if(l.active){t._modeling.updateProperties(e,{loopCharacteristics:void 0});return}var p=e.businessObject.get("loopCharacteristics");p&&v(p,l.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,p,{isSequential:l.options.isSequential}):(p=t._moddle.create(l.options.loopCharacteristics,{isSequential:l.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:p}))}var r=Z(e),o=r.loopCharacteristics,a,c,s;return o&&(a=o.isSequential,c=o.isSequential===void 0,s=o.isSequential!==void 0&&!o.isSequential),{"toggle-parallel-mi":{className:"bpmn-icon-parallel-mi-marker",title:n("Parallel multi-instance"),active:s,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!1}},"toggle-sequential-mi":{className:"bpmn-icon-sequential-mi-marker",title:n("Sequential multi-instance"),active:a,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!0}},"toggle-loop":{className:"bpmn-icon-loop-marker",title:n("Loop"),active:c,action:i,options:{loopCharacteristics:"bpmn:StandardLoopCharacteristics"}}}},Xn.prototype._getCollectionHeaderEntries=function(e){var t=this,n=this._translate,i=e.businessObject.dataObjectRef;if(!i)return{};function r(a,c){t._modeling.updateModdleProperties(e,i,{isCollection:!c.active})}var o=i.isCollection;return{"toggle-is-collection":{className:"bpmn-icon-parallel-mi-marker",title:n("Collection"),active:o,action:r}}},Xn.prototype._getParticipantMultiplicityHeaderEntries=function(e){var t=this,n=this._bpmnFactory,i=this._translate;function r(a,c){var s=c.active,u;s||(u=n.create("bpmn:ParticipantMultiplicity")),t._modeling.updateProperties(e,{participantMultiplicity:u})}var o=e.businessObject.participantMultiplicity;return{"toggle-participant-multiplicity":{className:"bpmn-icon-parallel-mi-marker",title:i("Participant multiplicity"),active:!!o,action:r}}},Xn.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=Z(e),i=this,r=Qm(e),o=v(e,"bpmn:BoundaryEvent")?nb["intermediate-event-non-interrupting"]:nb["start-event-non-interrupting"],a=!n[r];return{"toggle-non-interrupting":{imageHtml:o,title:t("Toggle non-interrupting"),active:a,action:function(){i._modeling.updateProperties(e,{[r]:!!a})}}}};const L2={__depends__:[pf,vy,kc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Xn]};function Fa(e,t,n,i,r,o,a,c,s,u,l,p,f){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=r,this._elementFactory=o,this._connect=a,this._create=c,this._popupMenu=s,this._canvas=u,this._rules=l,this._translate=p,this._eventBus=n,this._appendPreview=f,e.autoPlace!==!1&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(d){var h=d.context,m=h.shape;if(!(!pa(d)||!i.isOpen(m))){var g=i.getEntries(m);g.replace&&g.replace.action.click(d,m)}}),n.on("contextPad.close",function(){f.cleanUp()})}Fa.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Fa.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&O(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},Fa.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return ve(t)?Pr(e,n=>t.includes(n)):t},Fa.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,r=this._connect,o=this._create,a=this._popupMenu,c=this._autoPlace,s=this._translate,u=this._appendPreview,l={};if(e.type==="label")return this._isDeleteAllowed([e])&&O(l,h()),l;var p=e.businessObject;function f(x,b){r.start(x,b)}function d(x,b){n.removeElements([b])}function h(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:s("Delete"),action:{click:d}}}}function m(x){var b=5,E=t.getPad(x).html,T=E.getBoundingClientRect(),L={x:T.left,y:T.bottom+b};return L}function g(x,b,E,T){function L(H,N){var V=i.createShape(O({type:x},T));o.start(H,V,{source:N})}var A=c?function(H,N){var V=i.createShape(O({type:x},T));c.append(N,V)}:L,F=c?function(H,N){return u.create(N,x,T),()=>{u.cleanUp()}}:null;return{group:"model",className:b,title:E,action:{dragstart:L,click:A,hover:F}}}function R(x){return function(b,E){n.splitLane(E,x),t.open(E,!0)}}if(De(p,["bpmn:Lane","bpmn:Participant"])&&$e(e)){var w=or(e);O(l,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:s("Add lane above"),action:{click:function(x,b){n.addLane(b,"top")}}}}),w.length<2&&((Gt(e)?e.height>=120:e.width>=120)&&O(l,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:s("Divide into two lanes"),action:{click:R(2)}}}),(Gt(e)?e.height>=180:e.width>=180)&&O(l,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:s("Divide into three lanes"),action:{click:R(3)}}})),O(l,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:s("Add lane below"),action:{click:function(x,b){n.addLane(b,"bottom")}}}})}return v(p,"bpmn:FlowNode")&&(v(p,"bpmn:EventBasedGateway")?O(l,{"append.receive-task":g("bpmn:ReceiveTask","bpmn-icon-receive-task",s("Append receive task")),"append.message-intermediate-event":g("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",s("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":g("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",s("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":g("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",s("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":g("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",s("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):ib(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?O(l,{"append.compensation-activity":g("bpmn:Task","bpmn-icon-task",s("Append compensation activity"),{isForCompensation:!0})}):!v(p,"bpmn:EndEvent")&&!p.isForCompensation&&!ib(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!cn(p)&&O(l,{"append.end-event":g("bpmn:EndEvent","bpmn-icon-end-event-none",s("Append end event")),"append.gateway":g("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",s("Append gateway")),"append.append-task":g("bpmn:Task","bpmn-icon-task",s("Append task")),"append.intermediate-event":g("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",s("Append intermediate/boundary event"))})),a.isEmpty(e,"bpmn-replace")||O(l,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:s("Change element"),action:{click:function(x,b){var E=O(m(b),{cursor:{x:x.x,y:x.y}});a.open(b,"bpmn-replace",E,{title:s("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),v(p,"bpmn:SequenceFlow")&&O(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",s("Add text annotation"))}),v(p,"bpmn:MessageFlow")&&O(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",s("Add text annotation"))}),De(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&O(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",s("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:s("Connect to other element"),action:{click:f,dragstart:f}}}),v(p,"bpmn:TextAnnotation")&&O(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:s("Connect using association"),action:{click:f,dragstart:f}}}),De(p,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&O(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:s("Connect using data input association"),action:{click:f,dragstart:f}}}),v(p,"bpmn:Group")&&O(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",s("Add text annotation"))}),this._isDeleteAllowed([e])&&O(l,h()),l};function ib(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return M(o,function(a){a.$type===n&&(r=!0)}),i&&r}const I2={__depends__:[d2,J_,Dv,Un,_f,uc,L2],__init__:["contextPadProvider"],contextPadProvider:["type",Fa]};var N2={horizontal:["x","width"],vertical:["y","height"]},rb=5;function Vi(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return ve(i)?i:i?n:[]})}Vi.$inject=["modeling","rules"],Vi.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},Vi.prototype.trigger=function(e,t){var n=this._modeling,i,r;if(!(e.length<3)&&(this._setOrientation(t),r=this._filterElements(e),i=this._createGroups(r),!(i.length<=2)))return n.distributeElements(i,this._axis,this._dimension),i},Vi.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(M(t,function(o){r=o(r,n,i)}),r):e},Vi.prototype._createGroups=function(e){var t=[],n=this,i=this._axis,r=this._dimension;if(!i)throw new Error('must have a defined "axis" and "dimension"');var o=ai(e,i);return M(o,function(a,c){var s=n._findRange(a,i,r),u,l=t[t.length-1];l&&n._hasIntersection(l.range,s)?t[t.length-1].elements.push(a):(u={range:s,elements:[a]},t.push(u))}),t},Vi.prototype._setOrientation=function(e){var t=N2[e];this._axis=t[0],this._dimension=t[1]},Vi.prototype._hasIntersection=function(e,t){return Math.max(e.min,e.max)>=Math.min(t.min,t.max)&&Math.min(e.min,e.max)<=Math.max(t.min,t.max)},Vi.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+rb,max:t+n-rb}};const B2={__init__:["distributeElements"],distributeElements:["type",Vi]};function ou(e){Wn.call(this,e)}ou.$inject=["eventBus"],ie(ou,Wn),ou.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=Le(t,function(n){var i=De(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=xs(t),t.length<3?!1:t})};var ob={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
|
|
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>`},L2=900;function Ha(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",L2,this)}Ha.$inject=["popupMenu","distributeElements","translate","rules"],Ha.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&O(t,this._getEntries(e)),t},Ha.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Ha.prototype._getEntries=function(e){var t=this._distributeElements,n=this._translate,i=this._popupMenu,r={"distribute-elements-horizontal":{group:"distribute",title:n("Distribute elements horizontally"),className:"bjs-align-elements-menu-entry",imageHtml:ob.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:ob.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const I2={__depends__:[lf,O2],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",ou],distributeElementsMenuProvider:["type",Ha]};var ab="is not a registered action",N2="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 bf(e,ab);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 bf(e,N2);this._actions[e]=t},Xn.prototype.unregister=function(e){if(!this.isRegistered(e))throw bf(e,ab);this._actions[e]=void 0},Xn.prototype.getActions=function(){return Object.keys(this._actions)},Xn.prototype.isRegistered=function(e){return!!this._actions[e]};function bf(e,t){return new Error(e+" "+t)}const B2={__init__:["editorActions"],editorActions:["type",Xn]};function au(e){e.invoke(Xn,this)}ie(au,Xn),au.$inject=["injector"],au.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=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 $2={__depends__:[B2],editorActions:["type",au]};function sb(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;ke(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}sb.$inject=["eventBus"];function Yr(e,t){K.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;bn(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}Yr.$inject=["eventBus","gridSnapping","modeling"],ie(Yr,K),Yr.prototype.snapSimple=function(e,t){var n=this._gridSnapping;return t.width=n.snapValue(t.width,{min:t.width}),t.height=n.snapValue(t.height,{min:t.height}),t.x=e.x+e.width/2-t.width/2,t.y=e.y+e.height/2-t.height/2,t},Yr.prototype.snapComplex=function(e,t){return/w|e/.test(t)&&(e=this.snapHorizontally(e,t)),/n|s/.test(t)&&(e=this.snapVertically(e,t)),e},Yr.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,i=/w/.test(t),r=/e/.test(t),o={};return o.width=n.snapValue(e.width,{min:e.width}),r&&(i?(o.x=n.snapValue(e.x,{max:e.x}),o.width+=n.snapValue(e.x-o.x,{min:e.x-o.x})):e.x=e.x+e.width-o.width),O(e,o),e},Yr.prototype.snapVertically=function(e,t){var n=this._gridSnapping,i=/n/.test(t),r=/s/.test(t),o={};return o.height=n.snapValue(e.height,{min:e.height}),i&&(r?(o.y=n.snapValue(e.y,{max:e.y}),o.height+=n.snapValue(e.y-o.y,{min:e.y-o.y})):e.y=e.y+e.height-o.height),O(e,o),e};var j2=2e3;function cb(e,t){e.on(["spaceTool.move","spaceTool.end"],j2,function(n){var i=n.context;if(i.initialized){var r=i.axis,o;r==="x"?(o=t.snapValue(n.dx),n.x=n.x+o-n.dx,n.dx=o):(o=t.snapValue(n.dy),n.y=n.y+o-n.dy,n.dy=o)}})}cb.$inject=["eventBus","gridSnapping"];const F2={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Yr],gridSnappingSpaceToolBehavior:["type",cb]};var su=10;function xf(e,t,n){return n||(n="round"),Math[n](e/t)*t}var H2=1200,z2=800;function yr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",z2,function(){r.setActive(i)}),t.on(["create.move","create.end","bendpoint.move.move","bendpoint.move.end","connect.move","connect.end","connectionSegment.move.move","connectionSegment.move.end","resize.move","resize.end","shape.move.move","shape.move.end"],H2,function(o){var a=o.originalEvent;if(!(!r.active||a&&Pn(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(u){var l={},p=G2(o,u,e);p&&(l.offset=p);var f=V2(o,u);f&&O(l,f),Lo(o,u)||r.snapEvent(o,u,l)})}})}yr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);Tt(e,t,i)},yr.prototype.getGridSpacing=function(){return su},yr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=xf(e,su);var i,r;return t&&t.min&&(i=t.min,be(i)&&(i=xf(i+n,su,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,be(r)&&(r=xf(r+n,su,"floor"),e=Math.min(e,r))),e-=n,e},yr.prototype.isActive=function(){return this.active},yr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},yr.prototype.toggleActive=function(){this.setActive(!this.active)},yr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function V2(e,t){var n=e.context,i=n.createConstraints,r=n.resizeConstraints||{},o=n.gridSnappingContext,a=o.snapConstraints;if(a&&a[t])return a[t];a||(a=o.snapConstraints={}),a[t]||(a[t]={});var s=n.direction;i&&(cu(t)?(a.x.min=i.left,a.x.max=i.right):(a.y.min=i.top,a.y.max=i.bottom));var c=r.min,u=r.max;return c&&(cu(t)?lb(s)?a.x.max=c.left:a.x.min=c.right:ub(s)?a.y.max=c.top:a.y.min=c.bottom),u&&(cu(t)?lb(s)?a.x.min=u.left:a.x.max=u.right:ub(s)?a.y.min=u.top:a.y.max=u.bottom),a[t]}function G2(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&be(s[t])||(s||(s=o.snapOffset={}),be(s[t])||(s[t]=0),!r)||(n.get(r.id)||(cu(t)?s[t]+=r[t]+r.width/2:s[t]+=r[t]+r.height/2),!a)||(t==="x"?/left/.test(a)?s[t]-=r.width/2:/right/.test(a)&&(s[t]+=r.width/2):/top/.test(a)?s[t]-=r.height/2:/bottom/.test(a)&&(s[t]+=r.height/2)),s[t]}function cu(e){return e==="x"}function ub(e){return e.indexOf("n")!==-1}function lb(e){return e.indexOf("w")!==-1}const W2={__depends__:[F2],__init__:["gridSnapping"],gridSnapping:["type",yr]};var U2=2e3;function pb(e,t,n){e.on("autoPlace",U2,function(i){var r=i.source,o=ye(r),a=i.shape,s=lv(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")&&(q2(c)?u.offset=-a.width/2:u.offset=-a.height/2),s[c]=t.snapValue(s[c],u))}),s})}pb.$inject=["eventBus","gridSnapping","elementRegistry"];function q2(e){return e==="x"}var Y2=1750;function fb(e,t,n){t.on(["create.start","shape.move.start"],Y2,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}))}})}fb.$inject=["canvas","eventBus","gridSnapping"];var K2=3e3;function uu(e,t,n){K.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],K2,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||X2(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}uu.$inject=["eventBus","gridSnapping","modeling"],ie(uu,K),uu.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=J2(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function X2(e){return e.length>3}function Z2(e){return e==="h"}function Q2(e){return e==="v"}function J2(e,t,n){var i=Pi(t,n),r={};return Z2(i)&&(r.y=e.snapValue(t.y)),Q2(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=O({},t,r),n=O({},n,r)),[t,n]}const ek={__depends__:[W2,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",pb],gridSnappingParticipantBehavior:["type",fb],gridSnappingLayoutConnectionBehavior:["type",uu]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",sb]};var tk=30,db=30;function za(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var r=i.element,o=i.gfx;if(v(r,"bpmn:Lane"))return n._createParticipantHit(r,o);if(v(r,"bpmn:Participant"))return 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=Vt(e)?{width:tk,height:e.height}:{width:e.width,height:db};return this._interactionEvents.createBoxHit(t,"all",n),!0},za.prototype._createSubProcessHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"all",{width:e.width,height:db}),!0};const nk={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",za]};function lu(e){e.invoke(Po,this)}ie(lu,Po),lu.$inject=["injector"],lu.prototype.registerBindings=function(e,t){Po.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 ik={__depends__:[Yp],__init__:["keyboardBindings"],keyboardBindings:["type",lu]};var rk={moveSpeed:1,moveSpeedAccelerated:10},ok=1500,hb="left",mb="up",gb="right",yb="down",ak={ArrowLeft:hb,Left:hb,ArrowUp:mb,Up:mb,ArrowRight:gb,Right:gb,ArrowDown:yb,Down:yb},sk={left:function(e){return{x:-e,y:0}},up:function(e){return{x:0,y:-e}},right:function(e){return{x:e,y:0}},down:function(e){return{x:0,y:e}}};function vb(e,t,n,i,r){var o=this;this._config=O({},rk,e||{}),t.addListener(ok,function(a){var s=a.keyEvent,c=ak[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=sk[a](u),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,l)}}}vb.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const ck={__depends__:[Yp,Wn],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",vb]};var _b=10;function Va(e,t,n,i){this._dragging=i,this._rules=t;var r=this;function o(c,u){var l=c.shape,p=c.direction,f=c.resizeConstraints,d;c.delta=u,d=rR(l,p,u),c.newBounds=aR(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=Nh(p),!uk(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=ti(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Va.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=O({shape:t},n),o=r.direction,!o)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");i.init(e,bb(t,o),"resize",{autoActivate:!0,cursor:lk(o),data:{shape:t,context:r}})},Va.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:_b,height:_b},r=wm(t,e.childrenBoxPadding),sR(n,t,i,r)},Va.$inject=["eventBus","rules","modeling","dragging"];function uk(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function bb(e,t){var n=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 lk(e){var t="resize-";return e==="n"||e==="s"?t+"ns":e==="e"||e==="w"?t+"ew":e==="nw"||e==="se"?t+"nwse":t+"nesw"}var xb="djs-resizing",Eb="resize-not-ok",pk=500;function wb(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,xb)),s.width>5&&re(c,{x:s.x,width:s.width}),s.height>5&&re(c,{y:s.y,height:s.height}),o.canExecute?Fe(c).remove(Eb):Fe(c).add(Eb)}function r(o){var a=o.shape,s=o.frame;s&&It(o.frame),t.removeMarker(a,xb)}e.on("resize.move",pk,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}wb.$inject=["eventBus","canvas","previewSupport"];var pu=-6,fu=8,du=20,Ga="djs-resizer",fk=["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=dk(i),a=de("g");Fe(a).add(Ga),Fe(a).add(Ga+"-"+e.id),Fe(a).add(Ga+"-"+i),Se(r,a);var s=de("rect");re(s,{x:-fu/2+o.x,y:-fu/2+o.y,width:fu,height:fu}),Fe(s).add(Ga+"-visual"),Se(a,s);var c=de("rect");return re(c,{x:-du/2+o.x,y:-du/2+o.y,width:du,height:du}),Fe(c).add(Ga+"-hit"),Se(a,c),Ps(a,t,n),a},vr.prototype.createResizer=function(e,t){var n=bb(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},vr.prototype.addResizer=function(e){var t=this;nt(e)||M(fk,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},vr.prototype.removeResizers=function(){var e=this._getResizersParent();vs(e)},vr.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},vr.$inject=["eventBus","canvas","selection","resize"];function dk(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-pu:e.indexOf("w")!==-1&&(t.x=pu),e.indexOf("s")!==-1?t.y=-pu:e.indexOf("n")!==-1&&(t.y=pu),t}const Sb={__depends__:[yi,Oi,So],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Va],resizePreview:["type",wb],resizeHandles:["type",vr]};var hk=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"],hk,function(c){i.isActive(c.element)&&i.cancel()}),e.on(["commandStack.changed"],function(c){i.isActive()&&i.cancel()}),e.on("directEditing.activate",function(c){o.removeResizers()}),e.on("create.end",500,function(c){var u=c.context,l=u.shape,p=c.context.canExecute,f=c.isTouch;f||p&&(u.hints&&u.hints.createElementsBehavior===!1||s(l))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,u){(u||ke(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}Wa.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Wa.prototype.activate=function(e){var t=In(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);O(n,i);var r={},o=n.style||{};return O(o,{backgroundColor:null,border:null}),(ke(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||Rb(e))&&O(r,{centerVertically:!0}),nr(e)&&(O(r,{resizable:!0,autoResize:!0}),O(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),v(e,"bpmn:TextAnnotation")&&(O(r,{resizable:!0,autoResize:!0}),O(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),O(n,{options:r,style:o}),n}},Wa.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),r={x:i.x+i.width/2,y:i.y+i.height/2},o={x:i.x,y:i.y},a=t.zoom(),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")||yk(e)){var h=Vt(e),m=h?{width:i.height,height:30*a,x:i.x-i.height/2+15*a,y:r.y-30*a/2}:{width:i.width,height:30*a};O(o,m),O(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:h?"rotate(-90deg)":null})}if(gk(e)){var g=Vt(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};O(o,S),O(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:g?null:"rotate(-90deg)"})}(ke(e,["bpmn:Task","bpmn:CallActivity"])||Rb(e))&&(O(o,{width:i.width,height:i.height}),O(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),mk(e)&&(O(o,{width:i.width,x:i.x}),O(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var E=1,x=i.width+2*E;if(n.labelTarget&&(O(o,{width:x,height:i.height+2*E,x:i.x-E,y:i.y-E}),O(d,{fontSize:u+"px",lineHeight:l})),nr(n)&&!Ms(n)&&!Ae(n)){var b=cl(e),w=t.getAbsoluteBBox({x:b.x,y:b.y,width:0,height:0}),T=u,L=Nr.width*a+2*E;O(o,{width:L,height:T+2*E,x:w.x-L/2,y:w.y-T/2-E}),O(d,{fontSize:u+"px",lineHeight:l})}return v(e,"bpmn:TextAnnotation")&&(O(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}),O(d,{textAlign:"left",paddingTop:lo*a+"px",paddingBottom:lo*a+"px",paddingLeft:lo*a+"px",paddingRight:lo*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}),vk(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function Rb(e){return v(e,"bpmn:SubProcess")&&!Be(e)}function mk(e){return v(e,"bpmn:SubProcess")&&Be(e)}function gk(e){return v(e,"bpmn:Participant")&&!Be(e)}function yk(e){return v(e,"bpmn:Participant")&&Be(e)}function vk(e){return!e||!e.trim()}var Cb="djs-element-hidden",Pb="djs-label-hidden";function Ab(e,t,n){var i=this,r=t.getDefaultLayer(),o,a,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=de("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=de("path");re(p,{d:l,strokeWidth:2,stroke:_k(o)}),Se(s,p),Se(r,s),Xt(s,o.x,o.y)}v(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,Cb):(v(o,"bpmn:Task")||v(o,"bpmn:CallActivity")||v(o,"bpmn:SubProcess")||v(o,"bpmn:Participant")||v(o,"bpmn:Lane"))&&t.addMarker(o,Pb)}),e.on("directEditing.resize",function(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,Cb),t.removeMarker(o,Pb)),o=void 0,a=void 0,s&&(It(s),s=void 0)})}Ab.$inject=["eventBus","canvas","pathMap"];function _k(e,t){var n=ze(e);return n.get("stroke")||t||"black"}const bk={__depends__:[Cp,Sb,J_],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Wa],labelEditingPreview:["type",Ab]};var xk=500,Ek=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){a1(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"],xk,function(o){var a=o.element,s=o.gfx,c=tt(".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=tt(".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=de("rect");return re(e,O({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=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})},bi.prototype.registerProvider=function(e,t){t||(t=e,e=Ek),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){zt(i.getOutline)&&(t=t||i.getOutline(e))}),t},bi.$inject=["eventBus","styles","elementRegistry"];var hu=6;function Ef(e,t,n){this._canvas=t;var i=this;e.on("element.changed",function(r){n.isSelected(r.element)&&i._updateMultiSelectionOutline(n.get())}),e.on("selection.changed",function(r){var o=r.newSelection;i._updateMultiSelectionOutline(o)})}Ef.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");vs(t);var n=e.length>1,i=this._canvas.getContainer();if(Fe(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=wk(Rt(e)),o=de("rect");re(o,O({rx:3},r)),Fe(o).add("djs-selection-outline"),Se(t,o)}},Ef.$inject=["eventBus","canvas","selection"];function wk(e){return{x:e.x-hu,y:e.y-hu,width:e.width+hu*2,height:e.height+hu*2}}const wf={__depends__:[Wn],__init__:["outline","multiSelectionOutline"],outline:["type",bi],multiSelectionOutline:["type",Ef]},Tb=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],Mb={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},Sk=15,mu=2;function kb(e,t,n,i,r){const o=t.getLayer("overlays");e.on(["selection.changed","shape.changed"],function(){s()}),e.on("selection.changed",function({newSelection:p}){var d;const f=p.filter(h=>ke(h,Tb));if(f.length===1){const h=f[0];Ae(h)?a(h,h.labelTarget):(d=h.labels)!=null&&d.length&&a(h.labels[0],h)}if(f.length===2){const h=f.find(Ae),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;!ke(p,Tb)||!l(p)||(Ae(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)],Mb),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)<Sk||(el(d,[b,S]),Se(o,d))}function s(){ys(`.${Mb.class}`,o).forEach(It)}function c(p){const f=i.getOutline(p);if(!f)return u(p);if(f.x){const d={x:p.x+_r(f,"x")-mu,y:p.y+_r(f,"y")-mu,width:_r(f,"width")+mu*2,height:_r(f,"height")+mu*2};return ll(d,_r(f,"rx"))}if(f.cx){const d=_r(f,"r"),h={x:p.x+_r(f,"cx")-d,y:p.y+_r(f,"cy")-d,width:d*2,height:d*2};return am(h)}}function u(p){return n.getShapePath(p)}function l(p){return r.isSelected(p)}}kb.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function _r(e,t){return parseFloat(re(e,t)||0)}const Rk={__depends__:[Wn,wf],__init__:["labelLink"],labelLink:["type",kb]};var Ck=new wo("tt");function Pk(e){var t=ct('<div class="djs-tooltip-container" />');return fn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function Ak(e,t,n){fn(e,{left:t+"px",top:n+"px"})}function Sf(e,t){e.style.display=t===!1?"none":""}var Db="djs-tooltip",Rf="."+Db;function vn(e,t){this._eventBus=e,this._canvas=t,this._ids=Ck,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=Pk(t.getContainer());var n=this;Sn.bind(this._tooltipRoot,Rf,"mousedown",function(i){i.stopPropagation()}),Sn.bind(this._tooltipRoot,Rf,"mouseover",function(i){n.trigger("mouseover",i)}),Sn.bind(this._tooltipRoot,Rf,"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=O({},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(){Sf(this._tooltipRoot)},vn.prototype.hide=function(){Sf(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)),bn(n)&&(n=ct(n)),i=ct('<div data-tooltip-id="'+t+'" class="'+Db+'">'),fn(i,{position:"absolute"}),i.appendChild(n),e.type&&dt(i).add("djs-tooltip-"+e.type),e.className&&dt(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;Ak(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),Sf(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 Tk={__init__:["tooltips"],tooltips:["type",vn]};var Mk="flow elements must be children of pools/participants",kk="Data object must be placed within a pool/participant.";function Ob(e,t,n){function i(r,o,a){t.add({position:{x:r.x+5,y:r.y+5},type:"error",timeout:2e3,html:"<div>"+o+"</div>"})}e.on(["shape.move.rejected","create.rejected"],function(r){var o=r.context,a=o.shape,s=o.target;v(s,"bpmn:Collaboration")&&(v(a,"bpmn:FlowNode")?i(r,n(Mk)):v(a,"bpmn:DataObjectReference")&&i(r,n(kk)))})}Ob.$inject=["eventBus","tooltips","translate"];const Dk={__depends__:[Tk],__init__:["modelingFeedback"],modelingFeedback:["type",Ob]};var Ok=500,Lk=1250,Ik=1500,gu=Math.round;function Nk(e){return{x:e.x+gu(e.width/2),y:e.y+gu(e.height/2)}}function Lb(e,t,n,i,r){function o(s,c,u,l){return r.allowed("elements.move",{shapes:s,delta:c,position:u,target:l})}e.on("shape.move.start",Ik,function(s){var c=s.context,u=s.shape,l=i.get().slice();l.indexOf(u)===-1&&(l=[u]),l=Bk(l),O(c,{shapes:l,validatedShapes:l,shape:u})}),e.on("shape.move.start",Lk,function(s){var c=s.context,u=c.validatedShapes,l;if(l=c.canExecute=o(u),!l)return!1}),e.on("shape.move.move",Ok,function(s){var c=s.context,u=c.validatedShapes,l=s.hover,p={x:s.dx,y:s.dy},f={x:s.x,y:s.y},d;if(d=o(u,p,f,l),c.delta=p,c.canExecute=d,d===null){c.target=null;return}c.target=l}),e.on("shape.move.end",function(s){var c=s.context,u=c.delta,l=c.canExecute,p=l==="attach",f=c.shapes;if(l===!1)return!1;u.x=gu(u.x),u.y=gu(u.y),!(u.x===0&&u.y===0)&&n.moveElements(f,u,c.target,{primaryShape:c.shape,attach:p})}),e.on("element.mousedown",function(s){if(ar(s)){var c=_o(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)&&!Fe(s.target).has("djs-hit-no-move")){var p=Nk(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}Lb.$inject=["eventBus","dragging","modeling","selection","rules"];function Bk(e){var t=Jr(e,"id");return Oe(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var Ib=499,Cf="djs-dragging",Nb="drop-ok",Bb="drop-not-ok",$b="new-parent",jb="attach-ok";function Fb(e,t,n,i){function r(c){var u=o(c),l=$k(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){[jb,Nb,Bb,$b].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,Cf),c.allDraggedElements?c.allDraggedElements.push(u):c.allDraggedElements=[u]}e.on("shape.move.start",Ib,function(c){var u=c.context,l=u.shapes,p=u.allDraggedElements,f=r(l);if(!u.dragGroup){var d=de("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=wu([p,o(l)]):p=o(l),M(p,function(m){t.addMarker(m,Cf)}),u.allDraggedElements=p,u.differentParents=jk(l)}),e.on("shape.move.move",Ib,function(c){var u=c.context,l=u.dragGroup,p=u.target,f=u.shape.parent,d=u.canExecute;p&&(d==="attach"?a(p,jb):u.canExecute&&f&&p.id!==f.id?a(p,$b):a(p,u.canExecute?Nb:Bb)),Xt(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,Cf)}),p&&It(p)}),this.makeDraggable=s}Fb.$inject=["eventBus","canvas","styles","previewSupport"];function $k(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=Oe(e,function(i){return nt(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function jk(e){return zx(Jr(e,function(t){return t.parent&&t.parent.id}))!==1}const Fk={__depends__:[sc,Wn,wf,yi,Oi,So],__init__:["move","movePreview"],move:["type",Lb],movePreview:["type",Fb]};var Hb=".djs-palette-toggle",zb=".entry",Hk=Hb+", "+zb,Pf="djs-palette-",zk="shown",Af="open",Vb="two-column",Vk=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=Vk),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(Wk,{})},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=ct(Mt.HTML_MARKUP);n.appendChild(i),dt(n).add(Pf+zk),Sn.bind(i,Hk,"click",function(r){var o=r.delegateTarget;if(Wu(o,Hb))return e.toggle();e.trigger("click",r)}),we.bind(i,"mousedown",function(r){r.stopPropagation()}),Sn.bind(i,zb,"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=dt(n),a=dt(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(Vb,r),a.toggle(Pf+Vb,r),"open"in e&&(o.toggle(Af,e.open),a.toggle(Pf+Af,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},Mt.prototype._update=function(){var e=tt(".djs-palette-entries",this._container),t=this._entries=this.getEntries();ms(e),M(t,function(n,i){var r=n.group||"default",o=tt("[data-group="+Ma(r)+"]",e);o||(o=ct('<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=ct(a);if(o.appendChild(s),!n.separator&&(an(s,"data-action",i),n.title&&an(s,"title",n.title),n.className&&Gk(s,n.className),n.imageUrl)){var c=ct("<img>");an(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=an(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=tt(".djs-palette-entries",this._container),this._toolsContainer=tt("[data-group=tools]",t)),n=this._toolsContainer,M(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=dt(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},Mt.prototype.isOpen=function(){return dt(this._container).has(Af)},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 Gk(e,t){var n=dt(e),i=ge(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function Wk(e,t){var n=t.getPaletteEntries();return zt(n)?n(e):(M(n,function(i,r){e[r]=i}),e)}const Uk={__init__:["palette"],palette:["type",Mt]};var Gb="crosshair",Wb="selected",qk="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=de("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,Wb);for(const g of h)m.has(g)||t.addMarker(g,Wb)}},remove:function(p){this.update(p),p.frame&&It(p.frame),u(!1)}};function u(p){Fe(t.getContainer()).toggle(qk,p)}function l(p){var f=i.getAll();return new Set(Qr(oo(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=Ub(p),f.add=ec(p),f.lastMarked=new Set(r.get()),f.add?f.marked=f.lastMarked:f.marked=new Set,f.initialMarked=f.marked,c.create(f)}),e.on("lasso.move",function(p){var f=p.context,d=f.bbox=Ub(p),h=l(d),m=f.initialMarked.union(h);f.lastMarked=f.marked,f.marked=m,c.update(f)}),e.on("lasso.cleanup",function(p){var f=p.context;f.lastMarked=f.marked,f.marked=new Set(r.get()),c.remove(p.context)}),e.on("element.mousedown",1500,function(p){if(ec(p))return s.activateLasso(p.originalEvent),!0})}br.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],br.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:Gb,data:{context:{}},keepSelection:!0})},br.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:Gb,data:{context:{}},keepSelection:!0})},br.prototype._select=function(e){this._selection.select(e)},br.prototype.select=function(e,t,n=[]){var i=Qr(oo(e,t));this._select([...n,...i])},br.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},br.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function Ub(e){var t={x:e.x-e.dx,y:e.y-e.dy},n={x:e.x,y:e.y},i;return t.x<=n.x&&t.y<n.y||t.x<n.x&&t.y<=n.y?i={x:t.x,y:t.y,width:n.x-t.x,height:n.y-t.y}:t.x>=n.x&&t.y<n.y||t.x>n.x&&t.y<=n.y?i={x:n.x,y:t.y,width:t.x-n.x,height:n.y-t.y}:t.x<=n.x&&t.y>n.y||t.x<n.x&&t.y>=n.y?i={x:t.x,y:n.y,width:n.x-t.x,height:t.y-n.y}:t.x>=n.x&&t.y>n.y||t.x>n.x&&t.y>=n.y?i={x:n.x,y:n.y,width:t.x-n.x,height:t.y-n.y}:i={x:n.x,y:n.y,width:0,height:0},i}const Yk={__depends__:[pc,ha],__init__:["lassoTool"],lassoTool:["type",br]};var Tf=1500,qb="grab";function Io(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",Tf,function(c){if(pa(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(Tf,function(c){if(!(!Yb(c.keyEvent)||a.isActive())){var u=a._mouse.getLastMoveEvent();a.activateMove(u,!!u)}},"keyboard.keydown"),s&&s.addListener(Tf,function(c){!Yb(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})}Io.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Io.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:qb,data:{context:n||{}}})},Io.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:qb,data:{context:{reactivate:n}}})},Io.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Io.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function Yb(e){return Nt("Space",e)}const Kk={__depends__:[pc,ha],__init__:["handTool"],handTool:["type",Io]};var Kb="connect-ok",Xb="connect-not-ok";function No(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?Kb:Xb))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var u=c.context.startTarget,l=c.context.canStartConnect;u&&i.removeMarker(u,l?Kb:Xb)}),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})}No.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],No.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},No.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},No.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},No.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const Xk={__depends__:[vf,yi,Oi,pc,ha],globalConnect:["type",No]};function Mf(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)}Mf.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],Mf.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(O({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 O(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:s("Activate hand tool"),action:{click:function(p){o.activateHand(p)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:s("Activate lasso tool"),action:{click:function(p){r.activateSelection(p)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:s("Activate create/remove space tool"),action:{click:function(p){i.activateSelection(p)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:s("Activate global connect tool"),action:{click:function(p){a.start(p)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":c("bpmn:StartEvent","event","bpmn-icon-start-event-none",s("Create start event")),"create.intermediate-event":c("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",s("Create intermediate/boundary event")),"create.end-event":c("bpmn:EndEvent","event","bpmn-icon-end-event-none",s("Create end event")),"create.exclusive-gateway":c("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",s("Create gateway")),"create.task":c("bpmn:Task","activity","bpmn-icon-task",s("Create task")),"create.data-object":c("bpmn:DataObjectReference","data-object","bpmn-icon-data-object",s("Create data object reference")),"create.data-store":c("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",s("Create data store reference")),"create.subprocess-expanded":{group:"activity",className:"bpmn-icon-subprocess-expanded",title:s("Create expanded sub-process"),action:{dragstart:u,click:u}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:s("Create pool/participant"),action:{dragstart:l,click:l}},"create.group":c("bpmn:Group","artifact","bpmn-icon-group",s("Create group"))}),e};const Zk={__depends__:[Uk,uc,Sy,Yk,Kk,Xk,ra],__init__:["paletteProvider"],paletteProvider:["type",Mf]};var Qk=250;function kf(e,t,n,i,r){K.call(this,e);function o(s){var c=s.canExecute.replacements;M(c,function(u){var l=u.oldElementId,p={type:u.newElementType};if(!s.visualReplacements[l]){var f=t.get(l);O(p,{x:f.x,y:f.y});var d=n.createShape(p);i.addShape(d,f.parent);var h=tt('[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=tt('[data-element-id="'+Ma(l)+'"]',s.dragGroup);p&&re(p,{display:"inline"}),u.remove(),c[l]&&delete c[l]})}e.on("shape.move.move",Qk,function(s){var c=s.context,u=c.canExecute;c.visualReplacements||(c.visualReplacements={}),u&&u.replacements?o(c):a(c)})}kf.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],ie(kf,K);const Jk={__depends__:[So],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",kf]};var eD=1250,Df=40,tD=20,nD=10,Zb=20,Qb=["x","y"],iD=Math.abs;function Jb(e){e.on(["connect.hover","connect.move","connect.end"],eD,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&Pn(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&rD(t,o,cD(o)),o&&sD(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Yn(r),ke(o,["bpmn:Event","bpmn:Gateway"])&&ex(t,Yn(o)),ke(o,["bpmn:Task","bpmn:SubProcess"])&&oD(t,o),v(a,"bpmn:BoundaryEvent")&&s===a.host&&aD(t)):tx(i,"bpmn:MessageFlow")?(v(r,"bpmn:Event")&&(n.connectionStart=Yn(r)),v(o,"bpmn:Event")&&ex(t,Yn(o))):n.connectionStart=n.initialConnectionStart)})}Jb.$inject=["eventBus"];function rD(e,t,n){Qb.forEach(function(i){var r=nx(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 oD(e,t){var n=Yn(t);Qb.forEach(function(i){uD(e,t,i)&&Tt(e,i,n[i])})}function aD(e){var t=e.context,n=t.source,i=t.target;if(!lD(t)){var r=Yn(n),o=Kt(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;iD(c-r[s])<Df&&(c>r[s]?u=r[s]+Df:u=r[s]-Df,Tt(e,s,u))})}}function ex(e,t){Tt(e,"x",t.x),Tt(e,"y",t.y)}function tx(e,t){return e&&e.type===t}function sD(e,t){return zi(t,function(n){return tx(e,n)})}function nx(e,t){return e==="x"?t.width:t.height}function cD(e){return v(e,"bpmn:Task")?nD:tD}function uD(e,t,n){return e[n]>t[n]+Zb&&e[n]<t[n]+nx(n,t)-Zb}function lD(e){var t=e.hover,n=e.source;return t&&n&&t===n}function xr(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}xr.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},xr.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},xr.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},xr.prototype.getSnapLocations=function(){return this._snapLocations},xr.prototype.setSnapLocations=function(e){this._snapLocations=e},xr.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new yu,n.initDefaults(this._defaultSnaps)),n};function yu(){this._snapValues={}}yu.prototype.add=function(e,t){var n=this._snapValues[e];n||(n=this._snapValues[e]={x:[],y:[]}),n.x.indexOf(t.x)===-1&&n.x.push(t.x),n.y.indexOf(t.y)===-1&&n.y.push(t.y)},yu.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&QM(e[n],r[n],i)},yu.prototype.initDefaults=function(e){var t=this;M(e||{},function(n,i){M(n,function(r){t.add(i,r)})})};var pD=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"],pD,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&Pn(r.originalEvent))&&!(Lo(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}),Ae(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(Ae(r)){Ae(t)&&e.add("mid",Yn(r));return}if(nt(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))}),!be(t.x)||!be(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Yn(t)),e},xi.prototype.getSnapTargets=function(e,t){return z_(t).filter(function(n){return!fD(n)})};function fD(e){return!!e.hidden}var ix=1500;function Bo(e,t){t.invoke(xi,this),e.on(["create.move","create.end"],ix,gD),e.on(["create.move","create.end","shape.move.move","shape.move.end"],ix,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!Lo(n)&&dD(n,o)})}ie(Bo,xi),Bo.$inject=["eventBus","injector"],Bo.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",ox(o,i,e))}),M(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",ox(o,i,e))}),v(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Bo.prototype.addSnapTargetPoints=function(e,t,n){xi.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);M(i,function(o){(mD(o)||hD([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",F_(o)),e.add("bottom-right",H_(o)))});var r=this._elementRegistry;return M(t.incoming,function(o){if(r.get(t.id)){rx(i,o.source)||e.add("mid",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)){rx(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},Bo.prototype.getSnapTargets=function(e,t){return xi.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!v(n,"bpmn:Lane")})};function dD(e,t){var n=me(t),i=bg(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 hD(e,t){return e.every(function(n){return v(n,t)})}function mD(e){return v(e,"bpmn:SubProcess")&&Be(e)?!0:v(e,"bpmn:Participant")}function gD(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 rx(e,t){return e.indexOf(t)!==-1}function ox(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var yD=1250;function Ua(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],yD,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&Pn(i.originalEvent))&&!Lo(i)){var u=c.pointsForTarget(a);u.initialized||(u=n.addSnapTargetPoints(u,o,a,s),u.initialized=!0),bD(s)&&Tt(i,"x",i.x),xD(s)&&Tt(i,"y",i.y),t.snap(i,u)}}),e.on(["resize.cleanup"],function(){t.hide()})}Ua.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new xr);var o=ax(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},Ua.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return M(r,function(o){e.add("corner",H_(o)),e.add("corner",F_(o))}),e.add("corner",ax(t,i)),e},Ua.$inject=["eventBus","snapping"],Ua.prototype.getSnapTargets=function(e,t){return z_(t).filter(function(n){return!vD(n,e)&&!nt(n)&&!_D(n)&&!Ae(n)})};function ax(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 vD(e,t){return e.host===t}function _D(e){return!!e.hidden}function bD(e){return e==="n"||e==="s"}function xD(e){return e==="e"||e==="w"}var ED=7,wD=1e3;function Er(e){this._canvas=e,this._asyncHide=Ru(gn(this.hide,this),wD)}Er.$inject=["canvas"],Er.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:Lo(e,"x"),y:Lo(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,ED),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)})},Er.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=de("path");return re(n,{d:"M0,0 L0,0"}),Fe(n).add("djs-snap-line"),Se(t,n),{update:function(i){be(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 SD={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",xi],resizeSnapping:["type",Ua],snapping:["type",Er]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",Jb],createMoveSnapping:["type",Bo]};var sx=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=tt(Re.INPUT_SELECTOR,this._container),this._resultsContainer=tt(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:Sn.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){Sn.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=tt(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(){ms(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},Re.prototype._getCurrentResult=function(){return tt(Re.RESULT_SELECTED_SELECTOR,this._resultsContainer)},Re.prototype._createResultNode=function(e,t){var n=ct(Re.RESULT_HTML);return e.primaryTokens.length>0&&cx(n,e.primaryTokens,Re.RESULT_PRIMARY_HTML),cx(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,dt(this._canvas.getContainer()).add("djs-search-open"),dt(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,dt(this._canvas.getContainer()).remove("djs-search-open"),dt(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&&dt(t).remove(Re.RESULT_SELECTED_CLASS);var n=an(e,Re.RESULT_ID_ATTRIBUTE),i=this._results[n].element;dt(e).add(Re.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:sx}),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:sx}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},Re.prototype._getBoxHtml=function(){const e=ct(Re.BOX_HTML),t=tt(Re.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function cx(e,t,n){var i=RD(t),r=ct(n);r.innerHTML=i,e.appendChild(r)}function RD(e){var t="";return e.forEach(function(n){var i=gv(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+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>`},$2=900;function Ha(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",$2,this)}Ha.$inject=["popupMenu","distributeElements","translate","rules"],Ha.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&O(t,this._getEntries(e)),t},Ha.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Ha.prototype._getEntries=function(e){var t=this._distributeElements,n=this._translate,i=this._popupMenu,r={"distribute-elements-horizontal":{group:"distribute",title:n("Distribute elements horizontally"),className:"bjs-align-elements-menu-entry",imageHtml:ob.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:ob.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const j2={__depends__:[pf,B2],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",ou],distributeElementsMenuProvider:["type",Ha]};var ab="is not a registered action",F2="is already registered";function Zn(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}Zn.$inject=["eventBus","injector"],Zn.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),i=e.get("selection",!1),r=e.get("zoomScroll",!1),o=e.get("copyPaste",!1),a=e.get("canvas",!1),c=e.get("rules",!1),s=e.get("keyboardMove",!1),u=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),o&&i&&this.register("copy",function(){var l=i.get();if(l.length)return o.copy(l)}),o&&i&&this.register("duplicate",function(){var l=i.get();if(l.length)return o.duplicate(l)}),o&&this.register("paste",function(){o.paste()}),o&&i&&c&&this.register("cut",function(){var l=i.get();if(l.length){var p=c.allowed("elements.delete",{elements:l});if(p!==!1){var f=ve(p)?p:l;return o.cut(f.slice())}}}),r&&this.register("stepZoom",function(l){r.stepZoom(l.value)}),a&&this.register("zoom",function(l){a.zoom(l.value)}),n&&i&&c&&this.register("removeSelection",function(){var l=i.get();if(l.length){var p=c.allowed("elements.delete",{elements:l}),f;p!==!1&&(ve(p)?f=p:f=l,f.length&&n.removeElements(f.slice()))}}),s&&this.register("moveCanvas",function(l){s.moveCanvas(l)}),u&&this.register("moveSelection",function(l){u.moveSelection(l.direction,l.accelerated)})},Zn.prototype.trigger=function(e,t){if(!this._actions[e])throw xf(e,ab);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},Zn.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)})},Zn.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw xf(e,F2);this._actions[e]=t},Zn.prototype.unregister=function(e){if(!this.isRegistered(e))throw xf(e,ab);this._actions[e]=void 0},Zn.prototype.getActions=function(){return Object.keys(this._actions)},Zn.prototype.isRegistered=function(e){return!!this._actions[e]};function xf(e,t){return new Error(e+" "+t)}const H2={__init__:["editorActions"],editorActions:["type",Zn]};function au(e){e.invoke(Zn,this)}ie(au,Zn),au.$inject=["injector"],au.prototype._registerDefaultActions=function(e){Zn.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),i=e.get("selection",!1),r=e.get("spaceTool",!1),o=e.get("lassoTool",!1),a=e.get("handTool",!1),c=e.get("globalConnect",!1),s=e.get("distributeElements",!1),u=e.get("alignElements",!1),l=e.get("directEditing",!1),p=e.get("searchPad",!1),f=e.get("modeling",!1),d=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",function(){var h=t.getRootElement(),m=n.filter(function(g){return g!==h});return i.select(m),m}),r&&this._registerAction("spaceTool",function(){r.toggle()}),o&&this._registerAction("lassoTool",function(){o.toggle()}),a&&this._registerAction("handTool",function(){a.toggle()}),c&&this._registerAction("globalConnectTool",function(){c.toggle()}),i&&s&&this._registerAction("distributeElements",function(h){var m=i.get(),g=h.type;m.length&&s.trigger(m,g)}),i&&u&&this._registerAction("alignElements",function(h){var m=i.get(),g=[],R=h.type;m.length&&(g=Le(m,function(w){return!v(w,"bpmn:Lane")}),u.trigger(g,R))}),i&&f&&this._registerAction("setColor",function(h){var m=i.get();m.length&&f.setColor(m,h)}),i&&l&&this._registerAction("directEditing",function(){var h=i.get();h.length&&l.activate(h[0])}),p&&this._registerAction("find",function(){p.toggle()}),t&&f&&this._registerAction("moveToOrigin",function(){var h=t.getRootElement(),m,g;v(h,"bpmn:Collaboration")?g=n.filter(function(R){return v(R.parent,"bpmn:Collaboration")}):g=n.filter(function(R){return R!==h&&!v(R.parent,"bpmn:SubProcess")}),m=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 z2={__depends__:[H2],editorActions:["type",au]};function sb(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;De(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}sb.$inject=["eventBus"];function Kr(e,t){K.call(this,e),this._gridSnapping=t;var n=this;this.preExecute("shape.resize",function(i){var r=i.context,o=r.hints||{},a=o.autoResize;if(a){var c=r.shape,s=r.newBounds;xn(a)?r.newBounds=n.snapComplex(s,a):r.newBounds=n.snapSimple(c,s)}})}Kr.$inject=["eventBus","gridSnapping","modeling"],ie(Kr,K),Kr.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},Kr.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},Kr.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,i=/w/.test(t),r=/e/.test(t),o={};return o.width=n.snapValue(e.width,{min:e.width}),r&&(i?(o.x=n.snapValue(e.x,{max:e.x}),o.width+=n.snapValue(e.x-o.x,{min:e.x-o.x})):e.x=e.x+e.width-o.width),O(e,o),e},Kr.prototype.snapVertically=function(e,t){var n=this._gridSnapping,i=/n/.test(t),r=/s/.test(t),o={};return o.height=n.snapValue(e.height,{min:e.height}),i&&(r?(o.y=n.snapValue(e.y,{max:e.y}),o.height+=n.snapValue(e.y-o.y,{min:e.y-o.y})):e.y=e.y+e.height-o.height),O(e,o),e};var V2=2e3;function cb(e,t){e.on(["spaceTool.move","spaceTool.end"],V2,function(n){var i=n.context;if(i.initialized){var r=i.axis,o;r==="x"?(o=t.snapValue(n.dx),n.x=n.x+o-n.dx,n.dx=o):(o=t.snapValue(n.dy),n.y=n.y+o-n.dy,n.dy=o)}})}cb.$inject=["eventBus","gridSnapping"];const G2={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Kr],gridSnappingSpaceToolBehavior:["type",cb]};var su=10;function wf(e,t,n){return n||(n="round"),Math[n](e/t)*t}var W2=1200,U2=800;function vr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",U2,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"],W2,function(o){var a=o.originalEvent;if(!(!r.active||a&&An(a))){var c=o.context,s=c.gridSnappingContext;s||(s=c.gridSnappingContext={}),["x","y"].forEach(function(u){var l={},p=q2(o,u,e);p&&(l.offset=p);var f=Y2(o,u);f&&O(l,f),Io(o,u)||r.snapEvent(o,u,l)})}})}vr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);Mt(e,t,i)},vr.prototype.getGridSpacing=function(){return su},vr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=wf(e,su);var i,r;return t&&t.min&&(i=t.min,we(i)&&(i=wf(i+n,su,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,we(r)&&(r=wf(r+n,su,"floor"),e=Math.min(e,r))),e-=n,e},vr.prototype.isActive=function(){return this.active},vr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},vr.prototype.toggleActive=function(){this.setActive(!this.active)},vr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function Y2(e,t){var n=e.context,i=n.createConstraints,r=n.resizeConstraints||{},o=n.gridSnappingContext,a=o.snapConstraints;if(a&&a[t])return a[t];a||(a=o.snapConstraints={}),a[t]||(a[t]={});var c=n.direction;i&&(cu(t)?(a.x.min=i.left,a.x.max=i.right):(a.y.min=i.top,a.y.max=i.bottom));var s=r.min,u=r.max;return s&&(cu(t)?lb(c)?a.x.max=s.left:a.x.min=s.right:ub(c)?a.y.max=s.top:a.y.min=s.bottom),u&&(cu(t)?lb(c)?a.x.min=u.left:a.x.max=u.right:ub(c)?a.y.min=u.top:a.y.max=u.bottom),a[t]}function q2(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,c=o.snapOffset;return c&&we(c[t])||(c||(c=o.snapOffset={}),we(c[t])||(c[t]=0),!r)||(n.get(r.id)||(cu(t)?c[t]+=r[t]+r.width/2:c[t]+=r[t]+r.height/2),!a)||(t==="x"?/left/.test(a)?c[t]-=r.width/2:/right/.test(a)&&(c[t]+=r.width/2):/top/.test(a)?c[t]-=r.height/2:/bottom/.test(a)&&(c[t]+=r.height/2)),c[t]}function cu(e){return e==="x"}function ub(e){return e.indexOf("n")!==-1}function lb(e){return e.indexOf("w")!==-1}const K2={__depends__:[G2],__init__:["gridSnapping"],gridSnapping:["type",vr]};var X2=2e3;function pb(e,t,n){e.on("autoPlace",X2,function(i){var r=i.source,o=_e(r),a=i.shape,c=lv(r,a,n);return["x","y"].forEach(function(s){var u={};c[s]!==o[s]&&(c[s]>o[s]?u.min=c[s]:u.max=c[s],v(a,"bpmn:TextAnnotation")&&(Z2(s)?u.offset=-a.width/2:u.offset=-a.height/2),c[s]=t.snapValue(c[s],u))}),c})}pb.$inject=["eventBus","gridSnapping","elementRegistry"];function Z2(e){return e==="x"}var Q2=1750;function fb(e,t,n){t.on(["create.start","shape.move.start"],Q2,function(i){var r=i.context,o=r.shape,a=e.getRootElement();if(!(!v(o,"bpmn:Participant")||!v(a,"bpmn:Process")||!a.children.length)){var c=r.createConstraints;c&&(o.width=n.snapValue(o.width,{min:o.width}),o.height=n.snapValue(o.height,{min:o.height}))}})}fb.$inject=["canvas","eventBus","gridSnapping"];var J2=3e3;function uu(e,t,n){K.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],J2,function(r){var o=r.context,a=o.connection,c=o.hints||{},s=a.waypoints;c.connectionStart||c.connectionEnd||c.createElementsBehavior===!1||ek(s)&&n.updateWaypoints(a,i.snapMiddleSegments(s))})}uu.$inject=["eventBus","gridSnapping","modeling"],ie(uu,K),uu.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=ik(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function ek(e){return e.length>3}function tk(e){return e==="h"}function nk(e){return e==="v"}function ik(e,t,n){var i=Ti(t,n),r={};return tk(i)&&(r.y=e.snapValue(t.y)),nk(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=O({},t,r),n=O({},n,r)),[t,n]}const rk={__depends__:[K2,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",pb],gridSnappingParticipantBehavior:["type",fb],gridSnappingLayoutConnectionBehavior:["type",uu]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",sb]};var ok=30,db=30;function za(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var r=i.element,o=i.gfx;if(v(r,"bpmn:Lane"))return n._createParticipantHit(r,o);if(v(r,"bpmn:Participant"))return $e(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(v(r,"bpmn:SubProcess"))return $e(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}za.$inject=["eventBus","interactionEvents"],za.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},za.prototype._createParticipantHit=function(e,t){this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height});var n=Gt(e)?{width:ok,height:e.height}:{width:e.width,height:db};return this._interactionEvents.createBoxHit(t,"all",n),!0},za.prototype._createSubProcessHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"all",{width:e.width,height:db}),!0};const ak={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",za]};function lu(e){e.invoke(Ao,this)}ie(lu,Ao),lu.$inject=["injector"],lu.prototype.registerBindings=function(e,t){Ao.prototype.registerBindings.call(this,e,t);function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("selectElements",function(i){var r=i.keyEvent;if(e.isKey(["a","A"],r)&&e.isCmd(r))return t.trigger("selectElements"),!0}),n("find",function(i){var r=i.keyEvent;if(e.isKey(["f","F"],r)&&e.isCmd(r))return t.trigger("find"),!0}),n("spaceTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["s","S"],r))return t.trigger("spaceTool"),!0}),n("lassoTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["l","L"],r))return t.trigger("lassoTool"),!0}),n("handTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["h","H"],r))return t.trigger("handTool"),!0}),n("globalConnectTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["c","C"],r))return t.trigger("globalConnectTool"),!0}),n("directEditing",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["e","E"],r))return t.trigger("directEditing"),!0}),n("replaceElement",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["r","R"],r))return t.trigger("replaceElement",r),!0})};const sk={__depends__:[Kp],__init__:["keyboardBindings"],keyboardBindings:["type",lu]};var ck={moveSpeed:1,moveSpeedAccelerated:10},uk=1500,hb="left",mb="up",gb="right",yb="down",lk={ArrowLeft:hb,Left:hb,ArrowUp:mb,Up:mb,ArrowRight:gb,Right:gb,ArrowDown:yb,Down:yb},pk={left:function(e){return{x:-e,y:0}},up:function(e){return{x:0,y:-e}},right:function(e){return{x:e,y:0}},down:function(e){return{x:0,y:e}}};function vb(e,t,n,i,r){var o=this;this._config=O({},ck,e||{}),t.addListener(uk,function(a){var c=a.keyEvent,s=lk[c.key];if(s&&!t.isCmd(c)){var u=t.isShift(c);return o.moveSelection(s,u),!0}}),this.moveSelection=function(a,c){var s=r.get();if(s.length){var u=this._config[c?"moveSpeedAccelerated":"moveSpeed"],l=pk[a](u),p=i.allowed("elements.move",{shapes:s,hints:{keyboardMove:!0}});p&&n.moveElements(s,l)}}}vb.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const fk={__depends__:[Kp,Un],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",vb]};var _b=10;function Va(e,t,n,i){this._dragging=i,this._rules=t;var r=this;function o(s,u){var l=s.shape,p=s.direction,f=s.resizeConstraints,d;s.delta=u,d=cR(l,p,u),s.newBounds=lR(d,f),s.canExecute=r.canResize(s)}function a(s){var u=s.resizeConstraints,l=s.minBounds;u===void 0&&(l===void 0&&(l=r.computeMinResizeBox(s)),s.resizeConstraints={min:ye(l)})}function c(s){var u=s.shape,l=s.canExecute,p=s.newBounds;if(l){if(p=Nh(p),!dk(u,p))return;n.resizeShape(u,p)}}e.on("resize.start",function(s){a(s.context)}),e.on("resize.move",function(s){var u={x:s.dx,y:s.dy};o(s.context,u)}),e.on("resize.end",function(s){c(s.context)})}Va.prototype.canResize=function(e){var t=this._rules,n=ni(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Va.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=O({shape:t},n),o=r.direction,!o)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");i.init(e,bb(t,o),"resize",{autoActivate:!0,cursor:hk(o),data:{shape:t,context:r}})},Va.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:_b,height:_b},r=Em(t,e.childrenBoxPadding),pR(n,t,i,r)},Va.$inject=["eventBus","rules","modeling","dragging"];function dk(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function bb(e,t){var n=_e(e),i=ye(e),r={x:n.x,y:n.y};return t.indexOf("n")!==-1?r.y=i.top:t.indexOf("s")!==-1&&(r.y=i.bottom),t.indexOf("e")!==-1?r.x=i.right:t.indexOf("w")!==-1&&(r.x=i.left),r}function hk(e){var t="resize-";return e==="n"||e==="s"?t+"ns":e==="e"||e==="w"?t+"ew":e==="nw"||e==="se"?t+"nwse":t+"nesw"}var xb="djs-resizing",wb="resize-not-ok",mk=500;function Eb(e,t,n){function i(o){var a=o.shape,c=o.newBounds,s=o.frame;s||(s=o.frame=n.addFrame(a,t.getActiveLayer()),t.addMarker(a,xb)),c.width>5&&re(s,{x:c.x,width:c.width}),c.height>5&&re(s,{y:c.y,height:c.height}),o.canExecute?Fe(s).remove(wb):Fe(s).add(wb)}function r(o){var a=o.shape,c=o.frame;c&&Nt(o.frame),t.removeMarker(a,xb)}e.on("resize.move",mk,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}Eb.$inject=["eventBus","canvas","previewSupport"];var pu=-6,fu=8,du=20,Ga="djs-resizer",gk=["n","w","s","e","nw","ne","se","sw"];function _r(e,t,n,i){this._resize=i,this._canvas=t;var r=this;e.on("selection.changed",function(o){var a=o.newSelection;r.removeResizers(),a.length===1&&M(a,yn(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}_r.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){sr(o)&&i.activate(o,e,n)}Re.bind(t,"mousedown",r),Re.bind(t,"touchstart",r)},_r.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=yk(i),a=me("g");Fe(a).add(Ga),Fe(a).add(Ga+"-"+e.id),Fe(a).add(Ga+"-"+i),Ce(r,a);var c=me("rect");re(c,{x:-fu/2+o.x,y:-fu/2+o.y,width:fu,height:fu}),Fe(c).add(Ga+"-visual"),Ce(a,c);var s=me("rect");return re(s,{x:-du/2+o.x,y:-du/2+o.y,width:du,height:du}),Fe(s).add(Ga+"-hit"),Ce(a,s),Ps(a,t,n),a},_r.prototype.createResizer=function(e,t){var n=bb(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},_r.prototype.addResizer=function(e){var t=this;nt(e)||M(gk,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},_r.prototype.removeResizers=function(){var e=this._getResizersParent();vs(e)},_r.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},_r.$inject=["eventBus","canvas","selection","resize"];function yk(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-pu:e.indexOf("w")!==-1&&(t.x=pu),e.indexOf("s")!==-1?t.y=-pu:e.indexOf("n")!==-1&&(t.y=pu),t}const Sb={__depends__:[yi,Ii,Ro],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Va],resizePreview:["type",Eb],resizeHandles:["type",_r]};var vk=2e3;function Wa(e,t,n,i,r,o,a){this._bpmnFactory=t,this._canvas=n,this._modeling=r,this._textRenderer=a,i.registerProvider(this),e.on("element.dblclick",function(s){c(s.element,!0)}),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open","root.set","selection.changed"],function(){i.isActive()&&i.complete()}),e.on(["shape.remove","connection.remove"],vk,function(s){i.isActive(s.element)&&i.cancel()}),e.on(["commandStack.changed"],function(s){i.isActive()&&i.cancel()}),e.on("directEditing.activate",function(s){o.removeResizers()}),e.on("create.end",500,function(s){var u=s.context,l=u.shape,p=s.context.canExecute,f=s.isTouch;f||p&&(u.hints&&u.hints.createElementsBehavior===!1||c(l))}),e.on("autoPlace.end",500,function(s){c(s.shape)});function c(s,u){(u||De(s,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(s)}}Wa.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Wa.prototype.activate=function(e){var t=Nn(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);O(n,i);var r={},o=n.style||{};return O(o,{backgroundColor:null,border:null}),(De(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||Rb(e))&&O(r,{centerVertically:!0}),ir(e)&&(O(r,{resizable:!0,autoResize:!0}),O(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),v(e,"bpmn:TextAnnotation")&&(O(r,{resizable:!0,autoResize:!0}),O(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),O(n,{options:r,style:o}),n}},Wa.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),r={x:i.x+i.width/2,y:i.y+i.height/2},o={x:i.x,y:i.y},a=t.zoom(),c=this._textRenderer.getDefaultStyle(),s=this._textRenderer.getExternalStyle(),u=s.fontSize*a,l=s.lineHeight,p=c.fontSize*a,f=c.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(v(e,"bpmn:Lane")||xk(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};O(o,m),O(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:h?"rotate(-90deg)":null})}if(bk(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};O(o,R),O(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:g?null:"rotate(-90deg)"})}(De(e,["bpmn:Task","bpmn:CallActivity"])||Rb(e))&&(O(o,{width:i.width,height:i.height}),O(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),_k(e)&&(O(o,{width:i.width,x:i.x}),O(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var w=1,x=i.width+2*w;if(n.labelTarget&&(O(o,{width:x,height:i.height+2*w,x:i.x-w,y:i.y-w}),O(d,{fontSize:u+"px",lineHeight:l})),ir(n)&&!Ms(n)&&!Me(n)){var b=ul(e),E=t.getAbsoluteBBox({x:b.x,y:b.y,width:0,height:0}),T=u,L=Br.width*a+2*w;O(o,{width:L,height:T+2*w,x:E.x-L/2,y:E.y-T/2-w}),O(d,{fontSize:u+"px",lineHeight:l})}return v(e,"bpmn:TextAnnotation")&&(O(o,{width:i.width+2*w,height:i.height+2*w,x:i.x-w,y:i.y-w,minWidth:30*a,minHeight:10*a}),O(d,{textAlign:"left",paddingTop:po*a+"px",paddingBottom:po*a+"px",paddingLeft:po*a+"px",paddingRight:po*a+"px",fontSize:p+"px",lineHeight:f})),{bounds:o,style:d}},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}),wk(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function Rb(e){return v(e,"bpmn:SubProcess")&&!$e(e)}function _k(e){return v(e,"bpmn:SubProcess")&&$e(e)}function bk(e){return v(e,"bpmn:Participant")&&!$e(e)}function xk(e){return v(e,"bpmn:Participant")&&$e(e)}function wk(e){return!e||!e.trim()}var Cb="djs-element-hidden",Pb="djs-label-hidden";function Ab(e,t,n){var i=this,r=t.getDefaultLayer(),o,a,c;e.on("directEditing.activate",function(s){var u=s.active;if(o=u.element.label||u.element,v(o,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(o),c=me("g");var l=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:o.height,position:{mx:0,my:0}}),p=i.path=me("path");re(p,{d:l,strokeWidth:2,stroke:Ek(o)}),Ce(c,p),Ce(r,c),Xt(c,o.x,o.y)}v(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,Cb):(v(o,"bpmn:Task")||v(o,"bpmn:CallActivity")||v(o,"bpmn:SubProcess")||v(o,"bpmn:Participant")||v(o,"bpmn:Lane"))&&t.addMarker(o,Pb)}),e.on("directEditing.resize",function(s){if(v(o,"bpmn:TextAnnotation")){var u=s.height,l=s.dy,p=Math.max(o.height/a.height*(u+l),0),f=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:p,position:{mx:0,my:0}});re(i.path,{d:f})}}),e.on(["directEditing.complete","directEditing.cancel"],function(s){var u=s.active;u&&(t.removeMarker(u.element.label||u.element,Cb),t.removeMarker(o,Pb)),o=void 0,a=void 0,c&&(Nt(c),c=void 0)})}Ab.$inject=["eventBus","canvas","pathMap"];function Ek(e,t){var n=ze(e);return n.get("stroke")||t||"black"}const Sk={__depends__:[Pp,Sb,J_],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Wa],labelEditingPreview:["type",Ab]};var Rk=500,Ck=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){l1(o)||i.createOutline(o)}e.on("element.hover",function(o){r(o.element)}),e.on("selection.changed",function(o){M(o.newSelection,r)}),e.on(["shape.changed","connection.changed"],Rk,function(o){var a=o.element,c=o.gfx,s=tt(".djs-outline",c);s&&i.updateOutline(a,s)})}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=tt(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),Ce(t,n),this.updateOutline(e,n)),n},bi.prototype._createOutlineGfx=function(){var e=me("rect");return re(e,O({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=Ck),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){zt(i.getOutline)&&(t=t||i.getOutline(e))}),t},bi.$inject=["eventBus","styles","elementRegistry"];var hu=6;function Ef(e,t,n){this._canvas=t;var i=this;e.on("element.changed",function(r){n.isSelected(r.element)&&i._updateMultiSelectionOutline(n.get())}),e.on("selection.changed",function(r){var o=r.newSelection;i._updateMultiSelectionOutline(o)})}Ef.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");vs(t);var n=e.length>1,i=this._canvas.getContainer();if(Fe(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=Pk(Ct(e)),o=me("rect");re(o,O({rx:3},r)),Fe(o).add("djs-selection-outline"),Ce(t,o)}},Ef.$inject=["eventBus","canvas","selection"];function Pk(e){return{x:e.x-hu,y:e.y-hu,width:e.width+hu*2,height:e.height+hu*2}}const Sf={__depends__:[Un],__init__:["outline","multiSelectionOutline"],outline:["type",bi],multiSelectionOutline:["type",Ef]},Tb=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],Mb={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},Ak=15,mu=2;function kb(e,t,n,i,r){const o=t.getLayer("overlays");e.on(["selection.changed","shape.changed"],function(){c()}),e.on("selection.changed",function({newSelection:p}){var d;const f=p.filter(h=>De(h,Tb));if(f.length===1){const h=f[0];Me(h)?a(h,h.labelTarget):(d=h.labels)!=null&&d.length&&a(h.labels[0],h)}if(f.length===2){const h=f.find(Me),m=f.find(g=>{var R;return(R=g.labels)==null?void 0:R.includes(h)});h&&m&&a(h,m)}}),e.on("shape.changed",function({element:p}){var f;!De(p,Tb)||!l(p)||(Me(p)?a(p,p.labelTarget):(f=p.labels)!=null&&f.length&&a(p.labels[0],p))});function a(p,f){const d=qo([_e(f),_e(p)],Mb),h=d.getAttribute("d"),g=r.isSelected(p)?s(p):u(p),R=Qo(g,h);if(!R)return;const x=r.isSelected(f)?s(f):u(f),b=Qo(x,h)||_e(f);ca(b,R)<Ak||(tl(d,[b,R]),Ce(o,d))}function c(){ys(`.${Mb.class}`,o).forEach(Nt)}function s(p){const f=i.getOutline(p);if(!f)return u(p);if(f.x){const d={x:p.x+br(f,"x")-mu,y:p.y+br(f,"y")-mu,width:br(f,"width")+mu*2,height:br(f,"height")+mu*2};return pl(d,br(f,"rx"))}if(f.cx){const d=br(f,"r"),h={x:p.x+br(f,"cx")-d,y:p.y+br(f,"cy")-d,width:d*2,height:d*2};return am(h)}}function u(p){return n.getShapePath(p)}function l(p){return r.isSelected(p)}}kb.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function br(e,t){return parseFloat(re(e,t)||0)}const Tk={__depends__:[Un,Sf],__init__:["labelLink"],labelLink:["type",kb]};var Mk=new So("tt");function kk(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 Dk(e,t,n){fn(e,{left:t+"px",top:n+"px"})}function Rf(e,t){e.style.display=t===!1?"none":""}var Db="djs-tooltip",Cf="."+Db;function _n(e,t){this._eventBus=e,this._canvas=t,this._ids=Mk,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=kk(t.getContainer());var n=this;Rn.bind(this._tooltipRoot,Cf,"mousedown",function(i){i.stopPropagation()}),Rn.bind(this._tooltipRoot,Cf,"mouseover",function(i){n.trigger("mouseover",i)}),Rn.bind(this._tooltipRoot,Cf,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}_n.$inject=["eventBus","canvas"],_n.prototype.add=function(e){if(!e.position)throw new Error("must specifiy tooltip position");if(!e.html)throw new Error("must specifiy tooltip html");var t=this._ids.next();return e=O({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},_n.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(an(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},_n.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},_n.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},_n.prototype.setTimeout=function(e){if(e=this.get(e),!!e){this.clearTimeout(e);var t=this;e.removeTimer=setTimeout(function(){t.remove(e)},e.timeout)}},_n.prototype.remove=function(e){var t=this.get(e);t&&(pi(t.html),pi(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},_n.prototype.show=function(){Rf(this._tooltipRoot)},_n.prototype.hide=function(){Rf(this._tooltipRoot,!1)},_n.prototype._updateRoot=function(e){var t=e.scale||1,n=e.scale||1,i="matrix("+t+",0,0,"+n+","+-1*e.x*t+","+-1*e.y*n+")";this._tooltipRoot.style.transform=i,this._tooltipRoot.style["-ms-transform"]=i},_n.prototype._addTooltip=function(e){var t=e.id,n=e.html,i,r=this._tooltipRoot;n.get&&n.constructor.prototype.jquery&&(n=n.get(0)),xn(n)&&(n=ut(n)),i=ut('<div data-tooltip-id="'+t+'" class="'+Db+'">'),fn(i,{position:"absolute"}),i.appendChild(n),e.type&&dt(i).add("djs-tooltip-"+e.type),e.className&&dt(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},_n.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;Dk(n,t.x,t.y)},_n.prototype._updateTooltipVisibilty=function(e){M(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),Rf(i,r))})},_n.prototype._init=function(){var e=this;function t(n){e._updateRoot(n),e._updateTooltipVisibilty(n),e.show()}this._eventBus.on("canvas.viewbox.changing",function(n){e.hide()}),this._eventBus.on("canvas.viewbox.changed",function(n){t(n.viewbox)})};const Ok={__init__:["tooltips"],tooltips:["type",_n]};var Lk="flow elements must be children of pools/participants",Ik="Data object must be placed within a pool/participant.";function Ob(e,t,n){function i(r,o,a){t.add({position:{x:r.x+5,y:r.y+5},type:"error",timeout:2e3,html:"<div>"+o+"</div>"})}e.on(["shape.move.rejected","create.rejected"],function(r){var o=r.context,a=o.shape,c=o.target;v(c,"bpmn:Collaboration")&&(v(a,"bpmn:FlowNode")?i(r,n(Lk)):v(a,"bpmn:DataObjectReference")&&i(r,n(Ik)))})}Ob.$inject=["eventBus","tooltips","translate"];const Nk={__depends__:[Ok],__init__:["modelingFeedback"],modelingFeedback:["type",Ob]};var Bk=500,$k=1250,jk=1500,gu=Math.round;function Fk(e){return{x:e.x+gu(e.width/2),y:e.y+gu(e.height/2)}}function Lb(e,t,n,i,r){function o(c,s,u,l){return r.allowed("elements.move",{shapes:c,delta:s,position:u,target:l})}e.on("shape.move.start",jk,function(c){var s=c.context,u=c.shape,l=i.get().slice();l.indexOf(u)===-1&&(l=[u]),l=Hk(l),O(s,{shapes:l,validatedShapes:l,shape:u})}),e.on("shape.move.start",$k,function(c){var s=c.context,u=s.validatedShapes,l;if(l=s.canExecute=o(u),!l)return!1}),e.on("shape.move.move",Bk,function(c){var s=c.context,u=s.validatedShapes,l=c.hover,p={x:c.dx,y:c.dy},f={x:c.x,y:c.y},d;if(d=o(u,p,f,l),s.delta=p,s.canExecute=d,d===null){s.target=null;return}s.target=l}),e.on("shape.move.end",function(c){var s=c.context,u=s.delta,l=s.canExecute,p=l==="attach",f=s.shapes;if(l===!1)return!1;u.x=gu(u.x),u.y=gu(u.y),!(u.x===0&&u.y===0)&&n.moveElements(f,u,s.target,{primaryShape:s.shape,attach:p})}),e.on("element.mousedown",function(c){if(sr(c)){var s=bo(c);if(!s)throw new Error("must supply DOM mousedown event");return a(s,c.element)}});function a(c,s,u,l){if(Ht(u)&&(l=u,u=!1),!(s.waypoints||!s.parent)&&!Fe(c.target).has("djs-hit-no-move")){var p=Fk(s),f=t.init(c,p,"shape.move",{cursor:"grabbing",autoActivate:u,data:{shape:s,context:l||{}}});if(f!==!1)return!0}}this.start=a}Lb.$inject=["eventBus","dragging","modeling","selection","rules"];function Hk(e){var t=eo(e,"id");return Le(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var Ib=499,Pf="djs-dragging",Nb="drop-ok",Bb="drop-not-ok",$b="new-parent",jb="attach-ok";function Fb(e,t,n,i){function r(s){var u=o(s),l=zk(u);return l}function o(s){var u=Ko(s),l=u.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),p=u.concat(l),f=[...new Set(p)];return f}function a(s,u){[jb,Nb,Bb,$b].forEach(function(l){l===u?t.addMarker(s,l):t.removeMarker(s,l)})}function c(s,u,l){i.addDragger(u,s.dragGroup),l&&t.addMarker(u,Pf),s.allDraggedElements?s.allDraggedElements.push(u):s.allDraggedElements=[u]}e.on("shape.move.start",Ib,function(s){var u=s.context,l=u.shapes,p=u.allDraggedElements,f=r(l);if(!u.dragGroup){var d=me("g");re(d,n.cls("djs-drag-group",["no-events"]));var h=t.getActiveLayer();Ce(h,d),u.dragGroup=d}f.forEach(function(m){i.addDragger(m,u.dragGroup)}),p?p=Eu([p,o(l)]):p=o(l),M(p,function(m){t.addMarker(m,Pf)}),u.allDraggedElements=p,u.differentParents=Vk(l)}),e.on("shape.move.move",Ib,function(s){var u=s.context,l=u.dragGroup,p=u.target,f=u.shape.parent,d=u.canExecute;p&&(d==="attach"?a(p,jb):u.canExecute&&f&&p.id!==f.id?a(p,$b):a(p,u.canExecute?Nb:Bb)),Xt(l,s.dx,s.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(s){var u=s.context,l=u.target;l&&a(l,null)}),e.on("shape.move.cleanup",function(s){var u=s.context,l=u.allDraggedElements,p=u.dragGroup;M(l,function(f){t.removeMarker(f,Pf)}),p&&Nt(p)}),this.makeDraggable=c}Fb.$inject=["eventBus","canvas","styles","previewSupport"];function zk(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=Le(e,function(i){return nt(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function Vk(e){return Gx(eo(e,function(t){return t.parent&&t.parent.id}))!==1}const Gk={__depends__:[sc,Un,Sf,yi,Ii,Ro],__init__:["move","movePreview"],move:["type",Lb],movePreview:["type",Fb]};var Hb=".djs-palette-toggle",zb=".entry",Wk=Hb+", "+zb,Af="djs-palette-",Uk="shown",Tf="open",Vb="two-column",Yk=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=Yk),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(Kk,{})},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),dt(n).add(Af+Uk),Rn.bind(i,Wk,"click",function(r){var o=r.delegateTarget;if(Uu(o,Hb))return e.toggle();e.trigger("click",r)}),Re.bind(i,"mousedown",function(r){r.stopPropagation()}),Rn.bind(i,zb,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},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=dt(n),a=dt(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(Vb,r),a.toggle(Af+Vb,r),"open"in e&&(o.toggle(Tf,e.open),a.toggle(Af+Tf,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},kt.prototype._update=function(){var e=tt(".djs-palette-entries",this._container),t=this._entries=this.getEntries();ms(e),M(t,function(n,i){var r=n.group||"default",o=tt("[data-group="+Ma(r)+"]",e);o||(o=ut('<div class="group"></div>'),an(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),c=ut(a);if(o.appendChild(c),!n.separator&&(an(c,"data-action",i),n.title&&an(c,"title",n.title),n.className&&qk(c,n.className),n.imageUrl)){var s=ut("<img>");an(s,"src",n.imageUrl),c.appendChild(s)}}),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(zt(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=tt(".djs-palette-entries",this._container),this._toolsContainer=tt("[data-group=tools]",t)),n=this._toolsContainer,M(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=dt(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},kt.prototype.isOpen=function(){return dt(this._container).has(Tf)},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 qk(e,t){var n=dt(e),i=ve(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function Kk(e,t){var n=t.getPaletteEntries();return zt(n)?n(e):(M(n,function(i,r){e[r]=i}),e)}const Xk={__init__:["palette"],palette:["type",kt]};var Gb="crosshair",Wb="selected",Zk="djs-dragging-active-lasso";function xr(e,t,n,i,r,o,a){this._selection=r,this._dragging=n,this._mouse=a;var c=this,s={create:function(p){var f=t.getActiveLayer(),d=p.frame=me("rect");re(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),Ce(f,d),u(!0),this.update(p)},update:function(p){var f=p.frame,d=p.bbox;f&&d&&re(f,{x:d.x,y:d.y,width:d.width,height:d.height});var h=p.marked,m=p.lastMarked;if(h&&m){for(const g of m)h.has(g)||t.removeMarker(g,Wb);for(const g of h)m.has(g)||t.addMarker(g,Wb)}},remove:function(p){this.update(p),p.frame&&Nt(p.frame),u(!1)}};function u(p){Fe(t.getContainer()).toggle(Zk,p)}function l(p){var f=i.getAll();return new Set(Jr(ao(f,p)))}o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(p){var f=p.originalEvent.target;!p.hover&&!(f instanceof SVGElement)||e.once("lasso.selection.ended",function(){c.activateLasso(p.originalEvent,!0)})}),e.on("lasso.end",0,function(p){var f=p.context;c._select(Array.from(f.marked))}),e.on("lasso.start",function(p){var f=p.context;f.bbox=Ub(p),f.add=ec(p),f.lastMarked=new Set(r.get()),f.add?f.marked=f.lastMarked:f.marked=new Set,f.initialMarked=f.marked,s.create(f)}),e.on("lasso.move",function(p){var f=p.context,d=f.bbox=Ub(p),h=l(d),m=f.initialMarked.union(h);f.lastMarked=f.marked,f.marked=m,s.update(f)}),e.on("lasso.cleanup",function(p){var f=p.context;f.lastMarked=f.marked,f.marked=new Set(r.get()),s.remove(p.context)}),e.on("element.mousedown",1500,function(p){if(ec(p))return c.activateLasso(p.originalEvent),!0})}xr.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],xr.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:Gb,data:{context:{}},keepSelection:!0})},xr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:Gb,data:{context:{}},keepSelection:!0})},xr.prototype._select=function(e){this._selection.select(e)},xr.prototype.select=function(e,t,n=[]){var i=Jr(ao(e,t));this._select([...n,...i])},xr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},xr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function Ub(e){var t={x:e.x-e.dx,y:e.y-e.dy},n={x:e.x,y:e.y},i;return t.x<=n.x&&t.y<n.y||t.x<n.x&&t.y<=n.y?i={x:t.x,y:t.y,width:n.x-t.x,height:n.y-t.y}:t.x>=n.x&&t.y<n.y||t.x>n.x&&t.y<=n.y?i={x:n.x,y:t.y,width:t.x-n.x,height:n.y-t.y}:t.x<=n.x&&t.y>n.y||t.x<n.x&&t.y>=n.y?i={x:t.x,y:n.y,width:n.x-t.x,height:t.y-n.y}:t.x>=n.x&&t.y>n.y||t.x>n.x&&t.y>=n.y?i={x:n.x,y:n.y,width:t.x-n.x,height:t.y-n.y}:i={x:n.x,y:n.y,width:0,height:0},i}const Qk={__depends__:[pc,ha],__init__:["lassoTool"],lassoTool:["type",xr]};var Mf=1500,Yb="grab";function No(e,t,n,i,r,o){this._dragging=n,this._mouse=o;var a=this,c=i.get("keyboard",!1);r.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",Mf,function(s){if(pa(s))return a.activateMove(s.originalEvent,!0),!1}),c&&c.addListener(Mf,function(s){if(!(!qb(s.keyEvent)||a.isActive())){var u=a._mouse.getLastMoveEvent();a.activateMove(u,!!u)}},"keyboard.keydown"),c&&c.addListener(Mf,function(s){!qb(s.keyEvent)||!a.isActive()||a.toggle()},"keyboard.keyup"),e.on("hand.end",function(s){var u=s.originalEvent.target;if(!s.hover&&!(u instanceof SVGElement))return!1;e.once("hand.ended",function(){a.activateMove(s.originalEvent,{reactivate:!0})})}),e.on("hand.move.move",function(s){var u=t.viewbox().scale;t.scroll({dx:s.dx*u,dy:s.dy*u})}),e.on("hand.move.end",function(s){var u=s.context,l=u.reactivate;return!pa(s)&&l&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}No.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],No.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:Yb,data:{context:n||{}}})},No.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:Yb,data:{context:{reactivate:n}}})},No.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},No.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function qb(e){return Bt("Space",e)}const Jk={__depends__:[pc,ha],__init__:["handTool"],handTool:["type",No]};var Kb="connect-ok",Xb="connect-not-ok";function Bo(e,t,n,i,r,o,a){var c=this;this._dragging=t,this._rules=o,this._mouse=a,r.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",function(s){var u=s.context,l=s.hover,p=u.canStartConnect=c.canStartConnect(l);p!==null&&(u.startTarget=l,i.addMarker(l,p?Kb:Xb))}),e.on(["global-connect.out","global-connect.cleanup"],function(s){var u=s.context.startTarget,l=s.context.canStartConnect;u&&i.removeMarker(u,l?Kb:Xb)}),e.on(["global-connect.ended"],function(s){var u=s.context,l=u.startTarget,p={x:s.x,y:s.y},f=c.canStartConnect(l);if(f)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,l,p)}),!1})}Bo.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Bo.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Bo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Bo.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Bo.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const eD={__depends__:[_f,yi,Ii,pc,ha],globalConnect:["type",Bo]};function kf(e,t,n,i,r,o,a,c){this._palette=e,this._create=t,this._elementFactory=n,this._spaceTool=i,this._lassoTool=r,this._handTool=o,this._globalConnect=a,this._translate=c,e.registerProvider(this)}kf.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],kf.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,i=this._spaceTool,r=this._lassoTool,o=this._handTool,a=this._globalConnect,c=this._translate;function s(p,f,d,h,m){function g(R){var w=n.createShape(O({type:p},m));t.start(R,w)}return{group:f,className:d,title:h,action:{dragstart:g,click:g}}}function u(p){var f=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),d=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:f});t.start(p,[f,d],{hints:{autoSelect:[f]}})}function l(p){t.start(p,n.createParticipantShape())}return O(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:c("Activate hand tool"),action:{click:function(p){o.activateHand(p)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:c("Activate lasso tool"),action:{click:function(p){r.activateSelection(p)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:c("Activate create/remove space tool"),action:{click:function(p){i.activateSelection(p)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:c("Activate global connect tool"),action:{click:function(p){a.start(p)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":s("bpmn:StartEvent","event","bpmn-icon-start-event-none",c("Create start event")),"create.intermediate-event":s("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",c("Create intermediate/boundary event")),"create.end-event":s("bpmn:EndEvent","event","bpmn-icon-end-event-none",c("Create end event")),"create.exclusive-gateway":s("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",c("Create gateway")),"create.task":s("bpmn:Task","activity","bpmn-icon-task",c("Create task")),"create.data-object":s("bpmn:DataObjectReference","data-object","bpmn-icon-data-object",c("Create data object reference")),"create.data-store":s("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",c("Create data store reference")),"create.subprocess-expanded":{group:"activity",className:"bpmn-icon-subprocess-expanded",title:c("Create expanded sub-process"),action:{dragstart:u,click:u}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:c("Create pool/participant"),action:{dragstart:l,click:l}},"create.group":s("bpmn:Group","artifact","bpmn-icon-group",c("Create group"))}),e};const tD={__depends__:[Xk,uc,Sy,Qk,Jk,eD,ra],__init__:["paletteProvider"],paletteProvider:["type",kf]};var nD=250;function Df(e,t,n,i,r){K.call(this,e);function o(c){var s=c.canExecute.replacements;M(s,function(u){var l=u.oldElementId,p={type:u.newElementType};if(!c.visualReplacements[l]){var f=t.get(l);O(p,{x:f.x,y:f.y});var d=n.createShape(p);i.addShape(d,f.parent);var h=tt('[data-element-id="'+Ma(f.id)+'"]',c.dragGroup);h&&re(h,{display:"none"});var m=r.addDragger(d,c.dragGroup);c.visualReplacements[l]=m,i.removeShape(d)}})}function a(c){var s=c.visualReplacements;M(s,function(u,l){var p=tt('[data-element-id="'+Ma(l)+'"]',c.dragGroup);p&&re(p,{display:"inline"}),u.remove(),s[l]&&delete s[l]})}e.on("shape.move.move",nD,function(c){var s=c.context,u=s.canExecute;s.visualReplacements||(s.visualReplacements={}),u&&u.replacements?o(s):a(s)})}Df.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],ie(Df,K);const iD={__depends__:[Ro],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Df]};var rD=1250,Of=40,oD=20,aD=10,Zb=20,Qb=["x","y"],sD=Math.abs;function Jb(e){e.on(["connect.hover","connect.move","connect.end"],rD,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,c=n.target;t.originalEvent&&An(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&cD(t,o,fD(o)),o&&pD(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Kn(r),De(o,["bpmn:Event","bpmn:Gateway"])&&ex(t,Kn(o)),De(o,["bpmn:Task","bpmn:SubProcess"])&&uD(t,o),v(a,"bpmn:BoundaryEvent")&&c===a.host&&lD(t)):tx(i,"bpmn:MessageFlow")?(v(r,"bpmn:Event")&&(n.connectionStart=Kn(r)),v(o,"bpmn:Event")&&ex(t,Kn(o))):n.connectionStart=n.initialConnectionStart)})}Jb.$inject=["eventBus"];function cD(e,t,n){Qb.forEach(function(i){var r=nx(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 uD(e,t){var n=Kn(t);Qb.forEach(function(i){dD(e,t,i)&&Mt(e,i,n[i])})}function lD(e){var t=e.context,n=t.source,i=t.target;if(!hD(t)){var r=Kn(n),o=Kt(r,i,-10),a=[];/top|bottom/.test(o)&&a.push("x"),/left|right/.test(o)&&a.push("y"),a.forEach(function(c){var s=e[c],u;sD(s-r[c])<Of&&(s>r[c]?u=r[c]+Of:u=r[c]-Of,Mt(e,c,u))})}}function ex(e,t){Mt(e,"x",t.x),Mt(e,"y",t.y)}function tx(e,t){return e&&e.type===t}function pD(e,t){return Gi(t,function(n){return tx(e,n)})}function nx(e,t){return e==="x"?t.width:t.height}function fD(e){return v(e,"bpmn:Task")?aD:oD}function dD(e,t,n){return e[n]>t[n]+Zb&&e[n]<t[n]+nx(n,t)-Zb}function hD(e){var t=e.hover,n=e.source;return t&&n&&t===n}function wr(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}wr.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},wr.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},wr.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},wr.prototype.getSnapLocations=function(){return this._snapLocations},wr.prototype.setSnapLocations=function(e){this._snapLocations=e},wr.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new yu,n.initDefaults(this._defaultSnaps)),n};function yu(){this._snapValues={}}yu.prototype.add=function(e,t){var n=this._snapValues[e];n||(n=this._snapValues[e]={x:[],y:[]}),n.x.indexOf(t.x)===-1&&n.x.push(t.x),n.y.indexOf(t.y)===-1&&n.y.push(t.y)},yu.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&n2(e[n],r[n],i)},yu.prototype.initDefaults=function(e){var t=this;M(e||{},function(n,i){M(n,function(r){t.add(i,r)})})};var mD=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"],mD,function(r){var o=r.context,a=o.shape,c=o.snapContext,s=o.target;if(!(r.originalEvent&&An(r.originalEvent))&&!(Io(r)||!s)){var u=c.pointsForTarget(s);u.initialized||(u=i.addSnapTargetPoints(u,a,s),u.initialized=!0),n.snap(r,u)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){n.hide()})}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 wr);var o;t.get(i.id)?o=Kn(i,e):o={x:e.x+Kn(i).x,y:e.y+Kn(i).y};var a={x:o.x-i.width/2,y:o.y-i.height/2},c={x:o.x+i.width/2,y:o.y+i.height/2};return r.setSnapOrigin("mid",{x:o.x-e.x,y:o.y-e.y}),Me(i)||(r.setSnapOrigin("top-left",{x:a.x-e.x,y:a.y-e.y}),r.setSnapOrigin("bottom-right",{x:c.x-e.x,y:c.y-e.y})),r},xi.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return M(i,function(r){if(Me(r)){Me(t)&&e.add("mid",Kn(r));return}if(nt(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",Kn(r))}),!we(t.x)||!we(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Kn(t)),e},xi.prototype.getSnapTargets=function(e,t){return z_(t).filter(function(n){return!gD(n)})};function gD(e){return!!e.hidden}var ix=1500;function $o(e,t){t.invoke(xi,this),e.on(["create.move","create.end"],ix,bD),e.on(["create.move","create.end","shape.move.move","shape.move.end"],ix,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!Io(n)&&yD(n,o)})}ie($o,xi),$o.$inject=["eventBus","injector"],$o.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",ox(o,i,e))}),M(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",ox(o,i,e))}),v(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},$o.prototype.addSnapTargetPoints=function(e,t,n){xi.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);M(i,function(o){(_D(o)||vD([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",F_(o)),e.add("bottom-right",H_(o)))});var r=this._elementRegistry;return M(t.incoming,function(o){if(r.get(t.id)){rx(i,o.source)||e.add("mid",_e(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),M(t.outgoing,function(o){if(r.get(t.id)){rx(i,o.target)||e.add("mid",_e(o.target));var a=o.waypoints[o.waypoints.length-1];e.add(o.id+"-docking",a.original||a)}}),v(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},$o.prototype.getSnapTargets=function(e,t){return xi.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!v(n,"bpmn:Lane")})};function yD(e,t){var n=ye(t),i=bg(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=_e(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 vD(e,t){return e.every(function(n){return v(n,t)})}function _D(e){return v(e,"bpmn:SubProcess")&&$e(e)?!0:v(e,"bpmn:Participant")}function bD(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 rx(e,t){return e.indexOf(t)!==-1}function ox(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var xD=1250;function Ua(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],xD,function(i){var r=i.context,o=r.shape,a=o.parent,c=r.direction,s=r.snapContext;if(!(i.originalEvent&&An(i.originalEvent))&&!Io(i)){var u=s.pointsForTarget(a);u.initialized||(u=n.addSnapTargetPoints(u,o,a,c),u.initialized=!0),SD(c)&&Mt(i,"x",i.x),RD(c)&&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 wr);var o=ax(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},Ua.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return M(r,function(o){e.add("corner",H_(o)),e.add("corner",F_(o))}),e.add("corner",ax(t,i)),e},Ua.$inject=["eventBus","snapping"],Ua.prototype.getSnapTargets=function(e,t){return z_(t).filter(function(n){return!wD(n,e)&&!nt(n)&&!ED(n)&&!Me(n)})};function ax(e,t){var n=_e(e),i=ye(e),r={x:n.x,y:n.y};return t.indexOf("n")!==-1?r.y=i.top:t.indexOf("s")!==-1&&(r.y=i.bottom),t.indexOf("e")!==-1?r.x=i.right:t.indexOf("w")!==-1&&(r.x=i.left),r}function wD(e,t){return e.host===t}function ED(e){return!!e.hidden}function SD(e){return e==="n"||e==="s"}function RD(e){return e==="e"||e==="w"}var CD=7,PD=1e3;function Er(e){this._canvas=e,this._asyncHide=Ru(yn(this.hide,this),PD)}Er.$inject=["canvas"],Er.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:Io(e,"x"),y:Io(e,"y")};M(r,function(a){var c=i.getSnapOrigin(a),s={x:e.x+c.x,y:e.y+c.y};if(M(["x","y"],function(u){var l;o[u]||(l=t.snap(s,a,u,CD),l!==void 0&&(o[u]={value:l,originValue:l-c[u]}))}),o.x&&o.y)return!1}),this.showSnapLine("vertical",o.x&&o.x.value),this.showSnapLine("horizontal",o.y&&o.y.value),M(["x","y"],function(a){var c=o[a];Ht(c)&&Mt(e,a,c.originValue)})},Er.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=me("path");return re(n,{d:"M0,0 L0,0"}),Fe(n).add("djs-snap-line"),Ce(t,n),{update:function(i){we(i)?e==="horizontal"?re(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):re(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):re(n,{display:"none"})}}},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 AD={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",xi],resizeSnapping:["type",Ua],snapping:["type",Er]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",Jb],createMoveSnapping:["type",$o]};var sx=300;function Pe(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=tt(Pe.INPUT_SELECTOR,this._container),this._resultsContainer=tt(Pe.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}Pe.$inject=["canvas","eventBus","selection","translate"],Pe.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:Rn.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,Pe.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,Pe.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,Pe.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,Pe.INPUT_SELECTOR,"keydown",function(n){Bt("ArrowUp",n)&&n.preventDefault(),Bt("ArrowDown",n)&&n.preventDefault()}),t(this._container,Pe.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)})},Pe.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){Rn.unbind(e.el,e.type,e.listener)})},Pe.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=tt(Pe.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},Pe.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},Pe.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)}},Pe.prototype._clearResults=function(){ms(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},Pe.prototype._getCurrentResult=function(){return tt(Pe.RESULT_SELECTED_SELECTOR,this._resultsContainer)},Pe.prototype._createResultNode=function(e,t){var n=ut(Pe.RESULT_HTML);return e.primaryTokens.length>0&&cx(n,e.primaryTokens,Pe.RESULT_PRIMARY_HTML),cx(n,e.secondaryTokens,Pe.RESULT_SECONDARY_HTML),an(n,Pe.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},Pe.prototype.registerProvider=function(e){this._searchProvider=e},Pe.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,dt(this._canvas.getContainer()).add("djs-search-open"),dt(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},Pe.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,dt(this._canvas.getContainer()).remove("djs-search-open"),dt(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},Pe.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Pe.prototype.isOpen=function(){return this._open},Pe.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&dt(t).remove(Pe.RESULT_SELECTED_CLASS);var n=an(e,Pe.RESULT_ID_ATTRIBUTE),i=this._results[n].element;dt(e).add(Pe.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:sx}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},Pe.prototype._select=function(e){var t=an(e,Pe.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:sx}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},Pe.prototype._getBoxHtml=function(){const e=ut(Pe.BOX_HTML),t=tt(Pe.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function cx(e,t,n){var i=TD(t),r=ut(n);r.innerHTML=i,e.appendChild(r)}function TD(e){var t="";return e.forEach(function(n){var i=gv(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+Pe.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}Pe.CONTAINER_SELECTOR=".djs-search-container",Pe.INPUT_SELECTOR=".djs-search-input input",Pe.RESULTS_CONTAINER_SELECTOR=".djs-search-results",Pe.RESULT_SELECTOR=".djs-search-result",Pe.RESULT_SELECTED_CLASS="djs-search-result-selected",Pe.RESULT_SELECTED_SELECTOR="."+Pe.RESULT_SELECTED_CLASS,Pe.RESULT_ID_ATTRIBUTE="data-result-id",Pe.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",Pe.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>`,
|
|
343
|
+
</div>`,Pe.RESULT_HTML='<div class="djs-search-result"></div>',Pe.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',Pe.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const MD={__depends__:[ra,Oc,Un],searchPad:["type",Pe]};function Lf(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}Lf.$inject=["elementRegistry","searchPad","canvas","search"],Lf.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!Me(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:Nn(i),id:i.id})),e,{keys:["label","id"]}).map(kD)};function kD(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const DD={__depends__:[MD,b_],__init__:["bpmnSearch"],bpmnSearch:["type",Lf]},OD="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",LD="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",ID={width:36,height:50},ND={width:50,height:50};function ux(e,t,n){return me("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const Qn=5;function vu(e,t){this._styles=t,e.registerProvider(this)}vu.$inject=["outline","styles"],vu.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(aS(e))return n=me("rect"),re(n,O({x:-Qn,y:-Qn,rx:4,width:e.width+Qn*2,height:e.height+Qn*2},t)),n;if(!Me(e))return v(e,"bpmn:Gateway")?(n=me("rect"),O(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),re(n,O({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):De(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=me("rect"),re(n,O({x:-Qn,y:-Qn,rx:14,width:e.width+Qn*2,height:e.height+Qn*2},t))):v(e,"bpmn:EndEvent")?(n=me("circle"),re(n,O({cx:e.width/2,cy:e.height/2,r:e.width/2+Qn+1},t))):v(e,"bpmn:Event")?(n=me("circle"),re(n,O({cx:e.width/2,cy:e.height/2,r:e.width/2+Qn},t))):v(e,"bpmn:DataObjectReference")&&lx(e,"bpmn:DataObjectReference")?n=ux(OD,{x:-6,y:-6},t):v(e,"bpmn:DataStoreReference")&&lx(e,"bpmn:DataStoreReference")&&(n=ux(LD,{x:-6,y:-6},t)),n},vu.prototype.updateOutline=function(e,t){if(!Me(e))return De(e,["bpmn:SubProcess","bpmn:Group"])?(re(t,{width:e.width+Qn*2,height:e.height+Qn*2}),!0):!!De(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function lx(e,t){var n;return t==="bpmn:DataObjectReference"?n=ID:t==="bpmn:DataStoreReference"&&(n=ND),e.width===n.width&&e.height===n.height}const BD={__depends__:[Sf],__init__:["outlineProvider"],outlineProvider:["type",vu]};var $D='<?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 wi(e){uo.call(this,e)}ie(wi,uo),wi.Viewer=gr,wi.NavigatedViewer=ka,wi.prototype.createDiagram=function(){return this.importXML($D)},wi.prototype._interactionModules=[Ev,Rv,Av],wi.prototype._modelingModules=[FM,kc,WM,VM,r2,_f,l2,I2,dy,uc,j2,z2,rk,ak,sk,fk,Sk,Tk,Gp,Nk,Gk,tD,iD,Sb,AD,DD,BD],wi.prototype._modules=[].concat(gr.prototype._modules,wi.prototype._interactionModules,wi.prototype._modelingModules);const jD=((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 c(u){if(!a)throw new Error("modeler not mounted");try{const{warnings:l}=await a.importXML(u),p=ju(l);return r("imported",p),{warnings:p}}catch(l){throw r("import-error",l),l}}async function s(){if(!a)throw new Error("modeler not mounted");const{xml:u}=await a.saveXML({format:!0});return u??""}return St.onMounted(async()=>{a=new wi({container:o.value,moddleExtensions:ns}),i.xml&&await c(i.xml),r("ready")}),St.watch(()=>i.xml,u=>{u&&a&&c(u)}),St.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:c,saveXml:s,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=Fx,Q.BPMN_MODDLE_EXTENSIONS=ns,Q.BWL_MODDLE_SCHEMA=$f,Q.BWL_NS=Bf,Q.BWL_PREFIX=bu,Q.BWL_SIDES=xu,Q.BpmnModelerView=jD,Q.EDITOR=oE,Q.FLOW_LABEL_INDENT=gd,Q.HEADLESS_BPMN_MODULES=dv,Q.HEADLESS_TEXT_METRICS=oo,Q.I18N_NS=vw,Q.I18N_PREFIX=ud,Q.LABEL_FORK_MARGIN=Fu,Q.MVP_FLOW_NODE_TYPES=Ei,Q.SYMBOLIC_OP_KINDS=Hf,Q.SYMBOLIC_OP_SCHEMA=zf,Q.UNDO_EPISODE_COMMAND=wu,Q.applyBpmnOpBatch=ah,Q.applyBpmnOps=nh,Q.approximateTextWidth=Wo,Q.auditBpmnGeometry=Cd,Q.auditBpmnGeometryXml=Ow,Q.auditGeometry=Ki,Q.auditTargetsOf=Pi,Q.axisSegmentsOf=pn,Q.buildBpmnOpBatch=rE,Q.buildRegistryIndex=Ad,Q.containerBoundarySegments=Go,Q.createBpmnEditorController=aE,Q.createBpmnModdle=ld,Q.createHeadlessBpmnModeler=CT,Q.crossedShapesOf=Fn,Q.crossingCost=Ci,Q.describeProcess=oh,Q.describeProcessXml=iE,Q.edgeCrossCount=ss,Q.edgeCrossingPairsOf=Hu,Q.executeAsUndoEpisode=Ff,Q.forwardThreePointCandidates=zu,Q.geometryFindingKey=qi,Q.installHeadlessBpmnDom=Jd,Q.isMvpFlowNodeType=Nf,Q.labelRectsOf=cs,Q.lineCrossesLabel=Ri,Q.lineThroughLabel=_d,Q.lineThroughShapeLabel=Sd,Q.loadBpmnXml=$u,Q.lowerOps=th,Q.oppositeOverlapCount=Ew,Q.oppositeOverlapOf=md,Q.planBackEdgeBoundaryClearance=Fd,Q.planCrossPoolRoute=Nd,Q.planEdgeRepair=Od,Q.planLabelLineClearance=Wd,Q.planLabelPlacement=Gd,Q.planMiddleSegmentShifts=kd,Q.planOppositeOverlapRepair=zd,Q.planSegmentDetours=Md,Q.planShapeLabelClearance=qd,Q.repairIntroducedBoundaryHugging=Hd,Q.repairIntroducedCrossings=Ld,Q.repairIntroducedLabelLines=Ud,Q.repairIntroducedOppositeOverlaps=Vd,Q.repairIntroducedShapeLabelLines=Kd,Q.repairIntroducedSharedSegmentLabels=Yd,Q.rerouteIntroducedCrossPoolEdges=Bd,Q.resolverServicesOf=eh,Q.saveBpmnXml=_w,Q.sceneCrossingCost=xd,Q.sceneFromDefinitions=Rd,Q.sceneFromRegistry=Vt,Q.sharedSegmentUnderLabel=as,Q.sharedSpansOf=os,Q.unreadableOverlapCount=kr,Q.unreadableOverlapOf=rs,Q.validateOps=Qd,Q.warningMessages=ju,Object.defineProperty(Q,Symbol.toStringTag,{value:"Module"})}));
|