@g1cloud/bpmn-modeler-next 5.0.0-alpha.55 → 5.0.0-alpha.57
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/resolver/routeRepair.d.ts +19 -0
- package/dist/bpmn-modeler.js +9254 -9112
- package/dist/bpmn-modeler.umd.cjs +74 -74
- package/package.json +1 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
(function(oe,At){typeof exports=="object"&&typeof module<"u"?At(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],At):(oe=typeof globalThis<"u"?globalThis:oe||self,At(oe.BpmnModeler={},oe.Vue))})(this,(function(oe,At){"use strict";var KD=Object.defineProperty;var XD=(oe,At,Ri)=>At in oe?KD(oe,At,{enumerable:!0,configurable:!0,writable:!0,value:Ri}):oe[At]=Ri;var Zr=(oe,At,Ri)=>XD(oe,typeof At!="symbol"?At+"":At,Ri);const Ri=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway"];function td(e){return Ri.includes(e)}const nd="http://g1project.net/spec/bpmn/bwl/1.0",Au="bwl",Tu=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],id={name:"bwl-hints",uri:nd,prefix:Au,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"}]}]},Mu="bwl.undoEpisode",rd=new WeakSet;function v0(e){rd.has(e)||(e.register(Mu,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),rd.add(e))}function od(e,t){v0(e);const n={run:t};if(e.execute(Mu,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const ad=["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"],b0={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},_0={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},x0={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},w0={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다.",properties:{id:{type:"string"},type:{type:"string",enum:[...Ri]},name:{type:"string"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},E0={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},S0={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},R0={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"}},required:["id","source","target"],additionalProperties:!1},C0={type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},P0={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},A0={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},T0={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},M0={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},k0={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...Tu]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function rn(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const O0={"participant.add":rn("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":rn("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":rn("node.add",{description:'플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 갈래 1, 2…) — 위/아래가 아니라 "주 흐름에서 몇 번째 갈래"다. 행 배치(어느 갈래가 위/아래인지)는 호스트가 정한다(대칭·메시지 방향). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.',properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["node"]}),"node.update":rn("node.update",{description:"노드 이름/레인/타입/밴드 갱신. lane = 레인 재배정(이동), type = 태스크·이벤트 타입 전환, band = 행 재지정. 🔴 **기존 문서에서 band 는 「몇 번째 갈래」가 아니라 그 컨테이너의 행 번호**다(describe 의 hints.bands 가 보여 주는 값) — 신규 배치의 band 가 대칭으로 펴지는 것과 다르다. 간선이 도형을 가로지르거나 반대 방향으로 겹칠 때 그 노드를 다른 행으로 옮기는 채널이다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lane:{type:"string"},type:{type:"string",enum:[...Ri]},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["id"]}),"sequenceFlow.add":rn("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":rn("sequenceFlow.update",{description:"시퀀스 플로우 이름/조건/끝점 갱신. condition: null = 조건 제거. source/target = 끝점 재배선 — 중간 삽입은 기존 플로우를 지우지 말고 이것으로 한쪽 끝을 옮긴 뒤 새 플로우를 추가한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},condition:{description:"생략 = 보존, null = 제거.",anyOf:[{$ref:"#/$defs/irFlowCondition"},{type:"null"}]},source:{description:"새 출발 노드 id(생략 = 보존). 같은 배치에서 추가한 노드도 지목할 수 있다.",type:"string"},target:{description:"새 도착 노드 id(생략 = 보존). 같은 배치에서 추가한 노드도 지목할 수 있다.",type:"string"}},required:["id"]}),"messageFlow.add":rn("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":rn("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataStore.add":rn("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":rn("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataAssociation.add":rn("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":rn("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":rn("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":rn("annotation.update",{description:"주석 본문/방위 힌트 갱신. placement: null = 힌트 제거(휴리스틱 복귀). 주석 삭제는 element.remove.",properties:{id:{type:"string"},text:{type:"string"},placement:{description:"생략 = 보존, null = 힌트 제거.",anyOf:[{$ref:"#/$defs/bwlPlacement"},{type:"null"}]}},required:["id"]}),"group.add":rn("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":rn("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"element.remove":rn("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},sd={anyOf:ad.map(e=>O0[e])},D0={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:_0,irParticipant:x0,irNode:w0,irFlowCondition:E0,irSequenceFlow:S0,irMessageFlow:R0,irDataStore:C0,irDataAssociation:P0,irTextAnnotation:A0,irAssociation:T0,irGroup:M0,bwlPlacement:k0,nullableString:b0,symbolicOp:sd}};function ku(e){return Array.prototype.concat.apply([],e)}const Vo=Object.prototype.toString,L0=Object.prototype.hasOwnProperty;function Rr(e){return e===void 0}function Nt(e){return e!==void 0}function Qr(e){return e==null}function ke(e){return Vo.call(e)==="[object Array]"}function Vt(e){return Vo.call(e)==="[object Object]"}function Le(e){return Vo.call(e)==="[object Number]"}function Wt(e){const t=Vo.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function wn(e){return Vo.call(e)==="[object String]"}function I0(e){if(!ke(e))throw new Error("must supply array")}function En(e,t){return!Qr(e)&&L0.call(e,t)}function lt(e,t){const n=ns(t);let i;return L(e,function(r,o){if(n(r,o))return i=r,!1}),i}function cd(e,t){const n=ns(t);let i=ke(e)?-1:void 0;return L(e,function(r,o){if(n(r,o))return i=o,!1}),i}function Ge(e,t){const n=ns(t);let i=[];return L(e,function(r,o){n(r,o)&&i.push(r)}),i}function L(e,t){let n,i;if(Rr(e))return;const r=ke(e)?F0:j0;for(let o in e)if(En(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function N0(e,t){if(Rr(e))return[];I0(e);const n=ns(t);return e.filter(function(i,r){return!n(i,r)})}function Sn(e,t,n){return L(e,function(i,r){n=t(n,i,r)}),n}function Cr(e,t){return!!Sn(e,function(n,i,r){return n&&t(i,r)},!0)}function Ui(e,t){return!!lt(e,t)}function on(e,t){let n=[];return L(e,function(i,r){n.push(t(i,r))}),n}function ts(e){return e&&Object.keys(e)||[]}function B0(e){return ts(e).length}function Jr(e){return on(e,t=>t)}function eo(e,t,n={}){return t=Ou(t),L(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function ud(e,...t){e=Ou(e);let n={};return L(t,r=>eo(r,e,n)),on(n,function(r,o){return r[0]})}const $0=ud;function ai(e,t){t=Ou(t);let n=[];return L(e,function(i,r){let o=t(i,r),a={d:o,v:i};for(var s=0;s<n.length;s++){let{d:c}=n[s];if(o<c){n.splice(s,0,a);return}}n.push(a)}),on(n,i=>i.v)}function to(e){return function(t){return Cr(e,function(n,i){return t[i]===n})}}function Ou(e){return Wt(e)?e:t=>t[e]}function ns(e){return Wt(e)?e:t=>t===e}function j0(e){return e}function F0(e){return Number(e)}function Du(e,t){let n,i,r,o;function a(p){let f=Date.now(),d=p?0:o+t-f;if(d>0)return s(d);e.apply(r,i),c()}function s(p){n=setTimeout(a,p)}function c(){n&&clearTimeout(n),n=o=i=r=void 0}function u(){n&&a(!0),c()}function l(...p){o=Date.now(),i=p,r=this,n||s(t)}return l.flush=u,l.cancel=c,l}function mn(e,t){return e.bind(t)}function H(e,...t){return Object.assign(e,...t)}function H0(e,t,n){let i=e;return L(t,function(r,o){if(typeof r!="number"&&typeof r!="string")throw new Error("illegal key type: "+typeof r+". Key should be of type number or string.");if(r==="constructor")throw new Error("illegal key: constructor");if(r==="__proto__")throw new Error("illegal key: __proto__");let a=t[o+1],s=i[r];Nt(a)&&Qr(s)&&(s=i[r]=isNaN(+a)?{}:[]),Rr(a)?Rr(n)?delete i[r]:i[r]=n:i=s}),e}function Qn(e,t){let n={},i=Object(e);return L(t,function(r){r in i&&(n[r]=e[r])}),n}function si(e,t){let n={},i=Object(e);return L(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function Lu(){}Lu.prototype.get=function(e){return this.$model.properties.get(this,e)},Lu.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function ld(e,t){this.model=e,this.properties=t}ld.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Lu.prototype);L(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}),L(a,mn(function(s,c){this.set(c,s)},this))}return o.prototype=i,o.hasType=i.$instanceOf=this.model.hasType,n.defineModel(o,t),n.defineDescriptor(o,e),o};var z0=H(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),pd=H(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 Iu(e,t){var n=pd[e];return n?n(t):t}function Nu(e){return!!z0[e]}function fd(e){return!!pd[e]}function an(e,t){var n=e.split(/:/),i,r;if(n.length===1)i=e,r=t;else if(n.length===2)i=n[1],r=n[0];else throw new Error("expected <prefix:localName> or <localName>, got "+e);return e=(r?r+":":"")+i,{name:e,prefix:r,localName:i}}function Ln(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}Ln.prototype.build=function(){return Qn(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},Ln.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)},Ln.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},Ln.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=an(r[0],i),a=an(r[1],o.prefix).name,s=this.propertiesByName[a];if(s)this.replaceProperty(s,e,n);else throw new Error("refined property <"+a+"> not found");delete e.redefines},Ln.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},Ln.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},Ln.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},Ln.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},Ln.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},Ln.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")},Ln.prototype.hasProperty=function(e){return this.propertiesByName[e]},Ln.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(L(e.properties,mn(function(o){o=H({},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 qi(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,L(e,mn(this.registerPackage,this))}qi.prototype.getPackage=function(e){return this.packageMap[e]},qi.prototype.getPackages=function(){return this.packages},qi.prototype.registerPackage=function(e){e=H({},e);var t=this.packageMap;dd(t,e,"prefix"),dd(t,e,"uri"),L(e.types,mn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},qi.prototype.registerType=function(e,t){e=H({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:H({},e.meta||{})});var n=an(e.name,t.prefix),i=n.name,r=Object.create(null);L(e.properties,mn(function(o){var a=an(o.name,n.prefix),s=a.name;Nu(o.type)||(o.type=an(o.type,a.prefix).name),H(o,{ns:a,name:s}),r[s]=o},this)),H(e,{ns:n,name:i,propertiesByName:r}),L(e.extends,mn(function(o){var a=an(o,n.prefix),s=this.typeMap[a.name];s.traits=s.traits||[],s.traits.push(i)},this)),this.definePackage(e,t),this.typeMap[i]=e},qi.prototype.mapTypes=function(e,t,n){var i=Nu(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,u){var l=an(c,Nu(c)?"":e.prefix);r.mapTypes(l,t,u)}function a(c){return o(c,!0)}function s(c){return o(c,!1)}if(!i)throw new Error("unknown type <"+e.name+">");L(i.superClass,n?a:s),t(i,!n),L(i.traits,a)},qi.prototype.getEffectiveDescriptor=function(e){var t=an(e),n=new Ln(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},qi.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function dd(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(!wn(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;G0(n)?i?delete e[r]:delete e.$attrs[Bu(t)]:i?r in e?e[r]=n:hd(e,i,n):e.$attrs[Bu(t)]=n},Pr.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[Bu(t)];var i=n.name;return!e[i]&&n.isMany&&hd(e,n,[]),e[i]},Pr.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=H({},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 G0(e){return typeof e>"u"}function hd(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Bu(e){return e.replace(/^:/,"")}function $n(e,t={}){this.properties=new Pr(this),this.factory=new ld(this,this.properties),this.registry=new qi(e,this.properties),this.typeCache=Object.create(null),this.config=t}$n.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},$n.prototype.getType=function(e){var t=this.typeCache,n=wn(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},$n.prototype.createAny=function(e,t,n){var i=an(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){H0(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}),L(n,function(a,s){Vt(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},$n.prototype.getPackage=function(e){return this.registry.getPackage(e)},$n.prototype.getPackages=function(){return this.registry.getPackages()},$n.prototype.getElementDescriptor=function(e){return e.$descriptor},$n.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},$n.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},$n.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var md=String.fromCharCode,V0=Object.prototype.hasOwnProperty,W0=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,Wo={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(Wo).forEach(function(e){Wo[e.toUpperCase()]=Wo[e]});function U0(e,t,n,i){return i?V0.call(Wo,i)?Wo[i]:"&"+i+";":md(t||parseInt(n,16))}function Ar(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(W0,U0):e}var gd="non-whitespace outside of root node";function Yi(e){return new Error(e)}function q0(e){return"missing namespace for prefix <"+e+">"}function is(e){return{get:e,enumerable:!0}}function Y0(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var yd=Symbol("nameCache");function $u(e){return e+"$uri"}function K0(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[$u(i)]=n;return t}function rs(){return{line:0,column:0}}function X0(e){throw e}function vd(e){if(!this)return new vd(e);var t=e&&e.proxy,n,i,r,o,a=X0,s,c,u,l,p=rs,f=!1,d=!1,g="",h=!1,m=!1,w=null,y=!1,_,S,P,C;function D(O){O instanceof Error||(O=Yi(O)),w=O,a(O,p)}function T(O){s&&(O instanceof Error||(O=Yi(O)),s(O,p))}this.on=function(O,F){if(typeof F!="function")throw Yi("required args <name, cb>");switch(O){case"openTag":i=F;break;case"text":n=F;break;case"closeTag":r=F;break;case"error":a=F;break;case"warn":s=F;break;case"cdata":o=F;break;case"attention":l=F;break;case"question":u=F;break;case"comment":c=F;break;default:throw Yi("unsupported event: "+O)}return this},this.ns=function(O){if(typeof O>"u"&&(O={}),typeof O!="object")throw Yi("required args <nsMap={}>");var F=Object.create(null),ae;for(ae in O)F[ae]=O[ae];return m=!0,C=F,this};function N(){_=m?[]:null,S=m?K0(C):null,P=[],p=rs,y=!1,w=null,d=!1,g=""}this.parse=function(O){if(typeof O!="string")throw Yi("required args <xml=string>");if(f)throw Yi("parse during stream; call end() first");return N(),k(O),p=rs,y=!1,w},this.write=function(O){if(typeof O!="string")throw Yi("required args <xml=string>");return f||(N(),f=!0),w||(g=k(g+O,!0)||""),this},this.end=function(){return f||N(),f=!1,w||k(g),g="",p=rs,y=!1,w},this.stop=function(){y=!0};function k(O,F=!1){var ae=null,_e=null,We,Y=0,le=!1,ge=!1,ue=0,Re=0,re,q,U,Z,He,wt,M,E,b,j="",W=0,K;function ye(nt,Ht){var Xt=nt.indexOf(":");if(Xt===-1)return nt;var ln=S[nt.substring(0,Xt)];return ln?Ht===ln?nt.substr(Xt+1):ln+nt.substr(Xt):(T(q0(nt.substring(0,Xt))),null)}function Ie(){if(K!==null)return K;var nt,Ht,Xt=m&&S.xmlns,ln=m&&h?[]:null,et=W,zt=j,Zt=zt.length,Wi,bn,ri,Zn,It,qr={},Za=new Set,_n,Ze,rt;e:for(;et<Zt;et++)if(_n=!1,Ze=zt.charCodeAt(et),!(Ze===32||Ze<14&&Ze>8)){for((Ze<65||Ze>122||Ze>90&&Ze<97)&&Ze!==95&&Ze!==58&&(T("illegal first char attribute name"),_n=!0),rt=et+1;rt<Zt;rt++)if(Ze=zt.charCodeAt(rt),!(Ze>96&&Ze<123||Ze>64&&Ze<91||Ze>47&&Ze<59||Ze===46||Ze===45||Ze===95)){if(Ze===32||Ze<14&&Ze>8){T("missing attribute value"),et=rt;continue e}if(Ze===61)break;T("illegal attribute name char"),_n=!0}if(It=zt.substring(et,rt),It==="xmlns:xmlns"&&(T("illegal declaration of xmlns"),_n=!0),Ze=zt.charCodeAt(rt+1),Ze===34)rt=zt.indexOf('"',et=rt+2),rt===-1&&(rt=zt.indexOf("'",et),rt!==-1&&(T("attribute value quote missmatch"),_n=!0));else if(Ze===39)rt=zt.indexOf("'",et=rt+2),rt===-1&&(rt=zt.indexOf('"',et),rt!==-1&&(T("attribute value quote missmatch"),_n=!0));else for(T("missing attribute value quotes"),_n=!0,rt=rt+1;rt<Zt&&(Ze=zt.charCodeAt(rt+1),!(Ze===32||Ze<14&&Ze>8));rt++);for(rt===-1&&(T("missing closing quotes"),rt=Zt,_n=!0),_n||(ri=zt.substring(et,rt)),et=rt;rt+1<Zt&&(Ze=zt.charCodeAt(rt+1),!(Ze===32||Ze<14&&Ze>8));rt++)et===rt&&(T("illegal character after attribute end"),_n=!0);if(et=rt+1,_n)continue e;if(Za.has(It)){T("attribute <"+It+"> already defined");continue}if(Za.add(It),!m){qr[It]=ri;continue}if(h){if(bn=It==="xmlns"?"xmlns":It.charCodeAt(0)===120&&It.substr(0,6)==="xmlns:"?It.substr(6):null,bn!==null){if(nt=Ar(ri),Ht=$u(bn),Zn=C[nt],!Zn){if(bn==="xmlns"||Ht in S&&S[Ht]!==nt)do Zn="ns"+Y++;while(typeof S[Zn]<"u");else Zn=bn;C[nt]=Zn}S[bn]!==Zn&&(Wi||(S=Y0(S),Wi=!0),S[bn]=Zn,bn==="xmlns"&&(S[$u(Zn)]=nt,Xt=Zn),S[Ht]=nt),qr[It]=ri;continue}ln.push(It,ri);continue}It=ye(It,Xt),It!==null&&(qr[It]=ri)}if(h)for(et=0,Zt=ln.length;et<Zt;et++)It=ye(ln[et++],Xt),ri=ln[et],It!==null&&(qr[It]=ri);return K=qr}function Xe(){for(var nt=/(\r\n|\r|\n)/g,Ht=0,Xt=0,ln=0,et=Re,zt,Zt;ue>=ln&&(zt=nt.exec(O),!(!zt||(et=zt[0].length+zt.index,et>ue)));)Ht+=1,ln=et;return ue==-1?(Xt=et,Zt=O.substring(Re)):Re===0?Zt=O.substring(Re,ue):(Xt=ue-ln,Zt=Re==-1?O.substring(ue):O.substring(ue,Re+1)),{data:Zt,line:Ht,column:Xt}}for(p=Xe,t&&(b=Object.create({},{name:is(function(){return M}),originalName:is(function(){return E}),attrs:is(Ie),ns:is(function(){return S})}));Re!==-1;){if(O.charCodeAt(Re)===60?ue=Re:ue=O.indexOf("<",Re),ue===-1){if(F)return O.substring(Re);if(P.length)return D("unexpected end of file");if(!d)return D("missing start tag");Re<O.length&&O.substring(Re).trim()&&T(gd);return}if(d||(d=!0),Re!==ue){if(P.length){if(n&&(n(O.substring(Re,ue),Ar,p),y))return}else if(O.substring(Re,ue).trim()&&(T(gd),y))return}if(Z=O.charCodeAt(ue+1),Z===33){if(U=O.charCodeAt(ue+2),U===91&&O.substr(ue+3,6)==="CDATA["){if(Re=O.indexOf("]]>",ue),Re===-1)return F?O.substring(ue):D("unclosed cdata");if(o&&(o(O.substring(ue+9,Re),p),y))return;Re+=3;continue}if(U===45&&O.charCodeAt(ue+3)===45){if(Re=O.indexOf("-->",ue),Re===-1)return F?O.substring(ue):D("unclosed comment");if(c&&(c(O.substring(ue+4,Re),Ar,p),y))return;Re+=3;continue}}if(Z===63){if(Re=O.indexOf("?>",ue),Re===-1)return F?O.substring(ue):D("unclosed question");if(u&&(u(O.substring(ue,Re+2),p),y))return;Re+=2;continue}for(re=ue+1;;re++){if(He=O.charCodeAt(re),isNaN(He))return F?O.substring(ue):(Re=-1,D("unclosed tag"));if(He===34)U=O.indexOf('"',re+1),re=U!==-1?U:re;else if(He===39)U=O.indexOf("'",re+1),re=U!==-1?U:re;else if(He===62){Re=re;break}}if(Z===33){if(l&&(l(O.substring(ue,Re+1),Ar,p),y))return;Re+=1;continue}if(K={},Z===47){if(le=!1,ge=!0,!P.length)return D("missing open tag");if(re=M=P.pop(),U=ue+2+re.length,O.substring(ue+2,U)!==re)return D("closing tag mismatch");for(;U<Re;U++)if(Z=O.charCodeAt(U),!(Z===32||Z>8&&Z<14))return D("close tag")}else{if(O.charCodeAt(Re-1)===47?(re=M=O.substring(ue+1,Re-1),le=!0,ge=!0):(re=M=O.substring(ue+1,Re),le=!0,ge=!1),!(Z>96&&Z<123||Z>64&&Z<91||Z===95||Z===58))return D("illegal first char nodeName");for(U=1,q=re.length;U<q;U++)if(Z=re.charCodeAt(U),!(Z>96&&Z<123||Z>64&&Z<91||Z>47&&Z<59||Z===45||Z===95||Z==46)){if(Z===32||Z<14&&Z>8){M=re.substring(0,U),K=null;break}return D("invalid nodeName")}ge||P.push(M)}if(m){We=S,le&&(ge||_.push(We),K===null&&(h=re.indexOf("xmlns",U)!==-1)&&(W=U,j=re,Ie(),h=!1)),E=M,_e!==S&&(ae=S[yd],ae===void 0&&(ae=S[yd]=Object.create(null)),_e=S);var Et=ae[M];if(Et!==void 0)M=Et;else{if(Z=M.indexOf(":"),Z!==-1){if(wt=S[M.substring(0,Z)],!wt)return D("missing namespace on <"+E+">");M=M.substr(Z+1)}else wt=S.xmlns;wt&&(M=wt+":"+M),ae[E]=M}}if(le&&(W=U,j=re,i&&(t?i(b,Ar,ge,p):i(M,Ie,Ar,ge,p),y)))return;if(ge){if(r&&(r(t?b:M,Ar,le,p),y))return;m&&(le?S=We:S=_.pop())}Re+=1}}}function bd(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var ju={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},_d="property";function xd(e){return e.xml&&e.xml.serialize}function Z0(e){const t=xd(e);return t!==_d&&(t||null)}function Q0(e){return e.charAt(0).toUpperCase()+e.slice(1)}function wd(e,t){return bd(t)?e.prefix+":"+Q0(e.localName):e.name}function J0(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 ew(e,t,n){const i=an(e,t.xmlns),r=`${t[i.prefix]||i.prefix}:${i.localName}`,o=an(r);var a=n.getPackage(o.prefix);return J0(o,a)}function Ki(e){return new Error(e)}function Ci(e){return e.$descriptor}function tw(e){H(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw Ki("expected element");var n=this.elementsById,i=Ci(t),r=i.idProperty,o;if(r&&(o=t.get(r.name),o)){if(!/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i.test(o))throw new Error("illegal ID <"+o+">");if(n[o])throw Ki("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function Uo(){}Uo.prototype.handleEnd=function(){},Uo.prototype.handleText=function(){},Uo.prototype.handleNode=function(){};function Fu(){}Fu.prototype=Object.create(Uo.prototype),Fu.prototype.handleNode=function(){return this};function no(){}no.prototype=Object.create(Uo.prototype),no.prototype.handleText=function(e){this.body=(this.body||"")+e};function qo(e,t){this.property=e,this.context=t}qo.prototype=Object.create(no.prototype),qo.prototype.handleNode=function(e){if(this.element)throw Ki("expected no sub nodes");return this.element=this.createReference(e),this},qo.prototype.handleEnd=function(){this.element.id=this.body},qo.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function Hu(e,t){this.element=t,this.propertyDesc=e}Hu.prototype=Object.create(no.prototype),Hu.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Iu(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function os(){}os.prototype=Object.create(no.prototype),os.prototype.handleNode=function(e){var t=this,n=this.element;return n?t=this.handleChild(e):(n=this.element=this.createElement(e),this.context.addElement(n)),t};function pn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}pn.prototype=Object.create(os.prototype),pn.prototype.addReference=function(e){this.context.addReference(e)},pn.prototype.handleText=function(e){var t=this.element,n=Ci(t),i=n.bodyProperty;if(!i)throw Ki("unexpected body text <"+e+">");no.prototype.handleText.call(this,e)},pn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Ci(t),i=n.bodyProperty;i&&e!==void 0&&(e=Iu(i.type,e),t.set(i.name,e))},pn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=Ci(n),r=this.context,o=new n({}),a=this.model,s;return L(t,function(c,u){var l=i.propertiesByName[u],p;l&&l.isReference?l.isMany?(p=c.split(" "),L(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=Iu(l.type,c):u==="xmlns"?u=":"+u:(s=an(u,i.ns.prefix),a.getPackage(s.prefix)&&r.addWarning({message:"unknown attribute <"+u+">",element:o,property:u,value:c})),o.set(u,c))}),o},pn.prototype.getPropertyForNode=function(e){var t=e.name,n=an(t),i=this.type,r=this.model,o=Ci(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const u=Z0(s);if(u){const l=e.attributes[u];if(l){const p=ew(l,e.ns,r),f=r.getType(p);return H({},s,{effectiveType:Ci(f).name})}}return s}var c=r.getPackage(n.prefix);if(c){const u=wd(n,c),l=r.getType(u);if(s=lt(o.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&l.hasType(p.type)}),s)return H({},s,{effectiveType:Ci(l).name})}else if(s=lt(o.properties,function(u){return!u.isReference&&!u.isAttribute&&u.type==="Element"}),s)return s;throw Ki("unrecognized element <"+n.name+">")},pn.prototype.toString=function(){return"ElementDescriptor["+Ci(this.type).name+"]"},pn.prototype.valueHandler=function(e,t){return new Hu(e,t)},pn.prototype.referenceHandler=function(e){return new qo(e,this.context)},pn.prototype.handler=function(e){return e==="Element"?new io(this.model,e,this.context):new pn(this.model,e,this.context)},pn.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,fd(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?(H(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function zu(e,t,n){pn.call(this,e,t,n)}zu.prototype=Object.create(pn.prototype),zu.prototype.createElement=function(e){var t=e.name,n=an(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&wd(n,o)||t;if(!r.hasType(a))throw Ki("unexpected element <"+e.originalName+">");return pn.prototype.createElement.call(this,e)};function io(e,t,n){this.model=e,this.context=n}io.prototype=Object.create(os.prototype),io.prototype.createElement=function(e){var t=e.name,n=an(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},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 Gu(e){e instanceof $n&&(e={model:e}),H(this,{lax:!1},e)}Gu.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof pn?(i=t,t={}):typeof t=="string"?(i=this.handler(t),t={}):typeof i=="string"&&(i=this.handler(i));var r=this.model,o=this.lax,a=new tw(H({},t,{rootHandler:i})),s=new vd({proxy:!0}),c=nw();i.context=a,c.push(i);function u(P,C,D){var T=C(),N=T.line,k=T.column,O=T.data;O.charAt(0)==="<"&&O.indexOf(" ")!==-1&&(O=O.slice(0,O.indexOf(" "))+">");var F="unparsable content "+(O?O+" ":"")+`detected
|
|
2
|
-
line:
|
|
1
|
+
(function(ae,Mt){typeof exports=="object"&&typeof module<"u"?Mt(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],Mt):(ae=typeof globalThis<"u"?globalThis:ae||self,Mt(ae.BpmnModeler={},ae.Vue))})(this,(function(ae,Mt){"use strict";var rL=Object.defineProperty;var oL=(ae,Mt,Ri)=>Mt in ae?rL(ae,Mt,{enumerable:!0,configurable:!0,writable:!0,value:Ri}):ae[Mt]=Ri;var Xr=(ae,Mt,Ri)=>oL(ae,typeof Mt!="symbol"?Mt+"":Mt,Ri);const Ri=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway"];function rd(e){return Ri.includes(e)}const od="http://g1project.net/spec/bpmn/bwl/1.0",Tu="bwl",Mu=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],ad={name:"bwl-hints",uri:od,prefix:Tu,xml:{tagAlias:"lowerCase"},types:[{name:"Placement",superClass:["Element"],properties:[{name:"anchor",isAttr:!0,type:"String"},{name:"side",isAttr:!0,type:"String"},{name:"offset",isAttr:!0,type:"Real"}]},{name:"Members",superClass:["Element"],properties:[{name:"refs",isAttr:!0,type:"String"}]},{name:"BandHint",extends:["bpmn:FlowNode"],properties:[{name:"band",isAttr:!0,type:"Integer"}]},{name:"PoolOrderHint",extends:["bpmn:Participant"],properties:[{name:"poolOrder",isAttr:!0,type:"Integer"}]}]},ku="bwl.undoEpisode",sd=new WeakSet;function S0(e){sd.has(e)||(e.register(ku,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),sd.add(e))}function cd(e,t){S0(e);const n={run:t};if(e.execute(ku,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const ud=["participant.add","participant.update","node.add","node.update","sequenceFlow.add","sequenceFlow.update","messageFlow.add","messageFlow.update","dataStore.add","dataStore.update","dataAssociation.add","association.add","annotation.add","annotation.update","group.add","group.update","element.remove"],R0={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},C0={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},P0={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},A0={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다.",properties:{id:{type:"string"},type:{type:"string",enum:[...Ri]},name:{type:"string"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},T0={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},M0={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},k0={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"}},required:["id","source","target"],additionalProperties:!1},O0={type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},D0={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},L0={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},I0={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},B0={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},N0={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...Mu]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function an(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const $0={"participant.add":an("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":an("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":an("node.add",{description:'플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 갈래 1, 2…) — 위/아래가 아니라 "주 흐름에서 몇 번째 갈래"다. 행 배치(어느 갈래가 위/아래인지)는 호스트가 정한다(대칭·메시지 방향). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.',properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["node"]}),"node.update":an("node.update",{description:"노드 이름/레인/타입/밴드 갱신. lane = 레인 재배정(이동), type = 태스크·이벤트 타입 전환, band = 행 재지정. 🔴 **기존 문서에서 band 는 「몇 번째 갈래」가 아니라 그 컨테이너의 행 번호**다(describe 의 hints.bands 가 보여 주는 값) — 신규 배치의 band 가 대칭으로 펴지는 것과 다르다. 간선이 도형을 가로지르거나 반대 방향으로 겹칠 때 그 노드를 다른 행으로 옮기는 채널이다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lane:{type:"string"},type:{type:"string",enum:[...Ri]},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["id"]}),"sequenceFlow.add":an("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":an("sequenceFlow.update",{description:"시퀀스 플로우 이름/조건/끝점 갱신. condition: null = 조건 제거. source/target = 끝점 재배선 — 중간 삽입은 기존 플로우를 지우지 말고 이것으로 한쪽 끝을 옮긴 뒤 새 플로우를 추가한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},condition:{description:"생략 = 보존, null = 제거.",anyOf:[{$ref:"#/$defs/irFlowCondition"},{type:"null"}]},source:{description:"새 출발 노드 id(생략 = 보존). 같은 배치에서 추가한 노드도 지목할 수 있다.",type:"string"},target:{description:"새 도착 노드 id(생략 = 보존). 같은 배치에서 추가한 노드도 지목할 수 있다.",type:"string"}},required:["id"]}),"messageFlow.add":an("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":an("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataStore.add":an("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":an("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataAssociation.add":an("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":an("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":an("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":an("annotation.update",{description:"주석 본문/방위 힌트 갱신. placement: null = 힌트 제거(휴리스틱 복귀). 주석 삭제는 element.remove.",properties:{id:{type:"string"},text:{type:"string"},placement:{description:"생략 = 보존, null = 힌트 제거.",anyOf:[{$ref:"#/$defs/bwlPlacement"},{type:"null"}]}},required:["id"]}),"group.add":an("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":an("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"element.remove":an("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},ld={anyOf:ud.map(e=>$0[e])},F0={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:C0,irParticipant:P0,irNode:A0,irFlowCondition:T0,irSequenceFlow:M0,irMessageFlow:k0,irDataStore:O0,irDataAssociation:D0,irTextAnnotation:L0,irAssociation:I0,irGroup:B0,bwlPlacement:N0,nullableString:R0,symbolicOp:ld}};function Ou(e){return Array.prototype.concat.apply([],e)}const Wo=Object.prototype.toString,j0=Object.prototype.hasOwnProperty;function Rr(e){return e===void 0}function jt(e){return e!==void 0}function Zr(e){return e==null}function ke(e){return Wo.call(e)==="[object Array]"}function Ut(e){return Wo.call(e)==="[object Object]"}function Ie(e){return Wo.call(e)==="[object Number]"}function qt(e){const t=Wo.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function En(e){return Wo.call(e)==="[object String]"}function H0(e){if(!ke(e))throw new Error("must supply array")}function Sn(e,t){return!Zr(e)&&j0.call(e,t)}function lt(e,t){const n=ns(t);let i;return I(e,function(r,o){if(n(r,o))return i=r,!1}),i}function pd(e,t){const n=ns(t);let i=ke(e)?-1:void 0;return I(e,function(r,o){if(n(r,o))return i=o,!1}),i}function Ue(e,t){const n=ns(t);let i=[];return I(e,function(r,o){n(r,o)&&i.push(r)}),i}function I(e,t){let n,i;if(Rr(e))return;const r=ke(e)?U0:W0;for(let o in e)if(Sn(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function z0(e,t){if(Rr(e))return[];H0(e);const n=ns(t);return e.filter(function(i,r){return!n(i,r)})}function Rn(e,t,n){return I(e,function(i,r){n=t(n,i,r)}),n}function Cr(e,t){return!!Rn(e,function(n,i,r){return n&&t(i,r)},!0)}function Wi(e,t){return!!lt(e,t)}function sn(e,t){let n=[];return I(e,function(i,r){n.push(t(i,r))}),n}function ts(e){return e&&Object.keys(e)||[]}function G0(e){return ts(e).length}function Qr(e){return sn(e,t=>t)}function Jr(e,t,n={}){return t=Du(t),I(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function fd(e,...t){e=Du(e);let n={};return I(t,r=>Jr(r,e,n)),sn(n,function(r,o){return r[0]})}const V0=fd;function ci(e,t){t=Du(t);let n=[];return I(e,function(i,r){let o=t(i,r),a={d:o,v:i};for(var s=0;s<n.length;s++){let{d:c}=n[s];if(o<c){n.splice(s,0,a);return}}n.push(a)}),sn(n,i=>i.v)}function eo(e){return function(t){return Cr(e,function(n,i){return t[i]===n})}}function Du(e){return qt(e)?e:t=>t[e]}function ns(e){return qt(e)?e:t=>t===e}function W0(e){return e}function U0(e){return Number(e)}function Lu(e,t){let n,i,r,o;function a(f){let p=Date.now(),d=f?0:o+t-p;if(d>0)return s(d);e.apply(r,i),c()}function s(f){n=setTimeout(a,f)}function c(){n&&clearTimeout(n),n=o=i=r=void 0}function u(){n&&a(!0),c()}function l(...f){o=Date.now(),i=f,r=this,n||s(t)}return l.flush=u,l.cancel=c,l}function bn(e,t){return e.bind(t)}function z(e,...t){return Object.assign(e,...t)}function q0(e,t,n){let i=e;return I(t,function(r,o){if(typeof r!="number"&&typeof r!="string")throw new Error("illegal key type: "+typeof r+". Key should be of type number or string.");if(r==="constructor")throw new Error("illegal key: constructor");if(r==="__proto__")throw new Error("illegal key: __proto__");let a=t[o+1],s=i[r];jt(a)&&Zr(s)&&(s=i[r]=isNaN(+a)?{}:[]),Rr(a)?Rr(n)?delete i[r]:i[r]=n:i=s}),e}function ni(e,t){let n={},i=Object(e);return I(t,function(r){r in i&&(n[r]=e[r])}),n}function ui(e,t){let n={},i=Object(e);return I(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function Iu(){}Iu.prototype.get=function(e){return this.$model.properties.get(this,e)},Iu.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function dd(e,t){this.model=e,this.properties=t}dd.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Iu.prototype);I(e.properties,function(a){!a.isMany&&a.default!==void 0&&(i[a.name]=a.default)}),n.defineModel(i,t),n.defineDescriptor(i,e);var r=e.ns.name;function o(a){n.define(this,"$type",{value:r,enumerable:!0}),n.define(this,"$attrs",{value:{}}),n.define(this,"$parent",{writable:!0}),I(a,bn(function(s,c){this.set(c,s)},this))}return o.prototype=i,o.hasType=i.$instanceOf=this.model.hasType,n.defineModel(o,t),n.defineDescriptor(o,e),o};var Y0=z(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),hd=z(Object.create(null),{String:function(e){return e},Boolean:function(e){return e==="true"},Integer:function(e){return parseInt(e,10)},Real:function(e){return parseFloat(e)}});function Bu(e,t){var n=hd[e];return n?n(t):t}function Nu(e){return!!Y0[e]}function md(e){return!!hd[e]}function cn(e,t){var n=e.split(/:/),i,r;if(n.length===1)i=e,r=t;else if(n.length===2)i=n[1],r=n[0];else throw new Error("expected <prefix:localName> or <localName>, got "+e);return e=(r?r+":":"")+i,{name:e,prefix:r,localName:i}}function In(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}In.prototype.build=function(){return ni(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},In.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)},In.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},In.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=cn(r[0],i),a=cn(r[1],o.prefix).name,s=this.propertiesByName[a];if(s)this.replaceProperty(s,e,n);else throw new Error("refined property <"+a+"> not found");delete e.redefines},In.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},In.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},In.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},In.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},In.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},In.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")},In.prototype.hasProperty=function(e){return this.propertiesByName[e]},In.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(I(e.properties,bn(function(o){o=z({},o,{name:o.ns.localName,inherited:t}),Object.defineProperty(o,"definedBy",{value:e});var a=o.replaces,s=o.redefines;a||s?this.redefineProperty(o,a||s,a):(o.isBody&&this.setBodyProperty(o),o.isId&&this.setIdProperty(o),this.addProperty(o))},this)),i.push(e),n[r]=e)};function Ui(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,I(e,bn(this.registerPackage,this))}Ui.prototype.getPackage=function(e){return this.packageMap[e]},Ui.prototype.getPackages=function(){return this.packages},Ui.prototype.registerPackage=function(e){e=z({},e);var t=this.packageMap;gd(t,e,"prefix"),gd(t,e,"uri"),I(e.types,bn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Ui.prototype.registerType=function(e,t){e=z({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:z({},e.meta||{})});var n=cn(e.name,t.prefix),i=n.name,r=Object.create(null);I(e.properties,bn(function(o){var a=cn(o.name,n.prefix),s=a.name;Nu(o.type)||(o.type=cn(o.type,a.prefix).name),z(o,{ns:a,name:s}),r[s]=o},this)),z(e,{ns:n,name:i,propertiesByName:r}),I(e.extends,bn(function(o){var a=cn(o,n.prefix),s=this.typeMap[a.name];s.traits=s.traits||[],s.traits.push(i)},this)),this.definePackage(e,t),this.typeMap[i]=e},Ui.prototype.mapTypes=function(e,t,n){var i=Nu(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,u){var l=cn(c,Nu(c)?"":e.prefix);r.mapTypes(l,t,u)}function a(c){return o(c,!0)}function s(c){return o(c,!1)}if(!i)throw new Error("unknown type <"+e.name+">");I(i.superClass,n?a:s),t(i,!n),I(i.traits,a)},Ui.prototype.getEffectiveDescriptor=function(e){var t=cn(e),n=new In(t);this.mapTypes(t,function(r,o){n.addTrait(r,o)});var i=n.build();return this.definePackage(i,i.allTypes[i.allTypes.length-1].$pkg),i},Ui.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function gd(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function Pr(e){this.model=e}Pr.prototype.set=function(e,t,n){if(!En(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;K0(n)?i?delete e[r]:delete e.$attrs[$u(t)]:i?r in e?e[r]=n:yd(e,i,n):e.$attrs[$u(t)]=n},Pr.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[$u(t)];var i=n.name;return!e[i]&&n.isMany&&yd(e,n,[]),e[i]},Pr.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=z({},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 K0(e){return typeof e>"u"}function yd(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function $u(e){return e.replace(/^:/,"")}function zn(e,t={}){this.properties=new Pr(this),this.factory=new dd(this,this.properties),this.registry=new Ui(e,this.properties),this.typeCache=Object.create(null),this.config=t}zn.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},zn.prototype.getType=function(e){var t=this.typeCache,n=En(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},zn.prototype.createAny=function(e,t,n){var i=cn(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){q0(this,[a],s)}},o={name:e,isGeneric:!0,ns:{prefix:i.prefix,localName:i.localName,uri:t}};return this.properties.defineDescriptor(r,o),this.properties.defineModel(r,this),this.properties.define(r,"get",{enumerable:!1,writable:!0}),this.properties.define(r,"set",{enumerable:!1,writable:!0}),this.properties.define(r,"$parent",{enumerable:!1,writable:!0}),this.properties.define(r,"$instanceOf",{enumerable:!1,writable:!0}),I(n,function(a,s){Ut(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},zn.prototype.getPackage=function(e){return this.registry.getPackage(e)},zn.prototype.getPackages=function(){return this.registry.getPackages()},zn.prototype.getElementDescriptor=function(e){return e.$descriptor},zn.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},zn.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},zn.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var vd=String.fromCharCode,X0=Object.prototype.hasOwnProperty,Z0=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,Uo={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(Uo).forEach(function(e){Uo[e.toUpperCase()]=Uo[e]});function Q0(e,t,n,i){return i?X0.call(Uo,i)?Uo[i]:"&"+i+";":vd(t||parseInt(n,16))}function Ar(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(Z0,Q0):e}var bd="non-whitespace outside of root node";function qi(e){return new Error(e)}function J0(e){return"missing namespace for prefix <"+e+">"}function is(e){return{get:e,enumerable:!0}}function ew(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var _d=Symbol("nameCache");function Fu(e){return e+"$uri"}function tw(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[Fu(i)]=n;return t}function rs(){return{line:0,column:0}}function nw(e){throw e}function xd(e){if(!this)return new xd(e);var t=e&&e.proxy,n,i,r,o,a=nw,s,c,u,l,f=rs,p=!1,d=!1,g="",h=!1,m=!1,_=null,y=!1,x,S,P,C;function D(O){O instanceof Error||(O=qi(O)),_=O,a(O,f)}function T(O){s&&(O instanceof Error||(O=qi(O)),s(O,f))}this.on=function(O,j){if(typeof j!="function")throw qi("required args <name, cb>");switch(O){case"openTag":i=j;break;case"text":n=j;break;case"closeTag":r=j;break;case"error":a=j;break;case"warn":s=j;break;case"cdata":o=j;break;case"attention":l=j;break;case"question":u=j;break;case"comment":c=j;break;default:throw qi("unsupported event: "+O)}return this},this.ns=function(O){if(typeof O>"u"&&(O={}),typeof O!="object")throw qi("required args <nsMap={}>");var j=Object.create(null),se;for(se in O)j[se]=O[se];return m=!0,C=j,this};function $(){x=m?[]:null,S=m?tw(C):null,P=[],f=rs,y=!1,_=null,d=!1,g=""}this.parse=function(O){if(typeof O!="string")throw qi("required args <xml=string>");if(p)throw qi("parse during stream; call end() first");return $(),k(O),f=rs,y=!1,_},this.write=function(O){if(typeof O!="string")throw qi("required args <xml=string>");return p||($(),p=!0),_||(g=k(g+O,!0)||""),this},this.end=function(){return p||$(),p=!1,_||k(g),g="",f=rs,y=!1,_},this.stop=function(){y=!0};function k(O,j=!1){var se=null,we=null,Ke,Y=0,ue=!1,_e=!1,le=0,xe=0,ce,U,q,K,Ge,Xt,M,E,b,F="",W=0,X;function be(it,Tt){var Qt=it.indexOf(":");if(Qt===-1)return it;var yn=S[it.substring(0,Qt)];return yn?Tt===yn?it.substr(Qt+1):yn+it.substr(Qt):(T(J0(it.substring(0,Qt))),null)}function Be(){if(X!==null)return X;var it,Tt,Qt=m&&S.xmlns,yn=m&&h?[]:null,ut=W,Nt=F,$t=Nt.length,zo,Jt,vn,wn,Ft,Sr={},Za=new Set,Hn,Je,rt;e:for(;ut<$t;ut++)if(Hn=!1,Je=Nt.charCodeAt(ut),!(Je===32||Je<14&&Je>8)){for((Je<65||Je>122||Je>90&&Je<97)&&Je!==95&&Je!==58&&(T("illegal first char attribute name"),Hn=!0),rt=ut+1;rt<$t;rt++)if(Je=Nt.charCodeAt(rt),!(Je>96&&Je<123||Je>64&&Je<91||Je>47&&Je<59||Je===46||Je===45||Je===95)){if(Je===32||Je<14&&Je>8){T("missing attribute value"),ut=rt;continue e}if(Je===61)break;T("illegal attribute name char"),Hn=!0}if(Ft=Nt.substring(ut,rt),Ft==="xmlns:xmlns"&&(T("illegal declaration of xmlns"),Hn=!0),Je=Nt.charCodeAt(rt+1),Je===34)rt=Nt.indexOf('"',ut=rt+2),rt===-1&&(rt=Nt.indexOf("'",ut),rt!==-1&&(T("attribute value quote missmatch"),Hn=!0));else if(Je===39)rt=Nt.indexOf("'",ut=rt+2),rt===-1&&(rt=Nt.indexOf('"',ut),rt!==-1&&(T("attribute value quote missmatch"),Hn=!0));else for(T("missing attribute value quotes"),Hn=!0,rt=rt+1;rt<$t&&(Je=Nt.charCodeAt(rt+1),!(Je===32||Je<14&&Je>8));rt++);for(rt===-1&&(T("missing closing quotes"),rt=$t,Hn=!0),Hn||(vn=Nt.substring(ut,rt)),ut=rt;rt+1<$t&&(Je=Nt.charCodeAt(rt+1),!(Je===32||Je<14&&Je>8));rt++)ut===rt&&(T("illegal character after attribute end"),Hn=!0);if(ut=rt+1,Hn)continue e;if(Za.has(Ft)){T("attribute <"+Ft+"> already defined");continue}if(Za.add(Ft),!m){Sr[Ft]=vn;continue}if(h){if(Jt=Ft==="xmlns"?"xmlns":Ft.charCodeAt(0)===120&&Ft.substr(0,6)==="xmlns:"?Ft.substr(6):null,Jt!==null){if(it=Ar(vn),Tt=Fu(Jt),wn=C[it],!wn){if(Jt==="xmlns"||Tt in S&&S[Tt]!==it)do wn="ns"+Y++;while(typeof S[wn]<"u");else wn=Jt;C[it]=wn}S[Jt]!==wn&&(zo||(S=ew(S),zo=!0),S[Jt]=wn,Jt==="xmlns"&&(S[Fu(wn)]=it,Qt=wn),S[Tt]=it),Sr[Ft]=vn;continue}yn.push(Ft,vn);continue}Ft=be(Ft,Qt),Ft!==null&&(Sr[Ft]=vn)}if(h)for(ut=0,$t=yn.length;ut<$t;ut++)Ft=be(yn[ut++],Qt),vn=yn[ut],Ft!==null&&(Sr[Ft]=vn);return X=Sr}function et(){for(var it=/(\r\n|\r|\n)/g,Tt=0,Qt=0,yn=0,ut=xe,Nt,$t;le>=yn&&(Nt=it.exec(O),!(!Nt||(ut=Nt[0].length+Nt.index,ut>le)));)Tt+=1,yn=ut;return le==-1?(Qt=ut,$t=O.substring(xe)):xe===0?$t=O.substring(xe,le):(Qt=le-yn,$t=xe==-1?O.substring(le):O.substring(le,xe+1)),{data:$t,line:Tt,column:Qt}}for(f=et,t&&(b=Object.create({},{name:is(function(){return M}),originalName:is(function(){return E}),attrs:is(Be),ns:is(function(){return S})}));xe!==-1;){if(O.charCodeAt(xe)===60?le=xe:le=O.indexOf("<",xe),le===-1){if(j)return O.substring(xe);if(P.length)return D("unexpected end of file");if(!d)return D("missing start tag");xe<O.length&&O.substring(xe).trim()&&T(bd);return}if(d||(d=!0),xe!==le){if(P.length){if(n&&(n(O.substring(xe,le),Ar,f),y))return}else if(O.substring(xe,le).trim()&&(T(bd),y))return}if(K=O.charCodeAt(le+1),K===33){if(q=O.charCodeAt(le+2),q===91&&O.substr(le+3,6)==="CDATA["){if(xe=O.indexOf("]]>",le),xe===-1)return j?O.substring(le):D("unclosed cdata");if(o&&(o(O.substring(le+9,xe),f),y))return;xe+=3;continue}if(q===45&&O.charCodeAt(le+3)===45){if(xe=O.indexOf("-->",le),xe===-1)return j?O.substring(le):D("unclosed comment");if(c&&(c(O.substring(le+4,xe),Ar,f),y))return;xe+=3;continue}}if(K===63){if(xe=O.indexOf("?>",le),xe===-1)return j?O.substring(le):D("unclosed question");if(u&&(u(O.substring(le,xe+2),f),y))return;xe+=2;continue}for(ce=le+1;;ce++){if(Ge=O.charCodeAt(ce),isNaN(Ge))return j?O.substring(le):(xe=-1,D("unclosed tag"));if(Ge===34)q=O.indexOf('"',ce+1),ce=q!==-1?q:ce;else if(Ge===39)q=O.indexOf("'",ce+1),ce=q!==-1?q:ce;else if(Ge===62){xe=ce;break}}if(K===33){if(l&&(l(O.substring(le,xe+1),Ar,f),y))return;xe+=1;continue}if(X={},K===47){if(ue=!1,_e=!0,!P.length)return D("missing open tag");if(ce=M=P.pop(),q=le+2+ce.length,O.substring(le+2,q)!==ce)return D("closing tag mismatch");for(;q<xe;q++)if(K=O.charCodeAt(q),!(K===32||K>8&&K<14))return D("close tag")}else{if(O.charCodeAt(xe-1)===47?(ce=M=O.substring(le+1,xe-1),ue=!0,_e=!0):(ce=M=O.substring(le+1,xe),ue=!0,_e=!1),!(K>96&&K<123||K>64&&K<91||K===95||K===58))return D("illegal first char nodeName");for(q=1,U=ce.length;q<U;q++)if(K=ce.charCodeAt(q),!(K>96&&K<123||K>64&&K<91||K>47&&K<59||K===45||K===95||K==46)){if(K===32||K<14&&K>8){M=ce.substring(0,q),X=null;break}return D("invalid nodeName")}_e||P.push(M)}if(m){Ke=S,ue&&(_e||x.push(Ke),X===null&&(h=ce.indexOf("xmlns",q)!==-1)&&(W=q,F=ce,Be(),h=!1)),E=M,we!==S&&(se=S[_d],se===void 0&&(se=S[_d]=Object.create(null)),we=S);var vt=se[M];if(vt!==void 0)M=vt;else{if(K=M.indexOf(":"),K!==-1){if(Xt=S[M.substring(0,K)],!Xt)return D("missing namespace on <"+E+">");M=M.substr(K+1)}else Xt=S.xmlns;Xt&&(M=Xt+":"+M),se[E]=M}}if(ue&&(W=q,F=ce,i&&(t?i(b,Ar,_e,f):i(M,Be,Ar,_e,f),y)))return;if(_e){if(r&&(r(t?b:M,Ar,ue,f),y))return;m&&(ue?S=Ke:S=x.pop())}xe+=1}}}function wd(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var ju={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},Ed="property";function Sd(e){return e.xml&&e.xml.serialize}function iw(e){const t=Sd(e);return t!==Ed&&(t||null)}function rw(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Rd(e,t){return wd(t)?e.prefix+":"+rw(e.localName):e.name}function ow(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 aw(e,t,n){const i=cn(e,t.xmlns),r=`${t[i.prefix]||i.prefix}:${i.localName}`,o=cn(r);var a=n.getPackage(o.prefix);return ow(o,a)}function Yi(e){return new Error(e)}function Ci(e){return e.$descriptor}function sw(e){z(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw Yi("expected element");var n=this.elementsById,i=Ci(t),r=i.idProperty,o;if(r&&(o=t.get(r.name),o)){if(!/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i.test(o))throw new Error("illegal ID <"+o+">");if(n[o])throw Yi("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function qo(){}qo.prototype.handleEnd=function(){},qo.prototype.handleText=function(){},qo.prototype.handleNode=function(){};function Hu(){}Hu.prototype=Object.create(qo.prototype),Hu.prototype.handleNode=function(){return this};function to(){}to.prototype=Object.create(qo.prototype),to.prototype.handleText=function(e){this.body=(this.body||"")+e};function Yo(e,t){this.property=e,this.context=t}Yo.prototype=Object.create(to.prototype),Yo.prototype.handleNode=function(e){if(this.element)throw Yi("expected no sub nodes");return this.element=this.createReference(e),this},Yo.prototype.handleEnd=function(){this.element.id=this.body},Yo.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function zu(e,t){this.element=t,this.propertyDesc=e}zu.prototype=Object.create(to.prototype),zu.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Bu(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function os(){}os.prototype=Object.create(to.prototype),os.prototype.handleNode=function(e){var t=this,n=this.element;return n?t=this.handleChild(e):(n=this.element=this.createElement(e),this.context.addElement(n)),t};function fn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}fn.prototype=Object.create(os.prototype),fn.prototype.addReference=function(e){this.context.addReference(e)},fn.prototype.handleText=function(e){var t=this.element,n=Ci(t),i=n.bodyProperty;if(!i)throw Yi("unexpected body text <"+e+">");to.prototype.handleText.call(this,e)},fn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Ci(t),i=n.bodyProperty;i&&e!==void 0&&(e=Bu(i.type,e),t.set(i.name,e))},fn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=Ci(n),r=this.context,o=new n({}),a=this.model,s;return I(t,function(c,u){var l=i.propertiesByName[u],f;l&&l.isReference?l.isMany?(f=c.split(" "),I(f,function(p){r.addReference({element:o,property:l.ns.name,id:p})})):r.addReference({element:o,property:l.ns.name,id:c}):(l?c=Bu(l.type,c):u==="xmlns"?u=":"+u:(s=cn(u,i.ns.prefix),a.getPackage(s.prefix)&&r.addWarning({message:"unknown attribute <"+u+">",element:o,property:u,value:c})),o.set(u,c))}),o},fn.prototype.getPropertyForNode=function(e){var t=e.name,n=cn(t),i=this.type,r=this.model,o=Ci(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const u=iw(s);if(u){const l=e.attributes[u];if(l){const f=aw(l,e.ns,r),p=r.getType(f);return z({},s,{effectiveType:Ci(p).name})}}return s}var c=r.getPackage(n.prefix);if(c){const u=Rd(n,c),l=r.getType(u);if(s=lt(o.properties,function(f){return!f.isVirtual&&!f.isReference&&!f.isAttribute&&l.hasType(f.type)}),s)return z({},s,{effectiveType:Ci(l).name})}else if(s=lt(o.properties,function(u){return!u.isReference&&!u.isAttribute&&u.type==="Element"}),s)return s;throw Yi("unrecognized element <"+n.name+">")},fn.prototype.toString=function(){return"ElementDescriptor["+Ci(this.type).name+"]"},fn.prototype.valueHandler=function(e,t){return new zu(e,t)},fn.prototype.referenceHandler=function(e){return new Yo(e,this.context)},fn.prototype.handler=function(e){return e==="Element"?new no(this.model,e,this.context):new fn(this.model,e,this.context)},fn.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,md(n))return this.valueHandler(t,i);t.isReference?r=this.referenceHandler(t).handleNode(e):r=this.handler(n).handleNode(e);var o=r.element;return o!==void 0&&(t.isMany?i.get(t.name).push(o):i.set(t.name,o),t.isReference?(z(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function Gu(e,t,n){fn.call(this,e,t,n)}Gu.prototype=Object.create(fn.prototype),Gu.prototype.createElement=function(e){var t=e.name,n=cn(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&Rd(n,o)||t;if(!r.hasType(a))throw Yi("unexpected element <"+e.originalName+">");return fn.prototype.createElement.call(this,e)};function no(e,t,n){this.model=e,this.context=n}no.prototype=Object.create(os.prototype),no.prototype.createElement=function(e){var t=e.name,n=cn(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},no.prototype.handleChild=function(e){var t=new no(this.model,"Element",this.context).handleNode(e),n=this.element,i=t.element,r;return i!==void 0&&(r=n.$children=n.$children||[],r.push(i),i.$parent=n),t},no.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function Vu(e){e instanceof zn&&(e={model:e}),z(this,{lax:!1},e)}Vu.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof fn?(i=t,t={}):typeof t=="string"?(i=this.handler(t),t={}):typeof i=="string"&&(i=this.handler(i));var r=this.model,o=this.lax,a=new sw(z({},t,{rootHandler:i})),s=new xd({proxy:!0}),c=cw();i.context=a,c.push(i);function u(P,C,D){var T=C(),$=T.line,k=T.column,O=T.data;O.charAt(0)==="<"&&O.indexOf(" ")!==-1&&(O=O.slice(0,O.indexOf(" "))+">");var j="unparsable content "+(O?O+" ":"")+`detected
|
|
2
|
+
line: `+$+`
|
|
3
3
|
column: `+k+`
|
|
4
|
-
nested error: `+P.message;if(D)return a.addWarning({message:
|
|
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 bw(e){e=H({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new yw,o=new vw(r,e.format);e.preamble&&o.append(iw);var a=new gt,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(_w(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function _w(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in ju)n[i]=ju[i];for(const i in t){const r=t[i];n[r]=i}for(const i of e.getPackages())n[i.prefix]=i.uri;return n}function ss(e,t){$n.call(this,e,t)}ss.prototype=Object.create($n.prototype),ss.prototype.fromXML=function(e,t,n){wn(t)||(n=t,t="bpmn:Definitions");var i=new Gu(H({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},ss.prototype.toXML=function(e,t){var n=new bw(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var xw="BPMN20",ww="http://www.omg.org/spec/BPMN/20100524/MODEL",Ew="bpmn",Sw=[],Rw=[{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"}]}],Cw=[{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"}]}],Pw={tagAlias:"lowerCase",typePrefix:"t"},Aw={name:xw,uri:ww,prefix:Ew,associations:Sw,types:Rw,enumerations:Cw,xml:Pw},Tw="BPMNDI",Mw="http://www.omg.org/spec/BPMN/20100524/DI",kw="bpmndi",Ow=[{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"]}],Dw=[{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"}]}],Lw=[],Iw={name:Tw,uri:Mw,prefix:kw,types:Ow,enumerations:Dw,associations:Lw},Nw="DC",Bw="http://www.omg.org/spec/DD/20100524/DC",$w="dc",jw=[{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}]}],Fw=[],Hw={name:Nw,uri:Bw,prefix:$w,types:jw,associations:Fw},zw="DI",Gw="http://www.omg.org/spec/DD/20100524/DI",Vw="di",Ww=[{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"}]}],Uw=[],qw={tagAlias:"lowerCase"},Yw={name:zw,uri:Gw,prefix:Vw,types:Ww,associations:Uw,xml:qw},Kw="bpmn.io colors for BPMN",Xw="http://bpmn.io/schema/bpmn/biocolor/1.0",Zw="bioc",Qw=[{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"}]}],Jw=[],eE=[],tE={name:Kw,uri:Xw,prefix:Zw,types:Qw,enumerations:Jw,associations:eE},nE="BPMN in Color",iE="http://www.omg.org/spec/BPMN/non-normative/color/1.0",rE="color",oE=[{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"}]}],aE=[],sE=[],cE={name:nE,uri:iE,prefix:rE,types:oE,enumerations:aE,associations:sE};const uE={bpmn:Aw,bpmndi:Iw,dc:Hw,di:Yw,bioc:tE,color:cE};function Pd(e,t){const n=H({},uE,e);return new ss(n,t)}const lE={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"}},pE="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",Ad="i18n",cs={[Ad]:lE,[Au]:id};function Td(){return Pd(cs)}const Md=Td();async function Uu(e){const{rootElement:t,warnings:n}=await Md.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function fE(e){const{xml:t}=await Md.toXML(e,{format:!0});return t}function qu(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const ro={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},dE=/[ᄀ-ᇿ -〿-ヿ㐀-鿿가--⦆]/;function hE(e){const t=ro;return dE.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 oo(e,t){let n=0;for(const i of e)n+=t*hE(i);return n}function kd(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&mE(e),gE(e),yE(e),vE(e)}function mE(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:oo(r,o),fontBoundingBoxAscent:o*ro.ascentEm,fontBoundingBoxDescent:o*ro.descentEm,actualBoundingBoxAscent:o*ro.ascentEm,actualBoundingBoxDescent:o*ro.descentEm}}};t.getContext=()=>n}function gE(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,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 vE(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:oo(n,12),height:14}})}const us=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),bE=1,Yu=new Set(["bpmn:TextAnnotation","bpmn:DataStoreReference","bpmn:DataObjectReference","bpmn:DataInput","bpmn:DataOutput"]),_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"edge-overlap-unrelated":return`u|${e.edges[0]}|${e.edges[1]}`;case"label-on-shared-segment":return`l|${e.edge}|${e.other}`;case"annotation-over-label":return`a|${e.annotation}|${e.label}`;case"group-overlap-unintended":return`g|${e.groups[0]}|${e.groups[1]}${e.container?`|⊃${e.container}`:""}`;case"group-overlap-unreadable":return e.reason==="minority"?`gu*|${e.group}|${e.shapes.join(",")}`:e.reason==="throughpass"?`gu>|${e.group}|${e.shapes.join(",")}`:`gu|${e.groups[0]}|${e.groups[1]}|${e.shapes.join(",")}`;case"group-stack-unreadable":return`gs|${e.groups.join("|")}|${e.shapes.join(",")}`;case"group-on-container-boundary":return`gb|${e.group}|${e.container}|${e.side}`;case"group-on-group-boundary":return`gg|${e.groups[0]}|${e.groups[1]}|${e.axis}`;case"group-cuts-shape":return`gc|${e.group}|${e.shape}|${e.side}`;case"pool-name-over-label":return`pn|${e.pool}|${e.label}`}}const Od=20,ls=5,Dd=3,xE=8,Ld=12,wE=Ld*1.2;function Ku(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(o=>oo(o,Ld))),r=n.length*wE;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-r/2,width:i,height:r}}const Id=1;function fn(e){const t=[];for(let n=0;n+1<e.waypoints.length;n++){const i=e.waypoints[n],r=e.waypoints[n+1];Math.abs(i.y-r.y)<.5&&Math.abs(i.x-r.x)>=.5?t.push({axis:"h",at:i.y,lo:Math.min(i.x,r.x),hi:Math.max(i.x,r.x),dir:r.x>i.x?1:-1}):Math.abs(i.x-r.x)<.5&&Math.abs(i.y-r.y)>=.5&&t.push({axis:"v",at:i.x,lo:Math.min(i.y,r.y),hi:Math.max(i.y,r.y),dir:r.y>i.y?1:-1})}return t}function Yo(e,t){let n=null;const i=e.type!==t.type,o=!!(e.source&&e.target&&t.source&&t.target)&&e.source!==t.source&&e.source!==t.target&&e.target!==t.source&&e.target!==t.target;for(const a of fn(e))for(const s of fn(t)){if(a.axis!==s.axis||Math.abs(a.at-s.at)>Id)continue;const c=a.dir!==s.dir?"opposite":i?"mixed":o?"unrelated":null;if(!c)continue;const u=Math.min(a.hi,s.hi)-Math.max(a.lo,s.lo);u>=Od&&(!n||u>n.length)&&(n={axis:a.axis,length:u,kind:c})}return n}function Xu(e){return e.kind==="edge-overlap-opposite"||e.kind==="edge-overlap-mixed"||e.kind==="edge-overlap-unrelated"}function Nd(e,t){const n=Yo(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function EE(e,t){let n=0;for(const i of t)i.id!==e.id&&Nd(e,i)&&n++;return n}function Jn(e,t){let n=0;for(const i of t)i.id!==e.id&&Yo(e,i)&&n++;return n}const Bd=15,$d=20;function SE(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-$d||t.at>n[1]+$d)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 Zu=20;function ps(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>Id)continue;const r=Math.max(e.lo,i.lo),o=Math.min(e.hi,i.hi);o-r<Od||n.push([r-Zu,o+Zu])}return n}function fs(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of fn(e)){const o=SE(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of ps(r,fn(a)))if(Math.min(c,o[1])>Math.max(s,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const RE=1,CE=(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 PE(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,g)=>{if(g===0)return d<=0;const h=d/g;if(g>0){if(h>p)return!1;h>l&&(l=h)}else{if(h<l)return!1;h<p&&(p=h)}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 Qu(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 AE=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,ao=1;function Pi(e,t){const n=e.x+ao,i=e.x+e.width-ao,r=e.y+ao,o=e.y+e.height-ao;return t.axis==="h"?t.at>r&&t.at<o&&t.lo<i&&t.hi>n:t.at>n&&t.at<i&&t.lo<o&&t.hi>r}function Ko(e){return[{axis:"h",at:e.y,lo:e.x,hi:e.x+e.width,dir:1},{axis:"h",at:e.y+e.height,lo:e.x,hi:e.x+e.width,dir:1},{axis:"v",at:e.x,lo:e.y,hi:e.y+e.height,dir:1},{axis:"v",at:e.x+e.width,lo:e.y,hi:e.y+e.height,dir:1}]}function jd(e,t){const n=e.label;if(!n)return null;if(fn(e).some(i=>Pi(n,i)))return e.id;for(const i of[...t.edges].filter(r=>r.id!==e.id).sort((r,o)=>r.id.localeCompare(o.id)))if(fn(i).some(r=>Pi(n,r)))return i.id;for(const i of t.shapes.filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(Ko(i).some(r=>Pi(n,r)))return i.id;return null}function gn(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(PE(e.waypoints[o],e.waypoints[o+1],r,_E)){i.push(r);break}}return i}function TE(e,t,n,i){const r=(u,l,p)=>(l.x-u.x)*(p.y-u.y)-(l.y-u.y)*(p.x-u.x),o=r(n,i,e),a=r(n,i,t),s=r(e,t,n),c=r(e,t,i);return o*a<0&&s*c<0}const Fd=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function ds(e,t){let n=0;for(const i of t){if(i.id===e.id||Fd(e,i))continue;let r=!1;for(let o=0;o+1<e.waypoints.length&&!r;o++)for(let a=0;a+1<i.waypoints.length&&!r;a++)TE(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function ei(e,t){let n=0;for(const i of t)i.id===e.id||Fd(e,i)||ds(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function Hd(e){let t=0;const n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)ds(n[i],[n[r]])>0&&(t+=n[i].type===n[r].type?2:1);return t}function Ju(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(ds(n[i],[n[r]])>0){const o=n[i].id,a=n[r].id;t.push(o<a?[o,a]:[a,o])}return t.sort((i,r)=>`${i[0]}|${i[1]}`.localeCompare(`${r[0]}|${r[1]}`))}function zd(e){const t=Ju(e),n=a=>a==="bpmn:MessageFlow"||a.endsWith("Association")?"dashed":"solid",i=new Map(e.edges.map(a=>[a.id,a]));let r=0,o=0;for(const[a,s]of t){const c=i.get(a),u=i.get(s);if(!c||!u)continue;const l=n(c.type),p=n(u.type);l==="solid"&&p==="solid"?r++:l==="dashed"&&p==="dashed"&&o++}return{pairs:t,solidPairs:r,dashedPairs:o,mixedPairs:t.length-r-o,crossPoolMessages:ME(e)}}function ME(e){const t=e.shapes.filter(r=>r.type==="bpmn:Participant");if(t.length<3)return 0;const n=r=>{const o=e.shapes.find(a=>a.id===r);if(o)return t.find(a=>o.x>=a.x&&o.y>=a.y&&o.x+o.width<=a.x+a.width&&o.y+o.height<=a.y+a.height)};let i=0;for(const r of e.edges){if(r.type!=="bpmn:MessageFlow"||r.endpoints.length<2)continue;const o=n(r.endpoints[0]),a=n(r.endpoints[1]);if(!o||!a||o.id===a.id)continue;const s=Math.min(o.y,a.y),c=Math.max(o.y+o.height,a.y+a.height);t.some(u=>u.id!==o.id&&u.id!==a.id&&u.y>s&&u.y+u.height<c)&&i++}return i}function Gd(e,t,n){const i=new Set(t.flatMap(r=>[...r.members]));return e.shapes.filter(r=>!r.container&&!Yu.has(r.type)&&!i.has(r.id)&&r.x>=n.x&&r.y>=n.y&&r.x+r.width<=n.right&&r.y+r.height<=n.bottom).map(r=>r.id).sort()}function Vd(e){var n;const t=(n=ht(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const r=ht(i);if((r==null?void 0:r.$type)!=="bwl:Members"||typeof r.refs!="string")continue;const o=r.refs.split(/\s+/).filter(Boolean);return o.length?o:void 0}}const Wd=e=>e?{members:e}:{},ti=e=>e.shapes.filter(t=>!t.container);function kE(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 Ud(e,t){const n=e.label;if(!n)return null;for(const i of[...t.edges].sort((r,o)=>r.id.localeCompare(o.id)))if(fn(i).some(r=>Pi(n,r)))return i.id;for(const i of[...t.shapes].filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(Ko(i).some(r=>Pi(n,r)))return i.id;return null}function so(e){const t=[];for(const n of e.shapes)n.label&&t.push({owner:n.id,rect:n.label});for(const n of e.edges)n.label&&t.push({owner:n.id,rect:n.label});return t}function li(e){const t=[],n=e.shapes.filter(h=>!h.container);for(const h of e.edges)for(const m of gn(h,n))t.push({kind:"edge-crosses-shape",edge:h.id,shape:m.id});const i=n.filter(h=>!h.attached);for(let h=0;h<i.length;h++)for(let m=h+1;m<i.length;m++){const w=i[h],y=i[m];if(!Qu(w,y,bE))continue;const _=w.id<y.id?[w.id,y.id]:[y.id,w.id];t.push({kind:"shape-overlap",shapes:_,identical:AE(w,y)})}const r=e.shapes.filter(h=>h.type==="bpmn:Group"&&Array.isArray(h.members)&&h.members.length>0);for(let h=0;h<r.length;h++)for(let m=h+1;m<r.length;m++){const w=r[h],y=r[m],_=Math.min(w.x+w.width,y.x+y.width)-Math.max(w.x,y.x),S=Math.min(w.y+w.height,y.y+y.height)-Math.max(w.y,y.y);if(_<=ls||S<=ls)continue;const P=w.id<y.id?[w.id,y.id]:[y.id,w.id],C=new Set(y.members);if(w.members.some(T=>C.has(T))){const T=Gd(e,r,{x:Math.max(w.x,y.x),y:Math.max(w.y,y.y),right:Math.min(w.x+w.width,y.x+y.width),bottom:Math.min(w.y+w.height,y.y+y.height)});T.length&&t.push({kind:"group-overlap-unreadable",reason:"orphan",groups:P,shapes:T});continue}const D=w.x<=y.x&&w.y<=y.y&&w.x+w.width>=y.x+y.width&&w.y+w.height>=y.y+y.height?w.id:y.x<=w.x&&y.y<=w.y&&y.x+y.width>=w.x+w.width&&y.y+y.height>=w.y+w.height?y.id:void 0;t.push({kind:"group-overlap-unintended",groups:P,...D?{container:D}:{}})}const o=new Set(r.flatMap(h=>[...h.members])),a=h=>e.shapes.filter(m=>!m.container&&!Yu.has(m.type)&&m.x>=h.x&&m.y>=h.y&&m.x+m.width<=h.x+h.width&&m.y+m.height<=h.y+h.height);for(const h of r){const m=a(h);if(!m.length)continue;const w=new Set(h.members),y=m.filter(_=>!w.has(_.id));y.some(_=>o.has(_.id))&&(y.length*2<m.length||t.push({kind:"group-overlap-unreadable",reason:"minority",group:h.id,shapes:y.map(_=>_.id).sort()}))}for(const h of r){const m=new Set(a(h).map(C=>C.id)),w=new Set(h.members),y=new Set([...m].filter(C=>!w.has(C)&&o.has(C)));if(!y.size)continue;let _=!1,S=!1,P=!1;for(const C of e.edges){if(C.type!=="bpmn:SequenceFlow"||!C.source||!C.target)continue;const D=y.has(C.source),T=y.has(C.target);!D&&T&&!m.has(C.source)?_=!0:D&&!T&&!m.has(C.target)?S=!0:D&&T&&(P=!0)}_&&S&&P&&t.push({kind:"group-overlap-unreadable",reason:"throughpass",group:h.id,shapes:[...y].sort()})}const s=e.shapes.filter(h=>h.type==="bpmn:Group");for(let h=0;h<s.length;h++)for(let m=h+1;m<s.length;m++)for(let w=m+1;w<s.length;w++){const y=[s[h],s[m],s[w]],_={x:Math.max(...y.map(C=>C.x)),y:Math.max(...y.map(C=>C.y)),right:Math.min(...y.map(C=>C.x+C.width)),bottom:Math.min(...y.map(C=>C.y+C.height))};if(_.right-_.x<=ls||_.bottom-_.y<=ls)continue;const S=Gd(e,[],_);if(!S.length)continue;const P=y.map(C=>C.id).sort();t.push({kind:"group-stack-unreadable",groups:P,shapes:S})}for(const h of e.shapes.filter(m=>m.type==="bpmn:Group"))for(const m of e.shapes){if(m.container||m.attached||Yu.has(m.type)||m.width<=0||m.height<=0)continue;const w=[["top",h.y,"h",h.x,h.x+h.width],["bottom",h.y+h.height,"h",h.x,h.x+h.width],["left",h.x,"v",h.y,h.y+h.height],["right",h.x+h.width,"v",h.y,h.y+h.height]];for(const[y,_,S,P,C]of w){const D=S==="h"?m.x:m.y,T=S==="h"?m.x+m.width:m.y+m.height;if(!(D<C&&P<T))continue;const N=S==="h"?m.y:m.x,k=S==="h"?m.y+m.height:m.x+m.width;if(!(N<_&&_<k))continue;const O=Math.min(_-N,k-_);O<xE||t.push({kind:"group-cuts-shape",group:h.id,shape:m.id,side:y,depth:O})}}const c=e.shapes.filter(h=>h.container&&h.type!=="bpmn:Group"&&h.type!=="bpmn:Lane");for(const h of e.shapes.filter(m=>m.type==="bpmn:Group"))for(const m of c){const w=h.x<m.x+m.width&&m.x<h.x+h.width,y=h.y<m.y+m.height&&m.y<h.y+h.height,_=[["top",h.y,m.y,w],["bottom",h.y+h.height,m.y+m.height,w],["left",h.x,m.x,y],["right",h.x+h.width,m.x+m.width,y]];for(const[S,P,C,D]of _)D&&Math.abs(P-C)<=Dd&&t.push({kind:"group-on-container-boundary",group:h.id,container:m.id,side:S})}const u=e.shapes.filter(h=>h.type==="bpmn:Group");for(let h=0;h<u.length;h++)for(let m=h+1;m<u.length;m++){const w=u[h],y=u[m],_=w.x<y.x+y.width&&y.x<w.x+w.width,S=w.y<y.y+y.height&&y.y<w.y+w.height,P=[["x",w.x+w.width,y.x,S],["x",y.x+y.width,w.x,S],["y",w.y+w.height,y.y,_],["y",y.y+y.height,w.y,_]];for(const[C,D,T,N]of P)if(N&&Math.abs(D-T)<=Dd){t.push({kind:"group-on-group-boundary",groups:w.id<y.id?[w.id,y.id]:[y.id,w.id],axis:C});break}}for(let h=0;h<e.edges.length;h++)for(let m=h+1;m<e.edges.length;m++){const w=e.edges[h],y=e.edges[m],_=Yo(w,y);if(!_)continue;const S=w.id<y.id?[w.id,y.id]:[y.id,w.id];t.push({kind:_.kind==="opposite"?"edge-overlap-opposite":_.kind==="mixed"?"edge-overlap-mixed":"edge-overlap-unrelated",edges:S,axis:_.axis,length:Math.round(_.length)})}for(const h of e.edges){if(!h.label)continue;const m=fs(h,e.edges);m&&t.push({kind:"label-on-shared-segment",edge:h.id,other:m.other,axis:m.axis})}for(const h of e.edges){if(!h.label)continue;const m=jd(h,e);m&&t.push({kind:"label-over-line",edge:h.id,line:m})}const l=new Set(n.map(h=>h.id)),p=e.shapes.filter(h=>h.type==="bpmn:Participant"&&h.label);for(const h of[...n,...p.filter(m=>!l.has(m.id))]){if(!h.label)continue;const m=Ud(h,e);m&&t.push({kind:"label-over-line",edge:h.id,line:m})}const f=new Set(e.shapes.filter(h=>h.type==="bpmn:TextAnnotation").map(h=>h.id));for(const h of p)for(const{owner:m,rect:w}of so(e))m===h.id||f.has(m)||Qu(h.label,w,ao)&&t.push({kind:"pool-name-over-label",pool:h.id,label:m});const d=so(e);for(const h of n)if(h.type==="bpmn:TextAnnotation")for(const{owner:m,rect:w}of d)m!==h.id&&Qu(h,w,ao)&&t.push({kind:"annotation-over-label",annotation:h.id,label:m});const g=new Map(e.shapes.map(h=>[h.id,h]));for(const h of n){const m=h.parent??kE(h,e,g);if(!m)continue;const w=g.get(m);!w||!w.container||CE(w,h,RE)||t.push({kind:"shape-outside-container",shape:h.id,container:w.id})}return t.sort((h,m)=>ui(h).localeCompare(ui(m)))}const ht=e=>typeof e=="object"&&e!==null?e:void 0,St=e=>typeof e=="number"?e:0,Ai=e=>{const t=ht(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function OE(e){const t=ht(e);if(!t)return[];const n=[];for(const i of["sourceRef","targetRef"]){const r=t[i];for(const o of Array.isArray(r)?r:[r]){const a=Ai(o);a&&n.push(a)}}return n}function DE(e){const t=ht(e);if(!t)return{};const n=Array.isArray(t.sourceRef)?void 0:Ai(t.sourceRef),i=Array.isArray(t.targetRef)?void 0:Ai(t.targetRef);return n&&i?{source:n,target:i}:{}}function LE(e,t){const n=ht(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const r=Ai(n);return r?t.get(r):void 0}if(us.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return Ai(n)}function qd(e){var a,s,c,u,l;const t=[],n=[],i=((a=ht(e))==null?void 0:a.diagrams)??[],r=new Map,o=new Set;for(const p of((s=ht(e))==null?void 0:s.rootElements)??[]){const f=ht(p);if((f==null?void 0:f.$type)==="bpmn:Collaboration")for(const d of f.participants??[]){const g=ht(d),h=Ai(g),m=Ai(g==null?void 0:g.processRef);h&&m?r.set(m,h):h&&o.add(h)}}for(const p of i){const f=ht((c=ht(p))==null?void 0:c.plane),d=(f==null?void 0:f.planeElement)??[];for(const g of d){const h=ht(g);if(!h)continue;const m=ht(h.bpmnElement),w=typeof(m==null?void 0:m.id)=="string"?m.id:void 0;if(!w)continue;const y=typeof(m==null?void 0:m.$type)=="string"?m.$type:"",_=ht(h.bounds);if(_){const P=h.isExpanded===!1&&y!=="bpmn:Participant",C=ht((u=ht(h.label))==null?void 0:u.bounds),D={id:w,type:y,x:St(_.x),y:St(_.y),width:St(_.width),height:St(_.height),container:us.has(y)&&!P,attached:(m==null?void 0:m.attachedToRef)!==void 0,...m?{parent:LE(m,r)}:{},...C?{label:{x:St(C.x),y:St(C.y),width:St(C.width),height:St(C.height)}}:{},...y==="bpmn:Group"?Wd(Vd(m)):{}},T=h.isHorizontal!==!1,N=typeof(m==null?void 0:m.name)=="string"?m.name:"";o.has(w)&&T&&N&&(D.label=Ku(D,N)),t.push(D);continue}const S=h.waypoint;if(Array.isArray(S)){const P=ht((l=ht(h.label))==null?void 0:l.bounds);n.push({id:w,type:y,waypoints:S.map(C=>{var D,T;return{x:St((D=ht(C))==null?void 0:D.x),y:St((T=ht(C))==null?void 0:T.y)}}),endpoints:OE(m),...DE(m),...P?{label:{x:St(P.x),y:St(P.y),width:St(P.width),height:St(P.height)}}:{}})}}}return{shapes:t,edges:n}}function Yd(e){return li(qd(e))}async function IE(e){const{definitions:t,warnings:n}=await Uu(e);return{findings:Yd(t),warnings:n}}function mt(e){var i;const t=[],n=[];for(const r of e.getAll()){const o=r;if(o.type==="label"||o.labelTarget)continue;const a=typeof o.type=="string"?o.type:"";if(a==="bpmn:Definitions"||a.startsWith("bpmndi:"))continue;const s=o.waypoints;if(s){const h=ht(o.label),m=Ai(o.source),w=Ai(o.target);n.push({id:o.id,type:a,waypoints:s.map(y=>({x:St(y.x),y:St(y.y)})),endpoints:[m,w].filter(y=>!!y),...m&&w?{source:m,target:w}:{},...h&&typeof h.x=="number"?{label:{x:h.x,y:St(h.y),width:St(h.width),height:St(h.height)}}:{}});continue}if(typeof o.x!="number"||typeof o.y!="number")continue;const c=ht(o.businessObject),u=ht(o.label);let l=ht(o.parent);for(;l&&l.type==="bpmn:Lane";)l=ht(l.parent);const p=typeof(l==null?void 0:l.type)=="string"?l.type:"",f=l&&us.has(p)&&p!=="bpmn:Group"&&typeof l.id=="string"?l.id:void 0,d={id:o.id,type:a,x:o.x,y:o.y,width:St(o.width),height:St(o.height),container:us.has(a)&&(a==="bpmn:Participant"||o.collapsed!==!0),attached:(c==null?void 0:c.attachedToRef)!==void 0,...f!==void 0?{parent:f}:{},...u&&typeof u.x=="number"?{label:{x:u.x,y:St(u.y),width:St(u.width),height:St(u.height)}}:{},...a==="bpmn:Group"?Wd(Vd(c)):{}},g=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&g&&((i=ht(o.di))==null?void 0:i.isHorizontal)!==!1&&(d.label=Ku(d,g)),t.push(d)}return{shapes:t,edges:n}}const NE={"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 BE(e,t){const n=NE[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function Kd(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function Xd(e){const t=()=>e.getAll().filter(n=>n.type!=="label"&&!("labelTarget"in n&&n.labelTarget));return{isCollaboration:()=>t().some(n=>n.type==="bpmn:Participant"),categoryOf:n=>{const i=e.get(n);if(!(!i||i.type==="label"))return BE(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&Kd(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?Kd(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 el=20,$E=4,pt=(e,t)=>Math.abs(e-t)<.5;function tl(e,t,n,i=el){if(pt(e.y,t.y)&&!pt(e.x,t.x)){const r=Math.min(e.x,t.x),o=Math.max(e.x,t.x);if(!(r<n.x-i&&n.x+n.width+i<o))return null;const a=e.x<t.x?n.x-i:n.x+n.width+i,s=e.x<t.x?n.x+n.width+i:n.x-i,c=u=>[{x:a,y:e.y},{x:a,y:u},{x:s,y:u},{x:s,y:e.y}];return[c(n.y-i),c(n.y+n.height+i)]}if(pt(e.x,t.x)&&!pt(e.y,t.y)){const r=Math.min(e.y,t.y),o=Math.max(e.y,t.y);if(!(r<n.y-i&&n.y+n.height+i<o))return null;const a=e.y<t.y?n.y-i:n.y+n.height+i,s=e.y<t.y?n.y+n.height+i:n.y-i,c=u=>[{x:e.x,y:a},{x:u,y:a},{x:u,y:s},{x:e.x,y:s}];return[c(n.x-i),c(n.x+n.width+i)]}return null}function Zd(e,t,n,i=el){if(n.length<2)return null;if(pt(e.y,t.y)&&!pt(e.x,t.x)){const r=Math.min(e.x,t.x),o=Math.max(e.x,t.x),a=Math.min(...n.map(d=>d.x))-i,s=Math.max(...n.map(d=>d.x+d.width))+i;if(!(r<a&&s<o))return null;const c=e.x<t.x?a:s,u=e.x<t.x?s:a,l=Math.min(...n.map(d=>d.y))-i,p=Math.max(...n.map(d=>d.y+d.height))+i,f=d=>[{x:c,y:e.y},{x:c,y:d},{x:u,y:d},{x:u,y:e.y}];return[f(l),f(p)]}if(pt(e.x,t.x)&&!pt(e.y,t.y)){const r=Math.min(e.y,t.y),o=Math.max(e.y,t.y),a=Math.min(...n.map(d=>d.y))-i,s=Math.max(...n.map(d=>d.y+d.height))+i;if(!(r<a&&s<o))return null;const c=e.y<t.y?a:s,u=e.y<t.y?s:a,l=Math.min(...n.map(d=>d.x))-i,p=Math.max(...n.map(d=>d.x+d.width))+i,f=d=>[{x:e.x,y:c},{x:d,y:c},{x:d,y:u},{x:e.x,y:u}];return[f(l),f(p)]}return null}function Qd(e,t,n=el){if(e.length!==4)return null;const[i,r,o,a]=e;if(pt(i.y,r.y)&&pt(r.x,o.x)&&pt(o.y,a.y)){const s=c=>[i,{x:c,y:i.y},{x:c,y:a.y},a];return[s(t.x-n),s(t.x+t.width+n)]}if(pt(i.x,r.x)&&pt(r.y,o.y)&&pt(o.x,a.x)){const s=c=>[i,{x:i.x,y:c},{x:a.x,y:c},a];return[s(t.y-n),s(t.y+t.height+n)]}return null}function nl(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 Jd=30,jE=[0,-25,25,-40,40];function FE(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+Jd:s-Jd,u=a?i.y+i.height:i.y,l=n.x+n.width/2,p=i.x+i.width/2;return jE.map(f=>[{x:l,y:s},{x:l,y:c},{x:p+f,y:c},{x:p+f,y:u}])}const eh=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],co=(e,t,n)=>gn({...e,waypoints:t},n).length;function th(e,t,n,i){let r=[...e.waypoints],o=co(e,r,t);if(o===0)return null;let a=!1;for(const p of nl(e,t))if(co(e,p,t)===0)return p;const s=(i??[]).filter(p=>p.id!==e.id).flatMap(fn),c=p=>fn({...e,waypoints:p}).some(f=>ps(f,s).length>0),u=FE(e,t).filter(p=>co(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);if(e.endpoints.length===2&&r.length>2){const p=t.find(d=>d.id===e.endpoints[0]),f=t.find(d=>d.id===e.endpoints[1]);if(p&&f&&pt(p.y+p.height/2,f.y+f.height/2)){const d=[r[0],r[r.length-1]];if(pt(d[0].y,d[1].y)&&!pt(d[0].x,d[1].x)){const g=t.filter(y=>!e.endpoints.includes(y.id)&&gn({...e,waypoints:d},[y]).length>0),h=g.length>=2?Zd(d[0],d[1],g):null,w=(h?h.map(y=>[d[0],...y,d[1]]):g.length===1?(tl(d[0],d[1],g[0])??[]).map(y=>[d[0],...y,d[1]]):g.length===0?[d]:[]).filter(y=>co(e,y,t)===0&&y.length<=r.length).sort((y,_)=>Number(l(_))-Number(l(y)));if(w.length)return w.find(y=>!c(y))??w[0]}}}for(let p=0;p+1<r.length;p++){const f=r[p],d=r[p+1],g=t.filter(w=>!e.endpoints.includes(w.id)&&gn({...e,waypoints:[f,d]},[w]).length>0);if(g.length<2)continue;const h=Zd(f,d,g);if(!h)continue;const m=h.map(w=>eh(r,p,w)).filter(w=>co(e,w,t)===0).sort((w,y)=>Number(l(y))-Number(l(w)));if(m.length)return m.find(w=>!c(w))??m[0]}for(let p=0;p<$E&&o>0;p++){let f=!1;for(let d=0;d+1<r.length&&!f;d++){const g=r[d],h=r[d+1];for(const m of t){if(e.endpoints.includes(m.id)||gn({...e,waypoints:[g,h]},[m]).length===0)continue;const w=tl(g,h,m),y=w?w.map(S=>eh(r,d,S)):Qd(r,m)??[];if(!y.length)continue;const _=[...y].sort((S,P)=>Number(l(P))-Number(l(S)));for(const S of _){const P=co(e,S,t);if(P<o){r=S,o=P,f=!0,a=!0;break}}if(f)break}}if(!f)break}return a&&o===0?r:null}function nh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=mt(n),o=ti(r),a=li(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=th(u,o,f,r.edges);if(!d)continue;const g=r.edges.filter(w=>w.id!==c),h=Jn(u,g);Jn({...u,waypoints:d},g)>h||i.updateWaypoints(l,d)}}const HE=10;function ih(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 rh(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(F=>F.type==="bpmn:Participant"&&F.container),i=t.shapes.find(F=>F.id===e.endpoints[0]),r=t.shapes.find(F=>F.id===e.endpoints[1]);if(!i||!r)return null;const o=ih(i,n),a=ih(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(F=>F.id!==o.id&&F.id!==a.id&&F.y>=c.y+c.height&&F.y+F.height<=u.y).sort((F,ae)=>F.y-ae.y);if(!l.length)return null;const p=l[0],f=l[l.length-1],d=(c.y+c.height+p.y)/2,g=(f.y+f.height+u.y)/2,h=s?d:g,m=s?g:d,w=e.waypoints[0],y=e.waypoints[e.waypoints.length-1],_=ti(t),S=t.edges.filter(F=>F.id!==e.id),P=ei(e,S),C=gn(e,_).length;if(P===0&&C===0||C===0&&e.waypoints.length===2)return null;const D=Math.min(...l.map(F=>F.x)),T=Math.max(...l.map(F=>F.x+F.width)),N=(w.x+y.x)/2,k=F=>F.filter((ae,_e)=>_e===0||!(pt(ae.x,F[_e-1].x)&&pt(ae.y,F[_e-1].y)));let O;for(let F=D;F<=T;F+=HE){const ae=k([w,{x:w.x,y:h},{x:F,y:h},{x:F,y:m},{x:y.x,y:m},y]),_e={...e,waypoints:ae};if(gn(_e,_).length>0)continue;const We=ei(_e,S),Y=Math.abs(F-N);(!O||We<O.cross||We===O.cross&&Y<O.detour)&&(O={pts:ae,cross:We,detour:Y})}return O&&(C>0?O.cross<=P:O.cross<P)?O.pts:null}function oh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=mt(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=mt(n),s=a.edges.find(l=>l.id===o.id);if(!s)continue;const c=rh(s,a);if(!c)continue;const u=n.get(o.id);u&&i.updateWaypoints(u,c)}}const Xi=[25,-25,40,-40],hs=35;function il(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];if(i.x+i.width>n.x)return[];const r=n.y+n.height/2;if(r>=i.y&&r<=i.y+i.height)return[];const o=i.x+i.width/2,a=n.x+n.width/2,s=r<i.y,c=s?i.y:i.y+i.height,u=s?n.y:n.y+n.height,l=s?n.y-hs:n.y+n.height+hs,p=[];for(const y of[0,...Xi]){if(Math.abs(y)>=i.width/2-5)continue;const _=o+y;p.push({pts:[{x:n.x,y:r},{x:_,y:r},{x:_,y:c}],cost:Math.abs(y)});for(const S of[0,...Xi]){if(Math.abs(S)>=n.width/2-5)continue;const P=a+S;p.push({pts:[{x:P,y:u},{x:P,y:l},{x:_,y:l},{x:_,y:c}],cost:Math.abs(y)+Math.abs(S)})}}const f=50,d=i.y+i.height/2,g=s?n.y+n.height:n.y;for(const y of[0,...Xi]){if(Math.abs(y)>=n.width/2-5)continue;const _=a+y;p.push({pts:[{x:_,y:g},{x:_,y:d},{x:i.x+i.width,y:d}],cost:f+Math.abs(y)})}const h=60,m=s?i.y+i.height:i.y,w=s?i.y+i.height+hs:i.y-hs;for(const y of[0,...Xi]){if(Math.abs(y)>=i.width/2-5)continue;const _=o+y;for(const S of[0,...Xi]){if(Math.abs(S)>=n.width/2-5)continue;const P=a+S;p.push({pts:[{x:P,y:g},{x:P,y:w},{x:_,y:w},{x:_,y:m}],cost:h+Math.abs(y)+Math.abs(S)})}}return p}const ms=30;function ah(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],r=e[n+1],o=pt(i.y,r.y)&&!pt(i.x,r.x),a=pt(i.x,r.x)&&!pt(i.y,r.y);if(!(!o&&!a))for(const s of t)if(o){const c=Math.min(i.x,r.x);if(Math.max(i.x,r.x)<=s.x||c>=s.x+s.width)continue;if(Math.abs(i.y-s.y)<ms||Math.abs(i.y-(s.y+s.height))<ms)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)<ms||Math.abs(i.x-(s.x+s.width))<ms)return!0}}return!1}const gs=40;function zE(e,t,n){let i=0;for(const r of t){if(r.container||n.includes(r.id))continue;const o=r.x-gs,a=r.x+r.width+gs,s=r.y-gs,c=r.y+r.height+gs;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 sh(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(C=>C.container),i=new Map(t.shapes.map(C=>[C.id,C])),r=ti(t),o=t.edges.filter(C=>C.id!==e.id),a=Jn(e,o),s=ei(e,o),c=C=>zE(C,t.shapes,e.endpoints)+(ah(C,n)?1:0),u=c(e.waypoints),l=C=>{if(!C)return;const D=C.x+C.width/2,T=C.y+C.height/2;return n.find(N=>N.type==="bpmn:Lane"&&D>=N.x&&D<=N.x+N.width&&T>=N.y&&T<=N.y+N.height)},p=l(i.get(e.endpoints[0]??"")),f=l(i.get(e.endpoints[1]??"")),d=!!p&&!!f&&p.id!==f.id,g=C=>{if(!d||!f)return!1;for(let D=1;D<C.length-2;D++){const T=C[D],N=C[D+1];if(pt(T.y,N.y)&&!pt(T.x,N.x)&&T.y>f.y&&T.y<f.y+f.height)return!0}return!1},h=g(e.waypoints),w=(C=>{if(!C)return;const D=C.x+C.width/2,T=C.y+C.height/2;return n.filter(N=>N.type==="bpmn:Participant"&&D>=N.x&&D<=N.x+N.width&&T>=N.y&&T<=N.y+N.height).sort((N,k)=>N.width*N.height-k.width*k.height)[0]})(i.get(e.endpoints[0]??"")),y=C=>{if(!w)return 0;let D=0;for(let T=1;T<C.length-1;T++){const N=C[T];(N.x<w.x||N.x>w.x+w.width||N.y<w.y||N.y>w.y+w.height)&&D++}return D},_=y(e.waypoints);if(!ah(e.waypoints,n)&&!(d&&!h)&&_===0)return null;const S=C=>C.reduce((D,T,N)=>N?D+Math.abs(T.x-C[N-1].x)+Math.abs(T.y-C[N-1].y):0,0);let P;for(const{pts:C,cost:D}of il(e,i)){const T={...e,waypoints:C};if(gn(T,r).length>0)continue;const N=Jn(T,o);if(N>a)continue;const k=y(C);if(k>_)continue;const O=k<_&&N===0;if(!O&&ei(T,o)>s)continue;const F=c(C),ae=g(C);if(!O&&!(ae&&!h)&&F>=u)continue;const We=ae?0:1,Y=S(C);(!P||k<P.out||k===P.out&&(We<P.lane||We===P.lane&&(N<P.opp||N===P.opp&&(F<P.sc||F===P.sc&&(D<P.cost||D===P.cost&&Y<P.len)))))&&(P={pts:C,out:k,sc:F,lane:We,opp:N,cost:D,len:Y})}return(P==null?void 0:P.pts)??null}function GE(e,t){const{elementRegistry:n}=e,i=e.modeling,r=mt(n).edges.filter(o=>!t.has(o.id)&&o.waypoints.length>=4).map(o=>o.id).sort();for(const o of r){const a=mt(n),s=a.edges.find(d=>d.id===o);if(!s||s.waypoints.length<4)continue;const c=ti(a),u=a.edges.filter(d=>d.id!==o),l=gn(s,c).length,p=Jn(s,u),f=ei(s,u);for(const d of nl(s,a.shapes)){if(d.length>=s.waypoints.length)continue;const g={...s,waypoints:d};if(gn(g,c).length>l||Jn(g,u)>p||ei(g,u)>f)continue;const h=n.get(o);h&&i.updateWaypoints(h,d);break}}}function ch(e,t){const{elementRegistry:n}=e,i=e.modeling,r=mt(n).edges.filter(o=>o.type==="bpmn:SequenceFlow"&&!t.has(o.id)).map(o=>o.id).sort();for(const o of r){const a=mt(n),s=a.edges.find(l=>l.id===o);if(!s)continue;const c=sh(s,a);if(!c)continue;const u=n.get(o);u&&i.updateWaypoints(u,c)}}function uh(e,t){const n=e.waypoints;if(n.length<3)return[];const i=[],r=t.get(e.endpoints[0]??""),o=t.get(e.endpoints[1]??""),a=pt(n[0].x,n[1].x)&&!pt(n[0].y,n[1].y),s=pt(n[n.length-1].x,n[n.length-2].x)&&!pt(n[n.length-1].y,n[n.length-2].y);for(const c of Xi){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 VE(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];if(Math.min(n.x+n.width,i.x+i.width)-Math.max(n.x,i.x)>=1)return[];const r=i.y+i.height<=n.y,o=n.y+n.height<=i.y;if(!r&&!o)return[];const a=i.x>=n.x+n.width,s=i.x+i.width<=n.x;if(!a&&!s)return[];const c=n.x+n.width/2,u=n.y+n.height/2,l=i.x+i.width/2,p=i.y+i.height/2,f=a?n.x+n.width:n.x,d=o?n.y+n.height:n.y,g=a?i.x:i.x+i.width,h=o?i.y:i.y+i.height,m=[];for(const w of[0,...Xi])Math.abs(w)<i.width/2-5&&m.push({pts:[{x:f,y:u},{x:l+w,y:u},{x:l+w,y:h}],cost:Math.abs(w)}),Math.abs(w)<i.height/2-5&&m.push({pts:[{x:c,y:d},{x:c,y:p+w},{x:g,y:p+w}],cost:Math.abs(w)});return m}function lh(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];const r=Math.max(n.x,i.x),o=Math.min(n.x+n.width,i.x+i.width);if(o-r<1)return[];const a=i.y+i.height<=n.y,s=n.y+n.height<=i.y;if(!a&&!s)return[];const c=a?n.y:n.y+n.height,u=a?i.y+i.height:i.y,l=(r+o)/2,p=[];for(const f of[0,...Xi]){const d=l+f;d<=r||d>=o||p.push({pts:[{x:d,y:c},{x:d,y:u}],cost:Math.abs(f)})}return p}function ph(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=ti(t),r=t.edges.filter(d=>d.id!==e.id),o=Jn(e,r);if(o===0)return null;const a=ei(e,r);let s;const c=d=>d.reduce((g,h,m)=>m?g+Math.abs(h.x-d[m-1].x)+Math.abs(h.y-d[m-1].y):0,0),u=3,l=d=>{const g=d[0],h=d[d.length-1],m=Math.hypot(h.x-g.x,h.y-g.y);return m>=1&&c(d)/m>=u?1:0},p=l(e.waypoints),f=[...il(e,n),...lh(e,n),...uh(e,n)];for(const{pts:d,cost:g}of f){const h={...e,waypoints:d};if(gn(h,i).length>0)continue;const m=Jn(h,r),w=ei(h,r),y=o-m+(p-l(d));if(m>=o||w-a>y)continue;const _=c(d);(!s||m<s.opposite||m===s.opposite&&(w<s.cross||w===s.cross&&(g<s.cost||g===s.cost&&_<s.len)))&&(s={pts:d,opposite:m,cross:w,cost:g,len:_})}return(s==null?void 0:s.pts)??null}function fh(e,t){var i;let n=0;for(const r of t)r.id!==e.id&&((i=Yo(e,r))==null?void 0:i.kind)==="unrelated"&&n++;return n}function WE(e,t){const n=new Map(t.shapes.map(f=>[f.id,f])),i=ti(t),r=t.edges.filter(f=>f.id!==e.id),o=fh(e,r);if(o===0)return null;const a=Jn(e,r),s=ei(e,r),c=f=>f.reduce((d,g,h)=>h?d+Math.abs(g.x-f[h-1].x)+Math.abs(g.y-f[h-1].y):0,0),u=2;let l;const p=[...il(e,n),...lh(e,n),...VE(e,n),...uh(e,n)];for(const{pts:f,cost:d}of p){const g={...e,waypoints:f};if(gn(g,i).length>0)continue;const h=fh(g,r);if(h>=o)continue;const m=Jn(g,r);if(m-h>a-o)continue;const w=ei(g,r);if(w-s>(o-h)*u)continue;const y=c(f);(!l||h<l.fake||h===l.fake&&(m<l.unreadable||m===l.unreadable&&(w<l.cross||w===l.cross&&(d<l.cost||d===l.cost&&y<l.length))))&&(l={pts:f,fake:h,unreadable:m,cross:w,cost:d,length:y})}return(l==null?void 0:l.pts)??null}function dh(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=li(mt(i)).filter(s=>s.kind==="edge-overlap-unrelated"&&!t.has(ui(s)));if(!o.length)return;const a=new Set;for(const s of o)if(s.kind==="edge-overlap-unrelated")for(const c of s.edges)n.has(c)||a.add(c);for(const s of[...a].sort()){const c=mt(i),u=c.edges.find(f=>f.id===s);if(!u)continue;const l=WE(u,c);if(!l)continue;const p=i.get(s);p&&r.updateWaypoints(p,l)}}function hh(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=mt(i),a=li(o).filter(l=>Xu(l)&&!t.has(ui(l)));if(!a.length)return;const s=new Set;for(const l of a)if(Xu(l))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=mt(i),f=p.edges.find(h=>h.id===l);if(!f)continue;const d=ph(f,p);if(!d)continue;const g=i.get(l);g&&r.updateWaypoints(g,d)}}const UE=10,qE=(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 mh(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!fs(e,i))return null;const r=ti(t),o=i.flatMap(fn);for(const a of fn(e)){let s=[[a.lo,a.hi]];for(const[d,g]of ps(a,o))s=s.flatMap(([h,m])=>{const w=[];return d>h&&w.push([h,Math.min(m,d)]),g<m&&w.push([Math.max(h,g),m]),w.filter(([y,_])=>_>y)});const c=a.axis==="h"?n.width:n.height,u=s.find(([d,g])=>g-d>=c+UE*2);if(!u)continue;const l=(u[0]+u[1])/2,p=a.axis==="h"?{x:l,y:a.at-Bd}:{x:a.at+Rn+n.width/2,y:l},f={x:p.x-n.width/2,y:p.y-n.height/2,width:n.width,height:n.height};if(!fs({...e,label:f},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&qE(f,d)))return f}return null}const Rn=8;function gh(e,t){const n=e.label;if(!n)return null;const i=fn(e);if(!i.length)return null;const r=n.x+n.width/2,o=n.y+n.height/2,a=f=>{const d=f.axis==="h"?r:o,g=f.axis==="h"?o-f.at:r-f.at,h=d<f.lo?f.lo-d:d>f.hi?d-f.hi:0;return Math.hypot(g,h)},s=i.reduce((f,d)=>a(d)<a(f)?d:f,i[0]),c=[...i,...t.edges.filter(f=>f.id!==e.id).flatMap(fn),...t.shapes.filter(f=>f.container).flatMap(Ko)],u=f=>!c.some(d=>Pi(f,d));if(u(n))return null;const l=(s.axis==="v"?n.height:n.width)+Rn,p=[0,-l,l,-2*l,2*l];if(s.axis==="v")for(const f of[s.at+Rn,s.at-Rn-n.width])for(const d of p){const g=n.y+d;if(g<s.lo||g+n.height>s.hi)continue;const h={...n,x:f,y:g};if(u(h))return h}else for(const f of[s.at-Rn-n.height,s.at+Rn])for(const d of p){const g=n.x+d;if(g<s.lo||g+n.width>s.hi)continue;const h={...n,x:g,y:f};if(u(h))return h}return null}function yh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=mt(n);for(const o of r.edges){if(!o.label||t.has(o.id))continue;const a=gh(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 vh(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=mt(i),a=li(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=mh(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 bh(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(fn),...t.shapes.filter(f=>f.container).flatMap(Ko)],r=i.filter(f=>Pi(n,f));if(!r.length)return null;const o=t.shapes.filter(f=>!f.container&&f.id!==e.id),a=so(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=>Pi(f,d))&&!o.some(d=>s(f,d))&&!a.some(d=>s(f,d)),u=[];for(const f of r)f.axis==="h"?u.push({...n,y:f.at-Rn-n.height},{...n,y:f.at+Rn}):u.push({...n,x:f.at-Rn-n.width},{...n,x:f.at+Rn});const l=e.x+e.width/2,p=e.y+e.height/2;return u.push({...n,x:l-n.width/2,y:e.y+e.height+Rn},{...n,x:l-n.width/2,y:e.y-Rn-n.height},{...n,x:e.x+e.width+Rn,y:p-n.height/2},{...n,x:e.x-Rn-n.width,y:p-n.height/2}),u.find(c)??null}function _h(e,t){const{elementRegistry:n}=e,i=e.modeling,r=mt(n);for(const o of r.shapes){if(o.container||!o.label||t.has(o.id))continue;const a=bh(o,mt(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 YE=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,xh=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),wh={"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}]},ys=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),rl=e=>typeof e=="string"&&e!=="";function KE(e){const t=[];function n(i,r,o,a){if(a===null){rl(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!ys(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)rl(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{if(!ys(i)||!rl(i.kind)||!(i.kind in wh)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const o of wh[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(!ys(u))break;u=u[p]}if(!ys(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"||i.kind==="node.update"){const o=i.band;o!==void 0&&(!Number.isInteger(o)||o<0)&&t.push({kind:"payload-invalid",opIndex:r,field:"band"})}}),t}function Eh(e,t){const n=KE(e);if(n.length>0)return n;const i=[],r=new Map,o=new Map;function a(f,d,g){if(!YE.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,{...g,opIndex:f})}e.forEach((f,d)=>{var g;switch(f.kind){case"participant.add":a(d,f.participant.id,{category:"participant",lanes:(f.participant.lanes??[]).map(h=>h.id)});for(const h of f.participant.lanes??[])a(d,h.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 h of f.associations??[])h.id&&a(d,h.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"}),(g=f.association)!=null&&g.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(h=>h.id));for(const h of f.lanes)t.categoryOf(h.id)===void 0&&a(d,h.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,g,h){const m=s(d);if(m===void 0){i.push({kind:"ref-missing",opIndex:f,ref:d,role:g});return}if(h&&!h.includes(m)){i.push({kind:"ref-category",opIndex:f,ref:d,role:g,expected:h.join("|"),actual:m});return}return m}const l=t.isCollaboration()||e.some(f=>f.kind==="participant.add");return e.forEach((f,d)=>{var g;switch(f.kind){case"participant.add":break;case"node.add":{const{participant:h,lane:m}=f.node;if(h===void 0){(l||m!==void 0)&&i.push({kind:"participant-required",opIndex:d,id:f.node.id});break}if(u(d,h,"participant",["participant"])===void 0)break;m!==void 0&&((((g=r.get(h))==null?void 0:g.lanes)??o.get(h)??t.lanesOf(h)).includes(m)||i.push({kind:"lane-unknown",opIndex:d,lane:m,participant:h}));break}case"sequenceFlow.add":{const{id:h,source:m,target:w,name:y,condition:_}=f.flow,S=u(d,m,"source",["flowNode"]),P=u(d,w,"target",["flowNode"]);S&&P&&c(m)!==c(w)&&i.push({kind:"flow-cross-pool",opIndex:d,id:h}),y!==void 0&&_!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:h});break}case"messageFlow.add":{const{id:h,source:m,target:w}=f.flow,y=u(d,m,"source",["flowNode","participant"]),_=u(d,w,"target",["flowNode","participant"]);if(y&&_){const S=c(m),P=c(w);S!==void 0&&S===P&&i.push({kind:"message-flow-same-pool",opIndex:d,id:h})}break}case"dataStore.add":{for(const h of f.associations??[]){if([h.source,h.target].filter(y=>y===f.dataStore.id).length!==1){i.push({kind:"data-association-ends",opIndex:d,source:h.source,target:h.target});continue}const w=h.source===f.dataStore.id?h.target:h.source;u(d,w,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:h,target:m}=f.association,w=u(d,h,"source"),y=u(d,m,"target");if(w&&y){const _=new Set([w,y]);_.has("dataStore")&&_.has("flowNode")||i.push({kind:"data-association-ends",opIndex:d,source:h,target:m})}break}case"association.add":{const{id:h,source:m,target:w}=f.association,y=u(d,m,"source"),_=u(d,w,"target");y&&_&&y!=="annotation"&&_!=="annotation"&&i.push({kind:"association-detached",opIndex:d,annotation:h??`${m}->${w}`});break}case"annotation.add":{if(f.association){const{source:h,target:m}=f.association;if(h!==f.annotation.id&&m!==f.annotation.id)i.push({kind:"association-detached",opIndex:d,annotation:f.annotation.id});else{const w=h===f.annotation.id?m:h;u(d,w,"association")}}f.placement&&u(d,f.placement.anchor,"anchor");break}case"group.add":{for(const h of f.group.members??[]){const m=u(d,h,"member");m&&xh.has(m)&&i.push({kind:"ref-category",opIndex:d,ref:h,role:"member",expected:"shape",actual:m})}break}case"participant.update":{if(p(d,f.id,"participant")===void 0)break;if(f.lanes){const h=t.lanesOf(f.id),m=f.lanes.map(y=>y.id);for(const y of h)m.includes(y)||i.push({kind:"lane-shrink-unsupported",opIndex:d,participant:f.id,lane:y});for(const y of m)t.categoryOf(y)!==void 0&&!h.includes(y)&&i.push({kind:"id-duplicate",opIndex:d,id:y});const w=m.filter(y=>h.includes(y));w.length===h.length&&w.some((y,_)=>y!==h[_])&&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 h=t.participantOf(f.id);(h?o.get(h)??t.lanesOf(h):[]).includes(f.lane)||i.push({kind:"lane-unknown",opIndex:d,lane:f.lane,participant:h??""})}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 h=f.source===void 0||u(d,f.source,"source",["flowNode"])!==void 0,m=f.target===void 0||u(d,f.target,"target",["flowNode"])!==void 0,w=t.endpointsOf(f.id),y=f.source??(w==null?void 0:w.source),_=f.target??(w==null?void 0:w.target);h&&m&&y!==void 0&&_!==void 0&&new Set([c(y),c(_),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 h of f.members??[]){const m=u(d,h,"member");m&&xh.has(m)&&i.push({kind:"ref-category",opIndex:d,ref:h,role:"member",expected:"shape",actual:m})}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,g){if(r.has(d)){i.push({kind:"target-added-in-batch",opIndex:f,id:d});return}const h=t.categoryOf(d);if(h===void 0){i.push({kind:"ref-missing",opIndex:f,ref:d,role:"target"});return}if(g&&h!==g){i.push({kind:"ref-category",opIndex:f,ref:d,role:"target",expected:g,actual:h});return}return h}}function Sh(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 vs(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const bs={"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]},Qt=10,Rh=40,XE=10;function ol(e,t,n,i,r){const o=n,a=(k,O)=>{const[F,ae]=bs[k];let _e={x:t.x+t.width/2+F*(t.width/2+o.width/2+O),y:t.y+t.height/2+ae*(t.height/2+o.height/2+O)};const We=i.x+Qt+o.width/2,Y=i.x+i.width-Qt-o.width/2,le=i.y+Qt+o.height/2,ge=i.y+i.height-Qt-o.height/2,ue={x:Math.min(Y,Math.max(We,_e.x)),y:Math.min(ge,Math.max(le,_e.y))};return(ue.x!==_e.x||ue.y!==_e.y)&&(_e=Math.abs(ue.x-(t.x+t.width/2))<(t.width+o.width)/2+Qt&&Math.abs(ue.y-(t.y+t.height/2))<(t.height+o.height)/2+Qt?{x:t.x+t.width+Qt+o.width/2,y:ue.y}:ue),_e},s=(i.children??[]).filter(k=>!("waypoints"in k&&k.waypoints)&&k.type!=="bpmn:Lane"&&k.type!=="label"&&typeof k.x=="number"&&k.id!==r.selfId),c=mt(e),u=k=>{var F,ae;if(!r.selfId)return!1;const O=e.get(k);return!!O&&(((F=O.source)==null?void 0:F.id)===r.selfId||((ae=O.target)==null?void 0:ae.id)===r.selfId)},l=c.edges.filter(k=>!u(k.id)).flatMap(fn),p=so(c).filter(k=>k.owner!==r.selfId).map(k=>k.rect),f=k=>({x0:k.x-o.width/2-Qt,x1:k.x+o.width/2+Qt,y0:k.y-o.height/2-Qt,y1:k.y+o.height/2+Qt}),d=k=>{const O=f(k);return s.some(F=>O.x0<F.x+F.width&&O.x1>F.x&&O.y0<F.y+F.height&&O.y1>F.y)},g=k=>{const O=f(k);return l.some(F=>F.axis==="h"?F.at>O.y0&&F.at<O.y1&&F.lo<O.x1&&F.hi>O.x0:F.at>O.x0&&F.at<O.x1&&F.lo<O.y1&&F.hi>O.y0)},h=k=>{const O=f(k);return p.some(F=>O.x0<F.x+F.width&&O.x1>F.x&&O.y0<F.y+F.height&&O.y1>F.y)},m=c.shapes.filter(k=>k.type==="bpmn:Group").flatMap(k=>[{axis:"h",at:k.y,lo:k.x,hi:k.x+k.width},{axis:"h",at:k.y+k.height,lo:k.x,hi:k.x+k.width},{axis:"v",at:k.x,lo:k.y,hi:k.y+k.height},{axis:"v",at:k.x+k.width,lo:k.y,hi:k.y+k.height}]),w=k=>{const O=f(k);return m.some(F=>F.axis==="h"?F.at>O.y0&&F.at<O.y1&&F.lo<O.x1&&F.hi>O.x0:F.at>O.x0&&F.at<O.x1&&F.lo<O.y1&&F.hi>O.y0)},y=k=>d(k)||g(k)||h(k)||w(k),_=k=>k.x-o.width/2>=i.x&&k.x+o.width/2<=i.x+i.width&&k.y-o.height/2>=i.y&&k.y+o.height/2<=i.y+i.height;if(r.placement){const k=Y=>Y.startsWith("top")?Y.replace(/^top/,"bottom"):Y.replace(/^bottom/,"top"),O=Y=>Y.endsWith("left")?Y.replace(/left$/,"right"):Y.replace(/right$/,"left"),F=r.placement.side,ae=[F,k(F),O(F),k(O(F)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],_e=r.placement.offset??50;let We=a(F,_e);if(y(We)){const Y=new Set;for(const le of ae){if(Y.has(le))continue;Y.add(le);const ge=a(le,_e);if(_(ge)&&!y(ge)){We=ge;break}}}return We}const S=r.from,P=i.x+Qt+o.width/2,C=i.x+i.width-Qt-o.width/2,D=i.y+Qt+o.height/2,T=i.y+i.height-Qt-o.height/2;let N={x:Math.min(C,Math.max(P,S.x)),y:Math.min(T,Math.max(D,S.y))};if(y(N)){const k=(t.width+o.width)/2+Qt,F=[{x:N.x+k,y:N.y},{x:N.x-k,y:N.y},{x:N.x,y:N.y-o.height-Qt},{x:N.x,y:N.y+o.height+Qt}].filter(_).find(ae=>!y(ae));F&&(N=F)}return N}function Ut(e,t){return e.filter(n=>n.kind===t)}function Ch(e,t){var Kx,Xx,Zx,Qx,Jx,e0,t0,n0,i0,r0,o0,a0,s0,c0,u0,l0,p0,f0,d0,h0,m0,g0,y0;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:s,bpmnReplace:c}=t,u=()=>a.getRootElement(),l=v=>o.get(v),p=v=>{const R=l(v);if(!R)throw new Error(`하강 참조 해소 실패: ${v}`);return R},f=v=>{let R=v.parent;for(;R;){if(R.type==="bpmn:Participant")return R;R=R.parent}},d=new Map;for(const v of o.filter(R=>!("waypoints"in R&&R.waypoints)&&R.type!=="bpmn:Lane"&&R.type!=="label"&&typeof R.x=="number"))d.set(v.id,{x:v.x,y:v.y});const g=Ut(e,"participant.add"),h=Ut(e,"node.add"),m=Ut(e,"sequenceFlow.add"),w=Ut(e,"messageFlow.add"),y=Ut(e,"dataStore.add"),_=Ut(e,"dataAssociation.add"),S=Ut(e,"annotation.add"),P=Ut(e,"group.add"),C=new Map(h.map(v=>[v.node.id,v])),D=(v,R,A)=>{var z;const $=v.businessObject,B=(((z=$.extensionElements)==null?void 0:z.values)??[]).filter(V=>V.$type!==R),I=A?[...B,i.create(R,A)]:B;if(!I.length){$.extensionElements&&n.updateProperties(v,{extensionElements:void 0});return}const G=i.create("bpmn:ExtensionElements",{values:I});I.forEach(V=>{V.$parent=G}),n.updateProperties(v,{extensionElements:G})},T=v=>({anchor:v.anchor,side:v.side,...v.offset!==void 0?{offset:v.offset}:{}});for(const v of Ut(e,"element.remove")){const R=l(v.id);R&&n.removeElements([R])}const N=v=>o.filter(R=>{var A;return R.type==="bpmn:Lane"&&((A=f(R))==null?void 0:A.id)===v}).sort((R,A)=>R.y-A.y);for(const v of Ut(e,"participant.update")){const R=p(v.id);if(v.name!==void 0&&n.updateProperties(R,{name:v.name??void 0}),!v.lanes)continue;const A=N(v.id);if(!A.length){n.splitLane(R,v.lanes.length),N(v.id).forEach((B,I)=>{const G=v.lanes[I];G&&n.updateProperties(B,{id:G.id,name:G.name})});continue}const $=new Set(A.map(B=>B.id));v.lanes.forEach((B,I)=>{if($.has(B.id)){n.updateProperties(p(B.id),{name:B.name});return}const G=I===0?n.addLane(N(v.id)[0],"top"):n.addLane(p(v.lanes[I-1].id),"bottom");n.updateProperties(G,{id:B.id,name:B.name})})}const k=150,O=130,F=80,ae=90,_e=180,We=30,Y=(v,R,A,$,B)=>{const I=A-R.width/2,G=$-R.height/2;return(v.children??[]).find(z=>!("waypoints"in z&&z.waypoints)&&z.type!=="bpmn:Lane"&&z.type!=="label"&&!(B!=null&&B.has(z.id))&&typeof z.x=="number"&&I<z.x+z.width+We&&I+R.width+We>z.x&&G<z.y+z.height&&G+R.height>z.y)},le=new Set;for(const v of g){le.add(`pool:${v.participant.id}`);for(const R of v.participant.lanes??[])le.add(R.id)}const ge=new Map;for(const v of h){const R=v.node.lane??`pool:${v.node.participant??""}`;let A=ge.get(R);A||ge.set(R,A=new Set([0])),v.band!==void 0&&A.add(v.band)}const ue=new Map;for(const[v,R]of ge){if(!le.has(v))continue;const A=[...R].sort((I,G)=>I-G),$=A.map((I,G)=>G===0?0:G%2===1?Math.ceil(G/2):-(G/2)),B=Math.min(...$);ue.set(v,new Map(A.map((I,G)=>[I,$[G]-B])))}{const v=new Map;for(const R of g)(R.participant.lanes??[]).forEach((A,$)=>v.set(A.id,$));for(const[R,A]of ue){if(!v.has(R)||A.size<2)continue;const $=v.get(R),B=A.get(0)??0,I=new Set;for(const ie of h){if(ie.node.lane!==R||(ie.band??0)!==0||!ie.node.type.endsWith("Gateway"))continue;const Me={in:new Set,out:new Set,cross:new Set};for(const ce of m){const we=ce.flow.source===ie.node.id;if(!we&&ce.flow.target!==ie.node.id)continue;const at=C.get(we?ce.flow.target:ce.flow.source);if(!at||at.node.participant!==ie.node.participant||!at.node.lane)continue;let se,ve=!1;if(at.node.lane!==R){const me=v.get(at.node.lane);if(me===void 0)continue;se=me>$?"down":"up",ve=!0}else{const me=A.get(at.band??0)??B;se=me>B?"down":me<B?"up":void 0}se&&(Me[we?"out":"in"].add(se),ve&&Me.cross.add(se))}for(const ce of["up","down"])Me.in.has(ce)&&Me.out.has(ce)&&Me.cross.has(ce)&&I.add(ce)}if(I.size!==1)continue;const[G]=I,z=Math.max(...A.values()),V=G==="down"?z:0;if(B===V)continue;const X=[...A.entries()].filter(([ie])=>ie!==0).sort((ie,Me)=>ie[1]-Me[1]),pe=[...Array(z+1).keys()].filter(ie=>ie!==V),xe=new Map([[0,V]]);X.forEach(([ie],Me)=>xe.set(ie,pe[Me])),ue.set(R,xe)}}const Re=v=>{var R;return(((R=ge.get(v))==null?void 0:R.size)??0)>1},re=v=>v.band??(v.node.lane||!Re(`pool:${v.node.participant??""}`)?void 0:0),q=new Map,U=v=>q.get(v.node.id)??re(v),Z=new Set,He=new Set;{const v=new Map;for(const $ of m)v.set($.flow.target,(v.get($.flow.target)??0)+1);const R=$=>{const B=[],I=new Set([$]),G=[$];for(;G.length;){const z=G.shift();B.push(z);for(const V of m)V.flow.source!==z||I.has(V.flow.target)||(v.get(V.flow.target)??0)!==1||(I.add(V.flow.target),G.push(V.flow.target))}return B},A=($,B)=>{var I;return((I=ue.get($))==null?void 0:I.get(B))??B};for(const $ of h){if(!$.node.type.endsWith("Gateway"))continue;const B=$.node.lane??`pool:${$.node.participant??""}`,I=ue.get(B);if(!I||I.size<2)continue;const G=U($);if(G===void 0||A(B,G)!==A(B,0))continue;const z=A(B,G),V=m.filter(ce=>ce.flow.source===$.node.id).map(ce=>C.get(ce.flow.target)).filter(ce=>!!ce&&(ce.node.lane??`pool:${ce.node.participant??""}`)===B),X=V.filter(ce=>{const we=U(ce);return we!==void 0&&A(B,we)===z&&(v.get(ce.node.id)??0)===1}),pe=V.some(ce=>{const we=U(ce);return we!==void 0&&A(B,we)>z});if(X.length!==1||!pe)continue;const xe=new Set(V.flatMap(ce=>R(ce.node.id)));if(!m.some(ce=>ce.flow.target===$.node.id&&xe.has(ce.flow.source)))continue;const Me=new Map;for(const[ce,we]of I)Me.set(ce,we+1);Me.set(-1,0),ue.set(B,Me);for(const ce of R(X[0].node.id))C.has(ce)&&(q.set(ce,-1),He.add(ce));Z.add($.node.id)}}const wt=(v,R)=>{var A;return((A=ue.get(v))==null?void 0:A.get(R))??R},M=new Map;for(const[v,R]of ge){let A=0;for(const $ of R)A=Math.max(A,wt(v,$));M.set(v,A)}const E=v=>_e+k*v,b=(v,R,A)=>{const $=u().children.filter(B=>!("waypoints"in B&&B.waypoints)&&B.id!==R&&typeof B.y=="number"&&B.y>=v);$.length&&n.moveElements($,{x:0,y:A})},j=(v,R,A)=>{if(v){const G=p(v),z=E(R);if(G.height>=z)return;const V=z-G.height,X=f(G),pe=X?X.y+X.height:G.y+G.height;n.resizeLane(G,{x:G.x,y:G.y,width:G.width,height:z},!1),b(pe,X==null?void 0:X.id,V);return}if(!A)return;const $=k*(R+1);if(A.height>=$)return;const B=$-A.height,I=A.y+A.height;n.resizeShape(A,{x:A.x,y:A.y,width:A.width,height:$}),b(I,A.id,B)},W=g.map((v,R)=>({op:v,declared:R}));W.sort((v,R)=>{const A=v.op.order??Number.POSITIVE_INFINITY,$=R.op.order??Number.POSITIVE_INFINITY;return A!==$?A-$:v.declared-R.declared});let K=80;for(const v of o.getAll())v.parent===u()&&"height"in v&&typeof v.y=="number"&&(K=Math.max(K,v.y+v.height+60));for(const{op:v}of W){const R=v.participant,A=h.filter(ie=>ie.node.participant===R.id).length,$=((Kx=R.lanes)==null?void 0:Kx.length)??0,B=Math.max(1200,A*160+300),I=(R.lanes??[]).map(ie=>E(M.get(ie.id)??0)),G=I.reduce((ie,Me)=>ie+Me,0);$&&G<300&&(I[$-1]+=300-G);const z=Math.max(300,k*((M.get(`pool:${R.id}`)??0)+1)),V=R.blackBox||A+$===0?120:$?Math.max(300,G):z,X=r.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:R.id,name:R.name,...v.order!==void 0?{"bwl:poolOrder":v.order}:{},...R.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:B,height:V,isExpanded:!0}),pe=n.createShape(X,{x:100+B/2,y:K+V/2},u()),xe=R.lanes??[];if(xe.length&&n.splitLane(pe,xe.length),xe.length){const ie=o.filter(Me=>{var ce;return Me.type==="bpmn:Lane"&&((ce=f(Me))==null?void 0:ce.id)===R.id}).sort((Me,ce)=>Me.y-ce.y);if(ie.forEach((Me,ce)=>{const we=xe[ce];we&&n.updateProperties(Me,{id:we.id,name:we.name})}),I.some(Me=>Me!==pe.height/$)){let Me=pe.y;ie.forEach((ce,we)=>{const at=I[we];n.resizeShape(ce,{x:ce.x,y:Me,width:ce.width,height:at}),Me+=at})}}K=pe.y+pe.height+60}const ye=v=>{var $;const R=C.get(v);if(R)return R.node.participant??"";const A=l(v);return A?A.type==="bpmn:Participant"?A.id:(($=f(A))==null?void 0:$.id)??"":""},Ie=new Map,Xe=v=>{let R=Ie.get(v);return R||Ie.set(v,R={nodes:[],flows:[]}),R};for(const v of h)Xe(v.node.participant??"").nodes.push(v);for(const v of m)Xe(ye(v.flow.source)).flows.push(v);const Et=v=>{var R;return i.create("bpmn:SequenceFlow",{id:v.id,name:v.name??((R=v.condition)==null?void 0:R.label)})},nt=(v,R)=>r.createShape({type:vs(v.type),businessObject:i.create(vs(v.type),{id:v.id,name:v.name,...R!==void 0?{"bwl:band":R}:{}})}),Ht=[...W.map(({op:v})=>v.participant.id).filter(v=>Ie.has(v)),...[...Ie.keys()].filter(v=>!g.some(R=>R.participant.id===v))],Xt=v=>v.endsWith("Gateway");for(const v of Ht){const R=Ie.get(v),A=v?p(v):void 0,$=A?A.x+150:250;let B=A?A.y+80:120;const I=(se,ve,me)=>{if(se){const Ae=p(se);return Ae.y+Math.min(Ae.height/2,ae)+wt(se,ve??0)*k}return ve!==void 0&&A?A.y+F+wt(`pool:${v}`,ve)*k:me},G=(se,ve,me)=>{if(se){const Ae=p(se);return Ae.y+Math.min(Ae.height/2,ae)+ve*k}return A?A.y+F+ve*k:me},z=se=>se.participant?p(se.participant):u(),V=(se,ve,me,Ae,it,Qe)=>{const Yt=me!==void 0||Ae!==void 0,xn=wt(me??`pool:${v}`,Ae??0);if(Yt)for(let ne=0;ne<4;ne++){const ee=G(me,xn+ne,Qe);if(!Y(se,ve,it,ee))return j(me,xn+ne,A),{x:it,y:ee}}const Ee=I(me,Ae,Qe);Yt&&j(me,xn,A);let Je=it;for(let ne=0;ne<64;ne++){const ee=Y(se,ve,Je,Ee);if(!ee)break;Je=ee.x+ee.width+O+ve.width/2}return{x:Je,y:Ee}},X=new Set(R.flows.map(se=>se.flow.target)),pe=new Map;for(const se of R.nodes){if(X.has(se.node.id))continue;const ve=nt(se.node,se.band),me=re(se),Ae=se.node.lane?`${se.node.lane}|${me??""}`:me!==void 0?`band:${me}`:"",it=z(se.node),Qe=V(it,ve,se.node.lane,me,pe.get(Ae)??$,B);n.createShape(ve,Qe,it),pe.set(Ae,Qe.x+ve.width+O),!se.node.lane&&me===void 0&&(B+=160)}const xe=new Set,ie=new Map,Me=new Map,ce=new Map;if(v&&le.has(`pool:${v}`)){const se=new Map;for(const Ee of R.flows)se.set(Ee.flow.target,(se.get(Ee.flow.target)??0)+1);const ve=Ee=>I(Ee.node.lane,U(Ee),Number.NaN),me=new Set,Ae=Ee=>{var ee;const Je=(ee=C.get(Ee))==null?void 0:ee.node.participant;if(Je)return l(Je);const ne=l(Ee);if(ne)return ne.type==="bpmn:Participant"?ne:f(ne)},it=Ee=>{const Je=[],ne=new Set([Ee]),ee=[Ee];for(;ee.length;){const be=ee.shift(),Te=C.get(be);Te&&Je.push(Te);for(const Se of R.flows)Se.flow.source!==be||ne.has(Se.flow.target)||(se.get(Se.flow.target)??0)!==1||(ne.add(Se.flow.target),ee.push(Se.flow.target))}return Je},Qe=Ee=>{if(!A)return;const Je=new Set(Ee.map(be=>be.node.id));let ne=!1,ee=!1;for(const be of w){if(!Je.has(be.flow.source))continue;const Te=Ae(be.flow.target);!Te||Te.id===A.id||(Te.y<A.y?ne=!0:ee=!0)}return ne&&!ee?"up":ee&&!ne?"down":void 0};for(const Ee of R.nodes){if(!Xt(Ee.node.type))continue;const Je=I(Ee.node.lane,re(Ee),Number.NaN);if(Number.isNaN(Je))continue;const ne=[];for(const Se of R.flows){if(Se.flow.source!==Ee.node.id)continue;const je=C.get(Se.flow.target);if(!je||je.node.lane!==Ee.node.lane||(se.get(je.node.id)??0)!==1)continue;const tt=re(je);if(tt===void 0)continue;const Gt=I(je.node.lane,tt,Number.NaN);if(Number.isNaN(Gt))continue;const oi=it(je.node.id),Ct=Qe(oi);Ct&&ne.push({subtree:oi,band:tt,row:Gt,dir:Ct})}if(!ne.some(Se=>Se.dir==="up")||!ne.some(Se=>Se.dir==="down")||!ne.some(Se=>Se.dir==="up"&&ne.some(je=>je.dir==="down"&&je.row<Se.row)))continue;const be=[...ne].sort((Se,je)=>Se.row-je.row);[...ne.filter(Se=>Se.dir==="up"),...ne.filter(Se=>Se.dir==="down")].sort((Se,je)=>Se.dir===je.dir?Se.row-je.row:Se.dir==="up"?-1:1).forEach((Se,je)=>{const tt=be[je].band;if(tt!==Se.band){me.add(Ee.node.id);for(const Gt of Se.subtree)re(Gt)===Se.band&&q.set(Gt.node.id,tt)}})}const Yt=Ee=>{if(!A)return;const Je=new Set(Ee.map(be=>be.node.id));let ne=!1,ee=!1;for(const be of w){if(!Je.has(be.flow.target))continue;const Te=Ae(be.flow.source);!Te||Te.id===A.id||(Te.y<A.y?ne=!0:ee=!0)}return ne&&!ee?"up":ee&&!ne?"down":void 0};for(const Ee of R.nodes){if(!Xt(Ee.node.type))continue;const Je=Ee.node.lane??`pool:${v}`,ne=ue.get(Je);if(!ne||ne.size<2)continue;const ee=ne.get(0);if(ee===void 0)continue;const be=Math.max(...ne.values()),Te=ee===be&&ee!==0?"down":void 0;if(!Te)continue;const Se=[];for(const Ct of R.flows){if(Ct.flow.source!==Ee.node.id)continue;const dt=C.get(Ct.flow.target);if(!dt||dt.node.lane!==Ee.node.lane||(se.get(dt.node.id)??0)!==1)continue;const es=U(dt);es!==void 0&&Se.push({t:dt,subtree:it(dt.node.id),band:es})}const je=Se.find(Ct=>(ne.get(Ct.band)??Ct.band)===ee);if(!je||Yt(je.subtree)===Te||Qe(je.subtree)===Te)continue;const tt=Se.find(Ct=>Ct!==je&&Yt(Ct.subtree)===Te);if(!tt)continue;const Gt=je.band,oi=tt.band;for(const Ct of je.subtree)U(Ct)===Gt&&q.set(Ct.node.id,oi);for(const Ct of tt.subtree)U(Ct)===oi&&q.set(Ct.node.id,Gt);me.add(Ee.node.id)}for(const Ee of R.nodes){if(!Xt(Ee.node.type))continue;const Je=ve(Ee);if(Number.isNaN(Je)||S.some(Se=>{var je,tt;return(((je=Se.placement)==null?void 0:je.anchor)??(Se.association?Se.association.source===Se.annotation.id?Se.association.target:Se.association.source:void 0))===Ee.node.id&&((tt=Se.placement)==null?void 0:tt.side.startsWith("bottom"))}))continue;let ee,be=!1,Te;for(const Se of R.flows){if(Se.flow.source!==Ee.node.id)continue;const je=C.get(Se.flow.target);if(!je||!je.node.lane&&re(je)===void 0)continue;const tt=ve(je);Number.isNaN(tt)||(Math.abs(tt-Je)<.5&&(be=!0),tt>Je?!ee||tt>ee.row?ee={id:je.node.id,row:tt,count:1}:tt===ee.row&&ee.count++:tt<Je&&je.node.lane===Ee.node.lane&&(!Te||tt>Te.row?Te={op:je,row:tt,count:1}:tt===Te.row&&Te.count++))}ee&&ee.count===1&&(se.get(ee.id)??0)===1&&!me.has(Ee.node.id)&&xe.add(ee.id),!be&&Te&&Te.count===1&&(se.get(Te.op.node.id)??0)===1&&!Z.has(Ee.node.id)&&ie.set(Te.op.node.id,{lane:Ee.node.lane,band:U(Ee)})}const xn=new Map;for(const Ee of w)xn.set(Ee.flow.target,[...xn.get(Ee.flow.target)??[],Ee]);for(const Ee of R.nodes){const Je=xn.get(Ee.node.id);if(!Je||Je.length!==1||!se.get(Ee.node.id)||!Ee.node.lane&&re(Ee)===void 0||He.has(Ee.node.id))continue;const ne=(Xx=C.get(Je[0].flow.source))==null?void 0:Xx.node.participant,ee=ne?l(ne):void 0;if(!ee||!A||ee.id===A.id)continue;const be=Ee.node.lane??`pool:${v}`,Te=ue.get(be);if(!Te)continue;const Se=Te.get(0)??0,je=(Te.get(U(Ee)??0)??Se)-Se;if(je===0)continue;const tt=ee.y<A.y;if(tt&&je<0||!tt&&je>0)continue;let Gt;for(const[oi,Ct]of Te){const dt=Ct-Se;(tt&&dt<0&&(!Gt||dt<Gt.row)||!tt&&dt>0&&(!Gt||dt>Gt.row))&&(Gt={band:oi,row:dt})}Gt&&Me.set(Ee.node.id,{lane:Ee.node.lane,band:Gt.band})}}const we=new Set;let at=0;for(;at++<R.nodes.length+2;){for(let me=0;me<R.nodes.length+R.flows.length+2;me++){let Ae=!1;for(const it of R.flows){const Qe=it.flow;if(we.has(Qe.id))continue;const Yt=l(Qe.source);if(!Yt)continue;const xn=l(Qe.target),Ee=C.get(Qe.target);if(!xn&&Ee){const Je=nt(Ee.node,Ee.band),ne=U(Ee);if(Ee.node.lane||ne!==void 0){const ee=z(Ee.node),be=Yt,Te=be.x+(ce.get(Qe.source)??0)+be.width+O,Se=ie.get(Qe.target)??Me.get(Qe.target),je=V(ee,Je,Se?Se.lane:Ee.node.lane,Se?Se.band:ne,xe.has(Qe.target)?be.x+be.width/2:Te,Number.NaN),tt=n.createShape(Je,je,ee);xe.has(Qe.target)&&ce.set(Qe.target,Te-(tt.x+tt.width/2)),n.connect(Yt,tt,{type:"bpmn:SequenceFlow",businessObject:Et(Qe)})}else s.append(Yt,Je,{connection:{type:"bpmn:SequenceFlow",businessObject:Et(Qe)}})}else if(xn)n.connect(Yt,xn,{type:"bpmn:SequenceFlow",businessObject:Et(Qe)});else continue;we.add(Qe.id),Ae=!0}if(!Ae)break}const se=R.nodes.filter(me=>!l(me.node.id));if(!se.length)break;const ve=se[0];{const me=nt(ve.node,ve.band),Ae=z(ve.node),it=re(ve);n.createShape(me,V(Ae,me,ve.node.lane,it,$,B),Ae),!ve.node.lane&&it===void 0&&(B+=160)}}}const ln=40,et=(v,R=()=>!0)=>{const A=l(v);if(!A)return[];const $=[A],B=new Set([v]);for(let I=0;I<$.length;I++){const G=$[I].id;for(const z of m){const V=z.flow.target;if(z.flow.source!==G||B.has(V)||!C.has(V))continue;B.add(V);const X=l(V);X&&R(X)&&$.push(X)}}return $},zt=(v,R=()=>!0)=>{const A=l(v);if(!A)return[];const $=[A],B=new Set([v]);for(let I=0;I<$.length;I++){const G=$[I].id;for(const z of m){const V=z.flow.source;if(z.flow.target!==G||B.has(V)||!C.has(V))continue;B.add(V);const X=l(V);X&&R(X)&&$.push(X)}}return $},Zt=30,Wi=v=>!("waypoints"in v&&v.waypoints)&&v.type!=="bpmn:Lane"&&v.type!=="label"&&typeof v.x=="number",bn=(v,R)=>{const A=new Set(v.flatMap(G=>G.subtree.map(z=>z.id)));for(const G of v){const z=(G.pool.children??[]).filter(Wi).filter(X=>!A.has(X.id));if(G.subtree.some(X=>z.some(pe=>X.x+R<pe.x+pe.width+Zt&&X.x+R+X.width+Zt>pe.x&&X.y<pe.y+pe.height&&X.y+X.height>pe.y)))return null}const $=v.map(G=>G.pool.width),B=o.filter(G=>G.type==="label").map(G=>({label:G,x:G.x,y:G.y}));n.moveElements(v.flatMap(G=>G.subtree),{x:R,y:0});const I=v.map(G=>{const V=Math.max(...G.subtree.map(X=>X.x+X.width))+150-(G.pool.x+G.pool.width);return V>0&&n.resizeShape(G.pool,{x:G.pool.x,y:G.pool.y,width:G.pool.width+V,height:G.pool.height}),V});return()=>{n.moveElements(v.flatMap(G=>G.subtree),{x:-R,y:0}),v.forEach((G,z)=>{I[z]>0&&n.resizeShape(G.pool,{x:G.pool.x,y:G.pool.y,width:$[z],height:G.pool.height})});for(let G=0;G<3;G++){let z=0;for(const V of B){const X=V.x-V.label.x,pe=V.y-V.label.y;Math.abs(X)<=.5&&Math.abs(pe)<=.5||(n.moveElements([V.label],{x:X,y:pe}),z++)}if(!z)break}}},ri=()=>{const v=mt(o),R=A=>A.length>=2&&(A.every($=>Math.abs($.x-A[0].x)<.01)||A.every($=>Math.abs($.y-A[0].y)<.01));return{messages:v.edges.filter(A=>A.type==="bpmn:MessageFlow"&&A.waypoints.length===2).length,lines:v.edges.filter(A=>R(A.waypoints)).length}},Zn=v=>{const R=B=>{const I=[B],G=new Set([B.id]);for(let z=0;z<I.length;z++)for(const V of I[z].outgoing??[]){if(V.type!=="bpmn:SequenceFlow")continue;const X=V.target;!X||G.has(X.id)||v.has(X.id)||!Wi(X)||X.x<B.x||(G.add(X.id),I.push(X))}return I},A=new Set(v),$=[];for(const B of o.getAll()){if(B.type!=="bpmn:MessageFlow")continue;const I=B;if(!I.waypoints||I.waypoints.length!==2)continue;const G=I.source,z=I.target;if(!G||!z)continue;const V=v.has(G.id);if(V===v.has(z.id))continue;const X=V?z:G,pe=f(X);if(!pe||A.has(X.id))continue;const xe=R(X).filter(ie=>!A.has(ie.id));if(xe.length){for(const ie of xe)A.add(ie.id);$.push({subtree:xe,pool:pe})}}return $};for(const v of Ut(e,"sequenceFlow.update")){if(v.target===void 0)continue;const R=C.get(v.target);if(!R)continue;const A=l(v.target),$=l(v.id);if(!A||!$)continue;const B=v.source!==void 0?l(v.source):$.source,I=$.target;if(!B||!I||I.id===A.id)continue;const G=et(v.target),z=new Set(G.map(ce=>ce.id)),V=Math.min(...G.map(ce=>ce.x)),X=Math.max(...G.map(ce=>ce.x+ce.width)),pe=B.x+B.width,xe=X-V+ln*2-(I.x-pe);if(xe>0){const ce=f(A),we=(ce==null?void 0:ce.children)??[],at=me=>me.type==="bpmn:Lane",se=we.filter(me=>!("waypoints"in me&&me.waypoints)&&!at(me)&&!z.has(me.id)&&me.x>=I.x),ve=ce?[ce,...we.filter(me=>at(me))]:[];if(se.length){const me=Zn(new Set(se.map(Ae=>Ae.id)));n.createSpace(se,ve,{x:xe,y:0},"e",I.x-1);for(const Ae of me){const it=ri(),Qe=bn([Ae],xe);if(!Qe)continue;const Yt=ri();(Yt.messages<=it.messages||Yt.lines<it.lines)&&Qe()}}}const ie=R.node.lane||R.band!==void 0?A.y+A.height/2:B.y+B.height/2;n.moveElements(G,{x:pe+ln-V,y:ie-(A.y+A.height/2)});const Me=f(A);if(R.node.lane===void 0&&R.band!==void 0&&Me){const ce=Me.y+F+wt(`pool:${R.node.participant??""}`,R.band)*k,we=ce-(A.y+A.height/2);we!==0&&!Y(Me,A,A.x+A.width/2,ce,z)&&n.moveElements([A],{x:0,y:we})}}const It=(v,R)=>{const A=R.target===v,$=p(R.source),B=p(R.target),I=A?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect($,B,R.id?{type:I,businessObject:i.create(I,{id:R.id})}:{type:I})},qr=100,Za=v=>{for(const R of g){if(!R.participant.blackBox)continue;const A=l(R.participant.id);if(!A)continue;const $=[];for(const I of w){const G=I.flow.source===R.participant.id?I.flow.target:I.flow.target===R.participant.id?I.flow.source:void 0,z=G?l(G):void 0;z&&typeof z.x=="number"&&z.type!=="bpmn:Participant"&&$.push(z)}if(!$.length)continue;const B=Math.max(...$.map(I=>I.x+I.width/2))+qr;if(B>A.x+A.width&&n.resizeShape(A,{x:A.x,y:A.y,width:B-A.x,height:A.height}),!!v)for(const I of w){const G=l(I.flow.id),z=I.flow.source===R.participant.id?I.flow.target:I.flow.target===R.participant.id?I.flow.source:void 0,V=z?l(z):void 0;if(!G||!V||V.type==="bpmn:Participant")continue;const X=V.x+V.width/2;if(X<A.x+10||X>A.x+A.width-10)continue;const pe=A.y>V.y,xe=pe?V.y+V.height:V.y,ie=pe?A.y:A.y+A.height,Me=I.flow.source===R.participant.id?[{x:X,y:ie},{x:X,y:xe}]:[{x:X,y:xe},{x:X,y:ie}],ce=mt(o),we={...ce.edges.find(at=>at.id===I.flow.id),waypoints:Me};gn(we,ti(ce)).length||n.updateWaypoints(G,Me)}}};Za(!1);for(const v of w){const R=v.flow;n.connect(p(R.source),p(R.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:R.id,name:R.name})})}{const A=new Set([...m.map(V=>V.flow.id),...w.map(V=>V.flow.id)].filter(V=>!!V)),$=o.filter(V=>!!V.waypoints),B=(V,X)=>Math.abs(X.x-V.x)<2?"L":Math.abs(X.x-(V.x+V.width))<2?"R":Math.abs(X.y-V.y)<2?"T":Math.abs(X.y-(V.y+V.height))<2?"B":void 0,I=new Map,G=(V,X,pe)=>{if(!V||!X||typeof V.x!="number")return;const xe=B(V,X);if(!xe)return;let ie=I.get(V.id);ie||I.set(V.id,ie=new Map),ie.set(xe,[...ie.get(xe)??[],pe])};for(const V of $){const X=V.waypoints;!X||X.length<2||(G(V.source,X[0],{id:V.id,dir:"out"}),G(V.target,X[X.length-1],{id:V.id,dir:"in"}))}const z=new Set;for(const[V,X]of I){const pe=l(V);if(!pe||typeof pe.x!="number"||![...X.values()].some(ve=>{const me=ve.filter(Ae=>Ae.dir==="in");return ve.length>=3&&me.length>=1&&ve.some(Ae=>Ae.dir==="out")&&me.some(Ae=>A.has(Ae.id))}))continue;const ie=f(pe);if(!ie||z.has(ie.id)||(ie.children??[]).some(ve=>ve.type==="bpmn:Lane"))continue;const Me=(Zx=X.get("T"))!=null&&Zx.length?(Qx=X.get("B"))!=null&&Qx.length?void 0:"B":"T";if(!Me||(Me==="T"?pe.y-ie.y:ie.y+ie.height-(pe.y+pe.height))>=k)continue;const we=(ie.children??[]).filter(ve=>!("waypoints"in ve&&ve.waypoints)&&ve.type!=="label"&&typeof ve.x=="number"),at=ie.y+ie.height;n.resizeShape(ie,{x:ie.x,y:ie.y,width:ie.width,height:ie.height+k});const se=u().children.filter(ve=>!("waypoints"in ve&&ve.waypoints)&&ve.id!==ie.id&&typeof ve.y=="number"&&ve.y>=at);se.length&&n.moveElements(se,{x:0,y:k}),Me==="T"&&we.length&&n.moveElements(we,{x:0,y:k}),z.add(ie.id)}}const _n=20,Ze=4,rt=2,$D=[10,30,80],zo=()=>{const v=mt(o);return{bad:li(v).filter(R=>R.kind==="edge-crosses-shape"||R.kind==="edge-overlap-opposite"||R.kind==="edge-overlap-mixed").length,crossings:Hd(v),straight:v.edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.waypoints.length===2).length}},Go=v=>{const R=mt(o),A=R.edges.find($=>$.id===v);return A?gn(A,ti(R)).length:0},Su=v=>Go(v)>0,Ru=v=>mt(o).edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.id!==v&&R.waypoints.length===2).length,jD=(v,R,A)=>bn([{subtree:v,pool:R}],A),Nx=(v,R)=>R.bad>v.bad||R.crossings>v.crossings&&R.straight<=v.straight&&R.bad>=v.bad,Cu=(v,R)=>Nx(v,R)||R.straight<v.straight,Pu=(v,R,A=()=>!0,$=Nx)=>{const B=zo(),I=bn(v,R);if(!I)return!1;const G=zo();return $(B,G)||!A()?(I(),!1):!0},Bx=(v,R,A,$=()=>!0)=>Pu([{subtree:v,pool:R}],A,$),Yr=v=>{var R;return!!((R=C.get(v))!=null&&R.node.participant)},Qa=new Map;for(const v of w){if(!Yr(v.flow.target))continue;const R=Qa.get(v.flow.target)??[];R.push(v),Qa.set(v.flow.target,R)}const Zf=[...Qa.keys()],$x=new Set(m.map(v=>v.flow.target)),jx=v=>W.findIndex(({op:R})=>R.participant.id===v);Zf.sort((v,R)=>{var B,I;const A=$x.has(v)?1:0,$=$x.has(R)?1:0;return A!==$?A-$:jx((B=C.get(v))==null?void 0:B.node.participant)-jx((I=C.get(R))==null?void 0:I.node.participant)});const Kr=v=>v.x+v.width/2,FD=v=>{const R=new Map;for(const B of o.getAll()){const I=B;if(!I.waypoints||!I.source||!I.target)continue;(R.get(I.source.id)??R.set(I.source.id,[]).get(I.source.id)).push(I.target.id)}const A=new Set([v]),$=[v];for(let B=0;B<$.length;B++)for(const I of R.get($[B])??[])A.has(I)||(A.add(I),$.push(I));return A},HD=(v,R)=>{const A=FD(R);let $;for(const B of o.getAll()){const I=B;if(I.type!=="bpmn:MessageFlow"||!I.source||!I.target||I.target.id!==v||A.has(I.source.id))continue;const G=I.source;if(typeof G.x!="number"||G.type==="bpmn:Participant")continue;const z=Kr(G);($===void 0||z>$)&&($=z)}return $},Qf=(v,R)=>{const A=l(v.flow.source);if(A)return A.type==="bpmn:Participant"?HD(A.id,R):Kr(A)},Fx=v=>{let R;for(const A of Qa.get(v)??[]){const $=Qf(A,v);$!==void 0&&(!R||$>R.cx)&&(R={op:A,cx:$})}return R==null?void 0:R.op},zD=v=>{const R=Fx(v),A=l(v),$=R?Qf(R,v):void 0;return A&&$!==void 0?$-Kr(A):void 0},GD=v=>{const R=zD(v);return R!==void 0&&Math.abs(R)<_n},Hx=(v,R,A,$,B)=>{var I;for(let G=!0;G;){G=!1;for(const z of w){if(z.flow.id===A)continue;const V=R.has(z.flow.source),X=R.has(z.flow.target);if(V===X||$(V?z.flow.source:z.flow.target))continue;const pe=V?z.flow.target:z.flow.source;if(B(pe)||!Yr(pe))continue;const xe=l(z.flow.id);if(!(xe!=null&&xe.waypoints)||xe.waypoints.length!==2)continue;const ie=l(pe),Me=(I=C.get(pe))==null?void 0:I.node.participant;if(!ie||!Me)continue;const ce=et(pe,we=>we.x>=ie.x).filter(we=>!R.has(we.id));if(!(!ce.length||ce.some(we=>B(we.id)))){for(const we of ce)R.add(we.id);v.set(Me,[...v.get(Me)??[],...ce]),G=!0}}}return[...v].map(([G,z])=>({subtree:z,pool:p(G)}))},zx=(v,R,A,$,B)=>Hx(new Map([[R,[...v]]]),new Set(v.map(I=>I.id)),$,I=>I===A,I=>I===B),Jf=v=>{const R=Fx(v);if(!R)return null;const A=l(v),$=l(R.flow.source),B=Qf(R,v);if(!A||!$||B===void 0)return null;const I=B-Kr(A);if(I>=_n){const G=C.get(v).node.participant,z=et(v,V=>V.x>=A.x);return{groups:zx(z,G,v,R.flow.id,R.flow.source),dx:I}}if(-I>=_n&&Yr(R.flow.source)){const G=C.get(R.flow.source).node.participant,z=et(R.flow.source,V=>V.x>=$.x&&!GD(V.id));return{groups:zx(z,G,R.flow.source,R.flow.id,v),dx:-I}}return null},Gx=()=>Zf.map(v=>({id:v,plan:Jf(v)})).filter(v=>!!v.plan).sort((v,R)=>Math.min(...v.plan.groups.flatMap(A=>A.subtree.map($=>$.x)))-Math.min(...R.plan.groups.flatMap(A=>A.subtree.map($=>$.x)))).map(v=>v.id);for(let v=0;v<3;v++){const R=zo(),A=[];for(const B of Gx()){const I=Jf(B);if(!I)continue;const G=bn(I.groups,I.dx);G&&A.push(G)}if(!A.length)break;if(!Cu(R,zo()))continue;for(const B of A.reverse())B();let $=!1;for(const B of Gx()){const I=Jf(B);I&&Pu(I.groups,I.dx,()=>!0,Cu)&&($=!0)}if(!$)break}for(const v of Zf.flatMap(R=>Qa.get(R)??[])){if(!Su(v.flow.id))continue;const R=l(v.flow.target);if(!R)continue;const A=p(C.get(v.flow.target).node.participant),$=et(v.flow.target,z=>z.x>=R.x),B=R.width+O,I=Go(v.flow.id),G=Ru(v.flow.id);for(let z=1;z<=Ze;z++){const V=()=>Go(v.flow.id)<I&&Ru(v.flow.id)>=G;if(Bx($,A,B*z,V))break}}for(const v of w){if(!Su(v.flow.id))continue;const R=l(v.flow.source),A=l(v.flow.target);if(!R||!A||R.type==="bpmn:Participant"||A.type==="bpmn:Participant")continue;const $=R.x+R.width/2;if(Math.abs($-(A.x+A.width/2))>15)continue;const[B,I]=R.y<A.y?[R.y+R.height,A.y]:[A.y+A.height,R.y],G=[...C.values()].map(z=>l(z.node.id)).filter(z=>!!z&&z.id!==R.id&&z.id!==A.id).filter(z=>z.x<=$&&$<=z.x+z.width&&z.y+z.height>B&&z.y<I).sort((z,V)=>z.x-V.x);for(const z of G){const V=(Jx=C.get(z.id))==null?void 0:Jx.node.participant,X=V?l(V):void 0;if(!X)continue;const pe=[...C.values()].filter(me=>me.node.participant===V).map(me=>me.node.id),xe=me=>me.map(Ae=>l(Ae)).filter(Ae=>!!Ae),Me=[zt(z.id,me=>{var Ae;return((Ae=C.get(me.id))==null?void 0:Ae.node.participant)===V}),xe(pe)].filter(me=>me.length),ce=z.width+O,we=Go(v.flow.id),at=Ru(v.flow.id),se=()=>Go(v.flow.id)<we&&Ru(v.flow.id)>=at;let ve=!1;for(const me of Me){for(let Ae=1;Ae<=Ze;Ae++)if(Bx(me,X,ce*Ae,se)){ve=!0;break}if(ve)break}if(!Su(v.flow.id))break}}for(const v of w){if(!Su(v.flow.id))continue;const R=l(v.flow.id);if(((e0=R==null?void 0:R.waypoints)==null?void 0:e0.length)!==2)continue;const A=l(v.flow.source),$=l(v.flow.target);if(!A||!$||A.type==="bpmn:Participant"||$.type==="bpmn:Participant"||!Yr(v.flow.source)||!Yr(v.flow.target)||Math.abs(Kr(A)-Kr($))>rt)continue;const B=Kr(A),I=R.waypoints.map(we=>we.y),[G,z]=[Math.min(...I),Math.max(...I)],V=ti(mt(o)).filter(we=>we.id!==A.id&&we.id!==$.id&&we.x<B&&B<we.x+we.width&&G<we.y+we.height&&we.y<z);if(!V.length)continue;const X=(t0=C.get(v.flow.source))==null?void 0:t0.node.participant,pe=(n0=C.get(v.flow.target))==null?void 0:n0.node.participant;if(!X||!pe)continue;const xe=new Map;for(const[we,at,se]of[[v.flow.source,A,X],[v.flow.target,$,pe]]){const ve=xe.get(se)??[],me=et(we,Ae=>Ae.x>=at.x).filter(Ae=>!ve.some(it=>it.id===Ae.id));xe.set(se,[...ve,...me])}const ie=new Set([...xe.values()].flat().map(we=>we.id)),Me=Hx(xe,ie,v.flow.id,we=>we===v.flow.source||we===v.flow.target,()=>!1),ce=Math.max(...V.map(we=>we.x+we.width));for(const we of $D){const at=ce+we-B;if(at<=0)continue;if(Pu(Me,at,()=>{var ve,me;return Go(v.flow.id)===0&&((me=(ve=l(v.flow.id))==null?void 0:ve.waypoints)==null?void 0:me.length)===2},Cu))break}}{const v=A=>A.y+A.height/2,R=[];for(const A of C.keys()){if(!Yr(A))continue;const $=m.filter(G=>G.flow.target===A);if($.length!==1)continue;const B=l($[0].flow.source),I=l(A);!B||!I||!C.has(B.id)||Math.abs(v(B)-v(I))>1||I.x-(B.x+B.width)<=O+1||R.push({id:A,pred:B,node:I})}R.sort((A,$)=>A.node.x-$.node.x);for(const{id:A}of R){const $=C.get(A),B=l(A),I=l(m.find(ie=>ie.flow.target===A).flow.source);if(!B||!I)continue;const G=B.x-(I.x+I.width);if(G<=O+1)continue;const z=p($.node.participant),V=et(A,ie=>ie.x>=B.x),X=zo(),pe=jD(V,z,-(G-O));if(!pe)continue;const xe=zo();(xe.bad>X.bad||xe.crossings>=X.crossings||xe.straight<X.straight)&&pe()}}Za(!0);for(const v of y){const R=v.associations??[],A=R.map(I=>I.source===v.dataStore.id?I.target:I.source).map(l).find(Boolean),$=A?f(A)??u():u(),B=A?{x:A.x+A.width/2,y:A.y+A.height+110}:{x:200,y:K+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:v.dataStore.id,name:v.dataStore.name})},B,$);for(const I of R)It(v.dataStore.id,I)}for(const v of _){const A=p(v.association.target).type==="bpmn:DataStoreReference"?v.association.target:v.association.source;It(A,v.association)}let Vx=0;const Xr=10,Wx=40,VD=(v,R)=>{const A=R.map(V=>f(V)).filter(V=>!!V);for(const V of A){const X=Xr,pe=V.y,xe=V.y+V.height,ie=V.x,Me=V.x+V.width;if(Math.abs(v.y-pe)<X){const ce=pe+X-v.y;v.y+=ce,v.height-=ce}if(Math.abs(v.y+v.height-xe)<X&&(v.height=xe-X-v.y),Math.abs(v.x-ie)<X){const ce=ie+X-v.x;v.x+=ce,v.width-=ce}Math.abs(v.x+v.width-Me)<X&&(v.width=Me-X-v.x)}if(!A.length)return;const $=Math.min(...A.map(V=>V.y)),B=Math.max(...A.map(V=>V.y+V.height)),I=$-v.y,G=v.y+v.height-B,z=Wx-Xr;if(I>0!=G>0)if(I>0&&I<z){const V=I+Xr;v.y+=V,v.height-=V}else G>0&&G<z&&(v.height-=G+Xr)},WD=(v,R)=>{const A=Xr,$=30,B=o.filter(I=>I.type==="bpmn:Group"&&I.id!==R);for(const I of B){const G=I.x,z=I.x+I.width,V=I.y,X=I.y+I.height,pe=v.y<X&&V<v.y+v.height,xe=v.x<z&&G<v.x+v.width;if(pe){if(Math.abs(v.x-z)<A){const ie=Math.min(z+A-v.x,$);ie>0&&v.width-ie>0&&(v.x+=ie,v.width-=ie)}if(Math.abs(v.x+v.width-G)<A){const ie=Math.min(v.x+v.width-(G-A),$);ie>0&&v.width-ie>0&&(v.width-=ie)}}if(xe){if(Math.abs(v.y-X)<A){const ie=Math.min(X+A-v.y,$);ie>0&&v.height-ie>0&&(v.y+=ie,v.height-=ie)}if(Math.abs(v.y+v.height-V)<A){const ie=Math.min(v.y+v.height-(V-A),$);ie>0&&v.height-ie>0&&(v.height-=ie)}}}},ed=(v,R)=>{const A=Wx,$=Math.min(...v.map(V=>V.x))-A,B=Math.min(...v.map(V=>V.y))-A,I=Math.max(...v.map(V=>V.x+V.width))+A,G=Math.max(...v.map(V=>V.y+V.height))+A,z={x:$,y:B,width:I-$,height:G-B};return VD(z,v),WD(z,R),z};for(const v of P){const R=(v.group.members??[]).map(l).filter(B=>!!B);let A;R.length?A=ed(R,v.group.id):(A={x:300+Vx*350,y:40,width:300,height:200},Vx++);const $=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:v.group.id}),width:A.width,height:A.height},{x:A.x+A.width/2,y:A.y+A.height/2},u());v.group.name&&n.updateLabel($,v.group.name),(i0=v.group.members)!=null&&i0.length&&D($,"bwl:Members",{refs:v.group.members.join(" ")})}{const v=o.filter(B=>!!B.waypoints),R=new Map,A=(B,I)=>{!B||!I||(R.has(B)||R.set(B,new Set),R.get(B).add(I))};for(const B of v){const I=(r0=B.source)==null?void 0:r0.id,G=(o0=B.target)==null?void 0:o0.id;A(I,G),((a0=B.type)!=null&&a0.includes("DataOutputAssociation")||(s0=B.type)!=null&&s0.includes("DataInputAssociation")||B.type==="bpmn:Association")&&A(G,I)}const $=o.filter(B=>B.type==="bpmn:Group");for(const B of $){const G=(((c0=B.businessObject.extensionElements)==null?void 0:c0.values)??[]).find(se=>se.$type==="bwl:Members"),z=((G==null?void 0:G.refs)??"").split(" ").filter(Boolean);if(!z.length)continue;const V=new Set(z),X=[...z];for(;X.length;){const se=X.shift();for(const ve of R.get(se)??[])V.has(ve)||(V.add(ve),X.push(ve))}const pe=B.x,xe=B.x+B.width,ie=B.y,Me=B.y+B.height,ce=se=>m.filter(ve=>ve.flow.target===se).length,we=se=>{var me;const ve=((me=l(se))==null?void 0:me.type)??"";if(ve==="bpmn:StartEvent"&&ce(se)===0)return!1;if(ve.endsWith("Gateway")){const Ae=m.filter(it=>it.flow.target===se).map(it=>it.flow.source);if(Ae.length&&Ae.every(it=>{var Qe;return((Qe=l(it))==null?void 0:Qe.type)==="bpmn:StartEvent"&&ce(it)===0}))return!1}return!0},at=o.filter(se=>Wi(se)).filter(se=>se.type!=="bpmn:Group"&&se.type!=="bpmn:Participant"&&se.type!=="bpmn:TextAnnotation"&&!V.has(se.id)&&Yr(se.id)&&we(se.id)&&se.x<xe&&se.x+se.width>pe&&se.y<Me&&se.y+se.height>ie);if(at.length)for(const se of[-1,1]){const ve=at.filter(ne=>(ne.x+ne.width-pe<=xe-ne.x?-1:1)===se);if(!ve.length)continue;const me=[];for(const ne of ve){const ee=me.find(be=>be.some(Te=>ne.y<Te.y+Te.height&&ne.y+ne.height>Te.y));ee?ee.push(ne):me.push([ne])}const Ae=new Map;for(const ne of me){let ee=se<0?pe-Xr:xe+Xr;for(const be of[...ne].sort((Te,Se)=>se<0?Se.x-Te.x:Te.x-Se.x)){const Te=se<0?Math.min(be.x,ee-be.width):Math.max(be.x,ee);ee=se<0?Te-Zt:Te+be.width+Zt,Te!==be.x&&Math.sign(Te-be.x)===se&&Ae.set(be.id,Te-be.x)}}const it=new Map,Qe=ne=>it.get(ne)===ne||!it.get(ne)?ne:Qe(it.get(ne));for(const ne of ve)it.set(ne.id,ne.id);for(const ne of w){const ee=Ae.has(ne.flow.source)?ne.flow.source:void 0,be=Ae.has(ne.flow.target)?ne.flow.target:void 0;if(!ee||!be)continue;const Te=l(ne.flow.id);((u0=Te==null?void 0:Te.waypoints)==null?void 0:u0.length)===2&&it.set(Qe(ee),Qe(be))}const Yt=new Map;for(const ne of ve){if(!Ae.has(ne.id))continue;const ee=Qe(ne.id);Yt.set(ee,[...Yt.get(ee)??[],ne])}const xn=[...Yt.values()].sort((ne,ee)=>se<0?Math.min(...ne.map(be=>be.x))-Math.min(...ee.map(be=>be.x)):Math.max(...ee.map(be=>be.x))-Math.max(...ne.map(be=>be.x))),Ee=[];let Je=!0;for(const ne of xn){const ee=ne.map(Se=>Ae.get(Se.id)??0).reduce((Se,je)=>Math.abs(je)>Math.abs(Se)?je:Se,0),be=new Map;let Te=!0;for(const Se of ne){const je=f(Se);if(!je){Te=!1;break}be.has(je.id)||be.set(je.id,{subtree:[],pool:je}),be.get(je.id).subtree.push(Se)}Te&&Pu([...be.values()],ee,()=>!0,Cu)?Ee.push({shapes:ne,dx:ee}):Je=!1}if(!Je)for(const ne of Ee.reverse())n.moveElements(ne.shapes,{x:-ne.dx,y:0})}}}{const v=new Set([...P.map(R=>R.group.id),...Ut(e,"group.update").map(R=>R.id)]);for(const R of o.filter(A=>A.type==="bpmn:Group")){if(v.has(R.id))continue;const $=(((l0=R.businessObject.extensionElements)==null?void 0:l0.values)??[]).find(z=>z.$type==="bwl:Members"),B=(($==null?void 0:$.refs)??"").split(" ").filter(Boolean).map(l).filter(z=>!!z);!B.length||!B.some(z=>{const V=d.get(z.id);return!V||V.x!==z.x||V.y!==z.y})||!B.some(z=>z.x<R.x||z.y<R.y||z.x+z.width>R.x+R.width||z.y+z.height>R.y+R.height)||n.resizeShape(R,ed(B,R.id))}}{const R=new Map(so(mt(o)).map(z=>[z.owner,z.rect])),A=o.filter(z=>!!z.waypoints),$=new Map,B=(z,V)=>{!z||!V||($.has(z)||$.set(z,new Set),$.get(z).add(V))};for(const z of A){const V=(p0=z.source)==null?void 0:p0.id,X=(f0=z.target)==null?void 0:f0.id;B(V,X),((d0=z.type)!=null&&d0.includes("DataOutputAssociation")||(h0=z.type)!=null&&h0.includes("DataInputAssociation")||z.type==="bpmn:Association")&&B(X,V)}const I=z=>m.filter(V=>V.flow.target===z).length,G=z=>{var X;const V=((X=l(z))==null?void 0:X.type)??"";if(V==="bpmn:StartEvent"&&I(z)===0)return!1;if(V.endsWith("Gateway")){const pe=m.filter(xe=>xe.flow.target===z).map(xe=>xe.flow.source);if(pe.length&&pe.every(xe=>{var ie;return((ie=l(xe))==null?void 0:ie.type)==="bpmn:StartEvent"&&I(xe)===0}))return!1}return!0};for(const z of o.filter(V=>V.type==="bpmn:Group")){const X=(((m0=z.businessObject.extensionElements)==null?void 0:m0.values)??[]).find(ee=>ee.$type==="bwl:Members"),pe=((X==null?void 0:X.refs)??"").split(" ").filter(Boolean);if(!pe.length)continue;const xe=pe.map(l).filter(ee=>!!ee);if(!xe.length||!(P.some(ee=>ee.group.id===z.id)||Ut(e,"group.update").some(ee=>ee.id===z.id)||xe.some(ee=>{const be=d.get(ee.id);return!be||be.x!==ee.x||be.y!==ee.y})))continue;const Me=new Set(pe),ce=[...pe];for(;ce.length;){const ee=ce.shift();for(const be of $.get(ee)??[])Me.has(be)||(Me.add(be),ce.push(be))}const we=z.x,at=z.x+z.width,se=z.y,ve=z.y+z.height,me=ee=>{const be=R.get(ee.id),Te={x:ee.x,y:ee.y,width:ee.width,height:ee.height};return be?[Te,{x:be.x,y:be.y,width:be.width,height:be.height}]:[Te]},Ae=xe.flatMap(me),it=Math.min(...Ae.map(ee=>ee.x)),Qe=Math.max(...Ae.map(ee=>ee.x+ee.width)),Yt=Math.min(...Ae.map(ee=>ee.y)),xn=Math.max(...Ae.map(ee=>ee.y+ee.height)),Ee={L:it-we,R:at-Qe,T:Yt-se,B:ve-xn},Je=o.filter(ee=>Wi(ee)).filter(ee=>ee.type!=="bpmn:Group"&&ee.type!=="bpmn:Participant"&&ee.type!=="bpmn:TextAnnotation"&&!Me.has(ee.id)&&G(ee.id)&&ee.x<at&&ee.x+ee.width>we&&ee.y<ve&&ee.y+ee.height>se);if(!Je.length)continue;const ne={L:0,R:0,T:0,B:0};for(const ee of Je){const be=me(ee),Te=Math.min(...be.map(dt=>dt.x)),Se=Math.max(...be.map(dt=>dt.x+dt.width)),je=Math.min(...be.map(dt=>dt.y)),tt=Math.max(...be.map(dt=>dt.y+dt.height)),Gt={L:Se-we,R:at-Te,T:tt-se,B:ve-je},oi=["L","R","T","B"].filter(dt=>Gt[dt]<=Ee[dt]+.001);if(!oi.length)continue;const Ct=oi.reduce((dt,es)=>Gt[es]<Gt[dt]?es:dt,oi[0]);ne[Ct]=Math.max(ne[Ct],Math.min(Gt[Ct]+10,Ee[Ct]))}!ne.L&&!ne.R&&!ne.T&&!ne.B||n.resizeShape(z,{x:z.x+ne.L,y:z.y+ne.T,width:z.width-ne.L-ne.R,height:z.height-ne.T-ne.B})}}const Ux=v=>{const R=v.waypoints;if(R!=null&&R.length){const $=R[Math.floor((R.length-1)/2)];return{x:$.x,y:$.y,width:0,height:0}}const A=v;return{x:A.x,y:A.y,width:A.width,height:A.height}};let Ja=0;const qx=12,Yx=14,UD=15,qD=300,YD=v=>{const R=v.split(`
|
|
7
|
-
`),A=Math.max(...R.map(I=>oo(I,qx))),$=Math.max(100,Math.min(qD,Math.ceil(A)+Yx)),B=R.reduce((I,G)=>I+Math.max(1,Math.ceil((oo(G,qx)+Yx)/$)),0);return{width:$,height:Math.max(30,B*UD+10)}};for(const v of S){const R=v.association,A=((g0=v.placement)==null?void 0:g0.anchor)??(R?R.source===v.annotation.id?R.target:R.source:void 0),$=A?l(A):void 0,B=$?Ux($):void 0,I=YD(v.annotation.text??"");let G;if(B&&v.placement){const[pe,xe]=bs[v.placement.side],ie=v.placement.offset??50;G={x:B.x+B.width/2+pe*(B.width/2+I.width/2+ie),y:B.y+B.height/2+xe*(B.height/2+I.height/2+ie)}}else B?(G={x:B.x+B.width/2+180+Ja%3*260,y:B.y-110-Ja%2*95},Ja++):(G={x:300+Ja*260,y:60},Ja++);const z=$?f($)??u():u(),V=z;B&&typeof V.x=="number"&&typeof V.width=="number"&&V.type==="bpmn:Participant"&&(G=ol(o,B,I,V,v.placement?{placement:v.placement}:{from:G}));const X=n.createShape({type:"bpmn:TextAnnotation",width:I.width,height:I.height,businessObject:i.create("bpmn:TextAnnotation",{id:v.annotation.id,text:v.annotation.text})},G,z);if(R){const pe=xe=>xe===v.annotation.id?X:p(xe);n.connect(pe(R.source),pe(R.target),R.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:R.id})}:{type:"bpmn:Association"})}v.placement&&D(X,"bwl:Placement",T(v.placement))}for(const v of Ut(e,"association.add")){const R=v.association;n.connect(p(R.source),p(R.target),R.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:R.id})}:{type:"bpmn:Association"})}for(const v of Ut(e,"node.update")){let R=p(v.id);if(v.type&&vs(v.type)!==R.type&&(R=c.replaceElement(R,{type:vs(v.type)})),v.name!==void 0&&n.updateProperties(R,{name:v.name??void 0}),v.lane||v.band!==void 0){v.band!==void 0&&n.updateProperties(R,{"bwl:band":v.band});const A=R.y+R.height/2,$=f(R),B=v.lane?p(v.lane):(($==null?void 0:$.children)??[]).find(G=>G.type==="bpmn:Lane"&&A>=G.y&&A<=G.y+G.height);v.band!==void 0&&j(B==null?void 0:B.id,v.band,$);const I=B?B.y+(v.band===void 0?B.height/2:Math.min(B.height/2,ae)+wt(B.id,v.band)*k):v.band!==void 0&&$?$.y+F+wt(`pool:${$.id}`,v.band)*k:void 0;if(I!==void 0){const G=I-A;G!==0&&n.moveElements([R],{x:0,y:G})}}}for(const v of Ut(e,"sequenceFlow.update")){const R=p(v.id);if(v.source!==void 0||v.target!==void 0){const A=R,$=v.source!==void 0?p(v.source):A.source,B=v.target!==void 0?p(v.target):A.target,I=G=>({x:G.x+G.width/2,y:G.y+G.height/2});n.reconnect(A,$,B,[I($),I(B)])}v.name!==void 0&&n.updateProperties(R,{name:v.name??void 0}),v.condition!==void 0&&n.updateProperties(R,{name:((y0=v.condition)==null?void 0:y0.label)??void 0})}for(const v of Ut(e,"messageFlow.update"))v.name!==void 0&&n.updateProperties(p(v.id),{name:v.name??void 0});for(const v of Ut(e,"dataStore.update"))v.name!==void 0&&n.updateProperties(p(v.id),{name:v.name??void 0});for(const v of Ut(e,"annotation.update")){const R=p(v.id);if(v.text!==void 0&&n.updateProperties(R,{text:v.text}),v.placement===null)D(R,"bwl:Placement",null);else if(v.placement){const A=p(v.placement.anchor),$=Ux(A),B=f(A)??u(),I=typeof B.x=="number"&&typeof B.width=="number"&&B.type==="bpmn:Participant",[G,z]=bs[v.placement.side],V=v.placement.offset??50,X={x:$.x+$.width/2+G*($.width/2+R.width/2+V),y:$.y+$.height/2+z*($.height/2+R.height/2+V)},pe=I?ol(o,$,{width:R.width,height:R.height},B,{placement:v.placement,selfId:v.id}):X;n.moveElements([R],{x:pe.x-(R.x+R.width/2),y:pe.y-(R.y+R.height/2)}),D(R,"bwl:Placement",T(v.placement))}}for(const v of Ut(e,"group.update")){const R=p(v.id);if(v.name!==void 0&&n.updateLabel(R,v.name??""),v.members){const A=v.members.map(l).filter($=>!!$);A.length&&n.resizeShape(R,ed(A,v.id)),D(R,"bwl:Members",{refs:v.members.join(" ")})}}}function al(e){switch(e.kind){case"annotation-over-label":return[e.annotation];case"edge-crosses-shape":return[e.shape];case"shape-outside-container":return[e.shape];case"shape-overlap":return e.shapes;default:return[]}}function ZE(e,t,n){var l,p;const{elementRegistry:i}=e,r=e.modeling,o=f=>li(f).filter(d=>!t.has(ui(d))),a=f=>{var d;return((d=i.get(f))==null?void 0:d.type)==="bpmn:TextAnnotation"},s=mt(i),c=o(s),u=[...new Set(c.flatMap(al))].filter(f=>n.has(f)&&a(f));if(u.length)for(const f of u){const d=i.get(f);if(!d||typeof d.x!="number"||typeof d.width!="number")continue;let g=d.parent,h;for(;g;){if(g.type==="bpmn:Participant"){h=g;break}g=g.parent}if(!h){const _e=d.x+d.width/2,We=d.y+d.height/2;h=i.getAll().find(Y=>{if(Y.type!=="bpmn:Participant")return!1;const le=Y;return typeof le.x=="number"&&typeof le.width=="number"&&_e>=le.x&&_e<=le.x+le.width&&We>=le.y&&We<=le.y+le.height})}if(!h||typeof h.x!="number"||typeof h.width!="number")continue;const w=(((l=d.businessObject.extensionElements)==null?void 0:l.values)??[]).find(_e=>_e.$type==="bwl:Placement"),y=[...d.incoming??[],...d.outgoing??[]].find(_e=>_e.type==="bpmn:Association"),_=(w!=null&&w.anchor?i.get(w.anchor):void 0)??(y?((p=y.source)==null?void 0:p.id)===f?y.target:y.source:void 0);if(!_)continue;const S=_.waypoints,P=S!=null&&S.length?{x:S[Math.floor((S.length-1)/2)].x,y:S[Math.floor((S.length-1)/2)].y,width:0,height:0}:{x:_.x,y:_.y,width:_.width,height:_.height},C={width:d.width,height:d.height},D={x:d.x+d.width/2,y:d.y+d.height/2},T=w==null?void 0:w.side,N=[];T&&T in bs&&N.push(ol(i,P,C,h,{placement:{side:T,offset:(w==null?void 0:w.offset)??null},selfId:f}));for(const[_e,We]of[[-1,0],[1,0],[0,-1],[0,1]])for(let Y=1;Y<=XE;Y++)N.push({x:D.x+_e*Rh*Y,y:D.y+We*Rh*Y});const k={...s,edges:s.edges.filter(_e=>_e.id!==(y==null?void 0:y.id))},O=o(k),F=O.filter(_e=>al(_e).includes(f)).length;if(!F)continue;let ae;for(const _e of N){const We=_e.x-D.x,Y=_e.y-D.y;if(!We&&!Y||_e.x-C.width/2<h.x||_e.x+C.width/2>h.x+h.width||_e.y-C.height/2<h.y||_e.y+C.height/2>h.y+h.height)continue;const le={...k,shapes:k.shapes.map(re=>re.id===f?{...re,x:re.x+We,y:re.y+Y}:re)},ge=o(le),ue=ge.filter(re=>al(re).includes(f)).length;if(ue>=F||ge.length>O.length)continue;const Re=Math.abs(We)+Math.abs(Y);if((!ae||ue<ae.mine||ue===ae.mine&&(ge.length<ae.all||ge.length===ae.all&&Re<ae.dist))&&(ae={x:_e.x,y:_e.y,mine:ue,all:ge.length,dist:Re}),ae.mine===0&&ae.all<O.length)break}ae&&r.moveElements([d],{x:ae.x-D.x,y:ae.y-D.y})}}function Ph(e,t,n=Ch){const i=Sh(e),r=Eh(t,Xd(i.elementRegistry)),o={edgeCrossings:{before:0,after:0,pairs:[],solidPairs:0,dashedPairs:0,mixedPairs:0,crossPoolMessages:0}};if(r.length)return{ok:!1,issues:r,findings:[],stats:o};const a=mt(i.elementRegistry),s=new Set(li(a).map(ui)),c=new Set(a.edges.map(h=>h.id)),u=new Set(a.shapes.map(h=>h.id)),l=Ju(a).length,p=e.get("commandStack");try{od(p,()=>{n(t,i),oh(i,c),nh(i,s),hh(i,s,c),ch(i,c),GE(i,c),dh(i,s,c),vh(i,s,c),yh(i,c),_h(i,u),ZE(i,s,u)})}catch(h){return{ok:!1,issues:[{kind:"lower-failed",message:h instanceof Error?h.message:String(h)}],findings:[],stats:o}}const f=mt(i.elementRegistry),d=li(f).filter(h=>!s.has(ui(h))),g=zd(f);return{ok:!0,issues:[],findings:d,stats:{edgeCrossings:{before:l,after:g.pairs.length,pairs:g.pairs,solidPairs:g.solidPairs,dashedPairs:g.dashedPairs,mixedPairs:g.mixedPairs,crossPoolMessages:g.crossPoolMessages}}}}function QE(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function JE(e,t){return typeof e.get=="function"?e.get(t):e[t]}function Ah(e,t){const n=JE(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Th(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function e1(e){return typeof e=="string"&&Tu.includes(e)}function pi(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function Mh(e){const t=e.rootElements??[],n=t.find(Y=>Y.$type==="bpmn:Collaboration"),i=new Map(t.filter(Y=>Y.$type==="bpmn:Process").map(Y=>[Y.id,Y])),r=[],o=[],a=[],s=[],c=[],u=[],l={poolOrders:{},bands:{},placements:{}},p=[],f=[],d=[],g=[],h=[],m=[],w=new Set,y=new Set,_=Y=>{Y&&w.add(Y)},S=Y=>{w.add(Y),y.add(Y)},P=Y=>{const le=Th(Y,"bwl:Placement");if(!le)return;const ge=typeof le.anchor=="string"?le.anchor:void 0;if(!ge||!e1(le.side))return;const ue=typeof le.offset=="number"?le.offset:void 0;h.push({owner:Y.id,anchor:ge,side:le.side,...ue!==void 0?{offset:ue}:{}})},C=Y=>{const le=Th(Y,"bwl:Members"),ge=typeof(le==null?void 0:le.refs)=="string"?le.refs.split(/\s+/).filter(Boolean):[];ge.length&&m.push({owner:Y.id,refs:ge})},D=Y=>{var le;for(const ge of Y)switch(_(ge.id),ge.$type){case"bpmn:TextAnnotation":S(ge.id),s.push({id:ge.id,text:typeof ge.text=="string"?ge.text:""}),P(ge);break;case"bpmn:Association":d.push({id:ge.id,type:ge.$type,source:pi(ge.sourceRef),target:pi(ge.targetRef)});break;case"bpmn:Group":{S(ge.id);const ue=(le=ge.categoryValueRef)==null?void 0:le.value;c.push({id:ge.id,...typeof ue=="string"&&ue?{name:ue}:{}}),C(ge);break}default:u.push({id:ge.id,type:ge.$type,reason:"type-outside-mvp"})}},T=(Y,le)=>{const ge=Y.flowElements??[],ue=(Y.laneSets??[]).flatMap(re=>re.lanes??[]),Re=new Map;for(const re of ue){_(re.id);for(const q of re.flowNodeRef??[]){const U=pi(q);U&&Re.set(U,re.id)}}for(const re of ge){if(_(re.id),re.$type==="bpmn:SequenceFlow"){p.push({id:re.id,source:pi(re.sourceRef),target:pi(re.targetRef),...typeof re.name=="string"&&re.name?{name:re.name}:{}});continue}if(re.$type==="bpmn:DataStoreReference"){S(re.id),a.push({id:re.id,...re.name?{name:re.name}:{}});continue}const q=QE(re.$type);if(!td(q)){u.push({id:re.id,type:re.$type,reason:"type-outside-mvp"});continue}S(re.id),o.push({id:re.id,type:q,...re.name?{name:re.name}:{},...le?{participant:le}:{},...Re.has(re.id)?{lane:Re.get(re.id)}:{}});const U=Ah(re,"bwl:band");U!==void 0&&(l.bands[re.id]=U);for(const Z of re.dataOutputAssociations??[])_(Z.id),g.push({id:Z.id,type:Z.$type,source:re.id,target:pi(Z.targetRef)});for(const Z of re.dataInputAssociations??[])_(Z.id),g.push({id:Z.id,type:Z.$type,source:pi((Z.sourceRef??[])[0]),target:re.id})}D(Y.artifacts??[])};if(n){const Y=new Set;for(const le of n.participants??[]){S(le.id);const ge=pi(le.processRef);ge&&Y.add(ge);const ue=ge?i.get(ge):void 0,Re=((ue==null?void 0:ue.laneSets)??[]).flatMap(Z=>Z.lanes??[]),re=Re.map(Z=>({id:Z.id,...Z.name?{name:Z.name}:{}}));for(const Z of re)S(Z.id);const q=!ue||(ue.flowElements??[]).length===0&&Re.length===0&&(ue.artifacts??[]).length===0;r.push({id:le.id,...le.name?{name:le.name}:{},...q?{blackBox:!0}:{},...re.length?{lanes:re}:{}});const U=Ah(le,"bwl:poolOrder");U!==void 0&&(l.poolOrders[le.id]=U),ue&&T(ue,le.id)}for(const le of n.messageFlows??[])_(le.id),f.push({id:le.id,source:pi(le.sourceRef),target:pi(le.targetRef),...typeof le.name=="string"&&le.name?{name:le.name}:{}});D(n.artifacts??[]);for(const[le,ge]of i)!Y.has(le)&&(ge.flowElements??[]).length>0&&u.push({id:le,type:ge.$type,reason:"unreachable-process"})}else for(const Y of i.values())T(Y);const N=[],k=[],O=[],F=[],ae=(Y,le)=>!!Y&&!!le&&y.has(Y)&&y.has(le);for(const Y of p){if(!ae(Y.source,Y.target)){u.push({id:Y.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}N.push({id:Y.id,source:Y.source,target:Y.target,...Y.name?{name:Y.name}:{}}),y.add(Y.id)}for(const Y of f){if(!ae(Y.source,Y.target)){u.push({id:Y.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}k.push({id:Y.id,source:Y.source,target:Y.target,...Y.name?{name:Y.name}:{}}),y.add(Y.id)}for(const Y of g){if(!ae(Y.source,Y.target)){u.push({id:Y.id??"",type:Y.type,reason:"endpoint-outside-mvp"});continue}F.push({...Y.id?{id:Y.id}:{},source:Y.source,target:Y.target}),Y.id&&y.add(Y.id)}for(const Y of d){if(!ae(Y.source,Y.target)){u.push({id:Y.id??"",type:Y.type,reason:"endpoint-outside-mvp"});continue}O.push({...Y.id?{id:Y.id}:{},source:Y.source,target:Y.target})}const _e=new Map(c.map(Y=>[Y.id,Y]));for(const{owner:Y,refs:le}of m){const ge=le.filter(Re=>w.has(Re)),ue=_e.get(Y);ue&&ge.length&&(ue.members=ge)}for(const Y of h)w.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:N,...k.length?{messageFlows:k}:{},...a.length?{dataStores:a}:{},...F.length?{dataAssociations:F}:{},...s.length?{annotations:s}:{},...O.length?{associations:O}:{},...c.length?{groups:c}:{}},hints:l,omitted:u}}async function t1(e){const{definitions:t,warnings:n}=await Uu(e);return{...Mh(t),warnings:n}}function n1(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function kh(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=Ph(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 i1=Symbol("bpmn-editor");function r1(){const e=At.ref(!1),t=At.ref(!0),n=At.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 kh(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:qu(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 de(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function o1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var sl={exports:{}},Oh;function a1(){if(Oh)return sl.exports;Oh=1;var e=sl.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},sl.exports}var s1=a1(),c1=o1(s1);function fi(e){if(!(this instanceof fi))return new fi(e);e=e||[128,36,1],this._seed=e.length?c1.rack(e[0],e[1],e[2]):e}fi.prototype.next=function(e){return this._seed(e||!0)},fi.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},fi.prototype.claim=function(e,t){this._seed.set(e,t||!0)},fi.prototype.assigned=function(e){return this._seed.get(e)||!1},fi.prototype.unclaim=function(e){delete this._seed.hats[e]},fi.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const Bt={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};Bt.td=Bt.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],Bt.option=Bt.optgroup=[1,'<select multiple="multiple">',"</select>"],Bt.thead=Bt.tbody=Bt.colgroup=Bt.caption=Bt.tfoot=[1,"<table>","</table>"],Bt.polyline=Bt.ellipse=Bt.polygon=Bt.circle=Bt.text=Bt.line=Bt.path=Bt.rect=Bt.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function ft(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(Bt,i)?Bt[i]:Bt._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 u1(e,t){return t.forEach(function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach(function(i){if(i!=="default"&&!(i in e)){var r=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return n[i]}})}})}),Object.freeze(e)}function dn(e,...t){const n=e.style;return L(t,function(i){i&&L(i,function(r,o){n[o]=r})}),e}function sn(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const l1=Object.prototype.toString;function yt(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 l1.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 _s(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Mr(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function p1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var xs={},Dh;function f1(){if(Dh)return xs;Dh=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return xs.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},xs.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},xs}var Lh=f1(),d1=p1(Lh),Ne=u1({__proto__:null,default:d1},[Lh]),Ih=["focus","blur"];function h1(e,t,n,i,r){return Ih.indexOf(n)!==-1&&(r=!0),Ne.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=Mr(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function m1(e,t,n,i){return Ih.indexOf(t)!==-1&&(i=!0),Ne.unbind(e,t,n,i)}var Cn={bind:h1,unbind:m1};function cl(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function ot(e,t){return t=t||document,t.querySelector(e)}function ws(e,t){return t=t||document,t.querySelectorAll(e)}function di(e){e.parentNode&&e.parentNode.removeChild(e)}function g1(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function y1(e,t){return t.appendChild(g1(e,t))}function Be(e,t){return y1(t,e),e}var ul=2,Nh={"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":ul,"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":ul,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function v1(e,t){return Nh[t]?e.style[t]:e.getAttributeNS(null,t)}function Bh(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=Nh[i];r?(r===ul&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function b1(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)Bh(e,r,t[r])}function he(e,t,n){if(typeof t=="string")if(n!==void 0)Bh(e,t,n);else return v1(e,t);else b1(e,t);return e}const _1=Object.prototype.toString;function qe(e){return new Qi(e)}function Qi(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Qi.prototype.add=function(e){return this.list.add(e),this},Qi.prototype.remove=function(e){return _1.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Qi.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},Qi.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Qi.prototype.array=function(){return Array.from(this.list)},Qi.prototype.has=Qi.prototype.contains=function(e){return this.list.contains(e)};function Es(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function $h(e){return e.cloneNode(!0)}var ll={svg:"http://www.w3.org/2000/svg"},jh='<svg xmlns="'+ll.svg+'"';function x1(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(ll.svg)===-1&&(e=jh+e.substring(4)):(e=jh+">"+e+"</svg>",t=!0);var n=w1(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function w1(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function Ce(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=x1(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(ll.svg,e),t&&he(n,t),n}var pl=null;function Fh(){return pl===null&&(pl=Ce("svg")),pl}function Hh(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function E1(e,t,n,i,r,o){var a=Fh().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return Hh(a,e);case 6:return Hh(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function Xo(e){return Fh().createSVGTransform()}var zh=/([&<>]{1})/g,S1=/([&<>\n\r"]{1})/g,R1={"&":"&","<":"<",">":">",'"':"'"};function fl(e,t){function n(i,r){return R1[r]||r}return e.replace(t,n)}function Gh(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(fl(e.textContent,zh));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,'="',fl(o.value,S1),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)Gh(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",fl(e.nodeValue,zh),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function C1(e){for(var t=e.firstChild,n=[];t;)Gh(t,n),t=t.nextSibling;return n.join("")}function Vh(e,t){return C1(e)}function $t(e){var t=e.parentNode;return t&&t.removeChild(e),e}function P1(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function A1(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(P1(e,i))}function Zo(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),A1(n,t)),n.consolidate()}const T1=/^class[ {]/;function M1(e){return T1.test(e.toString())}function dl(e){return Array.isArray(e)}function hl(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Ss(...e){e.length===1&&dl(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const k1=/constructor\s*[^(]*\(\s*([^)]*)\)/m,O1=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,D1=/\/\*([^*]*)\*\//m;function L1(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(M1(e)?k1:O1);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(D1);return(r&&r[1]||i).trim()})||[]}function Wh(e,t){const n=t||{get:function(_,S){if(i.push(_),S===!1)return null;throw s(`No provider for "${_}"!`)}},i=[],r=this._providers=Object.create(n._providers||null),o=this._instances=Object.create(null),a=o.injector=this,s=function(_){const S=i.join(" -> ");return i.length=0,new Error(S?`${_} (Resolving: ${S})`:_)};function c(_,S){if(!r[_]&&_.includes(".")){const P=_.split(".");let C=c(P.shift());for(;P.length;)C=C[P.shift()];return C}if(hl(o,_))return o[_];if(hl(r,_)){if(i.indexOf(_)!==-1)throw i.push(_),s("Cannot resolve circular dependency!");return i.push(_),o[_]=r[_][0](r[_][1]),i.pop(),o[_]}return n.get(_,S)}function u(_,S){if(typeof S>"u"&&(S={}),typeof _!="function")if(dl(_))_=Ss(_.slice());else throw s(`Cannot invoke "${_}". Expected a function!`);const C=(_.$inject||L1(_)).map(D=>hl(S,D)?S[D]:c(D));return{fn:_,dependencies:C}}function l(_){const{fn:S,dependencies:P}=u(_),C=Function.prototype.bind.call(S,null,...P);return new C}function p(_,S,P){const{fn:C,dependencies:D}=u(_,P);return C.apply(S,D)}function f(_){return Ss(S=>_.get(S))}function d(_,S){if(S&&S.length){const P=Object.create(null),C=Object.create(null),D=[],T=[],N=[];let k,O,F,ae;for(let _e in r)k=r[_e],S.indexOf(_e)!==-1&&(k[2]==="private"?(O=D.indexOf(k[3]),O===-1?(F=k[3].createChild([],S),ae=f(F),D.push(k[3]),T.push(F),N.push(ae),P[_e]=[ae,_e,"private",F]):P[_e]=[N[O],_e,"private",T[O]]):P[_e]=[k[2],k[1]],C[_e]=!0),(k[2]==="factory"||k[2]==="type")&&k[1].$scope&&S.forEach(We=>{k[1].$scope.indexOf(We)!==-1&&(P[_e]=[k[2],k[1]],C[We]=!0)});S.forEach(_e=>{if(!C[_e])throw new Error('No provider for "'+_e+'". Cannot use provider from the parent!')}),_.unshift(P)}return new Wh(_,a)}const g={factory:p,type:l,value:function(_){return _}};function h(_,S){const P=_.__init__||[];return function(){P.forEach(C=>{typeof C=="string"?S.get(C):S.invoke(C)})}}function m(_){const S=_.__exports__;if(S){const P=_.__modules__,C=Object.keys(_).reduce((O,F)=>(F!=="__exports__"&&F!=="__modules__"&&F!=="__init__"&&F!=="__depends__"&&(O[F]=_[F]),O),Object.create(null)),D=(P||[]).concat(C),T=d(D),N=Ss(function(O){return T.get(O)});S.forEach(function(O){r[O]=[N,O,"private",T]});const k=(_.__init__||[]).slice();return k.unshift(function(){T.init()}),_=Object.assign({},_,{__init__:k}),h(_,T)}return Object.keys(_).forEach(function(P){if(P==="__init__"||P==="__depends__")return;const C=_[P];if(C[2]==="private"){r[P]=C;return}const D=C[0],T=C[1];r[P]=[g[D],I1(D,T),D]}),h(_,a)}function w(_,S){return _.indexOf(S)!==-1||(_=(S.__depends__||[]).reduce(w,_),_.indexOf(S)!==-1)?_:_.concat(S)}function y(_){const S=_.reduce(w,[]).map(m);let P=!1;return function(){P||(P=!0,S.forEach(C=>C()))}}this.get=c,this.invoke=p,this.instantiate=l,this.createChild=d,this.init=y(e)}function I1(e,t){return e!=="value"&&dl(t)&&(t=Ss(t.slice())),t}var N1=1e3;function Ti(e,t){var n=this;t=t||N1,e.on(["render.shape","render.connection"],t,function(i,r){var o=i.type,a=r.element,s=r.gfx,c=r.attrs;if(n.canRender(a))return o==="render.shape"?n.drawShape(s,a,c):n.drawConnection(s,a,c)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(i,r){if(n.canRender(r))return i.type==="render.getShapePath"?n.getShapePath(r):n.getConnectionPath(r)})}Ti.prototype.canRender=function(e){},Ti.prototype.drawShape=function(e,t){},Ti.prototype.drawConnection=function(e,t){},Ti.prototype.getShapePath=function(e){},Ti.prototype.getConnectionPath=function(e){};function kr(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function B1(e){return["M",e.x,e.y]}function ml(e){return["L",e.x,e.y]}function $1(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function j1(e,t){const n=e.length,i=[B1(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(ml(a));continue}const c=Math.min(t,gl(a.x-o.x,a.y-o.y),gl(s.x-a.x,s.y-a.y));if(!c){i.push(ml(a));continue}const u=Rs(a,o,c),l=Rs(a,o,c*.5),p=Rs(a,s,c),f=Rs(a,s,c*.5);i.push(ml(u)),i.push($1(l,f,p))}return i}function Rs(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=gl(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function gl(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Qo(e,t,n){Le(t)&&(n=t,t=null),t||(t={});const i=Ce("path",t);return Le(n)&&(i.dataset.cornerRadius=String(n)),yl(i,e)}function yl(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return he(e,{d:kr(j1(t,n))}),e}function Cs(e){var t=new Set(e);return Ge(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function Or(e,t,n){n=n||0,ke(e)||(e=[e]),L(e,function(i,r){var o=t(i,r,n);ke(o)&&o.length&&Or(o,t,n+1)})}function vl(e,t,n){var i=new Set,r=new Set;return Or(e,function(o,a,s){i.add(o);var c=o.children;if(c&&!r.has(c))return r.add(c),c}),Array.from(i)}function Jo(e,t){return vl(e)}function F1(e,t,n){Rr(t)&&(t=!0),Vt(t)&&(n=t,t=!0),n=n||{};var i=ea(n.allShapes),r=ea(n.allConnections),o=ea(n.enclosedElements),a=ea(n.enclosedConnections),s=ea(n.topLevel,t&&eo(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,L(l.incoming,c),L(l.outgoing,c),l.children}return Or(e,u),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function Tt(e,t){t=!!t,ke(e)||(e=[e]);var n,i,r,o;return L(e,function(a){var s=a;a.waypoints&&!t&&(s=Tt(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 uo(e,t){var n={};return L(e,function(i){var r=i;r.waypoints&&(r=Tt(r)),!Le(t.y)&&r.x>t.x&&(n[i.id]=i),!Le(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(Le(t.width)&&Le(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!Le(t.width)||!Le(t.height))&&(n[i.id]=i)}),n}function Uh(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function qh(e){return!!(e&&e.isFrame)}function ea(e,t){return H({},e||{},t||{})}var H1=1;function Ji(e,t){Ti.call(this,e,H1),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})}de(Ji,Ti),Ji.prototype.canRender=function(){return!0},Ji.prototype.drawShape=function(t,n,i){var r=Ce("rect");return he(r,{x:0,y:0,width:n.width||0,height:n.height||0}),qh(n)?he(r,H({},this.FRAME_STYLE,i||{})):he(r,H({},this.SHAPE_STYLE,i||{})),Be(t,r),r},Ji.prototype.drawConnection=function(t,n,i){var r=Qo(n.waypoints,H({},this.CONNECTION_STYLE,i||{}));return Be(t,r),r},Ji.prototype.getShapePath=function(t){var n=t.x,i=t.y,r=t.width,o=t.height,a=[["M",n,i],["l",r,0],["l",0,o],["l",-r,0],["z"]];return kr(a)},Ji.prototype.getConnectionPath=function(t){var n=t.waypoints,i,r,o=[];for(i=0;r=n[i];i++)r=r.original||r,o.push([i===0?"M":"L",r.x,r.y]);return kr(o)},Ji.$inject=["eventBus","styles"];function z1(){var e={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},t=this;this.cls=function(n,i,r){var o=this.style(i,r);return H(o,{class:n})},this.style=function(n,i){!ke(n)&&!i&&(i=n,n=[]);var r=Sn(n,function(o,a){return H(o,e[a]||{})},{});return i?H(r,i):r},this.computeStyle=function(n,i,r){return ke(i)||(r=i,i=[]),t.style(i||[],H({},r,n||{}))}}const G1={__init__:["defaultRenderer"],defaultRenderer:["type",Ji],styles:["type",z1]};function Rt(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function Pt(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 bl(e,t){return!e||!t?-1:e.indexOf(t)}function ta(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function _l(e,t,n,i){if(typeof i>"u"&&(i=5),!e||!t||!n)return!1;var r=(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),o=ta(e,t);return Math.abs(r/o)<=i}var V1=2;function Mi(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(W1(r,n))return o;return!1}function W1(e,t){const n=t[0];return Cr(t,function(i){return Math.abs(n[e]-i[e])<=V1})}function Yh(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 xl(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var U1=/,?([a-z]),?/gi,Kh=parseFloat,Mt=Math,er=Mt.PI,hi=Mt.min,mi=Mt.max,Xh=Mt.pow,tr=Mt.abs,q1=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,Y1=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,Zh=Array.isArray||function(e){return e instanceof Array};function K1(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function X1(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 Z1(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 K1(r,i)?(X1(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function Q1(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(q1,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(Y1,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=El,n}function J1(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 eS(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 wl(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 El(){return this.join(",").replace(U1,"$1")}function tS(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=El,t}function Qh(e,t,n,i,r,o,a,s,c){var u=1-c,l=Xh(u,3),p=Xh(u,2),f=c*c,d=f*c,g=l*e+p*3*c*n+u*3*c*c*r+d*a,h=l*t+p*3*c*i+u*3*c*c*o+d*s;return{x:Ps(g),y:Ps(h)}}function Jh(e){var t=sS(...e);return wl(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function nr(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function nS(e,t){return e=wl(e),t=wl(t),nr(t,e.x,e.y)||nr(t,e.x2,e.y)||nr(t,e.x,e.y2)||nr(t,e.x2,e.y2)||nr(e,t.x,t.y)||nr(e,t.x2,t.y)||nr(e,t.x,t.y2)||nr(e,t.x2,t.y2)||(e.x<t.x2&&e.x>t.x||t.x<e.x2&&t.x>e.x)&&(e.y<t.y2&&e.y>t.y||t.y<e.y2&&t.y>e.y)}function em(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 tm(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,g=0;g<l;g++){var h=u*p[g]+u,m=em(h,e,n,r,a),w=em(h,t,i,o,s),y=m*m+w*w;d+=f[g]*Mt.sqrt(y)}return u*d}function iS(e,t,n,i,r,o,a,s){if(!(mi(e,n)<hi(r,a)||hi(e,n)>mi(r,a)||mi(t,i)<hi(o,s)||hi(t,i)>mi(o,s))){var c=(e*i-t*n)*(r-a)-(e-n)*(r*s-o*a),u=(e*i-t*n)*(o-s)-(t-i)*(r*s-o*a),l=(e-n)*(o-s)-(t-i)*(r-a);if(l){var p=Ps(c/l),f=Ps(u/l),d=+p.toFixed(2),g=+f.toFixed(2);if(!(d<+hi(e,n).toFixed(2)||d>+mi(e,n).toFixed(2)||d<+hi(r,a).toFixed(2)||d>+mi(r,a).toFixed(2)||g<+hi(t,i).toFixed(2)||g>+mi(t,i).toFixed(2)||g<+hi(o,s).toFixed(2)||g>+mi(o,s).toFixed(2)))return{x:p,y:f}}}}function Ps(e){return Math.round(e*1e11)/1e11}function rS(e,t,n){var i=Jh(e),r=Jh(t);if(!nS(i,r))return[];var o=tm(...e),a=tm(...t),s=im(e)?1:~~(o/5)||1,c=im(t)?1:~~(a/5)||1,u=new Array(s+1),l=new Array(c+1),p={},f=[],d,g;for(d=0;d<s+1;d++){var h=Qh(...e,d/s);u[d]={x:h.x,y:h.y,t:d/s}}for(d=0;d<c+1;d++)h=Qh(...t,d/c),l[d]={x:h.x,y:h.y,t:d/c};for(d=0;d<s;d++)for(g=0;g<c;g++){var m=u[d],w=u[d+1],y=l[g],_=l[g+1],S=tr(w.x-m.x)<.01?"y":"x",P=tr(_.x-y.x)<.01?"y":"x",C=iS(m.x,m.y,w.x,w.y,y.x,y.y,_.x,_.y),D;if(C){if(D=C.x.toFixed(9)+"#"+C.y.toFixed(9),p[D])continue;p[D]=!0;var T=m.t+tr((C[S]-m[S])/(w[S]-m[S]))*(w.t-m.t),N=y.t+tr((C[P]-y[P])/(_[P]-y[P]))*(_.t-y.t);T>=0&&T<=1&&N>=0&&N<=1&&f.push({x:C.x,y:C.y,t1:T,t2:N})}}return f}function nm(e,t,n){e=am(e),t=am(t);for(var i,r,o,a,s,c,u,l,p,f,d=n?0:[],g=0,h=e.length;g<h;g++){var m=e[g];if(m[0]=="M")i=s=m[1],r=c=m[2];else{m[0]=="C"?(p=[i,r,...m.slice(1)],i=p[6],r=p[7]):(p=[i,r,i,r,s,c,s,c],i=s,r=c);for(var w=0,y=t.length;w<y;w++){var _=t[w];if(_[0]=="M")o=u=_[1],a=l=_[2];else{_[0]=="C"?(f=[o,a,..._.slice(1)],o=f[6],a=f[7]):(f=[o,a,o,a,u,l,u,l],o=u,a=l);var S=rS(p,f);{for(var P=0,C=S.length;P<C;P++)S[P].segment1=g,S[P].segment2=w,S[P].bez1=p,S[P].bez2=f;d=d.concat(S)}}}}}return d}function oS(e){return Zh(e)&&Zh(e[0])}function aS(e){if(J1(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 g=0,h=u.length;g<h;g++)c[g]=u[g];switch(s=s.toUpperCase(),c[0]){case"Z":n=+r,i=+o;break;case"H":n=c[1];break;case"V":i=c[1];break;case"M":r=c[c.length-2],o=c[c.length-1];default:n=c[c.length-2],i=c[c.length-1]}}return t.toString=El,t}function im(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function As(e,t,n,i){return[e,t,n,i,n,i]}function rm(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 om(e,t,n,i,r,o,a,s,c,u){var l=er*120/180,p=er/180*(+r||0),f=[],d,g=Z1(function(M,E,b){var j=M*Mt.cos(b)-E*Mt.sin(b),W=M*Mt.sin(b)+E*Mt.cos(b);return{x:j,y:W}});if(u)D=u[0],T=u[1],P=u[2],C=u[3];else{d=g(e,t,-p),e=d.x,t=d.y,d=g(s,c,-p),s=d.x,c=d.y;var h=(e-s)/2,m=(t-c)/2,w=h*h/(n*n)+m*m/(i*i);w>1&&(w=Mt.sqrt(w),n=w*n,i=w*i);var y=n*n,_=i*i,S=(o==a?-1:1)*Mt.sqrt(tr((y*_-y*m*m-_*h*h)/(y*m*m+_*h*h))),P=S*n*m/i+(e+s)/2,C=S*-i*h/n+(t+c)/2,D=Mt.asin(((t-C)/i).toFixed(9)),T=Mt.asin(((c-C)/i).toFixed(9));D=e<P?er-D:D,T=s<P?er-T:T,D<0&&(D=er*2+D),T<0&&(T=er*2+T),a&&D>T&&(D=D-er*2),!a&&T>D&&(T=T-er*2)}var N=T-D;if(tr(N)>l){var k=T,O=s,F=c;T=D+l*(a&&T>D?1:-1),s=P+n*Mt.cos(T),c=C+i*Mt.sin(T),f=om(s,c,n,i,r,0,a,O,F,[T,k,P,C])}N=T-D;var ae=Mt.cos(D),_e=Mt.sin(D),We=Mt.cos(T),Y=Mt.sin(T),le=Mt.tan(N/4),ge=4/3*n*le,ue=4/3*i*le,Re=[e,t],re=[e+ge*_e,t-ue*ae],q=[s+ge*Y,c-ue*We],U=[s,c];if(re[0]=2*Re[0]-re[0],re[1]=2*Re[1]-re[1],u)return[re,q,U].concat(f);f=[re,q,U].concat(f).join().split(",");for(var Z=[],He=0,wt=f.length;He<wt;He++)Z[He]=He%2?g(f[He-1],f[He],p).y:g(f[He],f[He+1],p).x;return Z}function sS(e,t,n,i,r,o,a,s){for(var c=[],u=[[],[]],l,p,f,d,g,h,m,w,y=0;y<2;++y){if(y==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),tr(l)<1e-12){if(tr(p)<1e-12)continue;d=-f/p,0<d&&d<1&&c.push(d);continue}m=p*p-4*f*l,w=Mt.sqrt(m),!(m<0)&&(g=(-p+w)/(2*l),0<g&&g<1&&c.push(g),h=(-p-w)/(2*l),0<h&&h<1&&c.push(h))}for(var _=c.length,S=_,P;_--;)d=c[_],P=1-d,u[0][_]=P*P*P*e+3*P*P*d*n+3*P*d*d*r+d*d*d*a,u[1][_]=P*P*P*t+3*P*P*d*i+3*P*d*d*o+d*d*d*s;return u[0][S]=e,u[1][S]=t,u[0][S+1]=a,u[1][S+1]=s,u[0].length=u[1].length=S+2,{x0:hi(...u[0]),y0:hi(...u[1]),x1:mi(...u[0]),y1:mi(...u[1])}}function am(e){if(oS(e)||(e=Q1(e)),eS(e))return e;for(var t=tS(aS(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(f,d,g){var h,m;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",...om(d.x,d.y,...f.slice(1))];break;case"S":g=="C"||g=="S"?(h=d.x*2-d.bx,m=d.y*2-d.by):(h=d.x,m=d.y),f=["C",h,m,...f.slice(1)];break;case"T":g=="Q"||g=="T"?(d.qx=d.x*2-d.qx,d.qy=d.y*2-d.qy):(d.qx=d.x,d.qy=d.y),f=["C",...rm(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",...rm(d.x,d.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...As(d.x,d.y,f[1],f[2])];break;case"H":f=["C",...As(d.x,d.y,f[1],d.y)];break;case"V":f=["C",...As(d.x,d.y,d.x,f[1])];break;case"Z":f=["C",...As(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 g=f[d];g.length;)o[d]="A",f.splice(d++,0,["C",...g.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=Kh(l[p-4])||n.x,n.by=Kh(l[p-3])||n.y}return t}function st(e){return Vt(e)&&En(e,"waypoints")}function Fe(e){return Vt(e)&&En(e,"labelTarget")}function cS(e){return Vt(e)&&Qr(e.parent)}function sm(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function ki(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Pe(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Ts(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function uS(e){return ki({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function lS(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],g=d&&d.endLength||0,h=dS(f,l);u.push({start:f,end:l,startLength:g,endLength:g+h,length:h})}return u},[]),i=n.reduce(function(u,l){return u+l.length},0),r=i/2,o=0,a=n[o];a.endLength<r;)a=n[++o];var s=(r-a.startLength)/a.length,c={x:a.start.x+(a.end.x-a.start.x)*s,y:a.start.y+(a.end.y-a.start.y)*s};return c}function Oe(e){return st(e)?lS(e):uS(e)}function Jt(e,t,n){n=n||0,Vt(n)||(n={x:n,y:n});var i=Pe(e),r=Pe(t),o=i.bottom+n.y<=r.top,a=i.left-n.x>=r.right,s=i.top-n.y>=r.bottom,c=i.right+n.x<=r.left,u=o?"top":s?"bottom":null,l=c?"left":a?"right":null;return l&&u?u+"-"+l:l||u||"intersect"}function na(e,t,n){var i=pS(e,t);return i.length===1||i.length===2&&ta(i[0],i[1])<1?ki(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}),ki(i[n?0:i.length-1])):null}function pS(e,t){return nm(e,t)}function fS(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],ta(n,r)===0||_l(i,r,n)?e.splice(t,1):t++;return e}function dS(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Ms(e,t){return Math.round(e*t)/t}function cm(e){return Le(e)?e+"px":e}function hS(e){for(;e.parent;)e=e.parent;return e}function mS(e){e=H({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),dn(n,{position:"relative",overflow:"hidden",width:cm(e.width),height:cm(e.height)}),t.appendChild(n),n}function um(e,t,n){const i=Ce("g");qe(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const gS="base",lm=0,yS=1,vS={shape:["x","y","width","height"],connection:["waypoints"]};function De(e,t,n,i){this._eventBus=t,this._elementRegistry=i,this._graphicsFactory=n,this._rootsIdx=0,this._layers={},this._planes=[],this._rootElement=null,this._focused=!1,this._init(e||{})}De.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],De.prototype._init=function(e){const t=this._eventBus,n=this._container=mS(e),i=this._svg=Ce("svg");he(i,{width:"100%",height:"100%"}),sn(i,"tabindex",0),e.autoFocus&&t.on("element.hover",()=>{this.restoreFocus()}),t.on("element.mousedown",500,o=>{this.focus()}),i.addEventListener("focusin",()=>{this._setFocused(!0)}),i.addEventListener("focusout",()=>{this._setFocused(!1)}),i.addEventListener("mouseover",()=>{this._eventBus.fire("canvas.mouseover")}),i.addEventListener("mouseout",()=>{this._eventBus.fire("canvas.mouseout")}),Be(n,i);const r=this._viewport=um(i,"viewport");e.deferUpdate&&(this._viewboxChanged=Du(this._viewboxChanged,300)),this._restoreFocus=Du(this._restoreFocus,0),t.on("diagram.init",()=>{t.fire("canvas.init",{svg:i,viewport:r})}),t.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed","root.set"],()=>{delete this._cachedViewbox}),t.on("diagram.destroy",500,this._destroy,this),t.on("diagram.clear",500,this._clear,this)},De.prototype._destroy=function(){this._restoreFocus.cancel(),this._eventBus.fire("canvas.destroy",{svg:this._svg,viewport:this._viewport});const e=this._container.parentNode;e&&e.removeChild(this._container),delete this._svg,delete this._container,delete this._layers,delete this._planes,delete this._rootElement,delete this._viewport},De.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},De.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=Uh(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},De.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},De.prototype.restoreFocus=function(){this._restoreFocus()},De.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},De.prototype.isFocused=function(){return this._focused},De.prototype.getDefaultLayer=function(){return this.getLayer(gS,lm)},De.prototype.getLayer=function(e,t){if(!e)throw new Error("must specify a name");let n=this._layers[e];if(n||(n=this._layers[e]=this._createLayer(e,t)),typeof t<"u"&&n.index!==t)throw new Error("layer <"+e+"> already created at index <"+t+">");return n.group},De.prototype._getChildIndex=function(e){return Sn(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},De.prototype._createLayer=function(e,t){typeof t>"u"&&(t=yS);const n=this._getChildIndex(t);return{group:um(this._viewport,"layer-"+e,n),index:t,visible:!0}},De.prototype.showLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=this._viewport,i=t.group,r=t.index;if(t.visible)return i;const o=this._getChildIndex(r);return n.insertBefore(i,n.childNodes[o]||null),t.visible=!0,i},De.prototype.hideLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=t.group;return t.visible&&($t(n),t.visible=!1),n},De.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],$t(t.group))},De.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},De.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(hS(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},De.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},De.prototype._findPlaneForRoot=function(e){return lt(this._planes,function(t){return t.rootElement===e})},De.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},De.prototype._resolveElements=function(e){return ke(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},De.prototype.getContainer=function(){return this._container},De.prototype._updateMarker=function(e,t,n){let i;e=this._resolveElement(e),e.markers=e.markers||new Set,i=this._elementRegistry._elements[e.id],i&&(L([i.gfx,i.secondaryGfx],function(r){r&&(n?(e.markers.add(t),qe(r).add(t)):(e.markers.delete(t),qe(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},De.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},De.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},De.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},De.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},De.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},De.prototype.addRootElement=function(e){const t=this._rootsIdx++;e||(e={id:"__implicitroot_"+t,children:[],isImplicit:!0});const n=e.layer="root-"+t;this._ensureValid("root",e);const i=this.getLayer(n,lm);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},De.prototype.removeRootElement=function(e){if(e=this._resolveElement(e),!!this._findPlaneForRoot(e))return this._removeRoot(e),this._removeLayer(e.layer),this._planes=this._planes.filter(function(n){return n.rootElement!==e}),this._rootElement===e&&(this._rootElement=null),e},De.prototype.setRootElement=function(e){if(e===this._rootElement)return e;let t;if(!e)throw new Error("rootElement required");return t=this._findPlaneForRoot(e),t||(e=this.addRootElement(e)),this._setRoot(e),e},De.prototype._removeRoot=function(e){const t=this._elementRegistry,n=this._eventBus;n.fire("root.remove",{element:e}),n.fire("root.removed",{element:e}),t.remove(e)},De.prototype._addRoot=function(e,t){const n=this._elementRegistry,i=this._eventBus;i.fire("root.add",{element:e}),n.add(e,t),i.fire("root.added",{element:e,gfx:t})},De.prototype._setRoot=function(e,t){const n=this._rootElement;n&&(this._elementRegistry.updateGraphics(n,null,!0),this.hideLayer(n.layer)),e&&(t||(t=this._findPlaneForRoot(e).layer),this._elementRegistry.updateGraphics(e,this._svg,!0),this.showLayer(e.layer)),this._rootElement=e,this._eventBus.fire("root.set",{element:e})},De.prototype._ensureValid=function(e,t){if(!t.id)throw new Error("element must have an id");if(this._elementRegistry.get(t.id))throw new Error("element <"+t.id+"> already exists");const n=vS[e];if(!Cr(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},De.prototype._setParent=function(e,t,n){Pt(t.children,e,n),e.parent=t},De.prototype._addElement=function(e,t,n,i){n=n||this.getRootElement();const r=this._eventBus,o=this._graphicsFactory;this._ensureValid(e,t),r.fire(e+".add",{element:t,parent:n}),this._setParent(t,n,i);const a=o.create(e,t,i);return this._elementRegistry.add(t,a),o.update(e,t,a),r.fire(e+".added",{element:t,gfx:a}),t},De.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},De.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},De.prototype._removeElement=function(e,t){const n=this._elementRegistry,i=this._graphicsFactory,r=this._eventBus;if(e=n.get(e.id||e),!!e)return r.fire(t+".remove",{element:e}),i.remove(e),Rt(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},De.prototype.removeShape=function(e){return this._removeElement(e,"shape")},De.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},De.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},De.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},De.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},De.prototype.viewbox=function(e){if(e===void 0&&this._cachedViewbox)return structuredClone(this._cachedViewbox);const t=this._viewport,n=this.getSize();let i,r,o,a,s,c,u;if(e)this._changeViewbox(function(){s=Math.min(n.width/e.width,n.height/e.height);const l=this._svg.createSVGMatrix().scale(s).translate(-e.x,-e.y);Zo(t,l)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=Zo(t),r=a?a.matrix:E1(),s=Ms(r.a,1e3),c=Ms(-r.e||0,1e3),u=Ms(-r.f||0,1e3),e=this._cachedViewbox={x:c?c/s:0,y:u?u/s:0,width:n.width/s,height:n.height/s,scale:s,inner:{width:i.width||0,height:i.height||0,x:i.x||0,y:i.y||0},outer:n},e;return e},De.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=H({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),pm(t,n)}),{x:n.e,y:n.f}},De.prototype.scrollToElement=function(e,t){let n=100;const i=this._resolveElements(e);if(!i.length)return;const r=this.findRoot(i);if(!r)return;r!==this.getRootElement()&&this.setRootElement(r);const o=i.filter(g=>g!=r);if(!o.length)return;t||(t={}),typeof t=="number"&&(n=t),t={top:t.top||n,right:t.right||n,bottom:t.bottom||n,left:t.left||n};const a=Tt(o),s=Pe(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=Pe(c);if(!(a.width<c.width&&a.height<c.height))l=a.x-c.x,p=a.y-c.y;else{const g=Math.max(0,s.right-f.right),h=Math.min(0,s.left-f.left),m=Math.max(0,s.bottom-f.bottom),w=Math.min(0,s.top-f.top);l=g||h,p=m||w}this.scroll({dx:-l*u,dy:-p*u})},De.prototype.zoom=function(e,t){if(!e)return this.viewbox(e).scale;if(e==="fit-viewport")return this._fitViewport(t);let n,i;return this._changeViewbox(function(){typeof t!="object"&&(n=this.viewbox().outer,t={x:n.width/2,y:n.height/2}),i=this._setZoom(e,t)}),Ms(i.a,1e3)};function pm(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}De.prototype._fitViewport=function(e){const t=this.viewbox(),n=t.outer,i=t.inner;let r,o;return i.x>=0&&i.y>=0&&i.x+i.width<=n.width&&i.y+i.height<=n.height&&!e?o={x:0,y:0,width:Math.max(i.width+i.x,n.width),height:Math.max(i.height+i.y,n.height)}:(r=Math.min(1,n.width/i.width,n.height/i.height),o={x:i.x+(e?i.width/2-n.width/r/2:0),y:i.y+(e?i.height/2-n.height/r/2:0),width:n.width/r,height:n.height/r}),this.viewbox(o),this.viewbox(!1).scale},De.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,r=n.createSVGMatrix(),o=n.createSVGPoint();let a,s,c,u,l;c=i.getCTM();const p=c.a;return t?(a=H(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),pm(this._viewport,l),l},De.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},De.prototype.getAbsoluteBBox=function(e){const t=this.viewbox();let n;e.waypoints?n=this.getGraphics(e).getBBox():n=e;const i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale,o=n.width*t.scale,a=n.height*t.scale;return{x:i,y:r,width:o,height:a}},De.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var lo="data-element-id";function In(e){this._elements={},this._eventBus=e}In.$inject=["eventBus"],In.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),he(t,lo,i),n&&he(n,lo,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},In.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(he(i.gfx,lo,""),i.secondaryGfx&&he(i.secondaryGfx,lo,""),delete t[n])},In.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)},In.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&he(t,lo,i),t},In.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&he(e,lo);var n=this._elements[t];return n&&n.element},In.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},In.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}},In.prototype.getAll=function(){return this.filter(function(e){return e})},In.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)})},In.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},In.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 bS(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 _S(e){return e.__refs_collection===!0}function xS(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function fm(e,t,n){var i=bS(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 wS(e,t,n){var i=t.inverse,r=n[t.name];Object.defineProperty(n,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return r},set:function(o){if(o!==r){var a=r;r=null,a&&e.unset(a,i,n),r=o,e.set(r,i,n)}}})}function jn(e,t){if(!(this instanceof jn))return new jn(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}jn.prototype.bind=function(e,t){if(typeof t=="string"){if(!this.props[t])throw new Error("no property <"+t+"> in ref");t=this.props[t]}t.collection?fm(this,t,e):wS(this,t,e)},jn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return _S(n)||fm(this,t,e),n},jn.prototype.ensureBound=function(e,t){xS(e,t)||this.bind(e,t)},jn.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},jn.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var Sl=new jn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),dm=new jn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),hm=new jn({name:"attachers",collection:!0},{name:"host"}),mm=new jn({name:"outgoing",collection:!0},{name:"source"}),gm=new jn({name:"incoming",collection:!0},{name:"target"});function po(){Object.defineProperty(this,"businessObject",{writable:!0}),Object.defineProperty(this,"label",{get:function(){return this.labels[0]},set:function(e){var t=this.label,n=this.labels;!e&&t?n.remove(t):n.add(e,0)}}),Sl.bind(this,"parent"),dm.bind(this,"labels"),mm.bind(this,"outgoing"),gm.bind(this,"incoming")}function ia(){po.call(this),Sl.bind(this,"children"),hm.bind(this,"host"),hm.bind(this,"attachers")}de(ia,po);function ym(){po.call(this),Sl.bind(this,"children")}de(ym,ia);function vm(){ia.call(this),dm.bind(this,"labelTarget")}de(vm,ia);function bm(){po.call(this),mm.bind(this,"source"),gm.bind(this,"target")}de(bm,po);var ES={connection:bm,shape:ia,label:vm,root:ym};function SS(e,t){var n=ES[e];if(!n)throw new Error("unknown type: <"+e+">");return H(new n,t)}function RS(e){return e instanceof po}function Oi(){this._uid=12}Oi.prototype.createRoot=function(e){return this.create("root",e)},Oi.prototype.createLabel=function(e){return this.create("label",e)},Oi.prototype.createShape=function(e){return this.create("shape",e)},Oi.prototype.createConnection=function(e){return this.create("connection",e)},Oi.prototype.create=function(e,t){return t=H({},t||{}),t.id||(t.id=e+"_"+this._uid++),SS(e,t)};var ks="__fn",_m=1e3,CS=Array.prototype.slice;function Pn(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}Pn.prototype.on=function(e,t,n,i){if(e=ke(e)?e:[e],Wt(t)&&(i=n,n=t,t=_m),!Le(t))throw new Error("priority must be a number");var r=n;i&&(r=mn(n,i),r[ks]=n[ks]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},Pn.prototype.once=function(e,t,n,i){var r=this;if(Wt(t)&&(i=n,n=t,t=_m),!Le(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[ks]=n,this.on(e,t,o)},Pn.prototype.off=function(e,t){e=ke(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},Pn.prototype.createEvent=function(e){var t=new ra;return t.init(e),t},Pn.prototype.fire=function(e,t){var n,i,r,o;if(o=CS.call(arguments),typeof e=="object"&&(t=e,e=t.type),!e)throw new Error("no event type specified");if(i=this._listeners[e],!!i){t instanceof ra?n=t:n=this.createEvent(t),o[0]=n;var a=n.type;e!==a&&(n.type=e);try{r=this._invokeListeners(n,o,i)}finally{e!==a&&(n.type=a)}return r===void 0&&n.defaultPrevented&&(r=!1),r}},Pn.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},Pn.prototype._destroy=function(){this._listeners={}},Pn.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},Pn.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=PS(n.callback,t),i!==void 0&&(e.returnValue=i,e.stopPropagation()),i===!1&&e.preventDefault()}catch(r){if(!this.handleError(r))throw console.error("unhandled error in event listener",r),r}return i},Pn.prototype._addListener=function(e,t){var n=this._getListeners(e),i;if(!n){this._setListeners(e,t);return}for(;n;){if(n.priority<t.priority){t.next=n,i?i.next=t:this._setListeners(e,t);return}i=n,n=n.next}i.next=t},Pn.prototype._getListeners=function(e){return this._listeners[e]},Pn.prototype._setListeners=function(e,t){this._listeners[e]=t},Pn.prototype._removeListener=function(e,t){var n=this._getListeners(e),i,r,o;if(!t){this._setListeners(e,null);return}for(;n;)i=n.next,o=n.callback,(o===t||o[ks]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function ra(){}ra.prototype.stopPropagation=function(){this.cancelBubble=!0},ra.prototype.preventDefault=function(){this.defaultPrevented=!0},ra.prototype.init=function(e){H(this,e||{})};function PS(e,t){return e.apply(null,t)}function Dr(e){return e.childNodes[0]}function AS(e){return e.parentNode.childNodes[1]}function Os(e,t,n,i,r){var o=Xo();o.setTranslate(t,n);var a=Xo();a.setRotate(i||0,0,0);var s=Xo();s.setScale(1,1),Zo(e,[o,a,s])}function en(e,t,n){var i=Xo();i.setTranslate(t,n),Zo(e,i)}function xm(e,t){var n=Xo();n.setRotate(t,0,0),Zo(e,n)}function Nn(e,t){this._eventBus=e,this._elementRegistry=t}Nn.$inject=["eventBus","elementRegistry"],Nn.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=AS(t),n||(n=Ce("g"),qe(n).add("djs-children"),Be(t.parentNode,n))):n=t,n},Nn.prototype._clear=function(e){var t=Dr(e);return _s(t),t},Nn.prototype._createContainer=function(e,t,n,i){var r=Ce("g");qe(r).add("djs-group"),typeof n<"u"?TS(r,t,t.childNodes[n]):Be(t,r);var o=Ce("g");qe(o).add("djs-element"),qe(o).add("djs-"+e),i&&qe(o).add("djs-frame"),Be(r,o);var a=Ce("g");return qe(a).add("djs-visual"),Be(o,a),o},Nn.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,qh(t))},Nn.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=Sn(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),L(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r),s=a.firstChild;L(o,function(c){var u=n.getGraphics(c).parentNode;u===s?s=s.nextSibling:a.insertBefore(u,s)})}})},Nn.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},Nn.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},Nn.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},Nn.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},Nn.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),en(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?he(n,"display","none"):he(n,"display","block")}},Nn.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);$t(t.parentNode)};function TS(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const MS={__depends__:[G1],__init__:["canvas"],canvas:["type",De],elementRegistry:["type",In],elementFactory:["type",Oi],eventBus:["type",Pn],graphicsFactory:["type",Nn]};function kS(e){var t=new Wh(e);return t.init(),t}function OS(e){e=e||{};var t={config:["value",e]},n=[t,MS].concat(e.modules||[]);return kS(n)}function ir(e,t){this._injector=t||OS(e),this.get("eventBus").fire("diagram.init")}ir.prototype.get=function(e,t){return this._injector.get(e,t)},ir.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},ir.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},ir.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function cn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function yn(e,t){return e.$instanceOf(t)}function DS(e){return lt(e.rootElements,function(t){return yn(t,"bpmn:Process")||yn(t,"bpmn:Collaboration")})}function LS(e){var t={},n=[],i={};function r(q,U){return function(Z){q(Z,U)}}function o(q){t[q.id]=q}function a(q){return t[q.id]}function s(q,U){var Z=q.gfx;if(Z)throw new Error(`already rendered ${cn(q)}`);return e.element(q,i[q.id],U)}function c(q,U){return e.root(q,i[q.id],U)}function u(q,U){try{var Z=i[q.id]&&s(q,U);return o(q),Z}catch(He){l(He.message,{element:q,error:He}),console.error(`failed to import ${cn(q)}`,He)}}function l(q,U){e.error(q,U)}var p=this.registerDi=function(U){var Z=U.bpmnElement;Z?i[Z.id]?l(`multiple DI elements defined for ${cn(Z)}`,{element:Z}):i[Z.id]=U:l(`no bpmnElement referenced in ${cn(U)}`,{element:U})};function f(q){d(q.plane)}function d(q){p(q),L(q.planeElement,g)}function g(q){p(q)}this.handleDefinitions=function(U,Z){var He=U.diagrams;if(Z&&He.indexOf(Z)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!Z&&He&&He.length&&(Z=He[0]),!Z)throw new Error("no diagram to display");i={},f(Z);var wt=Z.plane;if(!wt)throw new Error(`no plane for ${cn(Z)}`);var M=wt.bpmnElement;if(!M)if(M=DS(U),M)l(`correcting missing bpmnElement on ${cn(wt)} to ${cn(M)}`),wt.bpmnElement=M,p(wt);else throw new Error("no process or collaboration to display");var E=c(M,wt);if(yn(M,"bpmn:Process")||yn(M,"bpmn:SubProcess"))m(M,E);else if(yn(M,"bpmn:Collaboration"))Re(M,E),w(U.rootElements,E);else throw new Error(`unsupported bpmnElement for ${cn(wt)}: ${cn(M)}`);h(n)};var h=this.handleDeferred=function(){for(var U;n.length;)U=n.shift(),U()};function m(q,U){le(q,U),N(q.ioSpecification,U),T(q.artifacts,U),o(q)}function w(q,U){var Z=Ge(q,function(He){return!a(He)&&yn(He,"bpmn:Process")&&He.laneSets});Z.forEach(r(m,U))}function y(q,U){u(q,U)}function _(q,U){L(q,r(y,U))}function S(q,U){u(q,U)}function P(q,U){u(q,U)}function C(q,U){u(q,U)}function D(q,U){u(q,U)}function T(q,U){L(q,function(Z){yn(Z,"bpmn:Association")?n.push(function(){D(Z,U)}):D(Z,U)})}function N(q,U){q&&(L(q.dataInputs,r(P,U)),L(q.dataOutputs,r(C,U)))}var k=this.handleSubProcess=function(U,Z){le(U,Z),T(U.artifacts,Z)};function O(q,U){var Z=u(q,U);yn(q,"bpmn:SubProcess")&&k(q,Z||U),yn(q,"bpmn:Activity")&&N(q.ioSpecification,U),n.push(function(){L(q.dataInputAssociations,r(S,U)),L(q.dataOutputAssociations,r(S,U))})}function F(q,U){u(q,U)}function ae(q,U){u(q,U)}function _e(q,U){n.push(function(){var Z=u(q,U);q.childLaneSet&&We(q.childLaneSet,Z||U),re(q)})}function We(q,U){L(q.lanes,r(_e,U))}function Y(q,U){L(q,r(We,U))}function le(q,U){ge(q.flowElements,U),q.laneSets&&Y(q.laneSets,U)}function ge(q,U){L(q,function(Z){yn(Z,"bpmn:SequenceFlow")?n.push(function(){F(Z,U)}):yn(Z,"bpmn:BoundaryEvent")?n.unshift(function(){O(Z,U)}):yn(Z,"bpmn:FlowNode")?O(Z,U):yn(Z,"bpmn:DataObject")||(yn(Z,"bpmn:DataStoreReference")||yn(Z,"bpmn:DataObjectReference")?ae(Z,U):l(`unrecognized flowElement ${cn(Z)} in context ${cn(U&&U.businessObject)}`,{element:Z,context:U}))})}function ue(q,U){var Z=u(q,U),He=q.processRef;He&&m(He,Z||U)}function Re(q,U){L(q.participants,r(ue,U)),n.push(function(){_(q.messageFlows,U)}),T(q.artifacts,U)}function re(q){L(q.flowNodeRef,function(U){var Z=U.get("lanes");Z&&Z.push(q)})}}function x(e,t){var n=te(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function ze(e,t){return Ui(t,function(n){return x(e,n)})}function te(e){return e&&e.businessObject||e}function Ye(e){return e&&e.di}function IS(e,t,n){var i,r,o,a,s=[];function c(u,l){var p={root:function(h,m){return i.add(h,m)},element:function(h,m,w){return i.add(h,m,w)},error:function(h,m){s.push({message:h,context:m})}},f=new LS(p);l=l||u.diagrams&&u.diagrams[0];var d=NS(u,l);if(!d)throw new Error("no diagram to display");L(d,function(h){f.handleDefinitions(u,h)});var g=l.plane.bpmnElement.id;o.setRootElement(o.findRoot(g+"_plane")||o.findRoot(g))}return new Promise(function(u,l){try{return i=e.get("bpmnImporter"),r=e.get("eventBus"),o=e.get("canvas"),r.fire("import.render.start",{definitions:t}),c(t,n),r.fire("import.render.complete",{error:a,warnings:s}),u({warnings:s})}catch(p){return p.warnings=s,l(p)}})}function NS(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!x(n,"bpmn:Process")&&!x(n,"bpmn:Collaboration")&&(i=BS(n));var r;x(i,"bpmn:Collaboration")?r=i:r=lt(e.rootElements,function(u){if(x(u,"bpmn:Collaboration"))return lt(u.participants,function(l){return l.processRef===i})});var o=[i];r&&(o=on(r.participants,function(u){return u.processRef}),o.push(r));var a=wm(o),s=[t],c=[n];return L(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 wm(e){var t=[];return L(e,function(n){n&&(t.push(n),t=t.concat(wm(n.flowElements)))}),t}function BS(e){for(var t=e;t;){if(x(t,"bpmn:Process"))return t;t=t.$parent}}var $S='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.02 5.57" width="53" height="21"><path fill="currentColor" d="M1.88.92v.14c0 .41-.13.68-.4.8.33.14.46.44.46.86v.33c0 .61-.33.95-.95.95H0V0h.95c.65 0 .93.3.93.92zM.63.57v1.06h.24c.24 0 .38-.1.38-.43V.98c0-.28-.1-.4-.32-.4zm0 1.63v1.22h.36c.2 0 .32-.1.32-.39v-.35c0-.37-.12-.48-.4-.48H.63zM4.18.99v.52c0 .64-.31.98-.94.98h-.3V4h-.62V0h.92c.63 0 .94.35.94.99zM2.94.57v1.35h.3c.2 0 .3-.09.3-.37v-.6c0-.29-.1-.38-.3-.38h-.3zm2.89 2.27L6.25 0h.88v4h-.6V1.12L6.1 3.99h-.6l-.46-2.82v2.82h-.55V0h.87zM8.14 1.1V4h-.56V0h.79L9 2.4V0h.56v4h-.64zm2.49 2.29v.6h-.6v-.6zM12.12 1c0-.63.33-1 .95-1 .61 0 .95.37.95 1v2.04c0 .64-.34 1-.95 1-.62 0-.95-.37-.95-1zm.62 2.08c0 .28.13.39.33.39s.32-.1.32-.4V.98c0-.29-.12-.4-.32-.4s-.33.11-.33.4z"/><path fill="currentColor" d="M0 4.53h14.02v1.04H0zM11.08 0h.63v.62h-.63zm.63 4V1h-.63v2.98z"/></svg>',Em=$S,Sm={verticalAlign:"middle"},Rm={color:"#404040"},jS={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},FS={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},HS={position:"absolute",left:"50%",top:"40%",transform:"translate(-50%)",width:"260px",padding:"10px",background:"white",boxShadow:"0 1px 4px rgba(0,0,0,0.3)",fontFamily:"Helvetica, Arial, sans-serif",fontSize:"14px",display:"flex",lineHeight:"1.3"},zS='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+Em+'</a><span>Web-based tooling for BPMN, DMN and forms powered by <a href="https://bpmn.io" target="_blank" rel="noopener">bpmn.io</a>.</span></div></div>',gi;function GS(){gi=ft(zS),dn(gi,jS),dn(ot("svg",gi),Sm),dn(ot(".backdrop",gi),FS),dn(ot(".notice",gi),HS),dn(ot(".link",gi),Rm,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function VS(){gi||(GS(),Cn.bind(gi,".backdrop","click",function(e){document.body.removeChild(gi)})),document.body.appendChild(gi)}const Ds=5,Cm="djs-outline-hidden";function vt(e){e=H({},US,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),YS(this._container)}de(vt,ir),vt.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||[]),Ls(s,o),s=WS(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},vt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},vt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw Ls(o,[]),o}if(typeof t=="string"&&(i=qS(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw Ls(o,[]),o}try{this.clear()}catch(o){throw Ls(o,[]),o}const{warnings:r}=await IS(this,n,i);return{warnings:r}},vt.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},vt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=ot(":scope > defs",i._svg),a=Vh(r),s=o?"<defs>"+Vh(o)+"</defs>":"",c=i.getContainer();yt(c).add(Cm);let u;try{u=r.getBBox()}finally{yt(c).remove(Cm)}const l=u.x-Ds,p=u.y-Ds,f=u.width+Ds*2,d=u.height+Ds*2;t=`<?xml version="1.0" encoding="utf-8"?>
|
|
4
|
+
nested error: `+P.message;if(D)return a.addWarning({message:j,error:P}),!0;throw Yi(j)}function l(P,C){return u(P,C,!0)}function f(){var P=a.elementsById,C=a.references,D,T;for(D=0;T=C[D];D++){var $=T.element,k=P[T.id],O=Ci($).propertiesByName[T.property];if(k||a.addWarning({message:"unresolved reference <"+T.id+">",element:T.element,property:T.property,value:T.id}),O.isMany){var j=$.get(O.name),se=j.indexOf(T);se===-1&&(se=j.length),k?j[se]=k:j.splice(se,1)}else $.set(O.name,k)}}function p(){c.pop().handleEnd()}var d=/^<\?xml /i,g=/ encoding="([^"]+)"/i,h=/^utf-8$/i;function m(P){if(d.test(P)){var C=g.exec(P),D=C&&C[1];!D||h.test(D)||a.addWarning({message:"unsupported document encoding <"+D+">, falling back to UTF-8"})}}function _(P,C){var D=c.peek();try{c.push(D.handleNode(P))}catch(T){u(T,C,o)&&c.push(new Hu)}}function y(P,C){try{c.peek().handleText(P)}catch(D){l(D,C)}}function x(P,C){P.trim()&&y(P,C)}var S=r.getPackages().reduce(function(P,C){return P[C.uri]=C.prefix,P},Object.entries(ju).reduce(function(P,[C,D]){return P[D]=C,P},r.config&&r.config.nsMap||{}));return s.ns(S).on("openTag",function(P,C,D,T){var $=P.attrs||{},k=Object.keys($).reduce(function(j,se){var we=C($[se]);return j[se]=we,j},{}),O={name:P.name,originalName:P.originalName,attributes:k,ns:P.ns};_(O,T)}).on("question",m).on("closeTag",p).on("cdata",y).on("text",function(P,C,D){x(C(P),D)}).on("error",u).on("warn",l),new Promise(function(P,C){var D;try{s.parse(e),f()}catch(j){D=j}var T=i.element;!D&&!T&&(D=Yi("failed to parse document as <"+i.type.$descriptor.name+">"));var $=a.warnings,k=a.references,O=a.elementsById;return D?(D.warnings=$,C(D)):P({rootElement:T,elementsById:O,references:k,warnings:$})})},Vu.prototype.handler=function(e){return new Gu(this.model,e)};function cw(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var uw=`<?xml version="1.0" encoding="UTF-8"?>
|
|
5
|
+
`,lw=/<|>|'|"|&|\n\r|\n/g,Cd=/<|>|&/g;function li(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}li.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},li.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},li.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},li.prototype.add=function(e,t){this.uriMap[e.uri]=e,t?this.wellknown.push(e):this.custom.push(e),this.mapPrefix(e.prefix,e.uri)},li.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},li.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},li.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},li.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},li.prototype.getUsed=function(e){var t=[].concat(this.wellknown,this.custom);return t.filter(n=>{var i=this.getNSKey(n);return this.used[i]})};function pw(e){return e.charAt(0).toLowerCase()+e.slice(1)}function fw(e,t){return wd(t)?pw(e):e}function Pd(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function Ad(e){return En(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function dw(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 hw(e,t){return t.isGeneric?z({localName:t.ns.localName},e):z({localName:fw(t.ns.localName,t.$pkg)},e)}function mw(e,t){return z({localName:t.ns.localName},e)}function gw(e){var t=e.$descriptor;return Ue(t.properties,function(n){var i=n.name;if(n.isVirtual||!Sn(e,i))return!1;var r=e[i];return r===n.default||r===null?!1:n.isMany?r.length:!0})}var yw={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},vw={"<":"lt",">":"gt","&":"amp"};function Td(e,t,n){return e=En(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function bw(e){return Td(e,lw,yw)}function _w(e){return Td(e,Cd,vw)}function xw(e){return Ue(e,function(t){return t.isAttr})}function ww(e){return Ue(e,function(t){return!t.isAttr})}function Wu(e){this.tagName=e}Wu.prototype.build=function(e){return this.element=e,this},Wu.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function Tr(){}Tr.prototype.serializeValue=Tr.prototype.serializeTo=function(e){e.append(this.escape?_w(this.value):this.value)},Tr.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(Cd)!==-1&&(this.escape=!0),this};function Uu(e){this.tagName=e}Pd(Uu,Tr),Uu.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function bt(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}bt.prototype.build=function(e){this.element=e;var t=e.$descriptor,n=this.propertyDescriptor,i,r,o=t.isGeneric;return o?i=this.parseGenericNsAttributes(e):i=this.parseNsAttributes(e),n?this.ns=this.nsPropertyTagName(n):this.ns=this.nsTagName(t),this.tagName=this.addTagName(this.ns),o?this.parseGenericContainments(e):(r=gw(e),this.parseAttributes(xw(r)),this.parseContainments(ww(r))),this.parseGenericAttributes(e,i),this},bt.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return hw(t,e)},bt.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return mw(t,e)},bt.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},bt.prototype.nsAttributeName=function(e){var t;if(En(e)?t=cn(e):t=e.ns,e.inherited)return{localName:t.localName};var n=this.logNamespaceUsed(t);return this.getNamespaces().logUsed(n),this.isLocalNs(n)?{localName:t.localName}:z({localName:t.localName},n)},bt.prototype.parseGenericNsAttributes=function(e){return Object.entries(e).filter(([t,n])=>!t.startsWith("$")&&this.parseNsAttribute(e,t,n)).map(([t,n])=>({name:t,value:n}))},bt.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new Tr().build({type:"String"},t));var n=e.$children;n&&I(n,i=>{this.body.push(new bt(this).build(i))})},bt.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,r=cn(t),o;if(r.prefix==="xmlns"&&(o={prefix:r.localName,uri:n}),!r.prefix&&r.localName==="xmlns"&&(o={uri:n}),!o)return{name:t,value:n};if(i&&i.getPackage(n))this.logNamespace(o,!0,!0);else{var a=this.logNamespaceUsed(o,!0);this.getNamespaces().logUsed(a)}},bt.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return I(n,function(r,o){var a=t.parseNsAttribute(e,o,r);a&&i.push(a)}),i},bt.prototype.parseGenericAttributes=function(e,t){var n=this;I(t,function(i){try{n.addAttribute(n.nsAttributeName(i.name),i.value)}catch(r){typeof console<"u"&&console.warn(`missing namespace information for <${i.name}=${i.value}> on`,e,r)}})},bt.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;I(e,function(r){var o=i.get(r.name),a=r.isReference,s=r.isMany;if(s||(o=[o]),r.isBody)n.push(new Tr().build(r,o[0]));else if(md(r.type))I(o,function(u){n.push(new Uu(t.addTagName(t.nsPropertyTagName(r))).build(r,u))});else if(a)I(o,function(u){n.push(new Wu(t.addTagName(t.nsPropertyTagName(r))).build(u))});else{var c=Sd(r);I(o,function(u){var l;c?c===Ed?l=new bt(t,r):l=new as(t,r,c):l=new bt(t),n.push(l.build(u))})}})},bt.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new li(i):t=i),t},bt.prototype.logNamespace=function(e,t,n){var i=this.getNamespaces(n),r=e.uri,o=e.prefix,a=i.byUri(r);return(!a||n)&&i.add(e,t),i.mapPrefix(o,r),e},bt.prototype.logNamespaceUsed=function(e,t){var n=this.getNamespaces(t),i=e.prefix,r=e.uri,o,a,s;if(!i&&!r)return{localName:e.localName};if(s=n.defaultUriByPrefix(i),r=r||s||n.uriByPrefix(i),!r)throw new Error("no namespace uri given for prefix <"+i+">");if(e=n.byUri(r),!e&&!i&&(e=this.logNamespace({uri:r},s===r,!0)),!e){for(o=i,a=1;n.uriByPrefix(o);)o=i+"_"+a++;e=this.logNamespace({prefix:o,uri:r},s===r)}return i&&n.mapPrefix(i,r),e},bt.prototype.parseAttributes=function(e){var t=this,n=this.element;I(e,function(i){var r=n.get(i.name);if(i.isReference)if(!i.isMany)r=r.id;else{var o=[];I(r,function(a){o.push(a.id)}),r=o.join(" ")}t.addAttribute(t.nsAttributeName(i),r)})},bt.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),Ad(e)},bt.prototype.addAttribute=function(e,t){var n=this.attrs;En(t)&&(t=bw(t));var i=pd(n,function(o){return o.name.localName===e.localName&&o.name.uri===e.uri&&o.name.prefix===e.prefix}),r={name:e,value:t};i!==-1?n.splice(i,1,r):n.push(r)},bt.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=dw(n).concat(t)),I(t,function(i){e.append(" ").append(Ad(i.name)).append('="').append(i.value).append('"')})},bt.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==Tr;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),I(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function as(e,t,n){bt.call(this,e,t),this.serialization=n}Pd(as,bt),as.prototype.parseNsAttributes=function(e){var t=bt.prototype.parseNsAttributes.call(this,e).filter(a=>a.name!==this.serialization),n=e.$descriptor;if(n.name===this.propertyDescriptor.type)return t;var i=this.typeNs=this.nsTagName(n);this.getNamespaces().logUsed(this.typeNs);var r=e.$model.getPackage(i.uri),o=r.xml&&r.xml.typePrefix||"";return this.addAttribute(this.nsAttributeName(this.serialization),(i.prefix?i.prefix+":":"")+o+n.ns.localName),t},as.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function Ew(){this.value="",this.write=function(e){this.value+=e}}function Sw(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 Rw(e){e=z({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new Ew,o=new Sw(r,e.format);e.preamble&&o.append(uw);var a=new bt,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(Cw(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function Cw(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in ju)n[i]=ju[i];for(const i in t){const r=t[i];n[r]=i}for(const i of e.getPackages())n[i.prefix]=i.uri;return n}function ss(e,t){zn.call(this,e,t)}ss.prototype=Object.create(zn.prototype),ss.prototype.fromXML=function(e,t,n){En(t)||(n=t,t="bpmn:Definitions");var i=new Vu(z({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},ss.prototype.toXML=function(e,t){var n=new Rw(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var Pw="BPMN20",Aw="http://www.omg.org/spec/BPMN/20100524/MODEL",Tw="bpmn",Mw=[],kw=[{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"}]}],Ow=[{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"}]}],Dw={tagAlias:"lowerCase",typePrefix:"t"},Lw={name:Pw,uri:Aw,prefix:Tw,associations:Mw,types:kw,enumerations:Ow,xml:Dw},Iw="BPMNDI",Bw="http://www.omg.org/spec/BPMN/20100524/DI",Nw="bpmndi",$w=[{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"]}],Fw=[{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"}]}],jw=[],Hw={name:Iw,uri:Bw,prefix:Nw,types:$w,enumerations:Fw,associations:jw},zw="DC",Gw="http://www.omg.org/spec/DD/20100524/DC",Vw="dc",Ww=[{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}]}],Uw=[],qw={name:zw,uri:Gw,prefix:Vw,types:Ww,associations:Uw},Yw="DI",Kw="http://www.omg.org/spec/DD/20100524/DI",Xw="di",Zw=[{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"}]}],Qw=[],Jw={tagAlias:"lowerCase"},eE={name:Yw,uri:Kw,prefix:Xw,types:Zw,associations:Qw,xml:Jw},tE="bpmn.io colors for BPMN",nE="http://bpmn.io/schema/bpmn/biocolor/1.0",iE="bioc",rE=[{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"}]}],oE=[],aE=[],sE={name:tE,uri:nE,prefix:iE,types:rE,enumerations:oE,associations:aE},cE="BPMN in Color",uE="http://www.omg.org/spec/BPMN/non-normative/color/1.0",lE="color",pE=[{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"}]}],fE=[],dE=[],hE={name:cE,uri:uE,prefix:lE,types:pE,enumerations:fE,associations:dE};const mE={bpmn:Lw,bpmndi:Hw,dc:qw,di:eE,bioc:sE,color:hE};function Md(e,t){const n=z({},mE,e);return new ss(n,t)}const gE={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"}},yE="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",kd="i18n",cs={[kd]:gE,[Tu]:ad};function Od(){return Md(cs)}const Dd=Od();async function qu(e){const{rootElement:t,warnings:n}=await Dd.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function vE(e){const{xml:t}=await Dd.toXML(e,{format:!0});return t}function Yu(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const io={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},bE=/[ᄀ-ᇿ -〿-ヿ㐀-鿿가--⦆]/;function _E(e){const t=io;return bE.test(e)?t.cjkEm:e===" "?t.spaceEm:e>="0"&&e<="9"?t.digitEm:e>="A"&&e<="Z"?t.upperEm:e>="a"&&e<="z"?t.lowerEm:t.otherEm}function ro(e,t){let n=0;for(const i of e)n+=t*_E(i);return n}function Ld(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&xE(e),wE(e),EE(e),SE(e)}function xE(e){var i;const t=(i=e.HTMLCanvasElement)==null?void 0:i.prototype;if(!t||t.__headlessTextMeasurement)return;t.__headlessTextMeasurement=!0;const n={font:"12px sans-serif",letterSpacing:"0px",measureText(r){var a;const o=Number.parseFloat(((a=String(n.font).match(/(\d+(?:\.\d+)?)px/))==null?void 0:a[1])??"12");return{width:ro(r,o),fontBoundingBoxAscent:o*io.ascentEm,fontBoundingBoxDescent:o*io.descentEm,actualBoundingBoxAscent:o*io.ascentEm,actualBoundingBoxDescent:o*io.descentEm}}};t.getContext=()=>n}function wE(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 EE(e){var o;const t=()=>{const a=new e.SVGMatrix;return{type:0,matrix:a,setTranslate(s,c){a.e=s,a.f=c},setScale(s,c){a.a=s,a.d=c},setRotate(s,c=0,u=0){const l=s*Math.PI/180,f=Math.cos(l),p=Math.sin(l);a.a=f,a.b=p,a.c=-p,a.d=f,a.e=c-f*c+p*u,a.f=u-p*c-f*u},setMatrix(s){Object.assign(a,s)}}},n=a=>{const s=t();return Object.assign(s.matrix,a),s},i=(o=e.SVGSVGElement)==null?void 0:o.prototype;i&&!i.createSVGTransform&&(i.createSVGTransform=t,i.createSVGTransformFromMatrix=n,i.createSVGMatrix=()=>new e.SVGMatrix,i.createSVGPoint=()=>({x:0,y:0,matrixTransform:()=>({x:0,y:0})}));const r=e.SVGElement.prototype;Object.getOwnPropertyDescriptor(r,"transform")||Object.defineProperty(r,"transform",{configurable:!0,get(){if(!this.__headlessTransformList){const a=[];this.__headlessTransformList={baseVal:{get numberOfItems(){return a.length},clear:()=>{a.length=0},appendItem:s=>(a.push(s),s),getItem:s=>a[s],createSVGTransformFromMatrix:n,consolidate:()=>a[a.length-1]??null}}}return this.__headlessTransformList}})}function SE(e){const t=e.SVGElement.prototype;if(!t.getCTM){const n=()=>new e.SVGMatrix;t.getCTM=n,t.getScreenCTM=n}t.getBBox||(t.getBBox=function(){const n=String(this.textContent??"");return{x:0,y:0,width:ro(n,12),height:14}})}const us=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),RE=1,Ku=new Set(["bpmn:TextAnnotation","bpmn:DataStoreReference","bpmn:DataObjectReference","bpmn:DataInput","bpmn:DataOutput"]),CE=2;function ii(e){switch(e.kind){case"label-over-line":return`L|${e.edge}|${e.line}`;case"edge-crosses-shape":return`x|${e.edge}|${e.shape}`;case"shape-overlap":return`o|${e.shapes[0]}|${e.shapes[1]}`;case"shape-outside-container":return`c|${e.shape}|${e.container}`;case"edge-overlap-opposite":return`p|${e.edges[0]}|${e.edges[1]}`;case"edge-overlap-mixed":return`m|${e.edges[0]}|${e.edges[1]}`;case"edge-overlap-unrelated":return`u|${e.edges[0]}|${e.edges[1]}`;case"label-on-shared-segment":return`l|${e.edge}|${e.other}`;case"annotation-over-label":return`a|${e.annotation}|${e.label}`;case"group-overlap-unintended":return`g|${e.groups[0]}|${e.groups[1]}${e.container?`|⊃${e.container}`:""}`;case"group-overlap-unreadable":return e.reason==="minority"?`gu*|${e.group}|${e.shapes.join(",")}`:e.reason==="throughpass"?`gu>|${e.group}|${e.shapes.join(",")}`:`gu|${e.groups[0]}|${e.groups[1]}|${e.shapes.join(",")}`;case"group-stack-unreadable":return`gs|${e.groups.join("|")}|${e.shapes.join(",")}`;case"group-on-container-boundary":return`gb|${e.group}|${e.container}|${e.side}`;case"group-on-group-boundary":return`gg|${e.groups[0]}|${e.groups[1]}|${e.axis}`;case"group-cuts-shape":return`gc|${e.group}|${e.shape}|${e.side}`;case"pool-name-over-label":return`pn|${e.pool}|${e.label}`}}const Id=20,ls=5,Bd=3,PE=8,Nd=12,AE=Nd*1.2;function Xu(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(o=>ro(o,Nd))),r=n.length*AE;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-r/2,width:i,height:r}}const $d=1;function dn(e){const t=[];for(let n=0;n+1<e.waypoints.length;n++){const i=e.waypoints[n],r=e.waypoints[n+1];Math.abs(i.y-r.y)<.5&&Math.abs(i.x-r.x)>=.5?t.push({axis:"h",at:i.y,lo:Math.min(i.x,r.x),hi:Math.max(i.x,r.x),dir:r.x>i.x?1:-1}):Math.abs(i.x-r.x)<.5&&Math.abs(i.y-r.y)>=.5&&t.push({axis:"v",at:i.x,lo:Math.min(i.y,r.y),hi:Math.max(i.y,r.y),dir:r.y>i.y?1:-1})}return t}function oo(e,t){let n=null;const i=e.type!==t.type,o=!!(e.source&&e.target&&t.source&&t.target)&&e.source!==t.source&&e.source!==t.target&&e.target!==t.source&&e.target!==t.target;for(const a of dn(e))for(const s of dn(t)){if(a.axis!==s.axis||Math.abs(a.at-s.at)>$d)continue;const c=a.dir!==s.dir?"opposite":i?"mixed":o?"unrelated":null;if(!c)continue;const u=Math.min(a.hi,s.hi)-Math.max(a.lo,s.lo);u>=Id&&(!n||u>n.length)&&(n={axis:a.axis,length:u,kind:c})}return n}function Zu(e){return e.kind==="edge-overlap-opposite"||e.kind==="edge-overlap-mixed"||e.kind==="edge-overlap-unrelated"}function Fd(e,t){const n=oo(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function TE(e,t){let n=0;for(const i of t)i.id!==e.id&&Fd(e,i)&&n++;return n}function Bn(e,t){let n=0;for(const i of t)i.id!==e.id&&oo(e,i)&&n++;return n}const jd=15,Hd=20;function ME(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-Hd||t.at>n[1]+Hd)return null;const i=t.axis==="v"?[e.y,e.y+e.height]:[e.x,e.x+e.width],r=Math.max(i[0],t.lo),o=Math.min(i[1],t.hi);return o>r?[r,o]:null}const Qu=20;function ps(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>$d)continue;const r=Math.max(e.lo,i.lo),o=Math.min(e.hi,i.hi);o-r<Id||n.push([r-Qu,o+Qu])}return n}function fs(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of dn(e)){const o=ME(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of ps(r,dn(a)))if(Math.min(c,o[1])>Math.max(s,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const kE=1,OE=(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 DE(e,t,n,i){const r=n.x+i,o=n.y+i,a=n.x+n.width-i,s=n.y+n.height-i;if(a<=r||s<=o)return!1;const c=t.x-e.x,u=t.y-e.y;let l=0,f=1;const p=(d,g)=>{if(g===0)return d<=0;const h=d/g;if(g>0){if(h>f)return!1;h>l&&(l=h)}else{if(h<l)return!1;h<f&&(f=h)}return!0};return p(r-e.x,c)&&p(e.x-a,-c)&&p(o-e.y,u)&&p(e.y-s,-u)&&f>l}function Ju(e,t,n){return e.x+n<t.x+t.width-n&&t.x+n<e.x+e.width-n&&e.y+n<t.y+t.height-n&&t.y+n<e.y+e.height-n}const LE=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,ao=1;function Pi(e,t){const n=e.x+ao,i=e.x+e.width-ao,r=e.y+ao,o=e.y+e.height-ao;return t.axis==="h"?t.at>r&&t.at<o&&t.lo<i&&t.hi>n:t.at>n&&t.at<i&&t.lo<o&&t.hi>r}function Ko(e){return[{axis:"h",at:e.y,lo:e.x,hi:e.x+e.width,dir:1},{axis:"h",at:e.y+e.height,lo:e.x,hi:e.x+e.width,dir:1},{axis:"v",at:e.x,lo:e.y,hi:e.y+e.height,dir:1},{axis:"v",at:e.x+e.width,lo:e.y,hi:e.y+e.height,dir:1}]}function zd(e,t){const n=e.label;if(!n)return null;if(dn(e).some(i=>Pi(n,i)))return e.id;for(const i of[...t.edges].filter(r=>r.id!==e.id).sort((r,o)=>r.id.localeCompare(o.id)))if(dn(i).some(r=>Pi(n,r)))return i.id;for(const i of t.shapes.filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(Ko(i).some(r=>Pi(n,r)))return i.id;return null}function hn(e,t){const n=new Set(e.endpoints),i=[];for(const r of t)if(!n.has(r.id)){for(let o=0;o+1<e.waypoints.length;o++)if(DE(e.waypoints[o],e.waypoints[o+1],r,CE)){i.push(r);break}}return i}function IE(e,t,n,i){const r=(u,l,f)=>(l.x-u.x)*(f.y-u.y)-(l.y-u.y)*(f.x-u.x),o=r(n,i,e),a=r(n,i,t),s=r(e,t,n),c=r(e,t,i);return o*a<0&&s*c<0}const Gd=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function ds(e,t){let n=0;for(const i of t){if(i.id===e.id||Gd(e,i))continue;let r=!1;for(let o=0;o+1<e.waypoints.length&&!r;o++)for(let a=0;a+1<i.waypoints.length&&!r;a++)IE(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function Nn(e,t){let n=0;for(const i of t)i.id===e.id||Gd(e,i)||ds(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function Vd(e){let t=0;const n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)ds(n[i],[n[r]])>0&&(t+=n[i].type===n[r].type?2:1);return t}function el(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(ds(n[i],[n[r]])>0){const o=n[i].id,a=n[r].id;t.push(o<a?[o,a]:[a,o])}return t.sort((i,r)=>`${i[0]}|${i[1]}`.localeCompare(`${r[0]}|${r[1]}`))}function Wd(e){const t=el(e),n=a=>a==="bpmn:MessageFlow"||a.endsWith("Association")?"dashed":"solid",i=new Map(e.edges.map(a=>[a.id,a]));let r=0,o=0;for(const[a,s]of t){const c=i.get(a),u=i.get(s);if(!c||!u)continue;const l=n(c.type),f=n(u.type);l==="solid"&&f==="solid"?r++:l==="dashed"&&f==="dashed"&&o++}return{pairs:t,solidPairs:r,dashedPairs:o,mixedPairs:t.length-r-o,crossPoolMessages:BE(e)}}function BE(e){const t=e.shapes.filter(r=>r.type==="bpmn:Participant");if(t.length<3)return 0;const n=r=>{const o=e.shapes.find(a=>a.id===r);if(o)return t.find(a=>o.x>=a.x&&o.y>=a.y&&o.x+o.width<=a.x+a.width&&o.y+o.height<=a.y+a.height)};let i=0;for(const r of e.edges){if(r.type!=="bpmn:MessageFlow"||r.endpoints.length<2)continue;const o=n(r.endpoints[0]),a=n(r.endpoints[1]);if(!o||!a||o.id===a.id)continue;const s=Math.min(o.y,a.y),c=Math.max(o.y+o.height,a.y+a.height);t.some(u=>u.id!==o.id&&u.id!==a.id&&u.y>s&&u.y+u.height<c)&&i++}return i}function Ud(e,t,n){const i=new Set(t.flatMap(r=>[...r.members]));return e.shapes.filter(r=>!r.container&&!Ku.has(r.type)&&!i.has(r.id)&&r.x>=n.x&&r.y>=n.y&&r.x+r.width<=n.right&&r.y+r.height<=n.bottom).map(r=>r.id).sort()}function qd(e){var n;const t=(n=yt(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const r=yt(i);if((r==null?void 0:r.$type)!=="bwl:Members"||typeof r.refs!="string")continue;const o=r.refs.split(/\s+/).filter(Boolean);return o.length?o:void 0}}const Yd=e=>e?{members:e}:{},Gn=e=>e.shapes.filter(t=>!t.container);function NE(e,t,n){if(e.type==="bpmn:TextAnnotation")for(const i of t.edges){if(!/Association$/.test(i.type)||!i.endpoints.includes(e.id))continue;const r=i.endpoints.find(a=>a!==e.id),o=r?n.get(r):void 0;if(o){if(o.container)return o.id;if(o.parent)return o.parent}}}function Kd(e,t){const n=e.label;if(!n)return null;for(const i of[...t.edges].sort((r,o)=>r.id.localeCompare(o.id)))if(dn(i).some(r=>Pi(n,r)))return i.id;for(const i of[...t.shapes].filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(Ko(i).some(r=>Pi(n,r)))return i.id;return null}function so(e){const t=[];for(const n of e.shapes)n.label&&t.push({owner:n.id,rect:n.label});for(const n of e.edges)n.label&&t.push({owner:n.id,rect:n.label});return t}function ri(e){const t=[],n=e.shapes.filter(h=>!h.container);for(const h of e.edges)for(const m of hn(h,n))t.push({kind:"edge-crosses-shape",edge:h.id,shape:m.id});const i=n.filter(h=>!h.attached);for(let h=0;h<i.length;h++)for(let m=h+1;m<i.length;m++){const _=i[h],y=i[m];if(!Ju(_,y,RE))continue;const x=_.id<y.id?[_.id,y.id]:[y.id,_.id];t.push({kind:"shape-overlap",shapes:x,identical:LE(_,y)})}const r=e.shapes.filter(h=>h.type==="bpmn:Group"&&Array.isArray(h.members)&&h.members.length>0);for(let h=0;h<r.length;h++)for(let m=h+1;m<r.length;m++){const _=r[h],y=r[m],x=Math.min(_.x+_.width,y.x+y.width)-Math.max(_.x,y.x),S=Math.min(_.y+_.height,y.y+y.height)-Math.max(_.y,y.y);if(x<=ls||S<=ls)continue;const P=_.id<y.id?[_.id,y.id]:[y.id,_.id],C=new Set(y.members);if(_.members.some(T=>C.has(T))){const T=Ud(e,r,{x:Math.max(_.x,y.x),y:Math.max(_.y,y.y),right:Math.min(_.x+_.width,y.x+y.width),bottom:Math.min(_.y+_.height,y.y+y.height)});T.length&&t.push({kind:"group-overlap-unreadable",reason:"orphan",groups:P,shapes:T});continue}const D=_.x<=y.x&&_.y<=y.y&&_.x+_.width>=y.x+y.width&&_.y+_.height>=y.y+y.height?_.id:y.x<=_.x&&y.y<=_.y&&y.x+y.width>=_.x+_.width&&y.y+y.height>=_.y+_.height?y.id:void 0;t.push({kind:"group-overlap-unintended",groups:P,...D?{container:D}:{}})}const o=new Set(r.flatMap(h=>[...h.members])),a=h=>e.shapes.filter(m=>!m.container&&!Ku.has(m.type)&&m.x>=h.x&&m.y>=h.y&&m.x+m.width<=h.x+h.width&&m.y+m.height<=h.y+h.height);for(const h of r){const m=a(h);if(!m.length)continue;const _=new Set(h.members),y=m.filter(x=>!_.has(x.id));y.some(x=>o.has(x.id))&&(y.length*2<m.length||t.push({kind:"group-overlap-unreadable",reason:"minority",group:h.id,shapes:y.map(x=>x.id).sort()}))}for(const h of r){const m=new Set(a(h).map(C=>C.id)),_=new Set(h.members),y=new Set([...m].filter(C=>!_.has(C)&&o.has(C)));if(!y.size)continue;let x=!1,S=!1,P=!1;for(const C of e.edges){if(C.type!=="bpmn:SequenceFlow"||!C.source||!C.target)continue;const D=y.has(C.source),T=y.has(C.target);!D&&T&&!m.has(C.source)?x=!0:D&&!T&&!m.has(C.target)?S=!0:D&&T&&(P=!0)}x&&S&&P&&t.push({kind:"group-overlap-unreadable",reason:"throughpass",group:h.id,shapes:[...y].sort()})}const s=e.shapes.filter(h=>h.type==="bpmn:Group");for(let h=0;h<s.length;h++)for(let m=h+1;m<s.length;m++)for(let _=m+1;_<s.length;_++){const y=[s[h],s[m],s[_]],x={x:Math.max(...y.map(C=>C.x)),y:Math.max(...y.map(C=>C.y)),right:Math.min(...y.map(C=>C.x+C.width)),bottom:Math.min(...y.map(C=>C.y+C.height))};if(x.right-x.x<=ls||x.bottom-x.y<=ls)continue;const S=Ud(e,[],x);if(!S.length)continue;const P=y.map(C=>C.id).sort();t.push({kind:"group-stack-unreadable",groups:P,shapes:S})}for(const h of e.shapes.filter(m=>m.type==="bpmn:Group"))for(const m of e.shapes){if(m.container||m.attached||Ku.has(m.type)||m.width<=0||m.height<=0)continue;const _=[["top",h.y,"h",h.x,h.x+h.width],["bottom",h.y+h.height,"h",h.x,h.x+h.width],["left",h.x,"v",h.y,h.y+h.height],["right",h.x+h.width,"v",h.y,h.y+h.height]];for(const[y,x,S,P,C]of _){const D=S==="h"?m.x:m.y,T=S==="h"?m.x+m.width:m.y+m.height;if(!(D<C&&P<T))continue;const $=S==="h"?m.y:m.x,k=S==="h"?m.y+m.height:m.x+m.width;if(!($<x&&x<k))continue;const O=Math.min(x-$,k-x);O<PE||t.push({kind:"group-cuts-shape",group:h.id,shape:m.id,side:y,depth:O})}}const c=e.shapes.filter(h=>h.container&&h.type!=="bpmn:Group"&&h.type!=="bpmn:Lane");for(const h of e.shapes.filter(m=>m.type==="bpmn:Group"))for(const m of c){const _=h.x<m.x+m.width&&m.x<h.x+h.width,y=h.y<m.y+m.height&&m.y<h.y+h.height,x=[["top",h.y,m.y,_],["bottom",h.y+h.height,m.y+m.height,_],["left",h.x,m.x,y],["right",h.x+h.width,m.x+m.width,y]];for(const[S,P,C,D]of x)D&&Math.abs(P-C)<=Bd&&t.push({kind:"group-on-container-boundary",group:h.id,container:m.id,side:S})}const u=e.shapes.filter(h=>h.type==="bpmn:Group");for(let h=0;h<u.length;h++)for(let m=h+1;m<u.length;m++){const _=u[h],y=u[m],x=_.x<y.x+y.width&&y.x<_.x+_.width,S=_.y<y.y+y.height&&y.y<_.y+_.height,P=[["x",_.x+_.width,y.x,S],["x",y.x+y.width,_.x,S],["y",_.y+_.height,y.y,x],["y",y.y+y.height,_.y,x]];for(const[C,D,T,$]of P)if($&&Math.abs(D-T)<=Bd){t.push({kind:"group-on-group-boundary",groups:_.id<y.id?[_.id,y.id]:[y.id,_.id],axis:C});break}}for(let h=0;h<e.edges.length;h++)for(let m=h+1;m<e.edges.length;m++){const _=e.edges[h],y=e.edges[m],x=oo(_,y);if(!x)continue;const S=_.id<y.id?[_.id,y.id]:[y.id,_.id];t.push({kind:x.kind==="opposite"?"edge-overlap-opposite":x.kind==="mixed"?"edge-overlap-mixed":"edge-overlap-unrelated",edges:S,axis:x.axis,length:Math.round(x.length)})}for(const h of e.edges){if(!h.label)continue;const m=fs(h,e.edges);m&&t.push({kind:"label-on-shared-segment",edge:h.id,other:m.other,axis:m.axis})}for(const h of e.edges){if(!h.label)continue;const m=zd(h,e);m&&t.push({kind:"label-over-line",edge:h.id,line:m})}const l=new Set(n.map(h=>h.id)),f=e.shapes.filter(h=>h.type==="bpmn:Participant"&&h.label);for(const h of[...n,...f.filter(m=>!l.has(m.id))]){if(!h.label)continue;const m=Kd(h,e);m&&t.push({kind:"label-over-line",edge:h.id,line:m})}const p=new Set(e.shapes.filter(h=>h.type==="bpmn:TextAnnotation").map(h=>h.id));for(const h of f)for(const{owner:m,rect:_}of so(e))m===h.id||p.has(m)||Ju(h.label,_,ao)&&t.push({kind:"pool-name-over-label",pool:h.id,label:m});const d=so(e);for(const h of n)if(h.type==="bpmn:TextAnnotation")for(const{owner:m,rect:_}of d)m!==h.id&&Ju(h,_,ao)&&t.push({kind:"annotation-over-label",annotation:h.id,label:m});const g=new Map(e.shapes.map(h=>[h.id,h]));for(const h of n){const m=h.parent??NE(h,e,g);if(!m)continue;const _=g.get(m);!_||!_.container||OE(_,h,kE)||t.push({kind:"shape-outside-container",shape:h.id,container:_.id})}return t.sort((h,m)=>ii(h).localeCompare(ii(m)))}const yt=e=>typeof e=="object"&&e!==null?e:void 0,Rt=e=>typeof e=="number"?e:0,Ai=e=>{const t=yt(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function $E(e){const t=yt(e);if(!t)return[];const n=[];for(const i of["sourceRef","targetRef"]){const r=t[i];for(const o of Array.isArray(r)?r:[r]){const a=Ai(o);a&&n.push(a)}}return n}function FE(e){const t=yt(e);if(!t)return{};const n=Array.isArray(t.sourceRef)?void 0:Ai(t.sourceRef),i=Array.isArray(t.targetRef)?void 0:Ai(t.targetRef);return n&&i?{source:n,target:i}:{}}function jE(e,t){const n=yt(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const r=Ai(n);return r?t.get(r):void 0}if(us.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return Ai(n)}function Xd(e){var a,s,c,u,l;const t=[],n=[],i=((a=yt(e))==null?void 0:a.diagrams)??[],r=new Map,o=new Set;for(const f of((s=yt(e))==null?void 0:s.rootElements)??[]){const p=yt(f);if((p==null?void 0:p.$type)==="bpmn:Collaboration")for(const d of p.participants??[]){const g=yt(d),h=Ai(g),m=Ai(g==null?void 0:g.processRef);h&&m?r.set(m,h):h&&o.add(h)}}for(const f of i){const p=yt((c=yt(f))==null?void 0:c.plane),d=(p==null?void 0:p.planeElement)??[];for(const g of d){const h=yt(g);if(!h)continue;const m=yt(h.bpmnElement),_=typeof(m==null?void 0:m.id)=="string"?m.id:void 0;if(!_)continue;const y=typeof(m==null?void 0:m.$type)=="string"?m.$type:"",x=yt(h.bounds);if(x){const P=h.isExpanded===!1&&y!=="bpmn:Participant",C=yt((u=yt(h.label))==null?void 0:u.bounds),D={id:_,type:y,x:Rt(x.x),y:Rt(x.y),width:Rt(x.width),height:Rt(x.height),container:us.has(y)&&!P,attached:(m==null?void 0:m.attachedToRef)!==void 0,...m?{parent:jE(m,r)}:{},...C?{label:{x:Rt(C.x),y:Rt(C.y),width:Rt(C.width),height:Rt(C.height)}}:{},...y==="bpmn:Group"?Yd(qd(m)):{}},T=h.isHorizontal!==!1,$=typeof(m==null?void 0:m.name)=="string"?m.name:"";o.has(_)&&T&&$&&(D.label=Xu(D,$)),t.push(D);continue}const S=h.waypoint;if(Array.isArray(S)){const P=yt((l=yt(h.label))==null?void 0:l.bounds);n.push({id:_,type:y,waypoints:S.map(C=>{var D,T;return{x:Rt((D=yt(C))==null?void 0:D.x),y:Rt((T=yt(C))==null?void 0:T.y)}}),endpoints:$E(m),...FE(m),...P?{label:{x:Rt(P.x),y:Rt(P.y),width:Rt(P.width),height:Rt(P.height)}}:{}})}}}return{shapes:t,edges:n}}function Zd(e){return ri(Xd(e))}async function HE(e){const{definitions:t,warnings:n}=await qu(e);return{findings:Zd(t),warnings:n}}function ft(e){var i;const t=[],n=[];for(const r of e.getAll()){const o=r;if(o.type==="label"||o.labelTarget)continue;const a=typeof o.type=="string"?o.type:"";if(a==="bpmn:Definitions"||a.startsWith("bpmndi:"))continue;const s=o.waypoints;if(s){const h=yt(o.label),m=Ai(o.source),_=Ai(o.target);n.push({id:o.id,type:a,waypoints:s.map(y=>({x:Rt(y.x),y:Rt(y.y)})),endpoints:[m,_].filter(y=>!!y),...m&&_?{source:m,target:_}:{},...h&&typeof h.x=="number"?{label:{x:h.x,y:Rt(h.y),width:Rt(h.width),height:Rt(h.height)}}:{}});continue}if(typeof o.x!="number"||typeof o.y!="number")continue;const c=yt(o.businessObject),u=yt(o.label);let l=yt(o.parent);for(;l&&l.type==="bpmn:Lane";)l=yt(l.parent);const f=typeof(l==null?void 0:l.type)=="string"?l.type:"",p=l&&us.has(f)&&f!=="bpmn:Group"&&typeof l.id=="string"?l.id:void 0,d={id:o.id,type:a,x:o.x,y:o.y,width:Rt(o.width),height:Rt(o.height),container:us.has(a)&&(a==="bpmn:Participant"||o.collapsed!==!0),attached:(c==null?void 0:c.attachedToRef)!==void 0,...p!==void 0?{parent:p}:{},...u&&typeof u.x=="number"?{label:{x:u.x,y:Rt(u.y),width:Rt(u.width),height:Rt(u.height)}}:{},...a==="bpmn:Group"?Yd(qd(c)):{}},g=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&g&&((i=yt(o.di))==null?void 0:i.isHorizontal)!==!1&&(d.label=Xu(d,g)),t.push(d)}return{shapes:t,edges:n}}const zE={"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 GE(e,t){const n=zE[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function Qd(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function Jd(e){const t=()=>e.getAll().filter(n=>n.type!=="label"&&!("labelTarget"in n&&n.labelTarget));return{isCollaboration:()=>t().some(n=>n.type==="bpmn:Participant"),categoryOf:n=>{const i=e.get(n);if(!(!i||i.type==="label"))return GE(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&Qd(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?Qd(i):void 0},endpointsOf:n=>{var r,o;const i=e.get(n);if(!(!i||i.type==="label")&&"waypoints"in i)return{source:(r=i.source)==null?void 0:r.id,target:(o=i.target)==null?void 0:o.id}}}}const tl=20,VE=4,dt=(e,t)=>Math.abs(e-t)<.5;function nl(e,t,n,i=tl){if(dt(e.y,t.y)&&!dt(e.x,t.x)){const r=Math.min(e.x,t.x),o=Math.max(e.x,t.x);if(!(r<n.x-i&&n.x+n.width+i<o))return null;const a=e.x<t.x?n.x-i:n.x+n.width+i,s=e.x<t.x?n.x+n.width+i:n.x-i,c=u=>[{x:a,y:e.y},{x:a,y:u},{x:s,y:u},{x:s,y:e.y}];return[c(n.y-i),c(n.y+n.height+i)]}if(dt(e.x,t.x)&&!dt(e.y,t.y)){const r=Math.min(e.y,t.y),o=Math.max(e.y,t.y);if(!(r<n.y-i&&n.y+n.height+i<o))return null;const a=e.y<t.y?n.y-i:n.y+n.height+i,s=e.y<t.y?n.y+n.height+i:n.y-i,c=u=>[{x:e.x,y:a},{x:u,y:a},{x:u,y:s},{x:e.x,y:s}];return[c(n.x-i),c(n.x+n.width+i)]}return null}function eh(e,t,n,i=tl){if(n.length<2)return null;if(dt(e.y,t.y)&&!dt(e.x,t.x)){const r=Math.min(e.x,t.x),o=Math.max(e.x,t.x),a=Math.min(...n.map(d=>d.x))-i,s=Math.max(...n.map(d=>d.x+d.width))+i;if(!(r<a&&s<o))return null;const c=e.x<t.x?a:s,u=e.x<t.x?s:a,l=Math.min(...n.map(d=>d.y))-i,f=Math.max(...n.map(d=>d.y+d.height))+i,p=d=>[{x:c,y:e.y},{x:c,y:d},{x:u,y:d},{x:u,y:e.y}];return[p(l),p(f)]}if(dt(e.x,t.x)&&!dt(e.y,t.y)){const r=Math.min(e.y,t.y),o=Math.max(e.y,t.y),a=Math.min(...n.map(d=>d.y))-i,s=Math.max(...n.map(d=>d.y+d.height))+i;if(!(r<a&&s<o))return null;const c=e.y<t.y?a:s,u=e.y<t.y?s:a,l=Math.min(...n.map(d=>d.x))-i,f=Math.max(...n.map(d=>d.x+d.width))+i,p=d=>[{x:e.x,y:c},{x:d,y:c},{x:d,y:u},{x:e.x,y:u}];return[p(l),p(f)]}return null}function th(e,t,n=tl){if(e.length!==4)return null;const[i,r,o,a]=e;if(dt(i.y,r.y)&&dt(r.x,o.x)&&dt(o.y,a.y)){const s=c=>[i,{x:c,y:i.y},{x:c,y:a.y},a];return[s(t.x-n),s(t.x+t.width+n)]}if(dt(i.x,r.x)&&dt(r.y,o.y)&&dt(o.x,a.x)){const s=c=>[i,{x:i.x,y:c},{x:a.x,y:c},a];return[s(t.y-n),s(t.y+t.height+n)]}return null}function il(e,t){if(e.endpoints.length!==2)return[];const n=t.find(f=>f.id===e.endpoints[0]),i=t.find(f=>f.id===e.endpoints[1]);if(!n||!i)return[];if(i.x<=n.x+n.width)return[];const r=n.y+n.height/2,o=i.y+i.height/2;if(r>=i.y&&r<=i.y+i.height)return[];const a=i.x+i.width/2,s=n.x+n.width/2,c=r>o,u=[{x:n.x+n.width,y:r},{x:a,y:r},{x:a,y:c?i.y+i.height:i.y}],l=[{x:s,y:c?n.y:n.y+n.height},{x:s,y:o},{x:i.x,y:o}];return[u,l]}const nh=30,WE=[0,-25,25,-40,40];function UE(e,t){if(e.type!=="bpmn:MessageFlow"||e.endpoints.length!==2)return[];const n=t.find(p=>p.id===e.endpoints[0]),i=t.find(p=>p.id===e.endpoints[1]);if(!n||!i)return[];const r=n.y+n.height/2,o=i.y+i.height/2;if(i.y<n.y+n.height&&i.y+i.height>n.y)return[];const a=o<r,s=a?n.y+n.height:n.y,c=a?s+nh:s-nh,u=a?i.y+i.height:i.y,l=n.x+n.width/2,f=i.x+i.width/2;return WE.map(p=>[{x:l,y:s},{x:l,y:c},{x:f+p,y:c},{x:f+p,y:u}])}const ih=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],co=(e,t,n)=>hn({...e,waypoints:t},n).length;function rh(e,t,n,i){let r=[...e.waypoints],o=co(e,r,t);if(o===0)return null;let a=!1;for(const f of il(e,t))if(co(e,f,t)===0)return f;const s=(i??[]).filter(f=>f.id!==e.id).flatMap(dn),c=f=>dn({...e,waypoints:f}).some(p=>ps(p,s).length>0),u=UE(e,t).filter(f=>co(e,f,t)===0);if(u.length)return u.find(f=>!c(f))??u[0];const l=f=>!n||f.every(p=>p.x>=n.x&&p.x<=n.x+n.width&&p.y>=n.y&&p.y<=n.y+n.height);if(e.endpoints.length===2&&r.length>2){const f=t.find(d=>d.id===e.endpoints[0]),p=t.find(d=>d.id===e.endpoints[1]);if(f&&p&&dt(f.y+f.height/2,p.y+p.height/2)){const d=[r[0],r[r.length-1]];if(dt(d[0].y,d[1].y)&&!dt(d[0].x,d[1].x)){const g=t.filter(y=>!e.endpoints.includes(y.id)&&hn({...e,waypoints:d},[y]).length>0),h=g.length>=2?eh(d[0],d[1],g):null,_=(h?h.map(y=>[d[0],...y,d[1]]):g.length===1?(nl(d[0],d[1],g[0])??[]).map(y=>[d[0],...y,d[1]]):g.length===0?[d]:[]).filter(y=>co(e,y,t)===0&&y.length<=r.length).sort((y,x)=>Number(l(x))-Number(l(y)));if(_.length)return _.find(y=>!c(y))??_[0]}}}for(let f=0;f+1<r.length;f++){const p=r[f],d=r[f+1],g=t.filter(_=>!e.endpoints.includes(_.id)&&hn({...e,waypoints:[p,d]},[_]).length>0);if(g.length<2)continue;const h=eh(p,d,g);if(!h)continue;const m=h.map(_=>ih(r,f,_)).filter(_=>co(e,_,t)===0).sort((_,y)=>Number(l(y))-Number(l(_)));if(m.length)return m.find(_=>!c(_))??m[0]}for(let f=0;f<VE&&o>0;f++){let p=!1;for(let d=0;d+1<r.length&&!p;d++){const g=r[d],h=r[d+1];for(const m of t){if(e.endpoints.includes(m.id)||hn({...e,waypoints:[g,h]},[m]).length===0)continue;const _=nl(g,h,m),y=_?_.map(S=>ih(r,d,S)):th(r,m)??[];if(!y.length)continue;const x=[...y].sort((S,P)=>Number(l(P))-Number(l(S)));for(const S of x){const P=co(e,S,t);if(P<o){r=S,o=P,p=!0,a=!0;break}}if(p)break}}if(!p)break}return a&&o===0?r:null}function oh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=ft(n),o=Gn(r),a=ri(r).filter(c=>c.kind==="edge-crosses-shape"&&!t.has(ii(c)));if(!a.length)return;const s=new Map;for(const c of a){if(c.kind!=="edge-crosses-shape"||s.has(c.edge))continue;const u=r.edges.find(l=>l.id===c.edge);u&&s.set(c.edge,u)}for(const[c,u]of s){const l=n.get(c);if(!l)continue;const f=l.parent,p=f&&typeof f.x=="number"&&typeof f.width=="number"?{x:f.x,y:f.y,width:f.width,height:f.height}:void 0,d=rh(u,o,p,r.edges);if(!d)continue;const g=r.edges.filter(_=>_.id!==c),h=Bn(u,g);Bn({...u,waypoints:d},g)>h||i.updateWaypoints(l,d)}}const qE=10;function ah(e,t){if(e.parent){const r=t.find(o=>o.id===e.parent);if(r)return r}const n=e.x+e.width/2,i=e.y+e.height/2;return t.find(r=>n>=r.x&&n<=r.x+r.width&&i>=r.y&&i<=r.y+r.height)}function sh(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(j=>j.type==="bpmn:Participant"&&j.container),i=t.shapes.find(j=>j.id===e.endpoints[0]),r=t.shapes.find(j=>j.id===e.endpoints[1]);if(!i||!r)return null;const o=ah(i,n),a=ah(r,n);if(!o||!a||o.id===a.id)return null;const s=a.y>o.y,c=s?o:a,u=s?a:o,l=n.filter(j=>j.id!==o.id&&j.id!==a.id&&j.y>=c.y+c.height&&j.y+j.height<=u.y).sort((j,se)=>j.y-se.y);if(!l.length)return null;const f=l[0],p=l[l.length-1],d=(c.y+c.height+f.y)/2,g=(p.y+p.height+u.y)/2,h=s?d:g,m=s?g:d,_=e.waypoints[0],y=e.waypoints[e.waypoints.length-1],x=Gn(t),S=t.edges.filter(j=>j.id!==e.id),P=Nn(e,S),C=hn(e,x).length;if(P===0&&C===0||C===0&&e.waypoints.length===2)return null;const D=Math.min(...l.map(j=>j.x)),T=Math.max(...l.map(j=>j.x+j.width)),$=(_.x+y.x)/2,k=j=>j.filter((se,we)=>we===0||!(dt(se.x,j[we-1].x)&&dt(se.y,j[we-1].y)));let O;for(let j=D;j<=T;j+=qE){const se=k([_,{x:_.x,y:h},{x:j,y:h},{x:j,y:m},{x:y.x,y:m},y]),we={...e,waypoints:se};if(hn(we,x).length>0)continue;const Ke=Nn(we,S),Y=Math.abs(j-$);(!O||Ke<O.cross||Ke===O.cross&&Y<O.detour)&&(O={pts:se,cross:Ke,detour:Y})}return O&&(C>0?O.cross<=P:O.cross<P)?O.pts:null}function ch(e,t){const{elementRegistry:n}=e,i=e.modeling,r=ft(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=ft(n),s=a.edges.find(l=>l.id===o.id);if(!s)continue;const c=sh(s,a);if(!c)continue;const u=n.get(o.id);u&&i.updateWaypoints(u,c)}}const Ki=[25,-25,40,-40],hs=35;function ms(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];if(i.x+i.width>n.x)return[];const r=n.y+n.height/2;if(r>=i.y&&r<=i.y+i.height)return[];const o=i.x+i.width/2,a=n.x+n.width/2,s=r<i.y,c=s?i.y:i.y+i.height,u=s?n.y:n.y+n.height,l=s?n.y-hs:n.y+n.height+hs,f=[];for(const y of[0,...Ki]){if(Math.abs(y)>=i.width/2-5)continue;const x=o+y;f.push({pts:[{x:n.x,y:r},{x,y:r},{x,y:c}],cost:Math.abs(y)});for(const S of[0,...Ki]){if(Math.abs(S)>=n.width/2-5)continue;const P=a+S;f.push({pts:[{x:P,y:u},{x:P,y:l},{x,y:l},{x,y:c}],cost:Math.abs(y)+Math.abs(S)})}}const p=50,d=i.y+i.height/2,g=s?n.y+n.height:n.y;for(const y of[0,...Ki]){if(Math.abs(y)>=n.width/2-5)continue;const x=a+y;f.push({pts:[{x,y:g},{x,y:d},{x:i.x+i.width,y:d}],cost:p+Math.abs(y)})}const h=60,m=s?i.y+i.height:i.y,_=s?i.y+i.height+hs:i.y-hs;for(const y of[0,...Ki]){if(Math.abs(y)>=i.width/2-5)continue;const x=o+y;for(const S of[0,...Ki]){if(Math.abs(S)>=n.width/2-5)continue;const P=a+S;f.push({pts:[{x:P,y:g},{x:P,y:_},{x,y:_},{x,y:m}],cost:h+Math.abs(y)+Math.abs(S)})}}return f}const gs=30;function uh(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],r=e[n+1],o=dt(i.y,r.y)&&!dt(i.x,r.x),a=dt(i.x,r.x)&&!dt(i.y,r.y);if(!(!o&&!a))for(const s of t)if(o){const c=Math.min(i.x,r.x);if(Math.max(i.x,r.x)<=s.x||c>=s.x+s.width)continue;if(Math.abs(i.y-s.y)<gs||Math.abs(i.y-(s.y+s.height))<gs)return!0}else{const c=Math.min(i.y,r.y);if(Math.max(i.y,r.y)<=s.y||c>=s.y+s.height)continue;if(Math.abs(i.x-s.x)<gs||Math.abs(i.x-(s.x+s.width))<gs)return!0}}return!1}const ys=40;function YE(e,t,n){let i=0;for(const r of t){if(r.container||n.includes(r.id))continue;const o=r.x-ys,a=r.x+r.width+ys,s=r.y-ys,c=r.y+r.height+ys;for(let u=1;u<e.length-2;u++){const l=e[u],f=e[u+1],p={x:Math.min(l.x,f.x),y:Math.min(l.y,f.y)},d={x:Math.max(l.x,f.x),y:Math.max(l.y,f.y)};if(p.x<a&&d.x>o&&p.y<c&&d.y>s){i++;break}}}return i}function lh(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(C=>C.container),i=new Map(t.shapes.map(C=>[C.id,C])),r=Gn(t),o=t.edges.filter(C=>C.id!==e.id),a=Bn(e,o),s=Nn(e,o),c=C=>YE(C,t.shapes,e.endpoints)+(uh(C,n)?1:0),u=c(e.waypoints),l=C=>{if(!C)return;const D=C.x+C.width/2,T=C.y+C.height/2;return n.find($=>$.type==="bpmn:Lane"&&D>=$.x&&D<=$.x+$.width&&T>=$.y&&T<=$.y+$.height)},f=l(i.get(e.endpoints[0]??"")),p=l(i.get(e.endpoints[1]??"")),d=!!f&&!!p&&f.id!==p.id,g=C=>{if(!d||!p)return!1;for(let D=1;D<C.length-2;D++){const T=C[D],$=C[D+1];if(dt(T.y,$.y)&&!dt(T.x,$.x)&&T.y>p.y&&T.y<p.y+p.height)return!0}return!1},h=g(e.waypoints),_=(C=>{if(!C)return;const D=C.x+C.width/2,T=C.y+C.height/2;return n.filter($=>$.type==="bpmn:Participant"&&D>=$.x&&D<=$.x+$.width&&T>=$.y&&T<=$.y+$.height).sort(($,k)=>$.width*$.height-k.width*k.height)[0]})(i.get(e.endpoints[0]??"")),y=C=>{if(!_)return 0;let D=0;for(let T=1;T<C.length-1;T++){const $=C[T];($.x<_.x||$.x>_.x+_.width||$.y<_.y||$.y>_.y+_.height)&&D++}return D},x=y(e.waypoints);if(!uh(e.waypoints,n)&&!(d&&!h)&&x===0)return null;const S=C=>C.reduce((D,T,$)=>$?D+Math.abs(T.x-C[$-1].x)+Math.abs(T.y-C[$-1].y):0,0);let P;for(const{pts:C,cost:D}of ms(e,i)){const T={...e,waypoints:C};if(hn(T,r).length>0)continue;const $=Bn(T,o);if($>a)continue;const k=y(C);if(k>x)continue;const O=k<x&&$===0;if(!O&&Nn(T,o)>s)continue;const j=c(C),se=g(C);if(!O&&!(se&&!h)&&j>=u)continue;const Ke=se?0:1,Y=S(C);(!P||k<P.out||k===P.out&&(Ke<P.lane||Ke===P.lane&&($<P.opp||$===P.opp&&(j<P.sc||j===P.sc&&(D<P.cost||D===P.cost&&Y<P.len)))))&&(P={pts:C,out:k,sc:j,lane:Ke,opp:$,cost:D,len:Y})}return(P==null?void 0:P.pts)??null}function KE(e,t){const{elementRegistry:n}=e,i=e.modeling,r=ft(n).edges.filter(o=>!t.has(o.id)&&o.waypoints.length>=4).map(o=>o.id).sort();for(const o of r){const a=ft(n),s=a.edges.find(d=>d.id===o);if(!s||s.waypoints.length<4)continue;const c=Gn(a),u=a.edges.filter(d=>d.id!==o),l=hn(s,c).length,f=Bn(s,u),p=Nn(s,u);for(const d of il(s,a.shapes)){if(d.length>=s.waypoints.length)continue;const g={...s,waypoints:d};if(hn(g,c).length>l||Bn(g,u)>f||Nn(g,u)>p)continue;const h=n.get(o);h&&i.updateWaypoints(h,d);break}}}function ph(e,t){const{elementRegistry:n}=e,i=e.modeling,r=ft(n).edges.filter(o=>o.type==="bpmn:SequenceFlow"&&!t.has(o.id)).map(o=>o.id).sort();for(const o of r){const a=ft(n),s=a.edges.find(l=>l.id===o);if(!s)continue;const c=lh(s,a);if(!c)continue;const u=n.get(o);u&&i.updateWaypoints(u,c)}}function rl(e,t){const n=e.waypoints;if(n.length<3)return[];const i=[],r=t.get(e.endpoints[0]??""),o=t.get(e.endpoints[1]??""),a=dt(n[0].x,n[1].x)&&!dt(n[0].y,n[1].y),s=dt(n[n.length-1].x,n[n.length-2].x)&&!dt(n[n.length-1].y,n[n.length-2].y);for(const c of Ki){if(a&&r&&Math.abs(c)<r.width/2-5){const u=n.map(l=>({...l}));u[0].x+=c,u[1].x+=c,i.push({pts:u,cost:Math.abs(c)})}if(s&&o&&Math.abs(c)<o.width/2-5){const u=n.map(l=>({...l}));u[u.length-1].x+=c,u[u.length-2].x+=c,i.push({pts:u,cost:Math.abs(c)})}}return i}function XE(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];if(Math.min(n.x+n.width,i.x+i.width)-Math.max(n.x,i.x)>=1)return[];const r=i.y+i.height<=n.y,o=n.y+n.height<=i.y;if(!r&&!o)return[];const a=i.x>=n.x+n.width,s=i.x+i.width<=n.x;if(!a&&!s)return[];const c=n.x+n.width/2,u=n.y+n.height/2,l=i.x+i.width/2,f=i.y+i.height/2,p=a?n.x+n.width:n.x,d=o?n.y+n.height:n.y,g=a?i.x:i.x+i.width,h=o?i.y:i.y+i.height,m=[];for(const _ of[0,...Ki])Math.abs(_)<i.width/2-5&&m.push({pts:[{x:p,y:u},{x:l+_,y:u},{x:l+_,y:h}],cost:Math.abs(_)}),Math.abs(_)<i.height/2-5&&m.push({pts:[{x:c,y:d},{x:c,y:f+_},{x:g,y:f+_}],cost:Math.abs(_)});return m}function ol(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];const r=Math.max(n.x,i.x),o=Math.min(n.x+n.width,i.x+i.width);if(o-r<1)return[];const a=i.y+i.height<=n.y,s=n.y+n.height<=i.y;if(!a&&!s)return[];const c=a?n.y:n.y+n.height,u=a?i.y+i.height:i.y,l=(r+o)/2,f=[];for(const p of[0,...Ki]){const d=l+p;d<=r||d>=o||f.push({pts:[{x:d,y:c},{x:d,y:u}],cost:Math.abs(p)})}return f}function fh(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=Gn(t),r=t.edges.filter(d=>d.id!==e.id),o=Bn(e,r);if(o===0)return null;const a=Nn(e,r);let s;const c=d=>d.reduce((g,h,m)=>m?g+Math.abs(h.x-d[m-1].x)+Math.abs(h.y-d[m-1].y):0,0),u=3,l=d=>{const g=d[0],h=d[d.length-1],m=Math.hypot(h.x-g.x,h.y-g.y);return m>=1&&c(d)/m>=u?1:0},f=l(e.waypoints),p=[...ms(e,n),...ol(e,n),...rl(e,n)];for(const{pts:d,cost:g}of p){const h={...e,waypoints:d};if(hn(h,i).length>0)continue;const m=Bn(h,r),_=Nn(h,r),y=o-m+(f-l(d));if(m>=o||_-a>y)continue;const x=c(d);(!s||m<s.opposite||m===s.opposite&&(_<s.cross||_===s.cross&&(g<s.cost||g===s.cost&&x<s.len)))&&(s={pts:d,opposite:m,cross:_,cost:g,len:x})}return(s==null?void 0:s.pts)??null}function dh(e,t){var i;let n=0;for(const r of t)r.id!==e.id&&((i=oo(e,r))==null?void 0:i.kind)==="unrelated"&&n++;return n}function ZE(e,t){const n=new Map(t.shapes.map(p=>[p.id,p])),i=Gn(t),r=t.edges.filter(p=>p.id!==e.id),o=dh(e,r);if(o===0)return null;const a=Bn(e,r),s=Nn(e,r),c=p=>p.reduce((d,g,h)=>h?d+Math.abs(g.x-p[h-1].x)+Math.abs(g.y-p[h-1].y):0,0),u=2;let l;const f=[...ms(e,n),...ol(e,n),...XE(e,n),...rl(e,n)];for(const{pts:p,cost:d}of f){const g={...e,waypoints:p};if(hn(g,i).length>0)continue;const h=dh(g,r);if(h>=o)continue;const m=Bn(g,r);if(m-h>a-o)continue;const _=Nn(g,r);if(_-s>(o-h)*u)continue;const y=c(p);(!l||h<l.fake||h===l.fake&&(m<l.unreadable||m===l.unreadable&&(_<l.cross||_===l.cross&&(d<l.cost||d===l.cost&&y<l.length))))&&(l={pts:p,fake:h,unreadable:m,cross:_,cost:d,length:y})}return(l==null?void 0:l.pts)??null}function hh(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=ri(ft(i)).filter(s=>s.kind==="edge-overlap-unrelated"&&!t.has(ii(s)));if(!o.length)return;const a=new Set;for(const s of o)if(s.kind==="edge-overlap-unrelated")for(const c of s.edges)n.has(c)||a.add(c);for(const s of[...a].sort()){const c=ft(i),u=c.edges.find(p=>p.id===s);if(!u)continue;const l=ZE(u,c);if(!l)continue;const f=i.get(s);f&&r.updateWaypoints(f,l)}}function mh(e,t){const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");return!!n&&!!i&&i.x+i.width>n.x}function gh(e,t,n){var u;if(e.type!=="bpmn:SequenceFlow"||t.type!=="bpmn:SequenceFlow"||((u=oo(e,t))==null?void 0:u.kind)!=="opposite")return!1;const[i,r]=e.endpoints,[o,a]=t.endpoints,s=[i,r].filter(l=>l&&(l===o||l===a)).length;return!(!!r&&r===o||!!a&&a===i)||s!==1?!1:mh(e,n)&&mh(t,n)}function yh(e,t,n){let i=0;for(const r of t)r.id!==e.id&&gh(e,r,n)&&i++;return i}function QE(e,t){const n=new Map(t.shapes.map(p=>[p.id,p])),i=Gn(t),r=t.edges.filter(p=>p.id!==e.id),o=yh(e,r,n);if(o===0)return null;const a=Bn(e,r),s=Nn(e,r),c=p=>p.reduce((d,g,h)=>h?d+Math.abs(g.x-p[h-1].x)+Math.abs(g.y-p[h-1].y):0,0),u=2;let l;const f=[...ms(e,n),...ol(e,n),...rl(e,n)];for(const{pts:p,cost:d}of f){const g={...e,waypoints:p};if(hn(g,i).length>0)continue;const h=yh(g,r,n);if(h>=o)continue;const m=Bn(g,r);if(m-h>a-o)continue;const _=Nn(g,r);if(_-s>(o-h)*u)continue;const y=c(p);(!l||h<l.chain||h===l.chain&&(m<l.unreadable||m===l.unreadable&&(_<l.cross||_===l.cross&&(d<l.cost||d===l.cost&&y<l.length))))&&(l={pts:p,chain:h,unreadable:m,cross:_,cost:d,length:y})}return(l==null?void 0:l.pts)??null}function JE(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=ft(i),a=new Map(o.shapes.map(u=>[u.id,u])),s=ri(o).filter(u=>u.kind==="edge-overlap-opposite"&&!t.has(ii(u)));if(!s.length)return;const c=new Set;for(const u of s){if(u.kind!=="edge-overlap-opposite")continue;const[l,f]=u.edges.map(p=>o.edges.find(d=>d.id===p));if(!(!l||!f||!gh(l,f,a)))for(const p of u.edges)n.has(p)||c.add(p)}for(const u of[...c].sort()){const l=ft(i),f=l.edges.find(g=>g.id===u);if(!f)continue;const p=QE(f,l);if(!p)continue;const d=i.get(u);d&&r.updateWaypoints(d,p)}}function vh(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=ft(i),a=ri(o).filter(l=>Zu(l)&&!t.has(ii(l)));if(!a.length)return;const s=new Set;for(const l of a)if(Zu(l))for(const f of l.edges)n.has(f)||s.add(f);const c=l=>{var f;return((f=o.edges.find(p=>p.id===l))==null?void 0:f.type)??""},u=[...s].sort((l,f)=>{const p=c(l)==="bpmn:SequenceFlow"?0:1,d=c(f)==="bpmn:SequenceFlow"?0:1;return p!==d?p-d:l.localeCompare(f)});for(const l of u){const f=ft(i),p=f.edges.find(h=>h.id===l);if(!p)continue;const d=fh(p,f);if(!d)continue;const g=i.get(l);g&&r.updateWaypoints(g,d)}}const e1=10,t1=(e,t)=>e.x<t.x+t.width&&t.x<e.x+e.width&&e.y<t.y+t.height&&t.y<e.y+e.height;function bh(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!fs(e,i))return null;const r=Gn(t),o=i.flatMap(dn);for(const a of dn(e)){let s=[[a.lo,a.hi]];for(const[d,g]of ps(a,o))s=s.flatMap(([h,m])=>{const _=[];return d>h&&_.push([h,Math.min(m,d)]),g<m&&_.push([Math.max(h,g),m]),_.filter(([y,x])=>x>y)});const c=a.axis==="h"?n.width:n.height,u=s.find(([d,g])=>g-d>=c+e1*2);if(!u)continue;const l=(u[0]+u[1])/2,f=a.axis==="h"?{x:l,y:a.at-jd}:{x:a.at+Cn+n.width/2,y:l},p={x:f.x-n.width/2,y:f.y-n.height/2,width:n.width,height:n.height};if(!fs({...e,label:p},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&t1(p,d)))return p}return null}const Cn=8;function _h(e,t){const n=e.label;if(!n)return null;const i=dn(e);if(!i.length)return null;const r=n.x+n.width/2,o=n.y+n.height/2,a=p=>{const d=p.axis==="h"?r:o,g=p.axis==="h"?o-p.at:r-p.at,h=d<p.lo?p.lo-d:d>p.hi?d-p.hi:0;return Math.hypot(g,h)},s=i.reduce((p,d)=>a(d)<a(p)?d:p,i[0]),c=[...i,...t.edges.filter(p=>p.id!==e.id).flatMap(dn),...t.shapes.filter(p=>p.container).flatMap(Ko)],u=p=>!c.some(d=>Pi(p,d));if(u(n))return null;const l=(s.axis==="v"?n.height:n.width)+Cn,f=[0,-l,l,-2*l,2*l];if(s.axis==="v")for(const p of[s.at+Cn,s.at-Cn-n.width])for(const d of f){const g=n.y+d;if(g<s.lo||g+n.height>s.hi)continue;const h={...n,x:p,y:g};if(u(h))return h}else for(const p of[s.at-Cn-n.height,s.at+Cn])for(const d of f){const g=n.x+d;if(g<s.lo||g+n.width>s.hi)continue;const h={...n,x:g,y:p};if(u(h))return h}return null}function xh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=ft(n);for(const o of r.edges){if(!o.label||t.has(o.id))continue;const a=_h(o,r);if(!a)continue;const s=n.get(o.id),c=s==null?void 0:s.label;c&&i.moveElements([c],{x:a.x-c.x,y:a.y-c.y})}}function wh(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=ft(i),a=ri(o).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(ii(s)));for(const s of a){if(s.kind!=="label-on-shared-segment"||n.has(s.edge))continue;const c=o.edges.find(p=>p.id===s.edge);if(!c)continue;const u=bh(c,o);if(!u)continue;const l=i.get(s.edge),f=l==null?void 0:l.label;f&&r.moveElements([f],{x:u.x-f.x,y:u.y-f.y})}}function Eh(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(dn),...t.shapes.filter(p=>p.container).flatMap(Ko)],r=i.filter(p=>Pi(n,p));if(!r.length)return null;const o=t.shapes.filter(p=>!p.container&&p.id!==e.id),a=so(t).filter(p=>p.owner!==e.id).map(p=>p.rect),s=(p,d)=>p.x<d.x+d.width&&d.x<p.x+p.width&&p.y<d.y+d.height&&d.y<p.y+p.height,c=p=>!i.some(d=>Pi(p,d))&&!o.some(d=>s(p,d))&&!a.some(d=>s(p,d)),u=[];for(const p of r)p.axis==="h"?u.push({...n,y:p.at-Cn-n.height},{...n,y:p.at+Cn}):u.push({...n,x:p.at-Cn-n.width},{...n,x:p.at+Cn});const l=e.x+e.width/2,f=e.y+e.height/2;return u.push({...n,x:l-n.width/2,y:e.y+e.height+Cn},{...n,x:l-n.width/2,y:e.y-Cn-n.height},{...n,x:e.x+e.width+Cn,y:f-n.height/2},{...n,x:e.x-Cn-n.width,y:f-n.height/2}),u.find(c)??null}function Sh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=ft(n);for(const o of r.shapes){if(o.container||!o.label||t.has(o.id))continue;const a=Eh(o,ft(n));if(!a)continue;const s=n.get(o.id),c=s==null?void 0:s.label;c&&i.moveElements([c],{x:a.x-c.x,y:a.y-c.y})}}const n1=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,Rh=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),Ch={"participant.add":[{path:"participant",shape:["id"]},{path:"participant.lanes[]",shape:["id"],optional:!0}],"participant.update":[{path:"id",shape:null},{path:"lanes[]",shape:["id"],optional:!0}],"node.add":[{path:"node",shape:["id","type"]}],"node.update":[{path:"id",shape:null}],"sequenceFlow.add":[{path:"flow",shape:["id","source","target"]}],"sequenceFlow.update":[{path:"id",shape:null}],"messageFlow.add":[{path:"flow",shape:["id","source","target"]}],"messageFlow.update":[{path:"id",shape:null}],"dataStore.add":[{path:"dataStore",shape:["id"]},{path:"associations[]",shape:["source","target"],optional:!0}],"dataStore.update":[{path:"id",shape:null}],"dataAssociation.add":[{path:"association",shape:["source","target"]}],"association.add":[{path:"association",shape:["source","target"]}],"annotation.add":[{path:"annotation",shape:["id","text"]},{path:"association",shape:["source","target"],optional:!0},{path:"placement",shape:["anchor","side"],optional:!0}],"annotation.update":[{path:"id",shape:null},{path:"placement",shape:["anchor","side"],optional:!0}],"group.add":[{path:"group",shape:["id"]},{path:"group.members[]",shape:null,optional:!0}],"group.update":[{path:"id",shape:null},{path:"members[]",shape:null,optional:!0}],"element.remove":[{path:"id",shape:null}]},vs=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),al=e=>typeof e=="string"&&e!=="";function i1(e){const t=[];function n(i,r,o,a){if(a===null){al(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!vs(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)al(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{if(!vs(i)||!al(i.kind)||!(i.kind in Ch)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const o of Ch[i.kind]){const a=o.path.endsWith("[]"),s=a?o.path.slice(0,-2):o.path,c=s.split(".");let u=i;for(const f of c.slice(0,-1)){if(!vs(u))break;u=u[f]}if(!vs(u))continue;const l=u[c[c.length-1]];if(!(l===void 0&&o.optional)&&!(l===null&&o.optional)){if(!a){n(r,o.path,l,o.shape);continue}if(!Array.isArray(l)){t.push({kind:"payload-invalid",opIndex:r,field:o.path});continue}l.forEach((f,p)=>n(r,`${s}[${p}]`,f,o.shape))}}if(i.kind==="node.add"||i.kind==="node.update"){const o=i.band;o!==void 0&&(!Number.isInteger(o)||o<0)&&t.push({kind:"payload-invalid",opIndex:r,field:"band"})}}),t}function Ph(e,t){const n=i1(e);if(n.length>0)return n;const i=[],r=new Map,o=new Map;function a(p,d,g){if(!n1.test(d)){i.push({kind:"id-invalid",opIndex:p,id:d});return}if(t.categoryOf(d)!==void 0||r.has(d)){i.push({kind:"id-duplicate",opIndex:p,id:d});return}r.set(d,{...g,opIndex:p})}e.forEach((p,d)=>{var g;switch(p.kind){case"participant.add":a(d,p.participant.id,{category:"participant",lanes:(p.participant.lanes??[]).map(h=>h.id)});for(const h of p.participant.lanes??[])a(d,h.id,{category:"lane"});break;case"node.add":a(d,p.node.id,{category:"flowNode",participant:p.node.participant});break;case"sequenceFlow.add":a(d,p.flow.id,{category:"sequenceFlow"});break;case"messageFlow.add":a(d,p.flow.id,{category:"messageFlow"});break;case"dataStore.add":a(d,p.dataStore.id,{category:"dataStore"});for(const h of p.associations??[])h.id&&a(d,h.id,{category:"dataAssociation"});break;case"dataAssociation.add":p.association.id&&a(d,p.association.id,{category:"dataAssociation"});break;case"association.add":p.association.id&&a(d,p.association.id,{category:"association"});break;case"annotation.add":a(d,p.annotation.id,{category:"annotation"}),(g=p.association)!=null&&g.id&&a(d,p.association.id,{category:"association"});break;case"group.add":a(d,p.group.id,{category:"group"});break;case"participant.update":if(p.lanes){o.set(p.id,p.lanes.map(h=>h.id));for(const h of p.lanes)t.categoryOf(h.id)===void 0&&a(d,h.id,{category:"lane"})}break}});const s=p=>{var d;return((d=r.get(p))==null?void 0:d.category)??t.categoryOf(p)},c=p=>{const d=r.get(p);return d?d.category==="participant"?p:d.participant:t.categoryOf(p)==="participant"?p:t.participantOf(p)};function u(p,d,g,h){const m=s(d);if(m===void 0){i.push({kind:"ref-missing",opIndex:p,ref:d,role:g});return}if(h&&!h.includes(m)){i.push({kind:"ref-category",opIndex:p,ref:d,role:g,expected:h.join("|"),actual:m});return}return m}const l=t.isCollaboration()||e.some(p=>p.kind==="participant.add");return e.forEach((p,d)=>{var g;switch(p.kind){case"participant.add":break;case"node.add":{const{participant:h,lane:m}=p.node;if(h===void 0){(l||m!==void 0)&&i.push({kind:"participant-required",opIndex:d,id:p.node.id});break}if(u(d,h,"participant",["participant"])===void 0)break;m!==void 0&&((((g=r.get(h))==null?void 0:g.lanes)??o.get(h)??t.lanesOf(h)).includes(m)||i.push({kind:"lane-unknown",opIndex:d,lane:m,participant:h}));break}case"sequenceFlow.add":{const{id:h,source:m,target:_,name:y,condition:x}=p.flow,S=u(d,m,"source",["flowNode"]),P=u(d,_,"target",["flowNode"]);S&&P&&c(m)!==c(_)&&i.push({kind:"flow-cross-pool",opIndex:d,id:h}),y!==void 0&&x!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:h});break}case"messageFlow.add":{const{id:h,source:m,target:_}=p.flow,y=u(d,m,"source",["flowNode","participant"]),x=u(d,_,"target",["flowNode","participant"]);if(y&&x){const S=c(m),P=c(_);S!==void 0&&S===P&&i.push({kind:"message-flow-same-pool",opIndex:d,id:h})}break}case"dataStore.add":{for(const h of p.associations??[]){if([h.source,h.target].filter(y=>y===p.dataStore.id).length!==1){i.push({kind:"data-association-ends",opIndex:d,source:h.source,target:h.target});continue}const _=h.source===p.dataStore.id?h.target:h.source;u(d,_,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:h,target:m}=p.association,_=u(d,h,"source"),y=u(d,m,"target");if(_&&y){const x=new Set([_,y]);x.has("dataStore")&&x.has("flowNode")||i.push({kind:"data-association-ends",opIndex:d,source:h,target:m})}break}case"association.add":{const{id:h,source:m,target:_}=p.association,y=u(d,m,"source"),x=u(d,_,"target");y&&x&&y!=="annotation"&&x!=="annotation"&&i.push({kind:"association-detached",opIndex:d,annotation:h??`${m}->${_}`});break}case"annotation.add":{if(p.association){const{source:h,target:m}=p.association;if(h!==p.annotation.id&&m!==p.annotation.id)i.push({kind:"association-detached",opIndex:d,annotation:p.annotation.id});else{const _=h===p.annotation.id?m:h;u(d,_,"association")}}p.placement&&u(d,p.placement.anchor,"anchor");break}case"group.add":{for(const h of p.group.members??[]){const m=u(d,h,"member");m&&Rh.has(m)&&i.push({kind:"ref-category",opIndex:d,ref:h,role:"member",expected:"shape",actual:m})}break}case"participant.update":{if(f(d,p.id,"participant")===void 0)break;if(p.lanes){const h=t.lanesOf(p.id),m=p.lanes.map(y=>y.id);for(const y of h)m.includes(y)||i.push({kind:"lane-shrink-unsupported",opIndex:d,participant:p.id,lane:y});for(const y of m)t.categoryOf(y)!==void 0&&!h.includes(y)&&i.push({kind:"id-duplicate",opIndex:d,id:y});const _=m.filter(y=>h.includes(y));_.length===h.length&&_.some((y,x)=>y!==h[x])&&i.push({kind:"lane-reorder-unsupported",opIndex:d,participant:p.id})}break}case"node.update":{if(f(d,p.id,"flowNode")===void 0)break;if(p.lane!==void 0){const h=t.participantOf(p.id);(h?o.get(h)??t.lanesOf(h):[]).includes(p.lane)||i.push({kind:"lane-unknown",opIndex:d,lane:p.lane,participant:h??""})}break}case"sequenceFlow.update":{if(f(d,p.id,"sequenceFlow")===void 0)break;if(p.name!==void 0&&p.condition!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:p.id}),p.source!==void 0||p.target!==void 0){const h=p.source===void 0||u(d,p.source,"source",["flowNode"])!==void 0,m=p.target===void 0||u(d,p.target,"target",["flowNode"])!==void 0,_=t.endpointsOf(p.id),y=p.source??(_==null?void 0:_.source),x=p.target??(_==null?void 0:_.target);h&&m&&y!==void 0&&x!==void 0&&new Set([c(y),c(x),c(p.id)]).size>1&&i.push({kind:"flow-cross-pool",opIndex:d,id:p.id})}break}case"messageFlow.update":f(d,p.id,"messageFlow");break;case"dataStore.update":f(d,p.id,"dataStore");break;case"annotation.update":{if(f(d,p.id,"annotation")===void 0)break;p.placement&&u(d,p.placement.anchor,"anchor");break}case"group.update":{if(f(d,p.id,"group")===void 0)break;for(const h of p.members??[]){const m=u(d,h,"member");m&&Rh.has(m)&&i.push({kind:"ref-category",opIndex:d,ref:h,role:"member",expected:"shape",actual:m})}break}case"element.remove":{f(d,p.id)==="lane"&&i.push({kind:"ref-category",opIndex:d,ref:p.id,role:"target",expected:"removable",actual:"lane"});break}}}),i;function f(p,d,g){if(r.has(d)){i.push({kind:"target-added-in-batch",opIndex:p,id:d});return}const h=t.categoryOf(d);if(h===void 0){i.push({kind:"ref-missing",opIndex:p,ref:d,role:"target"});return}if(g&&h!==g){i.push({kind:"ref-category",opIndex:p,ref:d,role:"target",expected:g,actual:h});return}return h}}function Ah(e){return{modeling:e.get("modeling"),bpmnFactory:e.get("bpmnFactory"),elementFactory:e.get("elementFactory"),elementRegistry:e.get("elementRegistry"),canvas:e.get("canvas"),autoPlace:e.get("autoPlace"),bpmnReplace:e.get("bpmnReplace")}}function bs(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const _s={"top-left":[-1,-1],top:[0,-1],"top-right":[1,-1],right:[1,0],"bottom-right":[1,1],bottom:[0,1],"bottom-left":[-1,1],left:[-1,0]},en=10,Th=40,r1=10;function sl(e,t,n,i,r){const o=n,a=(k,O)=>{const[j,se]=_s[k];let we={x:t.x+t.width/2+j*(t.width/2+o.width/2+O),y:t.y+t.height/2+se*(t.height/2+o.height/2+O)};const Ke=i.x+en+o.width/2,Y=i.x+i.width-en-o.width/2,ue=i.y+en+o.height/2,_e=i.y+i.height-en-o.height/2,le={x:Math.min(Y,Math.max(Ke,we.x)),y:Math.min(_e,Math.max(ue,we.y))};return(le.x!==we.x||le.y!==we.y)&&(we=Math.abs(le.x-(t.x+t.width/2))<(t.width+o.width)/2+en&&Math.abs(le.y-(t.y+t.height/2))<(t.height+o.height)/2+en?{x:t.x+t.width+en+o.width/2,y:le.y}:le),we},s=(i.children??[]).filter(k=>!("waypoints"in k&&k.waypoints)&&k.type!=="bpmn:Lane"&&k.type!=="label"&&typeof k.x=="number"&&k.id!==r.selfId),c=ft(e),u=k=>{var j,se;if(!r.selfId)return!1;const O=e.get(k);return!!O&&(((j=O.source)==null?void 0:j.id)===r.selfId||((se=O.target)==null?void 0:se.id)===r.selfId)},l=c.edges.filter(k=>!u(k.id)).flatMap(dn),f=so(c).filter(k=>k.owner!==r.selfId).map(k=>k.rect),p=k=>({x0:k.x-o.width/2-en,x1:k.x+o.width/2+en,y0:k.y-o.height/2-en,y1:k.y+o.height/2+en}),d=k=>{const O=p(k);return s.some(j=>O.x0<j.x+j.width&&O.x1>j.x&&O.y0<j.y+j.height&&O.y1>j.y)},g=k=>{const O=p(k);return l.some(j=>j.axis==="h"?j.at>O.y0&&j.at<O.y1&&j.lo<O.x1&&j.hi>O.x0:j.at>O.x0&&j.at<O.x1&&j.lo<O.y1&&j.hi>O.y0)},h=k=>{const O=p(k);return f.some(j=>O.x0<j.x+j.width&&O.x1>j.x&&O.y0<j.y+j.height&&O.y1>j.y)},m=c.shapes.filter(k=>k.type==="bpmn:Group").flatMap(k=>[{axis:"h",at:k.y,lo:k.x,hi:k.x+k.width},{axis:"h",at:k.y+k.height,lo:k.x,hi:k.x+k.width},{axis:"v",at:k.x,lo:k.y,hi:k.y+k.height},{axis:"v",at:k.x+k.width,lo:k.y,hi:k.y+k.height}]),_=k=>{const O=p(k);return m.some(j=>j.axis==="h"?j.at>O.y0&&j.at<O.y1&&j.lo<O.x1&&j.hi>O.x0:j.at>O.x0&&j.at<O.x1&&j.lo<O.y1&&j.hi>O.y0)},y=k=>d(k)||g(k)||h(k)||_(k),x=k=>k.x-o.width/2>=i.x&&k.x+o.width/2<=i.x+i.width&&k.y-o.height/2>=i.y&&k.y+o.height/2<=i.y+i.height;if(r.placement){const k=Y=>Y.startsWith("top")?Y.replace(/^top/,"bottom"):Y.replace(/^bottom/,"top"),O=Y=>Y.endsWith("left")?Y.replace(/left$/,"right"):Y.replace(/right$/,"left"),j=r.placement.side,se=[j,k(j),O(j),k(O(j)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],we=r.placement.offset??50;let Ke=a(j,we);if(y(Ke)){const Y=new Set;for(const ue of se){if(Y.has(ue))continue;Y.add(ue);const _e=a(ue,we);if(x(_e)&&!y(_e)){Ke=_e;break}}}return Ke}const S=r.from,P=i.x+en+o.width/2,C=i.x+i.width-en-o.width/2,D=i.y+en+o.height/2,T=i.y+i.height-en-o.height/2;let $={x:Math.min(C,Math.max(P,S.x)),y:Math.min(T,Math.max(D,S.y))};if(y($)){const k=(t.width+o.width)/2+en,j=[{x:$.x+k,y:$.y},{x:$.x-k,y:$.y},{x:$.x,y:$.y-o.height-en},{x:$.x,y:$.y+o.height+en}].filter(x).find(se=>!y(se));j&&($=j)}return $}function Yt(e,t){return e.filter(n=>n.kind===t)}function Mh(e,t){var t0,n0,i0,r0,o0,a0,s0,c0,u0,l0,p0,f0,d0,h0,m0,g0,y0,v0,b0,_0,x0,w0,E0;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:s,bpmnReplace:c}=t,u=()=>a.getRootElement(),l=v=>o.get(v),f=v=>{const R=l(v);if(!R)throw new Error(`하강 참조 해소 실패: ${v}`);return R},p=v=>{let R=v.parent;for(;R;){if(R.type==="bpmn:Participant")return R;R=R.parent}},d=new Map;for(const v of o.filter(R=>!("waypoints"in R&&R.waypoints)&&R.type!=="bpmn:Lane"&&R.type!=="label"&&typeof R.x=="number"))d.set(v.id,{x:v.x,y:v.y});const g=Yt(e,"participant.add"),h=Yt(e,"node.add"),m=Yt(e,"sequenceFlow.add"),_=Yt(e,"messageFlow.add"),y=Yt(e,"dataStore.add"),x=Yt(e,"dataAssociation.add"),S=Yt(e,"annotation.add"),P=Yt(e,"group.add"),C=new Map(h.map(v=>[v.node.id,v])),D=(v,R,A)=>{var H;const L=v.businessObject,N=(((H=L.extensionElements)==null?void 0:H.values)??[]).filter(V=>V.$type!==R),B=A?[...N,i.create(R,A)]:N;if(!B.length){L.extensionElements&&n.updateProperties(v,{extensionElements:void 0});return}const G=i.create("bpmn:ExtensionElements",{values:B});B.forEach(V=>{V.$parent=G}),n.updateProperties(v,{extensionElements:G})},T=v=>({anchor:v.anchor,side:v.side,...v.offset!==void 0?{offset:v.offset}:{}});for(const v of Yt(e,"element.remove")){const R=l(v.id);R&&n.removeElements([R])}const $=v=>o.filter(R=>{var A;return R.type==="bpmn:Lane"&&((A=p(R))==null?void 0:A.id)===v}).sort((R,A)=>R.y-A.y);for(const v of Yt(e,"participant.update")){const R=f(v.id);if(v.name!==void 0&&n.updateProperties(R,{name:v.name??void 0}),!v.lanes)continue;const A=$(v.id);if(!A.length){n.splitLane(R,v.lanes.length),$(v.id).forEach((N,B)=>{const G=v.lanes[B];G&&n.updateProperties(N,{id:G.id,name:G.name})});continue}const L=new Set(A.map(N=>N.id));v.lanes.forEach((N,B)=>{if(L.has(N.id)){n.updateProperties(f(N.id),{name:N.name});return}const G=B===0?n.addLane($(v.id)[0],"top"):n.addLane(f(v.lanes[B-1].id),"bottom");n.updateProperties(G,{id:N.id,name:N.name})})}const k=150,O=130,j=80,se=90,we=180,Ke=30,Y=30,ue=(v,R,A,L,N)=>{const B=A-R.width/2,G=L-R.height/2;return(v.children??[]).find(H=>!("waypoints"in H&&H.waypoints)&&H.type!=="bpmn:Lane"&&H.type!=="label"&&!(N!=null&&N.has(H.id))&&typeof H.x=="number"&&B<H.x+H.width+Y&&B+R.width+Y>H.x&&G<H.y+H.height&&G+R.height>H.y)},_e=new Set;for(const v of g){_e.add(`pool:${v.participant.id}`);for(const R of v.participant.lanes??[])_e.add(R.id)}const le=new Map;for(const v of h){const R=v.node.lane??`pool:${v.node.participant??""}`;let A=le.get(R);A||le.set(R,A=new Set([0])),v.band!==void 0&&A.add(v.band)}const xe=new Map;for(const[v,R]of le){if(!_e.has(v))continue;const A=[...R].sort((B,G)=>B-G),L=A.map((B,G)=>G===0?0:G%2===1?Math.ceil(G/2):-(G/2)),N=Math.min(...L);xe.set(v,new Map(A.map((B,G)=>[B,L[G]-N])))}{const v=new Map;for(const R of g)(R.participant.lanes??[]).forEach((A,L)=>v.set(A.id,L));for(const[R,A]of xe){if(!v.has(R)||A.size<2)continue;const L=v.get(R),N=A.get(0)??0,B=new Set;for(const re of h){if(re.node.lane!==R||(re.band??0)!==0||!re.node.type.endsWith("Gateway"))continue;const Le={in:new Set,out:new Set,cross:new Set};for(const me of m){const fe=me.flow.source===re.node.id;if(!fe&&me.flow.target!==re.node.id)continue;const Ve=C.get(fe?me.flow.target:me.flow.source);if(!Ve||Ve.node.participant!==re.node.participant||!Ve.node.lane)continue;let oe,ge=!1;if(Ve.node.lane!==R){const Se=v.get(Ve.node.lane);if(Se===void 0)continue;oe=Se>L?"down":"up",ge=!0}else{const Se=A.get(Ve.band??0)??N;oe=Se>N?"down":Se<N?"up":void 0}oe&&(Le[fe?"out":"in"].add(oe),ge&&Le.cross.add(oe))}for(const me of["up","down"])Le.in.has(me)&&Le.out.has(me)&&Le.cross.has(me)&&B.add(me)}if(B.size!==1)continue;const[G]=B,H=Math.max(...A.values()),V=G==="down"?H:0;if(N===V)continue;const Q=[...A.entries()].filter(([re])=>re!==0).sort((re,Le)=>re[1]-Le[1]),pe=[...Array(H+1).keys()].filter(re=>re!==V),Ee=new Map([[0,V]]);Q.forEach(([re],Le)=>Ee.set(re,pe[Le])),xe.set(R,Ee)}}const ce=v=>{var R;return(((R=le.get(v))==null?void 0:R.size)??0)>1},U=v=>v.band??(v.node.lane||!ce(`pool:${v.node.participant??""}`)?void 0:0),q=new Map,K=v=>q.get(v.node.id)??U(v),Ge=new Set,Xt=new Set;{const v=new Map;for(const L of m)v.set(L.flow.target,(v.get(L.flow.target)??0)+1);const R=L=>{const N=[],B=new Set([L]),G=[L];for(;G.length;){const H=G.shift();N.push(H);for(const V of m)V.flow.source!==H||B.has(V.flow.target)||(v.get(V.flow.target)??0)!==1||(B.add(V.flow.target),G.push(V.flow.target))}return N},A=(L,N)=>{var B;return((B=xe.get(L))==null?void 0:B.get(N))??N};for(const L of h){if(!L.node.type.endsWith("Gateway"))continue;const N=L.node.lane??`pool:${L.node.participant??""}`,B=xe.get(N);if(!B||B.size<2)continue;const G=K(L);if(G===void 0||A(N,G)!==A(N,0))continue;const H=A(N,G),V=m.filter(me=>me.flow.source===L.node.id).map(me=>C.get(me.flow.target)).filter(me=>!!me&&(me.node.lane??`pool:${me.node.participant??""}`)===N),Q=V.filter(me=>{const fe=K(me);return fe!==void 0&&A(N,fe)===H&&(v.get(me.node.id)??0)===1}),pe=V.some(me=>{const fe=K(me);return fe!==void 0&&A(N,fe)>H});if(Q.length!==1||!pe)continue;const Ee=new Set(V.flatMap(me=>R(me.node.id)));if(!m.some(me=>me.flow.target===L.node.id&&Ee.has(me.flow.source)))continue;const Le=new Map;for(const[me,fe]of B)Le.set(me,fe+1);Le.set(-1,0),xe.set(N,Le);for(const me of R(Q[0].node.id))C.has(me)&&(q.set(me,-1),Xt.add(me));Ge.add(L.node.id)}}const M=(v,R)=>{var A;return((A=xe.get(v))==null?void 0:A.get(R))??R},E=new Map;for(const[v,R]of le){let A=0;for(const L of R)A=Math.max(A,M(v,L));E.set(v,A)}const b=v=>we+k*v,F=(v,R,A)=>{const L=u().children.filter(N=>!("waypoints"in N&&N.waypoints)&&N.id!==R&&typeof N.y=="number"&&N.y>=v);L.length&&n.moveElements(L,{x:0,y:A})},W=(v,R,A)=>{const L=v.type==="bpmn:Participant"?v:void 0;if(!L||L.children.some(H=>H.type==="bpmn:Lane"))return;const N=A+R.height/2+Ke-L.y;if(L.height>=N)return;const B=N-L.height,G=L.y+L.height;n.resizeShape(L,{x:L.x,y:L.y,width:L.width,height:N}),F(G,L.id,B)},X=(v,R,A)=>{if(v){const G=f(v),H=b(R);if(G.height>=H)return;const V=H-G.height,Q=p(G),pe=Q?Q.y+Q.height:G.y+G.height;n.resizeLane(G,{x:G.x,y:G.y,width:G.width,height:H},!1),F(pe,Q==null?void 0:Q.id,V);return}if(!A)return;const L=k*(R+1);if(A.height>=L)return;const N=L-A.height,B=A.y+A.height;n.resizeShape(A,{x:A.x,y:A.y,width:A.width,height:L}),F(B,A.id,N)},be=g.map((v,R)=>({op:v,declared:R}));be.sort((v,R)=>{const A=v.op.order??Number.POSITIVE_INFINITY,L=R.op.order??Number.POSITIVE_INFINITY;return A!==L?A-L:v.declared-R.declared});let Be=80;for(const v of o.getAll())v.parent===u()&&"height"in v&&typeof v.y=="number"&&(Be=Math.max(Be,v.y+v.height+60));for(const{op:v}of be){const R=v.participant,A=h.filter(re=>re.node.participant===R.id).length,L=((t0=R.lanes)==null?void 0:t0.length)??0,N=Math.max(1200,A*160+300),B=(R.lanes??[]).map(re=>b(E.get(re.id)??0)),G=B.reduce((re,Le)=>re+Le,0);L&&G<300&&(B[L-1]+=300-G);const H=Math.max(300,k*((E.get(`pool:${R.id}`)??0)+1)),V=R.blackBox||A+L===0?120:L?Math.max(300,G):H,Q=r.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:R.id,name:R.name,...v.order!==void 0?{"bwl:poolOrder":v.order}:{},...R.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:N,height:V,isExpanded:!0}),pe=n.createShape(Q,{x:100+N/2,y:Be+V/2},u()),Ee=R.lanes??[];if(Ee.length&&n.splitLane(pe,Ee.length),Ee.length){const re=o.filter(Le=>{var me;return Le.type==="bpmn:Lane"&&((me=p(Le))==null?void 0:me.id)===R.id}).sort((Le,me)=>Le.y-me.y);if(re.forEach((Le,me)=>{const fe=Ee[me];fe&&n.updateProperties(Le,{id:fe.id,name:fe.name})}),B.some(Le=>Le!==pe.height/L)){let Le=pe.y;re.forEach((me,fe)=>{const Ve=B[fe];n.resizeShape(me,{x:me.x,y:Le,width:me.width,height:Ve}),Le+=Ve})}}Be=pe.y+pe.height+60}const et=v=>{var L;const R=C.get(v);if(R)return R.node.participant??"";const A=l(v);return A?A.type==="bpmn:Participant"?A.id:((L=p(A))==null?void 0:L.id)??"":""},vt=new Map,it=v=>{let R=vt.get(v);return R||vt.set(v,R={nodes:[],flows:[]}),R};for(const v of h)it(v.node.participant??"").nodes.push(v);for(const v of m)it(et(v.flow.source)).flows.push(v);const Tt=v=>{var R;return i.create("bpmn:SequenceFlow",{id:v.id,name:v.name??((R=v.condition)==null?void 0:R.label)})},Qt=(v,R)=>r.createShape({type:bs(v.type),businessObject:i.create(bs(v.type),{id:v.id,name:v.name,...R!==void 0?{"bwl:band":R}:{}})}),yn=[...be.map(({op:v})=>v.participant.id).filter(v=>vt.has(v)),...[...vt.keys()].filter(v=>!g.some(R=>R.participant.id===v))],ut=v=>v.endsWith("Gateway");for(const v of yn){const R=vt.get(v),A=v?f(v):void 0,L=A?A.x+150:250;let N=A?A.y+80:120;const B=(oe,ge,Se)=>{if(oe){const Pe=f(oe);return Pe.y+Math.min(Pe.height/2,se)+M(oe,ge??0)*k}return ge!==void 0&&A?A.y+j+M(`pool:${v}`,ge)*k:Se},G=(oe,ge,Se)=>{if(oe){const Pe=f(oe);return Pe.y+Math.min(Pe.height/2,se)+ge*k}return A?A.y+j+ge*k:Se},H=oe=>oe.participant?f(oe.participant):u(),V=(oe,ge,Se,Pe,tt,$e)=>{const ht=Se!==void 0||Pe!==void 0,pt=M(Se??`pool:${v}`,Pe??0);if(ht)for(let ne=0;ne<4;ne++){const Z=G(Se,pt+ne,$e);if(!ue(oe,ge,tt,Z))return X(Se,pt+ne,A),{x:tt,y:Z}}const J=B(Se,Pe,$e);ht?X(Se,pt,A):W(oe,ge,J);let Ae=tt;for(let ne=0;ne<64;ne++){const Z=ue(oe,ge,Ae,J);if(!Z)break;Ae=Z.x+Z.width+O+ge.width/2}return{x:Ae,y:J}},Q=new Set(R.flows.map(oe=>oe.flow.target)),pe=new Map;for(const oe of R.nodes){if(Q.has(oe.node.id))continue;const ge=Qt(oe.node,oe.band),Se=U(oe),Pe=oe.node.lane?`${oe.node.lane}|${Se??""}`:Se!==void 0?`band:${Se}`:"",tt=H(oe.node),$e=V(tt,ge,oe.node.lane,Se,pe.get(Pe)??L,N);n.createShape(ge,$e,tt),pe.set(Pe,$e.x+ge.width+O),!oe.node.lane&&Se===void 0&&(N+=160)}const Ee=new Set,re=new Map,Le=new Map,me=new Map;if(v&&_e.has(`pool:${v}`)){const oe=new Map;for(const J of R.flows)oe.set(J.flow.target,(oe.get(J.flow.target)??0)+1);const ge=J=>B(J.node.lane,K(J),Number.NaN),Se=new Set,Pe=J=>{var Z;const Ae=(Z=C.get(J))==null?void 0:Z.node.participant;if(Ae)return l(Ae);const ne=l(J);if(ne)return ne.type==="bpmn:Participant"?ne:p(ne)},tt=J=>{const Ae=[],ne=new Set([J]),Z=[J];for(;Z.length;){const he=Z.shift(),Me=C.get(he);Me&&Ae.push(Me);for(const Re of R.flows)Re.flow.source!==he||ne.has(Re.flow.target)||(oe.get(Re.flow.target)??0)!==1||(ne.add(Re.flow.target),Z.push(Re.flow.target))}return Ae},$e=J=>{if(!A)return;const Ae=new Set(J.map(he=>he.node.id));let ne=!1,Z=!1;for(const he of _){if(!Ae.has(he.flow.source))continue;const Me=Pe(he.flow.target);!Me||Me.id===A.id||(Me.y<A.y?ne=!0:Z=!0)}return ne&&!Z?"up":Z&&!ne?"down":void 0};for(const J of R.nodes){if(!ut(J.node.type))continue;const Ae=B(J.node.lane,U(J),Number.NaN);if(Number.isNaN(Ae))continue;const ne=[];for(const Re of R.flows){if(Re.flow.source!==J.node.id)continue;const He=C.get(Re.flow.target);if(!He||He.node.lane!==J.node.lane||(oe.get(He.node.id)??0)!==1)continue;const nt=U(He);if(nt===void 0)continue;const Wt=B(He.node.lane,nt,Number.NaN);if(Number.isNaN(Wt))continue;const si=tt(He.node.id),Pt=$e(si);Pt&&ne.push({subtree:si,band:nt,row:Wt,dir:Pt})}if(!ne.some(Re=>Re.dir==="up")||!ne.some(Re=>Re.dir==="down")||!ne.some(Re=>Re.dir==="up"&&ne.some(He=>He.dir==="down"&&He.row<Re.row)))continue;const he=[...ne].sort((Re,He)=>Re.row-He.row);[...ne.filter(Re=>Re.dir==="up"),...ne.filter(Re=>Re.dir==="down")].sort((Re,He)=>Re.dir===He.dir?Re.row-He.row:Re.dir==="up"?-1:1).forEach((Re,He)=>{const nt=he[He].band;if(nt!==Re.band){Se.add(J.node.id);for(const Wt of Re.subtree)U(Wt)===Re.band&&q.set(Wt.node.id,nt)}})}const ht=J=>{if(!A)return;const Ae=new Set(J.map(he=>he.node.id));let ne=!1,Z=!1;for(const he of _){if(!Ae.has(he.flow.target))continue;const Me=Pe(he.flow.source);!Me||Me.id===A.id||(Me.y<A.y?ne=!0:Z=!0)}return ne&&!Z?"up":Z&&!ne?"down":void 0};for(const J of R.nodes){if(!ut(J.node.type))continue;const Ae=J.node.lane??`pool:${v}`,ne=xe.get(Ae);if(!ne||ne.size<2)continue;const Z=ne.get(0);if(Z===void 0)continue;const he=Math.max(...ne.values()),Me=Z===he&&Z!==0?"down":void 0;if(!Me)continue;const Re=[];for(const Pt of R.flows){if(Pt.flow.source!==J.node.id)continue;const gt=C.get(Pt.flow.target);if(!gt||gt.node.lane!==J.node.lane||(oe.get(gt.node.id)??0)!==1)continue;const es=K(gt);es!==void 0&&Re.push({t:gt,subtree:tt(gt.node.id),band:es})}const He=Re.find(Pt=>(ne.get(Pt.band)??Pt.band)===Z);if(!He||ht(He.subtree)===Me||$e(He.subtree)===Me)continue;const nt=Re.find(Pt=>Pt!==He&&ht(Pt.subtree)===Me);if(!nt)continue;const Wt=He.band,si=nt.band;for(const Pt of He.subtree)K(Pt)===Wt&&q.set(Pt.node.id,si);for(const Pt of nt.subtree)K(Pt)===si&&q.set(Pt.node.id,Wt);Se.add(J.node.id)}for(const J of R.nodes){if(!ut(J.node.type))continue;const Ae=ge(J);if(Number.isNaN(Ae)||S.some(Re=>{var He,nt;return(((He=Re.placement)==null?void 0:He.anchor)??(Re.association?Re.association.source===Re.annotation.id?Re.association.target:Re.association.source:void 0))===J.node.id&&((nt=Re.placement)==null?void 0:nt.side.startsWith("bottom"))}))continue;let Z,he=!1,Me;for(const Re of R.flows){if(Re.flow.source!==J.node.id)continue;const He=C.get(Re.flow.target);if(!He||!He.node.lane&&U(He)===void 0)continue;const nt=ge(He);Number.isNaN(nt)||(Math.abs(nt-Ae)<.5&&(he=!0),nt>Ae?!Z||nt>Z.row?Z={id:He.node.id,row:nt,count:1}:nt===Z.row&&Z.count++:nt<Ae&&He.node.lane===J.node.lane&&(!Me||nt>Me.row?Me={op:He,row:nt,count:1}:nt===Me.row&&Me.count++))}Z&&Z.count===1&&(oe.get(Z.id)??0)===1&&!Se.has(J.node.id)&&Ee.add(Z.id),!he&&Me&&Me.count===1&&(oe.get(Me.op.node.id)??0)===1&&!Ge.has(J.node.id)&&re.set(Me.op.node.id,{lane:J.node.lane,band:K(J)})}const pt=new Map;for(const J of _)pt.set(J.flow.target,[...pt.get(J.flow.target)??[],J]);for(const J of R.nodes){const Ae=pt.get(J.node.id);if(!Ae||Ae.length!==1||!oe.get(J.node.id)||!J.node.lane&&U(J)===void 0||Xt.has(J.node.id))continue;const ne=(n0=C.get(Ae[0].flow.source))==null?void 0:n0.node.participant,Z=ne?l(ne):void 0;if(!Z||!A||Z.id===A.id)continue;const he=J.node.lane??`pool:${v}`,Me=xe.get(he);if(!Me)continue;const Re=Me.get(0)??0,He=(Me.get(K(J)??0)??Re)-Re;if(He===0)continue;const nt=Z.y<A.y;if(nt&&He<0||!nt&&He>0)continue;let Wt;for(const[si,Pt]of Me){const gt=Pt-Re;(nt&><0&&(!Wt||gt<Wt.row)||!nt&>>0&&(!Wt||gt>Wt.row))&&(Wt={band:si,row:gt})}Wt&&Le.set(J.node.id,{lane:J.node.lane,band:Wt.band})}}const fe=new Set;let Ve=0;for(;Ve++<R.nodes.length+2;){for(let Se=0;Se<R.nodes.length+R.flows.length+2;Se++){let Pe=!1;for(const tt of R.flows){const $e=tt.flow;if(fe.has($e.id))continue;const ht=l($e.source);if(!ht)continue;const pt=l($e.target),J=C.get($e.target);if(!pt&&J){const Ae=Qt(J.node,J.band),ne=K(J);if(J.node.lane||ne!==void 0){const Z=H(J.node),he=ht,Me=he.x+(me.get($e.source)??0)+he.width+O,Re=re.get($e.target)??Le.get($e.target),He=V(Z,Ae,Re?Re.lane:J.node.lane,Re?Re.band:ne,Ee.has($e.target)?he.x+he.width/2:Me,Number.NaN),nt=n.createShape(Ae,He,Z);Ee.has($e.target)&&me.set($e.target,Me-(nt.x+nt.width/2)),n.connect(ht,nt,{type:"bpmn:SequenceFlow",businessObject:Tt($e)})}else s.append(ht,Ae,{connection:{type:"bpmn:SequenceFlow",businessObject:Tt($e)}})}else if(pt)n.connect(ht,pt,{type:"bpmn:SequenceFlow",businessObject:Tt($e)});else continue;fe.add($e.id),Pe=!0}if(!Pe)break}const oe=R.nodes.filter(Se=>!l(Se.node.id));if(!oe.length)break;const ge=oe[0];{const Se=Qt(ge.node,ge.band),Pe=H(ge.node),tt=U(ge);n.createShape(Se,V(Pe,Se,ge.node.lane,tt,L,N),Pe),!ge.node.lane&&tt===void 0&&(N+=160)}}}const Nt=40,$t=(v,R=()=>!0)=>{const A=l(v);if(!A)return[];const L=[A],N=new Set([v]);for(let B=0;B<L.length;B++){const G=L[B].id;for(const H of m){const V=H.flow.target;if(H.flow.source!==G||N.has(V)||!C.has(V))continue;N.add(V);const Q=l(V);Q&&R(Q)&&L.push(Q)}}return L},zo=(v,R=()=>!0)=>{const A=l(v);if(!A)return[];const L=[A],N=new Set([v]);for(let B=0;B<L.length;B++){const G=L[B].id;for(const H of m){const V=H.flow.source;if(H.flow.target!==G||N.has(V)||!C.has(V))continue;N.add(V);const Q=l(V);Q&&R(Q)&&L.push(Q)}}return L},Jt=30,vn=v=>!("waypoints"in v&&v.waypoints)&&v.type!=="bpmn:Lane"&&v.type!=="label"&&typeof v.x=="number",wn=(v,R)=>{const A=new Set(v.flatMap(G=>G.subtree.map(H=>H.id)));for(const G of v){const H=(G.pool.children??[]).filter(vn).filter(Q=>!A.has(Q.id));if(G.subtree.some(Q=>H.some(pe=>Q.x+R<pe.x+pe.width+Jt&&Q.x+R+Q.width+Jt>pe.x&&Q.y<pe.y+pe.height&&Q.y+Q.height>pe.y)))return null}const L=v.map(G=>G.pool.width),N=o.filter(G=>G.type==="label").map(G=>({label:G,x:G.x,y:G.y}));n.moveElements(v.flatMap(G=>G.subtree),{x:R,y:0});const B=v.map(G=>{const V=Math.max(...G.subtree.map(Q=>Q.x+Q.width))+150-(G.pool.x+G.pool.width);return V>0&&n.resizeShape(G.pool,{x:G.pool.x,y:G.pool.y,width:G.pool.width+V,height:G.pool.height}),V});return()=>{n.moveElements(v.flatMap(G=>G.subtree),{x:-R,y:0}),v.forEach((G,H)=>{B[H]>0&&n.resizeShape(G.pool,{x:G.pool.x,y:G.pool.y,width:L[H],height:G.pool.height})});for(let G=0;G<3;G++){let H=0;for(const V of N){const Q=V.x-V.label.x,pe=V.y-V.label.y;Math.abs(Q)<=.5&&Math.abs(pe)<=.5||(n.moveElements([V.label],{x:Q,y:pe}),H++)}if(!H)break}}},Ft=()=>{let v=0;for(const R of o.getAll()){if(R.type!=="bpmn:DataInputAssociation"&&R.type!=="bpmn:DataOutputAssociation")continue;const A=R.waypoints??[];for(let L=1;L<A.length;L++)v+=Math.hypot(A[L].x-A[L-1].x,A[L].y-A[L-1].y)}return v},Sr=v=>{const R=(v.children??[]).filter(vn);let A=0;for(let L=0;L<R.length;L++)for(let N=L+1;N<R.length;N++){const B=R[L],G=R[N];B.x<G.x+G.width&&B.x+B.width>G.x&&B.y<G.y+G.height&&B.y+B.height>G.y&&A++}return A},Za=()=>{const v=ft(o),R=A=>A.length>=2&&(A.every(L=>Math.abs(L.x-A[0].x)<.01)||A.every(L=>Math.abs(L.y-A[0].y)<.01));return{messages:v.edges.filter(A=>A.type==="bpmn:MessageFlow"&&A.waypoints.length===2).length,lines:v.edges.filter(A=>R(A.waypoints)).length}},Hn=v=>{const R=N=>{const B=[N],G=new Set([N.id]);for(let H=0;H<B.length;H++)for(const V of B[H].outgoing??[]){if(V.type!=="bpmn:SequenceFlow")continue;const Q=V.target;!Q||G.has(Q.id)||v.has(Q.id)||!vn(Q)||Q.x<N.x||(G.add(Q.id),B.push(Q))}return B},A=new Set(v),L=[];for(const N of o.getAll()){if(N.type!=="bpmn:MessageFlow")continue;const B=N;if(!B.waypoints||B.waypoints.length!==2)continue;const G=B.source,H=B.target;if(!G||!H)continue;const V=v.has(G.id);if(V===v.has(H.id))continue;const Q=V?H:G,pe=p(Q);if(!pe||A.has(Q.id))continue;const Ee=R(Q).filter(re=>!A.has(re.id));if(Ee.length){for(const re of Ee)A.add(re.id);L.push({subtree:Ee,pool:pe})}}return L};for(const v of Yt(e,"sequenceFlow.update")){if(v.target===void 0)continue;const R=C.get(v.target);if(!R)continue;const A=l(v.target),L=l(v.id);if(!A||!L)continue;const N=v.source!==void 0?l(v.source):L.source,B=L.target;if(!N||!B||B.id===A.id)continue;const G=$t(v.target),H=new Set(G.map(Ve=>Ve.id)),V=Math.min(...G.map(Ve=>Ve.x)),Q=Math.max(...G.map(Ve=>Ve.x+Ve.width)),pe=N.x+N.width,Ee=Q-V+Nt*2-(B.x-pe);let re=[];if(Ee>0){const Ve=p(A),oe=(Ve==null?void 0:Ve.children)??[],ge=$e=>$e.type==="bpmn:Lane";re=(()=>{const $e=new Set;for(const pt of oe)vn(pt)&&!H.has(pt.id)&&pt.x>=B.x&&$e.add(pt.id);const ht=[];for(const pt of oe){if(pt.type!=="bpmn:DataStoreReference"&&pt.type!=="bpmn:DataObjectReference")continue;const J=pt,ne=[...J.incoming??[],...J.outgoing??[]].filter(Z=>Z.type==="bpmn:DataInputAssociation"||Z.type==="bpmn:DataOutputAssociation").map(Z=>Z.source===J?Z.target:Z.source);ne.length&&ne.every(Z=>Z!==void 0&&$e.has(Z.id))&&ht.push(J)}return ht})();const Pe=oe.filter($e=>!("waypoints"in $e&&$e.waypoints)&&!ge($e)&&!H.has($e.id)&&$e.x>=B.x),tt=Ve?[Ve,...oe.filter($e=>ge($e))]:[];if(Pe.length){const $e=Hn(new Set(Pe.map(ht=>ht.id)));n.createSpace(Pe,tt,{x:Ee,y:0},"e",B.x-1);for(const ht of $e){const pt=Za(),J=wn([ht],Ee);if(!J)continue;const Ae=Za();(Ae.messages<=pt.messages||Ae.lines<pt.lines)&&J()}}}const Le=R.node.lane||R.band!==void 0?A.y+A.height/2:N.y+N.height/2;n.moveElements(G,{x:pe+Nt-V,y:Le-(A.y+A.height/2)});const me=p(A);if(R.node.lane===void 0&&R.band!==void 0&&me){const Ve=me.y+j+M(`pool:${R.node.participant??""}`,R.band)*k,oe=Ve-(A.y+A.height/2);oe!==0&&!ue(me,A,A.x+A.width/2,Ve,H)&&n.moveElements([A],{x:0,y:oe})}const fe=re.length?p(re[0]):void 0;if(fe){const Ve={assoc:Ft(),overlaps:Sr(fe)},oe=re.map(J=>({st:J,x:J.x})),ge=o.filter(J=>J.type==="label").map(J=>({label:J,x:J.x,y:J.y})),Se=Math.min(...re.flatMap(J=>[...J.incoming??[],...J.outgoing??[]].filter(Ae=>Ae.type==="bpmn:DataInputAssociation"||Ae.type==="bpmn:DataOutputAssociation").map(Ae=>(Ae.source===J?Ae.target:Ae.source).x))),Pe=new Set(re.map(J=>J.id)),tt=(fe.children??[]).filter(vn).filter(J=>!Pe.has(J.id));let $e=Se;for(const J of[...re].sort((Ae,ne)=>Ae.x-ne.x)){let Ae=$e;for(let ne=0;ne<100;ne++){const Z=tt.find(he=>Ae<he.x+he.width+Jt&&Ae+J.width+Jt>he.x&&J.y<he.y+he.height&&J.y+J.height>he.y);if(!Z)break;Ae=Z.x+Z.width+Jt}Ae!==J.x&&n.moveElements([J],{x:Ae-J.x,y:0}),$e=Ae+J.width+Jt}const ht=$e+150-(fe.x+fe.width);ht>0&&n.resizeShape(fe,{x:fe.x,y:fe.y,width:fe.width+ht,height:fe.height});const pt={assoc:Ft(),overlaps:Sr(fe)};if(pt.assoc>=Ve.assoc||pt.overlaps>Ve.overlaps){for(const{st:J,x:Ae}of oe)J.x!==Ae&&n.moveElements([J],{x:Ae-J.x,y:0});ht>0&&n.resizeShape(fe,{x:fe.x,y:fe.y,width:fe.width-ht,height:fe.height});for(const J of ge){const Ae=J.x-J.label.x,ne=J.y-J.label.y;(Ae!==0||ne!==0)&&n.moveElements([J.label],{x:Ae,y:ne})}}}}const Je=(v,R)=>{const A=R.target===v,L=f(R.source),N=f(R.target),B=A?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(L,N,R.id?{type:B,businessObject:i.create(B,{id:R.id})}:{type:B})},rt=100,jx=v=>{for(const R of g){if(!R.participant.blackBox)continue;const A=l(R.participant.id);if(!A)continue;const L=[];for(const B of _){const G=B.flow.source===R.participant.id?B.flow.target:B.flow.target===R.participant.id?B.flow.source:void 0,H=G?l(G):void 0;H&&typeof H.x=="number"&&H.type!=="bpmn:Participant"&&L.push(H)}if(!L.length)continue;const N=Math.max(...L.map(B=>B.x+B.width/2))+rt;if(N>A.x+A.width&&n.resizeShape(A,{x:A.x,y:A.y,width:N-A.x,height:A.height}),!!v)for(const B of _){const G=l(B.flow.id),H=B.flow.source===R.participant.id?B.flow.target:B.flow.target===R.participant.id?B.flow.source:void 0,V=H?l(H):void 0;if(!G||!V||V.type==="bpmn:Participant")continue;const Q=V.x+V.width/2;if(Q<A.x+10||Q>A.x+A.width-10)continue;const pe=A.y>V.y,Ee=pe?V.y+V.height:V.y,re=pe?A.y:A.y+A.height,Le=B.flow.source===R.participant.id?[{x:Q,y:re},{x:Q,y:Ee}]:[{x:Q,y:Ee},{x:Q,y:re}],me=ft(o),fe={...me.edges.find(Ve=>Ve.id===B.flow.id),waypoints:Le};hn(fe,Gn(me)).length||n.updateWaypoints(G,Le)}}};jx(!1);for(const v of _){const R=v.flow;n.connect(f(R.source),f(R.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:R.id,name:R.name})})}{const A=new Set([...m.map(V=>V.flow.id),..._.map(V=>V.flow.id)].filter(V=>!!V)),L=o.filter(V=>!!V.waypoints),N=(V,Q)=>Math.abs(Q.x-V.x)<2?"L":Math.abs(Q.x-(V.x+V.width))<2?"R":Math.abs(Q.y-V.y)<2?"T":Math.abs(Q.y-(V.y+V.height))<2?"B":void 0,B=new Map,G=(V,Q,pe)=>{if(!V||!Q||typeof V.x!="number")return;const Ee=N(V,Q);if(!Ee)return;let re=B.get(V.id);re||B.set(V.id,re=new Map),re.set(Ee,[...re.get(Ee)??[],pe])};for(const V of L){const Q=V.waypoints;!Q||Q.length<2||(G(V.source,Q[0],{id:V.id,dir:"out"}),G(V.target,Q[Q.length-1],{id:V.id,dir:"in"}))}const H=new Set;for(const[V,Q]of B){const pe=l(V);if(!pe||typeof pe.x!="number"||![...Q.values()].some(ge=>{const Se=ge.filter(Pe=>Pe.dir==="in");return ge.length>=3&&Se.length>=1&&ge.some(Pe=>Pe.dir==="out")&&Se.some(Pe=>A.has(Pe.id))}))continue;const re=p(pe);if(!re||H.has(re.id)||(re.children??[]).some(ge=>ge.type==="bpmn:Lane"))continue;const Le=(i0=Q.get("T"))!=null&&i0.length?(r0=Q.get("B"))!=null&&r0.length?void 0:"B":"T";if(!Le||(Le==="T"?pe.y-re.y:re.y+re.height-(pe.y+pe.height))>=k)continue;const fe=(re.children??[]).filter(ge=>!("waypoints"in ge&&ge.waypoints)&&ge.type!=="label"&&typeof ge.x=="number"),Ve=re.y+re.height;n.resizeShape(re,{x:re.x,y:re.y,width:re.width,height:re.height+k});const oe=u().children.filter(ge=>!("waypoints"in ge&&ge.waypoints)&&ge.id!==re.id&&typeof ge.y=="number"&&ge.y>=Ve);oe.length&&n.moveElements(oe,{x:0,y:k}),Le==="T"&&fe.length&&n.moveElements(fe,{x:0,y:k}),H.add(re.id)}}const Jf=20,Hx=4,UD=2,qD=[10,30,80],Go=()=>{const v=ft(o);return{bad:ri(v).filter(R=>R.kind==="edge-crosses-shape"||R.kind==="edge-overlap-opposite"||R.kind==="edge-overlap-mixed").length,crossings:Vd(v),straight:v.edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.waypoints.length===2).length}},Vo=v=>{const R=ft(o),A=R.edges.find(L=>L.id===v);return A?hn(A,Gn(R)).length:0},Ru=v=>Vo(v)>0,Cu=v=>ft(o).edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.id!==v&&R.waypoints.length===2).length,YD=(v,R,A)=>wn([{subtree:v,pool:R}],A),zx=(v,R)=>R.bad>v.bad||R.crossings>v.crossings&&R.straight<=v.straight&&R.bad>=v.bad,Pu=(v,R)=>zx(v,R)||R.straight<v.straight,Au=(v,R,A=()=>!0,L=zx)=>{const N=Go(),B=wn(v,R);if(!B)return!1;const G=Go();return L(N,G)||!A()?(B(),!1):!0},Gx=(v,R,A,L=()=>!0)=>Au([{subtree:v,pool:R}],A,L),qr=v=>{var R;return!!((R=C.get(v))!=null&&R.node.participant)},Qa=new Map;for(const v of _){if(!qr(v.flow.target))continue;const R=Qa.get(v.flow.target)??[];R.push(v),Qa.set(v.flow.target,R)}const ed=[...Qa.keys()],Vx=new Set(m.map(v=>v.flow.target)),Wx=v=>be.findIndex(({op:R})=>R.participant.id===v);ed.sort((v,R)=>{var N,B;const A=Vx.has(v)?1:0,L=Vx.has(R)?1:0;return A!==L?A-L:Wx((N=C.get(v))==null?void 0:N.node.participant)-Wx((B=C.get(R))==null?void 0:B.node.participant)});const Yr=v=>v.x+v.width/2,KD=v=>{const R=new Map;for(const N of o.getAll()){const B=N;if(!B.waypoints||!B.source||!B.target)continue;(R.get(B.source.id)??R.set(B.source.id,[]).get(B.source.id)).push(B.target.id)}const A=new Set([v]),L=[v];for(let N=0;N<L.length;N++)for(const B of R.get(L[N])??[])A.has(B)||(A.add(B),L.push(B));return A},XD=(v,R)=>{const A=KD(R);let L;for(const N of o.getAll()){const B=N;if(B.type!=="bpmn:MessageFlow"||!B.source||!B.target||B.target.id!==v||A.has(B.source.id))continue;const G=B.source;if(typeof G.x!="number"||G.type==="bpmn:Participant")continue;const H=Yr(G);(L===void 0||H>L)&&(L=H)}return L},td=(v,R)=>{const A=l(v.flow.source);if(A)return A.type==="bpmn:Participant"?XD(A.id,R):Yr(A)},Ux=v=>{let R;for(const A of Qa.get(v)??[]){const L=td(A,v);L!==void 0&&(!R||L>R.cx)&&(R={op:A,cx:L})}return R==null?void 0:R.op},ZD=v=>{const R=Ux(v),A=l(v),L=R?td(R,v):void 0;return A&&L!==void 0?L-Yr(A):void 0},QD=v=>{const R=ZD(v);return R!==void 0&&Math.abs(R)<Jf},qx=(v,R,A,L,N)=>{var B;for(let G=!0;G;){G=!1;for(const H of _){if(H.flow.id===A)continue;const V=R.has(H.flow.source),Q=R.has(H.flow.target);if(V===Q||L(V?H.flow.source:H.flow.target))continue;const pe=V?H.flow.target:H.flow.source;if(N(pe)||!qr(pe))continue;const Ee=l(H.flow.id);if(!(Ee!=null&&Ee.waypoints)||Ee.waypoints.length!==2)continue;const re=l(pe),Le=(B=C.get(pe))==null?void 0:B.node.participant;if(!re||!Le)continue;const me=$t(pe,fe=>fe.x>=re.x).filter(fe=>!R.has(fe.id));if(!(!me.length||me.some(fe=>N(fe.id)))){for(const fe of me)R.add(fe.id);v.set(Le,[...v.get(Le)??[],...me]),G=!0}}}return[...v].map(([G,H])=>({subtree:H,pool:f(G)}))},Yx=(v,R,A,L,N)=>qx(new Map([[R,[...v]]]),new Set(v.map(B=>B.id)),L,B=>B===A,B=>B===N),nd=v=>{const R=Ux(v);if(!R)return null;const A=l(v),L=l(R.flow.source),N=td(R,v);if(!A||!L||N===void 0)return null;const B=N-Yr(A);if(B>=Jf){const G=C.get(v).node.participant,H=$t(v,V=>V.x>=A.x);return{groups:Yx(H,G,v,R.flow.id,R.flow.source),dx:B}}if(-B>=Jf&&qr(R.flow.source)){const G=C.get(R.flow.source).node.participant,H=$t(R.flow.source,V=>V.x>=L.x&&!QD(V.id));return{groups:Yx(H,G,R.flow.source,R.flow.id,v),dx:-B}}return null},Kx=()=>ed.map(v=>({id:v,plan:nd(v)})).filter(v=>!!v.plan).sort((v,R)=>Math.min(...v.plan.groups.flatMap(A=>A.subtree.map(L=>L.x)))-Math.min(...R.plan.groups.flatMap(A=>A.subtree.map(L=>L.x)))).map(v=>v.id);for(let v=0;v<3;v++){const R=Go(),A=[];for(const N of Kx()){const B=nd(N);if(!B)continue;const G=wn(B.groups,B.dx);G&&A.push(G)}if(!A.length)break;if(!Pu(R,Go()))continue;for(const N of A.reverse())N();let L=!1;for(const N of Kx()){const B=nd(N);B&&Au(B.groups,B.dx,()=>!0,Pu)&&(L=!0)}if(!L)break}for(const v of ed.flatMap(R=>Qa.get(R)??[])){if(!Ru(v.flow.id))continue;const R=l(v.flow.target);if(!R)continue;const A=f(C.get(v.flow.target).node.participant),L=$t(v.flow.target,H=>H.x>=R.x),N=R.width+O,B=Vo(v.flow.id),G=Cu(v.flow.id);for(let H=1;H<=Hx;H++){const V=()=>Vo(v.flow.id)<B&&Cu(v.flow.id)>=G;if(Gx(L,A,N*H,V))break}}for(const v of _){if(!Ru(v.flow.id))continue;const R=l(v.flow.source),A=l(v.flow.target);if(!R||!A||R.type==="bpmn:Participant"||A.type==="bpmn:Participant")continue;const L=R.x+R.width/2;if(Math.abs(L-(A.x+A.width/2))>15)continue;const[N,B]=R.y<A.y?[R.y+R.height,A.y]:[A.y+A.height,R.y],G=[...C.values()].map(H=>l(H.node.id)).filter(H=>!!H&&H.id!==R.id&&H.id!==A.id).filter(H=>H.x<=L&&L<=H.x+H.width&&H.y+H.height>N&&H.y<B).sort((H,V)=>H.x-V.x);for(const H of G){const V=(o0=C.get(H.id))==null?void 0:o0.node.participant,Q=V?l(V):void 0;if(!Q)continue;const pe=[...C.values()].filter(Se=>Se.node.participant===V).map(Se=>Se.node.id),Ee=Se=>Se.map(Pe=>l(Pe)).filter(Pe=>!!Pe),Le=[zo(H.id,Se=>{var Pe;return((Pe=C.get(Se.id))==null?void 0:Pe.node.participant)===V}),Ee(pe)].filter(Se=>Se.length),me=H.width+O,fe=Vo(v.flow.id),Ve=Cu(v.flow.id),oe=()=>Vo(v.flow.id)<fe&&Cu(v.flow.id)>=Ve;let ge=!1;for(const Se of Le){for(let Pe=1;Pe<=Hx;Pe++)if(Gx(Se,Q,me*Pe,oe)){ge=!0;break}if(ge)break}if(!Ru(v.flow.id))break}}for(const v of _){if(!Ru(v.flow.id))continue;const R=l(v.flow.id);if(((a0=R==null?void 0:R.waypoints)==null?void 0:a0.length)!==2)continue;const A=l(v.flow.source),L=l(v.flow.target);if(!A||!L||A.type==="bpmn:Participant"||L.type==="bpmn:Participant"||!qr(v.flow.source)||!qr(v.flow.target)||Math.abs(Yr(A)-Yr(L))>UD)continue;const N=Yr(A),B=R.waypoints.map(fe=>fe.y),[G,H]=[Math.min(...B),Math.max(...B)],V=Gn(ft(o)).filter(fe=>fe.id!==A.id&&fe.id!==L.id&&fe.x<N&&N<fe.x+fe.width&&G<fe.y+fe.height&&fe.y<H);if(!V.length)continue;const Q=(s0=C.get(v.flow.source))==null?void 0:s0.node.participant,pe=(c0=C.get(v.flow.target))==null?void 0:c0.node.participant;if(!Q||!pe)continue;const Ee=new Map;for(const[fe,Ve,oe]of[[v.flow.source,A,Q],[v.flow.target,L,pe]]){const ge=Ee.get(oe)??[],Se=$t(fe,Pe=>Pe.x>=Ve.x).filter(Pe=>!ge.some(tt=>tt.id===Pe.id));Ee.set(oe,[...ge,...Se])}const re=new Set([...Ee.values()].flat().map(fe=>fe.id)),Le=qx(Ee,re,v.flow.id,fe=>fe===v.flow.source||fe===v.flow.target,()=>!1),me=Math.max(...V.map(fe=>fe.x+fe.width));for(const fe of qD){const Ve=me+fe-N;if(Ve<=0)continue;if(Au(Le,Ve,()=>{var ge,Se;return Vo(v.flow.id)===0&&((Se=(ge=l(v.flow.id))==null?void 0:ge.waypoints)==null?void 0:Se.length)===2},Pu))break}}{const v=A=>A.y+A.height/2,R=[];for(const A of C.keys()){if(!qr(A))continue;const L=m.filter(G=>G.flow.target===A);if(L.length!==1)continue;const N=l(L[0].flow.source),B=l(A);!N||!B||!C.has(N.id)||Math.abs(v(N)-v(B))>1||B.x-(N.x+N.width)<=O+1||R.push({id:A,pred:N,node:B})}R.sort((A,L)=>A.node.x-L.node.x);for(const{id:A}of R){const L=C.get(A),N=l(A),B=l(m.find(re=>re.flow.target===A).flow.source);if(!N||!B)continue;const G=N.x-(B.x+B.width);if(G<=O+1)continue;const H=f(L.node.participant),V=$t(A,re=>re.x>=N.x),Q=Go(),pe=YD(V,H,-(G-O));if(!pe)continue;const Ee=Go();(Ee.bad>Q.bad||Ee.crossings>=Q.crossings||Ee.straight<Q.straight)&&pe()}}jx(!0);for(const v of y){const R=v.associations??[],A=R.map(B=>B.source===v.dataStore.id?B.target:B.source).map(l).find(Boolean),L=A?p(A)??u():u(),N=A?{x:A.x+A.width/2,y:A.y+A.height+110}:{x:200,y:Be+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:v.dataStore.id,name:v.dataStore.name})},N,L);for(const B of R)Je(v.dataStore.id,B)}for(const v of x){const A=f(v.association.target).type==="bpmn:DataStoreReference"?v.association.target:v.association.source;Je(A,v.association)}let Xx=0;const Kr=10,Zx=40,JD=(v,R)=>{const A=R.map(V=>p(V)).filter(V=>!!V);for(const V of A){const Q=Kr,pe=V.y,Ee=V.y+V.height,re=V.x,Le=V.x+V.width;if(Math.abs(v.y-pe)<Q){const me=pe+Q-v.y;v.y+=me,v.height-=me}if(Math.abs(v.y+v.height-Ee)<Q&&(v.height=Ee-Q-v.y),Math.abs(v.x-re)<Q){const me=re+Q-v.x;v.x+=me,v.width-=me}Math.abs(v.x+v.width-Le)<Q&&(v.width=Le-Q-v.x)}if(!A.length)return;const L=Math.min(...A.map(V=>V.y)),N=Math.max(...A.map(V=>V.y+V.height)),B=L-v.y,G=v.y+v.height-N,H=Zx-Kr;if(B>0!=G>0)if(B>0&&B<H){const V=B+Kr;v.y+=V,v.height-=V}else G>0&&G<H&&(v.height-=G+Kr)},eL=(v,R)=>{const A=Kr,L=30,N=o.filter(B=>B.type==="bpmn:Group"&&B.id!==R);for(const B of N){const G=B.x,H=B.x+B.width,V=B.y,Q=B.y+B.height,pe=v.y<Q&&V<v.y+v.height,Ee=v.x<H&&G<v.x+v.width;if(pe){if(Math.abs(v.x-H)<A){const re=Math.min(H+A-v.x,L);re>0&&v.width-re>0&&(v.x+=re,v.width-=re)}if(Math.abs(v.x+v.width-G)<A){const re=Math.min(v.x+v.width-(G-A),L);re>0&&v.width-re>0&&(v.width-=re)}}if(Ee){if(Math.abs(v.y-Q)<A){const re=Math.min(Q+A-v.y,L);re>0&&v.height-re>0&&(v.y+=re,v.height-=re)}if(Math.abs(v.y+v.height-V)<A){const re=Math.min(v.y+v.height-(V-A),L);re>0&&v.height-re>0&&(v.height-=re)}}}},id=(v,R)=>{const A=Zx,L=Math.min(...v.map(V=>V.x))-A,N=Math.min(...v.map(V=>V.y))-A,B=Math.max(...v.map(V=>V.x+V.width))+A,G=Math.max(...v.map(V=>V.y+V.height))+A,H={x:L,y:N,width:B-L,height:G-N};return JD(H,v),eL(H,R),H};for(const v of P){const R=(v.group.members??[]).map(l).filter(N=>!!N);let A;R.length?A=id(R,v.group.id):(A={x:300+Xx*350,y:40,width:300,height:200},Xx++);const L=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:v.group.id}),width:A.width,height:A.height},{x:A.x+A.width/2,y:A.y+A.height/2},u());v.group.name&&n.updateLabel(L,v.group.name),(u0=v.group.members)!=null&&u0.length&&D(L,"bwl:Members",{refs:v.group.members.join(" ")})}{const v=o.filter(N=>!!N.waypoints),R=new Map,A=(N,B)=>{!N||!B||(R.has(N)||R.set(N,new Set),R.get(N).add(B))};for(const N of v){const B=(l0=N.source)==null?void 0:l0.id,G=(p0=N.target)==null?void 0:p0.id;A(B,G),((f0=N.type)!=null&&f0.includes("DataOutputAssociation")||(d0=N.type)!=null&&d0.includes("DataInputAssociation")||N.type==="bpmn:Association")&&A(G,B)}const L=o.filter(N=>N.type==="bpmn:Group");for(const N of L){const G=(((h0=N.businessObject.extensionElements)==null?void 0:h0.values)??[]).find(oe=>oe.$type==="bwl:Members"),H=((G==null?void 0:G.refs)??"").split(" ").filter(Boolean);if(!H.length)continue;const V=new Set(H),Q=[...H];for(;Q.length;){const oe=Q.shift();for(const ge of R.get(oe)??[])V.has(ge)||(V.add(ge),Q.push(ge))}const pe=N.x,Ee=N.x+N.width,re=N.y,Le=N.y+N.height,me=oe=>m.filter(ge=>ge.flow.target===oe).length,fe=oe=>{var Se;const ge=((Se=l(oe))==null?void 0:Se.type)??"";if(ge==="bpmn:StartEvent"&&me(oe)===0)return!1;if(ge.endsWith("Gateway")){const Pe=m.filter(tt=>tt.flow.target===oe).map(tt=>tt.flow.source);if(Pe.length&&Pe.every(tt=>{var $e;return(($e=l(tt))==null?void 0:$e.type)==="bpmn:StartEvent"&&me(tt)===0}))return!1}return!0},Ve=o.filter(oe=>vn(oe)).filter(oe=>oe.type!=="bpmn:Group"&&oe.type!=="bpmn:Participant"&&oe.type!=="bpmn:TextAnnotation"&&!V.has(oe.id)&&qr(oe.id)&&fe(oe.id)&&oe.x<Ee&&oe.x+oe.width>pe&&oe.y<Le&&oe.y+oe.height>re);if(Ve.length)for(const oe of[-1,1]){const ge=Ve.filter(ne=>(ne.x+ne.width-pe<=Ee-ne.x?-1:1)===oe);if(!ge.length)continue;const Se=[];for(const ne of ge){const Z=Se.find(he=>he.some(Me=>ne.y<Me.y+Me.height&&ne.y+ne.height>Me.y));Z?Z.push(ne):Se.push([ne])}const Pe=new Map;for(const ne of Se){let Z=oe<0?pe-Kr:Ee+Kr;for(const he of[...ne].sort((Me,Re)=>oe<0?Re.x-Me.x:Me.x-Re.x)){const Me=oe<0?Math.min(he.x,Z-he.width):Math.max(he.x,Z);Z=oe<0?Me-Jt:Me+he.width+Jt,Me!==he.x&&Math.sign(Me-he.x)===oe&&Pe.set(he.id,Me-he.x)}}const tt=new Map,$e=ne=>tt.get(ne)===ne||!tt.get(ne)?ne:$e(tt.get(ne));for(const ne of ge)tt.set(ne.id,ne.id);for(const ne of _){const Z=Pe.has(ne.flow.source)?ne.flow.source:void 0,he=Pe.has(ne.flow.target)?ne.flow.target:void 0;if(!Z||!he)continue;const Me=l(ne.flow.id);((m0=Me==null?void 0:Me.waypoints)==null?void 0:m0.length)===2&&tt.set($e(Z),$e(he))}const ht=new Map;for(const ne of ge){if(!Pe.has(ne.id))continue;const Z=$e(ne.id);ht.set(Z,[...ht.get(Z)??[],ne])}const pt=[...ht.values()].sort((ne,Z)=>oe<0?Math.min(...ne.map(he=>he.x))-Math.min(...Z.map(he=>he.x)):Math.max(...Z.map(he=>he.x))-Math.max(...ne.map(he=>he.x))),J=[];let Ae=!0;for(const ne of pt){const Z=ne.map(Re=>Pe.get(Re.id)??0).reduce((Re,He)=>Math.abs(He)>Math.abs(Re)?He:Re,0),he=new Map;let Me=!0;for(const Re of ne){const He=p(Re);if(!He){Me=!1;break}he.has(He.id)||he.set(He.id,{subtree:[],pool:He}),he.get(He.id).subtree.push(Re)}Me&&Au([...he.values()],Z,()=>!0,Pu)?J.push({shapes:ne,dx:Z}):Ae=!1}if(!Ae)for(const ne of J.reverse())n.moveElements(ne.shapes,{x:-ne.dx,y:0})}}}{const v=new Set([...P.map(R=>R.group.id),...Yt(e,"group.update").map(R=>R.id)]);for(const R of o.filter(A=>A.type==="bpmn:Group")){if(v.has(R.id))continue;const L=(((g0=R.businessObject.extensionElements)==null?void 0:g0.values)??[]).find(H=>H.$type==="bwl:Members"),N=((L==null?void 0:L.refs)??"").split(" ").filter(Boolean).map(l).filter(H=>!!H);!N.length||!N.some(H=>{const V=d.get(H.id);return!V||V.x!==H.x||V.y!==H.y})||!N.some(H=>H.x<R.x||H.y<R.y||H.x+H.width>R.x+R.width||H.y+H.height>R.y+R.height)||n.resizeShape(R,id(N,R.id))}}{const R=new Map(so(ft(o)).map(H=>[H.owner,H.rect])),A=o.filter(H=>!!H.waypoints),L=new Map,N=(H,V)=>{!H||!V||(L.has(H)||L.set(H,new Set),L.get(H).add(V))};for(const H of A){const V=(y0=H.source)==null?void 0:y0.id,Q=(v0=H.target)==null?void 0:v0.id;N(V,Q),((b0=H.type)!=null&&b0.includes("DataOutputAssociation")||(_0=H.type)!=null&&_0.includes("DataInputAssociation")||H.type==="bpmn:Association")&&N(Q,V)}const B=H=>m.filter(V=>V.flow.target===H).length,G=H=>{var Q;const V=((Q=l(H))==null?void 0:Q.type)??"";if(V==="bpmn:StartEvent"&&B(H)===0)return!1;if(V.endsWith("Gateway")){const pe=m.filter(Ee=>Ee.flow.target===H).map(Ee=>Ee.flow.source);if(pe.length&&pe.every(Ee=>{var re;return((re=l(Ee))==null?void 0:re.type)==="bpmn:StartEvent"&&B(Ee)===0}))return!1}return!0};for(const H of o.filter(V=>V.type==="bpmn:Group")){const Q=(((x0=H.businessObject.extensionElements)==null?void 0:x0.values)??[]).find(Z=>Z.$type==="bwl:Members"),pe=((Q==null?void 0:Q.refs)??"").split(" ").filter(Boolean);if(!pe.length)continue;const Ee=pe.map(l).filter(Z=>!!Z);if(!Ee.length||!(P.some(Z=>Z.group.id===H.id)||Yt(e,"group.update").some(Z=>Z.id===H.id)||Ee.some(Z=>{const he=d.get(Z.id);return!he||he.x!==Z.x||he.y!==Z.y})))continue;const Le=new Set(pe),me=[...pe];for(;me.length;){const Z=me.shift();for(const he of L.get(Z)??[])Le.has(he)||(Le.add(he),me.push(he))}const fe=H.x,Ve=H.x+H.width,oe=H.y,ge=H.y+H.height,Se=Z=>{const he=R.get(Z.id),Me={x:Z.x,y:Z.y,width:Z.width,height:Z.height};return he?[Me,{x:he.x,y:he.y,width:he.width,height:he.height}]:[Me]},Pe=Ee.flatMap(Se),tt=Math.min(...Pe.map(Z=>Z.x)),$e=Math.max(...Pe.map(Z=>Z.x+Z.width)),ht=Math.min(...Pe.map(Z=>Z.y)),pt=Math.max(...Pe.map(Z=>Z.y+Z.height)),J={L:tt-fe,R:Ve-$e,T:ht-oe,B:ge-pt},Ae=o.filter(Z=>vn(Z)).filter(Z=>Z.type!=="bpmn:Group"&&Z.type!=="bpmn:Participant"&&Z.type!=="bpmn:TextAnnotation"&&!Le.has(Z.id)&&G(Z.id)&&Z.x<Ve&&Z.x+Z.width>fe&&Z.y<ge&&Z.y+Z.height>oe);if(!Ae.length)continue;const ne={L:0,R:0,T:0,B:0};for(const Z of Ae){const he=Se(Z),Me=Math.min(...he.map(gt=>gt.x)),Re=Math.max(...he.map(gt=>gt.x+gt.width)),He=Math.min(...he.map(gt=>gt.y)),nt=Math.max(...he.map(gt=>gt.y+gt.height)),Wt={L:Re-fe,R:Ve-Me,T:nt-oe,B:ge-He},si=["L","R","T","B"].filter(gt=>Wt[gt]<=J[gt]+.001);if(!si.length)continue;const Pt=si.reduce((gt,es)=>Wt[es]<Wt[gt]?es:gt,si[0]);ne[Pt]=Math.max(ne[Pt],Math.min(Wt[Pt]+10,J[Pt]))}!ne.L&&!ne.R&&!ne.T&&!ne.B||n.resizeShape(H,{x:H.x+ne.L,y:H.y+ne.T,width:H.width-ne.L-ne.R,height:H.height-ne.T-ne.B})}}const Qx=v=>{const R=v.waypoints;if(R!=null&&R.length){const L=R[Math.floor((R.length-1)/2)];return{x:L.x,y:L.y,width:0,height:0}}const A=v;return{x:A.x,y:A.y,width:A.width,height:A.height}};let Ja=0;const Jx=12,e0=14,tL=15,nL=300,iL=v=>{const R=v.split(`
|
|
7
|
+
`),A=Math.max(...R.map(B=>ro(B,Jx))),L=Math.max(100,Math.min(nL,Math.ceil(A)+e0)),N=R.reduce((B,G)=>B+Math.max(1,Math.ceil((ro(G,Jx)+e0)/L)),0);return{width:L,height:Math.max(30,N*tL+10)}};for(const v of S){const R=v.association,A=((w0=v.placement)==null?void 0:w0.anchor)??(R?R.source===v.annotation.id?R.target:R.source:void 0),L=A?l(A):void 0,N=L?Qx(L):void 0,B=iL(v.annotation.text??"");let G;if(N&&v.placement){const[pe,Ee]=_s[v.placement.side],re=v.placement.offset??50;G={x:N.x+N.width/2+pe*(N.width/2+B.width/2+re),y:N.y+N.height/2+Ee*(N.height/2+B.height/2+re)}}else N?(G={x:N.x+N.width/2+180+Ja%3*260,y:N.y-110-Ja%2*95},Ja++):(G={x:300+Ja*260,y:60},Ja++);const H=L?p(L)??u():u(),V=H;N&&typeof V.x=="number"&&typeof V.width=="number"&&V.type==="bpmn:Participant"&&(G=sl(o,N,B,V,v.placement?{placement:v.placement}:{from:G}));const Q=n.createShape({type:"bpmn:TextAnnotation",width:B.width,height:B.height,businessObject:i.create("bpmn:TextAnnotation",{id:v.annotation.id,text:v.annotation.text})},G,H);if(R){const pe=Ee=>Ee===v.annotation.id?Q:f(Ee);n.connect(pe(R.source),pe(R.target),R.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:R.id})}:{type:"bpmn:Association"})}v.placement&&D(Q,"bwl:Placement",T(v.placement))}for(const v of Yt(e,"association.add")){const R=v.association;n.connect(f(R.source),f(R.target),R.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:R.id})}:{type:"bpmn:Association"})}for(const v of Yt(e,"node.update")){let R=f(v.id);if(v.type&&bs(v.type)!==R.type&&(R=c.replaceElement(R,{type:bs(v.type)})),v.name!==void 0&&n.updateProperties(R,{name:v.name??void 0}),v.lane||v.band!==void 0){v.band!==void 0&&n.updateProperties(R,{"bwl:band":v.band});const A=R.y+R.height/2,L=p(R),N=v.lane?f(v.lane):((L==null?void 0:L.children)??[]).find(G=>G.type==="bpmn:Lane"&&A>=G.y&&A<=G.y+G.height);v.band!==void 0&&X(N==null?void 0:N.id,v.band,L);const B=N?N.y+(v.band===void 0?N.height/2:Math.min(N.height/2,se)+M(N.id,v.band)*k):v.band!==void 0&&L?L.y+j+M(`pool:${L.id}`,v.band)*k:void 0;if(B!==void 0){const G=B-A;G!==0&&n.moveElements([R],{x:0,y:G})}}}for(const v of Yt(e,"sequenceFlow.update")){const R=f(v.id);if(v.source!==void 0||v.target!==void 0){const A=R,L=v.source!==void 0?f(v.source):A.source,N=v.target!==void 0?f(v.target):A.target,B=G=>({x:G.x+G.width/2,y:G.y+G.height/2});n.reconnect(A,L,N,[B(L),B(N)])}v.name!==void 0&&n.updateProperties(R,{name:v.name??void 0}),v.condition!==void 0&&n.updateProperties(R,{name:((E0=v.condition)==null?void 0:E0.label)??void 0})}for(const v of Yt(e,"messageFlow.update"))v.name!==void 0&&n.updateProperties(f(v.id),{name:v.name??void 0});for(const v of Yt(e,"dataStore.update"))v.name!==void 0&&n.updateProperties(f(v.id),{name:v.name??void 0});for(const v of Yt(e,"annotation.update")){const R=f(v.id);if(v.text!==void 0&&n.updateProperties(R,{text:v.text}),v.placement===null)D(R,"bwl:Placement",null);else if(v.placement){const A=f(v.placement.anchor),L=Qx(A),N=p(A)??u(),B=typeof N.x=="number"&&typeof N.width=="number"&&N.type==="bpmn:Participant",[G,H]=_s[v.placement.side],V=v.placement.offset??50,Q={x:L.x+L.width/2+G*(L.width/2+R.width/2+V),y:L.y+L.height/2+H*(L.height/2+R.height/2+V)},pe=B?sl(o,L,{width:R.width,height:R.height},N,{placement:v.placement,selfId:v.id}):Q;n.moveElements([R],{x:pe.x-(R.x+R.width/2),y:pe.y-(R.y+R.height/2)}),D(R,"bwl:Placement",T(v.placement))}}for(const v of Yt(e,"group.update")){const R=f(v.id);if(v.name!==void 0&&n.updateLabel(R,v.name??""),v.members){const A=v.members.map(l).filter(L=>!!L);A.length&&n.resizeShape(R,id(A,v.id)),D(R,"bwl:Members",{refs:v.members.join(" ")})}}}function cl(e){switch(e.kind){case"annotation-over-label":return[e.annotation];case"edge-crosses-shape":return[e.shape];case"shape-outside-container":return[e.shape];case"shape-overlap":return e.shapes;default:return[]}}function o1(e,t,n){var l,f;const{elementRegistry:i}=e,r=e.modeling,o=p=>ri(p).filter(d=>!t.has(ii(d))),a=p=>{var d;return((d=i.get(p))==null?void 0:d.type)==="bpmn:TextAnnotation"},s=ft(i),c=o(s),u=[...new Set(c.flatMap(cl))].filter(p=>n.has(p)&&a(p));if(u.length)for(const p of u){const d=i.get(p);if(!d||typeof d.x!="number"||typeof d.width!="number")continue;let g=d.parent,h;for(;g;){if(g.type==="bpmn:Participant"){h=g;break}g=g.parent}if(!h){const we=d.x+d.width/2,Ke=d.y+d.height/2;h=i.getAll().find(Y=>{if(Y.type!=="bpmn:Participant")return!1;const ue=Y;return typeof ue.x=="number"&&typeof ue.width=="number"&&we>=ue.x&&we<=ue.x+ue.width&&Ke>=ue.y&&Ke<=ue.y+ue.height})}if(!h||typeof h.x!="number"||typeof h.width!="number")continue;const _=(((l=d.businessObject.extensionElements)==null?void 0:l.values)??[]).find(we=>we.$type==="bwl:Placement"),y=[...d.incoming??[],...d.outgoing??[]].find(we=>we.type==="bpmn:Association"),x=(_!=null&&_.anchor?i.get(_.anchor):void 0)??(y?((f=y.source)==null?void 0:f.id)===p?y.target:y.source:void 0);if(!x)continue;const S=x.waypoints,P=S!=null&&S.length?{x:S[Math.floor((S.length-1)/2)].x,y:S[Math.floor((S.length-1)/2)].y,width:0,height:0}:{x:x.x,y:x.y,width:x.width,height:x.height},C={width:d.width,height:d.height},D={x:d.x+d.width/2,y:d.y+d.height/2},T=_==null?void 0:_.side,$=[];T&&T in _s&&$.push(sl(i,P,C,h,{placement:{side:T,offset:(_==null?void 0:_.offset)??null},selfId:p}));for(const[we,Ke]of[[-1,0],[1,0],[0,-1],[0,1]])for(let Y=1;Y<=r1;Y++)$.push({x:D.x+we*Th*Y,y:D.y+Ke*Th*Y});const k={...s,edges:s.edges.filter(we=>we.id!==(y==null?void 0:y.id))},O=o(k),j=O.filter(we=>cl(we).includes(p)).length;if(!j)continue;let se;for(const we of $){const Ke=we.x-D.x,Y=we.y-D.y;if(!Ke&&!Y||we.x-C.width/2<h.x||we.x+C.width/2>h.x+h.width||we.y-C.height/2<h.y||we.y+C.height/2>h.y+h.height)continue;const ue={...k,shapes:k.shapes.map(ce=>ce.id===p?{...ce,x:ce.x+Ke,y:ce.y+Y}:ce)},_e=o(ue),le=_e.filter(ce=>cl(ce).includes(p)).length;if(le>=j||_e.length>O.length)continue;const xe=Math.abs(Ke)+Math.abs(Y);if((!se||le<se.mine||le===se.mine&&(_e.length<se.all||_e.length===se.all&&xe<se.dist))&&(se={x:we.x,y:we.y,mine:le,all:_e.length,dist:xe}),se.mine===0&&se.all<O.length)break}se&&r.moveElements([d],{x:se.x-D.x,y:se.y-D.y})}}function kh(e,t,n=Mh){const i=Ah(e),r=Ph(t,Jd(i.elementRegistry)),o={edgeCrossings:{before:0,after:0,pairs:[],solidPairs:0,dashedPairs:0,mixedPairs:0,crossPoolMessages:0}};if(r.length)return{ok:!1,issues:r,findings:[],stats:o};const a=ft(i.elementRegistry),s=new Set(ri(a).map(ii)),c=new Set(a.edges.map(h=>h.id)),u=new Set(a.shapes.map(h=>h.id)),l=el(a).length,f=e.get("commandStack");try{cd(f,()=>{n(t,i),ch(i,c),oh(i,s),vh(i,s,c),ph(i,c),KE(i,c),hh(i,s,c),JE(i,s,c),wh(i,s,c),xh(i,c),Sh(i,u),o1(i,s,u)})}catch(h){return{ok:!1,issues:[{kind:"lower-failed",message:h instanceof Error?h.message:String(h)}],findings:[],stats:o}}const p=ft(i.elementRegistry),d=ri(p).filter(h=>!s.has(ii(h))),g=Wd(p);return{ok:!0,issues:[],findings:d,stats:{edgeCrossings:{before:l,after:g.pairs.length,pairs:g.pairs,solidPairs:g.solidPairs,dashedPairs:g.dashedPairs,mixedPairs:g.mixedPairs,crossPoolMessages:g.crossPoolMessages}}}}function a1(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function s1(e,t){return typeof e.get=="function"?e.get(t):e[t]}function Oh(e,t){const n=s1(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Dh(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function c1(e){return typeof e=="string"&&Mu.includes(e)}function pi(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function Lh(e){const t=e.rootElements??[],n=t.find(Y=>Y.$type==="bpmn:Collaboration"),i=new Map(t.filter(Y=>Y.$type==="bpmn:Process").map(Y=>[Y.id,Y])),r=[],o=[],a=[],s=[],c=[],u=[],l={poolOrders:{},bands:{},placements:{}},f=[],p=[],d=[],g=[],h=[],m=[],_=new Set,y=new Set,x=Y=>{Y&&_.add(Y)},S=Y=>{_.add(Y),y.add(Y)},P=Y=>{const ue=Dh(Y,"bwl:Placement");if(!ue)return;const _e=typeof ue.anchor=="string"?ue.anchor:void 0;if(!_e||!c1(ue.side))return;const le=typeof ue.offset=="number"?ue.offset:void 0;h.push({owner:Y.id,anchor:_e,side:ue.side,...le!==void 0?{offset:le}:{}})},C=Y=>{const ue=Dh(Y,"bwl:Members"),_e=typeof(ue==null?void 0:ue.refs)=="string"?ue.refs.split(/\s+/).filter(Boolean):[];_e.length&&m.push({owner:Y.id,refs:_e})},D=Y=>{var ue;for(const _e of Y)switch(x(_e.id),_e.$type){case"bpmn:TextAnnotation":S(_e.id),s.push({id:_e.id,text:typeof _e.text=="string"?_e.text:""}),P(_e);break;case"bpmn:Association":d.push({id:_e.id,type:_e.$type,source:pi(_e.sourceRef),target:pi(_e.targetRef)});break;case"bpmn:Group":{S(_e.id);const le=(ue=_e.categoryValueRef)==null?void 0:ue.value;c.push({id:_e.id,...typeof le=="string"&&le?{name:le}:{}}),C(_e);break}default:u.push({id:_e.id,type:_e.$type,reason:"type-outside-mvp"})}},T=(Y,ue)=>{const _e=Y.flowElements??[],le=(Y.laneSets??[]).flatMap(ce=>ce.lanes??[]),xe=new Map;for(const ce of le){x(ce.id);for(const U of ce.flowNodeRef??[]){const q=pi(U);q&&xe.set(q,ce.id)}}for(const ce of _e){if(x(ce.id),ce.$type==="bpmn:SequenceFlow"){f.push({id:ce.id,source:pi(ce.sourceRef),target:pi(ce.targetRef),...typeof ce.name=="string"&&ce.name?{name:ce.name}:{}});continue}if(ce.$type==="bpmn:DataStoreReference"){S(ce.id),a.push({id:ce.id,...ce.name?{name:ce.name}:{}});continue}const U=a1(ce.$type);if(!rd(U)){u.push({id:ce.id,type:ce.$type,reason:"type-outside-mvp"});continue}S(ce.id),o.push({id:ce.id,type:U,...ce.name?{name:ce.name}:{},...ue?{participant:ue}:{},...xe.has(ce.id)?{lane:xe.get(ce.id)}:{}});const q=Oh(ce,"bwl:band");q!==void 0&&(l.bands[ce.id]=q);for(const K of ce.dataOutputAssociations??[])x(K.id),g.push({id:K.id,type:K.$type,source:ce.id,target:pi(K.targetRef)});for(const K of ce.dataInputAssociations??[])x(K.id),g.push({id:K.id,type:K.$type,source:pi((K.sourceRef??[])[0]),target:ce.id})}D(Y.artifacts??[])};if(n){const Y=new Set;for(const ue of n.participants??[]){S(ue.id);const _e=pi(ue.processRef);_e&&Y.add(_e);const le=_e?i.get(_e):void 0,xe=((le==null?void 0:le.laneSets)??[]).flatMap(K=>K.lanes??[]),ce=xe.map(K=>({id:K.id,...K.name?{name:K.name}:{}}));for(const K of ce)S(K.id);const U=!le||(le.flowElements??[]).length===0&&xe.length===0&&(le.artifacts??[]).length===0;r.push({id:ue.id,...ue.name?{name:ue.name}:{},...U?{blackBox:!0}:{},...ce.length?{lanes:ce}:{}});const q=Oh(ue,"bwl:poolOrder");q!==void 0&&(l.poolOrders[ue.id]=q),le&&T(le,ue.id)}for(const ue of n.messageFlows??[])x(ue.id),p.push({id:ue.id,source:pi(ue.sourceRef),target:pi(ue.targetRef),...typeof ue.name=="string"&&ue.name?{name:ue.name}:{}});D(n.artifacts??[]);for(const[ue,_e]of i)!Y.has(ue)&&(_e.flowElements??[]).length>0&&u.push({id:ue,type:_e.$type,reason:"unreachable-process"})}else for(const Y of i.values())T(Y);const $=[],k=[],O=[],j=[],se=(Y,ue)=>!!Y&&!!ue&&y.has(Y)&&y.has(ue);for(const Y of f){if(!se(Y.source,Y.target)){u.push({id:Y.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}$.push({id:Y.id,source:Y.source,target:Y.target,...Y.name?{name:Y.name}:{}}),y.add(Y.id)}for(const Y of p){if(!se(Y.source,Y.target)){u.push({id:Y.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}k.push({id:Y.id,source:Y.source,target:Y.target,...Y.name?{name:Y.name}:{}}),y.add(Y.id)}for(const Y of g){if(!se(Y.source,Y.target)){u.push({id:Y.id??"",type:Y.type,reason:"endpoint-outside-mvp"});continue}j.push({...Y.id?{id:Y.id}:{},source:Y.source,target:Y.target}),Y.id&&y.add(Y.id)}for(const Y of d){if(!se(Y.source,Y.target)){u.push({id:Y.id??"",type:Y.type,reason:"endpoint-outside-mvp"});continue}O.push({...Y.id?{id:Y.id}:{},source:Y.source,target:Y.target})}const we=new Map(c.map(Y=>[Y.id,Y]));for(const{owner:Y,refs:ue}of m){const _e=ue.filter(xe=>_.has(xe)),le=we.get(Y);le&&_e.length&&(le.members=_e)}for(const Y of h)_.has(Y.anchor)&&(l.placements[Y.owner]={anchor:Y.anchor,side:Y.side,...Y.offset!==void 0?{offset:Y.offset}:{}});return{definition:{...r.length?{participants:r}:{},nodes:o,sequenceFlows:$,...k.length?{messageFlows:k}:{},...a.length?{dataStores:a}:{},...j.length?{dataAssociations:j}:{},...s.length?{annotations:s}:{},...O.length?{associations:O}:{},...c.length?{groups:c}:{}},hints:l,omitted:u}}async function u1(e){const{definitions:t,warnings:n}=await qu(e);return{...Lh(t),warnings:n}}function l1(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function Ih(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=kh(e,t.ops);if(!i.ok)return{status:"rejected",issues:i.issues};const{xml:r}=await e.saveXML({format:!0});return{status:"applied",version:n+1,xml:r??"",findings:i.findings,stats:i.stats}}const p1=Symbol("bpmn-editor");function f1(){const e=Mt.ref(!1),t=Mt.ref(!0),n=Mt.ref(!1);let i,r;const o=()=>{e.value=!0};function a(u,l){u.get("canvas").getContainer().style.pointerEvents=l?"":"none";const f=u.get("keyboard");l?(r&&f.bind(r),r=void 0):r||(r=f.getBinding(),f.unbind())}function s(){if(!i)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return i}function c(){return i==null?void 0:i.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,attach(u){i&&this.detach(),i=u,i.get("eventBus").on("commandStack.changed",o),t.value||a(i,!1)},detach(){i==null||i.get("eventBus").off("commandStack.changed",o),i&&!t.value&&a(i,!0),r=void 0,i=void 0},setEditable(u){t.value=u,i&&a(i,u)},async applyAgentBatch(u,l){const f=s();n.value=!0;try{const p=await Ih(f,u,{currentVersion:l});return p.status==="applied"&&(e.value=!1),p}finally{n.value=!1}},async importXml(u){const{warnings:l}=await s().importXML(u);return e.value=!1,{warnings:Yu(l)}},async saveXml(){const{xml:u}=await s().saveXML({format:!0});return e.value=!1,u??""},undo:()=>{var u;return(u=c())==null?void 0:u.undo()},redo:()=>{var u;return(u=c())==null?void 0:u.redo()},canUndo:()=>{var u;return((u=c())==null?void 0:u.canUndo())??!1},canRedo:()=>{var u;return((u=c())==null?void 0:u.canRedo())??!1}}}function ye(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function d1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ul={exports:{}},Bh;function h1(){if(Bh)return ul.exports;Bh=1;var e=ul.exports=function(t,n){if(n||(n=16),t===void 0&&(t=128),t<=0)return"0";for(var i=Math.log(Math.pow(2,t))/Math.log(n),r=2;i===1/0;r*=2)i=Math.log(Math.pow(2,t/r))/Math.log(n)*r;for(var o=i-Math.floor(i),a="",r=0;r<Math.floor(i);r++){var s=Math.floor(Math.random()*n).toString(n);a=s+a}if(o){var c=Math.pow(n,o),s=Math.floor(Math.random()*c).toString(n);a=s+a}var u=parseInt(a,n);return u!==1/0&&u>=Math.pow(2,t)?e(t,n):a};return e.rack=function(t,n,i){var r=function(a){var s=0;do{if(s++>10)if(i)t+=i;else throw new Error("too many ID collisions, use more bits");var c=e(t,n)}while(Object.hasOwnProperty.call(o,c));return o[c]=a,c},o=r.hats={};return r.get=function(a){return r.hats[a]},r.set=function(a,s){return r.hats[a]=s,r},r.bits=t||128,r.base=n||16,r},ul.exports}var m1=h1(),g1=d1(m1);function fi(e){if(!(this instanceof fi))return new fi(e);e=e||[128,36,1],this._seed=e.length?g1.rack(e[0],e[1],e[2]):e}fi.prototype.next=function(e){return this._seed(e||!0)},fi.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},fi.prototype.claim=function(e,t){this._seed.set(e,t||!0)},fi.prototype.assigned=function(e){return this._seed.get(e)||!1},fi.prototype.unclaim=function(e){delete this._seed.hats[e]},fi.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const Ht={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};Ht.td=Ht.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],Ht.option=Ht.optgroup=[1,'<select multiple="multiple">',"</select>"],Ht.thead=Ht.tbody=Ht.colgroup=Ht.caption=Ht.tfoot=[1,"<table>","</table>"],Ht.polyline=Ht.ellipse=Ht.polygon=Ht.circle=Ht.text=Ht.line=Ht.path=Ht.rect=Ht.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function mt(e,t=globalThis.document){var u;if(typeof e!="string")throw new TypeError("String expected");const n=/^<!--(.*?)-->$/s.exec(e);if(n)return t.createComment(n[1]);const i=(u=/<([\w:]+)/.exec(e))==null?void 0:u[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const l=t.createElement("html");l.innerHTML=e;const{lastChild:f}=l;return f.remove(),f}let[r,o,a]=Object.hasOwn(Ht,i)?Ht[i]:Ht._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 y1(e,t){return t.forEach(function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach(function(i){if(i!=="default"&&!(i in e)){var r=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return n[i]}})}})}),Object.freeze(e)}function mn(e,...t){const n=e.style;return I(t,function(i){i&&I(i,function(r,o){n[o]=r})}),e}function un(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const v1=Object.prototype.toString;function _t(e){return new Xi(e)}function Xi(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Xi.prototype.add=function(e){return this.list.add(e),this},Xi.prototype.remove=function(e){return v1.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Xi.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},Xi.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Xi.prototype.array=function(){return Array.from(this.list)},Xi.prototype.has=Xi.prototype.contains=function(e){return this.list.contains(e)};function xs(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Mr(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function b1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ws={},Nh;function _1(){if(Nh)return ws;Nh=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return ws.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},ws.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},ws}var $h=_1(),x1=b1($h),Ne=y1({__proto__:null,default:x1},[$h]),Fh=["focus","blur"];function w1(e,t,n,i,r){return Fh.indexOf(n)!==-1&&(r=!0),Ne.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=Mr(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function E1(e,t,n,i){return Fh.indexOf(t)!==-1&&(i=!0),Ne.unbind(e,t,n,i)}var Pn={bind:w1,unbind:E1};function ll(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function ot(e,t){return t=t||document,t.querySelector(e)}function Es(e,t){return t=t||document,t.querySelectorAll(e)}function di(e){e.parentNode&&e.parentNode.removeChild(e)}function S1(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function R1(e,t){return t.appendChild(S1(e,t))}function Fe(e,t){return R1(t,e),e}var pl=2,jh={"alignment-baseline":1,"baseline-shift":1,clip:1,"clip-path":1,"clip-rule":1,color:1,"color-interpolation":1,"color-interpolation-filters":1,"color-profile":1,"color-rendering":1,cursor:1,direction:1,display:1,"dominant-baseline":1,"enable-background":1,fill:1,"fill-opacity":1,"fill-rule":1,filter:1,"flood-color":1,"flood-opacity":1,font:1,"font-family":1,"font-size":pl,"font-size-adjust":1,"font-stretch":1,"font-style":1,"font-variant":1,"font-weight":1,"glyph-orientation-horizontal":1,"glyph-orientation-vertical":1,"image-rendering":1,kerning:1,"letter-spacing":1,"lighting-color":1,marker:1,"marker-end":1,"marker-mid":1,"marker-start":1,mask:1,opacity:1,overflow:1,"pointer-events":1,"shape-rendering":1,"stop-color":1,"stop-opacity":1,stroke:1,"stroke-dasharray":1,"stroke-dashoffset":1,"stroke-linecap":1,"stroke-linejoin":1,"stroke-miterlimit":1,"stroke-opacity":1,"stroke-width":pl,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function C1(e,t){return jh[t]?e.style[t]:e.getAttributeNS(null,t)}function Hh(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=jh[i];r?(r===pl&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function P1(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)Hh(e,r,t[r])}function ve(e,t,n){if(typeof t=="string")if(n!==void 0)Hh(e,t,n);else return C1(e,t);else P1(e,t);return e}const A1=Object.prototype.toString;function Xe(e){return new Zi(e)}function Zi(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Zi.prototype.add=function(e){return this.list.add(e),this},Zi.prototype.remove=function(e){return A1.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Zi.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},Zi.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Zi.prototype.array=function(){return Array.from(this.list)},Zi.prototype.has=Zi.prototype.contains=function(e){return this.list.contains(e)};function Ss(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function zh(e){return e.cloneNode(!0)}var fl={svg:"http://www.w3.org/2000/svg"},Gh='<svg xmlns="'+fl.svg+'"';function T1(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(fl.svg)===-1&&(e=Gh+e.substring(4)):(e=Gh+">"+e+"</svg>",t=!0);var n=M1(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function M1(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function Ce(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=T1(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(fl.svg,e),t&&ve(n,t),n}var dl=null;function Vh(){return dl===null&&(dl=Ce("svg")),dl}function Wh(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function k1(e,t,n,i,r,o){var a=Vh().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return Wh(a,e);case 6:return Wh(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function Xo(e){return Vh().createSVGTransform()}var Uh=/([&<>]{1})/g,O1=/([&<>\n\r"]{1})/g,D1={"&":"&","<":"<",">":">",'"':"'"};function hl(e,t){function n(i,r){return D1[r]||r}return e.replace(t,n)}function qh(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(hl(e.textContent,Uh));break;case 1:if(t.push("<",e.tagName),e.hasAttributes())for(r=e.attributes,n=0,i=r.length;n<i;++n)o=r.item(n),t.push(" ",o.name,'="',hl(o.value,O1),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)qh(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",hl(e.nodeValue,Uh),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function L1(e){for(var t=e.firstChild,n=[];t;)qh(t,n),t=t.nextSibling;return n.join("")}function Yh(e,t){return L1(e)}function zt(e){var t=e.parentNode;return t&&t.removeChild(e),e}function I1(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function B1(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(I1(e,i))}function Zo(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),B1(n,t)),n.consolidate()}const N1=/^class[ {]/;function $1(e){return N1.test(e.toString())}function ml(e){return Array.isArray(e)}function gl(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Rs(...e){e.length===1&&ml(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const F1=/constructor\s*[^(]*\(\s*([^)]*)\)/m,j1=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,H1=/\/\*([^*]*)\*\//m;function z1(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match($1(e)?F1:j1);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(H1);return(r&&r[1]||i).trim()})||[]}function Kh(e,t){const n=t||{get:function(x,S){if(i.push(x),S===!1)return null;throw s(`No provider for "${x}"!`)}},i=[],r=this._providers=Object.create(n._providers||null),o=this._instances=Object.create(null),a=o.injector=this,s=function(x){const S=i.join(" -> ");return i.length=0,new Error(S?`${x} (Resolving: ${S})`:x)};function c(x,S){if(!r[x]&&x.includes(".")){const P=x.split(".");let C=c(P.shift());for(;P.length;)C=C[P.shift()];return C}if(gl(o,x))return o[x];if(gl(r,x)){if(i.indexOf(x)!==-1)throw i.push(x),s("Cannot resolve circular dependency!");return i.push(x),o[x]=r[x][0](r[x][1]),i.pop(),o[x]}return n.get(x,S)}function u(x,S){if(typeof S>"u"&&(S={}),typeof x!="function")if(ml(x))x=Rs(x.slice());else throw s(`Cannot invoke "${x}". Expected a function!`);const C=(x.$inject||z1(x)).map(D=>gl(S,D)?S[D]:c(D));return{fn:x,dependencies:C}}function l(x){const{fn:S,dependencies:P}=u(x),C=Function.prototype.bind.call(S,null,...P);return new C}function f(x,S,P){const{fn:C,dependencies:D}=u(x,P);return C.apply(S,D)}function p(x){return Rs(S=>x.get(S))}function d(x,S){if(S&&S.length){const P=Object.create(null),C=Object.create(null),D=[],T=[],$=[];let k,O,j,se;for(let we in r)k=r[we],S.indexOf(we)!==-1&&(k[2]==="private"?(O=D.indexOf(k[3]),O===-1?(j=k[3].createChild([],S),se=p(j),D.push(k[3]),T.push(j),$.push(se),P[we]=[se,we,"private",j]):P[we]=[$[O],we,"private",T[O]]):P[we]=[k[2],k[1]],C[we]=!0),(k[2]==="factory"||k[2]==="type")&&k[1].$scope&&S.forEach(Ke=>{k[1].$scope.indexOf(Ke)!==-1&&(P[we]=[k[2],k[1]],C[Ke]=!0)});S.forEach(we=>{if(!C[we])throw new Error('No provider for "'+we+'". Cannot use provider from the parent!')}),x.unshift(P)}return new Kh(x,a)}const g={factory:f,type:l,value:function(x){return x}};function h(x,S){const P=x.__init__||[];return function(){P.forEach(C=>{typeof C=="string"?S.get(C):S.invoke(C)})}}function m(x){const S=x.__exports__;if(S){const P=x.__modules__,C=Object.keys(x).reduce((O,j)=>(j!=="__exports__"&&j!=="__modules__"&&j!=="__init__"&&j!=="__depends__"&&(O[j]=x[j]),O),Object.create(null)),D=(P||[]).concat(C),T=d(D),$=Rs(function(O){return T.get(O)});S.forEach(function(O){r[O]=[$,O,"private",T]});const k=(x.__init__||[]).slice();return k.unshift(function(){T.init()}),x=Object.assign({},x,{__init__:k}),h(x,T)}return Object.keys(x).forEach(function(P){if(P==="__init__"||P==="__depends__")return;const C=x[P];if(C[2]==="private"){r[P]=C;return}const D=C[0],T=C[1];r[P]=[g[D],G1(D,T),D]}),h(x,a)}function _(x,S){return x.indexOf(S)!==-1||(x=(S.__depends__||[]).reduce(_,x),x.indexOf(S)!==-1)?x:x.concat(S)}function y(x){const S=x.reduce(_,[]).map(m);let P=!1;return function(){P||(P=!0,S.forEach(C=>C()))}}this.get=c,this.invoke=f,this.instantiate=l,this.createChild=d,this.init=y(e)}function G1(e,t){return e!=="value"&&ml(t)&&(t=Rs(t.slice())),t}var V1=1e3;function Ti(e,t){var n=this;t=t||V1,e.on(["render.shape","render.connection"],t,function(i,r){var o=i.type,a=r.element,s=r.gfx,c=r.attrs;if(n.canRender(a))return o==="render.shape"?n.drawShape(s,a,c):n.drawConnection(s,a,c)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(i,r){if(n.canRender(r))return i.type==="render.getShapePath"?n.getShapePath(r):n.getConnectionPath(r)})}Ti.prototype.canRender=function(e){},Ti.prototype.drawShape=function(e,t){},Ti.prototype.drawConnection=function(e,t){},Ti.prototype.getShapePath=function(e){},Ti.prototype.getConnectionPath=function(e){};function kr(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function W1(e){return["M",e.x,e.y]}function yl(e){return["L",e.x,e.y]}function U1(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function q1(e,t){const n=e.length,i=[W1(e[0])];for(let r=1;r<n;r++){const o=e[r-1],a=e[r],s=e[r+1];if(!s||!t){i.push(yl(a));continue}const c=Math.min(t,vl(a.x-o.x,a.y-o.y),vl(s.x-a.x,s.y-a.y));if(!c){i.push(yl(a));continue}const u=Cs(a,o,c),l=Cs(a,o,c*.5),f=Cs(a,s,c),p=Cs(a,s,c*.5);i.push(yl(u)),i.push(U1(l,p,f))}return i}function Cs(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=vl(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function vl(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Qo(e,t,n){Ie(t)&&(n=t,t=null),t||(t={});const i=Ce("path",t);return Ie(n)&&(i.dataset.cornerRadius=String(n)),bl(i,e)}function bl(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return ve(e,{d:kr(q1(t,n))}),e}function Ps(e){var t=new Set(e);return Ue(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function Or(e,t,n){n=n||0,ke(e)||(e=[e]),I(e,function(i,r){var o=t(i,r,n);ke(o)&&o.length&&Or(o,t,n+1)})}function _l(e,t,n){var i=new Set,r=new Set;return Or(e,function(o,a,s){i.add(o);var c=o.children;if(c&&!r.has(c))return r.add(c),c}),Array.from(i)}function Jo(e,t){return _l(e)}function Y1(e,t,n){Rr(t)&&(t=!0),Ut(t)&&(n=t,t=!0),n=n||{};var i=ea(n.allShapes),r=ea(n.allConnections),o=ea(n.enclosedElements),a=ea(n.enclosedConnections),s=ea(n.topLevel,t&&Jr(e,function(l){return l.id}));function c(l){s[l.source.id]&&s[l.target.id]&&(s[l.id]=[l]),i[l.source.id]&&i[l.target.id]&&(a[l.id]=o[l.id]=l),r[l.id]=l}function u(l){if(o[l.id]=l,l.waypoints)a[l.id]=r[l.id]=l;else return i[l.id]=l,I(l.incoming,c),I(l.outgoing,c),l.children}return Or(e,u),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function kt(e,t){t=!!t,ke(e)||(e=[e]);var n,i,r,o;return I(e,function(a){var s=a;a.waypoints&&!t&&(s=kt(a.waypoints,!0));var c=s.x,u=s.y,l=s.height||0,f=s.width||0;(c<n||n===void 0)&&(n=c),(u<i||i===void 0)&&(i=u),(c+f>r||r===void 0)&&(r=c+f),(u+l>o||o===void 0)&&(o=u+l)}),{x:n,y:i,height:o-i,width:r-n}}function uo(e,t){var n={};return I(e,function(i){var r=i;r.waypoints&&(r=kt(r)),!Ie(t.y)&&r.x>t.x&&(n[i.id]=i),!Ie(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(Ie(t.width)&&Ie(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!Ie(t.width)||!Ie(t.height))&&(n[i.id]=i)}),n}function Xh(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function Zh(e){return!!(e&&e.isFrame)}function ea(e,t){return z({},e||{},t||{})}var K1=1;function Qi(e,t){Ti.call(this,e,K1),this.CONNECTION_STYLE=t.style(["no-fill"],{strokeWidth:5,stroke:"fuchsia"}),this.SHAPE_STYLE=t.style({fill:"white",stroke:"fuchsia",strokeWidth:2}),this.FRAME_STYLE=t.style(["no-fill"],{stroke:"fuchsia",strokeDasharray:4,strokeWidth:2})}ye(Qi,Ti),Qi.prototype.canRender=function(){return!0},Qi.prototype.drawShape=function(t,n,i){var r=Ce("rect");return ve(r,{x:0,y:0,width:n.width||0,height:n.height||0}),Zh(n)?ve(r,z({},this.FRAME_STYLE,i||{})):ve(r,z({},this.SHAPE_STYLE,i||{})),Fe(t,r),r},Qi.prototype.drawConnection=function(t,n,i){var r=Qo(n.waypoints,z({},this.CONNECTION_STYLE,i||{}));return Fe(t,r),r},Qi.prototype.getShapePath=function(t){var n=t.x,i=t.y,r=t.width,o=t.height,a=[["M",n,i],["l",r,0],["l",0,o],["l",-r,0],["z"]];return kr(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 kr(o)},Qi.$inject=["eventBus","styles"];function X1(){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 z(o,{class:n})},this.style=function(n,i){!ke(n)&&!i&&(i=n,n=[]);var r=Rn(n,function(o,a){return z(o,e[a]||{})},{});return i?z(r,i):r},this.computeStyle=function(n,i,r){return ke(i)||(r=i,i=[]),t.style(i||[],z({},r,n||{}))}}const Z1={__init__:["defaultRenderer"],defaultRenderer:["type",Qi],styles:["type",X1]};function Ct(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function At(e,t,n){if(!(!e||!t)){typeof n!="number"&&(n=-1);var i=e.indexOf(t);if(i!==-1){if(i===n)return;if(n!==-1)e.splice(i,1);else return}n!==-1?e.splice(n,0,t):e.push(t)}}function xl(e,t){return!e||!t?-1:e.indexOf(t)}function ta(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function wl(e,t,n,i){if(typeof i>"u"&&(i=5),!e||!t||!n)return!1;var r=(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),o=ta(e,t);return Math.abs(r/o)<=i}var Q1=2;function Mi(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(J1(r,n))return o;return!1}function J1(e,t){const n=t[0];return Cr(t,function(i){return Math.abs(n[e]-i[e])<=Q1})}function Qh(e,t,n){return n=n||0,e.x>t.x-n&&e.y>t.y-n&&e.x<t.x+t.width+n&&e.y<t.y+t.height+n}function El(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var eS=/,?([a-z]),?/gi,Jh=parseFloat,Ot=Math,Ji=Ot.PI,hi=Ot.min,mi=Ot.max,em=Ot.pow,er=Ot.abs,tS=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,nS=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,tm=Array.isArray||function(e){return e instanceof Array};function iS(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function rS(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 oS(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 iS(r,i)?(rS(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function aS(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(tS,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(nS,function(c,u){u&&a.push(+u)}),s=="m"&&a.length>2&&(n.push([r,...a.splice(0,2)]),s="l",r=r=="m"?"l":"L");a.length>=t[s]&&(n.push([r,...a.splice(0,t[s])]),!!t[s]););}),n.toString=Rl,n}function sS(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 cS(e){for(var t=0,n=e.length;t<n;t++){var i=e[t][0];if(i!=="M"&&i!=="C")return!1}return!0}function Sl(e,t,n,i){return arguments.length===1&&(t=e.y,n=e.width,i=e.height,e=e.x),{x:e,y:t,width:n,height:i,x2:e+n,y2:t+i}}function Rl(){return this.join(",").replace(eS,"$1")}function uS(e){for(var t=new Array(e.length),n=0,i=e.length;n<i;n++)for(var r=e[n],o=t[n]=new Array(r.length),a=0,s=r.length;a<s;a++)o[a]=r[a];return t.toString=Rl,t}function nm(e,t,n,i,r,o,a,s,c){var u=1-c,l=em(u,3),f=em(u,2),p=c*c,d=p*c,g=l*e+f*3*c*n+u*3*c*c*r+d*a,h=l*t+f*3*c*i+u*3*c*c*o+d*s;return{x:As(g),y:As(h)}}function im(e){var t=mS(...e);return Sl(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function tr(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function lS(e,t){return e=Sl(e),t=Sl(t),tr(t,e.x,e.y)||tr(t,e.x2,e.y)||tr(t,e.x,e.y2)||tr(t,e.x2,e.y2)||tr(e,t.x,t.y)||tr(e,t.x2,t.y)||tr(e,t.x,t.y2)||tr(e,t.x2,t.y2)||(e.x<t.x2&&e.x>t.x||t.x<e.x2&&t.x>e.x)&&(e.y<t.y2&&e.y>t.y||t.y<e.y2&&t.y>e.y)}function rm(e,t,n,i,r){var o=-3*t+9*n-9*i+3*r,a=e*o+6*t-12*n+6*i;return e*a-3*t+3*n}function om(e,t,n,i,r,o,a,s,c){c==null&&(c=1),c=c>1?1:c<0?0:c;for(var u=c/2,l=12,f=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],p=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,g=0;g<l;g++){var h=u*f[g]+u,m=rm(h,e,n,r,a),_=rm(h,t,i,o,s),y=m*m+_*_;d+=p[g]*Ot.sqrt(y)}return u*d}function pS(e,t,n,i,r,o,a,s){if(!(mi(e,n)<hi(r,a)||hi(e,n)>mi(r,a)||mi(t,i)<hi(o,s)||hi(t,i)>mi(o,s))){var c=(e*i-t*n)*(r-a)-(e-n)*(r*s-o*a),u=(e*i-t*n)*(o-s)-(t-i)*(r*s-o*a),l=(e-n)*(o-s)-(t-i)*(r-a);if(l){var f=As(c/l),p=As(u/l),d=+f.toFixed(2),g=+p.toFixed(2);if(!(d<+hi(e,n).toFixed(2)||d>+mi(e,n).toFixed(2)||d<+hi(r,a).toFixed(2)||d>+mi(r,a).toFixed(2)||g<+hi(t,i).toFixed(2)||g>+mi(t,i).toFixed(2)||g<+hi(o,s).toFixed(2)||g>+mi(o,s).toFixed(2)))return{x:f,y:p}}}}function As(e){return Math.round(e*1e11)/1e11}function fS(e,t,n){var i=im(e),r=im(t);if(!lS(i,r))return[];var o=om(...e),a=om(...t),s=sm(e)?1:~~(o/5)||1,c=sm(t)?1:~~(a/5)||1,u=new Array(s+1),l=new Array(c+1),f={},p=[],d,g;for(d=0;d<s+1;d++){var h=nm(...e,d/s);u[d]={x:h.x,y:h.y,t:d/s}}for(d=0;d<c+1;d++)h=nm(...t,d/c),l[d]={x:h.x,y:h.y,t:d/c};for(d=0;d<s;d++)for(g=0;g<c;g++){var m=u[d],_=u[d+1],y=l[g],x=l[g+1],S=er(_.x-m.x)<.01?"y":"x",P=er(x.x-y.x)<.01?"y":"x",C=pS(m.x,m.y,_.x,_.y,y.x,y.y,x.x,x.y),D;if(C){if(D=C.x.toFixed(9)+"#"+C.y.toFixed(9),f[D])continue;f[D]=!0;var T=m.t+er((C[S]-m[S])/(_[S]-m[S]))*(_.t-m.t),$=y.t+er((C[P]-y[P])/(x[P]-y[P]))*(x.t-y.t);T>=0&&T<=1&&$>=0&&$<=1&&p.push({x:C.x,y:C.y,t1:T,t2:$})}}return p}function am(e,t,n){e=lm(e),t=lm(t);for(var i,r,o,a,s,c,u,l,f,p,d=n?0:[],g=0,h=e.length;g<h;g++){var m=e[g];if(m[0]=="M")i=s=m[1],r=c=m[2];else{m[0]=="C"?(f=[i,r,...m.slice(1)],i=f[6],r=f[7]):(f=[i,r,i,r,s,c,s,c],i=s,r=c);for(var _=0,y=t.length;_<y;_++){var x=t[_];if(x[0]=="M")o=u=x[1],a=l=x[2];else{x[0]=="C"?(p=[o,a,...x.slice(1)],o=p[6],a=p[7]):(p=[o,a,o,a,u,l,u,l],o=u,a=l);var S=fS(f,p);{for(var P=0,C=S.length;P<C;P++)S[P].segment1=g,S[P].segment2=_,S[P].bez1=f,S[P].bez2=p;d=d.concat(S)}}}}}return d}function dS(e){return tm(e)&&tm(e[0])}function hS(e){if(sS(e))return e;var t=new Array(e.length),n=0,i=0,r=0,o=0,a=0,s;e[0][0]=="M"&&(n=+e[0][1],i=+e[0][2],r=n,o=i,a++,t[0]=["M",n,i]);for(var c,u,l=a,f=e.length;l<f;l++){if(u=e[l],s=u[0],t[l]=c=new Array(u.length),s!=s.toUpperCase())switch(c[0]=s.toUpperCase(),c[0]){case"A":c[1]=u[1],c[2]=u[2],c[3]=u[3],c[4]=u[4],c[5]=u[5],c[6]=+u[6]+n,c[7]=+u[7]+i;break;case"V":c[1]=+u[1]+i;break;case"H":c[1]=+u[1]+n;break;case"M":r=+u[1]+n,o=+u[2]+i;default:for(var p=1,d=u.length;p<d;p++)c[p]=+u[p]+(p%2?n:i)}else for(var g=0,h=u.length;g<h;g++)c[g]=u[g];switch(s=s.toUpperCase(),c[0]){case"Z":n=+r,i=+o;break;case"H":n=c[1];break;case"V":i=c[1];break;case"M":r=c[c.length-2],o=c[c.length-1];default:n=c[c.length-2],i=c[c.length-1]}}return t.toString=Rl,t}function sm(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Ts(e,t,n,i){return[e,t,n,i,n,i]}function cm(e,t,n,i,r,o){var a=.3333333333333333,s=2/3;return[a*e+s*n,a*t+s*i,a*r+s*n,a*o+s*i,r,o]}function um(e,t,n,i,r,o,a,s,c,u){var l=Ji*120/180,f=Ji/180*(+r||0),p=[],d,g=oS(function(M,E,b){var F=M*Ot.cos(b)-E*Ot.sin(b),W=M*Ot.sin(b)+E*Ot.cos(b);return{x:F,y:W}});if(u)D=u[0],T=u[1],P=u[2],C=u[3];else{d=g(e,t,-f),e=d.x,t=d.y,d=g(s,c,-f),s=d.x,c=d.y;var h=(e-s)/2,m=(t-c)/2,_=h*h/(n*n)+m*m/(i*i);_>1&&(_=Ot.sqrt(_),n=_*n,i=_*i);var y=n*n,x=i*i,S=(o==a?-1:1)*Ot.sqrt(er((y*x-y*m*m-x*h*h)/(y*m*m+x*h*h))),P=S*n*m/i+(e+s)/2,C=S*-i*h/n+(t+c)/2,D=Ot.asin(((t-C)/i).toFixed(9)),T=Ot.asin(((c-C)/i).toFixed(9));D=e<P?Ji-D:D,T=s<P?Ji-T:T,D<0&&(D=Ji*2+D),T<0&&(T=Ji*2+T),a&&D>T&&(D=D-Ji*2),!a&&T>D&&(T=T-Ji*2)}var $=T-D;if(er($)>l){var k=T,O=s,j=c;T=D+l*(a&&T>D?1:-1),s=P+n*Ot.cos(T),c=C+i*Ot.sin(T),p=um(s,c,n,i,r,0,a,O,j,[T,k,P,C])}$=T-D;var se=Ot.cos(D),we=Ot.sin(D),Ke=Ot.cos(T),Y=Ot.sin(T),ue=Ot.tan($/4),_e=4/3*n*ue,le=4/3*i*ue,xe=[e,t],ce=[e+_e*we,t-le*se],U=[s+_e*Y,c-le*Ke],q=[s,c];if(ce[0]=2*xe[0]-ce[0],ce[1]=2*xe[1]-ce[1],u)return[ce,U,q].concat(p);p=[ce,U,q].concat(p).join().split(",");for(var K=[],Ge=0,Xt=p.length;Ge<Xt;Ge++)K[Ge]=Ge%2?g(p[Ge-1],p[Ge],f).y:g(p[Ge],p[Ge+1],f).x;return K}function mS(e,t,n,i,r,o,a,s){for(var c=[],u=[[],[]],l,f,p,d,g,h,m,_,y=0;y<2;++y){if(y==0?(f=6*e-12*n+6*r,l=-3*e+9*n-9*r+3*a,p=3*n-3*e):(f=6*t-12*i+6*o,l=-3*t+9*i-9*o+3*s,p=3*i-3*t),er(l)<1e-12){if(er(f)<1e-12)continue;d=-p/f,0<d&&d<1&&c.push(d);continue}m=f*f-4*p*l,_=Ot.sqrt(m),!(m<0)&&(g=(-f+_)/(2*l),0<g&&g<1&&c.push(g),h=(-f-_)/(2*l),0<h&&h<1&&c.push(h))}for(var x=c.length,S=x,P;x--;)d=c[x],P=1-d,u[0][x]=P*P*P*e+3*P*P*d*n+3*P*d*d*r+d*d*d*a,u[1][x]=P*P*P*t+3*P*P*d*i+3*P*d*d*o+d*d*d*s;return u[0][S]=e,u[1][S]=t,u[0][S+1]=a,u[1][S+1]=s,u[0].length=u[1].length=S+2,{x0:hi(...u[0]),y0:hi(...u[1]),x1:mi(...u[0]),y1:mi(...u[1])}}function lm(e){if(dS(e)||(e=aS(e)),cS(e))return e;for(var t=uS(hS(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(p,d,g){var h,m;if(!p)return["C",d.x,d.y,d.x,d.y,d.x,d.y];switch(!(p[0]in{T:1,Q:1})&&(d.qx=d.qy=null),p[0]){case"M":d.X=p[1],d.Y=p[2];break;case"A":p=["C",...um(d.x,d.y,...p.slice(1))];break;case"S":g=="C"||g=="S"?(h=d.x*2-d.bx,m=d.y*2-d.by):(h=d.x,m=d.y),p=["C",h,m,...p.slice(1)];break;case"T":g=="Q"||g=="T"?(d.qx=d.x*2-d.qx,d.qy=d.y*2-d.qy):(d.qx=d.x,d.qy=d.y),p=["C",...cm(d.x,d.y,d.qx,d.qy,p[1],p[2])];break;case"Q":d.qx=p[1],d.qy=p[2],p=["C",...cm(d.x,d.y,p[1],p[2],p[3],p[4])];break;case"L":p=["C",...Ts(d.x,d.y,p[1],p[2])];break;case"H":p=["C",...Ts(d.x,d.y,p[1],d.y)];break;case"V":p=["C",...Ts(d.x,d.y,d.x,p[1])];break;case"Z":p=["C",...Ts(d.x,d.y,d.X,d.Y)];break}return p},r=function(p,d){if(p[d].length>7){p[d].shift();for(var g=p[d];g.length;)o[d]="A",p.splice(d++,0,["C",...g.splice(0,6)]);p.splice(d,1),u=t.length}},o=[],a="",s="",c=0,u=t.length;c<u;c++){t[c]&&(a=t[c][0]),a!="C"&&(o[c]=a,c&&(s=o[c-1])),t[c]=i(t[c],n,s),o[c]!="A"&&a=="C"&&(o[c]="C"),r(t,c);var l=t[c],f=l.length;n.x=l[f-2],n.y=l[f-1],n.bx=Jh(l[f-4])||n.x,n.by=Jh(l[f-3])||n.y}return t}function at(e){return Ut(e)&&Sn(e,"waypoints")}function ze(e){return Ut(e)&&Sn(e,"labelTarget")}function gS(e){return Ut(e)&&Zr(e.parent)}function pm(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function ki(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Te(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Ms(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function yS(e){return ki({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function vS(e){for(var t=e.waypoints,n=t.reduce(function(u,l,f){var p=t[f-1];if(p){var d=u[u.length-1],g=d&&d.endLength||0,h=xS(p,l);u.push({start:p,end:l,startLength:g,endLength:g+h,length:h})}return u},[]),i=n.reduce(function(u,l){return u+l.length},0),r=i/2,o=0,a=n[o];a.endLength<r;)a=n[++o];var s=(r-a.startLength)/a.length,c={x:a.start.x+(a.end.x-a.start.x)*s,y:a.start.y+(a.end.y-a.start.y)*s};return c}function Oe(e){return at(e)?vS(e):yS(e)}function tn(e,t,n){n=n||0,Ut(n)||(n={x:n,y:n});var i=Te(e),r=Te(t),o=i.bottom+n.y<=r.top,a=i.left-n.x>=r.right,s=i.top-n.y>=r.bottom,c=i.right+n.x<=r.left,u=o?"top":s?"bottom":null,l=c?"left":a?"right":null;return l&&u?u+"-"+l:l||u||"intersect"}function na(e,t,n){var i=bS(e,t);return i.length===1||i.length===2&&ta(i[0],i[1])<1?ki(i[0]):i.length>1?(i=ci(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),ki(i[n?0:i.length-1])):null}function bS(e,t){return am(e,t)}function _S(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],ta(n,r)===0||wl(i,r,n)?e.splice(t,1):t++;return e}function xS(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function ks(e,t){return Math.round(e*t)/t}function fm(e){return Ie(e)?e+"px":e}function wS(e){for(;e.parent;)e=e.parent;return e}function ES(e){e=z({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),mn(n,{position:"relative",overflow:"hidden",width:fm(e.width),height:fm(e.height)}),t.appendChild(n),n}function dm(e,t,n){const i=Ce("g");Xe(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const SS="base",hm=0,RS=1,CS={shape:["x","y","width","height"],connection:["waypoints"]};function De(e,t,n,i){this._eventBus=t,this._elementRegistry=i,this._graphicsFactory=n,this._rootsIdx=0,this._layers={},this._planes=[],this._rootElement=null,this._focused=!1,this._init(e||{})}De.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],De.prototype._init=function(e){const t=this._eventBus,n=this._container=ES(e),i=this._svg=Ce("svg");ve(i,{width:"100%",height:"100%"}),un(i,"tabindex",0),e.autoFocus&&t.on("element.hover",()=>{this.restoreFocus()}),t.on("element.mousedown",500,o=>{this.focus()}),i.addEventListener("focusin",()=>{this._setFocused(!0)}),i.addEventListener("focusout",()=>{this._setFocused(!1)}),i.addEventListener("mouseover",()=>{this._eventBus.fire("canvas.mouseover")}),i.addEventListener("mouseout",()=>{this._eventBus.fire("canvas.mouseout")}),Fe(n,i);const r=this._viewport=dm(i,"viewport");e.deferUpdate&&(this._viewboxChanged=Lu(this._viewboxChanged,300)),this._restoreFocus=Lu(this._restoreFocus,0),t.on("diagram.init",()=>{t.fire("canvas.init",{svg:i,viewport:r})}),t.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed","root.set"],()=>{delete this._cachedViewbox}),t.on("diagram.destroy",500,this._destroy,this),t.on("diagram.clear",500,this._clear,this)},De.prototype._destroy=function(){this._restoreFocus.cancel(),this._eventBus.fire("canvas.destroy",{svg:this._svg,viewport:this._viewport});const e=this._container.parentNode;e&&e.removeChild(this._container),delete this._svg,delete this._container,delete this._layers,delete this._planes,delete this._rootElement,delete this._viewport},De.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},De.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=Xh(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},De.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},De.prototype.restoreFocus=function(){this._restoreFocus()},De.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},De.prototype.isFocused=function(){return this._focused},De.prototype.getDefaultLayer=function(){return this.getLayer(SS,hm)},De.prototype.getLayer=function(e,t){if(!e)throw new Error("must specify a name");let n=this._layers[e];if(n||(n=this._layers[e]=this._createLayer(e,t)),typeof t<"u"&&n.index!==t)throw new Error("layer <"+e+"> already created at index <"+t+">");return n.group},De.prototype._getChildIndex=function(e){return Rn(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},De.prototype._createLayer=function(e,t){typeof t>"u"&&(t=RS);const n=this._getChildIndex(t);return{group:dm(this._viewport,"layer-"+e,n),index:t,visible:!0}},De.prototype.showLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=this._viewport,i=t.group,r=t.index;if(t.visible)return i;const o=this._getChildIndex(r);return n.insertBefore(i,n.childNodes[o]||null),t.visible=!0,i},De.prototype.hideLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=t.group;return t.visible&&(zt(n),t.visible=!1),n},De.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],zt(t.group))},De.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},De.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(wS(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},De.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},De.prototype._findPlaneForRoot=function(e){return lt(this._planes,function(t){return t.rootElement===e})},De.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},De.prototype._resolveElements=function(e){return ke(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},De.prototype.getContainer=function(){return this._container},De.prototype._updateMarker=function(e,t,n){let i;e=this._resolveElement(e),e.markers=e.markers||new Set,i=this._elementRegistry._elements[e.id],i&&(I([i.gfx,i.secondaryGfx],function(r){r&&(n?(e.markers.add(t),Xe(r).add(t)):(e.markers.delete(t),Xe(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},De.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},De.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},De.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},De.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},De.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},De.prototype.addRootElement=function(e){const t=this._rootsIdx++;e||(e={id:"__implicitroot_"+t,children:[],isImplicit:!0});const n=e.layer="root-"+t;this._ensureValid("root",e);const i=this.getLayer(n,hm);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},De.prototype.removeRootElement=function(e){if(e=this._resolveElement(e),!!this._findPlaneForRoot(e))return this._removeRoot(e),this._removeLayer(e.layer),this._planes=this._planes.filter(function(n){return n.rootElement!==e}),this._rootElement===e&&(this._rootElement=null),e},De.prototype.setRootElement=function(e){if(e===this._rootElement)return e;let t;if(!e)throw new Error("rootElement required");return t=this._findPlaneForRoot(e),t||(e=this.addRootElement(e)),this._setRoot(e),e},De.prototype._removeRoot=function(e){const t=this._elementRegistry,n=this._eventBus;n.fire("root.remove",{element:e}),n.fire("root.removed",{element:e}),t.remove(e)},De.prototype._addRoot=function(e,t){const n=this._elementRegistry,i=this._eventBus;i.fire("root.add",{element:e}),n.add(e,t),i.fire("root.added",{element:e,gfx:t})},De.prototype._setRoot=function(e,t){const n=this._rootElement;n&&(this._elementRegistry.updateGraphics(n,null,!0),this.hideLayer(n.layer)),e&&(t||(t=this._findPlaneForRoot(e).layer),this._elementRegistry.updateGraphics(e,this._svg,!0),this.showLayer(e.layer)),this._rootElement=e,this._eventBus.fire("root.set",{element:e})},De.prototype._ensureValid=function(e,t){if(!t.id)throw new Error("element must have an id");if(this._elementRegistry.get(t.id))throw new Error("element <"+t.id+"> already exists");const n=CS[e];if(!Cr(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},De.prototype._setParent=function(e,t,n){At(t.children,e,n),e.parent=t},De.prototype._addElement=function(e,t,n,i){n=n||this.getRootElement();const r=this._eventBus,o=this._graphicsFactory;this._ensureValid(e,t),r.fire(e+".add",{element:t,parent:n}),this._setParent(t,n,i);const a=o.create(e,t,i);return this._elementRegistry.add(t,a),o.update(e,t,a),r.fire(e+".added",{element:t,gfx:a}),t},De.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},De.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},De.prototype._removeElement=function(e,t){const n=this._elementRegistry,i=this._graphicsFactory,r=this._eventBus;if(e=n.get(e.id||e),!!e)return r.fire(t+".remove",{element:e}),i.remove(e),Ct(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},De.prototype.removeShape=function(e){return this._removeElement(e,"shape")},De.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},De.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},De.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},De.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},De.prototype.viewbox=function(e){if(e===void 0&&this._cachedViewbox)return structuredClone(this._cachedViewbox);const t=this._viewport,n=this.getSize();let i,r,o,a,s,c,u;if(e)this._changeViewbox(function(){s=Math.min(n.width/e.width,n.height/e.height);const l=this._svg.createSVGMatrix().scale(s).translate(-e.x,-e.y);Zo(t,l)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=Zo(t),r=a?a.matrix:k1(),s=ks(r.a,1e3),c=ks(-r.e||0,1e3),u=ks(-r.f||0,1e3),e=this._cachedViewbox={x:c?c/s:0,y:u?u/s:0,width:n.width/s,height:n.height/s,scale:s,inner:{width:i.width||0,height:i.height||0,x:i.x||0,y:i.y||0},outer:n},e;return e},De.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=z({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),mm(t,n)}),{x:n.e,y:n.f}},De.prototype.scrollToElement=function(e,t){let n=100;const i=this._resolveElements(e);if(!i.length)return;const r=this.findRoot(i);if(!r)return;r!==this.getRootElement()&&this.setRootElement(r);const o=i.filter(g=>g!=r);if(!o.length)return;t||(t={}),typeof t=="number"&&(n=t),t={top:t.top||n,right:t.right||n,bottom:t.bottom||n,left:t.left||n};const a=kt(o),s=Te(a),c=this.viewbox(),u=this.zoom();let l,f;c.y+=t.top/u,c.x+=t.left/u,c.width-=(t.right+t.left)/u,c.height-=(t.bottom+t.top)/u;const p=Te(c);if(!(a.width<c.width&&a.height<c.height))l=a.x-c.x,f=a.y-c.y;else{const g=Math.max(0,s.right-p.right),h=Math.min(0,s.left-p.left),m=Math.max(0,s.bottom-p.bottom),_=Math.min(0,s.top-p.top);l=g||h,f=m||_}this.scroll({dx:-l*u,dy:-f*u})},De.prototype.zoom=function(e,t){if(!e)return this.viewbox(e).scale;if(e==="fit-viewport")return this._fitViewport(t);let n,i;return this._changeViewbox(function(){typeof t!="object"&&(n=this.viewbox().outer,t={x:n.width/2,y:n.height/2}),i=this._setZoom(e,t)}),ks(i.a,1e3)};function mm(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}De.prototype._fitViewport=function(e){const t=this.viewbox(),n=t.outer,i=t.inner;let r,o;return i.x>=0&&i.y>=0&&i.x+i.width<=n.width&&i.y+i.height<=n.height&&!e?o={x:0,y:0,width:Math.max(i.width+i.x,n.width),height:Math.max(i.height+i.y,n.height)}:(r=Math.min(1,n.width/i.width,n.height/i.height),o={x:i.x+(e?i.width/2-n.width/r/2:0),y:i.y+(e?i.height/2-n.height/r/2:0),width:n.width/r,height:n.height/r}),this.viewbox(o),this.viewbox(!1).scale},De.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,r=n.createSVGMatrix(),o=n.createSVGPoint();let a,s,c,u,l;c=i.getCTM();const f=c.a;return t?(a=z(o,t),s=a.matrixTransform(c.inverse()),u=r.translate(s.x,s.y).scale(1/f*e).translate(-s.x,-s.y),l=c.multiply(u)):l=r.scale(e),mm(this._viewport,l),l},De.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},De.prototype.getAbsoluteBBox=function(e){const t=this.viewbox();let n;e.waypoints?n=this.getGraphics(e).getBBox():n=e;const i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale,o=n.width*t.scale,a=n.height*t.scale;return{x:i,y:r,width:o,height:a}},De.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var lo="data-element-id";function $n(e){this._elements={},this._eventBus=e}$n.$inject=["eventBus"],$n.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),ve(t,lo,i),n&&ve(n,lo,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},$n.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(ve(i.gfx,lo,""),i.secondaryGfx&&ve(i.secondaryGfx,lo,""),delete t[n])},$n.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)},$n.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&ve(t,lo,i),t},$n.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&ve(e,lo);var n=this._elements[t];return n&&n.element},$n.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},$n.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}},$n.prototype.getAll=function(){return this.filter(function(e){return e})},$n.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)})},$n.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},$n.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 PS(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 AS(e){return e.__refs_collection===!0}function TS(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function gm(e,t,n){var i=PS(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 MS(e,t,n){var i=t.inverse,r=n[t.name];Object.defineProperty(n,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return r},set:function(o){if(o!==r){var a=r;r=null,a&&e.unset(a,i,n),r=o,e.set(r,i,n)}}})}function Vn(e,t){if(!(this instanceof Vn))return new Vn(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Vn.prototype.bind=function(e,t){if(typeof t=="string"){if(!this.props[t])throw new Error("no property <"+t+"> in ref");t=this.props[t]}t.collection?gm(this,t,e):MS(this,t,e)},Vn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return AS(n)||gm(this,t,e),n},Vn.prototype.ensureBound=function(e,t){TS(e,t)||this.bind(e,t)},Vn.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Vn.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var Cl=new Vn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),ym=new Vn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),vm=new Vn({name:"attachers",collection:!0},{name:"host"}),bm=new Vn({name:"outgoing",collection:!0},{name:"source"}),_m=new Vn({name:"incoming",collection:!0},{name:"target"});function po(){Object.defineProperty(this,"businessObject",{writable:!0}),Object.defineProperty(this,"label",{get:function(){return this.labels[0]},set:function(e){var t=this.label,n=this.labels;!e&&t?n.remove(t):n.add(e,0)}}),Cl.bind(this,"parent"),ym.bind(this,"labels"),bm.bind(this,"outgoing"),_m.bind(this,"incoming")}function ia(){po.call(this),Cl.bind(this,"children"),vm.bind(this,"host"),vm.bind(this,"attachers")}ye(ia,po);function xm(){po.call(this),Cl.bind(this,"children")}ye(xm,ia);function wm(){ia.call(this),ym.bind(this,"labelTarget")}ye(wm,ia);function Em(){po.call(this),bm.bind(this,"source"),_m.bind(this,"target")}ye(Em,po);var kS={connection:Em,shape:ia,label:wm,root:xm};function OS(e,t){var n=kS[e];if(!n)throw new Error("unknown type: <"+e+">");return z(new n,t)}function DS(e){return e instanceof po}function Oi(){this._uid=12}Oi.prototype.createRoot=function(e){return this.create("root",e)},Oi.prototype.createLabel=function(e){return this.create("label",e)},Oi.prototype.createShape=function(e){return this.create("shape",e)},Oi.prototype.createConnection=function(e){return this.create("connection",e)},Oi.prototype.create=function(e,t){return t=z({},t||{}),t.id||(t.id=e+"_"+this._uid++),OS(e,t)};var Os="__fn",Sm=1e3,LS=Array.prototype.slice;function An(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}An.prototype.on=function(e,t,n,i){if(e=ke(e)?e:[e],qt(t)&&(i=n,n=t,t=Sm),!Ie(t))throw new Error("priority must be a number");var r=n;i&&(r=bn(n,i),r[Os]=n[Os]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},An.prototype.once=function(e,t,n,i){var r=this;if(qt(t)&&(i=n,n=t,t=Sm),!Ie(t))throw new Error("priority must be a number");function o(){o.__isTomb=!0;var a=n.apply(i,arguments);return r.off(e,o),a}o[Os]=n,this.on(e,t,o)},An.prototype.off=function(e,t){e=ke(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},An.prototype.createEvent=function(e){var t=new ra;return t.init(e),t},An.prototype.fire=function(e,t){var n,i,r,o;if(o=LS.call(arguments),typeof e=="object"&&(t=e,e=t.type),!e)throw new Error("no event type specified");if(i=this._listeners[e],!!i){t instanceof ra?n=t:n=this.createEvent(t),o[0]=n;var a=n.type;e!==a&&(n.type=e);try{r=this._invokeListeners(n,o,i)}finally{e!==a&&(n.type=a)}return r===void 0&&n.defaultPrevented&&(r=!1),r}},An.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},An.prototype._destroy=function(){this._listeners={}},An.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},An.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=IS(n.callback,t),i!==void 0&&(e.returnValue=i,e.stopPropagation()),i===!1&&e.preventDefault()}catch(r){if(!this.handleError(r))throw console.error("unhandled error in event listener",r),r}return i},An.prototype._addListener=function(e,t){var n=this._getListeners(e),i;if(!n){this._setListeners(e,t);return}for(;n;){if(n.priority<t.priority){t.next=n,i?i.next=t:this._setListeners(e,t);return}i=n,n=n.next}i.next=t},An.prototype._getListeners=function(e){return this._listeners[e]},An.prototype._setListeners=function(e,t){this._listeners[e]=t},An.prototype._removeListener=function(e,t){var n=this._getListeners(e),i,r,o;if(!t){this._setListeners(e,null);return}for(;n;)i=n.next,o=n.callback,(o===t||o[Os]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function ra(){}ra.prototype.stopPropagation=function(){this.cancelBubble=!0},ra.prototype.preventDefault=function(){this.defaultPrevented=!0},ra.prototype.init=function(e){z(this,e||{})};function IS(e,t){return e.apply(null,t)}function Dr(e){return e.childNodes[0]}function BS(e){return e.parentNode.childNodes[1]}function Ds(e,t,n,i,r){var o=Xo();o.setTranslate(t,n);var a=Xo();a.setRotate(i||0,0,0);var s=Xo();s.setScale(1,1),Zo(e,[o,a,s])}function nn(e,t,n){var i=Xo();i.setTranslate(t,n),Zo(e,i)}function Rm(e,t){var n=Xo();n.setRotate(t,0,0),Zo(e,n)}function Fn(e,t){this._eventBus=e,this._elementRegistry=t}Fn.$inject=["eventBus","elementRegistry"],Fn.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=BS(t),n||(n=Ce("g"),Xe(n).add("djs-children"),Fe(t.parentNode,n))):n=t,n},Fn.prototype._clear=function(e){var t=Dr(e);return xs(t),t},Fn.prototype._createContainer=function(e,t,n,i){var r=Ce("g");Xe(r).add("djs-group"),typeof n<"u"?NS(r,t,t.childNodes[n]):Fe(t,r);var o=Ce("g");Xe(o).add("djs-element"),Xe(o).add("djs-"+e),i&&Xe(o).add("djs-frame"),Fe(r,o);var a=Ce("g");return Xe(a).add("djs-visual"),Fe(o,a),o},Fn.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,Zh(t))},Fn.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=Rn(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),I(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r),s=a.firstChild;I(o,function(c){var u=n.getGraphics(c).parentNode;u===s?s=s.nextSibling:a.insertBefore(u,s)})}})},Fn.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},Fn.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},Fn.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},Fn.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},Fn.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),nn(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?ve(n,"display","none"):ve(n,"display","block")}},Fn.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);zt(t.parentNode)};function NS(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const $S={__depends__:[Z1],__init__:["canvas"],canvas:["type",De],elementRegistry:["type",$n],elementFactory:["type",Oi],eventBus:["type",An],graphicsFactory:["type",Fn]};function FS(e){var t=new Kh(e);return t.init(),t}function jS(e){e=e||{};var t={config:["value",e]},n=[t,$S].concat(e.modules||[]);return FS(n)}function nr(e,t){this._injector=t||jS(e),this.get("eventBus").fire("diagram.init")}nr.prototype.get=function(e,t){return this._injector.get(e,t)},nr.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},nr.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},nr.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function ln(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function _n(e,t){return e.$instanceOf(t)}function HS(e){return lt(e.rootElements,function(t){return _n(t,"bpmn:Process")||_n(t,"bpmn:Collaboration")})}function zS(e){var t={},n=[],i={};function r(U,q){return function(K){U(K,q)}}function o(U){t[U.id]=U}function a(U){return t[U.id]}function s(U,q){var K=U.gfx;if(K)throw new Error(`already rendered ${ln(U)}`);return e.element(U,i[U.id],q)}function c(U,q){return e.root(U,i[U.id],q)}function u(U,q){try{var K=i[U.id]&&s(U,q);return o(U),K}catch(Ge){l(Ge.message,{element:U,error:Ge}),console.error(`failed to import ${ln(U)}`,Ge)}}function l(U,q){e.error(U,q)}var f=this.registerDi=function(q){var K=q.bpmnElement;K?i[K.id]?l(`multiple DI elements defined for ${ln(K)}`,{element:K}):i[K.id]=q:l(`no bpmnElement referenced in ${ln(q)}`,{element:q})};function p(U){d(U.plane)}function d(U){f(U),I(U.planeElement,g)}function g(U){f(U)}this.handleDefinitions=function(q,K){var Ge=q.diagrams;if(K&&Ge.indexOf(K)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!K&&Ge&&Ge.length&&(K=Ge[0]),!K)throw new Error("no diagram to display");i={},p(K);var Xt=K.plane;if(!Xt)throw new Error(`no plane for ${ln(K)}`);var M=Xt.bpmnElement;if(!M)if(M=HS(q),M)l(`correcting missing bpmnElement on ${ln(Xt)} to ${ln(M)}`),Xt.bpmnElement=M,f(Xt);else throw new Error("no process or collaboration to display");var E=c(M,Xt);if(_n(M,"bpmn:Process")||_n(M,"bpmn:SubProcess"))m(M,E);else if(_n(M,"bpmn:Collaboration"))xe(M,E),_(q.rootElements,E);else throw new Error(`unsupported bpmnElement for ${ln(Xt)}: ${ln(M)}`);h(n)};var h=this.handleDeferred=function(){for(var q;n.length;)q=n.shift(),q()};function m(U,q){ue(U,q),$(U.ioSpecification,q),T(U.artifacts,q),o(U)}function _(U,q){var K=Ue(U,function(Ge){return!a(Ge)&&_n(Ge,"bpmn:Process")&&Ge.laneSets});K.forEach(r(m,q))}function y(U,q){u(U,q)}function x(U,q){I(U,r(y,q))}function S(U,q){u(U,q)}function P(U,q){u(U,q)}function C(U,q){u(U,q)}function D(U,q){u(U,q)}function T(U,q){I(U,function(K){_n(K,"bpmn:Association")?n.push(function(){D(K,q)}):D(K,q)})}function $(U,q){U&&(I(U.dataInputs,r(P,q)),I(U.dataOutputs,r(C,q)))}var k=this.handleSubProcess=function(q,K){ue(q,K),T(q.artifacts,K)};function O(U,q){var K=u(U,q);_n(U,"bpmn:SubProcess")&&k(U,K||q),_n(U,"bpmn:Activity")&&$(U.ioSpecification,q),n.push(function(){I(U.dataInputAssociations,r(S,q)),I(U.dataOutputAssociations,r(S,q))})}function j(U,q){u(U,q)}function se(U,q){u(U,q)}function we(U,q){n.push(function(){var K=u(U,q);U.childLaneSet&&Ke(U.childLaneSet,K||q),ce(U)})}function Ke(U,q){I(U.lanes,r(we,q))}function Y(U,q){I(U,r(Ke,q))}function ue(U,q){_e(U.flowElements,q),U.laneSets&&Y(U.laneSets,q)}function _e(U,q){I(U,function(K){_n(K,"bpmn:SequenceFlow")?n.push(function(){j(K,q)}):_n(K,"bpmn:BoundaryEvent")?n.unshift(function(){O(K,q)}):_n(K,"bpmn:FlowNode")?O(K,q):_n(K,"bpmn:DataObject")||(_n(K,"bpmn:DataStoreReference")||_n(K,"bpmn:DataObjectReference")?se(K,q):l(`unrecognized flowElement ${ln(K)} in context ${ln(q&&q.businessObject)}`,{element:K,context:q}))})}function le(U,q){var K=u(U,q),Ge=U.processRef;Ge&&m(Ge,K||q)}function xe(U,q){I(U.participants,r(le,q)),n.push(function(){x(U.messageFlows,q)}),T(U.artifacts,q)}function ce(U){I(U.flowNodeRef,function(q){var K=q.get("lanes");K&&K.push(U)})}}function w(e,t){var n=ie(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function We(e,t){return Wi(t,function(n){return w(e,n)})}function ie(e){return e&&e.businessObject||e}function Ze(e){return e&&e.di}function GS(e,t,n){var i,r,o,a,s=[];function c(u,l){var f={root:function(h,m){return i.add(h,m)},element:function(h,m,_){return i.add(h,m,_)},error:function(h,m){s.push({message:h,context:m})}},p=new zS(f);l=l||u.diagrams&&u.diagrams[0];var d=VS(u,l);if(!d)throw new Error("no diagram to display");I(d,function(h){p.handleDefinitions(u,h)});var g=l.plane.bpmnElement.id;o.setRootElement(o.findRoot(g+"_plane")||o.findRoot(g))}return new Promise(function(u,l){try{return i=e.get("bpmnImporter"),r=e.get("eventBus"),o=e.get("canvas"),r.fire("import.render.start",{definitions:t}),c(t,n),r.fire("import.render.complete",{error:a,warnings:s}),u({warnings:s})}catch(f){return f.warnings=s,l(f)}})}function VS(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!w(n,"bpmn:Process")&&!w(n,"bpmn:Collaboration")&&(i=WS(n));var r;w(i,"bpmn:Collaboration")?r=i:r=lt(e.rootElements,function(u){if(w(u,"bpmn:Collaboration"))return lt(u.participants,function(l){return l.processRef===i})});var o=[i];r&&(o=sn(r.participants,function(u){return u.processRef}),o.push(r));var a=Cm(o),s=[t],c=[n];return I(e.diagrams,function(u){if(u.plane){var l=u.plane.bpmnElement;a.indexOf(l)!==-1&&c.indexOf(l)===-1&&(s.push(u),c.push(l))}}),s}}function Cm(e){var t=[];return I(e,function(n){n&&(t.push(n),t=t.concat(Cm(n.flowElements)))}),t}function WS(e){for(var t=e;t;){if(w(t,"bpmn:Process"))return t;t=t.$parent}}var US='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.02 5.57" width="53" height="21"><path fill="currentColor" d="M1.88.92v.14c0 .41-.13.68-.4.8.33.14.46.44.46.86v.33c0 .61-.33.95-.95.95H0V0h.95c.65 0 .93.3.93.92zM.63.57v1.06h.24c.24 0 .38-.1.38-.43V.98c0-.28-.1-.4-.32-.4zm0 1.63v1.22h.36c.2 0 .32-.1.32-.39v-.35c0-.37-.12-.48-.4-.48H.63zM4.18.99v.52c0 .64-.31.98-.94.98h-.3V4h-.62V0h.92c.63 0 .94.35.94.99zM2.94.57v1.35h.3c.2 0 .3-.09.3-.37v-.6c0-.29-.1-.38-.3-.38h-.3zm2.89 2.27L6.25 0h.88v4h-.6V1.12L6.1 3.99h-.6l-.46-2.82v2.82h-.55V0h.87zM8.14 1.1V4h-.56V0h.79L9 2.4V0h.56v4h-.64zm2.49 2.29v.6h-.6v-.6zM12.12 1c0-.63.33-1 .95-1 .61 0 .95.37.95 1v2.04c0 .64-.34 1-.95 1-.62 0-.95-.37-.95-1zm.62 2.08c0 .28.13.39.33.39s.32-.1.32-.4V.98c0-.29-.12-.4-.32-.4s-.33.11-.33.4z"/><path fill="currentColor" d="M0 4.53h14.02v1.04H0zM11.08 0h.63v.62h-.63zm.63 4V1h-.63v2.98z"/></svg>',Pm=US,Am={verticalAlign:"middle"},Tm={color:"#404040"},qS={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},YS={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},KS={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"},XS='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+Pm+'</a><span>Web-based tooling for BPMN, DMN and forms powered by <a href="https://bpmn.io" target="_blank" rel="noopener">bpmn.io</a>.</span></div></div>',gi;function ZS(){gi=mt(XS),mn(gi,qS),mn(ot("svg",gi),Am),mn(ot(".backdrop",gi),YS),mn(ot(".notice",gi),KS),mn(ot(".link",gi),Tm,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function QS(){gi||(ZS(),Pn.bind(gi,".backdrop","click",function(e){document.body.removeChild(gi)})),document.body.appendChild(gi)}const Ls=5,Mm="djs-outline-hidden";function xt(e){e=z({},eR,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),nR(this._container)}ye(xt,nr),xt.prototype.importXML=async function(t,n){const i=this;function r(a){return i.get("eventBus").createEvent(a)}let o=[];try{t=this._emit("import.parse.start",{xml:t})||t;let a;try{a=await this._moddle.fromXML(t,"bpmn:Definitions")}catch(p){throw this._emit("import.parse.complete",{error:p}),p}let s=a.rootElement;const c=a.references,u=a.warnings,l=a.elementsById;o=o.concat(u),s=this._emit("import.parse.complete",r({error:null,definitions:s,elementsById:l,references:c,warnings:o}))||s;const f=await this.importDefinitions(s,n);return o=o.concat(f.warnings),this._emit("import.done",{error:null,warnings:o}),{warnings:o}}catch(a){let s=a;throw o=o.concat(s.warnings||[]),Is(s,o),s=JS(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},xt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},xt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw Is(o,[]),o}if(typeof t=="string"&&(i=tR(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw Is(o,[]),o}try{this.clear()}catch(o){throw Is(o,[]),o}const{warnings:r}=await GS(this,n,i);return{warnings:r}},xt.prototype.saveXML=async function(t){t=t||{};let n=this._definitions,i,r;try{if(!n)throw new Error("no definitions loaded");n=this._emit("saveXML.start",{definitions:n})||n,r=(await this._moddle.toXML(n,t)).xml,r=this._emit("saveXML.serialized",{xml:r})||r}catch(a){i=a}const o=i?{error:i}:{xml:r};if(this._emit("saveXML.done",o),i)throw i;return o},xt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=ot(":scope > defs",i._svg),a=Yh(r),s=o?"<defs>"+Yh(o)+"</defs>":"",c=i.getContainer();_t(c).add(Mm);let u;try{u=r.getBBox()}finally{_t(c).remove(Mm)}const l=u.x-Ls,f=u.y-Ls,p=u.width+Ls*2,d=u.height+Ls*2;t=`<?xml version="1.0" encoding="utf-8"?>
|
|
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}},vt.prototype._setDefinitions=function(e){this._definitions=e},vt.prototype.getModules=function(){return this._modules},vt.prototype.clear=function(){this.getDefinitions()&&ir.prototype.clear.call(this)},vt.prototype.destroy=function(){ir.prototype.destroy.call(this),di(this._container)},vt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},vt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},vt.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),typeof e=="string"&&(e=ot(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},vt.prototype.getDefinitions=function(){return this._definitions},vt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},vt.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=H(si(n,["additionalModules"]),{canvas:H({},n.canvas,{container:e}),modules:a});ir.call(this,s),n&&n.container&&this.attachTo(n.container)},vt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},vt.prototype._createContainer=function(e){const t=ft('<div class="bjs-container"></div>');return dn(t,{width:Pm(e.width),height:Pm(e.height),position:e.position}),t},vt.prototype._createModdle=function(e){const t=H({},this._moddleExtensions,e.moddleExtensions);return new Pd(t)},vt.prototype._modules=[];function Ls(e,t){return e.warnings=t,e}function WS(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 US={width:"100%",height:"100%",position:"relative"};function Pm(e){return e+(Le(e)?"px":"")}function qS(e,t){return t&<(e.diagrams,function(n){return n.id===t})||null}function YS(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Em+"</a>",i=ft(n);dn(ot("svg",i),Sm),dn(i,Rm,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),Ne.bind(i,"click",function(r){VS(),r.preventDefault()})}function fo(e){vt.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)}de(fo,vt),fo.prototype._createModdle=function(e){var t=vt.prototype._createModdle.call(this,e);return t.ids=new fi([32,36,1]),t},fo.prototype._collectIds=function(e,t){var n=e.$model,i=n.ids,r;i.clear();for(r in t)i.claim(r,t[r])};function Ue(e,t){return x(e,"bpmn:CallActivity")?!1:x(e,"bpmn:SubProcess")?(t=t||Ye(e),t&&x(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):x(e,"bpmn:Participant")?!!te(e).processRef:!0}function qt(e){if(!(!x(e,"bpmn:Participant")&&!x(e,"bpmn:Lane"))){var t=Ye(e).isHorizontal;return t===void 0?!0:t}}function KS(e){return e&&te(e).isInterrupting!==!1}function un(e){return e&&!!te(e).triggeredByEvent}function ho(e,t){var n=te(e).eventDefinitions;return Ui(n,function(i){return x(i,t)})}function XS(e){return ho(e,"bpmn:ErrorEventDefinition")}function ZS(e){return ho(e,"bpmn:EscalationEventDefinition")}function QS(e){return ho(e,"bpmn:CompensateEventDefinition")}var Lr={width:90,height:20},Am=15;function rr(e){return x(e,"bpmn:Event")||x(e,"bpmn:Gateway")||x(e,"bpmn:DataStoreReference")||x(e,"bpmn:DataObjectReference")||x(e,"bpmn:DataInput")||x(e,"bpmn:DataOutput")||x(e,"bpmn:SequenceFlow")||x(e,"bpmn:MessageFlow")||x(e,"bpmn:Group")}function Is(e){return Fe(e.label)}function JS(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=eR(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-=Am:a+=Am,{x:a,y:s}}function eR(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 Rl(e){return e.waypoints?JS(e.waypoints):x(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Lr.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Lr.height/2}}function tR(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(Lr.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=Rl(t),i=Lr),H({x:n.x-i.width/2,y:n.y-i.height/2},i)}function Tm(e){if(x(e,"bpmn:FlowElement")||x(e,"bpmn:Participant")||x(e,"bpmn:Lane")||x(e,"bpmn:SequenceFlow")||x(e,"bpmn:MessageFlow")||x(e,"bpmn:DataInput")||x(e,"bpmn:DataOutput"))return"name";if(x(e,"bpmn:TextAnnotation"))return"text";if(x(e,"bpmn:Group"))return"categoryValueRef"}function nR(e){var t=e.categoryValueRef;return t&&t.value||""}function Bn(e){var t=e.businessObject,n=Tm(t);if(n)return n==="categoryValueRef"?nR(t):t[n]||""}function iR(e,t){var n=e.businessObject,i=Tm(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function rR(e){return Fe(e)&&rr(e.labelTarget)}var mo=7;function Mm(e){let t=[];return L(e.incoming,n=>{x(n,"bpmn:Association")&&x(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),L(e.outgoing,n=>{x(n,"bpmn:Association")&&x(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function oa(e){const t=new Map;return L(vl(e),n=>{L(Mm(n),i=>{t.has(i.annotation)||t.set(i.annotation,{annotation:i.annotation,associations:[]}),t.get(i.annotation).associations.push(i.association)})}),[...t.values()]}var Cl="hsl(225, 10%, 15%)",oR="white";function yi(e,t){return Ui(e.eventDefinitions,function(n){return n.$type===t})}function aR(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function sR(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function Ve(e,t,n){var i=Ye(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||oR}function fe(e,t,n){var i=Ye(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||Cl}function aa(e,t,n,i){var r=Ye(e),o=r.get("label");return i||o&&o.get("color:color")||t||fe(e,n)}function km(e){var t=e.x+e.width/2,n=e.y+e.height/2,i=e.width/2,r=[["M",t,n],["m",0,-i],["a",i,i,0,1,1,0,2*i],["a",i,i,0,1,1,0,-2*i],["z"]];return kr(r)}function 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 kr(a)}function cR(e){var t=e.width,n=e.height,i=e.x,r=e.y,o=t/2,a=n/2,s=[["M",i+o,r],["l",o,a],["l",-o,a],["l",-o,-a],["z"]];return kr(s)}function uR(e){var t=e.x,n=e.y,i=e.width,r=e.height,o=[["M",t,n],["l",i,0],["l",0,r],["l",-i,0],["z"]];return kr(o)}function sa(e,t={}){return{width:Fn(e,t),height:An(e,t)}}function Fn(e,t={}){return En(t,"width")?t.width:e.width}function An(e,t={}){return En(t,"height")?t.height:e.height}var lR=new fi,pR=10,Ns=3,fR=1.5,Bs=10,dR=4,go=.95,hR=1,mR=.25;function Ir(e,t,n,i,r,o,a){Ti.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,u=e&&e.defaultLabelColor;function l(M){return n.computeStyle(M,{strokeLinecap:"round",strokeLinejoin:"round",stroke:Cl,strokeWidth:2,fill:"white"})}function p(M){return n.computeStyle(M,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:Cl,strokeWidth:2})}function f(M,E){var{ref:b={x:0,y:0},scale:j=1,element:W,parentGfx:K=r._svg}=E,ye=Ce("marker",{id:M,viewBox:"0 0 20 20",refX:b.x,refY:b.y,markerWidth:20*j,markerHeight:20*j,orient:"auto"});Be(ye,W);var Ie=ot(":scope > defs",K);Ie||(Ie=Ce("defs"),Be(K,Ie)),Be(Ie,ye)}function d(M,E,b,j){var W=lR.nextPrefixed("marker-");return g(M,W,E,b,j),"url(#"+W+")"}function g(M,E,b,j,W){if(b==="sequenceflow-end"){var K=Ce("path",{d:"M 1 5 L 11 10 L 1 15 Z",...l({fill:W,stroke:W,strokeWidth:1})});f(E,{element:K,ref:{x:11,y:10},scale:.5,parentGfx:M})}if(b==="messageflow-start"){var ye=Ce("circle",{cx:6,cy:6,r:3.5,...l({fill:j,stroke:W,strokeWidth:1,strokeDasharray:[1e4,1]})});f(E,{element:ye,ref:{x:6,y:6},parentGfx:M})}if(b==="messageflow-end"){var Ie=Ce("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...l({fill:j,stroke:W,strokeWidth:1,strokeDasharray:[1e4,1]})});f(E,{element:Ie,ref:{x:8.5,y:5},parentGfx:M})}if(b==="association-start"){var Xe=Ce("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:W,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(E,{element:Xe,ref:{x:1,y:10},scale:.5,parentGfx:M})}if(b==="association-end"){var Et=Ce("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:W,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(E,{element:Et,ref:{x:11,y:10},scale:.5,parentGfx:M})}if(b==="conditional-flow-marker"){var nt=Ce("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...l({fill:j,stroke:W})});f(E,{element:nt,ref:{x:-1,y:10},scale:.5,parentGfx:M})}if(b==="conditional-default-flow-marker"){var Ht=Ce("path",{d:"M 6 4 L 10 16",...l({stroke:W,fill:"none"})});f(E,{element:Ht,ref:{x:0,y:10},scale:.5,parentGfx:M})}}function h(M,E,b,j,W={}){Vt(j)&&(W=j,j=0),j=j||0,W=l(W);var K=E/2,ye=b/2,Ie=Ce("circle",{cx:K,cy:ye,r:Math.round((E+b)/4-j),...W});return Be(M,Ie),Ie}function m(M,E,b,j,W,K){Vt(W)&&(K=W,W=0),W=W||0,K=l(K);var ye=Ce("rect",{x:W,y:W,width:E-W*2,height:b-W*2,rx:j,ry:j,...K});return Be(M,ye),ye}function w(M,E,b,j){var W=E/2,K=b/2,ye=[{x:W,y:0},{x:E,y:K},{x:W,y:b},{x:0,y:K}],Ie=ye.map(function(Et){return Et.x+","+Et.y}).join(" ");j=l(j);var Xe=Ce("polygon",{...j,points:Ie});return Be(M,Xe),Xe}function y(M,E,b,j){b=p(b);var W=Qo(E,b,j);return Be(M,W),W}function _(M,E,b){return y(M,E,b,5)}function S(M,E,b){b=p(b);var j=Ce("path",{...b,d:E});return Be(M,j),j}function P(M,E,b,j){return S(E,b,H({"data-marker":M},j))}function C(M){return wt[M]}function D(M){return function(E,b,j){return C(M)(E,b,j)}}var T={"bpmn:MessageEventDefinition":function(M,E,b={},j){var W=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:b.width||E.width,containerHeight:b.height||E.height,position:{mx:.235,my:.315}}),K=j?fe(E,c,b.stroke):Ve(E,s,b.fill),ye=j?Ve(E,s,b.fill):fe(E,c,b.stroke),Ie=S(M,W,{fill:K,stroke:ye,strokeWidth:1});return Ie},"bpmn:TimerEventDefinition":function(M,E,b={}){var j=b.width||E.width,W=b.height||E.height,K=b.width?1:2,ye=h(M,j,W,.2*W,{fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke),strokeWidth:K}),Ie=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:j,containerHeight:W,position:{mx:.5,my:.5}});S(M,Ie,{stroke:fe(E,c,b.stroke),strokeWidth:K});for(var Xe=0;Xe<12;Xe++){var Et=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:j,containerHeight:W,position:{mx:.5,my:.5}}),nt=j/2,Ht=W/2;S(M,Et,{strokeWidth:1,stroke:fe(E,c,b.stroke),transform:"rotate("+Xe*30+","+Ht+","+nt+")"})}return ye},"bpmn:EscalationEventDefinition":function(M,E,b={},j){var W=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:b.width||E.width,containerHeight:b.height||E.height,position:{mx:.5,my:.2}}),K=j?fe(E,c,b.stroke):Ve(E,s,b.fill);return S(M,W,{fill:K,stroke:fe(E,c,b.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(M,E,b={}){var j=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:b.width||E.width,containerHeight:b.height||E.height,position:{mx:.5,my:.222}});return S(M,j,{fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(M,E,b={},j){var W=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:.57,my:.263}}),K=j?fe(E,c,b.stroke):Ve(E,s,b.fill);return S(M,W,{fill:K,stroke:fe(E,c,b.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(M,E,b={},j){var W=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:b.width||E.width,containerHeight:b.height||E.height,position:{mx:.2,my:.722}}),K=j?fe(E,c,b.stroke):Ve(E,s,b.fill);return S(M,W,{fill:K,stroke:fe(E,c,b.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(M,E,b={},j){var W=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:.638,my:-.055}}),K=j?fe(E,c,b.stroke):"none",ye=S(M,W,{fill:K,stroke:fe(E,c,b.stroke),strokeWidth:1});return xm(ye,45),ye},"bpmn:CompensateEventDefinition":function(M,E,b={},j){var W=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:b.width||E.width,containerHeight:b.height||E.height,position:{mx:.22,my:.5}}),K=j?fe(E,c,b.stroke):Ve(E,s,b.fill);return S(M,W,{fill:K,stroke:fe(E,c,b.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(M,E,b={},j){var W=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:b.width||E.width,containerHeight:b.height||E.height,position:{mx:.5,my:.2}}),K=j?fe(E,c,b.stroke):Ve(E,s,b.fill);return S(M,W,{strokeWidth:1,fill:K,stroke:fe(E,c,b.stroke)})},"bpmn:MultipleEventDefinition":function(M,E,b={},j){var W=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:b.width||E.width,containerHeight:b.height||E.height,position:{mx:.211,my:.36}}),K=j?fe(E,c,b.stroke):Ve(E,s,b.fill);return S(M,W,{fill:K,stroke:fe(E,c,b.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(M,E,b={}){var j=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:b.width||E.width,containerHeight:b.height||E.height,position:{mx:.458,my:.194}});return S(M,j,{fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(M,E,b={}){var j=h(M,E.width,E.height,8,{fill:fe(E,c,b.stroke),stroke:fe(E,c,b.stroke),strokeWidth:4});return j}};function N(M,E,b={},j){var W=te(M),K=aR(W),ye=j||M;return W.get("eventDefinitions")&&W.get("eventDefinitions").length>1?W.get("parallelMultiple")?T["bpmn:ParallelMultipleEventDefinition"](E,ye,b,K):T["bpmn:MultipleEventDefinition"](E,ye,b,K):yi(W,"bpmn:MessageEventDefinition")?T["bpmn:MessageEventDefinition"](E,ye,b,K):yi(W,"bpmn:TimerEventDefinition")?T["bpmn:TimerEventDefinition"](E,ye,b,K):yi(W,"bpmn:ConditionalEventDefinition")?T["bpmn:ConditionalEventDefinition"](E,ye,b,K):yi(W,"bpmn:SignalEventDefinition")?T["bpmn:SignalEventDefinition"](E,ye,b,K):yi(W,"bpmn:EscalationEventDefinition")?T["bpmn:EscalationEventDefinition"](E,ye,b,K):yi(W,"bpmn:LinkEventDefinition")?T["bpmn:LinkEventDefinition"](E,ye,b,K):yi(W,"bpmn:ErrorEventDefinition")?T["bpmn:ErrorEventDefinition"](E,ye,b,K):yi(W,"bpmn:CancelEventDefinition")?T["bpmn:CancelEventDefinition"](E,ye,b,K):yi(W,"bpmn:CompensateEventDefinition")?T["bpmn:CompensateEventDefinition"](E,ye,b,K):yi(W,"bpmn:TerminateEventDefinition")?T["bpmn:TerminateEventDefinition"](E,ye,b,K):null}var k={ParticipantMultiplicityMarker:function(M,E,b={}){var j=Fn(E,b),W=An(E,b),K=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:j,containerHeight:W,position:{mx:(j/2-6)/j,my:(W-15)/W}});P("participant-multiplicity",M,K,{strokeWidth:2,fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke)})},SubProcessMarker:function(M,E,b={}){var j=m(M,14,14,0,{strokeWidth:1,fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke)});en(j,E.width/2-7.5,E.height-20);var W=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:E.width,containerHeight:E.height,position:{mx:(E.width/2-7.5)/E.width,my:(E.height-20)/E.height}});P("sub-process",M,W,{fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke)})},ParallelMarker:function(M,E,b){var j=Fn(E,b),W=An(E,b),K=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:j,containerHeight:W,position:{mx:(j/2+b.parallel)/j,my:(W-20)/W}});P("parallel",M,K,{fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke)})},SequentialMarker:function(M,E,b){var j=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:(E.width/2+b.seq)/E.width,my:(E.height-19)/E.height}});P("sequential",M,j,{fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke)})},CompensationMarker:function(M,E,b){var j=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:(E.width/2+b.compensation)/E.width,my:(E.height-13)/E.height}});P("compensation",M,j,{strokeWidth:1,fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke)})},LoopMarker:function(M,E,b){var j=Fn(E,b),W=An(E,b),K=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:j,containerHeight:W,position:{mx:(j/2+b.loop)/j,my:(W-7)/W}});P("loop",M,K,{strokeWidth:1.5,fill:"none",stroke:fe(E,c,b.stroke),strokeMiterlimit:.5})},AdhocMarker:function(M,E,b){var j=Fn(E,b),W=An(E,b),K=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:j,containerHeight:W,position:{mx:(j/2+b.adhoc)/j,my:(W-15)/W}});P("adhoc",M,K,{strokeWidth:1,fill:fe(E,c,b.stroke),stroke:fe(E,c,b.stroke)})}};function O(M,E,b,j){k[M](E,b,j)}function F(M,E,b=[],j={}){j={fill:j.fill,stroke:j.stroke,width:Fn(E,j),height:An(E,j)};var W=te(E),K=b.includes("SubProcessMarker");K?j={...j,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:j={...j,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},W.get("isForCompensation")&&b.push("CompensationMarker"),x(W,"bpmn:AdHocSubProcess")&&(b.push("AdhocMarker"),K||H(j,{compensation:j.compensation-18}));var ye=W.get("loopCharacteristics"),Ie=ye&&ye.get("isSequential");ye&&(H(j,{compensation:j.compensation-18}),b.includes("AdhocMarker")&&H(j,{seq:-23,loop:-18,parallel:-24}),Ie===void 0&&b.push("LoopMarker"),Ie===!1&&b.push("ParallelMarker"),Ie===!0&&b.push("SequentialMarker")),b.includes("CompensationMarker")&&b.length===1&&H(j,{compensation:-8}),L(b,function(Xe){O(Xe,M,E,j)})}function ae(M,E,b={}){b=H({size:{width:100}},b);var j=o.createText(E||"",b);return qe(j).add("djs-label"),Be(M,j),j}function _e(M,E,b,j={}){var W=te(E),K=sa({x:E.x,y:E.y,width:E.width,height:E.height},j);return ae(M,W.name,{align:b,box:K,padding:7,style:{fill:aa(E,u,c,j.stroke)}})}function We(M,E,b={}){var j={width:E.width,height:E.height,x:E.width/2+E.x,y:E.height/2+E.y};return ae(M,Bn(E),{box:j,style:H({},o.getExternalStyle(),{fill:aa(E,u,c,b.stroke)})})}function Y(M,E,b,j={}){var W=qt(b),K=ae(M,E,{box:{height:30,width:W?An(b,j):Fn(b,j)},align:"center-middle",style:{fill:aa(b,u,c,j.stroke)}});if(W){var ye=-1*An(b,j);Os(K,0,-ye,270)}}function le(M,E,b={}){var{width:j,height:W}=sa(E,b);return m(M,j,W,Bs,{...b,fill:Ve(E,s,b.fill),fillOpacity:go,stroke:fe(E,c,b.stroke)})}function ge(M,E,b={}){var j=te(E),W=Ve(E,s,b.fill),K=fe(E,c,b.stroke);return(j.get("associationDirection")==="One"||j.get("associationDirection")==="Both")&&(b.markerEnd=d(M,"association-end",W,K)),j.get("associationDirection")==="Both"&&(b.markerStart=d(M,"association-start",W,K)),b=Ke(b,["markerStart","markerEnd"]),_(M,E.waypoints,{...b,stroke:K,strokeDasharray:"0, 5"})}function ue(M,E,b={}){var j=Ve(E,s,b.fill),W=fe(E,c,b.stroke),K=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:.474,my:.296}}),ye=S(M,K,{fill:j,fillOpacity:go,stroke:W}),Ie=te(E);if(sR(Ie)){var Xe=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:.33,my:(E.height-18)/E.height}});S(M,Xe,{strokeWidth:2,fill:j,stroke:W})}return ye}function Re(M,E,b={}){return h(M,E.width,E.height,{fillOpacity:go,...b,fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke)})}function re(M,E,b={}){return w(M,E.width,E.height,{fill:Ve(E,s,b.fill),fillOpacity:go,stroke:fe(E,c,b.stroke)})}function q(M,E,b={}){var j=m(M,Fn(E,b),An(E,b),0,{fill:Ve(E,s,b.fill),fillOpacity:b.fillOpacity||go,stroke:fe(E,c,b.stroke),strokeWidth:1.5}),W=te(E);if(x(W,"bpmn:Lane")){var K=W.get("name");Y(M,K,E,b)}return j}function U(M,E,b={}){var j=le(M,E,b),W=Ue(E);if(un(E)&&(he(j,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!W)){var K=te(E).flowElements||[],ye=K.filter(Ie=>x(Ie,"bpmn:StartEvent"));ye.length===1&&Z(ye[0],M,b,E)}return _e(M,E,W?"center-top":"center-middle",b),W?F(M,E,void 0,b):F(M,E,["SubProcessMarker"],b),j}function Z(M,E,b,j){var W=22,K={fill:Ve(j,s,b.fill),stroke:fe(j,c,b.stroke),width:W,height:W},ye=te(M).isInterrupting,Ie=ye?0:3,Xe=ye?1:1.2,Et=20,nt=(W-Et)/2,Ht="translate("+nt+","+nt+")";h(E,Et,Et,{fill:K.fill,stroke:K.stroke,strokeWidth:Xe,strokeDasharray:Ie,transform:Ht}),N(M,E,K,j)}function He(M,E,b={}){var j=le(M,E,b);return _e(M,E,"center-middle",b),F(M,E,void 0,b),j}var wt=this.handlers={"bpmn:AdHocSubProcess":function(M,E,b={}){return Ue(E)?b=Ke(b,["fill","stroke","width","height"]):b=Ke(b,["fill","stroke"]),U(M,E,b)},"bpmn:Association":function(M,E,b={}){return b=Ke(b,["fill","stroke"]),ge(M,E,b)},"bpmn:BoundaryEvent":function(M,E,b={}){var{renderIcon:j=!0}=b;b=Ke(b,["fill","stroke"]);var W=te(E),K=W.get("cancelActivity");b={strokeWidth:1.5,fill:Ve(E,s,b.fill),fillOpacity:hR,stroke:fe(E,c,b.stroke)},K||(b.strokeDasharray="6");var ye=Re(M,E,b);return h(M,E.width,E.height,Ns,{...b,fill:"none"}),j&&N(E,M,b),ye},"bpmn:BusinessRuleTask":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var j=He(M,E,b),W=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),K=S(M,W);he(K,{fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke),strokeWidth:1});var ye=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),Ie=S(M,ye);return he(Ie,{fill:fe(E,c,b.stroke),stroke:fe(E,c,b.stroke),strokeWidth:1}),j},"bpmn:CallActivity":function(M,E,b={}){return b=Ke(b,["fill","stroke"]),U(M,E,{strokeWidth:5,...b})},"bpmn:ComplexGateway":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var j=re(M,E,b),W=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:E.width,containerHeight:E.height,position:{mx:.46,my:.26}});return S(M,W,{fill:fe(E,c,b.stroke),stroke:fe(E,c,b.stroke),strokeWidth:1}),j},"bpmn:DataInput":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var j=i.getRawPath("DATA_ARROW"),W=ue(M,E,b);return S(M,j,{fill:"none",stroke:fe(E,c,b.stroke),strokeWidth:1}),W},"bpmn:DataInputAssociation":function(M,E,b={}){return b=Ke(b,["fill","stroke"]),ge(M,E,{...b,markerEnd:d(M,"association-end",Ve(E,s,b.fill),fe(E,c,b.stroke))})},"bpmn:DataObject":function(M,E,b={}){return b=Ke(b,["fill","stroke"]),ue(M,E,b)},"bpmn:DataObjectReference":D("bpmn:DataObject"),"bpmn:DataOutput":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var j=i.getRawPath("DATA_ARROW"),W=ue(M,E,b);return S(M,j,{strokeWidth:1,fill:fe(E,c,b.stroke),stroke:fe(E,c,b.stroke)}),W},"bpmn:DataOutputAssociation":function(M,E,b={}){return b=Ke(b,["fill","stroke"]),ge(M,E,{...b,markerEnd:d(M,"association-end",Ve(E,s,b.fill),fe(E,c,b.stroke))})},"bpmn:DataStoreReference":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var j=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:0,my:.133}});return S(M,j,{fill:Ve(E,s,b.fill),fillOpacity:go,stroke:fe(E,c,b.stroke),strokeWidth:2})},"bpmn:EndEvent":function(M,E,b={}){var{renderIcon:j=!0}=b;b=Ke(b,["fill","stroke"]);var W=Re(M,E,{...b,strokeWidth:4});return j&&N(E,M,b),W},"bpmn:EventBasedGateway":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var j=te(E),W=re(M,E,b);h(M,E.width,E.height,E.height*.2,{fill:Ve(E,"none",b.fill),stroke:fe(E,c,b.stroke),strokeWidth:1});var K=j.get("eventGatewayType"),ye=!!j.get("instantiate");function Ie(){var Et=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:E.width,containerHeight:E.height,position:{mx:.36,my:.44}});S(M,Et,{fill:"none",stroke:fe(E,c,b.stroke),strokeWidth:2})}if(K==="Parallel"){var Xe=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:E.width,containerHeight:E.height,position:{mx:.474,my:.296}});S(M,Xe,{fill:"none",stroke:fe(E,c,b.stroke),strokeWidth:1})}else K==="Exclusive"&&(ye||h(M,E.width,E.height,E.height*.26,{fill:"none",stroke:fe(E,c,b.stroke),strokeWidth:1}),Ie());return W},"bpmn:ExclusiveGateway":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var j=re(M,E,b),W=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:E.width,containerHeight:E.height,position:{mx:.32,my:.3}}),K=Ye(E);return K.get("isMarkerVisible")&&S(M,W,{fill:fe(E,c,b.stroke),stroke:fe(E,c,b.stroke),strokeWidth:1}),j},"bpmn:Gateway":function(M,E,b={}){return b=Ke(b,["fill","stroke"]),re(M,E,b)},"bpmn:Group":function(M,E,b={}){return b=Ke(b,["fill","stroke","width","height"]),m(M,E.width,E.height,Bs,{stroke:fe(E,c,b.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:Fn(E,b),height:An(E,b)})},"bpmn:InclusiveGateway":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var j=re(M,E,b);return h(M,E.width,E.height,E.height*.24,{fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke),strokeWidth:2.5}),j},"bpmn:IntermediateEvent":function(M,E,b={}){var{renderIcon:j=!0}=b;b=Ke(b,["fill","stroke"]);var W=Re(M,E,{...b,strokeWidth:1.5});return h(M,E.width,E.height,Ns,{fill:"none",stroke:fe(E,c,b.stroke),strokeWidth:1.5}),j&&N(E,M,b),W},"bpmn:IntermediateCatchEvent":D("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":D("bpmn:IntermediateEvent"),"bpmn:Lane":function(M,E,b={}){return b=Ke(b,["fill","stroke","width","height"]),q(M,E,{...b,fillOpacity:mR})},"bpmn:ManualTask":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var j=He(M,E,b),W=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return S(M,W,{fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke),strokeWidth:.5}),j},"bpmn:MessageFlow":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var j=te(E),W=Ye(E),K=Ve(E,s,b.fill),ye=fe(E,c,b.stroke),Ie=_(M,E.waypoints,{markerEnd:d(M,"messageflow-end",K,ye),markerStart:d(M,"messageflow-start",K,ye),stroke:ye,strokeDasharray:"10, 11",strokeWidth:1.5});if(j.get("messageRef")){var Xe=Ie.getPointAtLength(Ie.getTotalLength()/2),Et=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:Xe.x,y:Xe.y}}),nt={strokeWidth:1};W.get("messageVisibleKind")==="initiating"?(nt.fill=K,nt.stroke=ye):(nt.fill=ye,nt.stroke=K);var Ht=S(M,Et,nt),Xt=j.get("messageRef"),ln=Xt.get("name"),et=ae(M,ln,{align:"center-top",fitBox:!0,style:{fill:ye}}),zt=Ht.getBBox(),Zt=et.getBBox(),Wi=Xe.x-Zt.width/2,bn=Xe.y+zt.height/2+pR;Os(et,Wi,bn,0)}return Ie},"bpmn:ParallelGateway":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var j=re(M,E,b),W=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:E.width,containerHeight:E.height,position:{mx:.46,my:.2}});return S(M,W,{fill:fe(E,c,b.stroke),stroke:fe(E,c,b.stroke),strokeWidth:1}),j},"bpmn:Participant":function(M,E,b={}){b=Ke(b,["fill","stroke","width","height"]);var j=q(M,E,b),W=Ue(E),K=qt(E),ye=te(E),Ie=ye.get("name");if(W){var Xe=K?[{x:30,y:0},{x:30,y:An(E,b)}]:[{x:0,y:30},{x:Fn(E,b),y:30}];y(M,Xe,{stroke:fe(E,c,b.stroke),strokeWidth:fR}),Y(M,Ie,E,b)}else{var Et=sa(E,b);K||(Et.height=Fn(E,b),Et.width=An(E,b));var nt=ae(M,Ie,{box:Et,align:"center-middle",style:{fill:aa(E,u,c,b.stroke)}});if(!K){var Ht=-1*An(E,b);Os(nt,0,-Ht,270)}}return ye.get("participantMultiplicity")&&O("ParticipantMultiplicityMarker",M,E,b),j},"bpmn:ReceiveTask":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var j=te(E),W=He(M,E,b),K;return j.get("instantiate")?(h(M,28,28,20*.22,{fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke),strokeWidth:1}),K=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):K=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),S(M,K,{fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke),strokeWidth:1}),W},"bpmn:ScriptTask":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var j=He(M,E,b),W=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return S(M,W,{fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke),strokeWidth:1}),j},"bpmn:SendTask":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var j=He(M,E,b),W=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return S(M,W,{fill:fe(E,c,b.stroke),stroke:Ve(E,s,b.fill),strokeWidth:1}),j},"bpmn:SequenceFlow":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var j=Ve(E,s,b.fill),W=fe(E,c,b.stroke),K=_(M,E.waypoints,{markerEnd:d(M,"sequenceflow-end",j,W),stroke:W}),ye=te(E),{source:Ie}=E;if(Ie){var Xe=te(Ie);ye.get("conditionExpression")&&x(Xe,"bpmn:Activity")&&he(K,{markerStart:d(M,"conditional-flow-marker",j,W)}),Xe.get("default")&&(x(Xe,"bpmn:Gateway")||x(Xe,"bpmn:Activity"))&&Xe.get("default")===ye&&he(K,{markerStart:d(M,"conditional-default-flow-marker",j,W)})}return K},"bpmn:ServiceTask":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var j=He(M,E,b);h(M,10,10,{fill:Ve(E,s,b.fill),stroke:"none",transform:"translate(6, 6)"});var W=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});S(M,W,{fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke),strokeWidth:1}),h(M,10,10,{fill:Ve(E,s,b.fill),stroke:"none",transform:"translate(11, 10)"});var K=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return S(M,K,{fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke),strokeWidth:1}),j},"bpmn:StartEvent":function(M,E,b={}){var{renderIcon:j=!0}=b;b=Ke(b,["fill","stroke"]);var W=te(E);W.get("isInterrupting")||(b={...b,strokeDasharray:"6"});var K=Re(M,E,b);return j&&N(E,M,b),K},"bpmn:SubProcess":function(M,E,b={}){return Ue(E)?b=Ke(b,["fill","stroke","width","height"]):b=Ke(b,["fill","stroke"]),U(M,E,b)},"bpmn:Task":function(M,E,b={}){return b=Ke(b,["fill","stroke"]),He(M,E,b)},"bpmn:TextAnnotation":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var{width:j,height:W}=sa(E,b),K=m(M,j,W,0,0,{fill:"none",stroke:"none"}),ye=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:j,containerHeight:W,position:{mx:0,my:0}});S(M,ye,{stroke:fe(E,c,b.stroke)});var Ie=te(E),Xe=Ie.get("text")||"";return ae(M,Xe,{align:"left-top",box:sa(E,b),padding:mo,style:{fill:aa(E,u,c,b.stroke)}}),K},"bpmn:Transaction":function(M,E,b={}){Ue(E)?b=Ke(b,["fill","stroke","width","height"]):b=Ke(b,["fill","stroke"]);var j=U(M,E,{strokeWidth:1.5,...b}),W=n.style(["no-fill","no-events"],{stroke:fe(E,c,b.stroke),strokeWidth:1.5}),K=Ue(E);return K||(b={}),m(M,Fn(E,b),An(E,b),Bs-Ns,Ns,W),j},"bpmn:UserTask":function(M,E,b={}){b=Ke(b,["fill","stroke"]);var j=He(M,E,b),W=15,K=12,ye=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:W,y:K}});S(M,ye,{fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke),strokeWidth:.5});var Ie=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:W,y:K}});S(M,Ie,{fill:Ve(E,s,b.fill),stroke:fe(E,c,b.stroke),strokeWidth:.5});var Xe=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:W,y:K}});return S(M,Xe,{fill:fe(E,c,b.stroke),stroke:fe(E,c,b.stroke),strokeWidth:.5}),j},label:function(M,E,b={}){return We(M,E,b)}};this._drawPath=S,this._renderer=C}de(Ir,Ti),Ir.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Ir.prototype.canRender=function(e){return x(e,"bpmn:BaseElement")},Ir.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Ir.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Ir.prototype.getShapePath=function(e){return Fe(e)?Pl(e,dR):x(e,"bpmn:Event")?km(e):x(e,"bpmn:Activity")?Pl(e,Bs):x(e,"bpmn:Gateway")?cR(e):uR(e)};function Ke(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var gR=0,yR={width:150,height:50};function vR(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function bR(e){return Vt(e)?H({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var Al=null;function _R(){return Al||(Al=document.createElement("canvas").getContext("2d")),Al}function xR(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(Om(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function Om(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function wR(e,t){var n=_R();if(!n)return{width:0,height:0};n.font=xR(t),"letterSpacing"in n&&(n.letterSpacing=Om(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 ER(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=wR(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return SR(e,r,i,o);r=CR(r,o.width,t)}}function SR(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 Dm="";function RR(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===Dm)&&r.pop();break}var a=r[r.length-1];return a&&a===Dm&&(r[r.length-1]="-"),r.join("")}function CR(e,t,n){var i=Math.max(e.length*(n/t),1),r=RR(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function $s(e){this._config=H({},{size:yR,padding:gR,style:{},align:"center-top"},e||{})}$s.prototype.createText=function(e,t){return this.layoutText(e,t).element},$s.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},$s.prototype.layoutText=function(e,t){for(var n=H({},this._config.size,t.box),i=H({},this._config.style,t.style),r=vR(t.align||this._config.align),o=bR(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=PR(i),c=e.split(/\u00AD?\r?\n/),u=[],l=n.width-o.left-o.right;c.length;)u.push(ER(c,l,i));r.vertical==="middle"&&(o.top=o.bottom=0);var p=Sn(u,function(m,w,y){return m+(s||w.height)},0)+o.top+o.bottom,f=Sn(u,function(m,w,y){return w.width>m?w.width:m},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-p)/2),d-=(s||u[0].height)/4;var g=Ce("text");he(g,i),L(u,function(m){var w;switch(d+=s||m.height,r.horizontal){case"left":w=o.left;break;case"right":w=(a?f:l)-o.right-m.width;break;default:w=Math.max(((a?f:l)-m.width)/2+o.left,0)}var y=Ce("tspan");he(y,{x:w,y:d}),y.textContent=m.text,Be(g,y)});var h={width:f,height:p};return{dimensions:h,element:g}};function PR(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var AR=12,TR=1.2,MR=40;function Lm(e){var t=H({fontFamily:"Arial, sans-serif",fontSize:AR,fontWeight:"normal",lineHeight:TR},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=H({},t,{fontSize:n},e&&e.externalStyle||{}),r=new $s({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Lr.width),height:30},u=o(s,c,{style:i});return{x:Math.round(a.x+a.width/2-u.width/2),y:a.y,width:Math.ceil(u.width),height:Math.ceil(u.height)}},this.getTextAnnotationBounds=function(a,s){var c=o(s,a,{style:t,align:"left-top",padding:mo});return{x:a.x,y:a.y,width:a.width,height:Math.max(MR,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,H({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}Lm.$inject=["config.textRenderer"];function kR(){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=IR(i.d,{mx:r,my:o,e:a});return p}}var OR=/\{([^{}]+)\}/g,DR=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function LR(e,t,n){var i=n;return t.replace(DR,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 IR(e,t){return String(e).replace(OR,function(n,i){return LR(n,i,t)})}const NR={__init__:["bpmnRenderer"],bpmnRenderer:["type",Ir],textRenderer:["type",Lm],pathMap:["type",kR]};function BR(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const ca={translate:["value",BR]};function js(e,t,n){return H({id:e.id,type:e.$type,businessObject:e,di:t},n)}function $R(e,t,n){var i=e.waypoint;return!i||i.length<2?[Oe(t),Oe(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function Im(e,t,n){return new Error(`element ${cn(t)} referenced by ${cn(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(x(t,"bpmndi:BPMNPlane")){var a=x(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(js(e,t,a)),this._canvas.addRootElement(i)}else if(x(t,"bpmndi:BPMNShape")){var s=!Ue(e,t),c=FR(e);r=n&&(n.hidden||n.collapsed);var u=t.bounds;i=this._elementFactory.createShape(js(e,t,{collapsed:s,hidden:r,x:Math.round(u.x),y:Math.round(u.y),width:Math.round(u.width),height:Math.round(u.height),isFrame:c})),x(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),x(e,"bpmn:Lane")&&(o=0),x(e,"bpmn:DataStoreReference")&&(jR(n,Oe(u))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else if(x(t,"bpmndi:BPMNEdge")){var l=this._getSource(e),p=this._getTarget(e);r=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(js(e,t,{hidden:r,source:l,target:p,waypoints:$R(t,l,p)})),x(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${cn(t)} for element ${cn(e)}`);return rr(e)&&Bn(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 ${cn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw Im(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},Di.prototype.addLabel=function(e,t,n){var i,r,o;return i=tR(t,n),r=Bn(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(js(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!Bn(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?Im(e,i,t+"Ref"):new Error(`${cn(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 jR(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 FR(e){return x(e,"bpmn:Group")}const Nm={__depends__:[NR,{__depends__:[ca],bpmnImporter:["type",Di]}]};function ua(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 Tl(e){return Math.log(e)/Math.log(10)}var HR=1e3;function J(e){this._eventBus=e}J.$inject=["eventBus"];function zR(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}J.prototype.on=function(e,t,n,i,r,o){if((Wt(t)||Le(t))&&(o=r,r=i,i=n,n=t,t=null),Wt(n)&&(o=r,r=i,i=n,n=HR),Vt(r)&&(o=r,r=!1),!Wt(i))throw new Error("handlerFn must be a function");ke(e)||(e=[e]);var a=this._eventBus;L(e,function(s){var c=["commandStack",s,t].filter(function(u){return u}).join(".");a.on(c,n,r?zR(i,o):i,o)})},J.prototype.canExecute=Li("canExecute"),J.prototype.preExecute=Li("preExecute"),J.prototype.preExecuted=Li("preExecuted"),J.prototype.execute=Li("execute"),J.prototype.executed=Li("executed"),J.prototype.postExecute=Li("postExecute"),J.prototype.postExecuted=Li("postExecuted"),J.prototype.revert=Li("revert"),J.prototype.reverted=Li("reverted");function Li(e){return function(n,i,r,o,a){(Wt(n)||Le(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var Ml=["top","bottom","left","right"],Fs=10;function kl(e,t){J.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(Is(r)&&!st(r)){var o=WR(r);o&&i(r,o)}}function i(r,o){var a=Oe(r),s=r.label,c=Oe(s);if(s.parent){var u=Pe(r),l;switch(o){case"top":l={x:a.x,y:u.top-Fs-s.height/2};break;case"left":l={x:u.left-Fs-s.width/2,y:a.y};break;case"bottom":l={x:a.x,y:u.bottom+Fs+s.height/2};break;case"right":l={x:u.right+Fs+s.width/2,y:a.y};break}var p=ni(l,c);t.moveShape(s,p)}}}de(kl,J),kl.$inject=["eventBus","modeling"];function GR(e){var t=e.host,n=Oe(e),i=Jt(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=Ml.filter(function(a){return r.indexOf(a)===-1});return o}function VR(e){var t=Oe(e),n=[].concat(e.incoming.map(function(i){return i.waypoints[i.waypoints.length-2]}),e.outgoing.map(function(i){return i.waypoints[1]})).map(function(i){return Bm(t,i)});return n}function WR(e){var t=Oe(e.label),n=Oe(e),i=Bm(n,t);if(UR(i)){var r=VR(e);if(e.host){var o=GR(e);r=r.concat(o)}var a=Ml.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?Jt(e.label,e)!=="intersect"?void 0:i:a[0]}}function Bm(e,t){return Jt(t,e,5)}function UR(e){return Ml.indexOf(e)!==-1}function Ol(e){J.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(x(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)}de(Ol,J),Ol.$inject=["eventBus"];var qR=1500;function Dl(e,t,n){e.invoke(J,this),this.preExecute("elements.delete",qR,function(r){var o=r.context,a=o.elements,s=i(a);s.length&&(o.elements=a.concat(s))}),t.on("shape.move.start",function(r){var o=r.context.shapes,a=i(o);a.length&&(r.context.shapes=o.concat(a))});function i(r){var o=Ge(r,u=>x(u,"bpmn:Participant")||x(u,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(u=>x(u,"bpmn:Artifact"))),c=new Set;return L(o,u=>{const l=new Set(Jr(uo(Array.from(s),Tt(u))));c=c.union(l),s=s.difference(l)}),Array.from(c)}}de(Dl,J),Dl.$inject=["injector","eventBus","canvas"];function Ll(e,t){e.invoke(J,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=Ge(r.incoming.concat(r.outgoing),function(a){return x(a,"bpmn:Association")});L(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}de(Ll,J),Ll.$inject=["injector","modeling"];function yo(e,t){for(wn(t)&&(t=[t]);e=e.parent;)if(ze(e,t))return e;return null}function $m(e,t){var n=yo(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=yo(e,i),n)return qt(n);if(ze(e,i))return qt(e);var r;for(r=te(e);r&&!x(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find(function(a){var s=te(a);return s&&s.get("processRef")===r});return o?qt(o):!0}var jm=500;function Hs(e,t){t.invoke(J,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",jm,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return Fm(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",jm,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];Fm(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}Hs.$inject=["bpmnReplace","injector"],de(Hs,J),Hs.prototype._replaceShape=function(e,t){var n=YR(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function YR(e){var t=te(e),n=t.eventDefinitions;return n&&n[0]}function Fm(e,t){return!Fe(e)&&ze(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function Il(e,t){J.call(this,e);function n(i){return Ge(i.attachers,function(r){return x(r,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var r=i.context.source,o=i.context.target,a=n(o);x(r,"bpmn:EventBasedGateway")&&x(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var r=i.context.oldSource,o=i.context.newSource;x(r,"bpmn:Gateway")&&x(o,"bpmn:EventBasedGateway")&&L(o.outgoing,function(a){var s=a.target,c=n(s);x(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}Il.$inject=["eventBus","modeling"],de(Il,J);function Hm(e){return e.create("bpmn:Category")}function KR(e){return e.create("bpmn:CategoryValue")}function zm(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=KR(e)),n.$parent||(n.$parent=Hm(e)),n}function XR(e,t,n){return Pt(t.get("categoryValue"),e),e.$parent=t,Pt(n.get("rootElements"),t),t.$parent=n,e}function ZR(e){var t=e.$parent;return t&&(Rt(t.get("categoryValue"),e),e.$parent=null),e}function QR(e){var t=e.$parent;return t&&(Rt(t.get("rootElements"),e),e.$parent=null),e}var JR=500;function Nl(e,t,n){n.invoke(J,this);function i(c){return t.filter(function(u){return x(u,"bpmn:Group")&&!u.labelTarget}).map(te).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&&XR(c,u,e.getDefinitions())}function s(c,u,l){u&&!o(u,l)&&QR(u),c&&!r(c,l)&&ZR(c)}this.executed(["shape.create","label.create"],function(c){var u=c.labelTarget||c.shape;!x(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;!x(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,te(u))},!0),this.executed(["shape.move","shape.resize"],JR,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,te(u))},!0),this.executed("group.updateRefs",function(c){Gm(c).forEach(function(u){a(u.categoryValue,u.category)})},!0),this.reverted("group.updateRefs",function(c){Gm(c).forEach(function(u){s(u.categoryValue,u.category,te(u.groupShape))})},!0),this.executed("shape.delete",function(c){var u=c.shape;!x(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,te(u))},!0),this.reverted("shape.delete",function(c){var u=c.shape;!x(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0)}Nl.$inject=["bpmnjs","elementRegistry","injector"],de(Nl,J);function Gm(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function Bl(e,t,n){J.call(this,e),this.preExecute("shape.replace",s,!0),this.postExecuted("shape.replace",c,!0),this.preExecute("connection.create",r,!0),this.postExecuted("connection.delete",i,!0),this.postExecuted("connection.reconnect",o,!0),this.postExecuted("element.updateProperties",a,!0);function i(m){const w=m.source,y=m.target;vo(w)&&la(y)&&l(y)}function r(m){const w=m.connection,y=m.source,_=m.target;vo(y)&&zs(_)&&(u(_),f(y,[w]))}function o(m){const w=m.newTarget,y=m.oldSource,_=m.oldTarget;if(_!==w){const S=y;la(_)&&l(_),vo(S)&&zs(w)&&u(w)}}function a(m){const{element:w}=m;la(w)?(p(w),d(w)):zs(w)&&g(w)}function s(m){const{newData:w,oldShape:y}=m;if(vo(m.oldShape)&&w.eventDefinitionType!=="bpmn:CompensateEventDefinition"||w.type!=="bpmn:BoundaryEvent"){const _=y.outgoing.find(({target:S})=>la(S));_&&_.target&&(m._connectionTarget=_.target)}else if(!vo(m.oldShape)&&w.eventDefinitionType==="bpmn:CompensateEventDefinition"&&w.type==="bpmn:BoundaryEvent"){const _=y.outgoing.find(({target:S})=>zs(S));_&&_.target&&(m._connectionTarget=_.target),h(y)}}function c(m){const{_connectionTarget:w,newShape:y}=m;w&&t.connect(y,w)}function u(m){t.updateProperties(m,{isForCompensation:!0})}function l(m){t.updateProperties(m,{isForCompensation:void 0})}function p(m){for(const w of m.incoming)n.canConnect(w.source,m)||t.removeConnection(w);for(const w of m.outgoing)n.canConnect(m,w.target)||t.removeConnection(w)}function f(m,w){m.outgoing.filter(S=>x(S,"bpmn:Association")).filter(S=>la(S.target)&&!w.includes(S)).forEach(S=>t.removeConnection(S))}function d(m){const w=m.attachers.slice();w.length&&t.removeElements(w)}function g(m){const w=m.incoming.filter(y=>vo(y.source));t.removeElements(w)}function h(m){const w=m.outgoing.filter(y=>x(y,"bpmn:SequenceFlow"));t.removeElements(w)}}de(Bl,J),Bl.$inject=["eventBus","modeling","bpmnRules"];function la(e){const t=te(e);return t&&t.get("isForCompensation")}function vo(e){return e&&x(e,"bpmn:BoundaryEvent")&&ho(e,"bpmn:CompensateEventDefinition")}function zs(e){return e&&x(e,"bpmn:Activity")&&!un(e)}function $l(e){e.invoke(J,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,r=n.shape;x(i,"bpmn:Lane")&&!x(r,"bpmn:Lane")&&(n.parent=yo(i,"bpmn:Participant"))})}$l.$inject=["injector"],de($l,J);function jl(e,t){J.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,r=i.shape;if(x(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}})}jl.$inject=["eventBus","bpmnFactory"],de(jl,J);var Fl=20,Hl=20,Vm=30,Gs=2e3;function zl(e,t,n){J.call(this,t),t.on(["create.start","shape.move.start"],Gs,function(r){var o=r.context,a=o.shape,s=e.getRootElement();if(!(!x(a,"bpmn:Participant")||!x(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(p){return!x(p,"bpmn:Group")&&!Fe(p)&&!st(p)});if(c.length){var u=Tt(c),l=eC(a,u);H(a,l),o.createConstraints=tC(a,u)}}}),t.on("create.start",Gs,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}x(a,"bpmn:Participant")&&x(s,"bpmn:Process")&&(t.on("element.hover",Gs,u),t.once("create.cleanup",function(){t.off("element.hover",u)}))});function i(){var r=e.getRootElement();return x(r,"bpmn:Collaboration")?r:n.makeCollaboration()}this.preExecute("elements.create",Gs,function(r){var o=r.elements,a=r.parent,s=nC(o),c;s&&x(a,"bpmn:Process")&&(r.parent=i(),c=r.hints=r.hints||{},c.participant=s,c.process=a,c.processRef=te(s).get("processRef"))},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;x(a,"bpmn:Participant")&&x(o,"bpmn:Process")&&(r.parent=i(),r.process=o,r.processRef=te(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)&&te(s).set("processRef",te(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)&&te(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)}zl.$inject=["canvas","eventBus","modeling"],de(zl,J);function eC(e,t){t={width:t.width+Fl*2+Vm,height:t.height+Hl*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 tC(e,t){return t=Pe(t),{bottom:t.top+e.height/2-Hl,left:t.right-e.width/2+Fl,top:t.bottom-e.height/2+Hl,right:t.left+e.width/2-Fl-Vm}}function nC(e){return lt(e,function(t){return x(t,"bpmn:Participant")})}var Wm="__targetRef_placeholder";function Gl(e,t){J.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],Um(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],Um(o));function n(a,s,c){var u=a.get("dataInputAssociations");return lt(u,function(l){return l!==c&&l.targetRef===s})}function i(a,s){var c=a.get("properties"),u=lt(c,function(l){return l.name===Wm});return!u&&s&&(u=t.create("bpmn:Property",{name:Wm}),Pt(c,u)),u}function r(a,s){var c=i(a);c&&(n(a,c,s)||Rt(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,g=s.oldTarget||s.target,h=g&&g.businessObject,m=c.businessObject,w;h&&h!==p&&r(h,u),d&&d!==p&&r(d,u),p?(w=i(p,!0),m.targetRef=w):m.targetRef=null}}Gl.$inject=["eventBus","bpmnFactory"],de(Gl,J);function Um(e){return function(t){var n=t.context,i=n.connection;if(x(i,"bpmn:DataInputAssociation"))return e(t)}}function Vs(e){this._bpmnUpdater=e}Vs.$inject=["bpmnUpdater"],Vs.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),[]},Vs.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 Vl(e,t,n,i){J.call(this,i),t.registerHandler("dataStore.updateContainment",Vs);function r(){return n.filter(function(s){return x(s,"bpmn:Participant")&&te(s).processRef})[0]}function o(s){return s.children.filter(function(c){return x(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:Ye(s),newSemanticParent:l.processRef||l,newDiParent:Ye(c)})}}this.preExecute("shape.create",function(s){var c=s.context,u=c.shape;x(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 x(p,"bpmn:DataStoreReference")});l.length&&(c.hints||(c.hints={}),c.hints.autoResize=u.filter(function(p){return!x(p,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,u=c.shape,l=u.parent;x(u,"bpmn:DataStoreReference")&&u.type!=="label"&&x(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(!x(l,"bpmn:Collaboration")&&x(u,"bpmn:DataStoreReference")&&u.type!=="label"&&x(p,"bpmn:Collaboration")){var f=x(l,"bpmn:Participant")?l:rC(l,"bpmn:Participant");a(u,f)}}),this.postExecute("shape.delete",function(s){var c=s.context,u=c.shape,l=e.getRootElement();ze(u,["bpmn:Participant","bpmn:SubProcess"])&&x(l,"bpmn:Collaboration")&&o(l).filter(function(p){return iC(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){x(l,"bpmn:Process")&&a(f,l)})})}Vl.$inject=["canvas","commandStack","elementRegistry","eventBus"],de(Vl,J);function iC(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 rC(e,t){for(;e.parent;){if(x(e.parent,t))return e.parent;e=e.parent}}var Ws=Math.max,Us=Math.min,oC=20;function qm(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function aC(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 sC(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 qs(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return Le(r)&&(i=(/top|left/.test(e)?Us:Ws)(i,r)),Le(o)&&(i=(/top|left/.test(e)?Ws:Us)(i,o)),i}function cC(e,t){if(!t)return e;var n=Pe(e);return Ts({top:qs("top",n,t),right:qs("right",n,t),bottom:qs("bottom",n,t),left:qs("left",n,t)})}function uC(e,t,n,i){var r=Pe(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?Pe(i):o,s={top:Us(o.top,a.top),left:Us(o.left,a.left),bottom:Ws(o.bottom,a.bottom),right:Ws(o.right,a.right)};return Ts(s)}function pa(e,t){return typeof e<"u"?e:oC}function lC(e,t){var n,i,r,o;return typeof t=="object"?(n=pa(t.left),i=pa(t.right),r=pa(t.top),o=pa(t.bottom)):n=i=r=o=pa(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function pC(e){return!(e.waypoints||e.type==="label")}function Ym(e,t){var n;if(e.length===void 0?n=Ge(e.children,pC):n=e,n.length)return lC(Tt(n),t)}var or=Math.abs;function fC(e,t){return qm(Pe(t),Pe(e))}var dC=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Hn=30;function Ys(e,t){return t=t||[],e.children.filter(function(n){x(n,"bpmn:Lane")&&(Ys(n,t),t.push(n))}),t}function ar(e){return e.children.filter(function(t){return x(t,"bpmn:Lane")})}function zn(e){return yo(e,dC)||e}function hC(e,t){var n=zn(e),i=x(n,"bpmn:Process")?[]:[n],r=Ys(n,i),o=Pe(e),a=Pe(t),s=fC(e,t),c=[],u=qt(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,g=u?s.left:0,h=Pe(l);s.top&&(or(h.bottom-o.top)<10&&(d=a.top-h.bottom),or(h.top-o.top)<5&&(p=a.top-h.top)),s.left&&(or(h.right-o.left)<10&&(f=a.left-h.right),or(h.left-o.left)<5&&(g=a.left-h.left)),s.bottom&&(or(h.top-o.bottom)<10&&(p=a.bottom-h.top),or(h.bottom-o.bottom)<5&&(d=a.bottom-h.bottom)),s.right&&(or(h.left-o.right)<10&&(g=a.right-h.left),or(h.right-o.right)<5&&(f=a.right-h.right)),(p||f||d||g)&&c.push({shape:l,newBounds:sC(l,{top:p,right:f,bottom:d,left:g})})}}),c}var mC=500;function Wl(e,t){J.call(this,e);function n(i,r){var o=qt(i),a=ar(r),s=[],c=[],u=[],l=[];if(Or(a,function(m){return o?m.y>i.y?c.push(m):s.push(m):m.x>i.x?l.push(m):u.push(m),m.children}),!!a.length){var 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,g,h;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&&(g=t.calculateAdjustments(u,"x",p,i.x-10),t.makeSpace(g.movingShapes,g.resizingShapes,{x:p,y:0},"e")),l.length&&(h=t.calculateAdjustments(l,"x",-p,i.x+i.width+10),t.makeSpace(h.movingShapes,h.resizingShapes,{x:-p,y:0},"w"))}}this.postExecuted("shape.delete",mC,function(i){var r=i.context,o=r.hints,a=r.shape,s=r.oldParent;x(a,"bpmn:Lane")&&(o&&o.nested||n(a,s))})}Wl.$inject=["eventBus","spaceTool"],de(Wl,J);var Km=500;function Ks(e,t){t.invoke(J,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Km,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return Xm(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",Km,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;Xm(a,yC(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}Ks.$inject=["bpmnReplace","injector"],de(Ks,J),Ks.prototype._replaceShape=function(e){var t=gC(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function gC(e){var t=te(e),n=t.eventDefinitions;return n&&n[0]}function Xm(e,t){return!Fe(e)&&x(e,"bpmn:BoundaryEvent")&&!t}function yC(e,t){return e.indexOf(t)!==-1}var Xs=Math.round,vC=Math.max;function bC(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 _C(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var Zm=10;function xC(e,t){var n,i;for(n=0;i=e[n];n++)if(ta(i,t)<=Zm)return{point:e[n],bendpoint:!0,index:n};return null}function wC(e,t){var n=nm(bC(t,Zm),_C(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=vC(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:Xs(i.x+r.x)/2,y:Xs(i.y+r.y)/2},index:i.segment2}:{point:{x:Xs(i.x),y:Xs(i.y)},index:i.segment2}:null}function Ul(e,t){return xC(e,t)||wC(e,t)}function ql(e,t,n){J.call(this,e);function i(r,o,a){var s=o.waypoints,c,u,l,p,f,d,g,h=r.outgoing.slice(),m=r.incoming.slice(),w;Le(a.width)?w=Oe(a):w=a;var y=Ul(s,w);if(y){if(c=s.slice(0,y.index),u=s.slice(y.index+(y.bendpoint?1:0)),!c.length||!u.length)return;l=y.bendpoint?s[y.index]:w,(c.length===1||!Qm(r,c[c.length-1]))&&c.push(Jm(l)),(u.length===1||!Qm(r,u[0]))&&u.unshift(Jm(l))}p=o.source,f=o.target,t.canConnect(p,r,o)&&(n.reconnectEnd(o,r,c||w),d=o),t.canConnect(r,f,o)&&(d?g=n.connect(r,f,{type:o.type,waypoints:u}):(n.reconnectStart(o,r,u||w),g=o));var _=[].concat(d&&Ge(m,function(S){return S.source===d.source})||[],g&&Ge(h,function(S){return S.target===g.target})||[]);_.length&&n.removeElements(_)}this.preExecute("elements.move",function(r){var o=r.newParent,a=r.shapes,s=r.delta,c=a[0];if(!(!c||!o)){o&&o.waypoints&&(r.newParent=o=o.parent);var u=Oe(c),l={x:u.x+s.x,y:u.y+s.y},p=lt(o.children,function(f){var d=t.canInsert(a,f);return d&&Ul(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)}de(ql,J),ql.$inject=["eventBus","bpmnRules","modeling"];function Qm(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 Jm(e){return H({},e)}function Yl(e,t){J.call(this,e),this.preExecuted("connection.create",function(n){var i=n.context,r=i.connection,o=i.source,a=i.target,s=i.hints;if(!(s&&s.createElementsBehavior===!1)&&bo(r)){var c=[];x(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(u=>u!==r&&bo(u)):c=a.incoming.filter(u=>u!==r&&bo(u)&&x(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(x(r,"bpmn:EventBasedGateway")){var o=r.outgoing.filter(bo).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(bo).forEach(function(s){const c=a.incoming.filter(bo).filter(function(u){return u.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}Yl.$inject=["eventBus","modeling"],de(Yl,J);function bo(e){return x(e,"bpmn:SequenceFlow")}var Zs=1500,eg=2e3;function tg(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"],Zs,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;x(a,"bpmn:Lane")&&!ze(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=zn(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||ze(o,["bpmn:Group","bpmn:TextAnnotation"]))&&(i.hover=s,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.hover","connect.out","connect.end","connect.cleanup","global-connect.hover","global-connect.out","global-connect.end","global-connect.cleanup"],Zs,function(i){var r=i.hover;x(r,"bpmn:Lane")&&(i.hover=zn(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Zs,function(i){var r=i.context,o=i.hover,a=r.type;x(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=zn(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Zs,function(i){var r=i.context,o=r.start;x(o,"bpmn:Lane")&&(r.start=zn(o)||o)}),t.on("shape.move.start",eg,function(i){var r=i.shape;x(r,"bpmn:Lane")&&(i.shape=zn(r)||r)}),t.on("spaceTool.move",eg,function(i){var r=i.hover;r&&x(r,"bpmn:Lane")&&(i.hover=zn(r))})}tg.$inject=["elementRegistry","eventBus","canvas"];var ng=770;function Kl(e,t,n,i){n.invoke(J,this);function r(s,c){var u=te(s),l=c.categoryValue||u.categoryValueRef;l||(l=zm(e,u));var p=c.category||l.$parent||Hm(e);u.categoryValueRef=l,l.$parent=p,c.categoryValue=l,c.category=p}function o(s,c){var u=te(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;x(u,"bpmn:Group")&&r(u,c)}),this.revert("label.create",function(s){var c=s.context,u=c.labelTarget;x(u,"bpmn:Group")&&o(u,c)}),this.execute("shape.delete",function(s){var c=s.context,u=c.shape,l=te(u);if(!(!x(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(!(!x(u,"bpmn:Group")||u.labelTarget)){var l=c.category,p=c.categoryValue,f=te(u);p&&(f.categoryValueRef=p,p.$parent=l)}}),this.execute("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!x(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!te(u).categoryValueRef&&!c.categoryValue||r(u,c)}),this.reverted("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!x(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!te(u).categoryValueRef&&!c.categoryValue||o(u,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!x(u,"bpmn:Group")||u.labelTarget||te(u).categoryValueRef||r(u,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!x(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",ng,function(s){var c=s.descriptor,u=s.element;if(!(!x(u,"bpmn:Group")||u.labelTarget)){var l=te(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",ng,function(s){var c=s.descriptor,u=c.businessObject,l=c.categoryValue,p=c.category;l&&(l=u.categoryValueRef=a(l)),p&&(l.$parent=a(p)),delete c.category,delete c.categoryValue})}Kl.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],de(Kl,J);function Xl(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 ig(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=Xl(i,r,o,a),u=Xl(i,r,o,s),l;c&&u?rg(c,o)>rg(u,o)?l=u:l=c:l=c||u,i.original=l}function n(i){var r=i.waypoints;t(r[0],r[1],Oe(i.source)),t(r[r.length-1],r[r.length-2],Oe(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}ig.$inject=["eventBus"];function rg(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Zl(e){J.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=te(i),o=Ye(i);if(ze(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}Zl.$inject=["eventBus"],de(Zl,J);function og(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function ag(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function EC(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 SC(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 Ql(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=SC([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 sg(e,t){var n=Ql(e,t),i={x:n.x-e.x,y:n.y-e.y};return og(i)}function fa(e,t){return og({x:e.x-t.x,y:e.y-t.y})}var cg=Math.sqrt,ug=Math.min,RC=Math.max,lg=Math.abs;function pg(e){return Math.pow(e,2)}function da(e,t){return cg(pg(e.x-t.x)+pg(e.y-t.y))}function CC(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],dg(i,r)?u=[i]:(o=da(e,i),a=da(e,r),c=ug(o,a),u=PC(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:dg(i,u[0])?n:n+1}),u.length===2&&(s=TC(u[0],u[1]),l={type:"segment",position:s,segmentIndex:n,relativeLocation:da(i,s)/da(i,r)}),p=da(l.position,e),(!d||f>p)&&(d=l,f=p)}return d}function PC(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 g=cg(d),h=-p+g,m=-p-g,w={x:e.x-r*h,y:e.y-o*h};if(d===0)return[w];var y={x:e.x-r*m,y:e.y-o*m};return[w,y].filter(function(_){return AC(_,e,t)})}function AC(e,t,n){return fg(e.x,t.x,n.x)&&fg(e.y,t.y,n.y)}function fg(e,t,n){return e>=ug(t,n)-Qs&&e<=RC(t,n)+Qs}function TC(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Qs=.1;function dg(e,t){return lg(e.x-t.x)<=Qs&&lg(e.y-t.y)<=Qs}function MC(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=mg(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 hg(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=CC(e,n),c=s.segmentIndex,u=MC(n,t,s,i);if(u<0||u>t.length-2||u===null)return a;var l=gg(n,c),p=gg(t,u),f=s.position,d=OC(l,f),g=kC(l,p);if(s.type==="bendpoint"){var h=t.length-n.length,m=s.bendpointIndex,w=n[m];if(t.indexOf(w)!==-1)return a;if(h===0){var y=t[m];return r=y.x-s.position.x,o=y.y-s.position.y,{delta:{x:r,y:o},point:{x:e.x+r,y:e.y+o}}}h<0&&m!==0&&m<n.length-1&&(d=mg(n,m))}var _={x:(p[1].x-p[0].x)*d+p[0].x,y:(p[1].y-p[0].y)*d+p[0].y},S=EC({x:e.x-f.x,y:e.y-f.y},g);return r=_.x+S.x-e.x,o=_.y+S.y-e.y,{point:ki(_),delta:ki({x:r,y:o})}}function mg(e,t){var n=fa(e[t-1],e[t]),i=fa(e[t],e[t+1]),r=n/(n+i);return r}function kC(e,t){var n=ag(e),i=ag(t);return i-n}function gg(e,t){return[e[t],e[t+1]]}function OC(e,t){var n=fa(e[0],e[1]),i=fa(e[0],t);return n===0?0:i/n}function DC(e,t,n,i){var r=Oe(e);return hg(r,t,n,i).delta}function ha(e,t,n){var i=ua(t),r=ua(n),o=ni(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return ki({x:r.x+a.x,y:r.y+a.y})}function yg(e,t,n){var i=ua(e),r=ua(t),o=ua(n),a=ni(e,i),s=ni(i,r),c=LC(i,t,n);if(c)return c;var u={x:s.x*(n.width/t.width),y:s.y*(n.height/t.height)},l={x:o.x+u.x,y:o.y+u.y};return ki({x:l.x+a.x-e.x,y:l.y+a.y-e.y})}function LC(e,t,n){var i=Pe(t),r=Pe(n);if(IC(i,r))return null;var o=Jt(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=Jt(n,s),c!==o?null:a}function IC(e,t){return NC(e,t)||BC(e,t)}function NC(e,t){return e.right!==t.right&&e.left!==t.left}function BC(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var vg="name",bg="text";function Jl(e,t,n,i){J.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{te(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var s=a.context,c=s.element,u=s.properties;if(vg in u&&t.updateLabel(c,u[vg]),bg in u&&x(c,"bpmn:TextAnnotation")){var l=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},u[bg]||"");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;Fe(u)||!rr(u)||Bn(u)&&t.updateLabel(u,Bn(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=H({},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),DC(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=te(c);l&&rr(l)&&u.label&&c.label&&(c.label.x=u.label.x,c.label.y=u.label.y)}),this.preExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.hints||{};if(!(!Fe(c)||u.autoResize)){var l=s.newBounds,p=i.getDimensions(Bn(c)||"",{box:l,style:i.getExternalStyle()}),f=Math.ceil(p.height),d=l.y!==c.y,g=c.y+c.height;s.newBounds={width:l.width,height:f,x:l.x,y:d?g-f:l.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.newBounds,l=s.oldBounds;if(Is(c)){var p=c.label,f=Oe(p),d=FC(l),g=jC(f,d),h=$C(g,l,u);t.moveShape(p,h)}})}de(Jl,J),Jl.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function $C(e,t,n){var i=ha(e,t,n);return ki(ni(i,e))}function jC(e,t){if(t.length){var n=HC(e,t);return Ql(e,n)}}function FC(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 HC(e,t){var n=t.map(function(r){return{line:r,distance:sg(e,r)}}),i=ai(n,"distance");return i[0].line}function zC(e,t,n,i){return hg(e,t,n,i).point}function ep(e,t){J.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=H({},o.hints),c=o.newWaypoints||a.waypoints,u=o.oldWaypoints;return typeof s.startChanged>"u"&&(s.startChanged=!!s.connectionStart),typeof s.endChanged>"u"&&(s.endChanged=!!s.connectionEnd),zC(r,c,u,s)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming;s.forEach(function(c){var u=c.waypoints[c.waypoints.length-1],l=n(i,u),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)})})}de(ep,J),ep.$inject=["eventBus","modeling"];function Js(e,t,n){var i=tc(e),r=xg(i,t),o=i[0];return r.length?r[r.length-1]:ha(o.original||o,n,t)}function ec(e,t,n){var i=tc(e),r=xg(i,t),o=i[i.length-1];return r.length?r[0]:ha(o.original||o,n,t)}function tp(e,t,n){var i=tc(e),r=_g(t,n),o=i[0];return ha(o.original||o,r,t)}function np(e,t,n){var i=tc(e),r=_g(t,n),o=i[i.length-1];return ha(o.original||o,r,t)}function _g(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function tc(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function xg(e,t){var n=on(e,VC);return Ge(n,function(i){return GC(i,t)})}function GC(e,t){return Jt(t,e,1)==="intersect"}function VC(e){return e.original||e}function ip(e,t){J.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(WC(i,r)){var o=UC(i);o.incoming.forEach(function(a){var s=ec(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=Js(a,r,i);t.reconnectStart(a,r,s)})}},!0)}ip.$inject=["eventBus","modeling"],de(ip,J);function WC(e,t){return x(e,"bpmn:Participant")&&Ue(e)&&x(t,"bpmn:Participant")&&!Ue(t)}function UC(e){var t=Jo([e]),n=[],i=[];return t.forEach(function(r){r!==e&&(r.incoming.forEach(function(o){x(o,"bpmn:MessageFlow")&&n.push(o)}),r.outgoing.forEach(function(o){x(o,"bpmn:MessageFlow")&&i.push(o)}))},[]),{incoming:n,outgoing:i}}const qC=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function wg(e){const t=te(e);if(!x(t,"bpmn:BoundaryEvent")&&!(x(t,"bpmn:StartEvent")&&un(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:qC.some(i=>x(n[0],i))}function Eg(e){return x(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function rp(e,t){e.invoke(J,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!wg(r))return;const a=Eg(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=te(i).get(a),u=te(r).get(a);c!==u&&t.updateProperties(r,{[a]:c})})}rp.$inject=["injector","modeling"],de(rp,J);function op(e,t){J.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=Ye(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}de(op,J),op.$inject=["eventBus","modeling"];function ap(e,t,n){J.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(!(!x(o,"bpmn:SequenceFlow")||!x(a,"bpmn:SequenceFlow"))&&t.canConnect(o.source,a.target,o)){var s=YC(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}de(ap,J),ap.$inject=["eventBus","bpmnRules","modeling"];function _o(e){return e.original||e}function YC(e,t){var n=Xl(_o(e[e.length-2]),_o(e[e.length-1]),_o(t[1]),_o(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[_o(e[0]),_o(t[t.length-1])]}function sp(e,t){J.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,r=i.parent;x(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)}sp.$inject=["eventBus","modeling"],de(sp,J);function cp(e,t,n,i){J.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;x(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(u,l)||(d=!0),n.canConnectMessageFlow(u,l)&&(f="bpmn:MessageFlow")),x(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,g;d=n.canConnect(p,f),!(!d||d.type===l.type)&&(g=t.connect(p,f,{type:d.type,associationDirection:d.associationDirection,waypoints:l.waypoints.slice()}),l.parent&&t.removeConnection(l),u.connection=g,r&&s(l,g))}function s(c,u){var l=r.context(),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;L(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=lt(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})})}de(cp,J),cp.$inject=["eventBus","modeling","bpmnRules","injector"];function nc(e,t,n,i,r,o){i.invoke(J,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,function(a){var s=a.context,c=s.parent,u=s.elements,l=Sn(u,function(p,f){var d=t.canReplace([f],f.host||f.parent||c);return d?p.concat(d.replacements):p},[]);l.length&&this._replaceElements(u,l)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,u=s.newHost,l=[];L(s.closure.topLevel,function(f){un(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})})}de(nc,J),nc.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;L(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)},nc.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var KC=1500,XC={width:140,height:120},up={width:300,height:60},lp={width:60,height:300},ic={width:300,height:150},rc={width:150,height:300},Sg={width:140,height:120},Rg={width:100,height:40};function Cg(e){e.on("resize.start",KC,function(t){var n=t.context,i=n.shape,r=n.direction,o=n.balanced;(x(i,"bpmn:Lane")||x(i,"bpmn:Participant"))&&(n.resizeConstraints=tP(i,r,o)),x(i,"bpmn:SubProcess")&&Ue(i)&&(n.minDimensions=Sg),x(i,"bpmn:TextAnnotation")&&(n.minDimensions=Rg)})}Cg.$inject=["eventBus"];var sr=Math.abs,ZC=Math.min,QC=Math.max;function Pg(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function xo(e,t,n){return Pg(e,t,n,ZC)}function wo(e,t,n){return Pg(e,t,n,QC)}var JC={top:20,left:50,right:20,bottom:20},eP={top:50,left:20,right:20,bottom:20};function tP(e,t,n){var i=zn(e),r=!0,o=!0,a=Ys(i,[i]),s=Pe(e),c={},u={},l=qt(e),p=l?up:lp;/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(g){var h=Pe(g);l?(h.top<s.top-10&&(r=!1),h.bottom>s.bottom+10&&(o=!1)):(h.left<s.left-10&&(r=!1),h.right>s.right+10&&(o=!1)),/n/.test(t)&&(n&&sr(s.top-h.bottom)<10&&wo(c,"top",h.top+p.height),sr(s.top-h.top)<5&&xo(u,"top",h.bottom-p.height)),/e/.test(t)&&(n&&sr(s.right-h.left)<10&&xo(c,"right",h.right-p.width),sr(s.right-h.right)<5&&wo(u,"right",h.left+p.width)),/s/.test(t)&&(n&&sr(s.bottom-h.top)<10&&xo(c,"bottom",h.bottom-p.height),sr(s.bottom-h.bottom)<5&&wo(u,"bottom",h.top+p.height)),/w/.test(t)&&(n&&sr(s.left-h.right)<10&&wo(c,"left",h.left+p.width),sr(s.left-h.left)<5&&xo(u,"left",h.right-p.width))});var f=i.children.filter(function(g){return!g.hidden&&!g.waypoints&&(x(g,"bpmn:FlowElement")||x(g,"bpmn:Artifact"))}),d=l?JC:eP;return f.forEach(function(g){var h=Pe(g);/n/.test(t)&&(!l||r)&&xo(u,"top",h.top-d.top),/e/.test(t)&&(l||o)&&wo(u,"right",h.right+d.right),/s/.test(t)&&(!l||o)&&wo(u,"bottom",h.bottom+d.bottom),/w/.test(t)&&(l||r)&&xo(u,"left",h.left-d.left)}),{min:u,max:c}}function Ag(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function Eo(e){return e.originalEvent||e.srcEvent}function pp(e){Ag(e),Ag(Eo(e))}function Nr(e){return e.pointers&&e.pointers.length&&(e=e.pointers[0]),e.touches&&e.touches.length&&(e=e.touches[0]),e?{x:e.clientX,y:e.clientY}:null}function Tg(){return/mac/i.test(navigator.platform)}function Mg(e,t){return(Eo(e)||e).button===t}function cr(e){return Mg(e,0)}function nP(e){return Mg(e,1)}function ma(e){var t=Eo(e)||e;return cr(e)?Tg()?t.metaKey:t.ctrlKey:!1}function oc(e){var t=Eo(e)||e;return cr(e)&&t.shiftKey}var kg=1001;function Og(e,t){e.on("resize.start",kg+500,function(n){var i=n.context,r=i.shape;(x(r,"bpmn:Lane")||x(r,"bpmn:Participant"))&&(i.balanced=!ma(n))}),e.on("resize.end",kg,function(n){var i=n.context,r=i.shape,o=i.canExecute,a=i.newBounds;if(x(r,"bpmn:Lane")||x(r,"bpmn:Participant"))return o&&(a=sm(a),t.resizeLane(r,a,i.balanced)),!1})}Og.$inject=["eventBus","modeling"];var iP=500;function fp(e,t,n,i,r){n.invoke(J,this);function o(l){return ze(l,["bpmn:ReceiveTask","bpmn:SendTask"])||rP(l,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(l){var p=e.getDefinitions(),f=p.get("rootElements");return!!lt(f,to({id:l.id}))}function s(l){if(x(l,"bpmn:ErrorEventDefinition"))return"errorRef";if(x(l,"bpmn:EscalationEventDefinition"))return"escalationRef";if(x(l,"bpmn:MessageEventDefinition"))return"messageRef";if(x(l,"bpmn:SignalEventDefinition"))return"signalRef"}function c(l){if(ze(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(ze(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=te(p),d=c(f),g;d&&!a(d)&&(g=e.getDefinitions().get("rootElements"),Pt(g,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");Rt(f,p)}},!0),t.on("copyPaste.copyElement",function(l){var p=l.descriptor,f=l.element;if(!(f.labelTarget||!o(f))){var d=te(f),g=c(d);g&&(p.referencedRootElement=g)}}),t.on("copyPaste.pasteElement",iP,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)})}fp.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],de(fp,J);function rP(e,t){return ke(t)||(t=[t]),Ui(t,function(n){return ho(e,n)})}var Dg=Math.max;function Lg(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return L(n,function(a){var s=a.id;x(a,"bpmn:Participant")&&(o[s]=aP(a,i,r)),x(a,"bpmn:Lane")&&(o[s]=qt(a)?up:lp),x(a,"bpmn:SubProcess")&&Ue(a)&&(o[s]=Sg),x(a,"bpmn:TextAnnotation")&&(o[s]=Rg),x(a,"bpmn:Group")&&(o[s]=XC)}),o})}Lg.$inject=["eventBus"];function oP(e){return e==="x"}function aP(e,t,n){var i=qt(e);if(!uP(e))return i?ic:rc;var r=oP(t),o={};return r?i?o=ic:o={width:cP(e,n,r),height:rc.height}:i?o={width:ic.width,height:sP(e,n,r)}:o=rc,o}function sP(e,t,n){var i;return i=lP(e,t,n),Dg(ic.height,i)}function cP(e,t,n){var i;return i=pP(e,t,n),Dg(rc.width,i)}function uP(e){return!!ar(e).length}function lP(e,t,n){var i=ar(e),r;return r=dp(i,t,n),e.height-r.height+up.height}function pP(e,t,n){var i=ar(e),r;return r=dp(i,t,n),e.width-r.width+lp.width}function dp(e,t,n){var i,r,o;for(i=0;i<e.length;i++)if(r=e[i],!n&&t>=r.y&&t<=r.y+r.height||n&&t>=r.x&&t<=r.x+r.width)return o=ar(r),o.length?dp(o,t,n):r}var Ig="_plane";function Ng(e){var t=e.id;return fP(t)}function vi(e){var t=e.id;return x(e,"bpmn:SubProcess")?Bg(t):t}function Br(e){return Bg(e)}function ac(e){var t=Ye(e);return x(t,"bpmndi:BPMNPlane")}function Bg(e){return e+Ig}function fP(e){return e.replace(new RegExp(Ig+"$"),"")}var $g=400,dP=600,jg={x:180,y:160};function Ii(e,t,n,i,r,o,a){J.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 x(p,"bpmn:SubProcess")&&!Ue(p)}function u(p){var f=p.shape,d=p.newRootElement,g=te(f);d=s._addDiagram(d||g),p.newRootElement=e.addRootElement(d)}function l(p){var f=p.shape,d=te(f);s._removeDiagram(d);var g=p.newRootElement=a.get(vi(d));e.removeRootElement(g)}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;L(f,function(d){if(c(d)){var g=a.get(vi(d));if(!(!g||!d.children||!d.children.length)){var h=Fg(d);s._showRecursively(h),s._moveChildrenToShape(h,g)}}})},!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;!x(f,"bpmn:SubProcess")||!Ue(f)||L(oa([f]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(p){var f=p.shape;if(c(f)){var d=a.get(vi(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(vi(f)))},!0),this.postExecuted("shape.replace",function(p){var f=p.newShape,d=p.oldRoot,g=e.findRoot(vi(f));if(!(!d||!g)){var h=d.children;n.moveElements(h,{x:0,y:0},g)}},!0),this.executed("element.updateProperties",function(p){var f=p.element;if(x(f,"bpmn:SubProcess")){var d=p.properties,g=p.oldProperties,h=g.id,m=d.id;if(h!==m){if(ac(f)){a.updateId(f,Br(m)),a.updateId(h,m);return}var w=a.get(Br(h));w&&a.updateId(Br(h),Br(m))}}},!0),this.reverted("element.updateProperties",function(p){var f=p.element;if(x(f,"bpmn:SubProcess")){var d=p.properties,g=p.oldProperties,h=g.id,m=d.id;if(h!==m){if(ac(f)){a.updateId(f,Br(h)),a.updateId(m,h);return}var w=a.get(Br(m));w&&a.updateId(w,Br(h))}}},!0),t.on("element.changed",function(p){var f=p.element;if(ac(f)){var d=f,g=a.get(Ng(d));!g||g===d||t.fire("element.changed",{element:g})}}),this.executed("shape.toggleCollapse",$g,function(p){var f=p.shape;x(f,"bpmn:SubProcess")&&(Ue(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",$g,function(p){var f=p.shape;x(f,"bpmn:SubProcess")&&(Ue(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",dP,function(p){var f=p.shape;if(x(f,"bpmn:SubProcess")){var d=p.newRootElement;if(d)if(Ue(f))s._moveChildrenToShape(d.children.slice(),f),L(oa(f.children),h=>{n.moveShape(h.annotation,{x:0,y:0},f.parent),L(h.associations,m=>{n.moveConnection(m,{x:0,y:0},f.parent)})});else{s._disconnectSharedAnnotations(f);var g=Fg(f);s._moveChildrenToShape(g,d)}}},!0),t.on("copyPaste.createTree",function(p){var f=p.element,d=p.children;if(c(f)){var g=vi(f),h=a.get(g);h&&d.push.apply(d,h.children)}}),t.on("copyPaste.copyElement",function(p){var f=p.descriptor,d=p.element,g=p.elements,h=d.parent,m=x(Ye(h),"bpmndi:BPMNPlane");if(m){var w=Ng(h),y=lt(g,function(_){return _.id===w});y&&(f.parent=y.id)}}),t.on("copyPaste.pasteElement",function(p){var f=p.descriptor;f.parent&&(c(f.parent)||f.parent.hidden)&&(f.hidden=!0)})}de(Ii,J),Ii.prototype._moveChildrenToShape=function(e,t){var n=this._modeling;if(e.length){var i=e.filter(function(c){return!c.hidden});if(!i.length){n.moveElements(e,{x:0,y:0},t,{autoResize:!1});return}var r=Tt(i),o;if(!t.x)o={x:jg.x-r.x,y:jg.y-r.y};else{var a=Oe(t),s=Oe(r);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}},Ii.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(Mm(e).map(i=>i.annotation));n.size&&L(oa(e.children),i=>{n.has(i.annotation)&&L(i.associations,r=>{t.removeConnection(r)})})},Ii.prototype._showRecursively=function(e,t){var n=this,i=[];return e.forEach(function(r){r.hidden=!!t,i=i.concat(r),r.children&&(i=i.concat(n._showRecursively(r.children,r.collapsed||t)))}),i},Ii.prototype._addDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams;return e.businessObject||(e=this._createNewDiagram(e)),n.push(e.di.$parent),e},Ii.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,i=t.create("bpmndi:BPMNPlane",{bpmnElement:e}),r=t.create("bpmndi:BPMNDiagram",{plane:i});i.$parent=r;var o=n.createRoot({id:vi(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},Ii.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=lt(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},Ii.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function hP(e){var t=[];return L(oa(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function Fg(e){return e.children.slice().concat(hP(e.children)).concat(mP(e))}function mP(e){return vl(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function hp(e,t){e.invoke(J,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,r=n.context.newShape;if(!(!x(r,"bpmn:SubProcess")||x(r,"bpmn:AdHocSubProcess")||!(x(i,"bpmn:Task")||x(i,"bpmn:CallActivity"))||!Ue(r))){var o=gP(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}hp.$inject=["injector","modeling"],de(hp,J);function gP(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function mp(e,t){J.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;x(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&&x(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(!(!x(r,"bpmn:TextAnnotation")||o.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,Bn(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}}})}de(mp,J),mp.$inject=["eventBus","textRenderer"];function gp(e,t){J.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(Ue(i))return;var r=Jo(i);r.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();L(s,function(u){o(u,!0)}),L(c,function(u){o(u,!1)})});function o(a,s){r.indexOf(a.source)!==-1&&r.indexOf(a.target)!==-1||x(a,"bpmn:Association")&&(x(a.source,"bpmn:TextAnnotation")||x(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,Oe(i)):t.reconnectStart(a,i,Oe(i)))}},!0)}de(gp,J),gp.$inject=["eventBus","modeling"];var yp=500;function vp(e,t,n){J.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=yP(c).concat([a]),p=Ym(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"],yp,function(a){var s=a.context,c=s.shape;x(c,"bpmn:SubProcess")&&(c.collapsed?Ye(c).isExpanded=!1:(i(c.children),Ye(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],yp,function(a){var s=a.context,c=s.shape;c.collapsed?Ye(c).isExpanded=!1:Ye(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],yp,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"})})}de(vp,J),vp.$inject=["eventBus","elementFactory","modeling"];function yP(e){return e.filter(function(t){return!t.hidden})}function bp(e,t,n,i){t.invoke(J,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;Fe(a)||(x(a,"bpmn:Participant")&&Ue(a)&&n.ids.unclaim(s.processRef.id),i.unclaimId(s.id,s))}),this.preExecute("connection.delete",function(r){var o=r.context,a=o.connection,s=a.businessObject;i.unclaimId(s.id,s)}),this.preExecute("canvas.updateRoot",function(){var r=e.getRootElement(),o=r.businessObject;x(r,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}de(bp,J),bp.$inject=["canvas","injector","moddle","modeling"];function _p(e,t){J.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;vP(r,o)&&t.updateProperties(o,{default:null})})}de(_p,J),_p.$inject=["eventBus","modeling"];function vP(e,t){if(!x(e,"bpmn:SequenceFlow"))return!1;var n=te(t),i=te(e);return n.get("default")===i}var bP=500,_P=5e3,Hg=["shape.create","shape.delete","shape.move","shape.resize"],zg=[...Hg,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function xp(e,t){J.call(this,e);var n;function i(){return n=n||new xP,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(zg,_P,function(){i()}),this.postExecuted(zg,bP,function(){o()}),this.preExecute(Hg,function(a){var s=a.context,c=s.shape,u=r();!c||c.labelTarget||(x(c,"bpmn:Lane")&&u.addLane(c),x(c,"bpmn:FlowNode")&&u.addFlowNode(c))})}xp.$inject=["eventBus","modeling"],de(xp,J);function xP(){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 wP=500,EP=5e3,Gg=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],Vg=[...Gg,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function wp(e,t){J.call(this,e);var n;function i(){return n=n||new SP,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(Vg,EP,function(){i()}),this.postExecuted(Vg,wP,function(){o()}),this.preExecute(Gg,function(a){var s=a.context.connection||a.context.shape,c=r();!s||s.labelTarget||(x(s,"bpmn:FlowElement")&&c.addFlowElement(s),x(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;x(s,"bpmn:Group")&&r().addGroup(s)})}wp.$inject=["eventBus","modeling"],de(wp,J);function SP(){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 Ep(e,t){J.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)RP(o)&&!PP(o)&&t.updateProperties(o,{isForCompensation:void 0})})}de(Ep,J),Ep.$inject=["eventBus","modeling"];function RP(e){const t=te(e);return t&&t.isForCompensation}function CP(e){return e&&x(e,"bpmn:BoundaryEvent")&&ho(e,"bpmn:CompensateEventDefinition")}function PP(e){return e.incoming.filter(n=>CP(n.source)).length>0}const AP={__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",kl],appendBehavior:["type",Ol],associationBehavior:["type",Ll],attachEventBehavior:["type",Hs],artifactBehavior:["type",Dl],boundaryEventBehavior:["type",Il],categoryRootElementReferenceBehavior:["type",Nl],compensateBoundaryEventBehaviour:["type",Bl],createBehavior:["type",$l],createDataObjectBehavior:["type",jl],createParticipantBehavior:["type",zl],dataInputAssociationBehavior:["type",Gl],dataStoreBehavior:["type",Vl],deleteLaneBehavior:["type",Wl],detachEventBehavior:["type",Ks],dropOnFlowBehavior:["type",ql],eventBasedGatewayBehavior:["type",Yl],fixHoverBehavior:["type",tg],groupBehavior:["type",Kl],importDockingFix:["type",ig],isHorizontalFix:["type",Zl],labelBehavior:["type",Jl],layoutConnectionBehavior:["type",ep],messageFlowBehavior:["type",ip],nonInterruptingBehavior:["type",rp],removeElementBehavior:["type",ap],removeEmbeddedLabelBoundsBehavior:["type",op],removeParticipantBehavior:["type",sp],replaceConnectionBehavior:["type",cp],replaceElementBehaviour:["type",nc],resizeBehavior:["type",Cg],resizeLaneBehavior:["type",Og],rootElementReferenceBehavior:["type",fp],spaceToolBehavior:["type",Lg],subProcessPlaneBehavior:["type",Ii],subProcessStartEventBehavior:["type",hp],textAnnotationBehavior:["type",mp],toggleCollapseConnectionBehaviour:["type",gp],toggleElementCollapseBehaviour:["type",vp],unclaimIdBehavior:["type",bp],unsetDefaultFlowBehavior:["type",_p],updateFlowNodeRefsBehavior:["type",xp],updateCategoryValueRefsBehavior:["type",wp],setCompensationActivityAfterPasteBehavior:["type",Ep]};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 bi={__init__:["rules"],rules:["type",Sp]};function Gn(e){J.call(this,e),this.init()}Gn.$inject=["eventBus"],de(Gn,J),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 Wg(e,t){var n=Jt(e,t,-15);return n!=="intersect"?n:null}function tn(e){Gn.call(this,e)}de(tn,Gn),tn.$inject=["eventBus"],tn.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return TP(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 cc(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return cc(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 ry(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return st(i)&&!uc(t,i)?!1:Cr(t,function(r){return st(r)?cc(r.source,r.target,r):r.host?ga(r,r.host,null,n):Ap(r,i)})}),this.addRule("elements.move",function(e){var t=e.target,n=e.shapes,i=e.position,r=e.hints;return r!=null&&r.keyboardMove&&n.some(function(a){return Qg(a)&&!n.includes(a.host)})?!1:ga(n,t,null,i)||ny(n,t,i)||iy(n,t)||uc(n,t)}),this.addRule("shape.create",function(e){return Ap(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return ga(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return uy(n,t)})},tn.prototype.canConnectMessageFlow=sy,tn.prototype.canConnectSequenceFlow=cy,tn.prototype.canConnectDataAssociation=Tp,tn.prototype.canConnectAssociation=oy,tn.prototype.canConnectCompensationAssociation=ay,tn.prototype.canMove=iy,tn.prototype.canAttach=ga,tn.prototype.canReplace=ny,tn.prototype.canDrop=So,tn.prototype.canInsert=uc,tn.prototype.canCreate=Ap,tn.prototype.canConnect=cc,tn.prototype.canResize=ry,tn.prototype.canCopy=uy;function TP(e){return Rp(e)?null:ze(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function Rp(e){return!e||Fe(e)}function Ug(e){do{if(x(e,"bpmn:Process"))return te(e);if(x(e,"bpmn:Participant"))return te(e).processRef||te(e)}while(e=e.parent)}function Cp(e){return x(e,"bpmn:TextAnnotation")}function Pp(e){return x(e,"bpmn:Group")&&!e.labelTarget}function qg(e){return x(e,"bpmn:BoundaryEvent")&&_i(e,"bpmn:CompensateEventDefinition")}function sc(e){return te(e).isForCompensation}function MP(e,t){var n=Ug(e),i=Ug(t);return n===i}function kP(e){return x(e,"bpmn:InteractionNode")&&!x(e,"bpmn:BoundaryEvent")&&(!x(e,"bpmn:Event")||x(e,"bpmn:ThrowEvent")&&Xg(e,"bpmn:MessageEventDefinition"))}function OP(e){return x(e,"bpmn:InteractionNode")&&!sc(e)&&(!x(e,"bpmn:Event")||x(e,"bpmn:CatchEvent")&&Xg(e,"bpmn:MessageEventDefinition"))&&!(x(e,"bpmn:BoundaryEvent")&&!_i(e,"bpmn:MessageEventDefinition"))}function Yg(e){for(var t=e;t=t.parent;){if(x(t,"bpmn:FlowElementsContainer"))return te(t);if(x(t,"bpmn:Participant"))return te(t).processRef}return null}function Kg(e,t){var n=Yg(e),i=Yg(t);return n===i}function _i(e,t){var n=te(e);return!!lt(n.eventDefinitions||[],function(i){return x(i,t)})}function Xg(e,t){var n=te(e);return(n.eventDefinitions||[]).every(function(i){return x(i,t)})}function DP(e){return x(e,"bpmn:FlowNode")&&!x(e,"bpmn:EndEvent")&&!un(e)&&!(x(e,"bpmn:IntermediateThrowEvent")&&_i(e,"bpmn:LinkEventDefinition"))&&!qg(e)&&!sc(e)}function LP(e){return x(e,"bpmn:FlowNode")&&!x(e,"bpmn:StartEvent")&&!x(e,"bpmn:BoundaryEvent")&&!un(e)&&!(x(e,"bpmn:IntermediateCatchEvent")&&_i(e,"bpmn:LinkEventDefinition"))&&!sc(e)}function IP(e){return x(e,"bpmn:ReceiveTask")||x(e,"bpmn:IntermediateCatchEvent")&&(_i(e,"bpmn:MessageEventDefinition")||_i(e,"bpmn:TimerEventDefinition")||_i(e,"bpmn:ConditionalEventDefinition")||_i(e,"bpmn:SignalEventDefinition"))}function NP(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function Zg(e,t){var n=NP(t);return n.indexOf(e)!==-1}function cc(e,t,n){if(Rp(e)||Rp(t))return null;if(!x(n,"bpmn:DataAssociation")){if(sy(e,t))return{type:"bpmn:MessageFlow"};if(cy(e,t))return{type:"bpmn:SequenceFlow"}}var i=Tp(e,t);return i||(ay(e,t)?{type:"bpmn:Association",associationDirection:"One"}:oy(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function So(e,t){return Fe(e)||Pp(e)?!0:x(t,"bpmn:Participant")&&!Ue(t)?!1:x(e,"bpmn:Participant")?x(t,"bpmn:Process")||x(t,"bpmn:Collaboration"):ze(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:x(e,"bpmn:Lane")?x(t,"bpmn:Participant")||x(t,"bpmn:Lane"):x(e,"bpmn:BoundaryEvent")&&!BP(e)?!1:x(e,"bpmn:FlowElement")&&!x(e,"bpmn:DataStoreReference")?x(t,"bpmn:FlowElementsContainer")?Ue(t):ze(t,["bpmn:Participant","bpmn:Lane"]):x(e,"bpmn:DataStoreReference")&&x(t,"bpmn:Collaboration")?Ui(te(t).get("participants"),function(n){return!!n.get("processRef")}):ze(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?ze(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):x(e,"bpmn:MessageFlow")?x(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function BP(e){return te(e).cancelActivity&&(Jg(e)||ey(e))}function Qg(e){return!Fe(e)&&x(e,"bpmn:BoundaryEvent")}function $P(e){return x(e,"bpmn:Lane")}function jP(e){return Qg(e)||x(e,"bpmn:IntermediateThrowEvent")&&Jg(e)?!0:x(e,"bpmn:IntermediateCatchEvent")&&ey(e)}function Jg(e){var t=te(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function ey(e){return ty(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function ty(e,t){return t.some(function(n){return _i(e,n)})}function FP(e){return x(e,"bpmn:ReceiveTask")&<(e.incoming,function(t){return x(t.source,"bpmn:EventBasedGateway")})}function ga(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return Fe(r)||!jP(r)||un(t)||!x(t,"bpmn:Activity")||sc(t)||i&&!Wg(i,t)||FP(t)?!1:"attach"}function ny(e,t,n){if(!t)return!1;var i={replacements:[]};return L(e,function(r){un(t)||x(r,"bpmn:StartEvent")&&r.type!=="label"&&So(r,t)&&(KS(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(XS(r)||ZS(r)||QS(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),ty(r,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&x(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"})),x(t,"bpmn:Transaction")||_i(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(x(r,"bpmn:EndEvent")&&So(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),x(r,"bpmn:BoundaryEvent")&&ga(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function iy(e,t){return Ui(e,$P)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return So(n,t)})}function Ap(e,t,n,i){return t?Fe(e)||Pp(e)?!0:So(e,t)||uc(e,t):!1}function ry(e,t,n){return x(e,"bpmn:SubProcess")?Ue(e)&&(!t||t.width>=100&&t.height>=80):x(e,"bpmn:Lane")||x(e,"bpmn:Participant")?!0:Cp(e)?n?n==="e"||n==="w":!0:Pp(e)?!0:Fe(e)?n?n==="e"||n==="w":!0:!1}function HP(e,t){var n=Cp(e),i=Cp(t);return(n||i)&&n!==i}function oy(e,t){return Zg(t,e)||Zg(e,t)?!1:HP(e,t)?!0:!!Tp(e,t)}function ay(e,t){return Kg(e,t)&&qg(e)&&x(t,"bpmn:Activity")&&!GP(t,e)&&!un(t)}function sy(e,t){return py(e)&&!py(t)?!1:kP(e)&&OP(t)&&!MP(e,t)}function cy(e,t){return DP(e)&&LP(t)&&Kg(e,t)&&!(x(e,"bpmn:EventBasedGateway")&&!IP(t))}function Tp(e,t){return ze(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&ze(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:ze(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&ze(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function uc(e,t,n){if(!t)return!1;if(Array.isArray(e)){if(e.length!==1)return!1;e=e[0]}return t.source===e||t.target===e?!1:ze(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!Fe(t)&&x(e,"bpmn:FlowNode")&&!x(e,"bpmn:BoundaryEvent")&&So(e,t.parent)}function Mp(e,t){return e&&t&&e.indexOf(t)!==-1}function uy(e,t){return Fe(t)?!0:!(x(t,"bpmn:Lane")&&!Mp(e,t.parent)||x(t,"bpmn:MessageFlow")&&!zP(e,t))}function zP(e,t){var n=ly(t.source),i=ly(t.target);return Mp(e,n)&&Mp(e,i)}function ly(e){for(;e;e=e.parent)if(x(e,"bpmn:Participant"))return e;return null}function py(e){return yo(e,"bpmn:Process")||yo(e,"bpmn:Collaboration")}function GP(e,t){return e.attachers.includes(t)}const VP={__depends__:[bi],__init__:["bpmnRules"],bpmnRules:["type",tn]};var WP=2e3;function fy(e,t){e.on("saveXML.start",WP,n);function n(){var i=t.getRootElements();L(i,function(r){var o=Ye(r),a,s;a=Jo([r]),a=Ge(a,function(c){return c!==r&&!c.labelTarget}),s=on(a,Ye),o.set("planeElement",s)})}}fy.$inject=["eventBus","canvas"];const UP={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",fy]};function lc(e){J.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)})}lc.prototype.getOrdering=function(e,t){return null},de(lc,J);function kp(e,t){lc.call(this,e);var n=[{type:"bpmn:SubProcess",order:{level:6}},{type:"bpmn:SequenceFlow",order:{level:9,containers:["bpmn:Participant","bpmn:FlowElementsContainer"]}},{type:"bpmn:DataAssociation",order:{level:9,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:TextAnnotation",order:{level:9}},{type:"bpmn:MessageFlow",order:{level:9,containers:["bpmn:Collaboration"]}},{type:"bpmn:Association",order:{level:6,containers:["bpmn:Participant","bpmn:FlowElementsContainer","bpmn:Collaboration"]}},{type:"bpmn:BoundaryEvent",order:{level:8}},{type:"bpmn:Group",order:{level:10,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:FlowElement",order:{level:5}},{type:"bpmn:Participant",order:{level:-2}},{type:"bpmn:Lane",order:{level:-1}}];function i(a){if(a.labelTarget)return{level:10};var s=lt(n,function(c){return ze(a,[c.type])});return s&&s.order||{level:1}}function r(a){var s=a.order;if(s||(a.order=s=i(a)),!s)throw new Error(`no order for <${a.id}>`);return s}function o(a,s,c){for(var u=s;u&&!ze(u,c);)u=u.parent;if(!u)throw new Error(`no parent for <${a.id}> in <${s&&s.id}>`);return u}this.getOrdering=function(a,s){if(a.labelTarget||x(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=cd(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}}}kp.$inject=["eventBus","canvas"],de(kp,lc);const qP={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",kp]};function ya(){}ya.prototype.get=function(){return this._data},ya.prototype.set=function(e){this._data=e},ya.prototype.clear=function(){var e=this._data;return delete this._data,e},ya.prototype.isEmpty=function(){return!this._data};const YP={clipboard:["type",ya]};var dy=1500;function hy(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",dy,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",dy,function(c){s&&t.fire("element.out",{element:s,gfx:a})}),t.on("element.out",function(){a=null,s=null})})(),this._findTargetGfx=function(a){var s,c;if(a instanceof MouseEvent)return s=Nr(a),c=document.elementFromPoint(s.x,s.y),KP(c)}}hy.$inject=["elementRegistry","eventBus","injector"];function KP(e){return Mr(e,"svg, .djs-element",!0)}const XP={__init__:["hoverFix"],hoverFix:["type",hy]};function ZP(e){return!0}function pc(e){return cr(e)||nP(e)}var my=500;function gy(e,t,n){var i=this;function r(T,N,k){if(!s(T,N)){var O,F,ae;k?F=t.getGraphics(k):(O=N.delegateTarget||N.target,O&&(F=O,k=t.get(F))),!(!F||!k)&&(ae=e.fire(T,{element:k,gfx:F,originalEvent:N}),ae===!1&&(N.stopPropagation(),N.preventDefault()))}}var o={};function a(T){return o[T]}function s(T,N){var k=u[T]||cr;return!k(N)}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":ZP,"element.mousedown":pc,"element.mouseup":pc,"element.click":pc,"element.dblclick":pc};function l(T,N,k){var O=c[T];if(!O)throw new Error("unmapped DOM event name <"+T+">");return r(O,N,k)}var p="svg, .djs-element";function f(T,N,k,O){var F=o[k]=function(ae){r(k,ae)};O&&(u[k]=O),F.$delegate=Cn.bind(T,p,N,F)}function d(T,N,k){var O=a(k);O&&Cn.unbind(T,N,O.$delegate)}function g(T){L(c,function(N,k){f(T,k,N)})}function h(T){L(c,function(N,k){d(T,k,N)})}e.on("canvas.destroy",function(T){h(T.svg)}),e.on("canvas.init",function(T){g(T.svg)}),e.on(["shape.added","connection.added"],function(T){var N=T.element,k=T.gfx;e.fire("interactionEvents.createHit",{element:N,gfx:k})}),e.on(["shape.changed","connection.changed"],my,function(T){var N=T.element,k=T.gfx;e.fire("interactionEvents.updateHit",{element:N,gfx:k})}),e.on("interactionEvents.createHit",my,function(T){var N=T.element,k=T.gfx;i.createDefaultHit(N,k)}),e.on("interactionEvents.updateHit",function(T){var N=T.element,k=T.gfx;i.updateDefaultHit(N,k)});var m=P("djs-hit djs-hit-stroke"),w=P("djs-hit djs-hit-click-stroke"),y=P("djs-hit djs-hit-all"),_=P("djs-hit djs-hit-no-move"),S={all:y,"click-stroke":w,stroke:m,"no-move":_};function P(T,N){return N=H({stroke:"white",strokeWidth:15},N||{}),n.cls(T,["no-fill","no-border"],N)}function C(T,N){var k=S[N];if(!k)throw new Error("invalid hit type <"+N+">");return he(T,k),T}function D(T,N){Be(T,N)}this.removeHits=function(T){var N=ws(".djs-hit",T);L(N,$t)},this.createDefaultHit=function(T,N){var k=T.waypoints,O=T.isFrame,F;return k?this.createWaypointsHit(N,k):(F=O?"stroke":"all",this.createBoxHit(N,F,{width:T.width,height:T.height}))},this.createWaypointsHit=function(T,N){var k=Qo(N);return C(k,"stroke"),D(T,k),k},this.createBoxHit=function(T,N,k){k=H({x:0,y:0},k);var O=Ce("rect");return C(O,N),he(O,k),D(T,O),O},this.updateDefaultHit=function(T,N){var k=ot(".djs-hit",N);if(k)return T.waypoints?yl(k,T.waypoints):he(k,{width:T.width,height:T.height}),k},this.fire=r,this.triggerMouseEvent=l,this.mouseHandler=a,this.registerEvent=f,this.unregisterEvent=d}gy.$inject=["eventBus","elementRegistry","styles"];const fc={__init__:["interactionEvents"],interactionEvents:["type",gy]};function Ro(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=new Set;var n=this;e.on(["shape.remove","connection.remove"],function(i){var r=i.element;n.deselect(r)}),e.on(["diagram.clear","root.set"],function(i){n.select(null)})}Ro.$inject=["eventBus","canvas"],Ro.prototype.deselect=function(e){if(this._selectedElements.has(e)){var t=this.get();this._selectedElements.delete(e),this._eventBus.fire("selection.changed",{oldSelection:t,newSelection:this.get()})}},Ro.prototype.get=function(){return Array.from(this._selectedElements)},Ro.prototype.isSelected=function(e){return this._selectedElements.has(e)},Ro.prototype.select=function(e,t){var n=this.get();ke(e)||(e=e?[e]:[]);var i=this._canvas,r=i.getRootElement();e=e.filter(function(o){var a=i.findRoot(o);return r===a}),t?L(e,o=>{this._selectedElements.add(o)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var yy="hover",vy="selected";function by(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,yy)}),t.on("element.out",function(r){i(r.element,yy)}),t.on("selection.changed",function(r){function o(u){i(u,vy)}function a(u){n(u,vy)}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)})}by.$inject=["canvas","eventBus"];function _y(e,t,n,i){e.on("create.end",500,function(r){var o=r.context,a=o.canExecute,s=o.elements,c=o.hints||{},u=c.autoSelect;if(a){if(u===!1)return;ke(u)?t.select(u):t.select(s.filter(QP))}}),e.on("connect.end",500,function(r){var o=r.context,a=o.connection;a&&t.select(a)}),e.on("shape.move.end",500,function(r){var o=r.previousSelection||[],a=i.get(r.context.shape.id),s=lt(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(cr(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=oc(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}_y.$inject=["eventBus","selection","canvas","elementRegistry"];function QP(e){return!e.hidden}const Vn={__init__:["selectionVisuals","selectionBehavior"],__depends__:[fc],selection:["type",Ro],selectionVisuals:["type",by],selectionBehavior:["type",_y]};var JP=/^djs-cursor-.*$/;function dc(e){var t=yt(document.body);t.removeMatching(JP),e&&t.add("djs-cursor-"+e)}function xy(){dc(null)}var eA=5e3;function wy(e,t){t=t||"element.click";function n(){return!1}return e.once(t,eA,n),function(){e.off(t,n)}}var tA=["c","C"],nA=["v","V"],iA=["d","D"],rA=["x","X"],oA=["y","Y"],Ey=["z","Z"];function aA(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Tn(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function jt(e,t){return e=ke(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function Op(e){return e.shiftKey}function sA(e){return Tn(e)&&jt(tA,e)}function cA(e){return Tn(e)&&jt(nA,e)}function uA(e){return Tn(e)&&jt(iA,e)}function lA(e){return Tn(e)&&jt(rA,e)}function pA(e){return Tn(e)&&!Op(e)&&jt(Ey,e)}function fA(e){return Tn(e)&&(jt(oA,e)||jt(Ey,e)&&Op(e))}var Co=Math.round,Sy="djs-drag-active";function $r(e){e.preventDefault()}function dA(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function hA(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Ry(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(_){var S=t.viewbox(),P=t._container.getBoundingClientRect();return{x:S.x+(_.x-P.left)/S.scale,y:S.y+(_.y-P.top)/S.scale}}function s(_,S){S=S||o;var P=e.createEvent(H({},S.payload,S.data,{isTouch:S.isTouch}));return e.fire("drag."+_,P)===!1?!1:e.fire(S.prefix+"."+_,P)}function c(_){var S=_.filter(function(P){return i.get(P.id)});S.length&&n.select(S)}function u(_,S){var P=o.payload,C=o.displacement,D=o.globalStart,T=Nr(_),N=ni(T,D),k=o.localStart,O=a(T),F=ni(O,k);if(!o.active&&(S||hA(N)>o.threshold)){if(H(P,{x:Co(k.x+C.x),y:Co(k.y+C.y),dx:0,dy:0},{originalEvent:_}),s("start")===!1)return m();o.active=!0,o.keepSelection||(P.previousSelection=n.get(),n.select(null)),o.cursor&&dc(o.cursor),t.addMarker(t.getRootElement(),Sy)}pp(_),o.active&&(H(P,{x:Co(O.x+C.x),y:Co(O.y+C.y),dx:Co(F.x),dy:Co(F.y)},{originalEvent:_}),s("move"))}function l(_){var S,P=!0;o.active&&(_&&(o.payload.originalEvent=_,pp(_)),P=s("end")),P===!1&&s("rejected"),S=w(P!==!0),s("ended",S)}function p(_){jt("Escape",_)&&($r(_),m())}function f(_){var S;o.active&&(S=wy(e),setTimeout(S,400),$r(_)),l(_)}function d(_){u(_)}function g(_){var S=o.payload;S.hoverGfx=_.gfx,S.hover=_.element,s("hover")}function h(_){s("out");var S=o.payload;S.hoverGfx=null,S.hover=null}function m(_){var S;if(o){var P=o.active;P&&s("cancel"),S=w(_),P&&s("canceled",S)}}function w(_){var S,P;s("cleanup"),xy(),o.trapClick?P=f:P=l,Ne.unbind(document,"mousemove",u),Ne.unbind(document,"dragstart",$r),Ne.unbind(document,"selectstart",$r),Ne.unbind(document,"mousedown",P,!0),Ne.unbind(document,"mouseup",P,!0),Ne.unbind(document,"keyup",p),Ne.unbind(document,"touchstart",d,!0),Ne.unbind(document,"touchcancel",m,!0),Ne.unbind(document,"touchmove",u,!0),Ne.unbind(document,"touchend",l,!0),e.off("element.hover",g),e.off("element.out",h),t.removeMarker(t.getRootElement(),Sy);var C=o.payload.previousSelection;return _!==!1&&C&&!n.get().length&&c(C),S=o,o=null,S}function y(_,S,P,C){o&&m(!1),typeof S=="string"&&(C=P,P=S,S=null),C=H({},r,C||{});var D=C.data||{},T,N,k,O,F;if(C.trapClick?O=f:O=l,_?(T=Eo(_)||_,N=Nr(_),pp(_),T.type==="dragstart"&&$r(T)):(T=null,N={x:0,y:0}),k=a(N),S||(S=k),F=dA(T),o=H({prefix:P,data:D,payload:{},globalStart:N,displacement:ni(S,k),localStart:k,isTouch:F},C),C.manual||(F?(Ne.bind(document,"touchstart",d,!0),Ne.bind(document,"touchcancel",m,!0),Ne.bind(document,"touchmove",u,!0),Ne.bind(document,"touchend",l,!0)):(Ne.bind(document,"mousemove",u),Ne.bind(document,"dragstart",$r),Ne.bind(document,"selectstart",$r),Ne.bind(document,"mousedown",O,!0),Ne.bind(document,"mouseup",O,!0)),Ne.bind(document,"keyup",p),e.on("element.hover",g),e.on("element.out",h)),s("init")===!1)return m(),!1;C.autoActivate&&u(_,!0)}e.on("diagram.destroy",m),this.init=y,this.move=u,this.hover=g,this.out=h,this.end=l,this.cancel=m,this.context=function(){return o},this.setOptions=function(_){H(r,_)}}Ry.$inject=["eventBus","canvas","selection","elementRegistry"];const Ni={__depends__:[XP,Vn],dragging:["type",Ry]};function Po(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}Po.prototype.next=function(){return this._prefix+ ++this._counter};const mA=new Po("ps");var gA=["marker-start","marker-mid","marker-end"],yA=["circle","ellipse","line","path","polygon","polyline","path","rect"];function ur(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}ur.$inject=["elementRegistry","eventBus","canvas","styles"],ur.prototype.cleanUp=function(){console.warn("PreviewSupport#cleanUp is deprecated and will be removed in future versions. You do not need to manually clean up previews anymore. cf. https://github.com/bpmn-io/diagram-js/pull/906")},ur.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},ur.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=$h(n);return this._cloneMarkers(Dr(r),i),he(r,this._styles.cls(i,[])),Be(t,r),he(r,"data-preview-support-element-id",e.id),r},ur.prototype.addFrame=function(e,t){var n=Ce("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return Be(t,n),he(n,"data-preview-support-element-id",e.id),n},ur.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),xA(e)&&gA.forEach(function(r){if(he(e,r)){var o=vA(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},ur.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,mA.next()].join("-"),a=ot("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||$h(n);s.id=o,qe(s).add(r);var c=ot(":scope > defs",e);c||(c=Ce("defs"),Be(e,c)),Be(c,s);var u=_A(s.id);he(t,i,u)};function vA(e,t,n){var i=bA(he(e,t));return ot("marker#"+i,n||document)}function bA(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function _A(e){return"url(#"+e+")"}function xA(e){return yA.indexOf(e.nodeName)!==-1}const Ao={__init__:["previewSupport"],previewSupport:["type",ur]};var wA="drop-ok",Cy="drop-not-ok",Py="attach-ok",Ay="new-parent",Ty="create",EA=2e3;function My(e,t,n,i,r){function o(c,u,l,p,f){if(!u)return!1;c=Ge(c,function(y){var _=y.labelTarget;return!y.parent&&!(Fe(y)&&c.indexOf(_)!==-1)});var d=lt(c,function(y){return!st(y)}),g=!1,h=!1,m=!1;Oy(c)&&(g=r.allowed("shape.attach",{position:l,shape:d,target:u})),g||(Oy(c)?m=r.allowed("shape.create",{position:l,shape:d,source:p,target:u}):m=r.allowed("elements.create",{elements:c,position:l,target:u}));var w=f.connectionTarget;return m||g?(d&&p&&(h=r.allowed("connection.create",{source:w===p?d:p,target:w===p?p:d,hints:{targetParent:u,targetAttach:g}})),{attach:g,connect:h}):m===null||g===null?null:!1}function a(c,u){[Py,wA,Cy,Ay].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}ky(c);var g={x:c.x,y:c.y},h=u.canExecute=p&&o(l,p,g,f,d);p&&h!==null&&(u.target=p,h&&h.attach?a(p,Py):a(p,h?Ay:Cy))}),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,g=u.canExecute,h=g&&g.attach,m=g&&g.connect,w=u.hints||{};if(g===!1||!d)return!1;ky(c);var y={x:c.x,y:c.y};m?p=i.appendShape(l,p,y,d,{attach:h,connection:m===!0?{}:m,connectionTarget:w.connectionTarget}):(f=i.createElements(f,y,d,H({},w,{attach:h})),p=lt(f,function(_){return!st(_)})),H(u,{elements:f,shape:p}),H(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===Ty&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],EA,function(){n.off("elements.changed",s)})}),this.start=function(c,u,l){ke(u)||(u=[u]);var p=lt(u,function(g){return!st(g)});if(p){l=H({elements:u,hints:{},shape:p},l||{}),L(u,function(g){Le(g.x)||(g.x=0),Le(g.y)||(g.y=0)});var f=Ge(u,function(g){return!g.hidden}),d=Tt(f);L(u,function(g){st(g)&&(g.waypoints=on(g.waypoints,function(h){return{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2}})),H(g,{x:g.x-d.x-d.width/2,y:g.y-d.y-d.height/2})}),t.init(c,Ty,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:u,context:l}})}}}My.$inject=["canvas","dragging","eventBus","modeling","rules"];function ky(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 Oy(e){return e&&e.length===1&&!st(e[0])}var SA=750;function Dy(e,t,n,i,r){function o(a){var s=Ce("g");he(s,r.cls("djs-drag-group",["no-events"]));var c=Ce("g");return a.forEach(function(u){var l;u.hidden||(u.waypoints?(l=n._createContainer("connection",c),n.drawConnection(Dr(l),u)):(l=n._createContainer("shape",c),n.drawShape(Dr(l),u),en(l,u.x,u.y)),i.addDragger(u,s,l))}),s}t.on("create.move",SA,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(),Be(p,l)),en(l,a.x,a.y)):$t(l)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&$t(c)})}Dy.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const hc={__depends__:[Ni,Ao,bi,Vn],__init__:["create","createPreview"],create:["type",My],createPreview:["type",Dy]};function Dp(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)})}Dp.$inject=["eventBus"],Dp.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||RA(0,0)};function RA(e,t){var n=document.createEvent("MouseEvent"),i=e,r=t,o=e,a=t;return n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,i,r,o,a,!1,!1,!1,!1,0,null),n}const va={__init__:["mouse"],mouse:["type",Dp]};var Ly=2e3;function Mn(e,t,n,i,r,o,a,s){this._canvas=e,this._create=t,this._elementFactory=i,this._eventBus=r,this._modeling=o,this._mouse=a,this._rules=s,r.on("copyPaste.copyElement",function(c){var u=c.descriptor,l=c.element,p=c.elementsSet;u.priority=1,u.id=l.id,p.has(l.parent)&&(u.parent=l.parent.id),CA(l)&&(u.priority=2,u.host=l.host.id),st(l)&&(u.priority=3,u.source=l.source.id,u.target=l.target.id,u.waypoints=PA(l)),Fe(l)&&(u.priority=4,u.labelTarget=l.labelTarget.id),L(["x","y","width","height"],function(f){Le(l[f])&&(u[f]=l[f])}),u.hidden=l.hidden,u.collapsed=l.collapsed}),r.on("copyPaste.elementsCopied",Ly,function(c){var u;((u=c.hints)==null?void 0:u.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",Ly,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var u=c.hints;H(u,{createElementsBehavior:!1})})}Mn.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],Mn.prototype.copy=function(e,t={}){var n,i;return ke(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(ke(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},Mn.prototype.paste=function(e={}){var t=this._eventBus.createEvent({type:"copyPaste.pasteElements",hints:{},...e}),n=this._eventBus.fire(t);if(n!==!1){var i=t.tree;if(i){var r=t.hints,o=this._createElements(i);if(t.element&&t.point)return this._paste(o,t.element,t.point,r);this._create.start(this._mouse.getLastMoveEvent(),o,{hints:r})}}},Mn.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},Mn.prototype.cut=function(e){var t=this.copy(e),n=this._getElementIdsFromTree(t),i=e.filter(function(r){return n[r.id]});return i.length>0&&this._modeling.removeElements(i),t},Mn.prototype._getElementIdsFromTree=function(e){var t={};return L(e,function(n){L(n,function(i){i.id&&(t[i.id]=!0)})}),t},Mn.prototype._paste=function(e,t,n,i){L(e,function(o){Le(o.x)||(o.x=0),Le(o.y)||(o.y=0)});var r=Tt(e);return L(e,function(o){st(o)&&(o.waypoints=on(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),H(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,H({},i))},Mn.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return L(e,function(o,a){o=ai(o,"priority"),L(o,function(s){var c=H({},si(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var u;if(st(c)){c.source=i[s.source],c.target=i[s.target],u=i[s.id]=t.createConnection(c),r.push(u);return}if(Fe(c)){c.labelTarget=i[c.labelTarget],u=i[s.id]=t.createLabel(c),r.push(u);return}c.host&&(c.host=i[c.host]),u=i[s.id]=t.createShape(c),r.push(u)})}),r},Mn.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(si(e,["id"]));return t},Mn.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(si(e,["id"]));return t},Mn.prototype.createShape=function(e){var t=this._elementFactory.createShape(si(e,["id"]));return t},Mn.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(st(e)&&(!n.has(e.source)||!n.has(e.target))||Fe(e)&&!n.has(e.labelTarget))},Mn.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=Cs(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 g={element:p,depth:f};r.push(g),o.set(p,g);return}if(d.depth<f){r=u(d,r);var h={element:d.element,depth:f};r.push(h),o.set(p,h)}}function u(p,f){var d=f.indexOf(p);return d!==-1&&f.splice(d,1),f}Or(a,function(p,f,d){if(Fe(p))return;L(p.labels,function(m){c(m,d)});function g(m){m&&m.length&&L(m,function(w){L(w.labels,function(y){c(y,d)}),c(w,d)})}L([p.attachers,p.incoming,p.outgoing],g),c(p,d);var h=[];return p.children&&(h=p.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:p,children:h}),h}),e=on(r,function(p){return p.element});var l=new Set(e);return r=on(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=on(r,function(p){return p.element}),L(r,function(p){var f=p.depth;if(!n.hasRelations(p.element,e,l)){Ny(p.element,e),l.delete(p.element);return}if(!s(p.element,e)){Ny(p.element,e),l.delete(p.element);return}i[f]||(i[f]=[]),i[f].push(p.descriptor)}),i};function CA(e){return!!e.host}function PA(e){return on(e.waypoints,function(t){return t=Iy(t),t.original&&(t.original=Iy(t.original)),t})}function Iy(e){return H({},e)}function Ny(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const AA={__depends__:[YP,hc,va,bi],__init__:["copyPaste"],copyPaste:["type",Mn]};function Lp(e,t,n){ke(n)||(n=[n]),L(n,function(i){Rr(e[i])||(t[i]=e[i])})}var Ip=750;function By(e,t,n){function i(c,u){var l=e.create(c.$type);return n.copyElement(c,l,null,u)}t.on("copyPaste.copyElement",Ip,function(c){var u=c.descriptor,l=c.element,p=te(l);if(Fe(l))return u;var f=u.businessObject=i(p,!0),d=u.di=i(Ye(l),!0);d.bpmnElement=f,Lp(f,u,"name"),Lp(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=te(c);return c.default&&(l[c.default]={element:p,property:"default"}),c.host&&(te(c).attachedToRef=te(u[c.host])),si(l,Sn(l,function(f,d,g){var h=d.element,m=d.property;return g===c.id&&(h.set(m,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(Fe(l)){l.businessObject=te(u[l.labelTarget]),l.di=Ye(u[l.labelTarget]);return}p=l.businessObject=i(p),f=l.di=i(f),f.bpmnElement=p,Lp(l,p,["isExpanded","name"]),l.type=p.$type}),t.on("copyPaste.copyElement",Ip,function(c){var u=c.descriptor,l=c.element;if(x(l,"bpmn:Participant")){var p=te(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;x(u,"bpmn:SubProcess")&&L(oa(l),p=>{l.push(p.annotation)})}),t.on("copyPaste.pasteElement",Ip,function(c){var u=c.cache,l=c.descriptor;a(u,s(l,u,o(u)))})}By.$inject=["bpmnFactory","eventBus","moddleCopy"];const TA=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],MA=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function ba(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",i=>{const{propertyNames:r}=i;if(!(!r||!r.length))return ai(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=Vt(r)&&r.$descriptor;if(a&&MA.includes(a))return o;if(a&&TA.includes(a)||a&&s&&!lt(s.properties,to({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:r}=i;if(x(r,"bpmn:ExtensionElements")&&(!r.values||!r.values.length))return!1})}ba.$inject=["eventBus","bpmnFactory","moddle"],ba.prototype.copyElement=function(e,t,n,i=!1){n&&!ke(n)&&(n=[n]),n=n||Np(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(ke(r)&&(n=r),L(n,o=>{let a;En(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!Nt(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},ba.prototype.copyProperty=function(e,t,n,i=!1){let r=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n,clone:i});if(r===!1)return;if(r)return Vt(r)&&r.$type&&!r.$parent&&(r.$parent=t),r;const o=this._moddle.getPropertyDescriptor(t,n);if(!o.isReference)return o.isId?e&&this._copyId(e,t,i):ke(e)?Sn(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):Vt(e)&&e.$type?this._moddle.getElementDescriptor(e).isGeneric?void 0:(r=this._bpmnFactory.create(e.$type),r.$parent=t,r=this.copyElement(e,r,null,i),r):e},ba.prototype._copyId=function(e,t,n=!1){if(n)return e;if(!this._moddle.ids.assigned(e))return this._moddle.ids.claim(e,t),e};function Np(e,t){return Sn(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const $y={__depends__:[AA],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",By],moddleCopy:["type",ba]};var jy=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=jy(s+o/2),l=jy(c+a/2),p=i.replaceShape(e,H({},t,{x:u,y:l,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:p,hints:n}),p};function Fy(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}Fy.$inject=["selection","eventBus"];const kA={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Fy],replace:["type",Bp]};function OA(e,t,n){ke(n)||(n=[n]),L(n,function(i){Rr(e[i])||(t[i]=e[i])})}var DA=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function LA(e,t){var n=e&&En(e,"collapsed")?e.collapsed:!Ue(e),i;return t&&(En(t,"collapsed")||En(t,"isExpanded"))?i=En(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function Hy(e,t,n,i,r,o){function a(s,c,u){u=u||{};var l=c.type,p=s.businessObject;if(mc(p)&&(l==="bpmn:SubProcess"||l==="bpmn:AdHocSubProcess")&&LA(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),OA(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var g=Np(p.$descriptor),h=Np(f.$descriptor,!0),m=IA(g,h);H(f,Qn(c,DA));var w=Ge(m,function(S){return S==="eventDefinitions"?zy(s,c.eventDefinitionType):S==="loopCharacteristics"?!un(f):En(f,S)||S==="processRef"&&c.isExpanded===!1||S==="triggeredByEvent"?!1:S==="isForCompensation"?!un(f):!0});if(f=n.copyElement(p,f,w),c.eventDefinitionType&&(zy(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),x(p,"bpmn:Activity")){if(mc(p))d.isExpanded=Ue(s);else if(c&&En(c,"isExpanded")){d.isExpanded=c.isExpanded;var y=t.getDefaultSize(f,{isExpanded:d.isExpanded});d.width=y.width,d.height=y.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}Ue(s)&&!x(p,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(mc(p)&&!mc(f)&&(u.moveChildren=!1),x(p,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):u.moveChildren=!1;var _=qt(s);Ye(s).isHorizontal||(Ye(d).isHorizontal=_),d.width=_?s.width:t.getDefaultSize(d).width,d.height=_?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,ze(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&ze(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(f.default=p.default),c.host&&!x(p,"bpmn:BoundaryEvent")&&x(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}Hy.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function mc(e){return x(e,"bpmn:SubProcess")}function zy(e,t){var n=te(e);return t&&n.get("eventDefinitions").some(function(i){return x(i,t)})}function IA(e,t){return e.filter(function(n){return t.includes(n)})}const Gy={__depends__:[$y,kA,Vn],bpmnReplace:["type",Hy]};var NA=250;function jr(e){this._eventBus=e,this._tools=[],this._active=null}jr.$inject=["eventBus"],jr.prototype.registerTool=function(e,t){var n=this._tools;if(!t)throw new Error(`A tool has to be registered with it's "events"`);n.push(e),this.bindEvents(e,t)},jr.prototype.isActive=function(e){return e&&this._active===e},jr.prototype.length=function(e){return this._tools.length},jr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},jr.prototype.bindEvents=function(e,t){var n=this._eventBus,i=[];n.on(t.tool+".init",function(r){var o=r.context;if(!o.reactivate&&this.isActive(e)){this.setActive(null);return}this.setActive(e)},this),L(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,NA,function(r){this._active&&(BA(r)||this.setActive(null))},this)};function BA(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Mr(t,'.group[data-group="tools"]')}const gc={__depends__:[Ni],__init__:["toolManager"],toolManager:["type",jr]};function $A(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 jA(e,t){var n=[],i=new Set(e);L(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,s=o.outgoing;L(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 FA(e,t,n){var i=e.x,r=e.y,o=e.width,a=e.height,s=n.x,c=n.y;switch(t){case"n":return{x:i,y:r+c,width:o,height:a-c};case"s":return{x:i,y:r,width:o,height:a+c};case"w":return{x:i+s,y:r,width:o-s,height:a};case"e":return{x:i,y:r,width:o+s,height:a};default:throw new Error("unknown direction: "+t)}}var $p=Math.abs,HA=Math.round,Bi={x:"width",y:"height"},Vy="crosshair",lr={n:"top",w:"left",s:"bottom",e:"right"},zA=1500,yc={n:"s",w:"e",s:"n",e:"w"},vc=20;function Wn(e,t,n,i,r,o,a){this._canvas=e,this._dragging=t,this._eventBus=n,this._modeling=i,this._rules=r,this._toolManager=o,this._mouse=a;var s=this;o.registerTool("space",{tool:"spaceTool.selection",dragging:"spaceTool"}),n.on("spaceTool.selection.end",function(c){n.once("spaceTool.selection.ended",function(){s.activateMakeSpace(c.originalEvent)})}),n.on("spaceTool.move",zA,function(c){var u=c.context,l=u.initialized;l||(l=u.initialized=s.init(c,u)),l&&Uy(c)}),n.on("spaceTool.end",function(c){var u=c.context,l=u.axis,p=u.direction,f=u.movingShapes,d=u.resizingShapes,g=u.start;if(u.initialized){Uy(c);var h={x:0,y:0};h[l]=HA(c["d"+l]),s.makeSpace(f,d,h,p,g),n.once("spaceTool.ended",function(m){s.activateSelection(m.originalEvent,!0,!0)})}})}Wn.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Wn.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:Vy,data:{context:{reactivate:n}},trapClick:!1})},Wn.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:Vy,data:{context:{}}})},Wn.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},Wn.prototype.init=function(e,t){var n=$p(e.dx)>$p(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if($p(i)<5)return!1;i<0&&(i*=-1),ma(e)&&(i*=-1);var o=$A(n,i),a=this._canvas.getRootElement();!oc(e)&&e.hover&&(a=e.hover);var s=[...Jo(a),...a.attachers||[]],c=this.calculateAdjustments(s,n,i,r),u=this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:c.resizingShapes,start:r}),l=GA(c,n,o,r,u);return H(t,c,{axis:n,direction:o,spaceToolConstraints:l,start:r}),dc("resize-"+(n==="x"?"ew":"ns")),!0},Wn.prototype.calculateAdjustments=function(e,t,n,i){var r=this._rules,o=[],a=[],s=new Set,c=new Set,u=[],l=[];function p(d){s.has(d)||(s.add(d),o.push(d));var g=d.label;g&&!s.has(g)&&(s.add(g),o.push(g))}function f(d){c.has(d)||(c.add(d),a.push(d))}return L(e,function(d){if(!(!d.parent||Fe(d))){if(st(d)){l.push(d);return}var g=d[t],h=g+d[Bi[t]];if(VA(d)&&(n>0&&Oe(d)[t]>i||n<0&&Oe(d)[t]<i)){u.push(d);return}if(n>0&&g>i||n<0&&h<i){p(d);return}if(g<i&&h>i&&r.allowed("shape.resize",{shape:d})){f(d);return}}}),L(o,function(d){var g=d.attachers;g&&L(g,function(h){p(h)})}),L(u,function(d){var g=d.host;(s.has(g)||c.has(g))&&p(d)}),L(l,function(d){var g=d.source,h=d.target,m=d.label;(s.has(g)||c.has(g))&&(s.has(h)||c.has(h))&&m&&p(m)}),{movingShapes:o,resizingShapes:a}},Wn.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Wn.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function Wy(e){return{top:e.top-vc,right:e.right+vc,bottom:e.bottom+vc,left:e.left-vc}}function Uy(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;Le(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),Le(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),Le(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),Le(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function GA(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 L(a,function(f){var d=f.attachers,g=f.children,h=Pe(f),m=Ge(g,function(F){return!st(F)&&!Fe(F)&&!l.has(F)&&!p.has(F)}),w=Ge(g,function(F){return!st(F)&&!Fe(F)&&l.has(F)}),y,_,S,P=[],C=[],D,T,N,k;m.length&&(_=Wy(Pe(Tt(m))),y=i-h[lr[n]]+_[lr[n]],n==="n"?s.bottom=u=Le(u)?Math.min(u,y):y:n==="w"?s.right=u=Le(u)?Math.min(u,y):y:n==="s"?s.top=c=Le(c)?Math.max(c,y):y:n==="e"&&(s.left=c=Le(c)?Math.max(c,y):y)),w.length&&(S=Wy(Pe(Tt(w))),y=i-S[lr[yc[n]]]+h[lr[yc[n]]],n==="n"?s.bottom=u=Le(u)?Math.min(u,y):y:n==="w"?s.right=u=Le(u)?Math.min(u,y):y:n==="s"?s.top=c=Le(c)?Math.max(c,y):y:n==="e"&&(s.left=c=Le(c)?Math.max(c,y):y)),d&&d.length&&(d.forEach(function(F){l.has(F)?P.push(F):C.push(F)}),P.length&&(D=Pe(Tt(P.map(Oe))),T=h[lr[yc[n]]]-(D[lr[yc[n]]]-i)),C.length&&(N=Pe(Tt(C.map(Oe))),k=N[lr[n]]-(h[lr[n]]-i)),n==="n"?(y=Math.min(T||1/0,k||1/0),s.bottom=u=Le(u)?Math.min(u,y):y):n==="w"?(y=Math.min(T||1/0,k||1/0),s.right=u=Le(u)?Math.min(u,y):y):n==="s"?(y=Math.max(T||-1/0,k||-1/0),s.top=c=Le(c)?Math.max(c,y):y):n==="e"&&(y=Math.max(T||-1/0,k||-1/0),s.left=c=Le(c)?Math.max(c,y):y));var O=r&&r[f.id];O&&(n==="n"?(y=i+f[Bi[t]]-O[Bi[t]],s.bottom=u=Le(u)?Math.min(u,y):y):n==="w"?(y=i+f[Bi[t]]-O[Bi[t]],s.right=u=Le(u)?Math.min(u,y):y):n==="s"?(y=i-f[Bi[t]]+O[Bi[t]],s.top=c=Le(c)?Math.max(c,y):y):n==="e"&&(y=i-f[Bi[t]]+O[Bi[t]],s.left=c=Le(c)?Math.max(c,y):y))}),s}}function VA(e){return!!e.host}var jp="djs-dragging",qy="djs-resizing",WA=250,bc=Math.max;function Yy(e,t,n,i,r){function o(a,s){L(a,function(c){r.addDragger(c,s),n.addMarker(c,jp)})}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=Ce("g");he(l,i.cls("djs-crosshair-group",["no-events"])),Be(s,l);var p=Ce("path");he(p,"d",u.x),qe(p).add("djs-crosshair"),Be(l,p);var f=Ce("path");he(f,"d",u.y),qe(f).add("djs-crosshair"),Be(l,f),c.crosshairGroup=l}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;en(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&$t(c)}),e.on("spaceTool.move",WA,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=Ce("path"),he(c,"d","M0,0 L0,0"),qe(c).add("djs-crosshair"),Be(f,c),s.line=c;var d=Ce("g");he(d,i.cls("djs-drag-group",["no-events"])),Be(n.getActiveLayer(),d),o(l,d);var g=new Set(l);L(p,function(C){g.add(C)});var h=new Set,m=s.movingConnections=[];g.forEach(function(C){L(C.outgoing,function(D){h.has(D)||!st(D)||!g.has(D.target)||(h.add(D),m.push(D))})}),o(m,d),s.dragGroup=d}if(!s.frameGroup){var w=Ce("g");he(w,i.cls("djs-frame-group",["no-events"])),Be(n.getActiveLayer(),w);var y=[];L(p,function(C){var D=r.addFrame(C,w),T=D.getBBox();y.push({element:D,initialBounds:T}),n.addMarker(C,qy)}),s.frameGroup=w,s.frames=y}var _={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};he(c,{d:_[u]});var S={x:"y",y:"x"},P={x:a.dx,y:a.dy};P[S[s.axis]]=0,en(s.dragGroup,P.x,P.y),L(s.frames,function(C){var D=C.element,T=C.initialBounds,N,k;s.direction==="e"?he(D,{width:bc(T.width+P.x,5)}):(N=bc(T.width-P.x,5),he(D,{width:N,x:T.x+T.width-N})),s.direction==="s"?he(D,{height:bc(T.height+P.y,5)}):(k=bc(T.height-P.y,5),he(D,{height:k,y:T.y+T.height-k}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,u=s.movingConnections,l=s.resizingShapes,p=s.line,f=s.dragGroup,d=s.frameGroup;L(c,function(g){n.removeMarker(g,jp)}),L(u,function(g){n.removeMarker(g,jp)}),f&&($t(p),$t(f)),L(l,function(g){n.removeMarker(g,qy)}),d&&$t(d)})}Yy.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const UA={__init__:["spaceToolPreview"],__depends__:[Ni,bi,gc,Ao,va],spaceTool:["type",Wn],spaceToolPreview:["type",Yy]};function _c(e,t){e.invoke(Wn,this),this._canvas=t}_c.$inject=["injector","canvas"],de(_c,Wn),_c.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=Jr(uo(r.children.filter(u=>x(u,"bpmn:Artifact")),Tt(o))));const s=[...e,...a];var c=Wn.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(u){return!(x(u,"bpmn:TextAnnotation")||qA(u)&&(t==="y"&&qt(u)||t==="x"&&!qt(u)))}),c};function qA(e){return x(e,"bpmn:Participant")&&!te(e).processRef}const Ky={__depends__:[UA],spaceTool:["type",_c]};function bt(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)}bt.$inject=["eventBus","injector"],bt.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()},bt.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},bt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},bt.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()}},bt.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()}},bt.prototype.register=function(e,t){this._setHandler(e,t)},bt.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)},bt.prototype.canUndo=function(){return!!this._getUndoAction()},bt.prototype.canRedo=function(){return!!this._getRedoAction()},bt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},bt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},bt.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)})},bt.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},bt.prototype._createId=function(){return this._uid++},bt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},bt.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()},bt.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)},bt.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:ud("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},bt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=ke(e)?e:[e],t.dirty=t.dirty.concat(e))},bt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},bt.prototype._revertedAction=function(e){this._stackIdx--},bt.prototype._getHandler=function(e){return this._handlerMap[e]},bt.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 YA={commandStack:["type",bt]};function pr(e,t){if(typeof t!="function")throw new Error("removeFn iterator must be a function");if(!e)return[];for(var n;n=e[0];)t(n);return e}var KA=250,Xy=1400;function Fp(e,t,n){J.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",Xy,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=Zy(a),o.validatedShapes=Zy(s)}),i&&t.on("shape.move.start",KA,function(r){var o=r.context,a=new Set(o.shapes),s=new Set;for(const c of a)for(const u of c.labels)!u.hidden&&!a.has(u)&&s.add(u),c.labelTarget&&s.add(c);for(const c of s)i.makeDraggable(o,c,!0)}),this.preExecuted("elements.move",Xy,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];L(s,function(u){L(u.labels,function(l){s[l.id]||c.push(l)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(r){var o=r.context,a=o.connection||o.shape;pr(a.labels,function(s){n.removeShape(s,{nested:!0})})}),this.execute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.labelTarget;s&&(o.labelTargetIndex=bl(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&&(Pt(s.labels,a,c),a.labelTarget=s)})}de(Fp,J),Fp.$inject=["injector","eventBus","modeling"];function Zy(e){var t=new Set(e);return Ge(e,function(n){return!t.has(n.labelTarget)})}const XA={__init__:["labelSupport"],labelSupport:["type",Fp]};var ZA=251,Qy=1401,Jy="attach-ok";function Hp(e,t,n,i,r){J.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",Qy,function(a){var s=a.context,c=s.shapes,u=s.validatedShapes;s.shapes=QA(c),s.validatedShapes=JA(u)}),o&&t.on("shape.move.start",ZA,function(a){var s=a.context,c=s.shapes,u=zp(c);L(u,function(l){o.makeDraggable(s,l,!0),L(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,Jy),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(l,Jy)}))}}),this.preExecuted("elements.move",Qy,function(a){var s=a.context,c=s.closure,u=s.shapes,l=zp(u);L(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=Ge(c,function(p){var f=p.host;return eT(p)&&!tT(c,f)}),L(l,function(p){r.updateAttachment(p,u)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;L(s,function(c){L(c.attachers,function(u){L(u.outgoing.slice(),function(l){var p=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});p||r.removeConnection(l)}),L(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;pr(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&&L(u.attachers,function(l){var p=yg(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&&L(p,function(d){var g=yg(d,u,l);r.moveShape(d,g,d.parent),L(d.labels,function(h){r.moveShape(h,g,h.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;pr(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}de(Hp,J),Hp.$inject=["injector","eventBus","canvas","rules","modeling"];function zp(e){return ku(on(e,function(t){return t.attachers||[]}))}function QA(e){var t=zp(e);return $0("id",e,t)}function JA(e){var t=eo(e,"id");return Ge(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function eT(e){return!!e.host}function tT(e,t){return e.indexOf(t)!==-1}const nT={__depends__:[bi],__init__:["attachSupport"],attachSupport:["type",Hp]};function ev(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(Uh(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)})}ev.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const Gp={__init__:["changeSupport"],changeSupport:["type",ev]};function Un(e){this._model=e}Un.$inject=["moddle"],Un.prototype._needsId=function(e){return ze(e,["bpmn:RootElement","bpmn:FlowElement","bpmn:MessageFlow","bpmn:DataAssociation","bpmn:Artifact","bpmn:Participant","bpmn:Lane","bpmn:LaneSet","bpmn:Process","bpmn:Collaboration","bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane","bpmn:Property","bpmn:CategoryValue"])},Un.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;x(e,"bpmn:Activity")?t="Activity":x(e,"bpmn:Event")?t="Event":x(e,"bpmn:Gateway")?t="Gateway":ze(e,["bpmn:SequenceFlow","bpmn:MessageFlow"])?t="Flow":t=(e.$type||"").replace(/^[^:]*:/g,""),t+="_",!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e))},Un.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Un.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Un.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",H({bpmnElement:e,bounds:this.createDiBounds()},t))},Un.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Un.prototype.createDiWaypoints=function(e){var t=this;return on(e,function(n){return t.createDiWaypoint(n)})},Un.prototype.createDiWaypoint=function(e){return this.create("dc:Point",Qn(e,["x","y"]))},Un.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",H({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Un.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",H({bpmnElement:e},t))};function kn(e,t,n){J.call(this,e),this._bpmnFactory=t;var i=this;function r(d){var g=d.context,h=g.hints||{},m;!g.cropped&&h.createElementsBehavior!==!1&&(m=g.connection,m.waypoints=n.getCroppedWaypoints(m),g.cropped=!0)}this.executed(["connection.layout","connection.create"],r),this.reverted(["connection.layout"],function(d){delete d.context.cropped});function o(d){var g=d.context;i.updateParent(g.shape||g.connection,g.oldParent)}function a(d){var g=d.context,h=g.shape||g.connection,m=g.parent||g.newParent;i.updateParent(h,m)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],On(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],On(a));function s(d){var g=d.context,h=g.oldRoot,m=h.children;L(m,function(w){x(w,"bpmn:BaseElement")&&i.updateParent(w)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var g=d.context.shape;x(g,"bpmn:BaseElement")&&i.updateBounds(g)}this.executed(["shape.move","shape.create","shape.resize"],On(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],On(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"],On(u)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],On(u));function l(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],On(l)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],On(l)),this.executed("connection.reconnect",On(function(d){var g=d.context,h=g.connection,m=g.oldSource,w=g.newSource,y=te(h),_=te(m),S=te(w);y.conditionExpression&&!ze(S,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(g.oldConditionExpression=y.conditionExpression,delete y.conditionExpression),m!==w&&_.default===y&&(g.oldDefault=_.default,delete _.default)})),this.reverted("connection.reconnect",On(function(d){var g=d.context,h=g.connection,m=g.oldSource,w=g.newSource,y=te(h),_=te(m),S=te(w);g.oldConditionExpression&&(y.conditionExpression=g.oldConditionExpression),g.oldDefault&&(_.default=g.oldDefault,delete S.default)}));function p(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],On(p)),this.reverted(["element.updateAttachment"],On(p)),this.executed("element.updateLabel",On(f)),this.reverted("element.updateLabel",On(f));function f(d){const{element:g}=d.context,h=Bn(g),m=Ye(g),w=m&&m.get("label");rr(g)||ac(g)||(h&&!w?m.set("label",t.create("bpmndi:BPMNLabel")):!h&&w&&m.set("label",void 0))}}de(kn,J),kn.$inject=["eventBus","bpmnFactory","connectionDocking"],kn.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},kn.prototype.updateParent=function(e,t){if(!Fe(e)&&!(x(e,"bpmn:DataStoreReference")&&e.parent&&x(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=Ye(e),o=n&&n.businessObject,a=Ye(n);x(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),x(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),x(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(i,o),x(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},kn.prototype.updateBounds=function(e){var t=Ye(e),n=rT(e);if(n){var i=ni(n,t.get("bounds"));H(n,{x:e.x+i.x,y:e.y+i.y})}var r=Fe(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),H(o,{x:e.x,y:e.y,width:e.width,height:e.height})},kn.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;x(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),Rt(i,e)),x(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),Pt(r,e))}},kn.prototype.updateDiConnection=function(e,t,n){var i=Ye(e),r=Ye(t),o=Ye(n);i.sourceElement&&i.sourceElement.bpmnElement!==te(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==te(n)&&(i.targetElement=n&&o)},kn.prototype.updateDiParent=function(e,t){if(t&&!x(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(Rt(n,e),e.$parent=null)}};function iT(e){for(;e&&!x(e,"bpmn:Definitions");)e=e.$parent;return e}kn.prototype.getLaneSet=function(e){var t,n;return x(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(x(e,"bpmn:Participant")&&(e=e.processRef),n=e.get("laneSets"),t=n[0],t||(t=this._bpmnFactory.create("bpmn:LaneSet"),t.$parent=e,n.push(t)),t)},kn.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((x(e,"bpmn:DataInput")||x(e,"bpmn:DataOutput"))&&(x(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(x(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(x(e,"bpmn:FlowElement")){if(t){if(x(t,"bpmn:Participant"))t=t.processRef;else if(x(t,"bpmn:Lane"))do t=t.$parent.$parent;while(x(t,"bpmn:Lane"))}i="flowElements"}else if(x(e,"bpmn:Artifact")){for(;t&&!x(t,"bpmn:Process")&&!x(t,"bpmn:SubProcess")&&!x(t,"bpmn:Collaboration");)if(x(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(x(e,"bpmn:MessageFlow"))i="messageFlows";else if(x(e,"bpmn:Participant")){i="participants";var r=e.processRef,o;r&&(o=iT(e.$parent||t),e.$parent&&(Rt(o.get("rootElements"),r),r.$parent=null),t&&(Pt(o.get("rootElements"),r),r.$parent=o))}else x(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":x(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),Rt(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);Rt(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},kn.prototype.updateConnectionWaypoints=function(e){var t=Ye(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},kn.prototype.updateConnection=function(e){var t=e.connection,n=te(t),i=t.source,r=te(i),o=t.target,a=te(t.target),s;if(x(n,"bpmn:DataAssociation"))x(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=r,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):x(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||r,this.updateSemanticParent(n,r,s),n.targetRef=a);else{var c=x(n,"bpmn:SequenceFlow");n.sourceRef!==r&&(c&&(Rt(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(Rt(n.targetRef&&n.targetRef.get("incoming"),n),a&&a.get("incoming")&&a.get("incoming").push(n)),n.targetRef=a)}this.updateConnectionWaypoints(t),this.updateDiConnection(t,i,o)},kn.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function On(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;x(i,"bpmn:BaseElement")&&e(t)}}function rT(e){if(x(e,"bpmn:Activity")){var t=Ye(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function fr(e,t){Oi.call(this),this._bpmnFactory=e,this._moddle=t}de(fr,Oi),fr.$inject=["bpmnFactory","moddle"],fr.prototype._baseCreate=Oi.prototype.create,fr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,H({type:"label",di:n},Lr,t))}return this.createElement(e,t)},fr.prototype.createElement=function(e,t){t=H({},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(!aT(r)){var o=H({},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)}x(i,"bpmn:Group")&&(t=H({isFrame:!0},t)),t=oT(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Vp(r,t,"isExpanded")),ze(i,["bpmn:Lane","bpmn:Participant"])&&(t=Vp(r,t,"isHorizontal")),x(i,"bpmn:SubProcess")&&(t.collapsed=!Ue(i,r)),x(i,"bpmn:ExclusiveGateway")&&(En(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),Nt(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),Nt(t.cancelActivity)&&(i.cancelActivity=t.cancelActivity,delete t.cancelActivity);var a,s;return t.eventDefinitionType&&(a=i.get("eventDefinitions")||[],s=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),t.eventDefinitionType==="bpmn:ConditionalEventDefinition"&&(s.condition=this._bpmnFactory.create("bpmn:FormalExpression")),a.push(s),s.$parent=i,i.eventDefinitions=a,delete t.eventDefinitionType),n=this.getDefaultSize(i,r),t=H({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},fr.prototype.getDefaultSize=function(e,t){var n=te(e);if(t=t||Ye(e),x(n,"bpmn:SubProcess"))return Ue(n,t)?{width:350,height:200}:{width:100,height:80};if(x(n,"bpmn:Task"))return{width:100,height:80};if(x(n,"bpmn:Gateway"))return{width:50,height:50};if(x(n,"bpmn:Event"))return{width:36,height:36};if(x(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return Ue(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return x(n,"bpmn:Lane")?{width:400,height:100}:x(n,"bpmn:DataObjectReference")?{width:36,height:50}:x(n,"bpmn:DataStoreReference")?{width:50,height:50}:x(n,"bpmn:TextAnnotation")?{width:100,height:40}:x(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},fr.prototype.createParticipantShape=function(e){return Vt(e)||(e={isExpanded:e}),e=H({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function oT(e,t,n){return L(n,function(i){t=Vp(e,t,i)}),t}function Vp(e,t,n){return t[n]===void 0?t:(e[n]=t[n],si(t,[n]))}function aT(e){return ze(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function xc(e,t){this._modeling=e,this._canvas=t}xc.$inject=["modeling","canvas"],xc.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;L(n,function(r){var o={x:0,y:0};Nt(i.left)?o.x=i.left-r.x:Nt(i.right)?o.x=i.right-r.width-r.x:Nt(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:Nt(i.top)?o.y=i.top-r.y:Nt(i.bottom)?o.y=i.bottom-r.height-r.y:Nt(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},xc.prototype.postExecute=function(e){};function wc(e){this._modeling=e}wc.$inject=["modeling"],wc.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},wc.prototype.postExecute=function(e){var t=e.hints||{};sT(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 sT(e,t){return Ui(e.outgoing,function(n){return n.target===t})}function Ec(e,t){this._canvas=e,this._layouter=t}Ec.$inject=["canvas","layouter"],Ec.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},Ec.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var Sc=Math.round;function Wp(e){this._modeling=e}Wp.$inject=["modeling"],Wp.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;L(t,function(p){Le(p.x)||(p.x=0),Le(p.y)||(p.y=0)});var s=Ge(t,function(p){return!p.hidden}),c=Tt(s);L(t,function(p){st(p)&&(p.waypoints=on(p.waypoints,function(f){return{x:Sc(f.x-c.x-c.width/2+r.x),y:Sc(f.y-c.y-c.height/2+r.y)}})),H(p,{x:Sc(p.x-c.x-c.width/2+r.x),y:Sc(p.y-c.y-c.height/2+r.y)})});var u=new Set(Cs(t)),l={};L(t,function(p){if(st(p)){l[p.id]=Le(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=H({},o);u.has(p)||(f.autoResize=!1),Fe(p)&&(f=si(f,["attach"])),l[p.id]=Le(i)?a.createShape(p,Qn(p,["x","y","width","height"]),p.parent||n,i,f):a.createShape(p,Qn(p,["x","y","width","height"]),p.parent||n,f)}),e.elements=Jr(l)};var tv=Math.round;function dr(e){this._canvas=e}dr.$inject=["canvas"],dr.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,r=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?H(t,n):H(t,{x:n.x-tv(t.width/2),y:n.y-tv(t.height/2)}),this._canvas.addShape(t,i,r),t},dr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function _a(e){dr.call(this,e)}de(_a,dr),_a.$inject=["canvas"];var cT=dr.prototype.execute;_a.prototype.execute=function(e){var t=e.shape;return lT(t),t.labelTarget=e.labelTarget,cT.call(this,e)};var uT=dr.prototype.revert;_a.prototype.revert=function(e){return e.shape.labelTarget=null,uT.call(this,e)};function lT(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function xa(e,t){this._canvas=e,this._modeling=t}xa.$inject=["canvas","modeling"],xa.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;pr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),pr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},xa.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=bl(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},xa.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,Pt(n.children,t,i),this._canvas.addConnection(t,n),t};function Up(e,t){this._modeling=e,this._elementRegistry=t}Up.$inject=["modeling","elementRegistry"],Up.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;L(i,function(r){n.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};function wa(e,t){this._canvas=e,this._modeling=t}wa.$inject=["canvas","modeling"],wa.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;pr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),pr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),pr(n.children,function(i){st(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},wa.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=bl(i.children,n),t.removeShape(n),n},wa.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return Pt(i.children,n,r),t.addShape(n,i),n};function Rc(e){this._modeling=e}Rc.$inject=["modeling"];var nv={x:"y",y:"x"};Rc.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(m,w){m.range.min=Math.min(w[i],m.range.min),m.range.max=Math.max(w[i]+w[r],m.range.max)}function a(m){return m[i]+m[r]/2}function s(m){return m.length-1}function c(m){return m.max-m.min}function u(m,w){var y={y:0};y[i]=m-a(w),y[i]&&(y[nv[i]]=0,t.moveElements([w],y,w.parent))}var l=n[0],p=s(n),f=n[p],d,g,h=0;L(n,function(m,w){var y,_,S;if(m.elements.length<2){w&&w!==n.length-1&&(o(m,m.elements[0]),h+=c(m.range));return}y=ai(m.elements,i),_=y[0],w===p&&(_=y[s(y)]),S=a(_),m.range=null,L(y,function(P){if(u(S,P),m.range===null){m.range={min:P[i],max:P[i]+P[r]};return}o(m,P)}),w&&w!==n.length-1&&(h+=c(m.range))}),g=Math.abs(f.range.min-l.range.max),d=Math.round((g-h)/(n.length-1)),!(d<n.length-1)&&L(n,function(m,w){var y={},_;m===l||m===f||(_=n[w-1],m.range.max=0,L(m.elements,function(S,P){y[nv[i]]=0,y[i]=_.range.max-S[i]+d,m.range.min!==S[i]&&(y[i]+=S[i]-m.range.min),y[i]&&t.moveElements([S],y,S.parent),m.range.max=Math.max(S[i]+S[r],P?m.range.max:0)}))})},Rc.prototype.postExecute=function(e){};function Cc(e,t){this._layouter=e,this._canvas=t}Cc.$inject=["layouter","canvas"],Cc.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return H(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Cc.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function qp(){}qp.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=Rt(o.children,t),Pt(i.children,t,r),t.parent=i,L(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},qp.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return Rt(n.children,t),Pt(i.children,t,r),t.parent=i,L(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 Yp(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Yp.prototype.add=function(e,t){return this.addAll([e],t)},Yp.prototype.addAll=function(e,t){var n=F1(e,!!t,this);return H(this,n),this};function Ea(e){this._modeling=e}Ea.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},Ea.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,u=e.topLevel,l=!1;r&&r.parent===n&&(l=!0),L(a,function(p){o.moveShape(p,t,u[p.id]&&!l&&n,{recurse:!1,layout:!1})}),L(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&&tp(p,p.source,t),connectionEnd:d&&np(p,p.target,t)})})},Ea.prototype.getClosure=function(e){return new Yp().addAll(e,!0)};function Pc(e){this._helper=new Ea(e)}Pc.$inject=["modeling"],Pc.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Pc.prototype.postExecute=function(e){var t=e.hints,n;t&&t.primaryShape&&(n=t.primaryShape,t.oldParent=n.parent),this._helper.moveClosure(e.closure,e.delta,e.newParent,e.newHost,n)};function Fr(e){this._modeling=e,this._helper=new Ea(e)}Fr.$inject=["modeling"],Fr.prototype.execute=function(e){var t=e.shape,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldBounds=Qn(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=Rt(o.children,t),Pt(i.children,t,r),H(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Fr.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;i.layout!==!1&&(L(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:np(o,t,n)})}),L(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:tp(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},Fr.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return Pt(n.children,t,i),H(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},Fr.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Fr.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function Sa(e){this._modeling=e}Sa.$inject=["modeling"],Sa.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,i=e.connection,r=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return ke(r)&&(e.oldWaypoints=i.waypoints,i.waypoints=r),t&&(e.oldSource=i.source,i.source=t),n&&(e.oldTarget=i.target,i.target=n),i},Sa.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,i=e.newTarget,r=e.dockingOrPoints,o=e.hints||{},a={};o.connectionStart&&(a.connectionStart=o.connectionStart),o.connectionEnd&&(a.connectionEnd=o.connectionEnd),o.layoutConnection!==!1&&(n&&(!i||o.docking==="source")&&(a.connectionStart=a.connectionStart||iv(ke(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||iv(ke(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},Sa.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,i=e.oldWaypoints,r=e.connection;return t&&(r.source=t),n&&(r.target=n),i&&(r.waypoints=i),r};function iv(e){return e.original||e}function $i(e,t){this._modeling=e,this._rules=t}$i.$inject=["modeling","rules"],$i.prototype.preExecute=function(e){var t=this,n=this._modeling,i=this._rules,r=e.oldShape,o=e.newData,a=e.hints||{},s;function c(g,h,m){return i.allowed("connection.reconnect",{connection:m,source:g,target:h})}var u={x:o.x,y:o.y},l={x:r.x,y:r.y,width:r.width,height:r.height};s=e.newShape=e.newShape||t.createShape(o,u,r.parent,a),r.host&&n.updateAttachment(s,r.host);var 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();L(f,function(g){var h=g.source,m=c(h,s,g);m&&t.reconnectEnd(g,s,ec(g,s,l),a)}),L(d,function(g){var h=g.target,m=c(s,h,g);m&&t.reconnectStart(g,s,Js(g,s,l),a)})},$i.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},$i.prototype.execute=function(e){},$i.prototype.revert=function(e){},$i.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},$i.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},$i.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function Ra(e){this._modeling=e}Ra.$inject=["modeling"],Ra.prototype.execute=function(e){var t=e.shape,n=e.newBounds,i=e.minBounds;if(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)throw new Error("newBounds must have {x, y, width, height} properties");if(i&&(n.width<i.width||n.height<i.height))throw new Error("width and height cannot be less than minimum height and width");if(!i&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},H(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Ra.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(L(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:ec(o,n,i)})}),L(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:Js(o,n,i)})}))},Ra.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return H(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function hr(e){this._modeling=e}hr.$inject=["modeling"],hr.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,r=e.resizingShapes,o=e.start,a={};this.moveShapes(i,t),L(r,function(s){a[s.id]=fT(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(jA(i,r),t,n,o,i,r,a)},hr.prototype.execute=function(){},hr.prototype.revert=function(){},hr.prototype.moveShapes=function(e,t){var n=this;L(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},hr.prototype.resizeShapes=function(e,t,n){var i=this;L(e,function(r){var o=FA(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},hr.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=new Set(r),u=new Set(o);L(e,function(l){var p=l.source,f=l.target,d=pT(l),g=ov(n),h={},m=c.has(p)||u.has(p),w=c.has(f)||u.has(f);m&&w?(d=on(d,function(y){return av(y,i,n)&&(y[g]=y[g]+t[g]),y.original&&av(y.original,i,n)&&(y.original[g]=y.original[g]+t[g]),y}),s._modeling.updateWaypoints(l,d,{labelBehavior:!1})):(m||w)&&(c.has(p)?h.connectionStart=tp(l,p,t):c.has(f)?h.connectionEnd=np(l,f,t):u.has(p)?h.connectionStart=Js(l,p,a[p.id]):u.has(f)&&(h.connectionEnd=ec(l,f,a[f.id])),s._modeling.layoutConnection(l,h))})};function rv(e){return H({},e)}function pT(e){return on(e.waypoints,function(t){return t=rv(t),t.original&&(t.original=rv(t.original)),t})}function ov(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function av(e,t,n){var i=ov(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function fT(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Ac(e){this._modeling=e}Ac.$inject=["modeling"],Ac.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=sv(n),t.collapsed=!t.collapsed;var i=cv(n,t.collapsed);return[t].concat(i)},Ac.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=uv(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function sv(e){var t={};return L(e,function(n){t[n.id]=n.hidden,n.children&&(t=H({},t,sv(n.children)))}),t}function cv(e,t){var n=[];return L(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(cv(i.children,i.collapsed||t)))}),n}function uv(e,t){var n=[];return L(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(uv(i.children,t)))}),n}function Tc(e){this._modeling=e}Tc.$inject=["modeling"],Tc.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=lv(i,t),pv(n,t),t.host=n,t},Tc.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,lv(n,t),pv(i,t,r),t};function lv(e,t){return Rt(e&&e.attachers,t)}function pv(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),Pt(i,t,n)}}function Kp(){}Kp.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},Kp.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function ct(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}ct.$inject=["eventBus","elementFactory","commandStack"],ct.prototype.getHandlers=function(){return{"shape.append":wc,"shape.create":dr,"shape.delete":wa,"shape.move":Fr,"shape.resize":Ra,"shape.replace":$i,"shape.toggleCollapse":Ac,spaceTool:hr,"label.create":_a,"connection.create":Ec,"connection.delete":xa,"connection.move":qp,"connection.layout":Cc,"connection.updateWaypoints":Kp,"connection.reconnect":Sa,"elements.create":Wp,"elements.move":Pc,"elements.delete":Up,"elements.distribute":Rc,"elements.align":xc,"element.updateAttachment":Tc}},ct.prototype.registerHandlers=function(e){L(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},ct.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)},ct.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},ct.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)},ct.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)},ct.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},ct.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},ct.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},ct.prototype.createElements=function(e,t,n,i,r){ke(e)||(e=[e]),typeof i!="number"&&(r=i,i=void 0),r=r||{};var o={position:t,elements:e,parent:n,parentIndex:i,hints:r};return this._commandStack.execute("elements.create",o),o.elements},ct.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},ct.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},ct.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},ct.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},ct.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},ct.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},ct.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},ct.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},ct.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},ct.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)},ct.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},ct.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)},ct.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,H(i,{docking:"source"}))},ct.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,H(i,{docking:"target"}))},ct.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},ct.prototype._create=function(e,t){return RS(t)?t:this._elementFactory.create(e,t)},ct.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function Ca(e){this._elementRegistry=e}Ca.$inject=["elementRegistry"],Ca.prototype.execute=function(e){var t=e.element,n=e.moddleElement,i=e.properties;if(!n)throw new Error("<moddleElement> required");var r=e.changed||this._getVisualReferences(n).concat(t),o=e.oldProperties||dT(n,ts(i));return fv(n,i),e.oldProperties=o,e.changed=r,r},Ca.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return fv(n,t),i},Ca.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return x(e,"bpmn:DataObject")?hT(e,t):[]};function dT(e,t){return Sn(t,function(n,i){return n[i]=e.get(i),n},{})}function fv(e,t){L(t,function(n,i){e.set(i,n)})}function hT(e,t){return t.filter(function(n){return x(n,"bpmn:DataObjectReference")&&te(n).dataObjectRef===e})}var Pa="default",ji="id",dv="di",mT={width:0,height:0};function Aa(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}Aa.$inject=["elementRegistry","moddle","modeling","textRenderer"],Aa.prototype.execute=function(e){var t=e.element,n=[t];if(!t)throw new Error("element required");var i=this._elementRegistry,r=this._moddle.ids,o=t.businessObject,a=_T(e.properties),s=e.oldProperties||gT(t,a);return hv(a,o)&&(r.unclaim(o[ji]),i.updateId(t,a[ji]),r.claim(a[ji],o)),Pa in a&&(a[Pa]&&n.push(i.get(a[Pa].id)),o[Pa]&&n.push(i.get(o[Pa].id))),mv(t,a),e.oldProperties=s,e.changed=n,n},Aa.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&te(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,mT)}},Aa.prototype.revert=function(e){var t=e.element,n=e.properties,i=e.oldProperties,r=t.businessObject,o=this._elementRegistry,a=this._moddle.ids;return mv(t,i),hv(n,r)&&(a.unclaim(n[ji]),o.updateId(t,i[ji]),a.claim(i[ji],r)),e.changed};function hv(e,t){return ji in e&&e[ji]!==t[ji]}function gT(e,t){var n=ts(t),i=e.businessObject,r=Ye(e);return Sn(n,function(o,a){return a!==dv?o[a]=i.get(a):o[a]=yT(r,ts(t.di)),o},{})}function yT(e,t){return Sn(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function mv(e,t){var n=e.businessObject,i=Ye(e);L(t,function(r,o){o!==dv?n.set(o,r):i&&vT(i,r)})}function vT(e,t){L(t,function(n,i){e.set(i,n)})}var bT=["default"];function _T(e){var t=H({},e);return bT.forEach(function(n){n in e&&(t[n]=te(t[n]))}),t}function Mc(e,t){this._canvas=e,this._modeling=t}Mc.$inject=["canvas","modeling"],Mc.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=Ye(r);return t.setRootElement(n),t.removeRootElement(r),Pt(a.rootElements,i),i.$parent=a,Rt(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},Mc.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=Ye(n);return t.setRootElement(r),t.removeRootElement(n),Rt(a.rootElements,i),i.$parent=null,Pt(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function Xp(e,t){this._modeling=e,this._spaceTool=t}Xp.$inject=["modeling","spaceTool"],Xp.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=zn(i),a=o===i,s=a?i:i.parent,c=ar(s),u=qt(i);if(u?r==="left"?r="top":r==="right"&&(r="bottom"):r==="top"?r="left":r==="bottom"&&(r="right"),!c.length){var l=u?{x:i.x+Hn,y:i.y,width:i.width-Hn,height:i.height}:{x:i.x,y:i.y+Hn,width:i.width,height:i.height-Hn};n.createShape({type:"bpmn:Lane",isHorizontal:u},l,s)}var p=[];Or(o,function(S){return p.push(S),S.label&&p.push(S.label),S===i?[]:Ge(S.children,function(P){return P!==i})});var f,d,g,h,m;r==="top"?(f=-120,d=i.y,g=d+10,h="n",m="y"):r==="left"?(f=-120,d=i.x,g=d+10,h="w",m="x"):r==="bottom"?(f=120,d=i.y+i.height,g=d-10,h="s",m="y"):r==="right"&&(f=120,d=i.x+i.width,g=d-10,h="e",m="x");var w=t.calculateAdjustments(p,m,f,g),y=u?{x:0,y:f}:{x:f,y:0};t.makeSpace(w.movingShapes,w.resizingShapes,y,h,g);var _=u?{x:i.x+(a?Hn:0),y:d-(r==="top"?120:0),width:i.width-(a?Hn:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?Hn:0),width:120,height:i.height-(a?Hn:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:u},_,s)};function Zp(e){this._modeling=e}Zp.$inject=["modeling"],Zp.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=ar(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=qt(n),s=a?n.height:n.width,c=Math.round(s/i),u,l,p,f;for(f=0;f<i;f++)f===i-1?u=s-c*f:u=c,l=a?{x:n.x+Hn,y:n.y+f*c,width:n.width-Hn,height:u}:{x:n.x+f*c,y:n.y+Hn,width:u,height:n.height-Hn},f<o?t.resizeShape(r[f],l):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,l,n))};function Ta(e,t){this._modeling=e,this._spaceTool=t}Ta.$inject=["modeling","spaceTool"],Ta.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Ta.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=hC(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},Ta.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=Pe(e),r=Pe(t),o=qm(r,i),a=zn(e),s=[],c=[];Or(a,function(g){return s.push(g),(x(g,"bpmn:Lane")||x(g,"bpmn:Participant"))&&c.push(g),g.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 Ma="flowNodeRef",Qp="lanes";function kc(){}kc.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(l,p){var f=Pe(p),d={x:l.x+l.width/2,y:l.y+l.height/2};return d.x>f.left&&d.x<f.right&&d.y>f.top&&d.y<f.bottom}function s(l){n.indexOf(l)===-1&&(o.push(l),n.push(l))}function c(l){var p=zn(l);return r[p.id]||(r[p.id]=Ys(p)),r[p.id]}function u(l){if(!l.parent)return[];var p=c(l);return p.filter(function(f){return a(l,f)}).map(function(f){return f.businessObject})}return t.forEach(function(l){var p=zn(l);if(!(!p||n.indexOf(p)!==-1)){var f=p.children.filter(function(d){return x(d,"bpmn:FlowNode")});f.forEach(s),n.push(p)}}),e.forEach(s),o.forEach(function(l){var p=l.businessObject,f=p.get(Qp),d=f.slice(),g=u(l);i.push({flowNode:p,remove:d,add:g})}),t.forEach(function(l){var p=l.businessObject;l.parent||p.get(Ma).forEach(function(f){i.push({flowNode:f,remove:[p],add:[]})})}),i},kc.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(Qp);n.remove.forEach(function(o){Rt(r,o),Rt(o.get(Ma),i)}),n.add.forEach(function(o){Pt(r,o),Pt(o.get(Ma),i)})}),[]},kc.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(Qp);n.add.forEach(function(o){Rt(r,o),Rt(o.get(Ma),i)}),n.remove.forEach(function(o){Pt(r,o),Pt(o.get(Ma),i)})}),[]};var Jp="categoryValueRef";function ka(e,t){this._bpmnFactory=e,this._elementRegistry=t}ka.$inject=["bpmnFactory","elementRegistry"],ka.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,r=new Map,o=[],a=new Map;function s(y,_,S){if(_){var P=a.get(y);P||(P={},a.set(y,P)),!(S&&P.present)&&(!S&&P.past||(S?P.present={categoryValue:_,root:ef(y)}:P.past={categoryValue:_}))}}function c(y){r.set(y,te(y))}function u(){n.filter(function(y){return x(y,"bpmn:FlowElement")&&!Fe(y)&&y.parent}).forEach(c)}function l(y){var _=te(y),S=_.get("categoryValueRef");return S||(S=zm(i,_),o.push(xT(y,S))),S}function p(y){return y.reduce(function(_,S){var P=ef(S),C=_.get(P);return C||(C=[],_.set(P,C)),C.push(S),_},new Map)}e=Array.from(e||[]);var f=p(e);t.length&&u(),e.forEach(c),n.filter(function(y){return x(y,"bpmn:Group")&&!Fe(y)&&y.parent}).forEach(function(y){var _=te(y).get("categoryValueRef");if(!_){var S=ef(y),P=f.get(S)||[],C=uo(P,y),D=Object.keys(C).length>0;D&&(_=l(y))}s(y,_,!0)}),t.forEach(function(y){s(y.groupShape,y.categoryValue,!1)}),o.length&&u();var d=Array.from(r.keys()),g=Array.from(a.values()).reduce(function(y,_){return _.present&&y.add(_.present.categoryValue),_.past&&y.add(_.past.categoryValue),y},new Set),h=new Map,m=p(d);a.forEach(function(y,_){var S=y.present;if(S){var P=m.get(S.root)||[],C=uo(P,_);P.forEach(function(D){if(C[D.id]){var T=h.get(D);T||(T=new Set,h.set(D,T)),T.add(S.categoryValue)}})}});var w=d.reduce(function(y,_){var S=r.get(_),P=S.get(Jp),C=new Set(P),D=h.get(_)||new Set,T=Array.from(D).filter(function(k){return!C.has(k)}),N=P.filter(function(k){return g.has(k)&&!D.has(k)});return(T.length||N.length)&&y.push({businessObject:S,categoryValuesToAdd:T,categoryValuesToRemove:N}),y},[]);return{flowElements:w,groups:o}},ka.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),wT(t.groups),ST(t.flowElements),[]},ka.prototype.revert=function(e){var t=e.updates;return RT(t.flowElements),ET(t.groups),[]};function xT(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function wT(e){e.forEach(function(t){te(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function ET(e){e.forEach(function(t){te(t.groupShape).categoryValueRef=null})}function ST(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Jp);t.categoryValuesToRemove.forEach(function(r){Rt(i,r)}),t.categoryValuesToAdd.forEach(function(r){Pt(i,r,!0)})})}function RT(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Jp);t.categoryValuesToAdd.forEach(function(r){Rt(i,r)}),t.categoryValuesToRemove.forEach(function(r){Pt(i,r,!0)})})}function ef(e){for(;e.parent;)e=e.parent;return e}function Oc(e){this._moddle=e}Oc.$inject=["moddle"],Oc.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),[]},Oc.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 CT={fill:void 0,stroke:void 0};function tf(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(wn(t)){var n=PT(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}tf.$inject=["commandStack"],tf.prototype.postExecute=function(e){var t=e.elements,n=e.colors||CT,i=this,r={};"fill"in n&&H(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&H(r,{"border-color":this._normalizeColor(n.stroke)}),L(t,function(o){var a=st(o)?Qn(r,["border-color"]):r,s=Ye(o);if(AT(a),Fe(o)){if(!s||!x(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:s.label,properties:{color:r["border-color"]}})}else{if(!ze(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function PT(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 AT(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var TT={width:0,height:0};function gv(e,t,n){function i(c,u){var l=c.label||c,p=c.labelTarget||c;return iR(l,u),[l,p]}function r(c){var u=c.element,l=u.businessObject,p=c.newLabel;if(!Fe(u)&&rr(u)&&!Is(u)&&!yv(p)){var f=7,d=Rl(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=Bn(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(!(!Fe(l)&&!x(l,"bpmn:TextAnnotation"))){if(Fe(l)&&yv(p)){d.removeShape!==!1&&e.removeShape(l,{unsetLabel:!1});return}var g=Bn(u);typeof f>"u"&&(f=t.getExternalLabelBounds(l,g)),f&&e.resizeShape(l,f,TT)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}gv.$inject=["modeling","textRenderer","bpmnFactory"];function yv(e){return!e||!e.trim()}function nn(e,t,n,i){ct.call(this,e,t,n),this._bpmnRules=i}de(nn,ct),nn.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],nn.prototype.getHandlers=function(){var e=ct.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=Ca,e["element.updateProperties"]=Aa,e["canvas.updateRoot"]=Mc,e["lane.add"]=Xp,e["lane.resize"]=Ta,e["lane.split"]=Zp,e["lane.updateRefs"]=kc,e["group.updateRefs"]=ka,e["id.updateClaim"]=Oc,e["element.setColor"]=tf,e["element.updateLabel"]=gv,e},nn.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},nn.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)},nn.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},nn.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},nn.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},nn.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},nn.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},nn.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},nn.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},nn.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},nn.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},nn.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},nn.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},nn.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function vv(){}vv.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||Oe(t.source||e.source),t.connectionEnd||Oe(t.target||e.target)]};var Dc=20,MT=5,Lc=Math.round,bv=20,kT={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function OT(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function DT(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function _v(e,t,n){var i=Jt(t,e,MT),r=n.split(":")[0],o=Lc((t.x-e.x)/2+e.x),a=Lc((t.y-e.y)/2+e.y),s,c,u=DT(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=OT(i,r),c=l?"h:v":"v:h",p?l?(f=a===e.y,s={x:e.x+Dc*(/l/.test(r)?-1:1),y:f?a+Dc:a}):(f=o===e.x,s={x:f?o+Dc:o,y:e.y+Dc*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:nf(e,s,c).concat(s),directions:c,turnNextDirections:f}}function LT(e,t,n){return _v(e,t,n)}function IT(e,t,n){var i=_v(t,e,xv(n));return{waypoints:i.waypoints.slice().reverse(),directions:xv(i.directions),turnNextDirections:i.turnNextDirections}}function NT(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=nf(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function xv(e){return e.split(":").reverse().join(":")}function BT(e,t,n){var i=Lc((t.x-e.x)/2+e.x),r=Lc((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 nf(e,t,n){if(n=n||"h:h",!UT(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Ev(n)){var i=LT(e,t,n),r=IT(e,t,n),o=NT(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return BT(e,t,n)}function $T(e,t,n){var i=nf(e,t,n);return i.unshift(e),i.push(t),Rv(i)}function jT(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=N0(o,"straight")[0]||"h:h",s=kT[a]||0,c=Jt(e,t,s),u=WT(c,a);n=n||Oe(e),i=i||Oe(t);var l=u.split(":"),p=Sv(n,e,l[0],qT(c)),f=Sv(i,t,l[1],c);return $T(p,f,u)}function FT(e,t,n,i,r,o){ke(n)&&(r=n,o=i,n=Oe(e),i=Oe(t)),o=H({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&zT(e,t,n,i,o),c||(c=o.connectionEnd&&VT(t,e,i,r),c)||(c=o.connectionStart&>(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:jT(e,t,n,i,o)}function HT(e,t,n){return e>=t&&e<=n}function wv(e,t,n){var i={x:"width",y:"height"};return HT(t[e],n[e],n[e]+n[i[e]])}function zT(e,t,n,i,r){var o={},a,s;return s=Jt(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?wv(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:wv(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 GT(e,t,n,i){return rf(e,t,n,i)}function VT(e,t,n,i){var r=i.slice().reverse();return r=rf(e,t,n,r),r?r.reverse():null}function rf(e,t,n,i){function r(l){return l.length<3?!0:l.length>4?!1:!!lt(l,function(p,f){var d=l[f-1];return d&&ta(p,d)<3})}function o(l,p,f){var d=Mi(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(Yh(l[d],p,bv)||Yh(l[d],f,bv))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=rf(e,t,n,u)),c&&Mi(c)?null:c}function WT(e,t){if(Ev(t))return t;switch(e){case"intersect":return"t:t";case"top":case"bottom":return"v:v";case"left":case"right":return"h:h";default:return t}}function UT(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Ev(e){return e&&/t|r|b|l/.test(e)}function qT(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 Sv(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 Rv(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return _l(r,o,n,0)||t.push(n),t},[])}var YT=-10,KT=40,XT={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},ZT={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},of={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Oa={top:"t",right:"r",bottom:"b",left:"l"};function Ic(e){this._elementRegistry=e}de(Ic,vv),Ic.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=Cv(r&&r[0],n)),a||(a=Cv(r&&r[r.length-1],i)),(x(e,"bpmn:Association")||x(e,"bpmn:DataAssociation"))&&r&&!Pv(n,i))return[].concat([o],r.slice(1,-1),[a]);var l=$m(n,s)?XT:ZT;return x(e,"bpmn:MessageFlow")?c=JT(n,i,l):(x(e,"bpmn:SequenceFlow")||Pv(n,i))&&(n===i?c={preferredLayouts:oM(n,e,l)}:x(n,"bpmn:BoundaryEvent")?c={preferredLayouts:aM(n,i,a,l)}:Da(n)||Da(i)?c={preferredLayouts:l.subProcess,preserveDocking:tM(n)}:x(n,"bpmn:Gateway")?c={preferredLayouts:l.fromGateway}:x(i,"bpmn:Gateway")?c={preferredLayouts:l.toGateway}:c={preferredLayouts:l.default}),c&&(c=H(c,t),u=Rv(FT(n,i,o,a,r,c))),u||[o,a]};function QT(e){var t=e.host;return Jt(Oe(e),t,YT)}function JT(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:eM(e,t)}}function eM(e,t){return x(t,"bpmn:Participant")?"source":x(e,"bpmn:Participant")?"target":Da(t)?"source":Da(e)||x(t,"bpmn:Event")?"target":x(e,"bpmn:Event")?"source":null}function tM(e){return Da(e)?"target":"source"}function Cv(e,t){return e?e.original||e:Oe(t)}function Pv(e,t){return x(t,"bpmn:Activity")&&x(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Da(e){return x(e,"bpmn:SubProcess")&&Ue(e)}function Hr(e,t){return e===t}function nM(e,t){return t.indexOf(e)!==-1}function To(e){var t=/right|left/.exec(e);return t&&t[0]}function Mo(e){var t=/top|bottom/.exec(e);return t&&t[0]}function Av(e,t){return of[e]===t}function iM(e,t){var n=To(e),i=of[n];return t.indexOf(i)!==-1}function rM(e,t){var n=Mo(e),i=of[n];return t.indexOf(i)!==-1}function Tv(e){return e==="right"||e==="left"}function oM(e,t,n){var i=t.waypoints,r=i&&i.length&&Jt(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function aM(e,t,n,i){var r=Oe(e),o=Oe(t),a=QT(e),s,c,u=Hr(e.host,t),l=nM(a,["top","right","bottom","left"]),p=Jt(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?sM(a,l,e,t,n,i):(s=cM(a,p,l,i.isHorizontal),c=uM(a,p,l,i.isHorizontal),[s+":"+c])}function sM(e,t,n,i,r,o){var a=t?e:o.isHorizontal?Mo(e):To(e),s=Oa[a],c;return t?Tv(e)?c=Mv("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=Mv("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function Mv(e,t,n,i){var r=KT;return!(af(e,i,n,r)||af(e,i,{x:n.x+n.width,y:n.y+n.height},r)||af(e,i,Oe(t),r))}function af(e,t,n,i){return Math.abs(t[e]-n[e])<i}function cM(e,t,n,i){if(n)return Oa[e];var r=Mo(e),o=To(e),a=Mo(t),s=To(t);if(i){if(Hr(r,a)||Av(o,s))return Oa[r]}else if(Hr(o,s)||Av(r,a))return Oa[o];return Oa[i?o:r]}function uM(e,t,n,i){if(n)return Tv(e)?iM(e,t)||Hr(e,t)?"h":"v":rM(e,t)||Hr(e,t)?"v":"h";var r=Mo(e),o=To(e),a=Mo(t),s=To(t);return a&&!s?"v":s&&!a?"h":i?Hr(r,a)?"h":"v":Hr(o,s)?"v":"h"}Ic.$inject=["elementRegistry"];function kv(e){return H({original:e.point.original||e.point},e.actual)}function mr(e,t){this._elementRegistry=e,this._graphicsFactory=t}mr.$inject=["elementRegistry","graphicsFactory"],mr.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),r=this.getDockingPoint(e,n),o=e.waypoints.slice(i.idx+1,r.idx);return o.unshift(kv(i)),o.push(kv(r)),o},mr.prototype.getDockingPoint=function(e,t,n){var i=e.waypoints,r,o,a;return r=n?0:i.length-1,o=i[r],a=this._getIntersection(t,e,n),{point:o,actual:a||o,idx:r}},mr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return na(i,r,n)},mr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},mr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},mr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const sf={__init__:["modeling","bpmnUpdater"],__depends__:[AP,VP,UP,qP,Gy,YA,XA,nT,Vn,Gp,Ky],bpmnFactory:["type",Un],bpmnUpdater:["type",kn],elementFactory:["type",fr],modeling:["type",nn],layouter:["type",Ic],connectionDocking:["type",mr]};var lM=10,Ov=50,pM=250;function cf(e,t,n,i){for(var r;r=fM(e,n,t);)n=i(t,n,r);return n}function uf(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 fM(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=hM(e);return lt(r,function(o){if(o===n)return!1;var a=Jt(o,i,lM);return a==="intersect"})}function dM(e,t){t||(t={});function n(g){return g.source===e?1:-1}var i=t.defaultDistance||Ov,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||pM,c=t.reference||"start";o||(o=yM);function u(g,h){return r==="n"?c==="start"?Pe(g).top-Pe(h).bottom:c==="center"?Pe(g).top-Oe(h).y:Pe(g).top-Pe(h).top:r==="w"?c==="start"?Pe(g).left-Pe(h).right:c==="center"?Pe(g).left-Oe(h).x:Pe(g).left-Pe(h).left:r==="s"?c==="start"?Pe(h).top-Pe(g).bottom:c==="center"?Oe(h).y-Pe(g).bottom:Pe(h).bottom-Pe(g).bottom:c==="start"?Pe(h).left-Pe(g).right:c==="center"?Oe(h).x-Pe(g).right:Pe(h).right-Pe(g).right}var l=e.incoming.filter(o).map(function(g){var h=a(g),m=h<0?u(g.source,e):u(e,g.source);return{id:g.source.id,distance:m,weight:h}}),p=e.outgoing.filter(o).map(function(g){var h=a(g),m=h>0?u(e,g.target):u(g.target,e);return{id:g.target.id,distance:m,weight:h}}),f=l.concat(p).reduce(function(g,h){return g[h.id+"__weight_"+h.weight]=h,g},{}),d=Sn(f,function(g,h){var m=h.distance,w=h.weight;return m<0||m>s||(g[String(m)]||(g[String(m)]=0),g[String(m)]+=1*w,(!g.distance||g[g.distance]<g[String(m)])&&(g.distance=m)),g},{});return d.distance||i}function hM(e){var t=lf(e);return e.host&&(t=t.concat(lf(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(lf(i))},[]))),t}function lf(e){return gM(e).concat(mM(e))}function mM(e){return e.incoming.map(function(t){return t.source})}function gM(e){return e.outgoing.map(function(t){return t.target})}function yM(){return!0}var vM=100;function Dv(e,t,n){e.on("autoPlace",vM,function(i){var r=i.shape,o=i.source;return bM(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}}Dv.$inject=["eventBus","modeling","canvas"];function bM(e,t,n){n||(n={});var i=n.defaultDistance||Ov,r=Oe(e),o=Pe(e);return{x:o.right+i+t.width/2,y:r.y}}function Lv(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}Lv.$inject=["eventBus","selection"];const _M={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",Dv],autoPlaceSelectionBehavior:["type",Lv]};function Iv(e,t,n){var i=$m(e,n);if(x(t,"bpmn:TextAnnotation"))return wM(e,t,i);if(ze(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return EM(e,t,i);if(x(t,"bpmn:FlowNode"))return xM(e,t,i)}function xM(e,t,n){var i=Pe(e),r=Oe(e),o=n?{directionHint:"e",minDistance:80,baseOrientation:"left",boundaryOrientation:"top",start:"top",end:"bottom"}:{directionHint:"s",minDistance:90,baseOrientation:"top",boundaryOrientation:"left",start:"left",end:"right"},a=dM(e,{filter:function(d){return x(d,"bpmn:SequenceFlow")},direction:o.directionHint}),s=30,c=o.minDistance,u=o.baseOrientation;x(e,"bpmn:BoundaryEvent")&&(u=Jt(e,e.host,-25),u.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var l=n?{x:i.right+a+t.width/2,y:r.y+Nv(u,c,o)}:{x:r.x+Nv(u,c,o),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},f=n?{y:p}:{x:p};return cf(e,t,l,uf(f))}function Nv(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function wM(e,t,n){var i=Pe(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};st(e)&&(r=Oe(e),n?(r.x+=100,r.y-=50):(r.x+=100,r.y+=50));var o={margin:n?-30:30,minDistance:20},a=n?{y:o}:{x:o};return cf(e,t,r,uf(a))}function EM(e,t,n){var i=Pe(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 cf(e,t,r,uf(a))}function Bv(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return Iv(r,i,t)})}Bv.$inject=["eventBus","elementRegistry"];const Nc={__depends__:[_M],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",Bv]},$v=[Nm,ca,sf,Nc];function SM(e={}){kd(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new fo({container:t,moddleExtensions:e.moddleExtensions??cs,additionalModules:[...$v,...e.additionalModules??[]]})}var RM=new Po("ov"),CM=500;function Kt(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=RM,this._overlayDefaults=H({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=PM(n.getContainer()),this._init()}Kt.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Kt.prototype.get=function(e){if(wn(e)&&(e={id:e}),wn(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?Ge(t.overlays,to({type:e.type})):t.overlays.slice():[]}else return e.type?Ge(this._overlays,to({type:e.type})):e.id?this._overlays[e.id]:null},Kt.prototype.add=function(e,t,n){if(Vt(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=H({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},Kt.prototype.remove=function(e){var t=this.get(e)||[];ke(t)||(t=[t]);var n=this;L(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(di(i.html),di(i.htmlContainer),delete i.htmlContainer,delete i.element,delete n._overlays[i.id]),r){var o=r.overlays.indexOf(i);o!==-1&&r.overlays.splice(o,1)}})},Kt.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Kt.prototype.show=function(){Bc(this._overlayRoot)},Kt.prototype.hide=function(){Bc(this._overlayRoot,!1)},Kt.prototype.clear=function(){this._overlays={},this._overlayContainers=[],_s(this._overlayRoot)},Kt.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=Tt(t);i=o.x,r=o.y}jv(n,i,r),sn(e.html,"data-container-id",t.id)},Kt.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=Tt(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=Tt(i).height:s=i.height,o=t.bottom*-1+s}jv(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Kt.prototype._createOverlayContainer=function(e){var t=ft('<div class="djs-overlays" />');dn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},Kt.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";Fv(this._overlayRoot,n)},Kt.prototype._getOverlayContainer=function(e,t){var n=lt(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},Kt.prototype._addOverlay=function(e){var t=e.id,n=e.element,i=e.html,r,o;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),wn(i)&&(i=ft(i)),o=this._getOverlayContainer(n),r=ft('<div class="djs-overlay" data-overlay-id="'+t+'">'),dn(r,{position:"absolute"}),r.appendChild(i),e.type&&yt(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();Bc(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())},Kt.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=this._canvas.findRoot(e.element),r=n&&n.minZoom,o=n&&n.maxZoom,a=e.htmlContainer,s=this._canvas.getRootElement(),c=!0;(i!==s||n&&(Nt(r)&&r>t.scale||Nt(o)&&o<t.scale))&&(c=!1),Bc(a,c),this._updateOverlayScale(e,t)},Kt.prototype._updateOverlayScale=function(e,t){var n=e.scale,i,r,o=e.htmlContainer,a,s="";n!==!0&&(n===!1?(i=1,r=1):(i=n.min,r=n.max),Nt(i)&&t.scale<i&&(a=(1/t.scale||1)*i),Nt(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),Nt(a)&&(s="scale("+a+","+a+")"),Fv(o,s)},Kt.prototype._updateOverlaysVisibilty=function(e){var t=this;L(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},Kt.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});L(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){di(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",CM,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&(L(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&&yt(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 PM(e){var t=ft('<div class="djs-overlay-container" />');return dn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function jv(e,t,n){dn(e,{left:t+"px",top:n+"px"})}function Bc(e,t){e.style.display=t===!1?"none":""}function Fv(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const $c={__init__:["overlays"],overlays:["type",Kt]};function pf(e,t){t.invoke(J,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)})}de(pf,J),pf.$inject=["canvas","injector"];const AM={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",pf]};function La(e){return CSS.escape(e)}var TM={"&":"&","<":"<",">":">",'"':""","'":"'"};function Hv(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return TM[t]})}var MM="bjs-breadcrumbs-shown";function zv(e,t,n){var i=ft('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=yt(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var u=c.element,l=te(u),p=lt(a,function(f){return f===l});p&&s()});function s(c){c&&(a=kM(c));var u=a.flatMap(function(p){var f=n.findRoot(vi(p))||n.findRoot(p.id);if(!f&&x(p,"bpmn:Process")){var d=t.find(function(m){var w=te(m);return w&&w.get("processRef")===p});f=d&&n.findRoot(d.id)}if(!f)return[];var g=Hv(p.name||p.id),h=ft('<li><span class="bjs-crumb"><a title="'+g+'">'+g+"</a></span></li>");return h.addEventListener("click",function(){n.setRootElement(f)}),h});i.innerHTML="";var l=u.length>1;o.toggle(MM,l),u.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}zv.$inject=["eventBus","elementRegistry","canvas"];function kM(e){for(var t=te(e),n=[],i=t;i;i=i.$parent)(x(i,"bpmn:SubProcess")||x(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function Gv(e,t){var n=null,i=new OM;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,!(!x(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})}Gv.$inject=["eventBus","canvas"];function OM(){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 Vv={x:180,y:160};function zr(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}zr.prototype._handleImport=function(e){if(e.diagrams){var t=this;this._definitions=e,this._processToDiagramMap={},e.diagrams.forEach(function(i){!i.plane||!i.plane.bpmnElement||(t._processToDiagramMap[i.plane.bpmnElement.id]=i)});var n=e.diagrams.filter(i=>i.plane).flatMap(i=>t._createNewDiagrams(i.plane));n.forEach(function(i){t._movePlaneElementsToOrigin(i.plane)})}},zr.prototype._createNewDiagrams=function(e){var t=this,n=[],i=[];e.get("planeElement").forEach(function(o){var a=o.bpmnElement;if(a){var s=a.$parent;x(a,"bpmn:SubProcess")&&!o.isExpanded&&n.push(a),LM(a,e)&&i.push({diElement:o,parent:s})}});var r=[];return n.forEach(function(o){if(!t._processToDiagramMap[o.id]){var a=t._createDiagram(o);t._processToDiagramMap[o.id]=a,r.push(a)}}),i.forEach(function(o){for(var a=o.diElement,s=o.parent;s&&n.indexOf(s)===-1;)s=s.$parent;if(s){var c=t._processToDiagramMap[s.id];t._moveToDiPlane(a,c.plane)}}),r},zr.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=DM(e),i={x:n.x-Vv.x,y:n.y-Vv.y};t.forEach(function(r){r.waypoint?r.waypoint.forEach(function(o){o.x=o.x-i.x,o.y=o.y-i.y}):r.bounds&&(r.bounds.x=r.bounds.x-i.x,r.bounds.y=r.bounds.y-i.y)})},zr.prototype._moveToDiPlane=function(e,t){var n=Wv(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},zr.prototype._createDiagram=function(e){var t=this._moddle.create("bpmndi:BPMNPlane",{bpmnElement:e}),n=this._moddle.create("bpmndi:BPMNDiagram",{plane:t});return t.$parent=n,t.bpmnElement=e,n.$parent=this._definitions,this._definitions.diagrams.push(n),n},zr.$inject=["eventBus","moddle"];function Wv(e){return x(e,"bpmndi:BPMNDiagram")?e:Wv(e.$parent)}function DM(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=Pe(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),Ts(t)}function LM(e,t){var n=e.$parent;return!(!x(n,"bpmn:SubProcess")||n===t.bpmnElement||ze(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var jc=250,IM='<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>',NM="bjs-drilldown-empty";function gr(e,t,n,i,r){J.call(this,t),this._canvas=e,this._eventBus=t,this._elementRegistry=n,this._overlays=i,this._translate=r;var o=this;this.executed("shape.toggleCollapse",jc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",jc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],jc,function(a){var s=a.oldParent,c=a.newParent||a.parent,u=a.shape;o._canDrillDown(u)&&o._addOverlay(u),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(u)},!0),this.reverted(["shape.create","shape.move","shape.delete"],jc,function(a){var s=a.oldParent,c=a.newParent||a.parent,u=a.shape;o._canDrillDown(u)&&o._addOverlay(u),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(u)},!0),t.on("import.render.complete",function(){n.filter(function(a){return o._canDrillDown(a)}).map(function(a){o._addOverlay(a)})})}de(gr,J),gr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},gr.prototype._canDrillDown=function(e){var t=this._canvas;return x(e,"bpmn:SubProcess")&&t.findRoot(vi(e))},gr.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=te(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;yt(i.html).toggle(NM,!r)}},gr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=te(e),r=n.get({element:e,type:"drilldown"});r.length&&this._removeOverlay(e);var o=ft('<button type="button" class="bjs-drilldown">'+IM+"</button>"),a=i.get("name")||i.get("id"),s=this._translate("Open {element}",{element:a});o.setAttribute("title",s),o.addEventListener("click",function(){t.setRootElement(t.findRoot(vi(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},gr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},gr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const BM={__depends__:[$c,Gp,AM],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",zv],drilldownCentering:["type",Gv],drilldownOverlayBehavior:["type",gr],subprocessCompatibility:["type",zr]};function yr(e){vt.call(this,e)}de(yr,vt),yr.prototype._modules=[Nm,BM,$c,Vn,ca],yr.prototype._moddleExtensions={};var Fc="keyboard.keydown",$M="keyboard.keyup",jM=1e3,Uv="Keyboard binding is now implicit; explicit binding to an element got removed. For more information, see https://github.com/bpmn-io/diagram-js/issues/661";function hn(e,t){var n=this;this._config=e=e||{},this._eventBus=t,this._keydownHandler=this._keydownHandler.bind(this),this._keyupHandler=this._keyupHandler.bind(this),t.on("diagram.destroy",function(){n._fire("destroy"),n.unbind()}),e.bindTo&&console.error("unsupported configuration <keyboard.bindTo>",new Error(Uv));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}hn.$inject=["config.keyboard","eventBus"],hn.prototype._keydownHandler=function(e){this._keyHandler(e,Fc)},hn.prototype._keyupHandler=function(e){this._keyHandler(e,$M)},hn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Fc,i),n&&e.preventDefault()}},hn.prototype._isEventIgnored=function(e){return!1},hn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(Uv)),this.unbind(),e=this._node=this._target,Ne.bind(e,"keydown",this._keydownHandler),Ne.bind(e,"keyup",this._keyupHandler),this._fire("bind")},hn.prototype.getBinding=function(){return this._node},hn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),Ne.unbind(e,"keydown",this._keydownHandler),Ne.unbind(e,"keyup",this._keyupHandler)),this._node=null},hn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},hn.prototype.addListener=function(e,t,n){Wt(e)&&(n=t,t=e,e=jM),this._eventBus.on(n||Fc,e,t)},hn.prototype.removeListener=function(e,t){this._eventBus.off(t||Fc,e)},hn.prototype.hasModifier=aA,hn.prototype.isCmd=Tn,hn.prototype.isShift=Op,hn.prototype.isKey=jt;var FM=500;function ko(e,t){var n=this;e.on("editorActions.init",FM,function(i){var r=i.editorActions;n.registerBindings(t,r)})}ko.$inject=["eventBus","keyboard"],ko.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(pA(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(fA(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(sA(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(cA(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(uA(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(lA(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(jt(["+","Add","="],r)&&Tn(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(jt(["-","Subtract"],r)&&Tn(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(jt("0",r)&&Tn(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(jt(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const ff={__init__:["keyboard","keyboardBindings"],keyboard:["type",hn],keyboardBindings:["type",ko]};var HM={moveSpeed:50,moveSpeedAccelerated:200};function qv(e,t,n){var i=this;this._config=H({},HM,e||{}),t.addListener(r);function r(o){var a=o.keyEvent,s=i._config;if(t.isCmd(a)&&t.isKey(["ArrowLeft","Left","ArrowUp","Up","ArrowDown","Down","ArrowRight","Right"],a)){var c=t.isShift(a)?s.moveSpeedAccelerated:s.moveSpeed,u;switch(a.key){case"ArrowLeft":case"Left":u="left";break;case"ArrowUp":case"Up":u="up";break;case"ArrowRight":case"Right":u="right";break;case"ArrowDown":case"Down":u="down";break}return i.moveCanvas({speed:c,direction:u}),!0}}this.moveCanvas=function(o){var a=0,s=0,c=o.speed,u=c/Math.min(Math.sqrt(n.viewbox().scale),1);switch(o.direction){case"left":a=u;break;case"up":s=u;break;case"right":a=-u;break;case"down":s=-u;break}n.scroll({dx:a,dy:s})}}qv.$inject=["config.keyboardMove","keyboard","canvas"];const Yv={__depends__:[ff],__init__:["keyboardMove"],keyboardMove:["type",qv]};var zM=15;function Kv(e,t){var n;function i(s){return a(s.originalEvent)}e.on("canvas.focus.changed",function(s){s.focused?e.on("element.mousedown",500,i):e.off("element.mousedown",i)});function r(s){var c=n.start,u=n.button,l=Nr(s),p=ni(l,c);if(!n.dragging&&GM(p)>zM&&(n.dragging=!0,u===0&&wy(e),dc("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){Ne.unbind(document,"mousemove",r),Ne.unbind(document,"mouseup",o),n=null,xy()}function a(s){if(!Mr(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:Nr(s)},Ne.bind(document,"mousemove",r),Ne.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}Kv.$inject=["eventBus","canvas"];function GM(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const Xv={__init__:["moveCanvas"],moveCanvas:["type",Kv]};function Zv(e,t){var n=Tl(e.min),i=Tl(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function VM(e,t){return Math.max(e.min,Math.min(e.max,t))}var WM=Math.sign||function(e){return e>=0?1:-1},df={min:.2,max:4},Qv=10,UM=.1,qM=.75;function xi(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=mn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||qM;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}xi.$inject=["config.zoomScroll","eventBus","canvas"],xi.prototype.scroll=function(t){this._canvas.scroll(t)},xi.prototype.reset=function(){this._canvas.zoom("fit-viewport")},xi.prototype.zoom=function(t,n){var i=Zv(df,Qv*2);this._totalDelta+=t,Math.abs(this._totalDelta)>UM&&(this._zoom(t,n,i),this._totalDelta=0)},xi.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||Tg()&&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))*WM(t.deltaY)*o,this.zoom(a,c)}else r?a={dx:o*t.deltaY,dy:0}:a={dx:o*t.deltaX,dy:o*t.deltaY},this.scroll(a)}},xi.prototype.stepZoom=function(t,n){var i=Zv(df,Qv);this._zoom(t,n,i)},xi.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=Tl(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(VM(df,s),t)},xi.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&Ne[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},xi.prototype._init=function(e){this.toggle(e)};const Jv={__init__:["zoomScroll"],zoomScroll:["type",xi]};function Ia(e){yr.call(this,e)}de(Ia,yr),Ia.prototype._navigationModules=[Yv,Xv,Jv],Ia.prototype._modules=[].concat(yr.prototype._modules,Ia.prototype._navigationModules);function hf(e){return e&&e[e.length-1]}function eb(e){return e.y}function tb(e){return e.x}var YM={left:tb,center:tb,right:function(e){return e.x+e.width},top:eb,middle:eb,bottom:function(e){return e.y+e.height}};function Oo(e,t){this._modeling=e,this._rules=t}Oo.$inject=["modeling","rules"],Oo.prototype._getOrientationDetails=function(e){var t=["top","bottom","middle"],n="x",i="width";return t.indexOf(e)!==-1&&(n="y",i="height"),{axis:n,dimension:i}},Oo.prototype._isType=function(e,t){return t.indexOf(e)!==-1},Oo.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),i=n.axis,r=n.dimension,o={},a={},s=!1,c,u,l;function 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=hf(t),o[e]=l[i]+l[r];else if(this._isType(e,["center","middle"])){if(L(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=ai(a,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return o[e]=hf(c).center,o;u=t[0],t=ai(t,function(f){return f[i]+f[r]}),l=hf(t),o[e]=p(u,l)}return o},Oo.prototype.trigger=function(e,t){var n=this._modeling,i,r=Ge(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),ke(i)&&(r=i),!(r.length<2||!i)){var o=YM[t],a=ai(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const KM={__init__:["alignElements"],alignElements:["type",Oo]},XM=new Po;function Do(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Do.$inject=["eventBus"],Do.prototype.schedule=function(e,t=XM.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},Do.prototype._schedule=function(e,t){const n=ZM();return{executionId:setTimeout(()=>{try{this._scheduled[t]=null;try{n.resolve(e())}catch(r){n.reject(r)}}catch(r){console.error("Scheduler#_schedule execution failed",r)}}),promise:n.promise}},Do.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Do.prototype._cancel=function(e){clearTimeout(e.executionId)};function ZM(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const QM={scheduler:["type",Do]};var JM="djs-element-hidden",Hc=".entry",e2=1e3,nb=8,t2=300;function kt(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}kt.$inject=["canvas","elementRegistry","eventBus","scheduler"],kt.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",function(t){var n=t.newSelection,i=n.length?n.length===1?n[0]:n:null;i?e.open(i,!0):e.close()}),this._eventBus.on("elements.changed",function(t){var n=t.elements,i=e._current;if(i){var r=i.target,o=ke(r)?r:[r],a=o.filter(function(c){return n.includes(c)});if(a.length){e.close();var s=o.filter(function(c){return e._elementRegistry.get(c.id)});s.length&&e._updateAndOpen(s.length>1?s:s[0])}}}),this._eventBus.on("canvas.viewbox.changed",function(){e._updatePosition()}),this._eventBus.on("element.marker.update",function(t){if(e.isOpen()){var n=t.element,i=e._current,r=ke(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},kt.prototype._createContainer=function(){var e=ft('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},kt.prototype.registerProvider=function(e,t){t||(t=e,e=e2),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},kt.prototype.getEntries=function(e){var t=this._getProviders(),n=ke(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return L(t,function(r){if(Wt(r[n])){var o=r[n](e);Wt(o)?i=o(i):L(o,function(a,s){i[s]=a})}}),i},kt.prototype.trigger=function(e,t,n){var i=this,r,o,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(r=sn(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},t2);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,o,n)},kt.prototype.triggerEntry=function(e,t,n,i){if(this.isShown()){var r=this._current.target,o=this._current.entries,a=o[e];if(a){var s=a.action;if(this._eventBus.fire("contextPad.trigger",{entry:a,event:n})!==!1){if(Wt(s)){if(t==="click")return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},kt.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))}},kt.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},kt.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;L(t,function(r,o){var a=r.group||"default",s=ft(r.html||'<div class="entry" draggable="true"></div>'),c;sn(s,"data-action",o),c=ot("[data-group="+La(a)+"]",n),c||(c=ft('<div class="group"></div>'),sn(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&n2(s,r.className),r.title&&sn(s,"title",r.title),r.imageUrl&&(i=ft("<img>"),sn(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),yt(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},kt.prototype._createHtml=function(e){var t=this,n=ft('<div class="djs-context-pad"></div>');return Cn.bind(n,Hc,"click",function(i){t.trigger("click",i)}),Cn.bind(n,Hc,"dragstart",function(i){t.trigger("dragstart",i)}),Cn.bind(n,Hc,"mouseover",function(i){t.trigger("mouseover",i)}),Cn.bind(n,Hc,"mouseout",function(i){t.trigger("mouseout",i)}),Ne.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},kt.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()&&r2(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},kt.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},kt.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return ke(e)!==ke(n)?!1:ke(e)?e.length===n.length&&Cr(e,function(i){return n.includes(i)}):n===e},kt.prototype.isShown=function(){return this.isOpen()&&yt(this._current.html).has("open")},kt.prototype.show=function(){this.isOpen()&&(yt(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},kt.prototype.hide=function(){this.isOpen()&&(yt(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},kt.prototype._getPosition=function(e){if(!ke(e)&&st(e)){var t=this._canvas.viewbox(),n=i2(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+nb*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+nb*this._canvas.zoom(),top:s.top-a.top}},kt.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")},kt.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=ke(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,JM)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},kt.prototype._getTargetBounds=function(e){var t=this,n=ke(e)?e:[e],i=n.map(function(r){return t._canvas.getGraphics(r)});return i.reduce(function(r,o){const a=o.getBoundingClientRect();return r.top=Math.min(r.top,a.top),r.right=Math.max(r.right,a.right),r.bottom=Math.max(r.bottom,a.bottom),r.left=Math.min(r.left,a.left),r.x=r.left,r.y=r.top,r.width=r.right-r.left,r.height=r.bottom-r.top,r},{top:1/0,right:-1/0,bottom:-1/0,left:1/0})};function n2(e,t){var n=yt(e);t=ke(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function i2(e){return e.waypoints[e.waypoints.length-1]}function r2(e,t){return e=ke(e)?e:[e],t=ke(t)?t:[t],e.length===t.length&&Cr(e,function(n){return t.includes(n)})}const ib={__depends__:[fc,QM,$c],contextPad:["type",kt]};var zc,_t,rb,vr,ob,ab,sb,mf,Gc,Na,cb,gf,yf,vf,Vc={},Wc=[],o2=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Uc=Array.isArray;function Fi(e,t){for(var n in t)e[n]=t[n];return e}function bf(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function ub(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?zc.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 qc(e,a,i,r,null)}function qc(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??++rb,__i:-1,__u:0};return r==null&&_t.vnode!=null&&_t.vnode(o),o}function Yc(e){return e.children}function Kc(e,t){this.props=e,this.context=t}function Gr(e,t){if(t==null)return e.__?Gr(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?Gr(e):null}function a2(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=Fi({},t);o.__v=t.__v+1,_t.vnode&&_t.vnode(o),_f(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??Gr(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,yb(i,o,r),t.__e=t.__=null,o.__e!=n&&lb(o)}}function lb(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}),lb(e)}function pb(e){(!e.__d&&(e.__d=!0)&&vr.push(e)&&!Xc.__r++||ob!=_t.debounceRendering)&&((ob=_t.debounceRendering)||ab)(Xc)}function Xc(){try{for(var e,t=1;vr.length;)vr.length>t&&vr.sort(sb),e=vr.shift(),t=vr.length,a2(e)}finally{vr.length=Xc.__r=0}}function fb(e,t,n,i,r,o,a,s,c,u,l){var p,f,d,g,h,m,w=i&&i.__k||Wc,y=t.length;for(c=s2(n,t,w,c,y),p=0;p<y;p++)(d=n.__k[p])!=null&&(f=d.__i!=-1&&w[d.__i]||Vc,d.__i=p,m=_f(e,d,f,r,o,a,s,c,u,l),g=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&xf(f.ref,null,d),l.push(d.ref,d.__c||g,d)),h==null&&g!=null&&(h=g),4&d.__u?(c=db(d,c,e),f.__e&&(f.__e=null)):typeof d.type=="function"&&m!==void 0?c=m:g&&(c=g.nextSibling),d.__u&=-7);return n.__e=h,c}function s2(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]=qc(null,a,null,null,null):Uc(a)?a=e.__k[o]=qc(Yc,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=qc(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=c2(a,n,c,p))!=-1&&(p--,(s=n[u])&&(s.__u|=2)),s==null||s.__v==null?(u==-1&&(r>l?f--:r<l&&f++),typeof a.type!="function"&&(a.__u|=4)):u!=c&&(u==c-1?f--:u==c+1?f++:(u>c?f--:f++,a.__u|=4))):e.__k[o]=null;if(p)for(o=0;o<l;o++)(s=n[o])!=null&&(2&s.__u)==0&&(s.__e==i&&(i=Gr(s)),bb(s,s));return i}function db(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=db(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Gr(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function c2(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 hb(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||o2.test(t)?n:n+"px"}function Zc(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||hb(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||hb(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(cb,"$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[Na]=i[Na]:(n[Na]=gf,e.addEventListener(t,o?vf:yf,o)):e.removeEventListener(t,o?vf:yf,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 mb(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Gc]==null)t[Gc]=gf++;else if(t[Gc]<n[Na])return;return n(_t.event?_t.event(t):t)}}}function _f(e,t,n,i,r,o,a,s,c,u){var l,p,f,d,g,h,m,w,y,_,S,P,C,D,T,N,k=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(l=_t.__b)&&l(t);e:if(typeof k=="function"){p=a.length;try{if(y=t.props,_=k.prototype&&k.prototype.render,S=(l=k.contextType)&&i[l.__c],P=l?S?S.props.value:l.__:i,n.__c?w=(f=t.__c=n.__c).__=f.__E:(_?t.__c=f=new k(y,P):(t.__c=f=new Kc(y,P),f.constructor=k,f.render=l2),S&&S.sub(f),f.state||(f.state={}),f.__n=i,d=f.__d=!0,f.__h=[],f._sb=[]),_&&f.__s==null&&(f.__s=f.state),_&&k.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=Fi({},f.__s)),Fi(f.__s,k.getDerivedStateFromProps(y,f.__s))),g=f.props,h=f.state,f.__v=t,d)_&&k.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),_&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(_&&k.getDerivedStateFromProps==null&&y!==g&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(y,P),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(y,f.__s,P)===!1){t.__v!=n.__v&&(f.props=y,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(O){O&&(O.__=t)}),Wc.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&a.push(f),s=Gr(n);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(y,f.__s,P),_&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(g,h,m)})}if(f.context=P,f.props=y,f.__P=e,f.__e=!1,C=_t.__r,D=0,_)f.state=f.__s,f.__d=!1,C&&C(t),l=f.render(f.props,f.state,f.context),Wc.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,C&&C(t),l=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++D<25);f.state=f.__s,f.getChildContext!=null&&(i=Fi(Fi({},i),f.getChildContext())),_&&!d&&f.getSnapshotBeforeUpdate!=null&&(m=f.getSnapshotBeforeUpdate(g,h)),T=l!=null&&l.type===Yc&&l.key==null?vb(l.props.children):l,s=fb(e,Uc(T)?T:[T],t,n,i,r,o,a,s,c,u),f.base=t.__e,t.__u&=-161,f.__h.length&&a.push(f),w&&(f.__E=f.__=null)}catch(O){if(a.length=p,t.__v=null,c||o!=null){if(O.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(N=o.length;N--;)bf(o[N])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),O.then||gb(t),_t.__e(O,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=u2(n.__e,t,n,i,r,o,a,c,u);return(l=_t.diffed)&&l(t),128&t.__u?void 0:s}function gb(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(gb))}function yb(e,t,n){for(var i=0;i<n.length;i++)xf(n[i],n[++i],n[++i]);_t.__c&&_t.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){_t.__e(o,r.__v)}})}function vb(e){return typeof e!="object"||e==null||e.__b>0?e:Uc(e)?e.map(vb):e.constructor!==void 0?null:Fi({},e)}function u2(e,t,n,i,r,o,a,s,c){var u,l,p,f,d,g,h,m=n.props||Vc,w=t.props,y=t.type;if(y=="svg"?r="http://www.w3.org/2000/svg":y=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),o!=null){for(u=0;u<o.length;u++)if((d=o[u])&&"setAttribute"in d==!!y&&(y?d.localName==y:d.nodeType==3)){e=d,o[u]=null;break}}if(e==null){if(y==null)return document.createTextNode(w);e=document.createElementNS(r,y,w.is&&w),s&&(_t.__m&&_t.__m(t,o),s=!1),o=null}if(y==null)m===w||s&&e.data==w||(e.data=w);else{if(o=y=="textarea"&&w.defaultValue!=null?null:o&&zc.call(e.childNodes),!s&&o!=null)for(m={},u=0;u<e.attributes.length;u++)m[(d=e.attributes[u]).name]=d.value;for(u in m)d=m[u],u=="dangerouslySetInnerHTML"?p=d:u=="children"||u in w||u=="value"&&"defaultValue"in w||u=="checked"&&"defaultChecked"in w||Zc(e,u,null,d,r);for(u in w)d=w[u],u=="children"?f=d:u=="dangerouslySetInnerHTML"?l=d:u=="value"?g=d:u=="checked"?h=d:s&&typeof d!="function"||m[u]===d||Zc(e,u,d,m[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=""),fb(t.type=="template"?e.content:e,Uc(f)?f:[f],t,n,i,y=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&Gr(n,0),s,c),o!=null)for(u=o.length;u--;)bf(o[u]);s&&y!="textarea"||(u="value",y=="progress"&&g==null?e.removeAttribute("value"):g!=null&&(g!==e[u]||y=="progress"&&!g||y=="option"&&g!=m[u])&&Zc(e,u,g,m[u],r),u="checked",h!=null&&h!=e[u]&&Zc(e,u,h,m[u],r))}return e}function xf(e,t,n){try{if(typeof e=="function"){var i=typeof e.__u=="function";i&&e.__u(),i&&t==null||(e.__u=e(t))}else e.current=t}catch(r){_t.__e(r,n)}}function bb(e,t,n){var i,r;if(_t.unmount&&_t.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||xf(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){_t.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&bb(i[r],t,n||typeof e.type!="function");n||bf(e.__e),e.__c=e.__=e.__e=void 0}function l2(e,t,n){return this.constructor(e,n)}function _b(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),_t.__&&_t.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],_f(t,e=t.__k=ub(Yc,null,[e]),r||Vc,Vc,t.namespaceURI,r?null:t.firstChild?zc.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),yb(o,e,a),e.props.children=null}zc=Wc.slice,_t={__e:function(e,t,n,i){for(var r,o,a;t=t.__;)if((r=t.__c)&&!r.__)try{if((o=r.constructor)&&o.getDerivedStateFromError!=null&&(r.setState(o.getDerivedStateFromError(e)),a=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e,i||{}),a=r.__d),a)return r.__E=r}catch(s){e=s}throw e}},rb=0,Kc.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Fi({},this.state),typeof e=="function"&&(e=e(Fi({},n),this.props)),e&&Fi(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),pb(this))},Kc.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),pb(this))},Kc.prototype.render=Yc,vr=[],ab=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,sb=function(e,t){return e.__v.__b-t.__v.__b},Xc.__r=0,mf=Math.random().toString(8),Gc="__d"+mf,Na="__a"+mf,cb=/(PointerCapture)$|Capture$/i,gf=0,yf=mb(!1),vf=mb(!0);var xb=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,xb(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},wb=new Map;function p2(e){var t=wb.get(this);return t||(t=new Map,wb.set(this,t)),(t=xb(this,t.get(e)||(t.set(e,t=(function(n){for(var i,r,o=1,a="",s="",c=[0],u=function(f){o===1&&(f||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,f,a):o===3&&(f||a)?(c.push(3,f,a),o=2):o===2&&a==="..."&&f?c.push(4,f,0):o===2&&a&&!f?c.push(5,0,!0,a):o>=5&&((a||!f&&o===5)&&(c.push(o,0,a,r),o=6),f&&(c.push(o,f,0,r),o=6)),a=""},l=0;l<n.length;l++){l&&(o===1&&u(),u(l));for(var p=0;p<n[l].length;p++)i=n[l][p],o===1?i==="<"?(u(),c=[c],o=3):a+=i:o===4?a==="--"&&i===">"?(o=1,a=""):a=i+a[0]:s?i===s?s="":a+=i:i==='"'||i==="'"?s=i:i===">"?(u(),o=1):o&&(i==="="?(o=5,r=a,a=""):i==="/"&&(o<5||n[l][p+1]===">")?(u(),o===3&&(c=c[0]),o=c,(c=c[0]).push(2,0,o),o=0):i===" "||i===" "||i===`
|
|
11
|
-
`||i==="\r"?(u(),o=2):a+=i),o===3&&a==="!--"&&(o=4,c=c[0])}return u(),c})(e)),t),arguments,[])).length>1?t:t[0]}var
|
|
10
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="`+p+'" height="'+d+'" viewBox="'+l+" "+f+" "+p+" "+d+'" version="1.1">'+s+a+"</svg>"}catch(i){n=i}if(this._emit("saveSVG.done",{error:n,svg:t}),n)throw n;return{svg:t}},xt.prototype._setDefinitions=function(e){this._definitions=e},xt.prototype.getModules=function(){return this._modules},xt.prototype.clear=function(){this.getDefinitions()&&nr.prototype.clear.call(this)},xt.prototype.destroy=function(){nr.prototype.destroy.call(this),di(this._container)},xt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},xt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},xt.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),typeof e=="string"&&(e=ot(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},xt.prototype.getDefinitions=function(){return this._definitions},xt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},xt.prototype._init=function(e,t,n){const i=n.modules||this.getModules(n),r=n.additionalModules||[],o=[{bpmnjs:["value",this],moddle:["value",t]}],a=[].concat(o,i,r),s=z(ui(n,["additionalModules"]),{canvas:z({},n.canvas,{container:e}),modules:a});nr.call(this,s),n&&n.container&&this.attachTo(n.container)},xt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},xt.prototype._createContainer=function(e){const t=mt('<div class="bjs-container"></div>');return mn(t,{width:km(e.width),height:km(e.height),position:e.position}),t},xt.prototype._createModdle=function(e){const t=z({},this._moddleExtensions,e.moddleExtensions);return new Md(t)},xt.prototype._modules=[];function Is(e,t){return e.warnings=t,e}function JS(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 eR={width:"100%",height:"100%",position:"relative"};function km(e){return e+(Ie(e)?"px":"")}function tR(e,t){return t&<(e.diagrams,function(n){return n.id===t})||null}function nR(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Pm+"</a>",i=mt(n);mn(ot("svg",i),Am),mn(i,Tm,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),Ne.bind(i,"click",function(r){QS(),r.preventDefault()})}function fo(e){xt.call(this,e),this.on("import.parse.complete",function(t){t.error||this._collectIds(t.definitions,t.elementsById)},this),this.on("diagram.destroy",function(){this.get("moddle").ids.clear()},this)}ye(fo,xt),fo.prototype._createModdle=function(e){var t=xt.prototype._createModdle.call(this,e);return t.ids=new fi([32,36,1]),t},fo.prototype._collectIds=function(e,t){var n=e.$model,i=n.ids,r;i.clear();for(r in t)i.claim(r,t[r])};function Ye(e,t){return w(e,"bpmn:CallActivity")?!1:w(e,"bpmn:SubProcess")?(t=t||Ze(e),t&&w(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):w(e,"bpmn:Participant")?!!ie(e).processRef:!0}function Kt(e){if(!(!w(e,"bpmn:Participant")&&!w(e,"bpmn:Lane"))){var t=Ze(e).isHorizontal;return t===void 0?!0:t}}function iR(e){return e&&ie(e).isInterrupting!==!1}function pn(e){return e&&!!ie(e).triggeredByEvent}function ho(e,t){var n=ie(e).eventDefinitions;return Wi(n,function(i){return w(i,t)})}function rR(e){return ho(e,"bpmn:ErrorEventDefinition")}function oR(e){return ho(e,"bpmn:EscalationEventDefinition")}function aR(e){return ho(e,"bpmn:CompensateEventDefinition")}var Lr={width:90,height:20},Om=15;function ir(e){return w(e,"bpmn:Event")||w(e,"bpmn:Gateway")||w(e,"bpmn:DataStoreReference")||w(e,"bpmn:DataObjectReference")||w(e,"bpmn:DataInput")||w(e,"bpmn:DataOutput")||w(e,"bpmn:SequenceFlow")||w(e,"bpmn:MessageFlow")||w(e,"bpmn:Group")}function Bs(e){return ze(e.label)}function sR(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=cR(e),o=Math.atan((i.y-n.y)/(i.x-n.x)),a=r.x,s=r.y;return Math.abs(o)<Math.PI/2?s-=Om:a+=Om,{x:a,y:s}}function cR(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)];return{x:n.x+(i.x-n.x)/2,y:n.y+(i.y-n.y)/2}}function Pl(e){return e.waypoints?sR(e.waypoints):w(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Lr.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Lr.height/2}}function uR(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(Lr.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=Pl(t),i=Lr),z({x:n.x-i.width/2,y:n.y-i.height/2},i)}function Dm(e){if(w(e,"bpmn:FlowElement")||w(e,"bpmn:Participant")||w(e,"bpmn:Lane")||w(e,"bpmn:SequenceFlow")||w(e,"bpmn:MessageFlow")||w(e,"bpmn:DataInput")||w(e,"bpmn:DataOutput"))return"name";if(w(e,"bpmn:TextAnnotation"))return"text";if(w(e,"bpmn:Group"))return"categoryValueRef"}function lR(e){var t=e.categoryValueRef;return t&&t.value||""}function jn(e){var t=e.businessObject,n=Dm(t);if(n)return n==="categoryValueRef"?lR(t):t[n]||""}function pR(e,t){var n=e.businessObject,i=Dm(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function fR(e){return ze(e)&&ir(e.labelTarget)}var mo=7;function Lm(e){let t=[];return I(e.incoming,n=>{w(n,"bpmn:Association")&&w(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),I(e.outgoing,n=>{w(n,"bpmn:Association")&&w(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function oa(e){const t=new Map;return I(_l(e),n=>{I(Lm(n),i=>{t.has(i.annotation)||t.set(i.annotation,{annotation:i.annotation,associations:[]}),t.get(i.annotation).associations.push(i.association)})}),[...t.values()]}var Al="hsl(225, 10%, 15%)",dR="white";function yi(e,t){return Wi(e.eventDefinitions,function(n){return n.$type===t})}function hR(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function mR(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function qe(e,t,n){var i=Ze(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||dR}function de(e,t,n){var i=Ze(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||Al}function aa(e,t,n,i){var r=Ze(e),o=r.get("label");return i||o&&o.get("color:color")||t||de(e,n)}function Im(e){var t=e.x+e.width/2,n=e.y+e.height/2,i=e.width/2,r=[["M",t,n],["m",0,-i],["a",i,i,0,1,1,0,2*i],["a",i,i,0,1,1,0,-2*i],["z"]];return kr(r)}function Tl(e,t){var n=e.x,i=e.y,r=e.width,o=e.height,a=[["M",n+t,i],["l",r-t*2,0],["a",t,t,0,0,1,t,t],["l",0,o-t*2],["a",t,t,0,0,1,-t,t],["l",t*2-r,0],["a",t,t,0,0,1,-t,-t],["l",0,t*2-o],["a",t,t,0,0,1,t,-t],["z"]];return kr(a)}function gR(e){var t=e.width,n=e.height,i=e.x,r=e.y,o=t/2,a=n/2,s=[["M",i+o,r],["l",o,a],["l",-o,a],["l",-o,-a],["z"]];return kr(s)}function yR(e){var t=e.x,n=e.y,i=e.width,r=e.height,o=[["M",t,n],["l",i,0],["l",0,r],["l",-i,0],["z"]];return kr(o)}function sa(e,t={}){return{width:Wn(e,t),height:Tn(e,t)}}function Wn(e,t={}){return Sn(t,"width")?t.width:e.width}function Tn(e,t={}){return Sn(t,"height")?t.height:e.height}var vR=new fi,bR=10,Ns=3,_R=1.5,$s=10,xR=4,go=.95,wR=1,ER=.25;function Ir(e,t,n,i,r,o,a){Ti.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,u=e&&e.defaultLabelColor;function l(M){return n.computeStyle(M,{strokeLinecap:"round",strokeLinejoin:"round",stroke:Al,strokeWidth:2,fill:"white"})}function f(M){return n.computeStyle(M,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:Al,strokeWidth:2})}function p(M,E){var{ref:b={x:0,y:0},scale:F=1,element:W,parentGfx:X=r._svg}=E,be=Ce("marker",{id:M,viewBox:"0 0 20 20",refX:b.x,refY:b.y,markerWidth:20*F,markerHeight:20*F,orient:"auto"});Fe(be,W);var Be=ot(":scope > defs",X);Be||(Be=Ce("defs"),Fe(X,Be)),Fe(Be,be)}function d(M,E,b,F){var W=vR.nextPrefixed("marker-");return g(M,W,E,b,F),"url(#"+W+")"}function g(M,E,b,F,W){if(b==="sequenceflow-end"){var X=Ce("path",{d:"M 1 5 L 11 10 L 1 15 Z",...l({fill:W,stroke:W,strokeWidth:1})});p(E,{element:X,ref:{x:11,y:10},scale:.5,parentGfx:M})}if(b==="messageflow-start"){var be=Ce("circle",{cx:6,cy:6,r:3.5,...l({fill:F,stroke:W,strokeWidth:1,strokeDasharray:[1e4,1]})});p(E,{element:be,ref:{x:6,y:6},parentGfx:M})}if(b==="messageflow-end"){var Be=Ce("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...l({fill:F,stroke:W,strokeWidth:1,strokeDasharray:[1e4,1]})});p(E,{element:Be,ref:{x:8.5,y:5},parentGfx:M})}if(b==="association-start"){var et=Ce("path",{d:"M 11 5 L 1 10 L 11 15",...f({fill:"none",stroke:W,strokeWidth:1.5,strokeDasharray:[1e4,1]})});p(E,{element:et,ref:{x:1,y:10},scale:.5,parentGfx:M})}if(b==="association-end"){var vt=Ce("path",{d:"M 1 5 L 11 10 L 1 15",...f({fill:"none",stroke:W,strokeWidth:1.5,strokeDasharray:[1e4,1]})});p(E,{element:vt,ref:{x:11,y:10},scale:.5,parentGfx:M})}if(b==="conditional-flow-marker"){var it=Ce("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...l({fill:F,stroke:W})});p(E,{element:it,ref:{x:-1,y:10},scale:.5,parentGfx:M})}if(b==="conditional-default-flow-marker"){var Tt=Ce("path",{d:"M 6 4 L 10 16",...l({stroke:W,fill:"none"})});p(E,{element:Tt,ref:{x:0,y:10},scale:.5,parentGfx:M})}}function h(M,E,b,F,W={}){Ut(F)&&(W=F,F=0),F=F||0,W=l(W);var X=E/2,be=b/2,Be=Ce("circle",{cx:X,cy:be,r:Math.round((E+b)/4-F),...W});return Fe(M,Be),Be}function m(M,E,b,F,W,X){Ut(W)&&(X=W,W=0),W=W||0,X=l(X);var be=Ce("rect",{x:W,y:W,width:E-W*2,height:b-W*2,rx:F,ry:F,...X});return Fe(M,be),be}function _(M,E,b,F){var W=E/2,X=b/2,be=[{x:W,y:0},{x:E,y:X},{x:W,y:b},{x:0,y:X}],Be=be.map(function(vt){return vt.x+","+vt.y}).join(" ");F=l(F);var et=Ce("polygon",{...F,points:Be});return Fe(M,et),et}function y(M,E,b,F){b=f(b);var W=Qo(E,b,F);return Fe(M,W),W}function x(M,E,b){return y(M,E,b,5)}function S(M,E,b){b=f(b);var F=Ce("path",{...b,d:E});return Fe(M,F),F}function P(M,E,b,F){return S(E,b,z({"data-marker":M},F))}function C(M){return Xt[M]}function D(M){return function(E,b,F){return C(M)(E,b,F)}}var T={"bpmn:MessageEventDefinition":function(M,E,b={},F){var W=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:b.width||E.width,containerHeight:b.height||E.height,position:{mx:.235,my:.315}}),X=F?de(E,c,b.stroke):qe(E,s,b.fill),be=F?qe(E,s,b.fill):de(E,c,b.stroke),Be=S(M,W,{fill:X,stroke:be,strokeWidth:1});return Be},"bpmn:TimerEventDefinition":function(M,E,b={}){var F=b.width||E.width,W=b.height||E.height,X=b.width?1:2,be=h(M,F,W,.2*W,{fill:qe(E,s,b.fill),stroke:de(E,c,b.stroke),strokeWidth:X}),Be=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:F,containerHeight:W,position:{mx:.5,my:.5}});S(M,Be,{stroke:de(E,c,b.stroke),strokeWidth:X});for(var et=0;et<12;et++){var vt=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:F,containerHeight:W,position:{mx:.5,my:.5}}),it=F/2,Tt=W/2;S(M,vt,{strokeWidth:1,stroke:de(E,c,b.stroke),transform:"rotate("+et*30+","+Tt+","+it+")"})}return be},"bpmn:EscalationEventDefinition":function(M,E,b={},F){var W=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:b.width||E.width,containerHeight:b.height||E.height,position:{mx:.5,my:.2}}),X=F?de(E,c,b.stroke):qe(E,s,b.fill);return S(M,W,{fill:X,stroke:de(E,c,b.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(M,E,b={}){var F=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:b.width||E.width,containerHeight:b.height||E.height,position:{mx:.5,my:.222}});return S(M,F,{fill:qe(E,s,b.fill),stroke:de(E,c,b.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(M,E,b={},F){var W=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:.57,my:.263}}),X=F?de(E,c,b.stroke):qe(E,s,b.fill);return S(M,W,{fill:X,stroke:de(E,c,b.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(M,E,b={},F){var W=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:b.width||E.width,containerHeight:b.height||E.height,position:{mx:.2,my:.722}}),X=F?de(E,c,b.stroke):qe(E,s,b.fill);return S(M,W,{fill:X,stroke:de(E,c,b.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(M,E,b={},F){var W=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:.638,my:-.055}}),X=F?de(E,c,b.stroke):"none",be=S(M,W,{fill:X,stroke:de(E,c,b.stroke),strokeWidth:1});return Rm(be,45),be},"bpmn:CompensateEventDefinition":function(M,E,b={},F){var W=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:b.width||E.width,containerHeight:b.height||E.height,position:{mx:.22,my:.5}}),X=F?de(E,c,b.stroke):qe(E,s,b.fill);return S(M,W,{fill:X,stroke:de(E,c,b.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(M,E,b={},F){var W=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:b.width||E.width,containerHeight:b.height||E.height,position:{mx:.5,my:.2}}),X=F?de(E,c,b.stroke):qe(E,s,b.fill);return S(M,W,{strokeWidth:1,fill:X,stroke:de(E,c,b.stroke)})},"bpmn:MultipleEventDefinition":function(M,E,b={},F){var W=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:b.width||E.width,containerHeight:b.height||E.height,position:{mx:.211,my:.36}}),X=F?de(E,c,b.stroke):qe(E,s,b.fill);return S(M,W,{fill:X,stroke:de(E,c,b.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(M,E,b={}){var F=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:b.width||E.width,containerHeight:b.height||E.height,position:{mx:.458,my:.194}});return S(M,F,{fill:qe(E,s,b.fill),stroke:de(E,c,b.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(M,E,b={}){var F=h(M,E.width,E.height,8,{fill:de(E,c,b.stroke),stroke:de(E,c,b.stroke),strokeWidth:4});return F}};function $(M,E,b={},F){var W=ie(M),X=hR(W),be=F||M;return W.get("eventDefinitions")&&W.get("eventDefinitions").length>1?W.get("parallelMultiple")?T["bpmn:ParallelMultipleEventDefinition"](E,be,b,X):T["bpmn:MultipleEventDefinition"](E,be,b,X):yi(W,"bpmn:MessageEventDefinition")?T["bpmn:MessageEventDefinition"](E,be,b,X):yi(W,"bpmn:TimerEventDefinition")?T["bpmn:TimerEventDefinition"](E,be,b,X):yi(W,"bpmn:ConditionalEventDefinition")?T["bpmn:ConditionalEventDefinition"](E,be,b,X):yi(W,"bpmn:SignalEventDefinition")?T["bpmn:SignalEventDefinition"](E,be,b,X):yi(W,"bpmn:EscalationEventDefinition")?T["bpmn:EscalationEventDefinition"](E,be,b,X):yi(W,"bpmn:LinkEventDefinition")?T["bpmn:LinkEventDefinition"](E,be,b,X):yi(W,"bpmn:ErrorEventDefinition")?T["bpmn:ErrorEventDefinition"](E,be,b,X):yi(W,"bpmn:CancelEventDefinition")?T["bpmn:CancelEventDefinition"](E,be,b,X):yi(W,"bpmn:CompensateEventDefinition")?T["bpmn:CompensateEventDefinition"](E,be,b,X):yi(W,"bpmn:TerminateEventDefinition")?T["bpmn:TerminateEventDefinition"](E,be,b,X):null}var k={ParticipantMultiplicityMarker:function(M,E,b={}){var F=Wn(E,b),W=Tn(E,b),X=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:F,containerHeight:W,position:{mx:(F/2-6)/F,my:(W-15)/W}});P("participant-multiplicity",M,X,{strokeWidth:2,fill:qe(E,s,b.fill),stroke:de(E,c,b.stroke)})},SubProcessMarker:function(M,E,b={}){var F=m(M,14,14,0,{strokeWidth:1,fill:qe(E,s,b.fill),stroke:de(E,c,b.stroke)});nn(F,E.width/2-7.5,E.height-20);var W=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:E.width,containerHeight:E.height,position:{mx:(E.width/2-7.5)/E.width,my:(E.height-20)/E.height}});P("sub-process",M,W,{fill:qe(E,s,b.fill),stroke:de(E,c,b.stroke)})},ParallelMarker:function(M,E,b){var F=Wn(E,b),W=Tn(E,b),X=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:F,containerHeight:W,position:{mx:(F/2+b.parallel)/F,my:(W-20)/W}});P("parallel",M,X,{fill:qe(E,s,b.fill),stroke:de(E,c,b.stroke)})},SequentialMarker:function(M,E,b){var F=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:(E.width/2+b.seq)/E.width,my:(E.height-19)/E.height}});P("sequential",M,F,{fill:qe(E,s,b.fill),stroke:de(E,c,b.stroke)})},CompensationMarker:function(M,E,b){var F=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:(E.width/2+b.compensation)/E.width,my:(E.height-13)/E.height}});P("compensation",M,F,{strokeWidth:1,fill:qe(E,s,b.fill),stroke:de(E,c,b.stroke)})},LoopMarker:function(M,E,b){var F=Wn(E,b),W=Tn(E,b),X=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:F,containerHeight:W,position:{mx:(F/2+b.loop)/F,my:(W-7)/W}});P("loop",M,X,{strokeWidth:1.5,fill:"none",stroke:de(E,c,b.stroke),strokeMiterlimit:.5})},AdhocMarker:function(M,E,b){var F=Wn(E,b),W=Tn(E,b),X=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:F,containerHeight:W,position:{mx:(F/2+b.adhoc)/F,my:(W-15)/W}});P("adhoc",M,X,{strokeWidth:1,fill:de(E,c,b.stroke),stroke:de(E,c,b.stroke)})}};function O(M,E,b,F){k[M](E,b,F)}function j(M,E,b=[],F={}){F={fill:F.fill,stroke:F.stroke,width:Wn(E,F),height:Tn(E,F)};var W=ie(E),X=b.includes("SubProcessMarker");X?F={...F,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:F={...F,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},W.get("isForCompensation")&&b.push("CompensationMarker"),w(W,"bpmn:AdHocSubProcess")&&(b.push("AdhocMarker"),X||z(F,{compensation:F.compensation-18}));var be=W.get("loopCharacteristics"),Be=be&&be.get("isSequential");be&&(z(F,{compensation:F.compensation-18}),b.includes("AdhocMarker")&&z(F,{seq:-23,loop:-18,parallel:-24}),Be===void 0&&b.push("LoopMarker"),Be===!1&&b.push("ParallelMarker"),Be===!0&&b.push("SequentialMarker")),b.includes("CompensationMarker")&&b.length===1&&z(F,{compensation:-8}),I(b,function(et){O(et,M,E,F)})}function se(M,E,b={}){b=z({size:{width:100}},b);var F=o.createText(E||"",b);return Xe(F).add("djs-label"),Fe(M,F),F}function we(M,E,b,F={}){var W=ie(E),X=sa({x:E.x,y:E.y,width:E.width,height:E.height},F);return se(M,W.name,{align:b,box:X,padding:7,style:{fill:aa(E,u,c,F.stroke)}})}function Ke(M,E,b={}){var F={width:E.width,height:E.height,x:E.width/2+E.x,y:E.height/2+E.y};return se(M,jn(E),{box:F,style:z({},o.getExternalStyle(),{fill:aa(E,u,c,b.stroke)})})}function Y(M,E,b,F={}){var W=Kt(b),X=se(M,E,{box:{height:30,width:W?Tn(b,F):Wn(b,F)},align:"center-middle",style:{fill:aa(b,u,c,F.stroke)}});if(W){var be=-1*Tn(b,F);Ds(X,0,-be,270)}}function ue(M,E,b={}){var{width:F,height:W}=sa(E,b);return m(M,F,W,$s,{...b,fill:qe(E,s,b.fill),fillOpacity:go,stroke:de(E,c,b.stroke)})}function _e(M,E,b={}){var F=ie(E),W=qe(E,s,b.fill),X=de(E,c,b.stroke);return(F.get("associationDirection")==="One"||F.get("associationDirection")==="Both")&&(b.markerEnd=d(M,"association-end",W,X)),F.get("associationDirection")==="Both"&&(b.markerStart=d(M,"association-start",W,X)),b=Qe(b,["markerStart","markerEnd"]),x(M,E.waypoints,{...b,stroke:X,strokeDasharray:"0, 5"})}function le(M,E,b={}){var F=qe(E,s,b.fill),W=de(E,c,b.stroke),X=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:.474,my:.296}}),be=S(M,X,{fill:F,fillOpacity:go,stroke:W}),Be=ie(E);if(mR(Be)){var et=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:.33,my:(E.height-18)/E.height}});S(M,et,{strokeWidth:2,fill:F,stroke:W})}return be}function xe(M,E,b={}){return h(M,E.width,E.height,{fillOpacity:go,...b,fill:qe(E,s,b.fill),stroke:de(E,c,b.stroke)})}function ce(M,E,b={}){return _(M,E.width,E.height,{fill:qe(E,s,b.fill),fillOpacity:go,stroke:de(E,c,b.stroke)})}function U(M,E,b={}){var F=m(M,Wn(E,b),Tn(E,b),0,{fill:qe(E,s,b.fill),fillOpacity:b.fillOpacity||go,stroke:de(E,c,b.stroke),strokeWidth:1.5}),W=ie(E);if(w(W,"bpmn:Lane")){var X=W.get("name");Y(M,X,E,b)}return F}function q(M,E,b={}){var F=ue(M,E,b),W=Ye(E);if(pn(E)&&(ve(F,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!W)){var X=ie(E).flowElements||[],be=X.filter(Be=>w(Be,"bpmn:StartEvent"));be.length===1&&K(be[0],M,b,E)}return we(M,E,W?"center-top":"center-middle",b),W?j(M,E,void 0,b):j(M,E,["SubProcessMarker"],b),F}function K(M,E,b,F){var W=22,X={fill:qe(F,s,b.fill),stroke:de(F,c,b.stroke),width:W,height:W},be=ie(M).isInterrupting,Be=be?0:3,et=be?1:1.2,vt=20,it=(W-vt)/2,Tt="translate("+it+","+it+")";h(E,vt,vt,{fill:X.fill,stroke:X.stroke,strokeWidth:et,strokeDasharray:Be,transform:Tt}),$(M,E,X,F)}function Ge(M,E,b={}){var F=ue(M,E,b);return we(M,E,"center-middle",b),j(M,E,void 0,b),F}var Xt=this.handlers={"bpmn:AdHocSubProcess":function(M,E,b={}){return Ye(E)?b=Qe(b,["fill","stroke","width","height"]):b=Qe(b,["fill","stroke"]),q(M,E,b)},"bpmn:Association":function(M,E,b={}){return b=Qe(b,["fill","stroke"]),_e(M,E,b)},"bpmn:BoundaryEvent":function(M,E,b={}){var{renderIcon:F=!0}=b;b=Qe(b,["fill","stroke"]);var W=ie(E),X=W.get("cancelActivity");b={strokeWidth:1.5,fill:qe(E,s,b.fill),fillOpacity:wR,stroke:de(E,c,b.stroke)},X||(b.strokeDasharray="6");var be=xe(M,E,b);return h(M,E.width,E.height,Ns,{...b,fill:"none"}),F&&$(E,M,b),be},"bpmn:BusinessRuleTask":function(M,E,b={}){b=Qe(b,["fill","stroke"]);var F=Ge(M,E,b),W=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),X=S(M,W);ve(X,{fill:qe(E,s,b.fill),stroke:de(E,c,b.stroke),strokeWidth:1});var be=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),Be=S(M,be);return ve(Be,{fill:de(E,c,b.stroke),stroke:de(E,c,b.stroke),strokeWidth:1}),F},"bpmn:CallActivity":function(M,E,b={}){return b=Qe(b,["fill","stroke"]),q(M,E,{strokeWidth:5,...b})},"bpmn:ComplexGateway":function(M,E,b={}){b=Qe(b,["fill","stroke"]);var F=ce(M,E,b),W=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:E.width,containerHeight:E.height,position:{mx:.46,my:.26}});return S(M,W,{fill:de(E,c,b.stroke),stroke:de(E,c,b.stroke),strokeWidth:1}),F},"bpmn:DataInput":function(M,E,b={}){b=Qe(b,["fill","stroke"]);var F=i.getRawPath("DATA_ARROW"),W=le(M,E,b);return S(M,F,{fill:"none",stroke:de(E,c,b.stroke),strokeWidth:1}),W},"bpmn:DataInputAssociation":function(M,E,b={}){return b=Qe(b,["fill","stroke"]),_e(M,E,{...b,markerEnd:d(M,"association-end",qe(E,s,b.fill),de(E,c,b.stroke))})},"bpmn:DataObject":function(M,E,b={}){return b=Qe(b,["fill","stroke"]),le(M,E,b)},"bpmn:DataObjectReference":D("bpmn:DataObject"),"bpmn:DataOutput":function(M,E,b={}){b=Qe(b,["fill","stroke"]);var F=i.getRawPath("DATA_ARROW"),W=le(M,E,b);return S(M,F,{strokeWidth:1,fill:de(E,c,b.stroke),stroke:de(E,c,b.stroke)}),W},"bpmn:DataOutputAssociation":function(M,E,b={}){return b=Qe(b,["fill","stroke"]),_e(M,E,{...b,markerEnd:d(M,"association-end",qe(E,s,b.fill),de(E,c,b.stroke))})},"bpmn:DataStoreReference":function(M,E,b={}){b=Qe(b,["fill","stroke"]);var F=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:0,my:.133}});return S(M,F,{fill:qe(E,s,b.fill),fillOpacity:go,stroke:de(E,c,b.stroke),strokeWidth:2})},"bpmn:EndEvent":function(M,E,b={}){var{renderIcon:F=!0}=b;b=Qe(b,["fill","stroke"]);var W=xe(M,E,{...b,strokeWidth:4});return F&&$(E,M,b),W},"bpmn:EventBasedGateway":function(M,E,b={}){b=Qe(b,["fill","stroke"]);var F=ie(E),W=ce(M,E,b);h(M,E.width,E.height,E.height*.2,{fill:qe(E,"none",b.fill),stroke:de(E,c,b.stroke),strokeWidth:1});var X=F.get("eventGatewayType"),be=!!F.get("instantiate");function Be(){var vt=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:E.width,containerHeight:E.height,position:{mx:.36,my:.44}});S(M,vt,{fill:"none",stroke:de(E,c,b.stroke),strokeWidth:2})}if(X==="Parallel"){var et=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:E.width,containerHeight:E.height,position:{mx:.474,my:.296}});S(M,et,{fill:"none",stroke:de(E,c,b.stroke),strokeWidth:1})}else X==="Exclusive"&&(be||h(M,E.width,E.height,E.height*.26,{fill:"none",stroke:de(E,c,b.stroke),strokeWidth:1}),Be());return W},"bpmn:ExclusiveGateway":function(M,E,b={}){b=Qe(b,["fill","stroke"]);var F=ce(M,E,b),W=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:E.width,containerHeight:E.height,position:{mx:.32,my:.3}}),X=Ze(E);return X.get("isMarkerVisible")&&S(M,W,{fill:de(E,c,b.stroke),stroke:de(E,c,b.stroke),strokeWidth:1}),F},"bpmn:Gateway":function(M,E,b={}){return b=Qe(b,["fill","stroke"]),ce(M,E,b)},"bpmn:Group":function(M,E,b={}){return b=Qe(b,["fill","stroke","width","height"]),m(M,E.width,E.height,$s,{stroke:de(E,c,b.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:Wn(E,b),height:Tn(E,b)})},"bpmn:InclusiveGateway":function(M,E,b={}){b=Qe(b,["fill","stroke"]);var F=ce(M,E,b);return h(M,E.width,E.height,E.height*.24,{fill:qe(E,s,b.fill),stroke:de(E,c,b.stroke),strokeWidth:2.5}),F},"bpmn:IntermediateEvent":function(M,E,b={}){var{renderIcon:F=!0}=b;b=Qe(b,["fill","stroke"]);var W=xe(M,E,{...b,strokeWidth:1.5});return h(M,E.width,E.height,Ns,{fill:"none",stroke:de(E,c,b.stroke),strokeWidth:1.5}),F&&$(E,M,b),W},"bpmn:IntermediateCatchEvent":D("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":D("bpmn:IntermediateEvent"),"bpmn:Lane":function(M,E,b={}){return b=Qe(b,["fill","stroke","width","height"]),U(M,E,{...b,fillOpacity:ER})},"bpmn:ManualTask":function(M,E,b={}){b=Qe(b,["fill","stroke"]);var F=Ge(M,E,b),W=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return S(M,W,{fill:qe(E,s,b.fill),stroke:de(E,c,b.stroke),strokeWidth:.5}),F},"bpmn:MessageFlow":function(M,E,b={}){b=Qe(b,["fill","stroke"]);var F=ie(E),W=Ze(E),X=qe(E,s,b.fill),be=de(E,c,b.stroke),Be=x(M,E.waypoints,{markerEnd:d(M,"messageflow-end",X,be),markerStart:d(M,"messageflow-start",X,be),stroke:be,strokeDasharray:"10, 11",strokeWidth:1.5});if(F.get("messageRef")){var et=Be.getPointAtLength(Be.getTotalLength()/2),vt=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:et.x,y:et.y}}),it={strokeWidth:1};W.get("messageVisibleKind")==="initiating"?(it.fill=X,it.stroke=be):(it.fill=be,it.stroke=X);var Tt=S(M,vt,it),Qt=F.get("messageRef"),yn=Qt.get("name"),ut=se(M,yn,{align:"center-top",fitBox:!0,style:{fill:be}}),Nt=Tt.getBBox(),$t=ut.getBBox(),zo=et.x-$t.width/2,Jt=et.y+Nt.height/2+bR;Ds(ut,zo,Jt,0)}return Be},"bpmn:ParallelGateway":function(M,E,b={}){b=Qe(b,["fill","stroke"]);var F=ce(M,E,b),W=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:E.width,containerHeight:E.height,position:{mx:.46,my:.2}});return S(M,W,{fill:de(E,c,b.stroke),stroke:de(E,c,b.stroke),strokeWidth:1}),F},"bpmn:Participant":function(M,E,b={}){b=Qe(b,["fill","stroke","width","height"]);var F=U(M,E,b),W=Ye(E),X=Kt(E),be=ie(E),Be=be.get("name");if(W){var et=X?[{x:30,y:0},{x:30,y:Tn(E,b)}]:[{x:0,y:30},{x:Wn(E,b),y:30}];y(M,et,{stroke:de(E,c,b.stroke),strokeWidth:_R}),Y(M,Be,E,b)}else{var vt=sa(E,b);X||(vt.height=Wn(E,b),vt.width=Tn(E,b));var it=se(M,Be,{box:vt,align:"center-middle",style:{fill:aa(E,u,c,b.stroke)}});if(!X){var Tt=-1*Tn(E,b);Ds(it,0,-Tt,270)}}return be.get("participantMultiplicity")&&O("ParticipantMultiplicityMarker",M,E,b),F},"bpmn:ReceiveTask":function(M,E,b={}){b=Qe(b,["fill","stroke"]);var F=ie(E),W=Ge(M,E,b),X;return F.get("instantiate")?(h(M,28,28,20*.22,{fill:qe(E,s,b.fill),stroke:de(E,c,b.stroke),strokeWidth:1}),X=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):X=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),S(M,X,{fill:qe(E,s,b.fill),stroke:de(E,c,b.stroke),strokeWidth:1}),W},"bpmn:ScriptTask":function(M,E,b={}){b=Qe(b,["fill","stroke"]);var F=Ge(M,E,b),W=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return S(M,W,{fill:qe(E,s,b.fill),stroke:de(E,c,b.stroke),strokeWidth:1}),F},"bpmn:SendTask":function(M,E,b={}){b=Qe(b,["fill","stroke"]);var F=Ge(M,E,b),W=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return S(M,W,{fill:de(E,c,b.stroke),stroke:qe(E,s,b.fill),strokeWidth:1}),F},"bpmn:SequenceFlow":function(M,E,b={}){b=Qe(b,["fill","stroke"]);var F=qe(E,s,b.fill),W=de(E,c,b.stroke),X=x(M,E.waypoints,{markerEnd:d(M,"sequenceflow-end",F,W),stroke:W}),be=ie(E),{source:Be}=E;if(Be){var et=ie(Be);be.get("conditionExpression")&&w(et,"bpmn:Activity")&&ve(X,{markerStart:d(M,"conditional-flow-marker",F,W)}),et.get("default")&&(w(et,"bpmn:Gateway")||w(et,"bpmn:Activity"))&&et.get("default")===be&&ve(X,{markerStart:d(M,"conditional-default-flow-marker",F,W)})}return X},"bpmn:ServiceTask":function(M,E,b={}){b=Qe(b,["fill","stroke"]);var F=Ge(M,E,b);h(M,10,10,{fill:qe(E,s,b.fill),stroke:"none",transform:"translate(6, 6)"});var W=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});S(M,W,{fill:qe(E,s,b.fill),stroke:de(E,c,b.stroke),strokeWidth:1}),h(M,10,10,{fill:qe(E,s,b.fill),stroke:"none",transform:"translate(11, 10)"});var X=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return S(M,X,{fill:qe(E,s,b.fill),stroke:de(E,c,b.stroke),strokeWidth:1}),F},"bpmn:StartEvent":function(M,E,b={}){var{renderIcon:F=!0}=b;b=Qe(b,["fill","stroke"]);var W=ie(E);W.get("isInterrupting")||(b={...b,strokeDasharray:"6"});var X=xe(M,E,b);return F&&$(E,M,b),X},"bpmn:SubProcess":function(M,E,b={}){return Ye(E)?b=Qe(b,["fill","stroke","width","height"]):b=Qe(b,["fill","stroke"]),q(M,E,b)},"bpmn:Task":function(M,E,b={}){return b=Qe(b,["fill","stroke"]),Ge(M,E,b)},"bpmn:TextAnnotation":function(M,E,b={}){b=Qe(b,["fill","stroke"]);var{width:F,height:W}=sa(E,b),X=m(M,F,W,0,0,{fill:"none",stroke:"none"}),be=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:F,containerHeight:W,position:{mx:0,my:0}});S(M,be,{stroke:de(E,c,b.stroke)});var Be=ie(E),et=Be.get("text")||"";return se(M,et,{align:"left-top",box:sa(E,b),padding:mo,style:{fill:aa(E,u,c,b.stroke)}}),X},"bpmn:Transaction":function(M,E,b={}){Ye(E)?b=Qe(b,["fill","stroke","width","height"]):b=Qe(b,["fill","stroke"]);var F=q(M,E,{strokeWidth:1.5,...b}),W=n.style(["no-fill","no-events"],{stroke:de(E,c,b.stroke),strokeWidth:1.5}),X=Ye(E);return X||(b={}),m(M,Wn(E,b),Tn(E,b),$s-Ns,Ns,W),F},"bpmn:UserTask":function(M,E,b={}){b=Qe(b,["fill","stroke"]);var F=Ge(M,E,b),W=15,X=12,be=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:W,y:X}});S(M,be,{fill:qe(E,s,b.fill),stroke:de(E,c,b.stroke),strokeWidth:.5});var Be=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:W,y:X}});S(M,Be,{fill:qe(E,s,b.fill),stroke:de(E,c,b.stroke),strokeWidth:.5});var et=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:W,y:X}});return S(M,et,{fill:de(E,c,b.stroke),stroke:de(E,c,b.stroke),strokeWidth:.5}),F},label:function(M,E,b={}){return Ke(M,E,b)}};this._drawPath=S,this._renderer=C}ye(Ir,Ti),Ir.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Ir.prototype.canRender=function(e){return w(e,"bpmn:BaseElement")},Ir.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Ir.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Ir.prototype.getShapePath=function(e){return ze(e)?Tl(e,xR):w(e,"bpmn:Event")?Im(e):w(e,"bpmn:Activity")?Tl(e,$s):w(e,"bpmn:Gateway")?gR(e):yR(e)};function Qe(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var SR=0,RR={width:150,height:50};function CR(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function PR(e){return Ut(e)?z({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var Ml=null;function AR(){return Ml||(Ml=document.createElement("canvas").getContext("2d")),Ml}function TR(e){var t=[];return e.fontStyle&&t.push(e.fontStyle),e.fontVariant&&t.push(e.fontVariant),e.fontWeight&&t.push(e.fontWeight),e.fontStretch&&t.push(e.fontStretch),t.push(Bm(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function Bm(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function MR(e,t){var n=AR();if(!n)return{width:0,height:0};n.font=TR(t),"letterSpacing"in n&&(n.letterSpacing=Bm(t.letterSpacing)||"0px");var i=e==="",r=i?"dummy":e.replace(/\s+$/,""),o=n.measureText(r);return{width:i?0:o.width,height:"fontBoundingBoxAscent"in o?o.fontBoundingBoxAscent+o.fontBoundingBoxDescent:o.actualBoundingBoxAscent+o.actualBoundingBoxDescent}}function kR(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=MR(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return OR(e,r,i,o);r=LR(r,o.width,t)}}function OR(e,t,n,i){if(t.length<n.length){var r=n.slice(t.length).trim();e.unshift(r)}return{width:i.width,height:i.height,text:t}}var Nm="";function DR(e,t){var n=e.split(/(\s|-|\u00AD)/g),i,r=[],o=0;if(n.length>1)for(;i=n.shift();)if(i.length+o<t)r.push(i),o+=i.length;else{(i==="-"||i===Nm)&&r.pop();break}var a=r[r.length-1];return a&&a===Nm&&(r[r.length-1]="-"),r.join("")}function LR(e,t,n){var i=Math.max(e.length*(n/t),1),r=DR(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function Fs(e){this._config=z({},{size:RR,padding:SR,style:{},align:"center-top"},e||{})}Fs.prototype.createText=function(e,t){return this.layoutText(e,t).element},Fs.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Fs.prototype.layoutText=function(e,t){for(var n=z({},this._config.size,t.box),i=z({},this._config.style,t.style),r=CR(t.align||this._config.align),o=PR(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=IR(i),c=e.split(/\u00AD?\r?\n/),u=[],l=n.width-o.left-o.right;c.length;)u.push(kR(c,l,i));r.vertical==="middle"&&(o.top=o.bottom=0);var f=Rn(u,function(m,_,y){return m+(s||_.height)},0)+o.top+o.bottom,p=Rn(u,function(m,_,y){return _.width>m?_.width:m},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-f)/2),d-=(s||u[0].height)/4;var g=Ce("text");ve(g,i),I(u,function(m){var _;switch(d+=s||m.height,r.horizontal){case"left":_=o.left;break;case"right":_=(a?p:l)-o.right-m.width;break;default:_=Math.max(((a?p:l)-m.width)/2+o.left,0)}var y=Ce("tspan");ve(y,{x:_,y:d}),y.textContent=m.text,Fe(g,y)});var h={width:p,height:f};return{dimensions:h,element:g}};function IR(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var BR=12,NR=1.2,$R=40;function $m(e){var t=z({fontFamily:"Arial, sans-serif",fontSize:BR,fontWeight:"normal",lineHeight:NR},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=z({},t,{fontSize:n},e&&e.externalStyle||{}),r=new Fs({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Lr.width),height:30},u=o(s,c,{style:i});return{x:Math.round(a.x+a.width/2-u.width/2),y:a.y,width:Math.ceil(u.width),height:Math.ceil(u.height)}},this.getTextAnnotationBounds=function(a,s){var c=o(s,a,{style:t,align:"left-top",padding:mo});return{x:a.x,y:a.y,width:a.width,height:Math.max($R,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,z({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}$m.$inject=["config.textRenderer"];function FR(){this.pathMap={EVENT_MESSAGE:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:36,width:36,heightElements:[6,14],widthElements:[10.5,21]},EVENT_SIGNAL:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x1},0 Z",height:36,width:36,heightElements:[18],widthElements:[10,20]},EVENT_ESCALATION:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x0},-{e.y1} l -{e.x0},{e.y1} Z",height:36,width:36,heightElements:[20,7],widthElements:[8]},EVENT_CONDITIONAL:{d:"M {e.x0},{e.y0} l {e.x1},0 l 0,{e.y2} l -{e.x1},0 Z M {e.x2},{e.y3} l {e.x0},0 M {e.x2},{e.y4} l {e.x0},0 M {e.x2},{e.y5} l {e.x0},0 M {e.x2},{e.y6} l {e.x0},0 M {e.x2},{e.y7} l {e.x0},0 M {e.x2},{e.y8} l {e.x0},0 ",height:36,width:36,heightElements:[8.5,14.5,18,11.5,14.5,17.5,20.5,23.5,26.5],widthElements:[10.5,14.5,12.5]},EVENT_LINK:{d:"m {mx},{my} 0,{e.y0} -{e.x1},0 0,{e.y1} {e.x1},0 0,{e.y0} {e.x0},-{e.y2} -{e.x0},-{e.y2} z",height:36,width:36,heightElements:[4.4375,6.75,7.8125],widthElements:[9.84375,13.5]},EVENT_ERROR:{d:"m {mx},{my} {e.x0},-{e.y0} {e.x1},-{e.y1} {e.x2},{e.y2} {e.x3},-{e.y3} -{e.x4},{e.y4} -{e.x5},-{e.y5} z",height:36,width:36,heightElements:[.023,8.737,8.151,16.564,10.591,8.714],widthElements:[.085,6.672,6.97,4.273,5.337,6.636]},EVENT_CANCEL_45:{d:"m {mx},{my} -{e.x1},0 0,{e.x0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:36,width:36,heightElements:[4.75,8.5],widthElements:[4.75,8.5]},EVENT_COMPENSATION:{d:"m {mx},{my} {e.x0},-{e.y0} 0,{e.y1} z m {e.x1},-{e.y2} {e.x2},-{e.y3} 0,{e.y1} -{e.x2},-{e.y3} z",height:36,width:36,heightElements:[6.5,13,.4,6.1],widthElements:[9,9.3,8.7]},EVENT_TIMER_WH:{d:"M {mx},{my} l {e.x0},-{e.y0} m -{e.x0},{e.y0} l {e.x1},{e.y1} ",height:36,width:36,heightElements:[10,2],widthElements:[3,7]},EVENT_TIMER_LINE:{d:"M {mx},{my} m {e.x0},{e.y0} l -{e.x1},{e.y1} ",height:36,width:36,heightElements:[10,3],widthElements:[0,0]},EVENT_MULTIPLE:{d:"m {mx},{my} {e.x1},-{e.y0} {e.x1},{e.y0} -{e.x0},{e.y1} -{e.x2},0 z",height:36,width:36,heightElements:[6.28099,12.56199],widthElements:[3.1405,9.42149,12.56198]},EVENT_PARALLEL_MULTIPLE:{d:"m {mx},{my} {e.x0},0 0,{e.y1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} -{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z",height:36,width:36,heightElements:[2.56228,7.68683],widthElements:[2.56228,7.68683]},GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},GATEWAY_EVENT_BASED:{d:"m {mx},{my} {e.x0},{e.y0} {e.x0},{e.y1} {e.x1},{e.y2} {e.x2},0 z",height:11,width:11,heightElements:[-6,6,12,-12],widthElements:[9,-3,-12]},GATEWAY_COMPLEX:{d:"m {mx},{my} 0,{e.y0} -{e.x0},-{e.y1} -{e.x1},{e.y2} {e.x0},{e.y1} -{e.x2},0 0,{e.y3} {e.x2},0 -{e.x0},{e.y1} l {e.x1},{e.y2} {e.x0},-{e.y1} 0,{e.y0} {e.x3},0 0,-{e.y0} {e.x0},{e.y1} {e.x1},-{e.y2} -{e.x0},-{e.y1} {e.x2},0 0,-{e.y3} -{e.x2},0 {e.x0},-{e.y1} -{e.x1},-{e.y2} -{e.x0},{e.y1} 0,-{e.y0} -{e.x3},0 z",height:17.125,width:17.125,heightElements:[4.875,3.4375,2.125,3],widthElements:[3.4375,2.125,4.875,3]},DATA_OBJECT_PATH:{d:"m 0,0 {e.x1},0 {e.x0},{e.y0} 0,{e.y1} -{e.x2},0 0,-{e.y2} {e.x1},0 0,{e.y0} {e.x0},0",height:61,width:51,heightElements:[10,50,60],widthElements:[10,40,50,60]},DATA_OBJECT_COLLECTION_PATH:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},DATA_ARROW:{d:"m 5,9 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z",height:61,width:51,heightElements:[],widthElements:[]},DATA_STORE:{d:"m {mx},{my} l 0,{e.y2} c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 l 0,-{e.y2} c -{e.x0},-{e.y1} -{e.x1},-{e.y1} -{e.x2},0c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0",height:61,width:61,heightElements:[7,10,45],widthElements:[2,58,60]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_PARALLEL:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},MARKER_SEQUENTIAL:{d:"m{mx},{my} m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_COMPENSATION:{d:"m {mx},{my} 7,-5 0,10 z m 7.1,-0.3 6.9,-4.7 0,10 -6.9,-4.7 z",height:10,width:21,heightElements:[],widthElements:[]},MARKER_LOOP:{d:"m {mx},{my} c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 -6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902",height:13.9,width:13.7,heightElements:[],widthElements:[]},MARKER_ADHOC:{d:"m {mx},{my} m 0.84461,2.64411 c 1.05533,-1.23780996 2.64337,-2.07882 4.29653,-1.97997996 2.05163,0.0805 3.85579,1.15803 5.76082,1.79107 1.06385,0.34139996 2.24454,0.1438 3.18759,-0.43767 0.61743,-0.33642 1.2775,-0.64078 1.7542,-1.17511 0,0.56023 0,1.12046 0,1.6807 -0.98706,0.96237996 -2.29792,1.62393996 -3.6918,1.66181996 -1.24459,0.0927 -2.46671,-0.2491 -3.59505,-0.74812 -1.35789,-0.55965 -2.75133,-1.33436996 -4.27027,-1.18121996 -1.37741,0.14601 -2.41842,1.13685996 -3.44288,1.96782996 z",height:4,width:15,heightElements:[],widthElements:[]},TASK_TYPE_SEND:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:14,width:21,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"},TASK_TYPE_MANUAL:{d:"m {mx},{my} c 0.234,-0.01 5.604,0.008 8.029,0.004 0.808,0 1.271,-0.172 1.417,-0.752 0.227,-0.898 -0.334,-1.314 -1.338,-1.316 -2.467,-0.01 -7.886,-0.004 -8.108,-0.004 -0.014,-0.079 0.016,-0.533 0,-0.61 0.195,-0.042 8.507,0.006 9.616,0.002 0.877,-0.007 1.35,-0.438 1.353,-1.208 0.003,-0.768 -0.479,-1.09 -1.35,-1.091 -2.968,-0.002 -9.619,-0.013 -9.619,-0.013 v -0.591 c 0,0 5.052,-0.016 7.225,-0.016 0.888,-0.002 1.354,-0.416 1.351,-1.193 -0.006,-0.761 -0.492,-1.196 -1.361,-1.196 -3.473,-0.005 -10.86,-0.003 -11.0829995,-0.003 -0.022,-0.047 -0.045,-0.094 -0.069,-0.139 0.3939995,-0.319 2.0409995,-1.626 2.4149995,-2.017 0.469,-0.4870005 0.519,-1.1650005 0.162,-1.6040005 -0.414,-0.511 -0.973,-0.5 -1.48,-0.236 -1.4609995,0.764 -6.5999995,3.6430005 -7.7329995,4.2710005 -0.9,0.499 -1.516,1.253 -1.882,2.19 -0.37000002,0.95 -0.17,2.01 -0.166,2.979 0.004,0.718 -0.27300002,1.345 -0.055,2.063 0.629,2.087 2.425,3.312 4.859,3.318 4.6179995,0.014 9.2379995,-0.139 13.8569995,-0.158 0.755,-0.004 1.171,-0.301 1.182,-1.033 0.012,-0.754 -0.423,-0.969 -1.183,-0.973 -1.778,-0.01 -5.824,-0.004 -6.04,-0.004 10e-4,-0.084 0.003,-0.586 10e-4,-0.67 z"},TASK_TYPE_INSTANTIATING_SEND:{d:"m {mx},{my} l 0,8.4 l 12.6,0 l 0,-8.4 z l 6.3,3.6 l 6.3,-3.6"},TASK_TYPE_SERVICE:{d:"m {mx},{my} v -1.71335 c 0.352326,-0.0705 0.703932,-0.17838 1.047628,-0.32133 0.344416,-0.14465 0.665822,-0.32133 0.966377,-0.52145 l 1.19431,1.18005 1.567487,-1.57688 -1.195028,-1.18014 c 0.403376,-0.61394 0.683079,-1.29908 0.825447,-2.01824 l 1.622133,-0.01 v -2.2196 l -1.636514,0.01 c -0.07333,-0.35153 -0.178319,-0.70024 -0.323564,-1.04372 -0.145244,-0.34406 -0.321407,-0.6644 -0.522735,-0.96217 l 1.131035,-1.13631 -1.583305,-1.56293 -1.129598,1.13589 c -0.614052,-0.40108 -1.302883,-0.68093 -2.022633,-0.82247 l 0.0093,-1.61852 h -2.241173 l 0.0042,1.63124 c -0.353763,0.0736 -0.705369,0.17977 -1.049785,0.32371 -0.344415,0.14437 -0.665102,0.32092 -0.9635006,0.52046 l -1.1698628,-1.15823 -1.5667691,1.5792 1.1684265,1.15669 c -0.4026573,0.61283 -0.68308,1.29797 -0.8247287,2.01713 l -1.6588041,0.003 v 2.22174 l 1.6724648,-0.006 c 0.073327,0.35077 0.1797598,0.70243 0.3242851,1.04472 0.1452428,0.34448 0.3214064,0.6644 0.5227339,0.96066 l -1.1993431,1.19723 1.5840256,1.56011 1.1964668,-1.19348 c 0.6140517,0.40346 1.3028827,0.68232 2.0233517,0.82331 l 7.19e-4,1.69892 h 2.226848 z m 0.221462,-3.9957 c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_SERVICE_FILL:{d:"m {mx},{my} c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_BUSINESS_RULE_HEADER:{d:"m {mx},{my} 0,4 20,0 0,-4 z"},TASK_TYPE_BUSINESS_RULE_MAIN:{d:"m {mx},{my} 0,12 20,0 0,-12 zm 0,8 l 20,0 m -13,-4 l 0,8"},MESSAGE_FLOW_MARKER:{d:"m {mx},{my} m -10.5 ,-7 l 0,14 l 21,0 l 0,-14 z l 10.5,6 l 10.5,-6"}},this.getRawPath=function(t){return this.pathMap[t].d},this.getScaledPath=function(t,n){var i=this.pathMap[t],r,o;n.abspos?(r=n.abspos.x,o=n.abspos.y):(r=n.containerWidth*n.position.mx,o=n.containerHeight*n.position.my);var a={};if(n.position){for(var s=n.containerHeight/i.height*n.yScaleFactor,c=n.containerWidth/i.width*n.xScaleFactor,u=0;u<i.heightElements.length;u++)a["y"+u]=i.heightElements[u]*s;for(var l=0;l<i.widthElements.length;l++)a["x"+l]=i.widthElements[l]*c}var f=GR(i.d,{mx:r,my:o,e:a});return f}}var jR=/\{([^{}]+)\}/g,HR=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function zR(e,t,n){var i=n;return t.replace(HR,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 GR(e,t){return String(e).replace(jR,function(n,i){return zR(n,i,t)})}const VR={__init__:["bpmnRenderer"],bpmnRenderer:["type",Ir],textRenderer:["type",$m],pathMap:["type",FR]};function WR(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const ca={translate:["value",WR]};function js(e,t,n){return z({id:e.id,type:e.$type,businessObject:e,di:t},n)}function UR(e,t,n){var i=e.waypoint;return!i||i.length<2?[Oe(t),Oe(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function Fm(e,t,n){return new Error(`element ${ln(t)} referenced by ${ln(e)}#${n} not yet drawn`)}function Di(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}Di.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],Di.prototype.add=function(e,t,n){var i,r,o;if(w(t,"bpmndi:BPMNPlane")){var a=w(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(js(e,t,a)),this._canvas.addRootElement(i)}else if(w(t,"bpmndi:BPMNShape")){var s=!Ye(e,t),c=YR(e);r=n&&(n.hidden||n.collapsed);var u=t.bounds;i=this._elementFactory.createShape(js(e,t,{collapsed:s,hidden:r,x:Math.round(u.x),y:Math.round(u.y),width:Math.round(u.width),height:Math.round(u.height),isFrame:c})),w(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),w(e,"bpmn:Lane")&&(o=0),w(e,"bpmn:DataStoreReference")&&(qR(n,Oe(u))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else if(w(t,"bpmndi:BPMNEdge")){var l=this._getSource(e),f=this._getTarget(e);r=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(js(e,t,{hidden:r,source:l,target:f,waypoints:UR(t,l,f)})),w(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${ln(t)} for element ${ln(e)}`);return ir(e)&&jn(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},Di.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${ln(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw Fm(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},Di.prototype.addLabel=function(e,t,n){var i,r,o;return i=uR(t,n),r=jn(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(js(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!jn(n),x:Math.round(i.x),y:Math.round(i.y),width:Math.round(i.width),height:Math.round(i.height)})),this._canvas.addShape(o,n.parent)},Di.prototype._getConnectedElement=function(e,t){var n,i,r=e.$type;if(i=e[t+"Ref"],t==="source"&&r==="bpmn:DataInputAssociation"&&(i=i&&i[0]),(t==="source"&&r==="bpmn:DataOutputAssociation"||t==="target"&&r==="bpmn:DataInputAssociation")&&(i=e.$parent),n=i&&this._getElement(i),n)return n;throw i?Fm(e,i,t+"Ref"):new Error(`${ln(e)}#${t} Ref not specified`)},Di.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},Di.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},Di.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function qR(e,t){var n=t.x,i=t.y;return n>=e.x&&n<=e.x+e.width&&i>=e.y&&i<=e.y+e.height}function YR(e){return w(e,"bpmn:Group")}const jm={__depends__:[VR,{__depends__:[ca],bpmnImporter:["type",Di]}]};function ua(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function oi(e,t){return{x:e.x-t.x,y:e.y-t.y}}function kl(e){return Math.log(e)/Math.log(10)}var KR=1e3;function te(e){this._eventBus=e}te.$inject=["eventBus"];function XR(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}te.prototype.on=function(e,t,n,i,r,o){if((qt(t)||Ie(t))&&(o=r,r=i,i=n,n=t,t=null),qt(n)&&(o=r,r=i,i=n,n=KR),Ut(r)&&(o=r,r=!1),!qt(i))throw new Error("handlerFn must be a function");ke(e)||(e=[e]);var a=this._eventBus;I(e,function(s){var c=["commandStack",s,t].filter(function(u){return u}).join(".");a.on(c,n,r?XR(i,o):i,o)})},te.prototype.canExecute=Li("canExecute"),te.prototype.preExecute=Li("preExecute"),te.prototype.preExecuted=Li("preExecuted"),te.prototype.execute=Li("execute"),te.prototype.executed=Li("executed"),te.prototype.postExecute=Li("postExecute"),te.prototype.postExecuted=Li("postExecuted"),te.prototype.revert=Li("revert"),te.prototype.reverted=Li("reverted");function Li(e){return function(n,i,r,o,a){(qt(n)||Ie(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var Ol=["top","bottom","left","right"],Hs=10;function Dl(e,t){te.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],function(r){var o=r.context,a=o.connection,s=a.source,c=a.target,u=o.hints||{};u.createElementsBehavior!==!1&&(n(s),n(c))}),this.postExecuted(["label.create"],function(r){var o=r.context,a=o.shape,s=o.hints||{};s.createElementsBehavior!==!1&&n(a.labelTarget)}),this.postExecuted(["elements.create"],function(r){var o=r.context,a=o.elements,s=o.hints||{};s.createElementsBehavior!==!1&&a.forEach(function(c){n(c)})});function n(r){if(Bs(r)&&!at(r)){var o=JR(r);o&&i(r,o)}}function i(r,o){var a=Oe(r),s=r.label,c=Oe(s);if(s.parent){var u=Te(r),l;switch(o){case"top":l={x:a.x,y:u.top-Hs-s.height/2};break;case"left":l={x:u.left-Hs-s.width/2,y:a.y};break;case"bottom":l={x:a.x,y:u.bottom+Hs+s.height/2};break;case"right":l={x:u.right+Hs+s.width/2,y:a.y};break}var f=oi(l,c);t.moveShape(s,f)}}}ye(Dl,te),Dl.$inject=["eventBus","modeling"];function ZR(e){var t=e.host,n=Oe(e),i=tn(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=Ol.filter(function(a){return r.indexOf(a)===-1});return o}function QR(e){var t=Oe(e),n=[].concat(e.incoming.map(function(i){return i.waypoints[i.waypoints.length-2]}),e.outgoing.map(function(i){return i.waypoints[1]})).map(function(i){return Hm(t,i)});return n}function JR(e){var t=Oe(e.label),n=Oe(e),i=Hm(n,t);if(eC(i)){var r=QR(e);if(e.host){var o=ZR(e);r=r.concat(o)}var a=Ol.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?tn(e.label,e)!=="intersect"?void 0:i:a[0]}}function Hm(e,t){return tn(t,e,5)}function eC(e){return Ol.indexOf(e)!==-1}function Ll(e){te.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(w(i,"bpmn:TextAnnotation")?t.position={x:n.x+n.width/2+75,y:n.y-50-i.height/2}:t.position={x:n.x+n.width+80+i.width/2,y:n.y+n.height/2})},!0)}ye(Ll,te),Ll.$inject=["eventBus"];var tC=1500;function Il(e,t,n){e.invoke(te,this),this.preExecute("elements.delete",tC,function(r){var o=r.context,a=o.elements,s=i(a);s.length&&(o.elements=a.concat(s))}),t.on("shape.move.start",function(r){var o=r.context.shapes,a=i(o);a.length&&(r.context.shapes=o.concat(a))});function i(r){var o=Ue(r,u=>w(u,"bpmn:Participant")||w(u,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(u=>w(u,"bpmn:Artifact"))),c=new Set;return I(o,u=>{const l=new Set(Qr(uo(Array.from(s),kt(u))));c=c.union(l),s=s.difference(l)}),Array.from(c)}}ye(Il,te),Il.$inject=["injector","eventBus","canvas"];function Bl(e,t){e.invoke(te,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=Ue(r.incoming.concat(r.outgoing),function(a){return w(a,"bpmn:Association")});I(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}ye(Bl,te),Bl.$inject=["injector","modeling"];function yo(e,t){for(En(t)&&(t=[t]);e=e.parent;)if(We(e,t))return e;return null}function zm(e,t){var n=yo(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=yo(e,i),n)return Kt(n);if(We(e,i))return Kt(e);var r;for(r=ie(e);r&&!w(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find(function(a){var s=ie(a);return s&&s.get("processRef")===r});return o?Kt(o):!0}var Gm=500;function zs(e,t){t.invoke(te,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Gm,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return Vm(o,a)}),r.length===1&&r.map(function(o){return r.indexOf(o)}).forEach(function(o){var a=r[o];i.elements[o]=n._replaceShape(r[o],a)})},!0),this.preExecute("elements.move",Gm,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];Vm(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}zs.$inject=["bpmnReplace","injector"],ye(zs,te),zs.prototype._replaceShape=function(e,t){var n=nC(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function nC(e){var t=ie(e),n=t.eventDefinitions;return n&&n[0]}function Vm(e,t){return!ze(e)&&We(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function Nl(e,t){te.call(this,e);function n(i){return Ue(i.attachers,function(r){return w(r,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var r=i.context.source,o=i.context.target,a=n(o);w(r,"bpmn:EventBasedGateway")&&w(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var r=i.context.oldSource,o=i.context.newSource;w(r,"bpmn:Gateway")&&w(o,"bpmn:EventBasedGateway")&&I(o.outgoing,function(a){var s=a.target,c=n(s);w(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}Nl.$inject=["eventBus","modeling"],ye(Nl,te);function Wm(e){return e.create("bpmn:Category")}function iC(e){return e.create("bpmn:CategoryValue")}function Um(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=iC(e)),n.$parent||(n.$parent=Wm(e)),n}function rC(e,t,n){return At(t.get("categoryValue"),e),e.$parent=t,At(n.get("rootElements"),t),t.$parent=n,e}function oC(e){var t=e.$parent;return t&&(Ct(t.get("categoryValue"),e),e.$parent=null),e}function aC(e){var t=e.$parent;return t&&(Ct(t.get("rootElements"),e),e.$parent=null),e}var sC=500;function $l(e,t,n){n.invoke(te,this);function i(c){return t.filter(function(u){return w(u,"bpmn:Group")&&!u.labelTarget}).map(ie).filter(function(u){return u!==c})}function r(c,u){return i(u).some(function(l){return l.get("categoryValueRef")===c})}function o(c,u){return i(u).some(function(l){var f=l.get("categoryValueRef");return f&&f.$parent===c})}function a(c,u){c&&u&&rC(c,u,e.getDefinitions())}function s(c,u,l){u&&!o(u,l)&&aC(u),c&&!r(c,l)&&oC(c)}this.executed(["shape.create","label.create"],function(c){var u=c.labelTarget||c.shape;!w(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0),this.reverted(["shape.create","label.create"],function(c){var u=c.labelTarget||c.shape;!w(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,ie(u))},!0),this.executed(["shape.move","shape.resize"],sC,function(c){a(c.categoryValue,c.category)},!0),this.reverted(["shape.move","shape.resize"],function(c){var u=c.shape;c.categoryValue&&s(c.categoryValue,c.category,ie(u))},!0),this.executed("group.updateRefs",function(c){qm(c).forEach(function(u){a(u.categoryValue,u.category)})},!0),this.reverted("group.updateRefs",function(c){qm(c).forEach(function(u){s(u.categoryValue,u.category,ie(u.groupShape))})},!0),this.executed("shape.delete",function(c){var u=c.shape;!w(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,ie(u))},!0),this.reverted("shape.delete",function(c){var u=c.shape;!w(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0)}$l.$inject=["bpmnjs","elementRegistry","injector"],ye($l,te);function qm(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function Fl(e,t,n){te.call(this,e),this.preExecute("shape.replace",s,!0),this.postExecuted("shape.replace",c,!0),this.preExecute("connection.create",r,!0),this.postExecuted("connection.delete",i,!0),this.postExecuted("connection.reconnect",o,!0),this.postExecuted("element.updateProperties",a,!0);function i(m){const _=m.source,y=m.target;vo(_)&&la(y)&&l(y)}function r(m){const _=m.connection,y=m.source,x=m.target;vo(y)&&Gs(x)&&(u(x),p(y,[_]))}function o(m){const _=m.newTarget,y=m.oldSource,x=m.oldTarget;if(x!==_){const S=y;la(x)&&l(x),vo(S)&&Gs(_)&&u(_)}}function a(m){const{element:_}=m;la(_)?(f(_),d(_)):Gs(_)&&g(_)}function s(m){const{newData:_,oldShape:y}=m;if(vo(m.oldShape)&&_.eventDefinitionType!=="bpmn:CompensateEventDefinition"||_.type!=="bpmn:BoundaryEvent"){const x=y.outgoing.find(({target:S})=>la(S));x&&x.target&&(m._connectionTarget=x.target)}else if(!vo(m.oldShape)&&_.eventDefinitionType==="bpmn:CompensateEventDefinition"&&_.type==="bpmn:BoundaryEvent"){const x=y.outgoing.find(({target:S})=>Gs(S));x&&x.target&&(m._connectionTarget=x.target),h(y)}}function c(m){const{_connectionTarget:_,newShape:y}=m;_&&t.connect(y,_)}function u(m){t.updateProperties(m,{isForCompensation:!0})}function l(m){t.updateProperties(m,{isForCompensation:void 0})}function f(m){for(const _ of m.incoming)n.canConnect(_.source,m)||t.removeConnection(_);for(const _ of m.outgoing)n.canConnect(m,_.target)||t.removeConnection(_)}function p(m,_){m.outgoing.filter(S=>w(S,"bpmn:Association")).filter(S=>la(S.target)&&!_.includes(S)).forEach(S=>t.removeConnection(S))}function d(m){const _=m.attachers.slice();_.length&&t.removeElements(_)}function g(m){const _=m.incoming.filter(y=>vo(y.source));t.removeElements(_)}function h(m){const _=m.outgoing.filter(y=>w(y,"bpmn:SequenceFlow"));t.removeElements(_)}}ye(Fl,te),Fl.$inject=["eventBus","modeling","bpmnRules"];function la(e){const t=ie(e);return t&&t.get("isForCompensation")}function vo(e){return e&&w(e,"bpmn:BoundaryEvent")&&ho(e,"bpmn:CompensateEventDefinition")}function Gs(e){return e&&w(e,"bpmn:Activity")&&!pn(e)}function jl(e){e.invoke(te,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,r=n.shape;w(i,"bpmn:Lane")&&!w(r,"bpmn:Lane")&&(n.parent=yo(i,"bpmn:Participant"))})}jl.$inject=["injector"],ye(jl,te);function Hl(e,t){te.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,r=i.shape;if(w(r,"bpmn:DataObjectReference")&&r.type!=="label"){var o=t.create("bpmn:DataObject");o.isCollection=((a=r.businessObject.dataObjectRef)==null?void 0:a.isCollection)||!1,r.businessObject.dataObjectRef=o}})}Hl.$inject=["eventBus","bpmnFactory"],ye(Hl,te);var zl=20,Gl=20,Ym=30,Vs=2e3;function Vl(e,t,n){te.call(this,t),t.on(["create.start","shape.move.start"],Vs,function(r){var o=r.context,a=o.shape,s=e.getRootElement();if(!(!w(a,"bpmn:Participant")||!w(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(f){return!w(f,"bpmn:Group")&&!ze(f)&&!at(f)});if(c.length){var u=kt(c),l=cC(a,u);z(a,l),o.createConstraints=uC(a,u)}}}),t.on("create.start",Vs,function(r){var o=r.context,a=o.shape,s=e.getRootElement(),c=e.getGraphics(s);function u(l){l.element=s,l.gfx=c}w(a,"bpmn:Participant")&&w(s,"bpmn:Process")&&(t.on("element.hover",Vs,u),t.once("create.cleanup",function(){t.off("element.hover",u)}))});function i(){var r=e.getRootElement();return w(r,"bpmn:Collaboration")?r:n.makeCollaboration()}this.preExecute("elements.create",Vs,function(r){var o=r.elements,a=r.parent,s=lC(o),c;s&&w(a,"bpmn:Process")&&(r.parent=i(),c=r.hints=r.hints||{},c.participant=s,c.process=a,c.processRef=ie(s).get("processRef"))},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;w(a,"bpmn:Participant")&&w(o,"bpmn:Process")&&(r.parent=i(),r.process=o,r.processRef=ie(a).get("processRef"))},!0),this.execute("shape.create",function(r){var o=r.hints||{},a=r.process||o.process,s=r.shape,c=o.participant;a&&(!c||s===c)&&ie(s).set("processRef",ie(a))},!0),this.revert("shape.create",function(r){var o=r.hints||{},a=r.process||o.process,s=r.processRef||o.processRef,c=r.shape,u=o.participant;a&&(!u||c===u)&&ie(c).set("processRef",s)},!0),this.postExecute("shape.create",function(r){var o=r.hints||{},a=r.process||r.hints.process,s=r.shape,c=o.participant;if(a){var u=a.children.slice();c?s===c&&n.moveElements(u,{x:0,y:0},c):n.moveElements(u,{x:0,y:0},s)}},!0)}Vl.$inject=["canvas","eventBus","modeling"],ye(Vl,te);function cC(e,t){t={width:t.width+zl*2+Ym,height:t.height+Gl*2};var n=Math.max(e.width,t.width),i=Math.max(e.height,t.height);return{x:-n/2,y:-i/2,width:n,height:i}}function uC(e,t){return t=Te(t),{bottom:t.top+e.height/2-Gl,left:t.right-e.width/2+zl,top:t.bottom-e.height/2+Gl,right:t.left+e.width/2-zl-Ym}}function lC(e){return lt(e,function(t){return w(t,"bpmn:Participant")})}var Km="__targetRef_placeholder";function Wl(e,t){te.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 lt(u,function(l){return l!==c&&l.targetRef===s})}function i(a,s){var c=a.get("properties"),u=lt(c,function(l){return l.name===Km});return!u&&s&&(u=t.create("bpmn:Property",{name:Km}),At(c,u)),u}function r(a,s){var c=i(a);c&&(n(a,c,s)||Ct(a.get("properties"),c))}function o(a){var s=a.context,c=s.connection,u=c.businessObject,l=c.target,f=l&&l.businessObject,p=s.newTarget,d=p&&p.businessObject,g=s.oldTarget||s.target,h=g&&g.businessObject,m=c.businessObject,_;h&&h!==f&&r(h,u),d&&d!==f&&r(d,u),f?(_=i(f,!0),m.targetRef=_):m.targetRef=null}}Wl.$inject=["eventBus","bpmnFactory"],ye(Wl,te);function Xm(e){return function(t){var n=t.context,i=n.connection;if(w(i,"bpmn:DataInputAssociation"))return e(t)}}function Ws(e){this._bpmnUpdater=e}Ws.$inject=["bpmnUpdater"],Ws.prototype.execute=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.newSemanticParent,r=e.newDiParent;return e.oldSemanticParent=t.$parent,e.oldDiParent=n.$parent,this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,r),[]},Ws.prototype.revert=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.oldSemanticParent,r=e.oldDiParent;return this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,r),[]};function Ul(e,t,n,i){te.call(this,i),t.registerHandler("dataStore.updateContainment",Ws);function r(){return n.filter(function(s){return w(s,"bpmn:Participant")&&ie(s).processRef})[0]}function o(s){return s.children.filter(function(c){return w(c,"bpmn:DataStoreReference")&&!c.labelTarget})}function a(s,c){var u=s.businessObject||s;if(c=c||r(),c){var l=c.businessObject||c;t.execute("dataStore.updateContainment",{dataStoreBo:u,dataStoreDi:Ze(s),newSemanticParent:l.processRef||l,newDiParent:Ze(c)})}}this.preExecute("shape.create",function(s){var c=s.context,u=c.shape;w(u,"bpmn:DataStoreReference")&&u.type!=="label"&&(c.hints||(c.hints={}),c.hints.autoResize=!1)}),this.preExecute("elements.move",function(s){var c=s.context,u=c.shapes,l=u.filter(function(f){return w(f,"bpmn:DataStoreReference")});l.length&&(c.hints||(c.hints={}),c.hints.autoResize=u.filter(function(f){return!w(f,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,u=c.shape,l=u.parent;w(u,"bpmn:DataStoreReference")&&u.type!=="label"&&w(l,"bpmn:Collaboration")&&a(u)}),this.postExecute("shape.move",function(s){var c=s.context,u=c.shape,l=c.oldParent,f=u.parent;if(!w(l,"bpmn:Collaboration")&&w(u,"bpmn:DataStoreReference")&&u.type!=="label"&&w(f,"bpmn:Collaboration")){var p=w(l,"bpmn:Participant")?l:fC(l,"bpmn:Participant");a(u,p)}}),this.postExecute("shape.delete",function(s){var c=s.context,u=c.shape,l=e.getRootElement();We(u,["bpmn:Participant","bpmn:SubProcess"])&&w(l,"bpmn:Collaboration")&&o(l).filter(function(f){return pC(f,u)}).forEach(function(f){a(f)})}),this.postExecute("canvas.updateRoot",function(s){var c=s.context,u=c.oldRoot,l=c.newRoot,f=o(u);f.forEach(function(p){w(l,"bpmn:Process")&&a(p,l)})})}Ul.$inject=["canvas","commandStack","elementRegistry","eventBus"],ye(Ul,te);function pC(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 fC(e,t){for(;e.parent;){if(w(e.parent,t))return e.parent;e=e.parent}}var Us=Math.max,qs=Math.min,dC=20;function Zm(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function hC(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 mC(e,t){return{x:e.x+(t.left||0),y:e.y+(t.top||0),width:e.width-(t.left||0)+(t.right||0),height:e.height-(t.top||0)+(t.bottom||0)}}function Ys(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return Ie(r)&&(i=(/top|left/.test(e)?qs:Us)(i,r)),Ie(o)&&(i=(/top|left/.test(e)?Us:qs)(i,o)),i}function gC(e,t){if(!t)return e;var n=Te(e);return Ms({top:Ys("top",n,t),right:Ys("right",n,t),bottom:Ys("bottom",n,t),left:Ys("left",n,t)})}function yC(e,t,n,i){var r=Te(t),o={top:/n/.test(e)?r.bottom-n.height:r.top,left:/w/.test(e)?r.right-n.width:r.left,bottom:/s/.test(e)?r.top+n.height:r.bottom,right:/e/.test(e)?r.left+n.width:r.right},a=i?Te(i):o,s={top:qs(o.top,a.top),left:qs(o.left,a.left),bottom:Us(o.bottom,a.bottom),right:Us(o.right,a.right)};return Ms(s)}function pa(e,t){return typeof e<"u"?e:dC}function vC(e,t){var n,i,r,o;return typeof t=="object"?(n=pa(t.left),i=pa(t.right),r=pa(t.top),o=pa(t.bottom)):n=i=r=o=pa(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function bC(e){return!(e.waypoints||e.type==="label")}function Qm(e,t){var n;if(e.length===void 0?n=Ue(e.children,bC):n=e,n.length)return vC(kt(n),t)}var rr=Math.abs;function _C(e,t){return Zm(Te(t),Te(e))}var xC=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Un=30;function Ks(e,t){return t=t||[],e.children.filter(function(n){w(n,"bpmn:Lane")&&(Ks(n,t),t.push(n))}),t}function or(e){return e.children.filter(function(t){return w(t,"bpmn:Lane")})}function qn(e){return yo(e,xC)||e}function wC(e,t){var n=qn(e),i=w(n,"bpmn:Process")?[]:[n],r=Ks(n,i),o=Te(e),a=Te(t),s=_C(e,t),c=[],u=Kt(e);return r.forEach(function(l){if(l!==e){var f=u?0:s.top,p=u?s.right:0,d=u?0:s.bottom,g=u?s.left:0,h=Te(l);s.top&&(rr(h.bottom-o.top)<10&&(d=a.top-h.bottom),rr(h.top-o.top)<5&&(f=a.top-h.top)),s.left&&(rr(h.right-o.left)<10&&(p=a.left-h.right),rr(h.left-o.left)<5&&(g=a.left-h.left)),s.bottom&&(rr(h.top-o.bottom)<10&&(f=a.bottom-h.top),rr(h.bottom-o.bottom)<5&&(d=a.bottom-h.bottom)),s.right&&(rr(h.left-o.right)<10&&(g=a.right-h.left),rr(h.right-o.right)<5&&(p=a.right-h.right)),(f||p||d||g)&&c.push({shape:l,newBounds:mC(l,{top:f,right:p,bottom:d,left:g})})}}),c}var EC=500;function ql(e,t){te.call(this,e);function n(i,r){var o=Kt(i),a=or(r),s=[],c=[],u=[],l=[];if(Or(a,function(m){return o?m.y>i.y?c.push(m):s.push(m):m.x>i.x?l.push(m):u.push(m),m.children}),!!a.length){var f;o?c.length&&s.length?f=i.height/2:f=i.height:l.length&&u.length?f=i.width/2:f=i.width;var p,d,g,h;s.length&&(p=t.calculateAdjustments(s,"y",f,i.y-10),t.makeSpace(p.movingShapes,p.resizingShapes,{x:0,y:f},"s")),c.length&&(d=t.calculateAdjustments(c,"y",-f,i.y+i.height+10),t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:-f},"n")),u.length&&(g=t.calculateAdjustments(u,"x",f,i.x-10),t.makeSpace(g.movingShapes,g.resizingShapes,{x:f,y:0},"e")),l.length&&(h=t.calculateAdjustments(l,"x",-f,i.x+i.width+10),t.makeSpace(h.movingShapes,h.resizingShapes,{x:-f,y:0},"w"))}}this.postExecuted("shape.delete",EC,function(i){var r=i.context,o=r.hints,a=r.shape,s=r.oldParent;w(a,"bpmn:Lane")&&(o&&o.nested||n(a,s))})}ql.$inject=["eventBus","spaceTool"],ye(ql,te);var Jm=500;function Xs(e,t){t.invoke(te,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Jm,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return eg(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",Jm,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;eg(a,RC(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}Xs.$inject=["bpmnReplace","injector"],ye(Xs,te),Xs.prototype._replaceShape=function(e){var t=SC(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function SC(e){var t=ie(e),n=t.eventDefinitions;return n&&n[0]}function eg(e,t){return!ze(e)&&w(e,"bpmn:BoundaryEvent")&&!t}function RC(e,t){return e.indexOf(t)!==-1}var Zs=Math.round,CC=Math.max;function PC(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 AC(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var tg=10;function TC(e,t){var n,i;for(n=0;i=e[n];n++)if(ta(i,t)<=tg)return{point:e[n],bendpoint:!0,index:n};return null}function MC(e,t){var n=am(PC(t,tg),AC(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=CC(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:Zs(i.x+r.x)/2,y:Zs(i.y+r.y)/2},index:i.segment2}:{point:{x:Zs(i.x),y:Zs(i.y)},index:i.segment2}:null}function Yl(e,t){return TC(e,t)||MC(e,t)}function Kl(e,t,n){te.call(this,e);function i(r,o,a){var s=o.waypoints,c,u,l,f,p,d,g,h=r.outgoing.slice(),m=r.incoming.slice(),_;Ie(a.width)?_=Oe(a):_=a;var y=Yl(s,_);if(y){if(c=s.slice(0,y.index),u=s.slice(y.index+(y.bendpoint?1:0)),!c.length||!u.length)return;l=y.bendpoint?s[y.index]:_,(c.length===1||!ng(r,c[c.length-1]))&&c.push(ig(l)),(u.length===1||!ng(r,u[0]))&&u.unshift(ig(l))}f=o.source,p=o.target,t.canConnect(f,r,o)&&(n.reconnectEnd(o,r,c||_),d=o),t.canConnect(r,p,o)&&(d?g=n.connect(r,p,{type:o.type,waypoints:u}):(n.reconnectStart(o,r,u||_),g=o));var x=[].concat(d&&Ue(m,function(S){return S.source===d.source})||[],g&&Ue(h,function(S){return S.target===g.target})||[]);x.length&&n.removeElements(x)}this.preExecute("elements.move",function(r){var o=r.newParent,a=r.shapes,s=r.delta,c=a[0];if(!(!c||!o)){o&&o.waypoints&&(r.newParent=o=o.parent);var u=Oe(c),l={x:u.x+s.x,y:u.y+s.y},f=lt(o.children,function(p){var d=t.canInsert(a,p);return d&&Yl(p.waypoints,l)});f&&(r.targetFlow=f,r.position=l)}},!0),this.postExecuted("elements.move",function(r){var o=r.shapes,a=r.targetFlow,s=r.position;a&&i(o[0],a,s)},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;t.canInsert(a,o)&&(r.targetFlow=o,r.parent=o.parent)},!0),this.postExecuted("shape.create",function(r){var o=r.shape,a=r.targetFlow,s=r.position;a&&i(o,a,s)},!0)}ye(Kl,te),Kl.$inject=["eventBus","bpmnRules","modeling"];function ng(e,t){var n=t.x,i=t.y;return n>=e.x&&n<=e.x+e.width&&i>=e.y&&i<=e.y+e.height}function ig(e){return z({},e)}function Xl(e,t){te.call(this,e),this.preExecuted("connection.create",function(n){var i=n.context,r=i.connection,o=i.source,a=i.target,s=i.hints;if(!(s&&s.createElementsBehavior===!1)&&bo(r)){var c=[];w(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(u=>u!==r&&bo(u)):c=a.incoming.filter(u=>u!==r&&bo(u)&&w(u.source,"bpmn:EventBasedGateway")),c.forEach(function(u){t.removeConnection(u)})}}),this.preExecuted("shape.replace",function(n){var i=n.context,r=i.newShape;if(w(r,"bpmn:EventBasedGateway")){var o=r.outgoing.filter(bo).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(bo).forEach(function(s){const c=a.incoming.filter(bo).filter(function(u){return u.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}Xl.$inject=["eventBus","modeling"],ye(Xl,te);function bo(e){return w(e,"bpmn:SequenceFlow")}var Qs=1500,rg=2e3;function og(e,t,n){t.on(["create.hover","create.move","create.out","create.end","shape.move.hover","shape.move.move","shape.move.out","shape.move.end"],Qs,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;w(a,"bpmn:Lane")&&!We(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=qn(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||We(o,["bpmn:Group","bpmn:TextAnnotation"]))&&(i.hover=s,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.hover","connect.out","connect.end","connect.cleanup","global-connect.hover","global-connect.out","global-connect.end","global-connect.cleanup"],Qs,function(i){var r=i.hover;w(r,"bpmn:Lane")&&(i.hover=qn(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Qs,function(i){var r=i.context,o=i.hover,a=r.type;w(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=qn(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Qs,function(i){var r=i.context,o=r.start;w(o,"bpmn:Lane")&&(r.start=qn(o)||o)}),t.on("shape.move.start",rg,function(i){var r=i.shape;w(r,"bpmn:Lane")&&(i.shape=qn(r)||r)}),t.on("spaceTool.move",rg,function(i){var r=i.hover;r&&w(r,"bpmn:Lane")&&(i.hover=qn(r))})}og.$inject=["elementRegistry","eventBus","canvas"];var ag=770;function Zl(e,t,n,i){n.invoke(te,this);function r(s,c){var u=ie(s),l=c.categoryValue||u.categoryValueRef;l||(l=Um(e,u));var f=c.category||l.$parent||Wm(e);u.categoryValueRef=l,l.$parent=f,c.categoryValue=l,c.category=f}function o(s,c){var u=ie(s),l=c.categoryValue||u.categoryValueRef,f=c.category||l&&l.$parent;l&&(c.categoryValue=l,c.category=f,u.categoryValueRef=null)}this.execute("label.create",function(s){var c=s.context,u=c.labelTarget;w(u,"bpmn:Group")&&r(u,c)}),this.revert("label.create",function(s){var c=s.context,u=c.labelTarget;w(u,"bpmn:Group")&&o(u,c)}),this.execute("shape.delete",function(s){var c=s.context,u=c.shape,l=ie(u);if(!(!w(u,"bpmn:Group")||u.labelTarget)){var f=c.categoryValue=l.categoryValueRef;f&&(c.category=f.$parent,l.categoryValueRef=null)}}),this.reverted("shape.delete",function(s){var c=s.context,u=c.shape;if(!(!w(u,"bpmn:Group")||u.labelTarget)){var l=c.category,f=c.categoryValue,p=ie(u);f&&(p.categoryValueRef=f,f.$parent=l)}}),this.execute("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!w(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!ie(u).categoryValueRef&&!c.categoryValue||r(u,c)}),this.reverted("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!w(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!ie(u).categoryValueRef&&!c.categoryValue||o(u,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!w(u,"bpmn:Group")||u.labelTarget||ie(u).categoryValueRef||r(u,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!w(u,"bpmn:Group")||u.labelTarget||!c.categoryValue||o(u,c)});function a(s,c){var u=e.create(s.$type);return i.copyElement(s,u,null,c)}t.on("copyPaste.copyElement",ag,function(s){var c=s.descriptor,u=s.element;if(!(!w(u,"bpmn:Group")||u.labelTarget)){var l=ie(u);if(l.categoryValueRef){var f=l.categoryValueRef;c.categoryValue=a(f,!0),f.$parent&&(c.category=a(f.$parent,!0))}}}),t.on("copyPaste.pasteElement",ag,function(s){var c=s.descriptor,u=c.businessObject,l=c.categoryValue,f=c.category;l&&(l=u.categoryValueRef=a(l)),f&&(l.$parent=a(f)),delete c.category,delete c.categoryValue})}Zl.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],ye(Zl,te);function Ql(e,t,n,i){var r,o,a,s,c;return r=(i.y-n.y)*(t.x-e.x)-(i.x-n.x)*(t.y-e.y),r==0?null:(o=e.y-n.y,a=e.x-n.x,c=(i.x-n.x)*o-(i.y-n.y)*a,s=c/r,{x:Math.round(e.x+s*(t.x-e.x)),y:Math.round(e.y+s*(t.y-e.y))})}function sg(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=Ql(i,r,o,a),u=Ql(i,r,o,s),l;c&&u?cg(c,o)>cg(u,o)?l=u:l=c:l=c||u,i.original=l}function n(i){var r=i.waypoints;t(r[0],r[1],Oe(i.source)),t(r[r.length-1],r[r.length-2],Oe(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}sg.$inject=["eventBus"];function cg(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Jl(e){te.call(this,e);var t=["bpmn:Participant","bpmn:Lane"];this.executed(["shape.move","shape.create","shape.resize"],function(n){var i=n.context.shape,r=ie(i),o=Ze(i);if(We(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}Jl.$inject=["eventBus"],ye(Jl,te);function ug(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function lg(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function kC(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 OC(e,t,n){var i=[{n:e[0]-n[0],lambda:t[0]},{n:e[1]-n[1],lambda:t[1]}],r=i[0].n*t[0]+i[1].n*t[1],o=i[0].lambda*t[0]+i[1].lambda*t[1];return-r/o}function ep(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=OC([n.x,n.y],[r.x,r.y],[e.x,e.y]);return{x:n.x+o*r.x,y:n.y+o*r.y}}function pg(e,t){var n=ep(e,t),i={x:n.x-e.x,y:n.y-e.y};return ug(i)}function fa(e,t){return ug({x:e.x-t.x,y:e.y-t.y})}var fg=Math.sqrt,dg=Math.min,DC=Math.max,hg=Math.abs;function mg(e){return Math.pow(e,2)}function da(e,t){return fg(mg(e.x-t.x)+mg(e.y-t.y))}function LC(e,t){var n=0,i,r,o,a,s,c,u,l,f,p,d;for(n=0;n<t.length-1;n++){if(i=t[n],r=t[n+1],yg(i,r)?u=[i]:(o=da(e,i),a=da(e,r),c=dg(o,a),u=IC(i,r,e,c)),u.length<1)throw new Error("expected between [1, 2] circle -> line intersections");u.length===1&&(l={type:"bendpoint",position:u[0],segmentIndex:n,bendpointIndex:yg(i,u[0])?n:n+1}),u.length===2&&(s=NC(u[0],u[1]),l={type:"segment",position:s,segmentIndex:n,relativeLocation:da(i,s)/da(i,r)}),f=da(l.position,e),(!d||p>f)&&(d=l,p=f)}return d}function IC(e,t,n,i){var r=t.x-e.x,o=t.y-e.y,a=n.x-e.x,s=n.y-e.y,c=r*r+o*o,u=r*a+o*s,l=a*a+s*s-i*i,f=u/c,p=l/c,d=f*f-p;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var g=fg(d),h=-f+g,m=-f-g,_={x:e.x-r*h,y:e.y-o*h};if(d===0)return[_];var y={x:e.x-r*m,y:e.y-o*m};return[_,y].filter(function(x){return BC(x,e,t)})}function BC(e,t,n){return gg(e.x,t.x,n.x)&&gg(e.y,t.y,n.y)}function gg(e,t,n){return e>=dg(t,n)-Js&&e<=DC(t,n)+Js}function NC(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Js=.1;function yg(e,t){return hg(e.x-t.x)<=Js&&hg(e.y-t.y)<=Js}function $C(e,t,n,i){var r=n.segmentIndex,o=t.length-e.length;if(i.segmentMove){var a=i.segmentMove.segmentStartIndex,s=i.segmentMove.newSegmentStartIndex;return r===a?s:r>=s?r+o<s?s:r+o:r}if(i.bendpointMove){var c=i.bendpointMove.insert,u=i.bendpointMove.bendpointIndex,l;if(o===0)return r;if(r>=u&&(l=c?r+1:r-1),r<u&&(l=r,c&&n.type!=="bendpoint"&&u-1===r)){var f=bg(t,u);f<n.relativeLocation&&l++}return l}return o===0?r:i.connectionStart&&r===0?0:i.connectionEnd&&r===e.length-2?t.length-2:Math.floor((t.length-2)/2)}function vg(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=LC(e,n),c=s.segmentIndex,u=$C(n,t,s,i);if(u<0||u>t.length-2||u===null)return a;var l=_g(n,c),f=_g(t,u),p=s.position,d=jC(l,p),g=FC(l,f);if(s.type==="bendpoint"){var h=t.length-n.length,m=s.bendpointIndex,_=n[m];if(t.indexOf(_)!==-1)return a;if(h===0){var y=t[m];return r=y.x-s.position.x,o=y.y-s.position.y,{delta:{x:r,y:o},point:{x:e.x+r,y:e.y+o}}}h<0&&m!==0&&m<n.length-1&&(d=bg(n,m))}var x={x:(f[1].x-f[0].x)*d+f[0].x,y:(f[1].y-f[0].y)*d+f[0].y},S=kC({x:e.x-p.x,y:e.y-p.y},g);return r=x.x+S.x-e.x,o=x.y+S.y-e.y,{point:ki(x),delta:ki({x:r,y:o})}}function bg(e,t){var n=fa(e[t-1],e[t]),i=fa(e[t],e[t+1]),r=n/(n+i);return r}function FC(e,t){var n=lg(e),i=lg(t);return i-n}function _g(e,t){return[e[t],e[t+1]]}function jC(e,t){var n=fa(e[0],e[1]),i=fa(e[0],t);return n===0?0:i/n}function HC(e,t,n,i){var r=Oe(e);return vg(r,t,n,i).delta}function ha(e,t,n){var i=ua(t),r=ua(n),o=oi(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return ki({x:r.x+a.x,y:r.y+a.y})}function xg(e,t,n){var i=ua(e),r=ua(t),o=ua(n),a=oi(e,i),s=oi(i,r),c=zC(i,t,n);if(c)return c;var u={x:s.x*(n.width/t.width),y:s.y*(n.height/t.height)},l={x:o.x+u.x,y:o.y+u.y};return ki({x:l.x+a.x-e.x,y:l.y+a.y-e.y})}function zC(e,t,n){var i=Te(t),r=Te(n);if(GC(i,r))return null;var o=tn(t,e),a,s,c;if(o==="top")a={x:0,y:r.bottom-i.bottom};else if(o==="bottom")a={x:0,y:r.top-i.top};else if(o==="right")a={x:r.left-i.left,y:0};else if(o==="left")a={x:r.right-i.right,y:0};else return null;return s={x:e.x+a.x,y:e.y+a.y},c=tn(n,s),c!==o?null:a}function GC(e,t){return VC(e,t)||WC(e,t)}function VC(e,t){return e.right!==t.right&&e.left!==t.left}function WC(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var wg="name",Eg="text";function tp(e,t,n,i){te.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{ie(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var s=a.context,c=s.element,u=s.properties;if(wg in u&&t.updateLabel(c,u[wg]),Eg in u&&w(c,"bpmn:TextAnnotation")){var l=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},u[Eg]||"");t.updateLabel(c,u.text,l)}}this.postExecute(["shape.create","connection.create"],function(a){var s=a.context,c=s.hints||{};if(c.createElementsBehavior!==!1){var u=s.shape||s.connection;ze(u)||!ir(u)||jn(u)&&t.updateLabel(u,jn(u))}}),this.postExecute("shape.delete",function(a){var s=a.context,c=s.labelTarget,u=s.hints||{};c&&u.unsetLabel!==!1&&t.updateLabel(c,null,null,{removeShape:!1})});function o(a){var s=a.context,c=s.connection,u=c.label,l=z({},s.hints),f=s.newWaypoints||c.waypoints,p=s.oldWaypoints;return typeof l.startChanged>"u"&&(l.startChanged=!!l.connectionStart),typeof l.endChanged>"u"&&(l.endChanged=!!l.connectionEnd),HC(u,f,p,l)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(a){var s=a.context,c=s.hints||{};if(c.labelBehavior!==!1){var u=s.connection,l=u.label,f;!l||!l.parent||(f=o(a),t.moveShape(l,f))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,u=s.oldShape,l=ie(c);l&&ir(l)&&u.label&&c.label&&(c.label.x=u.label.x,c.label.y=u.label.y)}),this.preExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.hints||{};if(!(!ze(c)||u.autoResize)){var l=s.newBounds,f=i.getDimensions(jn(c)||"",{box:l,style:i.getExternalStyle()}),p=Math.ceil(f.height),d=l.y!==c.y,g=c.y+c.height;s.newBounds={width:l.width,height:p,x:l.x,y:d?g-p:l.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.newBounds,l=s.oldBounds;if(Bs(c)){var f=c.label,p=Oe(f),d=YC(l),g=qC(p,d),h=UC(g,l,u);t.moveShape(f,h)}})}ye(tp,te),tp.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function UC(e,t,n){var i=ha(e,t,n);return ki(oi(i,e))}function qC(e,t){if(t.length){var n=KC(e,t);return ep(e,n)}}function YC(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 KC(e,t){var n=t.map(function(r){return{line:r,distance:pg(e,r)}}),i=ci(n,"distance");return i[0].line}function XC(e,t,n,i){return vg(e,t,n,i).point}function np(e,t){te.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=z({},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),XC(r,c,u,s)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming;s.forEach(function(c){var u=c.waypoints[c.waypoints.length-1],l=n(i,u),f=[].concat(c.waypoints.slice(0,-1),[l]);t.updateWaypoints(c,f)}),a.forEach(function(c){var u=c.waypoints[0],l=n(i,u),f=[].concat([l],c.waypoints.slice(1));t.updateWaypoints(c,f)})}),this.postExecute(["connection.move"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming,c=r.delta;s.forEach(function(u){var l=u.waypoints[u.waypoints.length-1],f={x:l.x+c.x,y:l.y+c.y},p=[].concat(u.waypoints.slice(0,-1),[f]);t.updateWaypoints(u,p)}),a.forEach(function(u){var l=u.waypoints[0],f={x:l.x+c.x,y:l.y+c.y},p=[].concat([f],u.waypoints.slice(1));t.updateWaypoints(u,p)})})}ye(np,te),np.$inject=["eventBus","modeling"];function ec(e,t,n){var i=nc(e),r=Rg(i,t),o=i[0];return r.length?r[r.length-1]:ha(o.original||o,n,t)}function tc(e,t,n){var i=nc(e),r=Rg(i,t),o=i[i.length-1];return r.length?r[0]:ha(o.original||o,n,t)}function ip(e,t,n){var i=nc(e),r=Sg(t,n),o=i[0];return ha(o.original||o,r,t)}function rp(e,t,n){var i=nc(e),r=Sg(t,n),o=i[i.length-1];return ha(o.original||o,r,t)}function Sg(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function nc(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Rg(e,t){var n=sn(e,QC);return Ue(n,function(i){return ZC(i,t)})}function ZC(e,t){return tn(t,e,1)==="intersect"}function QC(e){return e.original||e}function op(e,t){te.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(JC(i,r)){var o=eP(i);o.incoming.forEach(function(a){var s=tc(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=ec(a,r,i);t.reconnectStart(a,r,s)})}},!0)}op.$inject=["eventBus","modeling"],ye(op,te);function JC(e,t){return w(e,"bpmn:Participant")&&Ye(e)&&w(t,"bpmn:Participant")&&!Ye(t)}function eP(e){var t=Jo([e]),n=[],i=[];return t.forEach(function(r){r!==e&&(r.incoming.forEach(function(o){w(o,"bpmn:MessageFlow")&&n.push(o)}),r.outgoing.forEach(function(o){w(o,"bpmn:MessageFlow")&&i.push(o)}))},[]),{incoming:n,outgoing:i}}const tP=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Cg(e){const t=ie(e);if(!w(t,"bpmn:BoundaryEvent")&&!(w(t,"bpmn:StartEvent")&&pn(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:tP.some(i=>w(n[0],i))}function Pg(e){return w(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function ap(e,t){e.invoke(te,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!Cg(r))return;const a=Pg(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=ie(i).get(a),u=ie(r).get(a);c!==u&&t.updateProperties(r,{[a]:c})})}ap.$inject=["injector","modeling"],ye(ap,te);function sp(e,t){te.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=Ze(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}ye(sp,te),sp.$inject=["eventBus","modeling"];function cp(e,t,n){te.call(this,e),this.preExecute("shape.delete",function(i){var r=i.context.shape;if(!(r.incoming.length!==1||r.outgoing.length!==1)){var o=r.incoming[0],a=r.outgoing[0];if(!(!w(o,"bpmn:SequenceFlow")||!w(a,"bpmn:SequenceFlow"))&&t.canConnect(o.source,a.target,o)){var s=nP(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}ye(cp,te),cp.$inject=["eventBus","bpmnRules","modeling"];function _o(e){return e.original||e}function nP(e,t){var n=Ql(_o(e[e.length-2]),_o(e[e.length-1]),_o(t[1]),_o(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[_o(e[0]),_o(t[t.length-1])]}function up(e,t){te.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,r=i.parent;w(i,"bpmn:Participant")&&(n.collaborationRoot=r)},!0),this.postExecute("shape.delete",function(n){var i=n.collaborationRoot;if(i&&!i.businessObject.participants.length){var r=t.makeProcess(),o=i.children.slice();t.moveElements(o,{x:0,y:0},r)}},!0)}up.$inject=["eventBus","modeling"],ye(up,te);function lp(e,t,n,i){te.call(this,e);var r=i.get("dragging",!1);function o(c){var u=c.source,l=c.target,f=c.parent;if(f){var p,d;w(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(u,l)||(d=!0),n.canConnectMessageFlow(u,l)&&(p="bpmn:MessageFlow")),w(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(u,l)||(d=!0),n.canConnectSequenceFlow(u,l)&&(p="bpmn:SequenceFlow")),d&&t.removeConnection(c),p&&t.connect(u,l,{type:p,waypoints:c.waypoints.slice()})}}function a(c){var u=c.context,l=u.connection,f=u.newSource||l.source,p=u.newTarget||l.target,d,g;d=n.canConnect(f,p),!(!d||d.type===l.type)&&(g=t.connect(f,p,{type:d.type,associationDirection:d.associationDirection,waypoints:l.waypoints.slice()}),l.parent&&t.removeConnection(l),u.connection=g,r&&s(l,g))}function s(c,u){var l=r.context(),f=l&&l.payload.previousSelection,p;!f||!f.length||(p=f.indexOf(c),p!==-1&&f.splice(p,1,u))}this.postExecuted("elements.move",function(c){var u=c.closure,l=u.allConnections;I(l,o)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var u=c.context,l=u.properties,f=u.element,p=f.businessObject,d;l.default&&(d=lt(f.outgoing,eo({id:f.businessObject.default.id})),d&&t.updateProperties(d,{conditionExpression:void 0})),l.conditionExpression&&p.sourceRef.default===p&&t.updateProperties(f.source,{default:void 0})})}ye(lp,te),lp.$inject=["eventBus","modeling","bpmnRules","injector"];function ic(e,t,n,i,r,o){i.invoke(te,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,function(a){var s=a.context,c=s.parent,u=s.elements,l=Rn(u,function(f,p){var d=t.canReplace([p],p.host||p.parent||c);return d?f.concat(d.replacements):f},[]);l.length&&this._replaceElements(u,l)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,u=s.newHost,l=[];I(s.closure.topLevel,function(p){pn(p)?l=l.concat(p.children):l=l.concat(p)}),l.length===1&&u&&(c=u);var f=t.canReplace(l,c);f&&this._replaceElements(l,f.replacements,u)},this),this.postExecute(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,u=s.newShape,l=c.attachers,f;l&&l.length&&(f=t.canReplace(l,u),this._replaceElements(l,f.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,u=s.newShape;r.unclaimId(c.businessObject.id,c.businessObject),r.updateProperties(u,{id:c.id})})}ye(ic,te),ic.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;I(t,function(o){var a={type:o.newElementType},s=n.get(o.oldElementId),c=e.indexOf(s);e[c]=i.replaceElement(s,a,{select:!1})}),t&&r.select(e)},ic.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var iP=1500,rP={width:140,height:120},pp={width:300,height:60},fp={width:60,height:300},rc={width:300,height:150},oc={width:150,height:300},Ag={width:140,height:120},Tg={width:100,height:40};function Mg(e){e.on("resize.start",iP,function(t){var n=t.context,i=n.shape,r=n.direction,o=n.balanced;(w(i,"bpmn:Lane")||w(i,"bpmn:Participant"))&&(n.resizeConstraints=uP(i,r,o)),w(i,"bpmn:SubProcess")&&Ye(i)&&(n.minDimensions=Ag),w(i,"bpmn:TextAnnotation")&&(n.minDimensions=Tg)})}Mg.$inject=["eventBus"];var ar=Math.abs,oP=Math.min,aP=Math.max;function kg(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function xo(e,t,n){return kg(e,t,n,oP)}function wo(e,t,n){return kg(e,t,n,aP)}var sP={top:20,left:50,right:20,bottom:20},cP={top:50,left:20,right:20,bottom:20};function uP(e,t,n){var i=qn(e),r=!0,o=!0,a=Ks(i,[i]),s=Te(e),c={},u={},l=Kt(e),f=l?pp:fp;/n/.test(t)?u.top=s.bottom-f.height:/e/.test(t)?u.right=s.left+f.width:/s/.test(t)?u.bottom=s.top+f.height:/w/.test(t)&&(u.left=s.right-f.width),a.forEach(function(g){var h=Te(g);l?(h.top<s.top-10&&(r=!1),h.bottom>s.bottom+10&&(o=!1)):(h.left<s.left-10&&(r=!1),h.right>s.right+10&&(o=!1)),/n/.test(t)&&(n&&ar(s.top-h.bottom)<10&&wo(c,"top",h.top+f.height),ar(s.top-h.top)<5&&xo(u,"top",h.bottom-f.height)),/e/.test(t)&&(n&&ar(s.right-h.left)<10&&xo(c,"right",h.right-f.width),ar(s.right-h.right)<5&&wo(u,"right",h.left+f.width)),/s/.test(t)&&(n&&ar(s.bottom-h.top)<10&&xo(c,"bottom",h.bottom-f.height),ar(s.bottom-h.bottom)<5&&wo(u,"bottom",h.top+f.height)),/w/.test(t)&&(n&&ar(s.left-h.right)<10&&wo(c,"left",h.left+f.width),ar(s.left-h.left)<5&&xo(u,"left",h.right-f.width))});var p=i.children.filter(function(g){return!g.hidden&&!g.waypoints&&(w(g,"bpmn:FlowElement")||w(g,"bpmn:Artifact"))}),d=l?sP:cP;return p.forEach(function(g){var h=Te(g);/n/.test(t)&&(!l||r)&&xo(u,"top",h.top-d.top),/e/.test(t)&&(l||o)&&wo(u,"right",h.right+d.right),/s/.test(t)&&(!l||o)&&wo(u,"bottom",h.bottom+d.bottom),/w/.test(t)&&(l||r)&&xo(u,"left",h.left-d.left)}),{min:u,max:c}}function Og(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function Eo(e){return e.originalEvent||e.srcEvent}function dp(e){Og(e),Og(Eo(e))}function Br(e){return e.pointers&&e.pointers.length&&(e=e.pointers[0]),e.touches&&e.touches.length&&(e=e.touches[0]),e?{x:e.clientX,y:e.clientY}:null}function Dg(){return/mac/i.test(navigator.platform)}function Lg(e,t){return(Eo(e)||e).button===t}function sr(e){return Lg(e,0)}function lP(e){return Lg(e,1)}function ma(e){var t=Eo(e)||e;return sr(e)?Dg()?t.metaKey:t.ctrlKey:!1}function ac(e){var t=Eo(e)||e;return sr(e)&&t.shiftKey}var Ig=1001;function Bg(e,t){e.on("resize.start",Ig+500,function(n){var i=n.context,r=i.shape;(w(r,"bpmn:Lane")||w(r,"bpmn:Participant"))&&(i.balanced=!ma(n))}),e.on("resize.end",Ig,function(n){var i=n.context,r=i.shape,o=i.canExecute,a=i.newBounds;if(w(r,"bpmn:Lane")||w(r,"bpmn:Participant"))return o&&(a=pm(a),t.resizeLane(r,a,i.balanced)),!1})}Bg.$inject=["eventBus","modeling"];var pP=500;function hp(e,t,n,i,r){n.invoke(te,this);function o(l){return We(l,["bpmn:ReceiveTask","bpmn:SendTask"])||fP(l,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(l){var f=e.getDefinitions(),p=f.get("rootElements");return!!lt(p,eo({id:l.id}))}function s(l){if(w(l,"bpmn:ErrorEventDefinition"))return"errorRef";if(w(l,"bpmn:EscalationEventDefinition"))return"escalationRef";if(w(l,"bpmn:MessageEventDefinition"))return"messageRef";if(w(l,"bpmn:SignalEventDefinition"))return"signalRef"}function c(l){if(We(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.get("messageRef");var f=l.get("eventDefinitions"),p=f[0];return p.get(s(p))}function u(l,f){if(We(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.set("messageRef",f);var p=l.get("eventDefinitions"),d=p[0];return d.set(s(d),f)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var f=l.shape||l.element;if(o(f)){var p=ie(f),d=c(p),g;d&&!a(d)&&(g=e.getDefinitions().get("rootElements"),At(g,d),l.addedRootElement=d)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var f=l.addedRootElement;if(f){var p=e.getDefinitions().get("rootElements");Ct(p,f)}},!0),t.on("copyPaste.copyElement",function(l){var f=l.descriptor,p=l.element;if(!(p.labelTarget||!o(p))){var d=ie(p),g=c(d);g&&(f.referencedRootElement=g)}}),t.on("copyPaste.pasteElement",pP,function(l){var f=l.descriptor,p=f.businessObject,d=f.referencedRootElement;d&&(a(d)||(d=i.copyElement(d,r.create(d.$type))),u(p,d),delete f.referencedRootElement)})}hp.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],ye(hp,te);function fP(e,t){return ke(t)||(t=[t]),Wi(t,function(n){return ho(e,n)})}var Ng=Math.max;function $g(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return I(n,function(a){var s=a.id;w(a,"bpmn:Participant")&&(o[s]=hP(a,i,r)),w(a,"bpmn:Lane")&&(o[s]=Kt(a)?pp:fp),w(a,"bpmn:SubProcess")&&Ye(a)&&(o[s]=Ag),w(a,"bpmn:TextAnnotation")&&(o[s]=Tg),w(a,"bpmn:Group")&&(o[s]=rP)}),o})}$g.$inject=["eventBus"];function dP(e){return e==="x"}function hP(e,t,n){var i=Kt(e);if(!yP(e))return i?rc:oc;var r=dP(t),o={};return r?i?o=rc:o={width:gP(e,n,r),height:oc.height}:i?o={width:rc.width,height:mP(e,n,r)}:o=oc,o}function mP(e,t,n){var i;return i=vP(e,t,n),Ng(rc.height,i)}function gP(e,t,n){var i;return i=bP(e,t,n),Ng(oc.width,i)}function yP(e){return!!or(e).length}function vP(e,t,n){var i=or(e),r;return r=mp(i,t,n),e.height-r.height+pp.height}function bP(e,t,n){var i=or(e),r;return r=mp(i,t,n),e.width-r.width+fp.width}function mp(e,t,n){var i,r,o;for(i=0;i<e.length;i++)if(r=e[i],!n&&t>=r.y&&t<=r.y+r.height||n&&t>=r.x&&t<=r.x+r.width)return o=or(r),o.length?mp(o,t,n):r}var Fg="_plane";function jg(e){var t=e.id;return _P(t)}function vi(e){var t=e.id;return w(e,"bpmn:SubProcess")?Hg(t):t}function Nr(e){return Hg(e)}function sc(e){var t=Ze(e);return w(t,"bpmndi:BPMNPlane")}function Hg(e){return e+Fg}function _P(e){return e.replace(new RegExp(Fg+"$"),"")}var zg=400,xP=600,Gg={x:180,y:160};function Ii(e,t,n,i,r,o,a){te.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=i,this._bpmnFactory=r,this._bpmnjs=o,this._elementRegistry=a;var s=this;function c(f){return w(f,"bpmn:SubProcess")&&!Ye(f)}function u(f){var p=f.shape,d=f.newRootElement,g=ie(p);d=s._addDiagram(d||g),f.newRootElement=e.addRootElement(d)}function l(f){var p=f.shape,d=ie(p);s._removeDiagram(d);var g=f.newRootElement=a.get(vi(d));e.removeRootElement(g)}this.executed("shape.create",function(f){var p=f.shape;c(p)&&u(f)},!0),this.postExecuted("elements.create",function(f){var p=f.elements;I(p,function(d){if(c(d)){var g=a.get(vi(d));if(!(!g||!d.children||!d.children.length)){var h=Vg(d);s._showRecursively(h),s._moveChildrenToShape(h,g)}}})},!0),this.reverted("shape.create",function(f){var p=f.shape;c(p)&&l(f)},!0),this.preExecute("shape.delete",function(f){var p=f.shape;!w(p,"bpmn:SubProcess")||!Ye(p)||I(oa([p]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(f){var p=f.shape;if(c(p)){var d=a.get(vi(p));d&&n.removeElements(d.children.slice())}},!0),this.executed("shape.delete",function(f){var p=f.shape;c(p)&&l(f)},!0),this.reverted("shape.delete",function(f){var p=f.shape;c(p)&&u(f)},!0),this.preExecuted("shape.replace",function(f){var p=f.oldShape,d=f.newShape;!c(p)||!c(d)||(f.oldRoot=e.removeRootElement(vi(p)))},!0),this.postExecuted("shape.replace",function(f){var p=f.newShape,d=f.oldRoot,g=e.findRoot(vi(p));if(!(!d||!g)){var h=d.children;n.moveElements(h,{x:0,y:0},g)}},!0),this.executed("element.updateProperties",function(f){var p=f.element;if(w(p,"bpmn:SubProcess")){var d=f.properties,g=f.oldProperties,h=g.id,m=d.id;if(h!==m){if(sc(p)){a.updateId(p,Nr(m)),a.updateId(h,m);return}var _=a.get(Nr(h));_&&a.updateId(Nr(h),Nr(m))}}},!0),this.reverted("element.updateProperties",function(f){var p=f.element;if(w(p,"bpmn:SubProcess")){var d=f.properties,g=f.oldProperties,h=g.id,m=d.id;if(h!==m){if(sc(p)){a.updateId(p,Nr(h)),a.updateId(m,h);return}var _=a.get(Nr(m));_&&a.updateId(_,Nr(h))}}},!0),t.on("element.changed",function(f){var p=f.element;if(sc(p)){var d=p,g=a.get(jg(d));!g||g===d||t.fire("element.changed",{element:g})}}),this.executed("shape.toggleCollapse",zg,function(f){var p=f.shape;w(p,"bpmn:SubProcess")&&(Ye(p)?l(f):(u(f),s._showRecursively(p.children)))},!0),this.reverted("shape.toggleCollapse",zg,function(f){var p=f.shape;w(p,"bpmn:SubProcess")&&(Ye(p)?l(f):(u(f),s._showRecursively(p.children)))},!0),this.postExecuted("shape.toggleCollapse",xP,function(f){var p=f.shape;if(w(p,"bpmn:SubProcess")){var d=f.newRootElement;if(d)if(Ye(p))s._moveChildrenToShape(d.children.slice(),p),I(oa(p.children),h=>{n.moveShape(h.annotation,{x:0,y:0},p.parent),I(h.associations,m=>{n.moveConnection(m,{x:0,y:0},p.parent)})});else{s._disconnectSharedAnnotations(p);var g=Vg(p);s._moveChildrenToShape(g,d)}}},!0),t.on("copyPaste.createTree",function(f){var p=f.element,d=f.children;if(c(p)){var g=vi(p),h=a.get(g);h&&d.push.apply(d,h.children)}}),t.on("copyPaste.copyElement",function(f){var p=f.descriptor,d=f.element,g=f.elements,h=d.parent,m=w(Ze(h),"bpmndi:BPMNPlane");if(m){var _=jg(h),y=lt(g,function(x){return x.id===_});y&&(p.parent=y.id)}}),t.on("copyPaste.pasteElement",function(f){var p=f.descriptor;p.parent&&(c(p.parent)||p.parent.hidden)&&(p.hidden=!0)})}ye(Ii,te),Ii.prototype._moveChildrenToShape=function(e,t){var n=this._modeling;if(e.length){var i=e.filter(function(c){return!c.hidden});if(!i.length){n.moveElements(e,{x:0,y:0},t,{autoResize:!1});return}var r=kt(i),o;if(!t.x)o={x:Gg.x-r.x,y:Gg.y-r.y};else{var a=Oe(t),s=Oe(r);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}},Ii.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(Lm(e).map(i=>i.annotation));n.size&&I(oa(e.children),i=>{n.has(i.annotation)&&I(i.associations,r=>{t.removeConnection(r)})})},Ii.prototype._showRecursively=function(e,t){var n=this,i=[];return e.forEach(function(r){r.hidden=!!t,i=i.concat(r),r.children&&(i=i.concat(n._showRecursively(r.children,r.collapsed||t)))}),i},Ii.prototype._addDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams;return e.businessObject||(e=this._createNewDiagram(e)),n.push(e.di.$parent),e},Ii.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,i=t.create("bpmndi:BPMNPlane",{bpmnElement:e}),r=t.create("bpmndi:BPMNDiagram",{plane:i});i.$parent=r;var o=n.createRoot({id:vi(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},Ii.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=lt(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},Ii.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function wP(e){var t=[];return I(oa(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function Vg(e){return e.children.slice().concat(wP(e.children)).concat(EP(e))}function EP(e){return _l(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function gp(e,t){e.invoke(te,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,r=n.context.newShape;if(!(!w(r,"bpmn:SubProcess")||w(r,"bpmn:AdHocSubProcess")||!(w(i,"bpmn:Task")||w(i,"bpmn:CallActivity"))||!Ye(r))){var o=SP(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}gp.$inject=["injector","modeling"],ye(gp,te);function SP(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function yp(e,t){te.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;w(i,"bpmn:TextAnnotation")&&(n.parent=i.parent)},!0),this.preExecute(["shape.create","shape.resize","elements.move"],function(n){const i=n.shapes||[n.shape];i.length===1&&w(i[0],"bpmn:TextAnnotation")&&(n.hints=n.hints||{},n.hints.autoResize=!1)},!0),this.preExecute("shape.resize",function(n){var i=n.context,r=i.shape,o=i.hints||{};if(!(!w(r,"bpmn:TextAnnotation")||o.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,jn(r)||""),c=a.y!==r.y&&Math.abs(a.y+a.height-(r.y+r.height))<=1,u=r.y+r.height;i.newBounds={width:a.width,height:s.height,x:a.x,y:c?u-s.height:a.y}}})}ye(yp,te),yp.$inject=["eventBus","textRenderer"];function vp(e,t){te.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(Ye(i))return;var r=Jo(i);r.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();I(s,function(u){o(u,!0)}),I(c,function(u){o(u,!1)})});function o(a,s){r.indexOf(a.source)!==-1&&r.indexOf(a.target)!==-1||w(a,"bpmn:Association")&&(w(a.source,"bpmn:TextAnnotation")||w(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,Oe(i)):t.reconnectStart(a,i,Oe(i)))}},!0)}ye(vp,te),vp.$inject=["eventBus","modeling"];var bp=500;function _p(e,t,n){te.call(this,e);function i(a){a.length&&a.forEach(function(s){s.type==="label"&&!s.businessObject.name&&(s.hidden=!0)})}function r(a,s){var c=a.children,u=s,l,f;return l=RP(c).concat([a]),f=Qm(l),f?(u.width=Math.max(f.width,u.width),u.height=Math.max(f.height,u.height),u.x=f.x+(f.width-u.width)/2,u.y=f.y+(f.height-u.height)/2):(u.x=a.x+(a.width-u.width)/2,u.y=a.y+(a.height-u.height)/2),u}function o(a,s){return{x:a.x+(a.width-s.width)/2,y:a.y+(a.height-s.height)/2,width:s.width,height:s.height}}this.executed(["shape.toggleCollapse"],bp,function(a){var s=a.context,c=s.shape;w(c,"bpmn:SubProcess")&&(c.collapsed?Ze(c).isExpanded=!1:(i(c.children),Ze(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],bp,function(a){var s=a.context,c=s.shape;c.collapsed?Ze(c).isExpanded=!1:Ze(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],bp,function(a){var s=a.context.shape,c=t.getDefaultSize(s),u;s.collapsed?u=o(s,c):u=r(s,c),n.resizeShape(s,u,null,{autoResize:s.collapsed?!1:"nwse"})})}ye(_p,te),_p.$inject=["eventBus","elementFactory","modeling"];function RP(e){return e.filter(function(t){return!t.hidden})}function xp(e,t,n,i){t.invoke(te,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;ze(a)||(w(a,"bpmn:Participant")&&Ye(a)&&n.ids.unclaim(s.processRef.id),i.unclaimId(s.id,s))}),this.preExecute("connection.delete",function(r){var o=r.context,a=o.connection,s=a.businessObject;i.unclaimId(s.id,s)}),this.preExecute("canvas.updateRoot",function(){var r=e.getRootElement(),o=r.businessObject;w(r,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}ye(xp,te),xp.$inject=["canvas","injector","moddle","modeling"];function wp(e,t){te.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;CP(r,o)&&t.updateProperties(o,{default:null})})}ye(wp,te),wp.$inject=["eventBus","modeling"];function CP(e,t){if(!w(e,"bpmn:SequenceFlow"))return!1;var n=ie(t),i=ie(e);return n.get("default")===i}var PP=500,AP=5e3,Wg=["shape.create","shape.delete","shape.move","shape.resize"],Ug=[...Wg,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function Ep(e,t){te.call(this,e);var n;function i(){return n=n||new TP,n.enter(),n}function r(){if(!n)throw new Error("out of bounds release");return n}function o(){if(!n)throw new Error("out of bounds release");var a=n.leave();return a&&(t.updateLaneRefs(n.flowNodes,n.lanes),n=null),a}this.preExecute(Ug,AP,function(){i()}),this.postExecuted(Ug,PP,function(){o()}),this.preExecute(Wg,function(a){var s=a.context,c=s.shape,u=r();!c||c.labelTarget||(w(c,"bpmn:Lane")&&u.addLane(c),w(c,"bpmn:FlowNode")&&u.addFlowNode(c))})}Ep.$inject=["eventBus","modeling"],ye(Ep,te);function TP(){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 MP=500,kP=5e3,qg=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],Yg=[...qg,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function Sp(e,t){te.call(this,e);var n;function i(){return n=n||new OP,n.enter(),n}function r(){if(!n)throw new Error("out of bounds release");return n}function o(){if(!n)throw new Error("out of bounds release");var a=n.leave();return a&&(t.updateCategoryValueRefs(Array.from(n.affectedFlowElements),Array.from(n.affectedGroupEntries.values())),n=null),a}this.preExecute(Yg,kP,function(){i()}),this.postExecuted(Yg,MP,function(){o()}),this.preExecute(qg,function(a){var s=a.context.connection||a.context.shape,c=r();!s||s.labelTarget||(w(s,"bpmn:FlowElement")&&c.addFlowElement(s),w(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;w(s,"bpmn:Group")&&r().addGroup(s)})}Sp.$inject=["eventBus","modeling"],ye(Sp,te);function OP(){this.affectedFlowElements=new Set,this.affectedGroupEntries=new Map,this.counter=0,this.addFlowElement=function(e){this.affectedFlowElements.add(e)},this.addGroup=function(e){this.affectedGroupEntries.has(e)||this.affectedGroupEntries.set(e,{categoryValue:e.businessObject.categoryValueRef,groupShape:e})},this.enter=function(){this.counter++},this.leave=function(){return this.counter--,!this.counter}}function Rp(e,t){te.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)DP(o)&&!IP(o)&&t.updateProperties(o,{isForCompensation:void 0})})}ye(Rp,te),Rp.$inject=["eventBus","modeling"];function DP(e){const t=ie(e);return t&&t.isForCompensation}function LP(e){return e&&w(e,"bpmn:BoundaryEvent")&&ho(e,"bpmn:CompensateEventDefinition")}function IP(e){return e.incoming.filter(n=>LP(n.source)).length>0}const BP={__init__:["adaptiveLabelPositioningBehavior","appendBehavior","artifactBehavior","associationBehavior","attachEventBehavior","boundaryEventBehavior","categoryRootElementReferenceBehavior","compensateBoundaryEventBehaviour","createBehavior","createDataObjectBehavior","createParticipantBehavior","dataInputAssociationBehavior","dataStoreBehavior","deleteLaneBehavior","detachEventBehavior","dropOnFlowBehavior","eventBasedGatewayBehavior","fixHoverBehavior","groupBehavior","importDockingFix","isHorizontalFix","labelBehavior","layoutConnectionBehavior","messageFlowBehavior","nonInterruptingBehavior","removeElementBehavior","removeEmbeddedLabelBoundsBehavior","removeParticipantBehavior","replaceConnectionBehavior","replaceElementBehaviour","resizeBehavior","resizeLaneBehavior","rootElementReferenceBehavior","spaceToolBehavior","subProcessPlaneBehavior","subProcessStartEventBehavior","textAnnotationBehavior","toggleCollapseConnectionBehaviour","toggleElementCollapseBehaviour","unclaimIdBehavior","updateFlowNodeRefsBehavior","updateCategoryValueRefsBehavior","unsetDefaultFlowBehavior","setCompensationActivityAfterPasteBehavior"],adaptiveLabelPositioningBehavior:["type",Dl],appendBehavior:["type",Ll],associationBehavior:["type",Bl],attachEventBehavior:["type",zs],artifactBehavior:["type",Il],boundaryEventBehavior:["type",Nl],categoryRootElementReferenceBehavior:["type",$l],compensateBoundaryEventBehaviour:["type",Fl],createBehavior:["type",jl],createDataObjectBehavior:["type",Hl],createParticipantBehavior:["type",Vl],dataInputAssociationBehavior:["type",Wl],dataStoreBehavior:["type",Ul],deleteLaneBehavior:["type",ql],detachEventBehavior:["type",Xs],dropOnFlowBehavior:["type",Kl],eventBasedGatewayBehavior:["type",Xl],fixHoverBehavior:["type",og],groupBehavior:["type",Zl],importDockingFix:["type",sg],isHorizontalFix:["type",Jl],labelBehavior:["type",tp],layoutConnectionBehavior:["type",np],messageFlowBehavior:["type",op],nonInterruptingBehavior:["type",ap],removeElementBehavior:["type",cp],removeEmbeddedLabelBoundsBehavior:["type",sp],removeParticipantBehavior:["type",up],replaceConnectionBehavior:["type",lp],replaceElementBehaviour:["type",ic],resizeBehavior:["type",Mg],resizeLaneBehavior:["type",Bg],rootElementReferenceBehavior:["type",hp],spaceToolBehavior:["type",$g],subProcessPlaneBehavior:["type",Ii],subProcessStartEventBehavior:["type",gp],textAnnotationBehavior:["type",yp],toggleCollapseConnectionBehaviour:["type",vp],toggleElementCollapseBehaviour:["type",_p],unclaimIdBehavior:["type",xp],unsetDefaultFlowBehavior:["type",wp],updateFlowNodeRefsBehavior:["type",Ep],updateCategoryValueRefsBehavior:["type",Sp],setCompensationActivityAfterPasteBehavior:["type",Rp]};function Cp(e){this._commandStack=e.get("commandStack",!1)}Cp.$inject=["injector"],Cp.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const bi={__init__:["rules"],rules:["type",Cp]};function Yn(e){te.call(this,e),this.init()}Yn.$inject=["eventBus"],ye(Yn,te),Yn.prototype.addRule=function(e,t,n){var i=this;typeof e=="string"&&(e=[e]),e.forEach(function(r){i.canExecute(r,t,function(o,a,s){return n(o)},!0)})},Yn.prototype.init=function(){};function Kg(e,t){var n=tn(e,t,-15);return n!=="intersect"?n:null}function rn(e){Yn.call(this,e)}ye(rn,Yn),rn.$inject=["eventBus"],rn.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return NP(t)}),this.addRule("connection.create",function(e){var t=e.source,n=e.target,i=e.hints||{},r=i.targetParent,o=i.targetAttach;if(o)return!1;r&&(n.parent=r);try{return uc(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return uc(n,i,t)}),this.addRule("connection.updateWaypoints",function(e){return{type:e.connection.type}}),this.addRule("shape.resize",function(e){var t=e.shape,n=e.newBounds,i=e.direction;return cy(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return at(i)&&!lc(t,i)?!1:Cr(t,function(r){return at(r)?uc(r.source,r.target,r):r.host?ga(r,r.host,null,n):Mp(r,i)})}),this.addRule("elements.move",function(e){var t=e.target,n=e.shapes,i=e.position,r=e.hints;return r!=null&&r.keyboardMove&&n.some(function(a){return ny(a)&&!n.includes(a.host)})?!1:ga(n,t,null,i)||ay(n,t,i)||sy(n,t)||lc(n,t)}),this.addRule("shape.create",function(e){return Mp(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return ga(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return dy(n,t)})},rn.prototype.canConnectMessageFlow=py,rn.prototype.canConnectSequenceFlow=fy,rn.prototype.canConnectDataAssociation=kp,rn.prototype.canConnectAssociation=uy,rn.prototype.canConnectCompensationAssociation=ly,rn.prototype.canMove=sy,rn.prototype.canAttach=ga,rn.prototype.canReplace=ay,rn.prototype.canDrop=So,rn.prototype.canInsert=lc,rn.prototype.canCreate=Mp,rn.prototype.canConnect=uc,rn.prototype.canResize=cy,rn.prototype.canCopy=dy;function NP(e){return Pp(e)?null:We(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function Pp(e){return!e||ze(e)}function Xg(e){do{if(w(e,"bpmn:Process"))return ie(e);if(w(e,"bpmn:Participant"))return ie(e).processRef||ie(e)}while(e=e.parent)}function Ap(e){return w(e,"bpmn:TextAnnotation")}function Tp(e){return w(e,"bpmn:Group")&&!e.labelTarget}function Zg(e){return w(e,"bpmn:BoundaryEvent")&&_i(e,"bpmn:CompensateEventDefinition")}function cc(e){return ie(e).isForCompensation}function $P(e,t){var n=Xg(e),i=Xg(t);return n===i}function FP(e){return w(e,"bpmn:InteractionNode")&&!w(e,"bpmn:BoundaryEvent")&&(!w(e,"bpmn:Event")||w(e,"bpmn:ThrowEvent")&&ey(e,"bpmn:MessageEventDefinition"))}function jP(e){return w(e,"bpmn:InteractionNode")&&!cc(e)&&(!w(e,"bpmn:Event")||w(e,"bpmn:CatchEvent")&&ey(e,"bpmn:MessageEventDefinition"))&&!(w(e,"bpmn:BoundaryEvent")&&!_i(e,"bpmn:MessageEventDefinition"))}function Qg(e){for(var t=e;t=t.parent;){if(w(t,"bpmn:FlowElementsContainer"))return ie(t);if(w(t,"bpmn:Participant"))return ie(t).processRef}return null}function Jg(e,t){var n=Qg(e),i=Qg(t);return n===i}function _i(e,t){var n=ie(e);return!!lt(n.eventDefinitions||[],function(i){return w(i,t)})}function ey(e,t){var n=ie(e);return(n.eventDefinitions||[]).every(function(i){return w(i,t)})}function HP(e){return w(e,"bpmn:FlowNode")&&!w(e,"bpmn:EndEvent")&&!pn(e)&&!(w(e,"bpmn:IntermediateThrowEvent")&&_i(e,"bpmn:LinkEventDefinition"))&&!Zg(e)&&!cc(e)}function zP(e){return w(e,"bpmn:FlowNode")&&!w(e,"bpmn:StartEvent")&&!w(e,"bpmn:BoundaryEvent")&&!pn(e)&&!(w(e,"bpmn:IntermediateCatchEvent")&&_i(e,"bpmn:LinkEventDefinition"))&&!cc(e)}function GP(e){return w(e,"bpmn:ReceiveTask")||w(e,"bpmn:IntermediateCatchEvent")&&(_i(e,"bpmn:MessageEventDefinition")||_i(e,"bpmn:TimerEventDefinition")||_i(e,"bpmn:ConditionalEventDefinition")||_i(e,"bpmn:SignalEventDefinition"))}function VP(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function ty(e,t){var n=VP(t);return n.indexOf(e)!==-1}function uc(e,t,n){if(Pp(e)||Pp(t))return null;if(!w(n,"bpmn:DataAssociation")){if(py(e,t))return{type:"bpmn:MessageFlow"};if(fy(e,t))return{type:"bpmn:SequenceFlow"}}var i=kp(e,t);return i||(ly(e,t)?{type:"bpmn:Association",associationDirection:"One"}:uy(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function So(e,t){return ze(e)||Tp(e)?!0:w(t,"bpmn:Participant")&&!Ye(t)?!1:w(e,"bpmn:Participant")?w(t,"bpmn:Process")||w(t,"bpmn:Collaboration"):We(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:w(e,"bpmn:Lane")?w(t,"bpmn:Participant")||w(t,"bpmn:Lane"):w(e,"bpmn:BoundaryEvent")&&!WP(e)?!1:w(e,"bpmn:FlowElement")&&!w(e,"bpmn:DataStoreReference")?w(t,"bpmn:FlowElementsContainer")?Ye(t):We(t,["bpmn:Participant","bpmn:Lane"]):w(e,"bpmn:DataStoreReference")&&w(t,"bpmn:Collaboration")?Wi(ie(t).get("participants"),function(n){return!!n.get("processRef")}):We(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?We(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):w(e,"bpmn:MessageFlow")?w(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function WP(e){return ie(e).cancelActivity&&(iy(e)||ry(e))}function ny(e){return!ze(e)&&w(e,"bpmn:BoundaryEvent")}function UP(e){return w(e,"bpmn:Lane")}function qP(e){return ny(e)||w(e,"bpmn:IntermediateThrowEvent")&&iy(e)?!0:w(e,"bpmn:IntermediateCatchEvent")&&ry(e)}function iy(e){var t=ie(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function ry(e){return oy(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function oy(e,t){return t.some(function(n){return _i(e,n)})}function YP(e){return w(e,"bpmn:ReceiveTask")&<(e.incoming,function(t){return w(t.source,"bpmn:EventBasedGateway")})}function ga(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return ze(r)||!qP(r)||pn(t)||!w(t,"bpmn:Activity")||cc(t)||i&&!Kg(i,t)||YP(t)?!1:"attach"}function ay(e,t,n){if(!t)return!1;var i={replacements:[]};return I(e,function(r){pn(t)||w(r,"bpmn:StartEvent")&&r.type!=="label"&&So(r,t)&&(iR(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(rR(r)||oR(r)||aR(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),oy(r,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&w(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"})),w(t,"bpmn:Transaction")||_i(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(w(r,"bpmn:EndEvent")&&So(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),w(r,"bpmn:BoundaryEvent")&&ga(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function sy(e,t){return Wi(e,UP)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return So(n,t)})}function Mp(e,t,n,i){return t?ze(e)||Tp(e)?!0:So(e,t)||lc(e,t):!1}function cy(e,t,n){return w(e,"bpmn:SubProcess")?Ye(e)&&(!t||t.width>=100&&t.height>=80):w(e,"bpmn:Lane")||w(e,"bpmn:Participant")?!0:Ap(e)?n?n==="e"||n==="w":!0:Tp(e)?!0:ze(e)?n?n==="e"||n==="w":!0:!1}function KP(e,t){var n=Ap(e),i=Ap(t);return(n||i)&&n!==i}function uy(e,t){return ty(t,e)||ty(e,t)?!1:KP(e,t)?!0:!!kp(e,t)}function ly(e,t){return Jg(e,t)&&Zg(e)&&w(t,"bpmn:Activity")&&!ZP(t,e)&&!pn(t)}function py(e,t){return my(e)&&!my(t)?!1:FP(e)&&jP(t)&&!$P(e,t)}function fy(e,t){return HP(e)&&zP(t)&&Jg(e,t)&&!(w(e,"bpmn:EventBasedGateway")&&!GP(t))}function kp(e,t){return We(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&We(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:We(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&We(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function lc(e,t,n){if(!t)return!1;if(Array.isArray(e)){if(e.length!==1)return!1;e=e[0]}return t.source===e||t.target===e?!1:We(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!ze(t)&&w(e,"bpmn:FlowNode")&&!w(e,"bpmn:BoundaryEvent")&&So(e,t.parent)}function Op(e,t){return e&&t&&e.indexOf(t)!==-1}function dy(e,t){return ze(t)?!0:!(w(t,"bpmn:Lane")&&!Op(e,t.parent)||w(t,"bpmn:MessageFlow")&&!XP(e,t))}function XP(e,t){var n=hy(t.source),i=hy(t.target);return Op(e,n)&&Op(e,i)}function hy(e){for(;e;e=e.parent)if(w(e,"bpmn:Participant"))return e;return null}function my(e){return yo(e,"bpmn:Process")||yo(e,"bpmn:Collaboration")}function ZP(e,t){return e.attachers.includes(t)}const QP={__depends__:[bi],__init__:["bpmnRules"],bpmnRules:["type",rn]};var JP=2e3;function gy(e,t){e.on("saveXML.start",JP,n);function n(){var i=t.getRootElements();I(i,function(r){var o=Ze(r),a,s;a=Jo([r]),a=Ue(a,function(c){return c!==r&&!c.labelTarget}),s=sn(a,Ze),o.set("planeElement",s)})}}gy.$inject=["eventBus","canvas"];const eA={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",gy]};function pc(e){te.call(this,e);var t=this;this.preExecute(["shape.create","connection.create"],function(n){var i=n.context,r=i.shape||i.connection,o=i.parent,a=t.getOrdering(r,o);a&&(a.parent!==void 0&&(i.parent=a.parent),i.parentIndex=a.index)}),this.preExecute(["shape.move","connection.move"],function(n){var i=n.context,r=i.shape||i.connection,o=i.newParent||r.parent,a=t.getOrdering(r,o);a&&(a.parent!==void 0&&(i.newParent=a.parent),i.newParentIndex=a.index)})}pc.prototype.getOrdering=function(e,t){return null},ye(pc,te);function Dp(e,t){pc.call(this,e);var n=[{type:"bpmn:SubProcess",order:{level:6}},{type:"bpmn:SequenceFlow",order:{level:9,containers:["bpmn:Participant","bpmn:FlowElementsContainer"]}},{type:"bpmn:DataAssociation",order:{level:9,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:TextAnnotation",order:{level:9}},{type:"bpmn:MessageFlow",order:{level:9,containers:["bpmn:Collaboration"]}},{type:"bpmn:Association",order:{level:6,containers:["bpmn:Participant","bpmn:FlowElementsContainer","bpmn:Collaboration"]}},{type:"bpmn:BoundaryEvent",order:{level:8}},{type:"bpmn:Group",order:{level:10,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:FlowElement",order:{level:5}},{type:"bpmn:Participant",order:{level:-2}},{type:"bpmn:Lane",order:{level:-1}}];function i(a){if(a.labelTarget)return{level:10};var s=lt(n,function(c){return We(a,[c.type])});return s&&s.order||{level:1}}function r(a){var s=a.order;if(s||(a.order=s=i(a)),!s)throw new Error(`no order for <${a.id}>`);return s}function o(a,s,c){for(var u=s;u&&!We(u,c);)u=u.parent;if(!u)throw new Error(`no parent for <${a.id}> in <${s&&s.id}>`);return u}this.getOrdering=function(a,s){if(a.labelTarget||w(a,"bpmn:TextAnnotation"))return{parent:t.findRoot(s)||t.getRootElement(),index:-1};var c=r(a);c.containers&&(s=o(a,s,c.containers));var u=s.children.indexOf(a),l=pd(s.children,function(f){return!a.labelTarget&&f.labelTarget?!1:c.level<r(f).level});return l!==-1&&u!==-1&&u<l&&(l-=1),{index:l,parent:s}}}Dp.$inject=["eventBus","canvas"],ye(Dp,pc);const tA={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Dp]};function ya(){}ya.prototype.get=function(){return this._data},ya.prototype.set=function(e){this._data=e},ya.prototype.clear=function(){var e=this._data;return delete this._data,e},ya.prototype.isEmpty=function(){return!this._data};const nA={clipboard:["type",ya]};var yy=1500;function vy(e,t,n){var i=this,r=n.get("dragging",!1);function o(a){if(!a.hover){var s=a.originalEvent,c=i._findTargetGfx(s),u=c&&e.get(c);c&&u&&(a.stopPropagation(),r.hover({element:u,gfx:c}),r.move(s))}}r&&t.on("drag.start",function(a){t.once("drag.move",yy,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",yy,function(c){s&&t.fire("element.out",{element:s,gfx:a})}),t.on("element.out",function(){a=null,s=null})})(),this._findTargetGfx=function(a){var s,c;if(a instanceof MouseEvent)return s=Br(a),c=document.elementFromPoint(s.x,s.y),iA(c)}}vy.$inject=["elementRegistry","eventBus","injector"];function iA(e){return Mr(e,"svg, .djs-element",!0)}const rA={__init__:["hoverFix"],hoverFix:["type",vy]};function oA(e){return!0}function fc(e){return sr(e)||lP(e)}var by=500;function _y(e,t,n){var i=this;function r(T,$,k){if(!s(T,$)){var O,j,se;k?j=t.getGraphics(k):(O=$.delegateTarget||$.target,O&&(j=O,k=t.get(j))),!(!j||!k)&&(se=e.fire(T,{element:k,gfx:j,originalEvent:$}),se===!1&&($.stopPropagation(),$.preventDefault()))}}var o={};function a(T){return o[T]}function s(T,$){var k=u[T]||sr;return!k($)}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":oA,"element.mousedown":fc,"element.mouseup":fc,"element.click":fc,"element.dblclick":fc};function l(T,$,k){var O=c[T];if(!O)throw new Error("unmapped DOM event name <"+T+">");return r(O,$,k)}var f="svg, .djs-element";function p(T,$,k,O){var j=o[k]=function(se){r(k,se)};O&&(u[k]=O),j.$delegate=Pn.bind(T,f,$,j)}function d(T,$,k){var O=a(k);O&&Pn.unbind(T,$,O.$delegate)}function g(T){I(c,function($,k){p(T,k,$)})}function h(T){I(c,function($,k){d(T,k,$)})}e.on("canvas.destroy",function(T){h(T.svg)}),e.on("canvas.init",function(T){g(T.svg)}),e.on(["shape.added","connection.added"],function(T){var $=T.element,k=T.gfx;e.fire("interactionEvents.createHit",{element:$,gfx:k})}),e.on(["shape.changed","connection.changed"],by,function(T){var $=T.element,k=T.gfx;e.fire("interactionEvents.updateHit",{element:$,gfx:k})}),e.on("interactionEvents.createHit",by,function(T){var $=T.element,k=T.gfx;i.createDefaultHit($,k)}),e.on("interactionEvents.updateHit",function(T){var $=T.element,k=T.gfx;i.updateDefaultHit($,k)});var m=P("djs-hit djs-hit-stroke"),_=P("djs-hit djs-hit-click-stroke"),y=P("djs-hit djs-hit-all"),x=P("djs-hit djs-hit-no-move"),S={all:y,"click-stroke":_,stroke:m,"no-move":x};function P(T,$){return $=z({stroke:"white",strokeWidth:15},$||{}),n.cls(T,["no-fill","no-border"],$)}function C(T,$){var k=S[$];if(!k)throw new Error("invalid hit type <"+$+">");return ve(T,k),T}function D(T,$){Fe(T,$)}this.removeHits=function(T){var $=Es(".djs-hit",T);I($,zt)},this.createDefaultHit=function(T,$){var k=T.waypoints,O=T.isFrame,j;return k?this.createWaypointsHit($,k):(j=O?"stroke":"all",this.createBoxHit($,j,{width:T.width,height:T.height}))},this.createWaypointsHit=function(T,$){var k=Qo($);return C(k,"stroke"),D(T,k),k},this.createBoxHit=function(T,$,k){k=z({x:0,y:0},k);var O=Ce("rect");return C(O,$),ve(O,k),D(T,O),O},this.updateDefaultHit=function(T,$){var k=ot(".djs-hit",$);if(k)return T.waypoints?bl(k,T.waypoints):ve(k,{width:T.width,height:T.height}),k},this.fire=r,this.triggerMouseEvent=l,this.mouseHandler=a,this.registerEvent=p,this.unregisterEvent=d}_y.$inject=["eventBus","elementRegistry","styles"];const dc={__init__:["interactionEvents"],interactionEvents:["type",_y]};function Ro(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=new Set;var n=this;e.on(["shape.remove","connection.remove"],function(i){var r=i.element;n.deselect(r)}),e.on(["diagram.clear","root.set"],function(i){n.select(null)})}Ro.$inject=["eventBus","canvas"],Ro.prototype.deselect=function(e){if(this._selectedElements.has(e)){var t=this.get();this._selectedElements.delete(e),this._eventBus.fire("selection.changed",{oldSelection:t,newSelection:this.get()})}},Ro.prototype.get=function(){return Array.from(this._selectedElements)},Ro.prototype.isSelected=function(e){return this._selectedElements.has(e)},Ro.prototype.select=function(e,t){var n=this.get();ke(e)||(e=e?[e]:[]);var i=this._canvas,r=i.getRootElement();e=e.filter(function(o){var a=i.findRoot(o);return r===a}),t?I(e,o=>{this._selectedElements.add(o)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var xy="hover",wy="selected";function Ey(e,t){this._canvas=e;function n(r,o){e.addMarker(r,o)}function i(r,o){e.removeMarker(r,o)}t.on("element.hover",function(r){n(r.element,xy)}),t.on("element.out",function(r){i(r.element,xy)}),t.on("selection.changed",function(r){function o(u){i(u,wy)}function a(u){n(u,wy)}var s=new Set(r.oldSelection),c=new Set(r.newSelection);for(let u of s)c.has(u)||o(u);for(let u of c)s.has(u)||a(u)})}Ey.$inject=["canvas","eventBus"];function Sy(e,t,n,i){e.on("create.end",500,function(r){var o=r.context,a=o.canExecute,s=o.elements,c=o.hints||{},u=c.autoSelect;if(a){if(u===!1)return;ke(u)?t.select(u):t.select(s.filter(aA))}}),e.on("connect.end",500,function(r){var o=r.context,a=o.connection;a&&t.select(a)}),e.on("shape.move.end",500,function(r){var o=r.previousSelection||[],a=i.get(r.context.shape.id),s=lt(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(sr(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=ac(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}Sy.$inject=["eventBus","selection","canvas","elementRegistry"];function aA(e){return!e.hidden}const Kn={__init__:["selectionVisuals","selectionBehavior"],__depends__:[dc],selection:["type",Ro],selectionVisuals:["type",Ey],selectionBehavior:["type",Sy]};var sA=/^djs-cursor-.*$/;function hc(e){var t=_t(document.body);t.removeMatching(sA),e&&t.add("djs-cursor-"+e)}function Ry(){hc(null)}var cA=5e3;function Cy(e,t){t=t||"element.click";function n(){return!1}return e.once(t,cA,n),function(){e.off(t,n)}}var uA=["c","C"],lA=["v","V"],pA=["d","D"],fA=["x","X"],dA=["y","Y"],Py=["z","Z"];function hA(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Mn(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function Gt(e,t){return e=ke(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function Lp(e){return e.shiftKey}function mA(e){return Mn(e)&&Gt(uA,e)}function gA(e){return Mn(e)&&Gt(lA,e)}function yA(e){return Mn(e)&&Gt(pA,e)}function vA(e){return Mn(e)&&Gt(fA,e)}function bA(e){return Mn(e)&&!Lp(e)&&Gt(Py,e)}function _A(e){return Mn(e)&&(Gt(dA,e)||Gt(Py,e)&&Lp(e))}var Co=Math.round,Ay="djs-drag-active";function $r(e){e.preventDefault()}function xA(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function wA(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Ty(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(x){var S=t.viewbox(),P=t._container.getBoundingClientRect();return{x:S.x+(x.x-P.left)/S.scale,y:S.y+(x.y-P.top)/S.scale}}function s(x,S){S=S||o;var P=e.createEvent(z({},S.payload,S.data,{isTouch:S.isTouch}));return e.fire("drag."+x,P)===!1?!1:e.fire(S.prefix+"."+x,P)}function c(x){var S=x.filter(function(P){return i.get(P.id)});S.length&&n.select(S)}function u(x,S){var P=o.payload,C=o.displacement,D=o.globalStart,T=Br(x),$=oi(T,D),k=o.localStart,O=a(T),j=oi(O,k);if(!o.active&&(S||wA($)>o.threshold)){if(z(P,{x:Co(k.x+C.x),y:Co(k.y+C.y),dx:0,dy:0},{originalEvent:x}),s("start")===!1)return m();o.active=!0,o.keepSelection||(P.previousSelection=n.get(),n.select(null)),o.cursor&&hc(o.cursor),t.addMarker(t.getRootElement(),Ay)}dp(x),o.active&&(z(P,{x:Co(O.x+C.x),y:Co(O.y+C.y),dx:Co(j.x),dy:Co(j.y)},{originalEvent:x}),s("move"))}function l(x){var S,P=!0;o.active&&(x&&(o.payload.originalEvent=x,dp(x)),P=s("end")),P===!1&&s("rejected"),S=_(P!==!0),s("ended",S)}function f(x){Gt("Escape",x)&&($r(x),m())}function p(x){var S;o.active&&(S=Cy(e),setTimeout(S,400),$r(x)),l(x)}function d(x){u(x)}function g(x){var S=o.payload;S.hoverGfx=x.gfx,S.hover=x.element,s("hover")}function h(x){s("out");var S=o.payload;S.hoverGfx=null,S.hover=null}function m(x){var S;if(o){var P=o.active;P&&s("cancel"),S=_(x),P&&s("canceled",S)}}function _(x){var S,P;s("cleanup"),Ry(),o.trapClick?P=p:P=l,Ne.unbind(document,"mousemove",u),Ne.unbind(document,"dragstart",$r),Ne.unbind(document,"selectstart",$r),Ne.unbind(document,"mousedown",P,!0),Ne.unbind(document,"mouseup",P,!0),Ne.unbind(document,"keyup",f),Ne.unbind(document,"touchstart",d,!0),Ne.unbind(document,"touchcancel",m,!0),Ne.unbind(document,"touchmove",u,!0),Ne.unbind(document,"touchend",l,!0),e.off("element.hover",g),e.off("element.out",h),t.removeMarker(t.getRootElement(),Ay);var C=o.payload.previousSelection;return x!==!1&&C&&!n.get().length&&c(C),S=o,o=null,S}function y(x,S,P,C){o&&m(!1),typeof S=="string"&&(C=P,P=S,S=null),C=z({},r,C||{});var D=C.data||{},T,$,k,O,j;if(C.trapClick?O=p:O=l,x?(T=Eo(x)||x,$=Br(x),dp(x),T.type==="dragstart"&&$r(T)):(T=null,$={x:0,y:0}),k=a($),S||(S=k),j=xA(T),o=z({prefix:P,data:D,payload:{},globalStart:$,displacement:oi(S,k),localStart:k,isTouch:j},C),C.manual||(j?(Ne.bind(document,"touchstart",d,!0),Ne.bind(document,"touchcancel",m,!0),Ne.bind(document,"touchmove",u,!0),Ne.bind(document,"touchend",l,!0)):(Ne.bind(document,"mousemove",u),Ne.bind(document,"dragstart",$r),Ne.bind(document,"selectstart",$r),Ne.bind(document,"mousedown",O,!0),Ne.bind(document,"mouseup",O,!0)),Ne.bind(document,"keyup",f),e.on("element.hover",g),e.on("element.out",h)),s("init")===!1)return m(),!1;C.autoActivate&&u(x,!0)}e.on("diagram.destroy",m),this.init=y,this.move=u,this.hover=g,this.out=h,this.end=l,this.cancel=m,this.context=function(){return o},this.setOptions=function(x){z(r,x)}}Ty.$inject=["eventBus","canvas","selection","elementRegistry"];const Bi={__depends__:[rA,Kn],dragging:["type",Ty]};function Po(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}Po.prototype.next=function(){return this._prefix+ ++this._counter};const EA=new Po("ps");var SA=["marker-start","marker-mid","marker-end"],RA=["circle","ellipse","line","path","polygon","polyline","path","rect"];function cr(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}cr.$inject=["elementRegistry","eventBus","canvas","styles"],cr.prototype.cleanUp=function(){console.warn("PreviewSupport#cleanUp is deprecated and will be removed in future versions. You do not need to manually clean up previews anymore. cf. https://github.com/bpmn-io/diagram-js/pull/906")},cr.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},cr.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=zh(n);return this._cloneMarkers(Dr(r),i),ve(r,this._styles.cls(i,[])),Fe(t,r),ve(r,"data-preview-support-element-id",e.id),r},cr.prototype.addFrame=function(e,t){var n=Ce("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return Fe(t,n),ve(n,"data-preview-support-element-id",e.id),n},cr.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),TA(e)&&SA.forEach(function(r){if(ve(e,r)){var o=CA(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,EA.next()].join("-"),a=ot("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||zh(n);s.id=o,Xe(s).add(r);var c=ot(":scope > defs",e);c||(c=Ce("defs"),Fe(e,c)),Fe(c,s);var u=AA(s.id);ve(t,i,u)};function CA(e,t,n){var i=PA(ve(e,t));return ot("marker#"+i,n||document)}function PA(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function AA(e){return"url(#"+e+")"}function TA(e){return RA.indexOf(e.nodeName)!==-1}const Ao={__init__:["previewSupport"],previewSupport:["type",cr]};var MA="drop-ok",My="drop-not-ok",ky="attach-ok",Oy="new-parent",Dy="create",kA=2e3;function Ly(e,t,n,i,r){function o(c,u,l,f,p){if(!u)return!1;c=Ue(c,function(y){var x=y.labelTarget;return!y.parent&&!(ze(y)&&c.indexOf(x)!==-1)});var d=lt(c,function(y){return!at(y)}),g=!1,h=!1,m=!1;By(c)&&(g=r.allowed("shape.attach",{position:l,shape:d,target:u})),g||(By(c)?m=r.allowed("shape.create",{position:l,shape:d,source:f,target:u}):m=r.allowed("elements.create",{elements:c,position:l,target:u}));var _=p.connectionTarget;return m||g?(d&&f&&(h=r.allowed("connection.create",{source:_===f?d:f,target:_===f?f:d,hints:{targetParent:u,targetAttach:g}})),{attach:g,connect:h}):m===null||g===null?null:!1}function a(c,u){[ky,MA,My,Oy].forEach(function(l){l===u?e.addMarker(c,l):e.removeMarker(c,l)})}n.on(["create.move","create.hover"],function(c){var u=c.context,l=u.elements,f=c.hover,p=u.source,d=u.hints||{};if(!f){u.canExecute=!1,u.target=null;return}Iy(c);var g={x:c.x,y:c.y},h=u.canExecute=f&&o(l,f,g,p,d);f&&h!==null&&(u.target=f,h&&h.attach?a(f,ky):a(f,h?Oy:My))}),n.on(["create.end","create.out","create.cleanup"],function(c){var u=c.hover;u&&a(u,null)}),n.on("create.end",function(c){var u=c.context,l=u.source,f=u.shape,p=u.elements,d=u.target,g=u.canExecute,h=g&&g.attach,m=g&&g.connect,_=u.hints||{};if(g===!1||!d)return!1;Iy(c);var y={x:c.x,y:c.y};m?f=i.appendShape(l,f,y,d,{attach:h,connection:m===!0?{}:m,connectionTarget:_.connectionTarget}):(p=i.createElements(p,y,d,z({},_,{attach:h})),f=lt(p,function(x){return!at(x)})),z(u,{elements:p,shape:f}),z(c,{elements:p,shape:f})});function s(){var c=t.context();c&&c.prefix===Dy&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],kA,function(){n.off("elements.changed",s)})}),this.start=function(c,u,l){ke(u)||(u=[u]);var f=lt(u,function(g){return!at(g)});if(f){l=z({elements:u,hints:{},shape:f},l||{}),I(u,function(g){Ie(g.x)||(g.x=0),Ie(g.y)||(g.y=0)});var p=Ue(u,function(g){return!g.hidden}),d=kt(p);I(u,function(g){at(g)&&(g.waypoints=sn(g.waypoints,function(h){return{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2}})),z(g,{x:g.x-d.x-d.width/2,y:g.y-d.y-d.height/2})}),t.init(c,Dy,{cursor:"grabbing",autoActivate:!0,data:{shape:f,elements:u,context:l}})}}}Ly.$inject=["canvas","dragging","eventBus","modeling","rules"];function Iy(e){var t=e.context,n=t.createConstraints;n&&(n.left&&(e.x=Math.max(e.x,n.left)),n.right&&(e.x=Math.min(e.x,n.right)),n.top&&(e.y=Math.max(e.y,n.top)),n.bottom&&(e.y=Math.min(e.y,n.bottom)))}function By(e){return e&&e.length===1&&!at(e[0])}var OA=750;function Ny(e,t,n,i,r){function o(a){var s=Ce("g");ve(s,r.cls("djs-drag-group",["no-events"]));var c=Ce("g");return a.forEach(function(u){var l;u.hidden||(u.waypoints?(l=n._createContainer("connection",c),n.drawConnection(Dr(l),u)):(l=n._createContainer("shape",c),n.drawShape(Dr(l),u),nn(l,u.x,u.y)),i.addDragger(u,s,l))}),s}t.on("create.move",OA,function(a){var s=a.hover,c=a.context,u=c.elements,l=c.dragGroup;l||(l=c.dragGroup=o(u));var f;s?(l.parentNode||(f=e.getActiveLayer(),Fe(f,l)),nn(l,a.x,a.y)):zt(l)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&zt(c)})}Ny.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const mc={__depends__:[Bi,Ao,bi,Kn],__init__:["create","createPreview"],create:["type",Ly],createPreview:["type",Ny]};function Ip(e){var t=this;this._lastMoveEvent=null;function n(i){t._lastMoveEvent=i}e.on("canvas.init",function(i){var r=t._svg=i.svg;r.addEventListener("mousemove",n)}),e.on("canvas.destroy",function(){t._lastMouseEvent=null,t._svg.removeEventListener("mousemove",n)})}Ip.$inject=["eventBus"],Ip.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||DA(0,0)};function DA(e,t){var n=document.createEvent("MouseEvent"),i=e,r=t,o=e,a=t;return n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,i,r,o,a,!1,!1,!1,!1,0,null),n}const va={__init__:["mouse"],mouse:["type",Ip]};var $y=2e3;function kn(e,t,n,i,r,o,a,s){this._canvas=e,this._create=t,this._elementFactory=i,this._eventBus=r,this._modeling=o,this._mouse=a,this._rules=s,r.on("copyPaste.copyElement",function(c){var u=c.descriptor,l=c.element,f=c.elementsSet;u.priority=1,u.id=l.id,f.has(l.parent)&&(u.parent=l.parent.id),LA(l)&&(u.priority=2,u.host=l.host.id),at(l)&&(u.priority=3,u.source=l.source.id,u.target=l.target.id,u.waypoints=IA(l)),ze(l)&&(u.priority=4,u.labelTarget=l.labelTarget.id),I(["x","y","width","height"],function(p){Ie(l[p])&&(u[p]=l[p])}),u.hidden=l.hidden,u.collapsed=l.collapsed}),r.on("copyPaste.elementsCopied",$y,function(c){var u;((u=c.hints)==null?void 0:u.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",$y,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var u=c.hints;z(u,{createElementsBehavior:!1})})}kn.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],kn.prototype.copy=function(e,t={}){var n,i;return ke(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(ke(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},kn.prototype.paste=function(e={}){var t=this._eventBus.createEvent({type:"copyPaste.pasteElements",hints:{},...e}),n=this._eventBus.fire(t);if(n!==!1){var i=t.tree;if(i){var r=t.hints,o=this._createElements(i);if(t.element&&t.point)return this._paste(o,t.element,t.point,r);this._create.start(this._mouse.getLastMoveEvent(),o,{hints:r})}}},kn.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},kn.prototype.cut=function(e){var t=this.copy(e),n=this._getElementIdsFromTree(t),i=e.filter(function(r){return n[r.id]});return i.length>0&&this._modeling.removeElements(i),t},kn.prototype._getElementIdsFromTree=function(e){var t={};return I(e,function(n){I(n,function(i){i.id&&(t[i.id]=!0)})}),t},kn.prototype._paste=function(e,t,n,i){I(e,function(o){Ie(o.x)||(o.x=0),Ie(o.y)||(o.y=0)});var r=kt(e);return I(e,function(o){at(o)&&(o.waypoints=sn(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),z(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,z({},i))},kn.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return I(e,function(o,a){o=ci(o,"priority"),I(o,function(s){var c=z({},ui(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var u;if(at(c)){c.source=i[s.source],c.target=i[s.target],u=i[s.id]=t.createConnection(c),r.push(u);return}if(ze(c)){c.labelTarget=i[c.labelTarget],u=i[s.id]=t.createLabel(c),r.push(u);return}c.host&&(c.host=i[c.host]),u=i[s.id]=t.createShape(c),r.push(u)})}),r},kn.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(ui(e,["id"]));return t},kn.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(ui(e,["id"]));return t},kn.prototype.createShape=function(e){var t=this._elementFactory.createShape(ui(e,["id"]));return t},kn.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(at(e)&&(!n.has(e.source)||!n.has(e.target))||ze(e)&&!n.has(e.labelTarget))},kn.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=Ps(e);function s(f,p){return t.allowed("element.copy",{element:f,elements:p})}function c(f,p){var d=o.get(f);if(!d){var g={element:f,depth:p};r.push(g),o.set(f,g);return}if(d.depth<p){r=u(d,r);var h={element:d.element,depth:p};r.push(h),o.set(f,h)}}function u(f,p){var d=p.indexOf(f);return d!==-1&&p.splice(d,1),p}Or(a,function(f,p,d){if(ze(f))return;I(f.labels,function(m){c(m,d)});function g(m){m&&m.length&&I(m,function(_){I(_.labels,function(y){c(y,d)}),c(_,d)})}I([f.attachers,f.incoming,f.outgoing],g),c(f,d);var h=[];return f.children&&(h=f.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:f,children:h}),h}),e=sn(r,function(f){return f.element});var l=new Set(e);return r=sn(r,function(f){return f.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:f.descriptor,element:f.element,elements:e,elementsSet:l}),f}),r=ci(r,function(f){return f.descriptor.priority}),e=sn(r,function(f){return f.element}),I(r,function(f){var p=f.depth;if(!n.hasRelations(f.element,e,l)){jy(f.element,e),l.delete(f.element);return}if(!s(f.element,e)){jy(f.element,e),l.delete(f.element);return}i[p]||(i[p]=[]),i[p].push(f.descriptor)}),i};function LA(e){return!!e.host}function IA(e){return sn(e.waypoints,function(t){return t=Fy(t),t.original&&(t.original=Fy(t.original)),t})}function Fy(e){return z({},e)}function jy(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const BA={__depends__:[nA,mc,va,bi],__init__:["copyPaste"],copyPaste:["type",kn]};function Bp(e,t,n){ke(n)||(n=[n]),I(n,function(i){Rr(e[i])||(t[i]=e[i])})}var Np=750;function Hy(e,t,n){function i(c,u){var l=e.create(c.$type);return n.copyElement(c,l,null,u)}t.on("copyPaste.copyElement",Np,function(c){var u=c.descriptor,l=c.element,f=ie(l);if(ze(l))return u;var p=u.businessObject=i(f,!0),d=u.di=i(Ze(l),!0);d.bpmnElement=p,Bp(p,u,"name"),Bp(d,u,"isExpanded"),f.default&&(u.default=f.default.id)});var r="-bpmn-js-refs";function o(c){return c[r]=c[r]||{}}function a(c,u){c[r]=u}function s(c,u,l){var f=ie(c);return c.default&&(l[c.default]={element:f,property:"default"}),c.host&&(ie(c).attachedToRef=ie(u[c.host])),ui(l,Rn(l,function(p,d,g){var h=d.element,m=d.property;return g===c.id&&(h.set(m,f),p.push(c.id)),p},[]))}t.on("copyPaste.pasteElement",function(c){var u=c.cache,l=c.descriptor,f=l.businessObject,p=l.di;if(ze(l)){l.businessObject=ie(u[l.labelTarget]),l.di=Ze(u[l.labelTarget]);return}f=l.businessObject=i(f),p=l.di=i(p),p.bpmnElement=f,Bp(l,f,["isExpanded","name"]),l.type=f.$type}),t.on("copyPaste.copyElement",Np,function(c){var u=c.descriptor,l=c.element;if(w(l,"bpmn:Participant")){var f=ie(l);f.processRef&&(u.processRef=i(f.processRef,!0))}}),t.on("copyPaste.pasteElement",function(c){var u=c.descriptor,l=u.processRef;l&&(u.processRef=i(l))}),t.on("copyPaste.createTree",function(c){var u=c.element,l=c.children;w(u,"bpmn:SubProcess")&&I(oa(l),f=>{l.push(f.annotation)})}),t.on("copyPaste.pasteElement",Np,function(c){var u=c.cache,l=c.descriptor;a(u,s(l,u,o(u)))})}Hy.$inject=["bpmnFactory","eventBus","moddleCopy"];const NA=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],$A=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function ba(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",i=>{const{propertyNames:r}=i;if(!(!r||!r.length))return ci(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=Ut(r)&&r.$descriptor;if(a&&$A.includes(a))return o;if(a&&NA.includes(a)||a&&s&&!lt(s.properties,eo({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:r}=i;if(w(r,"bpmn:ExtensionElements")&&(!r.values||!r.values.length))return!1})}ba.$inject=["eventBus","bpmnFactory","moddle"],ba.prototype.copyElement=function(e,t,n,i=!1){n&&!ke(n)&&(n=[n]),n=n||$p(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(ke(r)&&(n=r),I(n,o=>{let a;Sn(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!jt(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},ba.prototype.copyProperty=function(e,t,n,i=!1){let r=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n,clone:i});if(r===!1)return;if(r)return Ut(r)&&r.$type&&!r.$parent&&(r.$parent=t),r;const o=this._moddle.getPropertyDescriptor(t,n);if(!o.isReference)return o.isId?e&&this._copyId(e,t,i):ke(e)?Rn(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):Ut(e)&&e.$type?this._moddle.getElementDescriptor(e).isGeneric?void 0:(r=this._bpmnFactory.create(e.$type),r.$parent=t,r=this.copyElement(e,r,null,i),r):e},ba.prototype._copyId=function(e,t,n=!1){if(n)return e;if(!this._moddle.ids.assigned(e))return this._moddle.ids.claim(e,t),e};function $p(e,t){return Rn(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const zy={__depends__:[BA],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",Hy],moddleCopy:["type",ba]};var Gy=Math.round;function Fp(e,t){this._modeling=e,this._eventBus=t}Fp.$inject=["modeling","eventBus"],Fp.prototype.replaceElement=function(e,t,n){if(e.waypoints)return null;var i=this._modeling,r=this._eventBus;r.fire("replace.start",{element:e,attrs:t,hints:n});var o=t.width||e.width,a=t.height||e.height,s=t.x||e.x,c=t.y||e.y,u=Gy(s+o/2),l=Gy(c+a/2),f=i.replaceShape(e,z({},t,{x:u,y:l,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:f,hints:n}),f};function Vy(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}Vy.$inject=["selection","eventBus"];const FA={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Vy],replace:["type",Fp]};function jA(e,t,n){ke(n)||(n=[n]),I(n,function(i){Rr(e[i])||(t[i]=e[i])})}var HA=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function zA(e,t){var n=e&&Sn(e,"collapsed")?e.collapsed:!Ye(e),i;return t&&(Sn(t,"collapsed")||Sn(t,"isExpanded"))?i=Sn(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function Wy(e,t,n,i,r,o){function a(s,c,u){u=u||{};var l=c.type,f=s.businessObject;if(gc(f)&&(l==="bpmn:SubProcess"||l==="bpmn:AdHocSubProcess")&&zA(s,c))return i.toggleCollapse(s),s;var p=e.create(l),d={type:l,businessObject:p};d.di={},l==="bpmn:ExclusiveGateway"&&(d.di.isMarkerVisible=!0),jA(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var g=$p(f.$descriptor),h=$p(p.$descriptor,!0),m=GA(g,h);z(p,ni(c,HA));var _=Ue(m,function(S){return S==="eventDefinitions"?Uy(s,c.eventDefinitionType):S==="loopCharacteristics"?!pn(p):Sn(p,S)||S==="processRef"&&c.isExpanded===!1||S==="triggeredByEvent"?!1:S==="isForCompensation"?!pn(p):!0});if(p=n.copyElement(f,p,_),c.eventDefinitionType&&(Uy(p,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),w(f,"bpmn:Activity")){if(gc(f))d.isExpanded=Ye(s);else if(c&&Sn(c,"isExpanded")){d.isExpanded=c.isExpanded;var y=t.getDefaultSize(p,{isExpanded:d.isExpanded});d.width=y.width,d.height=y.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}Ye(s)&&!w(f,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(gc(f)&&!gc(p)&&(u.moveChildren=!1),w(f,"bpmn:Participant")){c.isExpanded===!0?p.processRef=e.create("bpmn:Process"):u.moveChildren=!1;var x=Kt(s);Ze(s).isHorizontal||(Ze(d).isHorizontal=x),d.width=x?s.width:t.getDefaultSize(d).width,d.height=x?t.getDefaultSize(d).height:s.height}return o.allowed("shape.resize",{shape:p})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),p.name=f.name,We(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&We(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(p.default=f.default),c.host&&!w(f,"bpmn:BoundaryEvent")&&w(p,"bpmn:BoundaryEvent")&&(d.host=c.host),(d.type==="bpmn:DataStoreReference"||d.type==="bpmn:DataObjectReference")&&(d.x=s.x+(s.width-d.width)/2),r.replaceElement(s,d,{...u,targetElement:c})}this.replaceElement=a}Wy.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function gc(e){return w(e,"bpmn:SubProcess")}function Uy(e,t){var n=ie(e);return t&&n.get("eventDefinitions").some(function(i){return w(i,t)})}function GA(e,t){return e.filter(function(n){return t.includes(n)})}const qy={__depends__:[zy,FA,Kn],bpmnReplace:["type",Wy]};var VA=250;function Fr(e){this._eventBus=e,this._tools=[],this._active=null}Fr.$inject=["eventBus"],Fr.prototype.registerTool=function(e,t){var n=this._tools;if(!t)throw new Error(`A tool has to be registered with it's "events"`);n.push(e),this.bindEvents(e,t)},Fr.prototype.isActive=function(e){return e&&this._active===e},Fr.prototype.length=function(e){return this._tools.length},Fr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Fr.prototype.bindEvents=function(e,t){var n=this._eventBus,i=[];n.on(t.tool+".init",function(r){var o=r.context;if(!o.reactivate&&this.isActive(e)){this.setActive(null);return}this.setActive(e)},this),I(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,VA,function(r){this._active&&(WA(r)||this.setActive(null))},this)};function WA(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Mr(t,'.group[data-group="tools"]')}const yc={__depends__:[Bi],__init__:["toolManager"],toolManager:["type",Fr]};function UA(e,t){if(e==="x"){if(t>0)return"e";if(t<0)return"w"}if(e==="y"){if(t>0)return"s";if(t<0)return"n"}return null}function qA(e,t){var n=[],i=new Set(e);I(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,s=o.outgoing;I(a.concat(s),function(c){var u=c.source,l=c.target;(i.has(u)||i.has(l))&&(r.has(c)||(r.add(c),n.push(c)))})}),n}function YA(e,t,n){var i=e.x,r=e.y,o=e.width,a=e.height,s=n.x,c=n.y;switch(t){case"n":return{x:i,y:r+c,width:o,height:a-c};case"s":return{x:i,y:r,width:o,height:a+c};case"w":return{x:i+s,y:r,width:o-s,height:a};case"e":return{x:i,y:r,width:o+s,height:a};default:throw new Error("unknown direction: "+t)}}var jp=Math.abs,KA=Math.round,Ni={x:"width",y:"height"},Yy="crosshair",ur={n:"top",w:"left",s:"bottom",e:"right"},XA=1500,vc={n:"s",w:"e",s:"n",e:"w"},bc=20;function Xn(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",XA,function(c){var u=c.context,l=u.initialized;l||(l=u.initialized=s.init(c,u)),l&&Xy(c)}),n.on("spaceTool.end",function(c){var u=c.context,l=u.axis,f=u.direction,p=u.movingShapes,d=u.resizingShapes,g=u.start;if(u.initialized){Xy(c);var h={x:0,y:0};h[l]=KA(c["d"+l]),s.makeSpace(p,d,h,f,g),n.once("spaceTool.ended",function(m){s.activateSelection(m.originalEvent,!0,!0)})}})}Xn.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Xn.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:Yy,data:{context:{reactivate:n}},trapClick:!1})},Xn.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:Yy,data:{context:{}}})},Xn.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},Xn.prototype.init=function(e,t){var n=jp(e.dx)>jp(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(jp(i)<5)return!1;i<0&&(i*=-1),ma(e)&&(i*=-1);var o=UA(n,i),a=this._canvas.getRootElement();!ac(e)&&e.hover&&(a=e.hover);var s=[...Jo(a),...a.attachers||[]],c=this.calculateAdjustments(s,n,i,r),u=this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:c.resizingShapes,start:r}),l=ZA(c,n,o,r,u);return z(t,c,{axis:n,direction:o,spaceToolConstraints:l,start:r}),hc("resize-"+(n==="x"?"ew":"ns")),!0},Xn.prototype.calculateAdjustments=function(e,t,n,i){var r=this._rules,o=[],a=[],s=new Set,c=new Set,u=[],l=[];function f(d){s.has(d)||(s.add(d),o.push(d));var g=d.label;g&&!s.has(g)&&(s.add(g),o.push(g))}function p(d){c.has(d)||(c.add(d),a.push(d))}return I(e,function(d){if(!(!d.parent||ze(d))){if(at(d)){l.push(d);return}var g=d[t],h=g+d[Ni[t]];if(QA(d)&&(n>0&&Oe(d)[t]>i||n<0&&Oe(d)[t]<i)){u.push(d);return}if(n>0&&g>i||n<0&&h<i){f(d);return}if(g<i&&h>i&&r.allowed("shape.resize",{shape:d})){p(d);return}}}),I(o,function(d){var g=d.attachers;g&&I(g,function(h){f(h)})}),I(u,function(d){var g=d.host;(s.has(g)||c.has(g))&&f(d)}),I(l,function(d){var g=d.source,h=d.target,m=d.label;(s.has(g)||c.has(g))&&(s.has(h)||c.has(h))&&m&&f(m)}),{movingShapes:o,resizingShapes:a}},Xn.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Xn.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function Ky(e){return{top:e.top-bc,right:e.right+bc,bottom:e.bottom+bc,left:e.left-bc}}function Xy(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;Ie(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),Ie(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),Ie(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),Ie(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function ZA(e,t,n,i,r){var o=e.movingShapes,a=e.resizingShapes;if(a.length){var s={},c,u,l=new Set(o),f=new Set(a);return I(a,function(p){var d=p.attachers,g=p.children,h=Te(p),m=Ue(g,function(j){return!at(j)&&!ze(j)&&!l.has(j)&&!f.has(j)}),_=Ue(g,function(j){return!at(j)&&!ze(j)&&l.has(j)}),y,x,S,P=[],C=[],D,T,$,k;m.length&&(x=Ky(Te(kt(m))),y=i-h[ur[n]]+x[ur[n]],n==="n"?s.bottom=u=Ie(u)?Math.min(u,y):y:n==="w"?s.right=u=Ie(u)?Math.min(u,y):y:n==="s"?s.top=c=Ie(c)?Math.max(c,y):y:n==="e"&&(s.left=c=Ie(c)?Math.max(c,y):y)),_.length&&(S=Ky(Te(kt(_))),y=i-S[ur[vc[n]]]+h[ur[vc[n]]],n==="n"?s.bottom=u=Ie(u)?Math.min(u,y):y:n==="w"?s.right=u=Ie(u)?Math.min(u,y):y:n==="s"?s.top=c=Ie(c)?Math.max(c,y):y:n==="e"&&(s.left=c=Ie(c)?Math.max(c,y):y)),d&&d.length&&(d.forEach(function(j){l.has(j)?P.push(j):C.push(j)}),P.length&&(D=Te(kt(P.map(Oe))),T=h[ur[vc[n]]]-(D[ur[vc[n]]]-i)),C.length&&($=Te(kt(C.map(Oe))),k=$[ur[n]]-(h[ur[n]]-i)),n==="n"?(y=Math.min(T||1/0,k||1/0),s.bottom=u=Ie(u)?Math.min(u,y):y):n==="w"?(y=Math.min(T||1/0,k||1/0),s.right=u=Ie(u)?Math.min(u,y):y):n==="s"?(y=Math.max(T||-1/0,k||-1/0),s.top=c=Ie(c)?Math.max(c,y):y):n==="e"&&(y=Math.max(T||-1/0,k||-1/0),s.left=c=Ie(c)?Math.max(c,y):y));var O=r&&r[p.id];O&&(n==="n"?(y=i+p[Ni[t]]-O[Ni[t]],s.bottom=u=Ie(u)?Math.min(u,y):y):n==="w"?(y=i+p[Ni[t]]-O[Ni[t]],s.right=u=Ie(u)?Math.min(u,y):y):n==="s"?(y=i-p[Ni[t]]+O[Ni[t]],s.top=c=Ie(c)?Math.max(c,y):y):n==="e"&&(y=i-p[Ni[t]]+O[Ni[t]],s.left=c=Ie(c)?Math.max(c,y):y))}),s}}function QA(e){return!!e.host}var Hp="djs-dragging",Zy="djs-resizing",JA=250,_c=Math.max;function Qy(e,t,n,i,r){function o(a,s){I(a,function(c){r.addDragger(c,s),n.addMarker(c,Hp)})}e.on("spaceTool.selection.start",function(a){var s=n.getLayer("space"),c=a.context,u={x:"M 0,-10000 L 0,10000",y:"M -10000,0 L 10000,0"},l=Ce("g");ve(l,i.cls("djs-crosshair-group",["no-events"])),Fe(s,l);var f=Ce("path");ve(f,"d",u.x),Xe(f).add("djs-crosshair"),Fe(l,f);var p=Ce("path");ve(p,"d",u.y),Xe(p).add("djs-crosshair"),Fe(l,p),c.crosshairGroup=l}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;nn(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&zt(c)}),e.on("spaceTool.move",JA,function(a){var s=a.context,c=s.line,u=s.axis,l=s.movingShapes,f=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var p=n.getLayer("space");c=Ce("path"),ve(c,"d","M0,0 L0,0"),Xe(c).add("djs-crosshair"),Fe(p,c),s.line=c;var d=Ce("g");ve(d,i.cls("djs-drag-group",["no-events"])),Fe(n.getActiveLayer(),d),o(l,d);var g=new Set(l);I(f,function(C){g.add(C)});var h=new Set,m=s.movingConnections=[];g.forEach(function(C){I(C.outgoing,function(D){h.has(D)||!at(D)||!g.has(D.target)||(h.add(D),m.push(D))})}),o(m,d),s.dragGroup=d}if(!s.frameGroup){var _=Ce("g");ve(_,i.cls("djs-frame-group",["no-events"])),Fe(n.getActiveLayer(),_);var y=[];I(f,function(C){var D=r.addFrame(C,_),T=D.getBBox();y.push({element:D,initialBounds:T}),n.addMarker(C,Zy)}),s.frameGroup=_,s.frames=y}var x={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};ve(c,{d:x[u]});var S={x:"y",y:"x"},P={x:a.dx,y:a.dy};P[S[s.axis]]=0,nn(s.dragGroup,P.x,P.y),I(s.frames,function(C){var D=C.element,T=C.initialBounds,$,k;s.direction==="e"?ve(D,{width:_c(T.width+P.x,5)}):($=_c(T.width-P.x,5),ve(D,{width:$,x:T.x+T.width-$})),s.direction==="s"?ve(D,{height:_c(T.height+P.y,5)}):(k=_c(T.height-P.y,5),ve(D,{height:k,y:T.y+T.height-k}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,u=s.movingConnections,l=s.resizingShapes,f=s.line,p=s.dragGroup,d=s.frameGroup;I(c,function(g){n.removeMarker(g,Hp)}),I(u,function(g){n.removeMarker(g,Hp)}),p&&(zt(f),zt(p)),I(l,function(g){n.removeMarker(g,Zy)}),d&&zt(d)})}Qy.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const eT={__init__:["spaceToolPreview"],__depends__:[Bi,bi,yc,Ao,va],spaceTool:["type",Xn],spaceToolPreview:["type",Qy]};function xc(e,t){e.invoke(Xn,this),this._canvas=t}xc.$inject=["injector","canvas"],ye(xc,Xn),xc.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=Qr(uo(r.children.filter(u=>w(u,"bpmn:Artifact")),kt(o))));const s=[...e,...a];var c=Xn.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(u){return!(w(u,"bpmn:TextAnnotation")||tT(u)&&(t==="y"&&Kt(u)||t==="x"&&!Kt(u)))}),c};function tT(e){return w(e,"bpmn:Participant")&&!ie(e).processRef}const Jy={__depends__:[eT],spaceTool:["type",xc]};function wt(e,t){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[],trigger:null},this._injector=t,this._eventBus=e,this._uid=1,e.on(["diagram.destroy","diagram.clear"],function(){this.clear(!1)},this)}wt.$inject=["eventBus","injector"],wt.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";const n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction()},wt.prototype.canExecute=function(e,t){const n={command:e,context:t},i=this._getHandler(e);let r=this._fire(e,"canExecute",n);if(r===void 0){if(!i)return!1;i.canExecute&&(r=i.canExecute(t))}return r},wt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},wt.prototype.undo=function(){let e=this._getUndoAction(),t;if(e){for(this._currentExecution.trigger="undo",this._pushAction(e);e&&(this._internalUndo(e),t=this._getUndoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},wt.prototype.redo=function(){let e=this._getRedoAction(),t;if(e){for(this._currentExecution.trigger="redo",this._pushAction(e);e&&(this._internalExecute(e,!0),t=this._getRedoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},wt.prototype.register=function(e,t){this._setHandler(e,t)},wt.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");const n=this._injector.instantiate(t);this.register(e,n)},wt.prototype.canUndo=function(){return!!this._getUndoAction()},wt.prototype.canRedo=function(){return!!this._getRedoAction()},wt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},wt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},wt.prototype._internalUndo=function(e){const t=e.command,n=e.context,i=this._getHandler(t);this._atomicDo(()=>{this._fire(t,"revert",e),i.revert&&this._markDirty(i.revert(n)),this._revertedAction(e),this._fire(t,"reverted",e)})},wt.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const i=t?[e+"."+t,t]:[e];let r;n=this._eventBus.createEvent(n);for(const o of i)if(r=this._eventBus.fire("commandStack."+o,n),n.cancelBubble)break;return r},wt.prototype._createId=function(){return this._uid++},wt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},wt.prototype._internalExecute=function(e,t){const n=e.command,i=e.context,r=this._getHandler(n);if(!r)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),r.preExecute&&r.preExecute(i),this._fire(n,"preExecuted",e)),this._atomicDo(()=>{this._fire(n,"execute",e),r.execute&&this._markDirty(r.execute(i)),this._executedAction(e,t),this._fire(n,"executed",e)}),t||(this._fire(n,"postExecute",e),r.postExecute&&r.postExecute(i),this._fire(n,"postExecuted",e)),this._popAction()},wt.prototype._pushAction=function(e){const t=this._currentExecution,n=t.actions,i=n[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=i&&i.id||this._createId()),n.push(e)},wt.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,n=e.actions,i=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:fd("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},wt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=ke(e)?e:[e],t.dirty=t.dirty.concat(e))},wt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},wt.prototype._revertedAction=function(e){this._stackIdx--},wt.prototype._getHandler=function(e){return this._handlerMap[e]},wt.prototype._setHandler=function(e,t){if(!e||!t)throw new Error("command and handler required");if(this._handlerMap[e])throw new Error("overriding handler for command <"+e+">");this._handlerMap[e]=t};const nT={commandStack:["type",wt]};function lr(e,t){if(typeof t!="function")throw new Error("removeFn iterator must be a function");if(!e)return[];for(var n;n=e[0];)t(n);return e}var iT=250,ev=1400;function zp(e,t,n){te.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",ev,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=tv(a),o.validatedShapes=tv(s)}),i&&t.on("shape.move.start",iT,function(r){var o=r.context,a=new Set(o.shapes),s=new Set;for(const c of a)for(const u of c.labels)!u.hidden&&!a.has(u)&&s.add(u),c.labelTarget&&s.add(c);for(const c of s)i.makeDraggable(o,c,!0)}),this.preExecuted("elements.move",ev,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];I(s,function(u){I(u.labels,function(l){s[l.id]||c.push(l)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(r){var o=r.context,a=o.connection||o.shape;lr(a.labels,function(s){n.removeShape(s,{nested:!0})})}),this.execute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.labelTarget;s&&(o.labelTargetIndex=xl(s.labels,a),o.labelTarget=s,a.labelTarget=null)}),this.revert("shape.delete",function(r){var o=r.context,a=o.shape,s=o.labelTarget,c=o.labelTargetIndex;s&&(At(s.labels,a,c),a.labelTarget=s)})}ye(zp,te),zp.$inject=["injector","eventBus","modeling"];function tv(e){var t=new Set(e);return Ue(e,function(n){return!t.has(n.labelTarget)})}const rT={__init__:["labelSupport"],labelSupport:["type",zp]};var oT=251,nv=1401,iv="attach-ok";function Gp(e,t,n,i,r){te.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",nv,function(a){var s=a.context,c=s.shapes,u=s.validatedShapes;s.shapes=aT(c),s.validatedShapes=sT(u)}),o&&t.on("shape.move.start",oT,function(a){var s=a.context,c=s.shapes,u=Vp(c);I(u,function(l){o.makeDraggable(s,l,!0),I(l.labels,function(f){o.makeDraggable(s,f,!0)})})}),o&&t.on("shape.move.start",function(a){var s=a.context,c=s.shapes;if(c.length===1){var u=c[0],l=u.host;l&&(n.addMarker(l,iv),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(l,iv)}))}}),this.preExecuted("elements.move",nv,function(a){var s=a.context,c=s.closure,u=s.shapes,l=Vp(u);I(l,function(f){c.add(f,c.topLevel[f.host.id])})}),this.postExecuted("elements.move",function(a){var s=a.context,c=s.shapes,u=s.newHost,l;u&&c.length!==1||(u?l=c:l=Ue(c,function(f){var p=f.host;return cT(f)&&!uT(c,p)}),I(l,function(f){r.updateAttachment(f,u)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;I(s,function(c){I(c.attachers,function(u){I(u.outgoing.slice(),function(l){var f=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});f||r.removeConnection(l)}),I(u.incoming.slice(),function(l){var f=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});f||r.removeConnection(l)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,u=s.host;u&&r.updateAttachment(c,u)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,u=s.newShape;lr(c.attachers,function(l){var f=i.allowed("elements.move",{target:u,shapes:[l]});f==="attach"?r.updateAttachment(l,u):r.removeShape(l)}),u.attachers.length&&I(u.attachers,function(l){var f=xg(l,c,u);r.moveShape(l,f,l.parent)})}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.oldBounds,l=s.newBounds,f=c.attachers,p=s.hints||{};p.attachSupport!==!1&&I(f,function(d){var g=xg(d,u,l);r.moveShape(d,g,d.parent),I(d.labels,function(h){r.moveShape(h,g,h.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;lr(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}ye(Gp,te),Gp.$inject=["injector","eventBus","canvas","rules","modeling"];function Vp(e){return Ou(sn(e,function(t){return t.attachers||[]}))}function aT(e){var t=Vp(e);return V0("id",e,t)}function sT(e){var t=Jr(e,"id");return Ue(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function cT(e){return!!e.host}function uT(e,t){return e.indexOf(t)!==-1}const lT={__depends__:[bi],__init__:["attachSupport"],attachSupport:["type",Gp]};function rv(e,t,n,i){e.on("element.changed",function(r){var o=r.element;(o.parent||o===t.getRootElement())&&(r.gfx=n.getGraphics(o)),r.gfx&&e.fire(Xh(o)+".changed",r)}),e.on("elements.changed",function(r){var o=r.elements;o.forEach(function(a){e.fire("element.changed",{element:a})}),i.updateContainments(o)}),e.on("shape.changed",function(r){i.update("shape",r.element,r.gfx)}),e.on("connection.changed",function(r){i.update("connection",r.element,r.gfx)})}rv.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const Wp={__init__:["changeSupport"],changeSupport:["type",rv]};function Zn(e){this._model=e}Zn.$inject=["moddle"],Zn.prototype._needsId=function(e){return We(e,["bpmn:RootElement","bpmn:FlowElement","bpmn:MessageFlow","bpmn:DataAssociation","bpmn:Artifact","bpmn:Participant","bpmn:Lane","bpmn:LaneSet","bpmn:Process","bpmn:Collaboration","bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane","bpmn:Property","bpmn:CategoryValue"])},Zn.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;w(e,"bpmn:Activity")?t="Activity":w(e,"bpmn:Event")?t="Event":w(e,"bpmn:Gateway")?t="Gateway":We(e,["bpmn:SequenceFlow","bpmn:MessageFlow"])?t="Flow":t=(e.$type||"").replace(/^[^:]*:/g,""),t+="_",!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e))},Zn.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Zn.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Zn.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",z({bpmnElement:e,bounds:this.createDiBounds()},t))},Zn.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Zn.prototype.createDiWaypoints=function(e){var t=this;return sn(e,function(n){return t.createDiWaypoint(n)})},Zn.prototype.createDiWaypoint=function(e){return this.create("dc:Point",ni(e,["x","y"]))},Zn.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",z({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Zn.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",z({bpmnElement:e},t))};function On(e,t,n){te.call(this,e),this._bpmnFactory=t;var i=this;function r(d){var g=d.context,h=g.hints||{},m;!g.cropped&&h.createElementsBehavior!==!1&&(m=g.connection,m.waypoints=n.getCroppedWaypoints(m),g.cropped=!0)}this.executed(["connection.layout","connection.create"],r),this.reverted(["connection.layout"],function(d){delete d.context.cropped});function o(d){var g=d.context;i.updateParent(g.shape||g.connection,g.oldParent)}function a(d){var g=d.context,h=g.shape||g.connection,m=g.parent||g.newParent;i.updateParent(h,m)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Dn(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Dn(a));function s(d){var g=d.context,h=g.oldRoot,m=h.children;I(m,function(_){w(_,"bpmn:BaseElement")&&i.updateParent(_)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var g=d.context.shape;w(g,"bpmn:BaseElement")&&i.updateBounds(g)}this.executed(["shape.move","shape.create","shape.resize"],Dn(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],Dn(function(d){d.context.shape.type!=="label"&&c(d)})),e.on("shape.changed",function(d){d.element.type==="label"&&c({context:{shape:d.element}})});function u(d){i.updateConnection(d.context)}this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],Dn(u)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],Dn(u));function l(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],Dn(l)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],Dn(l)),this.executed("connection.reconnect",Dn(function(d){var g=d.context,h=g.connection,m=g.oldSource,_=g.newSource,y=ie(h),x=ie(m),S=ie(_);y.conditionExpression&&!We(S,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(g.oldConditionExpression=y.conditionExpression,delete y.conditionExpression),m!==_&&x.default===y&&(g.oldDefault=x.default,delete x.default)})),this.reverted("connection.reconnect",Dn(function(d){var g=d.context,h=g.connection,m=g.oldSource,_=g.newSource,y=ie(h),x=ie(m),S=ie(_);g.oldConditionExpression&&(y.conditionExpression=g.oldConditionExpression),g.oldDefault&&(x.default=g.oldDefault,delete S.default)}));function f(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],Dn(f)),this.reverted(["element.updateAttachment"],Dn(f)),this.executed("element.updateLabel",Dn(p)),this.reverted("element.updateLabel",Dn(p));function p(d){const{element:g}=d.context,h=jn(g),m=Ze(g),_=m&&m.get("label");ir(g)||sc(g)||(h&&!_?m.set("label",t.create("bpmndi:BPMNLabel")):!h&&_&&m.set("label",void 0))}}ye(On,te),On.$inject=["eventBus","bpmnFactory","connectionDocking"],On.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},On.prototype.updateParent=function(e,t){if(!ze(e)&&!(w(e,"bpmn:DataStoreReference")&&e.parent&&w(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=Ze(e),o=n&&n.businessObject,a=Ze(n);w(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),w(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),w(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(i,o),w(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},On.prototype.updateBounds=function(e){var t=Ze(e),n=fT(e);if(n){var i=oi(n,t.get("bounds"));z(n,{x:e.x+i.x,y:e.y+i.y})}var r=ze(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),z(o,{x:e.x,y:e.y,width:e.width,height:e.height})},On.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;w(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),Ct(i,e)),w(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),At(r,e))}},On.prototype.updateDiConnection=function(e,t,n){var i=Ze(e),r=Ze(t),o=Ze(n);i.sourceElement&&i.sourceElement.bpmnElement!==ie(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==ie(n)&&(i.targetElement=n&&o)},On.prototype.updateDiParent=function(e,t){if(t&&!w(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(Ct(n,e),e.$parent=null)}};function pT(e){for(;e&&!w(e,"bpmn:Definitions");)e=e.$parent;return e}On.prototype.getLaneSet=function(e){var t,n;return w(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(w(e,"bpmn:Participant")&&(e=e.processRef),n=e.get("laneSets"),t=n[0],t||(t=this._bpmnFactory.create("bpmn:LaneSet"),t.$parent=e,n.push(t)),t)},On.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((w(e,"bpmn:DataInput")||w(e,"bpmn:DataOutput"))&&(w(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(w(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(w(e,"bpmn:FlowElement")){if(t){if(w(t,"bpmn:Participant"))t=t.processRef;else if(w(t,"bpmn:Lane"))do t=t.$parent.$parent;while(w(t,"bpmn:Lane"))}i="flowElements"}else if(w(e,"bpmn:Artifact")){for(;t&&!w(t,"bpmn:Process")&&!w(t,"bpmn:SubProcess")&&!w(t,"bpmn:Collaboration");)if(w(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(w(e,"bpmn:MessageFlow"))i="messageFlows";else if(w(e,"bpmn:Participant")){i="participants";var r=e.processRef,o;r&&(o=pT(e.$parent||t),e.$parent&&(Ct(o.get("rootElements"),r),r.$parent=null),t&&(At(o.get("rootElements"),r),r.$parent=o))}else w(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":w(e,"bpmn:DataInputAssociation")&&(i="dataInputAssociations");if(!i)throw new Error(`no parent for <${e.id}> in <${t.id}>`);var a;if(e.$parent&&(a=e.$parent.get(i),Ct(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);Ct(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},On.prototype.updateConnectionWaypoints=function(e){var t=Ze(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},On.prototype.updateConnection=function(e){var t=e.connection,n=ie(t),i=t.source,r=ie(i),o=t.target,a=ie(t.target),s;if(w(n,"bpmn:DataAssociation"))w(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=r,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):w(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||r,this.updateSemanticParent(n,r,s),n.targetRef=a);else{var c=w(n,"bpmn:SequenceFlow");n.sourceRef!==r&&(c&&(Ct(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(Ct(n.targetRef&&n.targetRef.get("incoming"),n),a&&a.get("incoming")&&a.get("incoming").push(n)),n.targetRef=a)}this.updateConnectionWaypoints(t),this.updateDiConnection(t,i,o)},On.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function Dn(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;w(i,"bpmn:BaseElement")&&e(t)}}function fT(e){if(w(e,"bpmn:Activity")){var t=Ze(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function pr(e,t){Oi.call(this),this._bpmnFactory=e,this._moddle=t}ye(pr,Oi),pr.$inject=["bpmnFactory","moddle"],pr.prototype._baseCreate=Oi.prototype.create,pr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,z({type:"label",di:n},Lr,t))}return this.createElement(e,t)},pr.prototype.createElement=function(e,t){t=z({},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(!hT(r)){var o=z({},r||{},{id:i.id+"_di"});e==="root"?r=this._bpmnFactory.createDiPlane(i,o):e==="connection"?r=this._bpmnFactory.createDiEdge(i,o):r=this._bpmnFactory.createDiShape(i,o)}w(i,"bpmn:Group")&&(t=z({isFrame:!0},t)),t=dT(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Up(r,t,"isExpanded")),We(i,["bpmn:Lane","bpmn:Participant"])&&(t=Up(r,t,"isHorizontal")),w(i,"bpmn:SubProcess")&&(t.collapsed=!Ye(i,r)),w(i,"bpmn:ExclusiveGateway")&&(Sn(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),jt(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),jt(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=z({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},pr.prototype.getDefaultSize=function(e,t){var n=ie(e);if(t=t||Ze(e),w(n,"bpmn:SubProcess"))return Ye(n,t)?{width:350,height:200}:{width:100,height:80};if(w(n,"bpmn:Task"))return{width:100,height:80};if(w(n,"bpmn:Gateway"))return{width:50,height:50};if(w(n,"bpmn:Event"))return{width:36,height:36};if(w(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return Ye(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return w(n,"bpmn:Lane")?{width:400,height:100}:w(n,"bpmn:DataObjectReference")?{width:36,height:50}:w(n,"bpmn:DataStoreReference")?{width:50,height:50}:w(n,"bpmn:TextAnnotation")?{width:100,height:40}:w(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},pr.prototype.createParticipantShape=function(e){return Ut(e)||(e={isExpanded:e}),e=z({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function dT(e,t,n){return I(n,function(i){t=Up(e,t,i)}),t}function Up(e,t,n){return t[n]===void 0?t:(e[n]=t[n],ui(t,[n]))}function hT(e){return We(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function wc(e,t){this._modeling=e,this._canvas=t}wc.$inject=["modeling","canvas"],wc.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;I(n,function(r){var o={x:0,y:0};jt(i.left)?o.x=i.left-r.x:jt(i.right)?o.x=i.right-r.width-r.x:jt(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:jt(i.top)?o.y=i.top-r.y:jt(i.bottom)?o.y=i.bottom-r.height-r.y:jt(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},wc.prototype.postExecute=function(e){};function Ec(e){this._modeling=e}Ec.$inject=["modeling"],Ec.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,i=e.shape,r=e.hints||{};i=e.shape=this._modeling.createShape(i,e.position,n,{attach:r.attach}),e.shape=i},Ec.prototype.postExecute=function(e){var t=e.hints||{};mT(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 mT(e,t){return Wi(e.outgoing,function(n){return n.target===t})}function Sc(e,t){this._canvas=e,this._layouter=t}Sc.$inject=["canvas","layouter"],Sc.prototype.execute=function(e){var t=e.connection,n=e.source,i=e.target,r=e.parent,o=e.parentIndex,a=e.hints;if(!n||!i)throw new Error("source and target required");if(!r)throw new Error("parent required");return t.source=n,t.target=i,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,a)),this._canvas.addConnection(t,r,o),t},Sc.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var Rc=Math.round;function qp(e){this._modeling=e}qp.$inject=["modeling"],qp.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;I(t,function(f){Ie(f.x)||(f.x=0),Ie(f.y)||(f.y=0)});var s=Ue(t,function(f){return!f.hidden}),c=kt(s);I(t,function(f){at(f)&&(f.waypoints=sn(f.waypoints,function(p){return{x:Rc(p.x-c.x-c.width/2+r.x),y:Rc(p.y-c.y-c.height/2+r.y)}})),z(f,{x:Rc(f.x-c.x-c.width/2+r.x),y:Rc(f.y-c.y-c.height/2+r.y)})});var u=new Set(Ps(t)),l={};I(t,function(f){if(at(f)){l[f.id]=Ie(i)?a.createConnection(l[f.source.id],l[f.target.id],i,f,f.parent||n,o):a.createConnection(l[f.source.id],l[f.target.id],f,f.parent||n,o);return}var p=z({},o);u.has(f)||(p.autoResize=!1),ze(f)&&(p=ui(p,["attach"])),l[f.id]=Ie(i)?a.createShape(f,ni(f,["x","y","width","height"]),f.parent||n,i,p):a.createShape(f,ni(f,["x","y","width","height"]),f.parent||n,p)}),e.elements=Qr(l)};var ov=Math.round;function fr(e){this._canvas=e}fr.$inject=["canvas"],fr.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,r=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?z(t,n):z(t,{x:n.x-ov(t.width/2),y:n.y-ov(t.height/2)}),this._canvas.addShape(t,i,r),t},fr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function _a(e){fr.call(this,e)}ye(_a,fr),_a.$inject=["canvas"];var gT=fr.prototype.execute;_a.prototype.execute=function(e){var t=e.shape;return vT(t),t.labelTarget=e.labelTarget,gT.call(this,e)};var yT=fr.prototype.revert;_a.prototype.revert=function(e){return e.shape.labelTarget=null,yT.call(this,e)};function vT(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function xa(e,t){this._canvas=e,this._modeling=t}xa.$inject=["canvas","modeling"],xa.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;lr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),lr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},xa.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=xl(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},xa.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,At(n.children,t,i),this._canvas.addConnection(t,n),t};function Yp(e,t){this._modeling=e,this._elementRegistry=t}Yp.$inject=["modeling","elementRegistry"],Yp.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;I(i,function(r){n.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};function wa(e,t){this._canvas=e,this._modeling=t}wa.$inject=["canvas","modeling"],wa.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;lr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),lr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),lr(n.children,function(i){at(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},wa.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=xl(i.children,n),t.removeShape(n),n},wa.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return At(i.children,n,r),t.addShape(n,i),n};function Cc(e){this._modeling=e}Cc.$inject=["modeling"];var av={x:"y",y:"x"};Cc.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(m,_){m.range.min=Math.min(_[i],m.range.min),m.range.max=Math.max(_[i]+_[r],m.range.max)}function a(m){return m[i]+m[r]/2}function s(m){return m.length-1}function c(m){return m.max-m.min}function u(m,_){var y={y:0};y[i]=m-a(_),y[i]&&(y[av[i]]=0,t.moveElements([_],y,_.parent))}var l=n[0],f=s(n),p=n[f],d,g,h=0;I(n,function(m,_){var y,x,S;if(m.elements.length<2){_&&_!==n.length-1&&(o(m,m.elements[0]),h+=c(m.range));return}y=ci(m.elements,i),x=y[0],_===f&&(x=y[s(y)]),S=a(x),m.range=null,I(y,function(P){if(u(S,P),m.range===null){m.range={min:P[i],max:P[i]+P[r]};return}o(m,P)}),_&&_!==n.length-1&&(h+=c(m.range))}),g=Math.abs(p.range.min-l.range.max),d=Math.round((g-h)/(n.length-1)),!(d<n.length-1)&&I(n,function(m,_){var y={},x;m===l||m===p||(x=n[_-1],m.range.max=0,I(m.elements,function(S,P){y[av[i]]=0,y[i]=x.range.max-S[i]+d,m.range.min!==S[i]&&(y[i]+=S[i]-m.range.min),y[i]&&t.moveElements([S],y,S.parent),m.range.max=Math.max(S[i]+S[r],P?m.range.max:0)}))})},Cc.prototype.postExecute=function(e){};function Pc(e,t){this._layouter=e,this._canvas=t}Pc.$inject=["layouter","canvas"],Pc.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return z(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Pc.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Kp(){}Kp.prototype.execute=function(e){var t=e.connection,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldParent=o,e.oldParentIndex=Ct(o.children,t),At(i.children,t,r),t.parent=i,I(t.waypoints,function(a){a.x+=n.x,a.y+=n.y,a.original&&(a.original.x+=n.x,a.original.y+=n.y)}),t},Kp.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return Ct(n.children,t),At(i.children,t,r),t.parent=i,I(t.waypoints,function(a){a.x-=o.x,a.y-=o.y,a.original&&(a.original.x-=o.x,a.original.y-=o.y)}),t};function Xp(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Xp.prototype.add=function(e,t){return this.addAll([e],t)},Xp.prototype.addAll=function(e,t){var n=Y1(e,!!t,this);return z(this,n),this};function Ea(e){this._modeling=e}Ea.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},Ea.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,u=e.topLevel,l=!1;r&&r.parent===n&&(l=!0),I(a,function(f){o.moveShape(f,t,u[f.id]&&!l&&n,{recurse:!1,layout:!1})}),I(s,function(f){var p=!!a[f.source.id],d=!!a[f.target.id];c[f.id]&&p&&d?o.moveConnection(f,t,u[f.id]&&!l&&n):o.layoutConnection(f,{connectionStart:p&&ip(f,f.source,t),connectionEnd:d&&rp(f,f.target,t)})})},Ea.prototype.getClosure=function(e){return new Xp().addAll(e,!0)};function Ac(e){this._helper=new Ea(e)}Ac.$inject=["modeling"],Ac.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Ac.prototype.postExecute=function(e){var t=e.hints,n;t&&t.primaryShape&&(n=t.primaryShape,t.oldParent=n.parent),this._helper.moveClosure(e.closure,e.delta,e.newParent,e.newHost,n)};function jr(e){this._modeling=e,this._helper=new Ea(e)}jr.$inject=["modeling"],jr.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=Ct(o.children,t),At(i.children,t,r),z(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},jr.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;i.layout!==!1&&(I(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:rp(o,t,n)})}),I(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:ip(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},jr.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return At(n.children,t,i),z(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},jr.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},jr.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function Sa(e){this._modeling=e}Sa.$inject=["modeling"],Sa.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,i=e.connection,r=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return ke(r)&&(e.oldWaypoints=i.waypoints,i.waypoints=r),t&&(e.oldSource=i.source,i.source=t),n&&(e.oldTarget=i.target,i.target=n),i},Sa.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,i=e.newTarget,r=e.dockingOrPoints,o=e.hints||{},a={};o.connectionStart&&(a.connectionStart=o.connectionStart),o.connectionEnd&&(a.connectionEnd=o.connectionEnd),o.layoutConnection!==!1&&(n&&(!i||o.docking==="source")&&(a.connectionStart=a.connectionStart||sv(ke(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||sv(ke(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},Sa.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,i=e.oldWaypoints,r=e.connection;return t&&(r.source=t),n&&(r.target=n),i&&(r.waypoints=i),r};function sv(e){return e.original||e}function $i(e,t){this._modeling=e,this._rules=t}$i.$inject=["modeling","rules"],$i.prototype.preExecute=function(e){var t=this,n=this._modeling,i=this._rules,r=e.oldShape,o=e.newData,a=e.hints||{},s;function c(g,h,m){return i.allowed("connection.reconnect",{connection:m,source:g,target:h})}var u={x:o.x,y:o.y},l={x:r.x,y:r.y,width:r.width,height:r.height};s=e.newShape=e.newShape||t.createShape(o,u,r.parent,a),r.host&&n.updateAttachment(s,r.host);var f;a.moveChildren!==!1&&(f=r.children.slice(),n.moveElements(f,{x:0,y:0},s,a));var p=r.incoming.slice(),d=r.outgoing.slice();I(p,function(g){var h=g.source,m=c(h,s,g);m&&t.reconnectEnd(g,s,tc(g,s,l),a)}),I(d,function(g){var h=g.target,m=c(s,h,g);m&&t.reconnectStart(g,s,ec(g,s,l),a)})},$i.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},$i.prototype.execute=function(e){},$i.prototype.revert=function(e){},$i.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},$i.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},$i.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function Ra(e){this._modeling=e}Ra.$inject=["modeling"],Ra.prototype.execute=function(e){var t=e.shape,n=e.newBounds,i=e.minBounds;if(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)throw new Error("newBounds must have {x, y, width, height} properties");if(i&&(n.width<i.width||n.height<i.height))throw new Error("width and height cannot be less than minimum height and width");if(!i&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},z(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Ra.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(I(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:tc(o,n,i)})}),I(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:ec(o,n,i)})}))},Ra.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return z(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function dr(e){this._modeling=e}dr.$inject=["modeling"],dr.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,r=e.resizingShapes,o=e.start,a={};this.moveShapes(i,t),I(r,function(s){a[s.id]=_T(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(qA(i,r),t,n,o,i,r,a)},dr.prototype.execute=function(){},dr.prototype.revert=function(){},dr.prototype.moveShapes=function(e,t){var n=this;I(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},dr.prototype.resizeShapes=function(e,t,n){var i=this;I(e,function(r){var o=YA(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},dr.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=new Set(r),u=new Set(o);I(e,function(l){var f=l.source,p=l.target,d=bT(l),g=uv(n),h={},m=c.has(f)||u.has(f),_=c.has(p)||u.has(p);m&&_?(d=sn(d,function(y){return lv(y,i,n)&&(y[g]=y[g]+t[g]),y.original&&lv(y.original,i,n)&&(y.original[g]=y.original[g]+t[g]),y}),s._modeling.updateWaypoints(l,d,{labelBehavior:!1})):(m||_)&&(c.has(f)?h.connectionStart=ip(l,f,t):c.has(p)?h.connectionEnd=rp(l,p,t):u.has(f)?h.connectionStart=ec(l,f,a[f.id]):u.has(p)&&(h.connectionEnd=tc(l,p,a[p.id])),s._modeling.layoutConnection(l,h))})};function cv(e){return z({},e)}function bT(e){return sn(e.waypoints,function(t){return t=cv(t),t.original&&(t.original=cv(t.original)),t})}function uv(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function lv(e,t,n){var i=uv(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function _T(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Tc(e){this._modeling=e}Tc.$inject=["modeling"],Tc.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=pv(n),t.collapsed=!t.collapsed;var i=fv(n,t.collapsed);return[t].concat(i)},Tc.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=dv(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function pv(e){var t={};return I(e,function(n){t[n.id]=n.hidden,n.children&&(t=z({},t,pv(n.children)))}),t}function fv(e,t){var n=[];return I(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(fv(i.children,i.collapsed||t)))}),n}function dv(e,t){var n=[];return I(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(dv(i.children,t)))}),n}function Mc(e){this._modeling=e}Mc.$inject=["modeling"],Mc.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=hv(i,t),mv(n,t),t.host=n,t},Mc.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,hv(n,t),mv(i,t,r),t};function hv(e,t){return Ct(e&&e.attachers,t)}function mv(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),At(i,t,n)}}function Zp(){}Zp.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},Zp.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function st(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}st.$inject=["eventBus","elementFactory","commandStack"],st.prototype.getHandlers=function(){return{"shape.append":Ec,"shape.create":fr,"shape.delete":wa,"shape.move":jr,"shape.resize":Ra,"shape.replace":$i,"shape.toggleCollapse":Tc,spaceTool:dr,"label.create":_a,"connection.create":Sc,"connection.delete":xa,"connection.move":Kp,"connection.layout":Pc,"connection.updateWaypoints":Zp,"connection.reconnect":Sa,"elements.create":qp,"elements.move":Ac,"elements.delete":Yp,"elements.distribute":Cc,"elements.align":wc,"element.updateAttachment":Mc}},st.prototype.registerHandlers=function(e){I(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},st.prototype.moveShape=function(e,t,n,i,r){typeof i=="object"&&(r=i,i=null);var o={shape:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("shape.move",o)},st.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},st.prototype.moveElements=function(e,t,n,i){i=i||{};var r=i.attach,o=n,a;r===!0?(a=n,o=n.parent):r===!1&&(a=null);var s={shapes:e,delta:t,newParent:o,newHost:a,hints:i};this._commandStack.execute("elements.move",s)},st.prototype.moveConnection=function(e,t,n,i,r){typeof i=="object"&&(r=i,i=void 0);var o={connection:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("connection.move",o)},st.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},st.prototype.createConnection=function(e,t,n,i,r,o){typeof n=="object"&&(o=r,r=i,i=n,n=void 0),i=this._create("connection",i);var a={source:e,target:t,parent:r,parentIndex:n,connection:i,hints:o};return this._commandStack.execute("connection.create",a),a.connection},st.prototype.createShape=function(e,t,n,i,r){typeof i!="number"&&(r=i,i=void 0),r=r||{};var o=r.attach,a,s;e=this._create("shape",e),o?(a=n.parent,s=n):a=n;var c={position:t,shape:e,parent:a,parentIndex:i,host:s,hints:r};return this._commandStack.execute("shape.create",c),c.shape},st.prototype.createElements=function(e,t,n,i,r){ke(e)||(e=[e]),typeof i!="number"&&(r=i,i=void 0),r=r||{};var o={position:t,elements:e,parent:n,parentIndex:i,hints:r};return this._commandStack.execute("elements.create",o),o.elements},st.prototype.createLabel=function(e,t,n,i){n=this._create("label",n);var r={labelTarget:e,position:t,parent:i||e.parent,shape:n};return this._commandStack.execute("label.create",r),r.shape},st.prototype.appendShape=function(e,t,n,i,r){r=r||{},t=this._create("shape",t);var o={source:e,position:n,target:i,shape:t,connection:r.connection,connectionParent:r.connectionParent,hints:r};return this._commandStack.execute("shape.append",o),o.shape},st.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},st.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},st.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},st.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},st.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},st.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},st.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},st.prototype.createSpace=function(e,t,n,i,r){var o={delta:n,direction:i,movingShapes:e,resizingShapes:t,start:r};this._commandStack.execute("spaceTool",o)},st.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},st.prototype.reconnect=function(e,t,n,i,r){var o={connection:e,newSource:t,newTarget:n,dockingOrPoints:i,hints:r||{}};this._commandStack.execute("connection.reconnect",o)},st.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,z(i,{docking:"source"}))},st.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,z(i,{docking:"target"}))},st.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},st.prototype._create=function(e,t){return DS(t)?t:this._elementFactory.create(e,t)},st.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function Ca(e){this._elementRegistry=e}Ca.$inject=["elementRegistry"],Ca.prototype.execute=function(e){var t=e.element,n=e.moddleElement,i=e.properties;if(!n)throw new Error("<moddleElement> required");var r=e.changed||this._getVisualReferences(n).concat(t),o=e.oldProperties||xT(n,ts(i));return gv(n,i),e.oldProperties=o,e.changed=r,r},Ca.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return gv(n,t),i},Ca.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return w(e,"bpmn:DataObject")?wT(e,t):[]};function xT(e,t){return Rn(t,function(n,i){return n[i]=e.get(i),n},{})}function gv(e,t){I(t,function(n,i){e.set(i,n)})}function wT(e,t){return t.filter(function(n){return w(n,"bpmn:DataObjectReference")&&ie(n).dataObjectRef===e})}var Pa="default",Fi="id",yv="di",ET={width:0,height:0};function Aa(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}Aa.$inject=["elementRegistry","moddle","modeling","textRenderer"],Aa.prototype.execute=function(e){var t=e.element,n=[t];if(!t)throw new Error("element required");var i=this._elementRegistry,r=this._moddle.ids,o=t.businessObject,a=AT(e.properties),s=e.oldProperties||ST(t,a);return vv(a,o)&&(r.unclaim(o[Fi]),i.updateId(t,a[Fi]),r.claim(a[Fi],o)),Pa in a&&(a[Pa]&&n.push(i.get(a[Pa].id)),o[Pa]&&n.push(i.get(o[Pa].id))),bv(t,a),e.oldProperties=s,e.changed=n,n},Aa.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&ie(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,ET)}},Aa.prototype.revert=function(e){var t=e.element,n=e.properties,i=e.oldProperties,r=t.businessObject,o=this._elementRegistry,a=this._moddle.ids;return bv(t,i),vv(n,r)&&(a.unclaim(n[Fi]),o.updateId(t,i[Fi]),a.claim(i[Fi],r)),e.changed};function vv(e,t){return Fi in e&&e[Fi]!==t[Fi]}function ST(e,t){var n=ts(t),i=e.businessObject,r=Ze(e);return Rn(n,function(o,a){return a!==yv?o[a]=i.get(a):o[a]=RT(r,ts(t.di)),o},{})}function RT(e,t){return Rn(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function bv(e,t){var n=e.businessObject,i=Ze(e);I(t,function(r,o){o!==yv?n.set(o,r):i&&CT(i,r)})}function CT(e,t){I(t,function(n,i){e.set(i,n)})}var PT=["default"];function AT(e){var t=z({},e);return PT.forEach(function(n){n in e&&(t[n]=ie(t[n]))}),t}function kc(e,t){this._canvas=e,this._modeling=t}kc.$inject=["canvas","modeling"],kc.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=Ze(r);return t.setRootElement(n),t.removeRootElement(r),At(a.rootElements,i),i.$parent=a,Ct(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},kc.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=Ze(n);return t.setRootElement(r),t.removeRootElement(n),Ct(a.rootElements,i),i.$parent=null,At(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function Qp(e,t){this._modeling=e,this._spaceTool=t}Qp.$inject=["modeling","spaceTool"],Qp.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=qn(i),a=o===i,s=a?i:i.parent,c=or(s),u=Kt(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+Un,y:i.y,width:i.width-Un,height:i.height}:{x:i.x,y:i.y+Un,width:i.width,height:i.height-Un};n.createShape({type:"bpmn:Lane",isHorizontal:u},l,s)}var f=[];Or(o,function(S){return f.push(S),S.label&&f.push(S.label),S===i?[]:Ue(S.children,function(P){return P!==i})});var p,d,g,h,m;r==="top"?(p=-120,d=i.y,g=d+10,h="n",m="y"):r==="left"?(p=-120,d=i.x,g=d+10,h="w",m="x"):r==="bottom"?(p=120,d=i.y+i.height,g=d-10,h="s",m="y"):r==="right"&&(p=120,d=i.x+i.width,g=d-10,h="e",m="x");var _=t.calculateAdjustments(f,m,p,g),y=u?{x:0,y:p}:{x:p,y:0};t.makeSpace(_.movingShapes,_.resizingShapes,y,h,g);var x=u?{x:i.x+(a?Un:0),y:d-(r==="top"?120:0),width:i.width-(a?Un:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?Un:0),width:120,height:i.height-(a?Un:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:u},x,s)};function Jp(e){this._modeling=e}Jp.$inject=["modeling"],Jp.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=or(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=Kt(n),s=a?n.height:n.width,c=Math.round(s/i),u,l,f,p;for(p=0;p<i;p++)p===i-1?u=s-c*p:u=c,l=a?{x:n.x+Un,y:n.y+p*c,width:n.width-Un,height:u}:{x:n.x+p*c,y:n.y+Un,width:u,height:n.height-Un},p<o?t.resizeShape(r[p],l):(f={type:"bpmn:Lane",isHorizontal:a},t.createShape(f,l,n))};function Ta(e,t){this._modeling=e,this._spaceTool=t}Ta.$inject=["modeling","spaceTool"],Ta.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Ta.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=wC(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},Ta.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=Te(e),r=Te(t),o=Zm(r,i),a=qn(e),s=[],c=[];Or(a,function(g){return s.push(g),(w(g,"bpmn:Lane")||w(g,"bpmn:Participant"))&&c.push(g),g.children});var u,l,f,p,d;(o.bottom||o.top)&&(u=o.bottom||o.top,l=e.y+(o.bottom?e.height:0)+(o.bottom?-10:10),f=o.bottom?"s":"n",p=o.top>0||o.bottom<0?-u:u,d=n.calculateAdjustments(s,"y",p,l),n.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:u},f)),(o.left||o.right)&&(u=o.right||o.left,l=e.x+(o.right?e.width:0)+(o.right?-10:100),f=o.right?"e":"w",p=o.left>0||o.right<0?-u:u,d=n.calculateAdjustments(c,"x",p,l),n.makeSpace(d.movingShapes,d.resizingShapes,{x:u,y:0},f))};var Ma="flowNodeRef",ef="lanes";function Oc(){}Oc.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(l,f){var p=Te(f),d={x:l.x+l.width/2,y:l.y+l.height/2};return d.x>p.left&&d.x<p.right&&d.y>p.top&&d.y<p.bottom}function s(l){n.indexOf(l)===-1&&(o.push(l),n.push(l))}function c(l){var f=qn(l);return r[f.id]||(r[f.id]=Ks(f)),r[f.id]}function u(l){if(!l.parent)return[];var f=c(l);return f.filter(function(p){return a(l,p)}).map(function(p){return p.businessObject})}return t.forEach(function(l){var f=qn(l);if(!(!f||n.indexOf(f)!==-1)){var p=f.children.filter(function(d){return w(d,"bpmn:FlowNode")});p.forEach(s),n.push(f)}}),e.forEach(s),o.forEach(function(l){var f=l.businessObject,p=f.get(ef),d=p.slice(),g=u(l);i.push({flowNode:f,remove:d,add:g})}),t.forEach(function(l){var f=l.businessObject;l.parent||f.get(Ma).forEach(function(p){i.push({flowNode:p,remove:[f],add:[]})})}),i},Oc.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.flowNodeShapes,e.laneShapes)),t.forEach(function(n){var i=n.flowNode,r=i.get(ef);n.remove.forEach(function(o){Ct(r,o),Ct(o.get(Ma),i)}),n.add.forEach(function(o){At(r,o),At(o.get(Ma),i)})}),[]},Oc.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(ef);n.add.forEach(function(o){Ct(r,o),Ct(o.get(Ma),i)}),n.remove.forEach(function(o){At(r,o),At(o.get(Ma),i)})}),[]};var tf="categoryValueRef";function ka(e,t){this._bpmnFactory=e,this._elementRegistry=t}ka.$inject=["bpmnFactory","elementRegistry"],ka.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,r=new Map,o=[],a=new Map;function s(y,x,S){if(x){var P=a.get(y);P||(P={},a.set(y,P)),!(S&&P.present)&&(!S&&P.past||(S?P.present={categoryValue:x,root:nf(y)}:P.past={categoryValue:x}))}}function c(y){r.set(y,ie(y))}function u(){n.filter(function(y){return w(y,"bpmn:FlowElement")&&!ze(y)&&y.parent}).forEach(c)}function l(y){var x=ie(y),S=x.get("categoryValueRef");return S||(S=Um(i,x),o.push(TT(y,S))),S}function f(y){return y.reduce(function(x,S){var P=nf(S),C=x.get(P);return C||(C=[],x.set(P,C)),C.push(S),x},new Map)}e=Array.from(e||[]);var p=f(e);t.length&&u(),e.forEach(c),n.filter(function(y){return w(y,"bpmn:Group")&&!ze(y)&&y.parent}).forEach(function(y){var x=ie(y).get("categoryValueRef");if(!x){var S=nf(y),P=p.get(S)||[],C=uo(P,y),D=Object.keys(C).length>0;D&&(x=l(y))}s(y,x,!0)}),t.forEach(function(y){s(y.groupShape,y.categoryValue,!1)}),o.length&&u();var d=Array.from(r.keys()),g=Array.from(a.values()).reduce(function(y,x){return x.present&&y.add(x.present.categoryValue),x.past&&y.add(x.past.categoryValue),y},new Set),h=new Map,m=f(d);a.forEach(function(y,x){var S=y.present;if(S){var P=m.get(S.root)||[],C=uo(P,x);P.forEach(function(D){if(C[D.id]){var T=h.get(D);T||(T=new Set,h.set(D,T)),T.add(S.categoryValue)}})}});var _=d.reduce(function(y,x){var S=r.get(x),P=S.get(tf),C=new Set(P),D=h.get(x)||new Set,T=Array.from(D).filter(function(k){return!C.has(k)}),$=P.filter(function(k){return g.has(k)&&!D.has(k)});return(T.length||$.length)&&y.push({businessObject:S,categoryValuesToAdd:T,categoryValuesToRemove:$}),y},[]);return{flowElements:_,groups:o}},ka.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),MT(t.groups),OT(t.flowElements),[]},ka.prototype.revert=function(e){var t=e.updates;return DT(t.flowElements),kT(t.groups),[]};function TT(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function MT(e){e.forEach(function(t){ie(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function kT(e){e.forEach(function(t){ie(t.groupShape).categoryValueRef=null})}function OT(e){e.forEach(function(t){var n=t.businessObject,i=n.get(tf);t.categoryValuesToRemove.forEach(function(r){Ct(i,r)}),t.categoryValuesToAdd.forEach(function(r){At(i,r,!0)})})}function DT(e){e.forEach(function(t){var n=t.businessObject,i=n.get(tf);t.categoryValuesToAdd.forEach(function(r){Ct(i,r)}),t.categoryValuesToRemove.forEach(function(r){At(i,r,!0)})})}function nf(e){for(;e.parent;)e=e.parent;return e}function Dc(e){this._moddle=e}Dc.$inject=["moddle"],Dc.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,i=e.element,r=e.claiming;return r?t.claim(n,i):t.unclaim(n),[]},Dc.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,i=e.element,r=e.claiming;return r?t.unclaim(n):t.claim(n,i),[]};var LT={fill:void 0,stroke:void 0};function rf(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(En(t)){var n=IT(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}rf.$inject=["commandStack"],rf.prototype.postExecute=function(e){var t=e.elements,n=e.colors||LT,i=this,r={};"fill"in n&&z(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&z(r,{"border-color":this._normalizeColor(n.stroke)}),I(t,function(o){var a=at(o)?ni(r,["border-color"]):r,s=Ze(o);if(BT(a),ze(o)){if(!s||!w(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:s.label,properties:{color:r["border-color"]}})}else{if(!We(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function IT(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 BT(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var NT={width:0,height:0};function _v(e,t,n){function i(c,u){var l=c.label||c,f=c.labelTarget||c;return pR(l,u),[l,f]}function r(c){var u=c.element,l=u.businessObject,f=c.newLabel;if(!ze(u)&&ir(u)&&!Bs(u)&&!xv(f)){var p=7,d=Pl(u);d={x:d.x,y:d.y+p},e.createLabel(u,d,{id:l.id+"_label",businessObject:l,di:u.di})}}function o(c){return c.oldLabel=jn(c.element),i(c.element,c.newLabel)}function a(c){return i(c.element,c.oldLabel)}function s(c){var u=c.element,l=u.label||u,f=c.newLabel,p=c.newBounds,d=c.hints||{};if(!(!ze(l)&&!w(l,"bpmn:TextAnnotation"))){if(ze(l)&&xv(f)){d.removeShape!==!1&&e.removeShape(l,{unsetLabel:!1});return}var g=jn(u);typeof p>"u"&&(p=t.getExternalLabelBounds(l,g)),p&&e.resizeShape(l,p,NT)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}_v.$inject=["modeling","textRenderer","bpmnFactory"];function xv(e){return!e||!e.trim()}function on(e,t,n,i){st.call(this,e,t,n),this._bpmnRules=i}ye(on,st),on.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],on.prototype.getHandlers=function(){var e=st.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=Ca,e["element.updateProperties"]=Aa,e["canvas.updateRoot"]=kc,e["lane.add"]=Qp,e["lane.resize"]=Ta,e["lane.split"]=Jp,e["lane.updateRefs"]=Oc,e["group.updateRefs"]=ka,e["id.updateClaim"]=Dc,e["element.setColor"]=rf,e["element.updateLabel"]=_v,e},on.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},on.prototype.connect=function(e,t,n,i){var r=this._bpmnRules;if(n||(n=r.canConnect(e,t)),!!n)return this.createConnection(e,t,n,e.parent,i)},on.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},on.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},on.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},on.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},on.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},on.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},on.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},on.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},on.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},on.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},on.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},on.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function wv(){}wv.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||Oe(t.source||e.source),t.connectionEnd||Oe(t.target||e.target)]};var Lc=20,$T=5,Ic=Math.round,Ev=20,FT={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function jT(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function HT(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function Sv(e,t,n){var i=tn(t,e,$T),r=n.split(":")[0],o=Ic((t.x-e.x)/2+e.x),a=Ic((t.y-e.y)/2+e.y),s,c,u=HT(r,i),l=/h|r|l/.test(r),f=!1,p=!1;return u?(s=l?{x:o,y:e.y}:{x:e.x,y:a},c=l?"h:h":"v:v"):(f=jT(i,r),c=l?"h:v":"v:h",f?l?(p=a===e.y,s={x:e.x+Lc*(/l/.test(r)?-1:1),y:p?a+Lc:a}):(p=o===e.x,s={x:p?o+Lc:o,y:e.y+Lc*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:of(e,s,c).concat(s),directions:c,turnNextDirections:p}}function zT(e,t,n){return Sv(e,t,n)}function GT(e,t,n){var i=Sv(t,e,Rv(n));return{waypoints:i.waypoints.slice().reverse(),directions:Rv(i.directions),turnNextDirections:i.turnNextDirections}}function VT(e,t){var n=e.directions.split(":")[1],i=t.directions.split(":")[0];e.turnNextDirections&&(n=n=="h"?"v":"h"),t.turnNextDirections&&(i=i=="h"?"v":"h");var r=n+":"+i,o=of(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function Rv(e){return e.split(":").reverse().join(":")}function WT(e,t,n){var i=Ic((t.x-e.x)/2+e.x),r=Ic((t.y-e.y)/2+e.y);if(n==="h:v")return[{x:t.x,y:e.y}];if(n==="v:h")return[{x:e.x,y:t.y}];if(n==="h:h")return[{x:i,y:e.y},{x:i,y:t.y}];if(n==="v:v")return[{x:e.x,y:r},{x:t.x,y:r}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}function of(e,t,n){if(n=n||"h:h",!eM(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Pv(n)){var i=zT(e,t,n),r=GT(e,t,n),o=VT(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return WT(e,t,n)}function UT(e,t,n){var i=of(e,t,n);return i.unshift(e),i.push(t),Tv(i)}function qT(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=z0(o,"straight")[0]||"h:h",s=FT[a]||0,c=tn(e,t,s),u=JT(c,a);n=n||Oe(e),i=i||Oe(t);var l=u.split(":"),f=Av(n,e,l[0],tM(c)),p=Av(i,t,l[1],c);return UT(f,p,u)}function YT(e,t,n,i,r,o){ke(n)&&(r=n,o=i,n=Oe(e),i=Oe(t)),o=z({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&XT(e,t,n,i,o),c||(c=o.connectionEnd&&QT(t,e,i,r),c)||(c=o.connectionStart&&ZT(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:qT(e,t,n,i,o)}function KT(e,t,n){return e>=t&&e<=n}function Cv(e,t,n){var i={x:"width",y:"height"};return KT(t[e],n[e],n[e]+n[i[e]])}function XT(e,t,n,i,r){var o={},a,s;return s=tn(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?Cv(a,i,e)?(o[a]=i[a],[{x:o.x!==void 0?o.x:n.x,y:o.y!==void 0?o.y:n.y,original:{x:o.x!==void 0?o.x:n.x,y:o.y!==void 0?o.y:n.y}},{x:i.x,y:i.y}]):null:Cv(a,n,t)?(o[a]=n[a],[{x:n.x,y:n.y},{x:o.x!==void 0?o.x:i.x,y:o.y!==void 0?o.y:i.y,original:{x:o.x!==void 0?o.x:i.x,y:o.y!==void 0?o.y:i.y}}]):null):null}function ZT(e,t,n,i){return af(e,t,n,i)}function QT(e,t,n,i){var r=i.slice().reverse();return r=af(e,t,n,r),r?r.reverse():null}function af(e,t,n,i){function r(l){return l.length<3?!0:l.length>4?!1:!!lt(l,function(f,p){var d=l[p-1];return d&&ta(f,d)<3})}function o(l,f,p){var d=Mi(f,l);switch(d){case"v":return{x:p.x,y:l.y};case"h":return{x:l.x,y:p.y}}return{x:l.x,y:l.y}}function a(l,f,p){var d;for(d=l.length-2;d!==0;d--)if(Qh(l[d],f,Ev)||Qh(l[d],p,Ev))return l.slice(d);return l}if(r(i))return null;var s=i[0],c=i.slice(),u;return c[0]=n,c[1]=o(c[1],s,n),u=a(c,e,t),u!==c&&(c=af(e,t,n,u)),c&&Mi(c)?null:c}function JT(e,t){if(Pv(t))return t;switch(e){case"intersect":return"t:t";case"top":case"bottom":return"v:v";case"left":case"right":return"h:h";default:return t}}function eM(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Pv(e){return e&&/t|r|b|l/.test(e)}function tM(e){return{top:"bottom",bottom:"top",left:"right",right:"left","top-left":"bottom-right","bottom-right":"top-left","top-right":"bottom-left","bottom-left":"top-right"}[e]}function Av(e,t,n,i){if(n==="h"&&(n=/left/.test(i)?"l":"r"),n==="v"&&(n=/top/.test(i)?"t":"b"),n==="t")return{original:e,x:e.x,y:t.y};if(n==="r")return{original:e,x:t.x+t.width,y:e.y};if(n==="b")return{original:e,x:e.x,y:t.y+t.height};if(n==="l")return{original:e,x:t.x,y:e.y};throw new Error("unexpected dockingDirection: <"+n+">")}function Tv(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return wl(r,o,n,0)||t.push(n),t},[])}var nM=-10,iM=40,rM={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},oM={default:["v:v"],fromGateway:["h:v"],toGateway:["v:h"],loop:{fromTop:["t:l"],fromRight:["r:t"],fromLeft:["l:b"],fromBottom:["b:r"]},boundaryLoop:{alternateHorizontalSide:"t",alternateVerticalSide:"r",default:"h"},messageFlow:["straight","h:h"],subProcess:["straight","v:v"],isHorizontal:!1},sf={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Oa={top:"t",right:"r",bottom:"b",left:"l"};function Bc(e){this._elementRegistry=e}ye(Bc,wv),Bc.prototype.layoutConnection=function(e,t){t||(t={});var n=t.source||e.source,i=t.target||e.target,r=t.waypoints||e.waypoints,o=t.connectionStart,a=t.connectionEnd,s=this._elementRegistry,c,u;if(o||(o=Mv(r&&r[0],n)),a||(a=Mv(r&&r[r.length-1],i)),(w(e,"bpmn:Association")||w(e,"bpmn:DataAssociation"))&&r&&!kv(n,i))return[].concat([o],r.slice(1,-1),[a]);var l=zm(n,s)?rM:oM;return w(e,"bpmn:MessageFlow")?c=sM(n,i,l):(w(e,"bpmn:SequenceFlow")||kv(n,i))&&(n===i?c={preferredLayouts:dM(n,e,l)}:w(n,"bpmn:BoundaryEvent")?c={preferredLayouts:hM(n,i,a,l)}:Da(n)||Da(i)?c={preferredLayouts:l.subProcess,preserveDocking:uM(n)}:w(n,"bpmn:Gateway")?c={preferredLayouts:l.fromGateway}:w(i,"bpmn:Gateway")?c={preferredLayouts:l.toGateway}:c={preferredLayouts:l.default}),c&&(c=z(c,t),u=Tv(YT(n,i,o,a,r,c))),u||[o,a]};function aM(e){var t=e.host;return tn(Oe(e),t,nM)}function sM(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:cM(e,t)}}function cM(e,t){return w(t,"bpmn:Participant")?"source":w(e,"bpmn:Participant")?"target":Da(t)?"source":Da(e)||w(t,"bpmn:Event")?"target":w(e,"bpmn:Event")?"source":null}function uM(e){return Da(e)?"target":"source"}function Mv(e,t){return e?e.original||e:Oe(t)}function kv(e,t){return w(t,"bpmn:Activity")&&w(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Da(e){return w(e,"bpmn:SubProcess")&&Ye(e)}function Hr(e,t){return e===t}function lM(e,t){return t.indexOf(e)!==-1}function To(e){var t=/right|left/.exec(e);return t&&t[0]}function Mo(e){var t=/top|bottom/.exec(e);return t&&t[0]}function Ov(e,t){return sf[e]===t}function pM(e,t){var n=To(e),i=sf[n];return t.indexOf(i)!==-1}function fM(e,t){var n=Mo(e),i=sf[n];return t.indexOf(i)!==-1}function Dv(e){return e==="right"||e==="left"}function dM(e,t,n){var i=t.waypoints,r=i&&i.length&&tn(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function hM(e,t,n,i){var r=Oe(e),o=Oe(t),a=aM(e),s,c,u=Hr(e.host,t),l=lM(a,["top","right","bottom","left"]),f=tn(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?mM(a,l,e,t,n,i):(s=gM(a,f,l,i.isHorizontal),c=yM(a,f,l,i.isHorizontal),[s+":"+c])}function mM(e,t,n,i,r,o){var a=t?e:o.isHorizontal?Mo(e):To(e),s=Oa[a],c;return t?Dv(e)?c=Lv("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=Lv("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function Lv(e,t,n,i){var r=iM;return!(cf(e,i,n,r)||cf(e,i,{x:n.x+n.width,y:n.y+n.height},r)||cf(e,i,Oe(t),r))}function cf(e,t,n,i){return Math.abs(t[e]-n[e])<i}function gM(e,t,n,i){if(n)return Oa[e];var r=Mo(e),o=To(e),a=Mo(t),s=To(t);if(i){if(Hr(r,a)||Ov(o,s))return Oa[r]}else if(Hr(o,s)||Ov(r,a))return Oa[o];return Oa[i?o:r]}function yM(e,t,n,i){if(n)return Dv(e)?pM(e,t)||Hr(e,t)?"h":"v":fM(e,t)||Hr(e,t)?"v":"h";var r=Mo(e),o=To(e),a=Mo(t),s=To(t);return a&&!s?"v":s&&!a?"h":i?Hr(r,a)?"h":"v":Hr(o,s)?"v":"h"}Bc.$inject=["elementRegistry"];function Iv(e){return z({original:e.point.original||e.point},e.actual)}function hr(e,t){this._elementRegistry=e,this._graphicsFactory=t}hr.$inject=["elementRegistry","graphicsFactory"],hr.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),r=this.getDockingPoint(e,n),o=e.waypoints.slice(i.idx+1,r.idx);return o.unshift(Iv(i)),o.push(Iv(r)),o},hr.prototype.getDockingPoint=function(e,t,n){var i=e.waypoints,r,o,a;return r=n?0:i.length-1,o=i[r],a=this._getIntersection(t,e,n),{point:o,actual:a||o,idx:r}},hr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return na(i,r,n)},hr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},hr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},hr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const uf={__init__:["modeling","bpmnUpdater"],__depends__:[BP,QP,eA,tA,qy,nT,rT,lT,Kn,Wp,Jy],bpmnFactory:["type",Zn],bpmnUpdater:["type",On],elementFactory:["type",pr],modeling:["type",on],layouter:["type",Bc],connectionDocking:["type",hr]};var vM=10,Bv=50,bM=250;function lf(e,t,n,i){for(var r;r=_M(e,n,t);)n=i(t,n,r);return n}function pf(e){return function(t,n,i){var r={x:n.x,y:n.y};return["x","y"].forEach(function(o){var a=e[o];if(a){var s=o==="x"?"width":"height",c=a.margin,u=a.minDistance;c<0?r[o]=Math.min(i[o]+c-t[s]/2,n[o]-u+c):r[o]=Math.max(i[o]+i[s]+c+t[s]/2,n[o]+u+c)}}),r}}function _M(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=wM(e);return lt(r,function(o){if(o===n)return!1;var a=tn(o,i,vM);return a==="intersect"})}function xM(e,t){t||(t={});function n(g){return g.source===e?1:-1}var i=t.defaultDistance||Bv,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||bM,c=t.reference||"start";o||(o=RM);function u(g,h){return r==="n"?c==="start"?Te(g).top-Te(h).bottom:c==="center"?Te(g).top-Oe(h).y:Te(g).top-Te(h).top:r==="w"?c==="start"?Te(g).left-Te(h).right:c==="center"?Te(g).left-Oe(h).x:Te(g).left-Te(h).left:r==="s"?c==="start"?Te(h).top-Te(g).bottom:c==="center"?Oe(h).y-Te(g).bottom:Te(h).bottom-Te(g).bottom:c==="start"?Te(h).left-Te(g).right:c==="center"?Oe(h).x-Te(g).right:Te(h).right-Te(g).right}var l=e.incoming.filter(o).map(function(g){var h=a(g),m=h<0?u(g.source,e):u(e,g.source);return{id:g.source.id,distance:m,weight:h}}),f=e.outgoing.filter(o).map(function(g){var h=a(g),m=h>0?u(e,g.target):u(g.target,e);return{id:g.target.id,distance:m,weight:h}}),p=l.concat(f).reduce(function(g,h){return g[h.id+"__weight_"+h.weight]=h,g},{}),d=Rn(p,function(g,h){var m=h.distance,_=h.weight;return m<0||m>s||(g[String(m)]||(g[String(m)]=0),g[String(m)]+=1*_,(!g.distance||g[g.distance]<g[String(m)])&&(g.distance=m)),g},{});return d.distance||i}function wM(e){var t=ff(e);return e.host&&(t=t.concat(ff(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(ff(i))},[]))),t}function ff(e){return SM(e).concat(EM(e))}function EM(e){return e.incoming.map(function(t){return t.source})}function SM(e){return e.outgoing.map(function(t){return t.target})}function RM(){return!0}var CM=100;function Nv(e,t,n){e.on("autoPlace",CM,function(i){var r=i.shape,o=i.source;return PM(o,r)}),e.on("autoPlace.end",function(i){n.scrollToElement(i.shape)}),this.append=function(i,r,o){e.fire("autoPlace.start",{source:i,shape:r});var a=e.fire("autoPlace",{source:i,shape:r}),s=t.appendShape(i,r,a,i.parent,o);return e.fire("autoPlace.end",{source:i,shape:s}),s}}Nv.$inject=["eventBus","modeling","canvas"];function PM(e,t,n){n||(n={});var i=n.defaultDistance||Bv,r=Oe(e),o=Te(e);return{x:o.right+i+t.width/2,y:r.y}}function $v(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}$v.$inject=["eventBus","selection"];const AM={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",Nv],autoPlaceSelectionBehavior:["type",$v]};function Fv(e,t,n){var i=zm(e,n);if(w(t,"bpmn:TextAnnotation"))return MM(e,t,i);if(We(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return kM(e,t,i);if(w(t,"bpmn:FlowNode"))return TM(e,t,i)}function TM(e,t,n){var i=Te(e),r=Oe(e),o=n?{directionHint:"e",minDistance:80,baseOrientation:"left",boundaryOrientation:"top",start:"top",end:"bottom"}:{directionHint:"s",minDistance:90,baseOrientation:"top",boundaryOrientation:"left",start:"left",end:"right"},a=xM(e,{filter:function(d){return w(d,"bpmn:SequenceFlow")},direction:o.directionHint}),s=30,c=o.minDistance,u=o.baseOrientation;w(e,"bpmn:BoundaryEvent")&&(u=tn(e,e.host,-25),u.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var l=n?{x:i.right+a+t.width/2,y:r.y+jv(u,c,o)}:{x:r.x+jv(u,c,o),y:i.bottom+a+t.height/2},f={margin:s,minDistance:c},p=n?{y:f}:{x:f};return lf(e,t,l,pf(p))}function jv(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function MM(e,t,n){var i=Te(e),r=n?{x:i.right+t.width/2,y:i.top-50-t.height/2}:{x:i.right+50+t.width/2,y:i.bottom+t.height/2};at(e)&&(r=Oe(e),n?(r.x+=100,r.y-=50):(r.x+=100,r.y+=50));var o={margin:n?-30:30,minDistance:20},a=n?{y:o}:{x:o};return lf(e,t,r,pf(a))}function kM(e,t,n){var i=Te(e),r=n?{x:i.right-10+t.width/2,y:i.bottom+40+t.width/2}:{x:i.left-40-t.width/2,y:i.bottom-10+t.height/2},o={margin:30,minDistance:30},a=n?{x:o}:{y:o};return lf(e,t,r,pf(a))}function Hv(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return Fv(r,i,t)})}Hv.$inject=["eventBus","elementRegistry"];const Nc={__depends__:[AM],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",Hv]},zv=[jm,ca,uf,Nc];function OM(e={}){Ld(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new fo({container:t,moddleExtensions:e.moddleExtensions??cs,additionalModules:[...zv,...e.additionalModules??[]]})}var DM=new Po("ov"),LM=500;function Zt(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=DM,this._overlayDefaults=z({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=IM(n.getContainer()),this._init()}Zt.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Zt.prototype.get=function(e){if(En(e)&&(e={id:e}),En(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?Ue(t.overlays,eo({type:e.type})):t.overlays.slice():[]}else return e.type?Ue(this._overlays,eo({type:e.type})):e.id?this._overlays[e.id]:null},Zt.prototype.add=function(e,t,n){if(Ut(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=z({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},Zt.prototype.remove=function(e){var t=this.get(e)||[];ke(t)||(t=[t]);var n=this;I(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(di(i.html),di(i.htmlContainer),delete i.htmlContainer,delete i.element,delete n._overlays[i.id]),r){var o=r.overlays.indexOf(i);o!==-1&&r.overlays.splice(o,1)}})},Zt.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Zt.prototype.show=function(){$c(this._overlayRoot)},Zt.prototype.hide=function(){$c(this._overlayRoot,!1)},Zt.prototype.clear=function(){this._overlays={},this._overlayContainers=[],xs(this._overlayRoot)},Zt.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=kt(t);i=o.x,r=o.y}Gv(n,i,r),un(e.html,"data-container-id",t.id)},Zt.prototype._updateOverlay=function(e){var t=e.position,n=e.htmlContainer,i=e.element,r=t.left,o=t.top;if(t.right!==void 0){var a;i.waypoints?a=kt(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=kt(i).height:s=i.height,o=t.bottom*-1+s}Gv(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Zt.prototype._createOverlayContainer=function(e){var t=mt('<div class="djs-overlays" />');mn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},Zt.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";Vv(this._overlayRoot,n)},Zt.prototype._getOverlayContainer=function(e,t){var n=lt(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},Zt.prototype._addOverlay=function(e){var t=e.id,n=e.element,i=e.html,r,o;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),En(i)&&(i=mt(i)),o=this._getOverlayContainer(n),r=mt('<div class="djs-overlay" data-overlay-id="'+t+'">'),mn(r,{position:"absolute"}),r.appendChild(i),e.type&&_t(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();$c(r,a===s),e.htmlContainer=r,o.overlays.push(e),o.html.appendChild(r),this._overlays[t]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Zt.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&&(jt(r)&&r>t.scale||jt(o)&&o<t.scale))&&(c=!1),$c(a,c),this._updateOverlayScale(e,t)},Zt.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),jt(i)&&t.scale<i&&(a=(1/t.scale||1)*i),jt(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),jt(a)&&(s="scale("+a+","+a+")"),Vv(o,s)},Zt.prototype._updateOverlaysVisibilty=function(e){var t=this;I(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},Zt.prototype._init=function(){var e=this._eventBus,t=this;function n(i){t._updateRoot(i),t._updateOverlaysVisibilty(i),t.show()}e.on("canvas.viewbox.changing",function(i){t.hide()}),e.on("canvas.viewbox.changed",function(i){n(i.viewbox)}),e.on(["shape.remove","connection.remove"],function(i){var r=i.element,o=t.get({element:r});I(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){di(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",LM,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&(I(o.overlays,function(a){t._updateOverlay(a)}),t._updateOverlayContainer(o))}),e.on("element.marker.update",function(i){var r=t._getOverlayContainer(i.element,!0);r&&_t(r.html)[i.add?"add":"remove"](i.marker)}),e.on("root.set",function(){t._updateOverlaysVisibilty(t._canvas.viewbox())}),e.on("diagram.clear",this.clear,this)};function IM(e){var t=mt('<div class="djs-overlay-container" />');return mn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function Gv(e,t,n){mn(e,{left:t+"px",top:n+"px"})}function $c(e,t){e.style.display=t===!1?"none":""}function Vv(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Fc={__init__:["overlays"],overlays:["type",Zt]};function df(e,t){t.invoke(te,this),this.executed(function(n){var i=n.context;i.rootElement?e.setRootElement(i.rootElement):i.rootElement=e.getRootElement()}),this.revert(function(n){var i=n.context;i.rootElement&&e.setRootElement(i.rootElement)})}ye(df,te),df.$inject=["canvas","injector"];const BM={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",df]};function La(e){return CSS.escape(e)}var NM={"&":"&","<":"<",">":">",'"':""","'":"'"};function Wv(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return NM[t]})}var $M="bjs-breadcrumbs-shown";function Uv(e,t,n){var i=mt('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=_t(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var u=c.element,l=ie(u),f=lt(a,function(p){return p===l});f&&s()});function s(c){c&&(a=FM(c));var u=a.flatMap(function(f){var p=n.findRoot(vi(f))||n.findRoot(f.id);if(!p&&w(f,"bpmn:Process")){var d=t.find(function(m){var _=ie(m);return _&&_.get("processRef")===f});p=d&&n.findRoot(d.id)}if(!p)return[];var g=Wv(f.name||f.id),h=mt('<li><span class="bjs-crumb"><a title="'+g+'">'+g+"</a></span></li>");return h.addEventListener("click",function(){n.setRootElement(p)}),h});i.innerHTML="";var l=u.length>1;o.toggle($M,l),u.forEach(function(f){i.appendChild(f)})}e.on("root.set",function(c){s(c.element)})}Uv.$inject=["eventBus","elementRegistry","canvas"];function FM(e){for(var t=ie(e),n=[],i=t;i;i=i.$parent)(w(i,"bpmn:SubProcess")||w(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function qv(e,t){var n=null,i=new jM;e.on("root.set",function(r){var o=r.element,a=t.viewbox(),s=i.get(o);if(i.set(n,{x:a.x,y:a.y,zoom:a.scale}),n=o,!(!w(o,"bpmn:SubProcess")&&!s)){s=s||{x:0,y:0,zoom:1};var c=(a.x-s.x)*a.scale,u=(a.y-s.y)*a.scale;(c!==0||u!==0)&&t.scroll({dx:c,dy:u}),s.zoom!==a.scale&&t.zoom(s.zoom,{x:0,y:0})}}),e.on("diagram.clear",function(){i.clear(),n=null})}qv.$inject=["eventBus","canvas"];function jM(){this._entries=[],this.set=function(e,t){var n=!1;for(var i in this._entries)if(this._entries[i][0]===e){this._entries[i][1]=t,n=!0;break}n||this._entries.push([e,t])},this.get=function(e){for(var t in this._entries)if(this._entries[t][0]===e)return this._entries[t][1];return null},this.clear=function(){this._entries.length=0},this.remove=function(e){var t=-1;for(var n in this._entries)if(this._entries[n][0]===e){t=n;break}t!==-1&&this._entries.splice(t,1)}}var Yv={x:180,y:160};function zr(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}zr.prototype._handleImport=function(e){if(e.diagrams){var t=this;this._definitions=e,this._processToDiagramMap={},e.diagrams.forEach(function(i){!i.plane||!i.plane.bpmnElement||(t._processToDiagramMap[i.plane.bpmnElement.id]=i)});var n=e.diagrams.filter(i=>i.plane).flatMap(i=>t._createNewDiagrams(i.plane));n.forEach(function(i){t._movePlaneElementsToOrigin(i.plane)})}},zr.prototype._createNewDiagrams=function(e){var t=this,n=[],i=[];e.get("planeElement").forEach(function(o){var a=o.bpmnElement;if(a){var s=a.$parent;w(a,"bpmn:SubProcess")&&!o.isExpanded&&n.push(a),zM(a,e)&&i.push({diElement:o,parent:s})}});var r=[];return n.forEach(function(o){if(!t._processToDiagramMap[o.id]){var a=t._createDiagram(o);t._processToDiagramMap[o.id]=a,r.push(a)}}),i.forEach(function(o){for(var a=o.diElement,s=o.parent;s&&n.indexOf(s)===-1;)s=s.$parent;if(s){var c=t._processToDiagramMap[s.id];t._moveToDiPlane(a,c.plane)}}),r},zr.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=HM(e),i={x:n.x-Yv.x,y:n.y-Yv.y};t.forEach(function(r){r.waypoint?r.waypoint.forEach(function(o){o.x=o.x-i.x,o.y=o.y-i.y}):r.bounds&&(r.bounds.x=r.bounds.x-i.x,r.bounds.y=r.bounds.y-i.y)})},zr.prototype._moveToDiPlane=function(e,t){var n=Kv(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},zr.prototype._createDiagram=function(e){var t=this._moddle.create("bpmndi:BPMNPlane",{bpmnElement:e}),n=this._moddle.create("bpmndi:BPMNDiagram",{plane:t});return t.$parent=n,t.bpmnElement=e,n.$parent=this._definitions,this._definitions.diagrams.push(n),n},zr.$inject=["eventBus","moddle"];function Kv(e){return w(e,"bpmndi:BPMNDiagram")?e:Kv(e.$parent)}function HM(e){var t={top:1/0,right:-1/0,bottom:-1/0,left:1/0};return e.planeElement.forEach(function(n){if(n.bounds){var i=Te(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),Ms(t)}function zM(e,t){var n=e.$parent;return!(!w(n,"bpmn:SubProcess")||n===t.bpmnElement||We(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var jc=250,GM='<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>',VM="bjs-drilldown-empty";function mr(e,t,n,i,r){te.call(this,t),this._canvas=e,this._eventBus=t,this._elementRegistry=n,this._overlays=i,this._translate=r;var o=this;this.executed("shape.toggleCollapse",jc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",jc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],jc,function(a){var s=a.oldParent,c=a.newParent||a.parent,u=a.shape;o._canDrillDown(u)&&o._addOverlay(u),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(u)},!0),this.reverted(["shape.create","shape.move","shape.delete"],jc,function(a){var s=a.oldParent,c=a.newParent||a.parent,u=a.shape;o._canDrillDown(u)&&o._addOverlay(u),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(u)},!0),t.on("import.render.complete",function(){n.filter(function(a){return o._canDrillDown(a)}).map(function(a){o._addOverlay(a)})})}ye(mr,te),mr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},mr.prototype._canDrillDown=function(e){var t=this._canvas;return w(e,"bpmn:SubProcess")&&t.findRoot(vi(e))},mr.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=ie(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;_t(i.html).toggle(VM,!r)}},mr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=ie(e),r=n.get({element:e,type:"drilldown"});r.length&&this._removeOverlay(e);var o=mt('<button type="button" class="bjs-drilldown">'+GM+"</button>"),a=i.get("name")||i.get("id"),s=this._translate("Open {element}",{element:a});o.setAttribute("title",s),o.addEventListener("click",function(){t.setRootElement(t.findRoot(vi(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},mr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},mr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const WM={__depends__:[Fc,Wp,BM],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",Uv],drilldownCentering:["type",qv],drilldownOverlayBehavior:["type",mr],subprocessCompatibility:["type",zr]};function gr(e){xt.call(this,e)}ye(gr,xt),gr.prototype._modules=[jm,WM,Fc,Kn,ca],gr.prototype._moddleExtensions={};var Hc="keyboard.keydown",UM="keyboard.keyup",qM=1e3,Xv="Keyboard binding is now implicit; explicit binding to an element got removed. For more information, see https://github.com/bpmn-io/diagram-js/issues/661";function gn(e,t){var n=this;this._config=e=e||{},this._eventBus=t,this._keydownHandler=this._keydownHandler.bind(this),this._keyupHandler=this._keyupHandler.bind(this),t.on("diagram.destroy",function(){n._fire("destroy"),n.unbind()}),e.bindTo&&console.error("unsupported configuration <keyboard.bindTo>",new Error(Xv));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}gn.$inject=["config.keyboard","eventBus"],gn.prototype._keydownHandler=function(e){this._keyHandler(e,Hc)},gn.prototype._keyupHandler=function(e){this._keyHandler(e,UM)},gn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Hc,i),n&&e.preventDefault()}},gn.prototype._isEventIgnored=function(e){return!1},gn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(Xv)),this.unbind(),e=this._node=this._target,Ne.bind(e,"keydown",this._keydownHandler),Ne.bind(e,"keyup",this._keyupHandler),this._fire("bind")},gn.prototype.getBinding=function(){return this._node},gn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),Ne.unbind(e,"keydown",this._keydownHandler),Ne.unbind(e,"keyup",this._keyupHandler)),this._node=null},gn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},gn.prototype.addListener=function(e,t,n){qt(e)&&(n=t,t=e,e=qM),this._eventBus.on(n||Hc,e,t)},gn.prototype.removeListener=function(e,t){this._eventBus.off(t||Hc,e)},gn.prototype.hasModifier=hA,gn.prototype.isCmd=Mn,gn.prototype.isShift=Lp,gn.prototype.isKey=Gt;var YM=500;function ko(e,t){var n=this;e.on("editorActions.init",YM,function(i){var r=i.editorActions;n.registerBindings(t,r)})}ko.$inject=["eventBus","keyboard"],ko.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(bA(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(_A(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(mA(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(gA(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(yA(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(vA(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Gt(["+","Add","="],r)&&Mn(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Gt(["-","Subtract"],r)&&Mn(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(Gt("0",r)&&Mn(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(Gt(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const hf={__init__:["keyboard","keyboardBindings"],keyboard:["type",gn],keyboardBindings:["type",ko]};var KM={moveSpeed:50,moveSpeedAccelerated:200};function Zv(e,t,n){var i=this;this._config=z({},KM,e||{}),t.addListener(r);function r(o){var a=o.keyEvent,s=i._config;if(t.isCmd(a)&&t.isKey(["ArrowLeft","Left","ArrowUp","Up","ArrowDown","Down","ArrowRight","Right"],a)){var c=t.isShift(a)?s.moveSpeedAccelerated:s.moveSpeed,u;switch(a.key){case"ArrowLeft":case"Left":u="left";break;case"ArrowUp":case"Up":u="up";break;case"ArrowRight":case"Right":u="right";break;case"ArrowDown":case"Down":u="down";break}return i.moveCanvas({speed:c,direction:u}),!0}}this.moveCanvas=function(o){var a=0,s=0,c=o.speed,u=c/Math.min(Math.sqrt(n.viewbox().scale),1);switch(o.direction){case"left":a=u;break;case"up":s=u;break;case"right":a=-u;break;case"down":s=-u;break}n.scroll({dx:a,dy:s})}}Zv.$inject=["config.keyboardMove","keyboard","canvas"];const Qv={__depends__:[hf],__init__:["keyboardMove"],keyboardMove:["type",Zv]};var XM=15;function Jv(e,t){var n;function i(s){return a(s.originalEvent)}e.on("canvas.focus.changed",function(s){s.focused?e.on("element.mousedown",500,i):e.off("element.mousedown",i)});function r(s){var c=n.start,u=n.button,l=Br(s),f=oi(l,c);if(!n.dragging&&ZM(f)>XM&&(n.dragging=!0,u===0&&Cy(e),hc("grab")),n.dragging){var p=n.last||n.start;f=oi(l,p),t.scroll({dx:f.x,dy:f.y}),n.last=l}s.preventDefault()}function o(s){Ne.unbind(document,"mousemove",r),Ne.unbind(document,"mouseup",o),n=null,Ry()}function a(s){if(!Mr(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:Br(s)},Ne.bind(document,"mousemove",r),Ne.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}Jv.$inject=["eventBus","canvas"];function ZM(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const eb={__init__:["moveCanvas"],moveCanvas:["type",Jv]};function tb(e,t){var n=kl(e.min),i=kl(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function QM(e,t){return Math.max(e.min,Math.min(e.max,t))}var JM=Math.sign||function(e){return e>=0?1:-1},mf={min:.2,max:4},nb=10,e2=.1,t2=.75;function xi(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=bn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||t2;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}xi.$inject=["config.zoomScroll","eventBus","canvas"],xi.prototype.scroll=function(t){this._canvas.scroll(t)},xi.prototype.reset=function(){this._canvas.zoom("fit-viewport")},xi.prototype.zoom=function(t,n){var i=tb(mf,nb*2);this._totalDelta+=t,Math.abs(this._totalDelta)>e2&&(this._zoom(t,n,i),this._totalDelta=0)},xi.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||Dg()&&t.metaKey,r=t.shiftKey,o=-1*this._scale,a;if(i?o*=t.deltaMode===0?.02:.32:o*=t.deltaMode===0?1:16,i){var s=n.getBoundingClientRect(),c={x:t.clientX-s.left,y:t.clientY-s.top};a=Math.sqrt(Math.pow(t.deltaY,2)+Math.pow(t.deltaX,2))*JM(t.deltaY)*o,this.zoom(a,c)}else r?a={dx:o*t.deltaY,dy:0}:a={dx:o*t.deltaX,dy:o*t.deltaY},this.scroll(a)}},xi.prototype.stepZoom=function(t,n){var i=tb(mf,nb);this._zoom(t,n,i)},xi.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=kl(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(QM(mf,s),t)},xi.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&Ne[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},xi.prototype._init=function(e){this.toggle(e)};const ib={__init__:["zoomScroll"],zoomScroll:["type",xi]};function Ia(e){gr.call(this,e)}ye(Ia,gr),Ia.prototype._navigationModules=[Qv,eb,ib],Ia.prototype._modules=[].concat(gr.prototype._modules,Ia.prototype._navigationModules);function gf(e){return e&&e[e.length-1]}function rb(e){return e.y}function ob(e){return e.x}var n2={left:ob,center:ob,right:function(e){return e.x+e.width},top:rb,middle:rb,bottom:function(e){return e.y+e.height}};function Oo(e,t){this._modeling=e,this._rules=t}Oo.$inject=["modeling","rules"],Oo.prototype._getOrientationDetails=function(e){var t=["top","bottom","middle"],n="x",i="width";return t.indexOf(e)!==-1&&(n="y",i="height"),{axis:n,dimension:i}},Oo.prototype._isType=function(e,t){return t.indexOf(e)!==-1},Oo.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),i=n.axis,r=n.dimension,o={},a={},s=!1,c,u,l;function f(p,d){return Math.round((p[i]+d[i]+d[r])/2)}if(this._isType(e,["left","top"]))o[e]=t[0][i];else if(this._isType(e,["right","bottom"]))l=gf(t),o[e]=l[i]+l[r];else if(this._isType(e,["center","middle"])){if(I(t,function(p){var d=p[i]+Math.round(p[r]/2);a[d]?a[d].elements.push(p):a[d]={elements:[p],center:d}}),c=ci(a,function(p){return p.elements.length>1&&(s=!0),p.elements.length}),s)return o[e]=gf(c).center,o;u=t[0],t=ci(t,function(p){return p[i]+p[r]}),l=gf(t),o[e]=f(u,l)}return o},Oo.prototype.trigger=function(e,t){var n=this._modeling,i,r=Ue(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),ke(i)&&(r=i),!(r.length<2||!i)){var o=n2[t],a=ci(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const i2={__init__:["alignElements"],alignElements:["type",Oo]},r2=new Po;function Do(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Do.$inject=["eventBus"],Do.prototype.schedule=function(e,t=r2.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},Do.prototype._schedule=function(e,t){const n=o2();return{executionId:setTimeout(()=>{try{this._scheduled[t]=null;try{n.resolve(e())}catch(r){n.reject(r)}}catch(r){console.error("Scheduler#_schedule execution failed",r)}}),promise:n.promise}},Do.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Do.prototype._cancel=function(e){clearTimeout(e.executionId)};function o2(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const a2={scheduler:["type",Do]};var s2="djs-element-hidden",zc=".entry",c2=1e3,ab=8,u2=300;function Dt(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}Dt.$inject=["canvas","elementRegistry","eventBus","scheduler"],Dt.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",function(t){var n=t.newSelection,i=n.length?n.length===1?n[0]:n:null;i?e.open(i,!0):e.close()}),this._eventBus.on("elements.changed",function(t){var n=t.elements,i=e._current;if(i){var r=i.target,o=ke(r)?r:[r],a=o.filter(function(c){return n.includes(c)});if(a.length){e.close();var s=o.filter(function(c){return e._elementRegistry.get(c.id)});s.length&&e._updateAndOpen(s.length>1?s:s[0])}}}),this._eventBus.on("canvas.viewbox.changed",function(){e._updatePosition()}),this._eventBus.on("element.marker.update",function(t){if(e.isOpen()){var n=t.element,i=e._current,r=ke(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},Dt.prototype._createContainer=function(){var e=mt('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},Dt.prototype.registerProvider=function(e,t){t||(t=e,e=c2),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},Dt.prototype.getEntries=function(e){var t=this._getProviders(),n=ke(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return I(t,function(r){if(qt(r[n])){var o=r[n](e);qt(o)?i=o(i):I(o,function(a,s){i[s]=a})}}),i},Dt.prototype.trigger=function(e,t,n){var i=this,r,o,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(r=un(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},u2);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,o,n)},Dt.prototype.triggerEntry=function(e,t,n,i){if(this.isShown()){var r=this._current.target,o=this._current.entries,a=o[e];if(a){var s=a.action;if(this._eventBus.fire("contextPad.trigger",{entry:a,event:n})!==!1){if(qt(s)){if(t==="click")return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},Dt.prototype.open=function(e,t){if(!(!t&&this.isOpen(e))){var n=this._eventBus.fire("contextPad.open.allowed",{target:e});n!==!1&&(this.close(),this._updateAndOpen(e))}},Dt.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Dt.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;I(t,function(r,o){var a=r.group||"default",s=mt(r.html||'<div class="entry" draggable="true"></div>'),c;un(s,"data-action",o),c=ot("[data-group="+La(a)+"]",n),c||(c=mt('<div class="group"></div>'),un(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&l2(s,r.className),r.title&&un(s,"title",r.title),r.imageUrl&&(i=mt("<img>"),un(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),_t(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},Dt.prototype._createHtml=function(e){var t=this,n=mt('<div class="djs-context-pad"></div>');return Pn.bind(n,zc,"click",function(i){t.trigger("click",i)}),Pn.bind(n,zc,"dragstart",function(i){t.trigger("dragstart",i)}),Pn.bind(n,zc,"mouseover",function(i){t.trigger("mouseover",i)}),Pn.bind(n,zc,"mouseout",function(i){t.trigger("mouseout",i)}),Ne.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},Dt.prototype.getPad=function(e){console.warn(new Error("ContextPad#getPad is deprecated and will be removed in future library versions, cf. https://github.com/bpmn-io/diagram-js/pull/888"));let t;return this.isOpen()&&f2(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},Dt.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},Dt.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return ke(e)!==ke(n)?!1:ke(e)?e.length===n.length&&Cr(e,function(i){return n.includes(i)}):n===e},Dt.prototype.isShown=function(){return this.isOpen()&&_t(this._current.html).has("open")},Dt.prototype.show=function(){this.isOpen()&&(_t(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},Dt.prototype.hide=function(){this.isOpen()&&(_t(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},Dt.prototype._getPosition=function(e){if(!ke(e)&&at(e)){var t=this._canvas.viewbox(),n=p2(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+ab*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+ab*this._canvas.zoom(),top:s.top-a.top}},Dt.prototype._updatePosition=function(){const e=()=>{if(this.isOpen()){var t=this._current.html,n=this._getPosition(this._current.target);"x"in n&&"y"in n?(t.style.left=n.x+"px",t.style.top=n.y+"px"):["top","right","bottom","left"].forEach(function(i){i in n&&(t.style[i]=n[i]+"px")})}};this._scheduler.schedule(e,"ContextPad#_updatePosition")},Dt.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=ke(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,s2)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},Dt.prototype._getTargetBounds=function(e){var t=this,n=ke(e)?e:[e],i=n.map(function(r){return t._canvas.getGraphics(r)});return i.reduce(function(r,o){const a=o.getBoundingClientRect();return r.top=Math.min(r.top,a.top),r.right=Math.max(r.right,a.right),r.bottom=Math.max(r.bottom,a.bottom),r.left=Math.min(r.left,a.left),r.x=r.left,r.y=r.top,r.width=r.right-r.left,r.height=r.bottom-r.top,r},{top:1/0,right:-1/0,bottom:-1/0,left:1/0})};function l2(e,t){var n=_t(e);t=ke(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function p2(e){return e.waypoints[e.waypoints.length-1]}function f2(e,t){return e=ke(e)?e:[e],t=ke(t)?t:[t],e.length===t.length&&Cr(e,function(n){return t.includes(n)})}const sb={__depends__:[dc,a2,Fc],contextPad:["type",Dt]};var Gc,Et,cb,yr,ub,lb,pb,yf,Vc,Ba,fb,vf,bf,_f,Wc={},Uc=[],d2=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,qc=Array.isArray;function ji(e,t){for(var n in t)e[n]=t[n];return e}function xf(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function db(e,t,n){var i,r,o,a={};for(o in t)o=="key"?i=t[o]:o=="ref"?r=t[o]:a[o]=t[o];if(arguments.length>2&&(a.children=arguments.length>3?Gc.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)a[o]===void 0&&(a[o]=e.defaultProps[o]);return Yc(e,a,i,r,null)}function Yc(e,t,n,i,r){var o={type:e,props:t,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++cb,__i:-1,__u:0};return r==null&&Et.vnode!=null&&Et.vnode(o),o}function Kc(e){return e.children}function Xc(e,t){this.props=e,this.context=t}function Gr(e,t){if(t==null)return e.__?Gr(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?Gr(e):null}function h2(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=ji({},t);o.__v=t.__v+1,Et.vnode&&Et.vnode(o),wf(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??Gr(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,xb(i,o,r),t.__e=t.__=null,o.__e!=n&&hb(o)}}function hb(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),hb(e)}function mb(e){(!e.__d&&(e.__d=!0)&&yr.push(e)&&!Zc.__r++||ub!=Et.debounceRendering)&&((ub=Et.debounceRendering)||lb)(Zc)}function Zc(){try{for(var e,t=1;yr.length;)yr.length>t&&yr.sort(pb),e=yr.shift(),t=yr.length,h2(e)}finally{yr.length=Zc.__r=0}}function gb(e,t,n,i,r,o,a,s,c,u,l){var f,p,d,g,h,m,_=i&&i.__k||Uc,y=t.length;for(c=m2(n,t,_,c,y),f=0;f<y;f++)(d=n.__k[f])!=null&&(p=d.__i!=-1&&_[d.__i]||Wc,d.__i=f,m=wf(e,d,p,r,o,a,s,c,u,l),g=d.__e,d.ref&&p.ref!=d.ref&&(p.ref&&Ef(p.ref,null,d),l.push(d.ref,d.__c||g,d)),h==null&&g!=null&&(h=g),4&d.__u?(c=yb(d,c,e),p.__e&&(p.__e=null)):typeof d.type=="function"&&m!==void 0?c=m:g&&(c=g.nextSibling),d.__u&=-7);return n.__e=h,c}function m2(e,t,n,i,r){var o,a,s,c,u,l=n.length,f=l,p=0;for(e.__k=new Array(r),o=0;o<r;o++)(a=t[o])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[o]=Yc(null,a,null,null,null):qc(a)?a=e.__k[o]=Yc(Kc,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=Yc(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[o]=a,c=o+p,a.__=e,a.__b=e.__b+1,s=null,(u=a.__i=g2(a,n,c,f))!=-1&&(f--,(s=n[u])&&(s.__u|=2)),s==null||s.__v==null?(u==-1&&(r>l?p--:r<l&&p++),typeof a.type!="function"&&(a.__u|=4)):u!=c&&(u==c-1?p--:u==c+1?p++:(u>c?p--:p++,a.__u|=4))):e.__k[o]=null;if(f)for(o=0;o<l;o++)(s=n[o])!=null&&(2&s.__u)==0&&(s.__e==i&&(i=Gr(s)),Eb(s,s));return i}function yb(e,t,n){var i,r;if(typeof e.type=="function"){for(i=e.__k,r=0;i&&r<i.length;r++)i[r]&&(i[r].__=e,t=yb(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Gr(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function g2(e,t,n,i){var r,o,a,s=e.key,c=e.type,u=t[n],l=u!=null&&(2&u.__u)==0;if(u===null&&s==null||l&&s==u.key&&c==u.type)return n;if(i>(l?1:0)){for(r=n-1,o=n+1;r>=0||o<t.length;)if((u=t[a=r>=0?r--:o++])!=null&&(2&u.__u)==0&&s==u.key&&c==u.type)return a}return-1}function vb(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||d2.test(t)?n:n+"px"}function Qc(e,t,n,i,r){var o,a;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof i=="string"&&(e.style.cssText=i=""),i)for(t in i)n&&t in n||vb(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||vb(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(fb,"$1")),a=t.toLowerCase(),t=a in e||t=="onFocusOut"||t=="onFocusIn"?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?i?n[Ba]=i[Ba]:(n[Ba]=vf,e.addEventListener(t,o?_f:bf,o)):e.removeEventListener(t,o?_f:bf,o);else{if(r=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function bb(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Vc]==null)t[Vc]=vf++;else if(t[Vc]<n[Ba])return;return n(Et.event?Et.event(t):t)}}}function wf(e,t,n,i,r,o,a,s,c,u){var l,f,p,d,g,h,m,_,y,x,S,P,C,D,T,$,k=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(l=Et.__b)&&l(t);e:if(typeof k=="function"){f=a.length;try{if(y=t.props,x=k.prototype&&k.prototype.render,S=(l=k.contextType)&&i[l.__c],P=l?S?S.props.value:l.__:i,n.__c?_=(p=t.__c=n.__c).__=p.__E:(x?t.__c=p=new k(y,P):(t.__c=p=new Xc(y,P),p.constructor=k,p.render=v2),S&&S.sub(p),p.state||(p.state={}),p.__n=i,d=p.__d=!0,p.__h=[],p._sb=[]),x&&p.__s==null&&(p.__s=p.state),x&&k.getDerivedStateFromProps!=null&&(p.__s==p.state&&(p.__s=ji({},p.__s)),ji(p.__s,k.getDerivedStateFromProps(y,p.__s))),g=p.props,h=p.state,p.__v=t,d)x&&k.getDerivedStateFromProps==null&&p.componentWillMount!=null&&p.componentWillMount(),x&&p.componentDidMount!=null&&p.__h.push(p.componentDidMount);else{if(x&&k.getDerivedStateFromProps==null&&y!==g&&p.componentWillReceiveProps!=null&&p.componentWillReceiveProps(y,P),t.__v==n.__v||!p.__e&&p.shouldComponentUpdate!=null&&p.shouldComponentUpdate(y,p.__s,P)===!1){t.__v!=n.__v&&(p.props=y,p.state=p.__s,p.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(O){O&&(O.__=t)}),Uc.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&a.push(p),s=Gr(n);break e}p.componentWillUpdate!=null&&p.componentWillUpdate(y,p.__s,P),x&&p.componentDidUpdate!=null&&p.__h.push(function(){p.componentDidUpdate(g,h,m)})}if(p.context=P,p.props=y,p.__P=e,p.__e=!1,C=Et.__r,D=0,x)p.state=p.__s,p.__d=!1,C&&C(t),l=p.render(p.props,p.state,p.context),Uc.push.apply(p.__h,p._sb),p._sb=[];else do p.__d=!1,C&&C(t),l=p.render(p.props,p.state,p.context),p.state=p.__s;while(p.__d&&++D<25);p.state=p.__s,p.getChildContext!=null&&(i=ji(ji({},i),p.getChildContext())),x&&!d&&p.getSnapshotBeforeUpdate!=null&&(m=p.getSnapshotBeforeUpdate(g,h)),T=l!=null&&l.type===Kc&&l.key==null?wb(l.props.children):l,s=gb(e,qc(T)?T:[T],t,n,i,r,o,a,s,c,u),p.base=t.__e,t.__u&=-161,p.__h.length&&a.push(p),_&&(p.__E=p.__=null)}catch(O){if(a.length=f,t.__v=null,c||o!=null){if(O.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($=o.length;$--;)xf(o[$])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),O.then||_b(t),Et.__e(O,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=y2(n.__e,t,n,i,r,o,a,c,u);return(l=Et.diffed)&&l(t),128&t.__u?void 0:s}function _b(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(_b))}function xb(e,t,n){for(var i=0;i<n.length;i++)Ef(n[i],n[++i],n[++i]);Et.__c&&Et.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){Et.__e(o,r.__v)}})}function wb(e){return typeof e!="object"||e==null||e.__b>0?e:qc(e)?e.map(wb):e.constructor!==void 0?null:ji({},e)}function y2(e,t,n,i,r,o,a,s,c){var u,l,f,p,d,g,h,m=n.props||Wc,_=t.props,y=t.type;if(y=="svg"?r="http://www.w3.org/2000/svg":y=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),o!=null){for(u=0;u<o.length;u++)if((d=o[u])&&"setAttribute"in d==!!y&&(y?d.localName==y:d.nodeType==3)){e=d,o[u]=null;break}}if(e==null){if(y==null)return document.createTextNode(_);e=document.createElementNS(r,y,_.is&&_),s&&(Et.__m&&Et.__m(t,o),s=!1),o=null}if(y==null)m===_||s&&e.data==_||(e.data=_);else{if(o=y=="textarea"&&_.defaultValue!=null?null:o&&Gc.call(e.childNodes),!s&&o!=null)for(m={},u=0;u<e.attributes.length;u++)m[(d=e.attributes[u]).name]=d.value;for(u in m)d=m[u],u=="dangerouslySetInnerHTML"?f=d:u=="children"||u in _||u=="value"&&"defaultValue"in _||u=="checked"&&"defaultChecked"in _||Qc(e,u,null,d,r);for(u in _)d=_[u],u=="children"?p=d:u=="dangerouslySetInnerHTML"?l=d:u=="value"?g=d:u=="checked"?h=d:s&&typeof d!="function"||m[u]===d||Qc(e,u,d,m[u],r);if(l)s||f&&(l.__html==f.__html||l.__html==e.innerHTML)||(e.innerHTML=l.__html),t.__k=[];else if(f&&(e.innerHTML=""),gb(t.type=="template"?e.content:e,qc(p)?p:[p],t,n,i,y=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&Gr(n,0),s,c),o!=null)for(u=o.length;u--;)xf(o[u]);s&&y!="textarea"||(u="value",y=="progress"&&g==null?e.removeAttribute("value"):g!=null&&(g!==e[u]||y=="progress"&&!g||y=="option"&&g!=m[u])&&Qc(e,u,g,m[u],r),u="checked",h!=null&&h!=e[u]&&Qc(e,u,h,m[u],r))}return e}function Ef(e,t,n){try{if(typeof e=="function"){var i=typeof e.__u=="function";i&&e.__u(),i&&t==null||(e.__u=e(t))}else e.current=t}catch(r){Et.__e(r,n)}}function Eb(e,t,n){var i,r;if(Et.unmount&&Et.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||Ef(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){Et.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&Eb(i[r],t,n||typeof e.type!="function");n||xf(e.__e),e.__c=e.__=e.__e=void 0}function v2(e,t,n){return this.constructor(e,n)}function Sb(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),Et.__&&Et.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],wf(t,e=t.__k=db(Kc,null,[e]),r||Wc,Wc,t.namespaceURI,r?null:t.firstChild?Gc.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),xb(o,e,a),e.props.children=null}Gc=Uc.slice,Et={__e:function(e,t,n,i){for(var r,o,a;t=t.__;)if((r=t.__c)&&!r.__)try{if((o=r.constructor)&&o.getDerivedStateFromError!=null&&(r.setState(o.getDerivedStateFromError(e)),a=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e,i||{}),a=r.__d),a)return r.__E=r}catch(s){e=s}throw e}},cb=0,Xc.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=ji({},this.state),typeof e=="function"&&(e=e(ji({},n),this.props)),e&&ji(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),mb(this))},Xc.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),mb(this))},Xc.prototype.render=Kc,yr=[],lb=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,pb=function(e,t){return e.__v.__b-t.__v.__b},Zc.__r=0,yf=Math.random().toString(8),Vc="__d"+yf,Ba="__a"+yf,fb=/(PointerCapture)$|Capture$/i,vf=0,bf=bb(!1),_f=bb(!0);var Rb=function(e,t,n,i){var r;t[0]=0;for(var o=1;o<t.length;o++){var a=t[o++],s=t[o]?(t[0]|=a?1:2,n[t[o++]]):t[++o];a===3?i[0]=s:a===4?i[1]=Object.assign(i[1]||{},s):a===5?(i[1]=i[1]||{})[t[++o]]=s:a===6?i[1][t[++o]]+=s+"":a?(r=e.apply(s,Rb(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},Cb=new Map;function b2(e){var t=Cb.get(this);return t||(t=new Map,Cb.set(this,t)),(t=Rb(this,t.get(e)||(t.set(e,t=(function(n){for(var i,r,o=1,a="",s="",c=[0],u=function(p){o===1&&(p||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,p,a):o===3&&(p||a)?(c.push(3,p,a),o=2):o===2&&a==="..."&&p?c.push(4,p,0):o===2&&a&&!p?c.push(5,0,!0,a):o>=5&&((a||!p&&o===5)&&(c.push(o,0,a,r),o=6),p&&(c.push(o,p,0,r),o=6)),a=""},l=0;l<n.length;l++){l&&(o===1&&u(),u(l));for(var f=0;f<n[l].length;f++)i=n[l][f],o===1?i==="<"?(u(),c=[c],o=3):a+=i:o===4?a==="--"&&i===">"?(o=1,a=""):a=i+a[0]:s?i===s?s="":a+=i:i==='"'||i==="'"?s=i:i===">"?(u(),o=1):o&&(i==="="?(o=5,r=a,a=""):i==="/"&&(o<5||n[l][f+1]===">")?(u(),o===3&&(c=c[0]),o=c,(c=c[0]).push(2,0,o),o=0):i===" "||i===" "||i===`
|
|
11
|
+
`||i==="\r"?(u(),o=2):a+=i),o===3&&a==="!--"&&(o=4,c=c[0])}return u(),c})(e)),t),arguments,[])).length>1?t:t[0]}var ct=b2.bind(db),Lo,Lt,Sf,Pb,Na=0,Ab=[],Vt=Et,Tb=Vt.__b,Mb=Vt.__r,kb=Vt.diffed,Ob=Vt.__c,Db=Vt.unmount,Lb=Vt.__;function Jc(e,t){Vt.__h&&Vt.__h(Lt,e,Na||t),Na=0;var n=Lt.__H||(Lt.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Rf(e){return Na=1,_2(Bb,e)}function _2(e,t,n){var i=Jc(Lo++,2);if(i.t=e,!i.__c&&(i.__=[Bb(void 0,t),function(s){var c=i.__N?i.__N[0]:i.__[0],u=i.t(c,s);c!==u&&(i.__N=[u,i.__[1]],i.__c.setState({}))}],i.__c=Lt,!Lt.__f)){var r=function(s,c,u){if(!i.__c.__H)return!0;var l=!1,f=i.__c.props!==s;if(i.__c.__H.__.some(function(d){if(d.__N){l=!0;var g=d.__[0];d.__=d.__N,d.__N=void 0,g!==d.__[0]&&(f=!0)}}),o){var p=o.call(this,s,c,u);return l?p||f:p}return!l||f};Lt.__f=!0;var o=Lt.shouldComponentUpdate,a=Lt.componentWillUpdate;Lt.componentWillUpdate=function(s,c,u){if(this.__e){var l=o;o=void 0,r(s,c,u),o=l}a&&a.call(this,s,c,u)},Lt.shouldComponentUpdate=r}return i.__N||i.__}function eu(e,t){var n=Jc(Lo++,3);!Vt.__s&&Af(n.__H,t)&&(n.__=e,n.u=t,Lt.__H.__h.push(n))}function Cf(e,t){var n=Jc(Lo++,4);!Vt.__s&&Af(n.__H,t)&&(n.__=e,n.u=t,Lt.__h.push(n))}function tu(e){return Na=5,Hi(function(){return{current:e}},[])}function Hi(e,t){var n=Jc(Lo++,7);return Af(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function $a(e,t){return Na=8,Hi(function(){return e},t)}function x2(){for(var e;e=Ab.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(nu),t.__h.some(Pf),t.__h=[]}catch(n){t.__h=[],Vt.__e(n,e.__v)}}}Vt.__b=function(e){Lt=null,Tb&&Tb(e)},Vt.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Lb&&Lb(e,t)},Vt.__r=function(e){Mb&&Mb(e),Lo=0;var t=(Lt=e.__c).__H;t&&(Sf===Lt?(t.__h=[],Lt.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(nu),t.__h.some(Pf),t.__h=[],Lo=0)),Sf=Lt},Vt.diffed=function(e){kb&&kb(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Ab.push(t)!==1&&Pb===Vt.requestAnimationFrame||((Pb=Vt.requestAnimationFrame)||w2)(x2)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),Sf=Lt=null},Vt.__c=function(e,t){t.some(function(n){try{n.__h.some(nu),n.__h=n.__h.filter(function(i){return!i.__||Pf(i)})}catch(i){t.some(function(r){r.__h&&(r.__h=[])}),t=[],Vt.__e(i,n.__v)}}),Ob&&Ob(e,t)},Vt.unmount=function(e){Db&&Db(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{nu(i)}catch(r){t=r}}),n.__H=void 0,t&&Vt.__e(t,n.__v))};var Ib=typeof requestAnimationFrame=="function";function w2(e){var t,n=function(){clearTimeout(i),Ib&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);Ib&&(t=requestAnimationFrame(n))}function nu(e){var t=Lt,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),Lt=t}function Pf(e){var t=Lt;e.__c=e.__(),Lt=t}function Af(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function Bb(e,t){return typeof t=="function"?t(e):t}function E2(e){const{navigationStack:t,setNavigationStack:n}=e,i=Hi(()=>t.length<=1?[]:t.slice(0,-1).map((a,s)=>({label:a.label,onClick:()=>n(c=>c.slice(0,s+1))})),[t,n]),r=t.length>0?()=>n([]):null,o=t.length>0?t[t.length-1].label:null;return ct`
|
|
12
12
|
<div class="djs-popup-breadcrumbs">
|
|
13
|
-
${r&&
|
|
13
|
+
${r&&ct`
|
|
14
14
|
<button
|
|
15
15
|
type="button"
|
|
16
16
|
class="djs-popup-breadcrumbs-item djs-popup-breadcrumbs-item--back"
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
</svg>
|
|
24
24
|
</button>
|
|
25
25
|
`}
|
|
26
|
-
${i.map((a,s)=>
|
|
26
|
+
${i.map((a,s)=>ct`
|
|
27
27
|
<button
|
|
28
28
|
key=${s}
|
|
29
29
|
type="button"
|
|
@@ -35,23 +35,23 @@
|
|
|
35
35
|
</button>
|
|
36
36
|
<span class="djs-popup-breadcrumbs-item--separator" aria-hidden="true"></span>
|
|
37
37
|
`)}
|
|
38
|
-
${o&&
|
|
38
|
+
${o&&ct`
|
|
39
39
|
<span class="djs-popup-breadcrumbs-item djs-popup-breadcrumbs-item--current" title=${o}>
|
|
40
40
|
${o}
|
|
41
41
|
</span>
|
|
42
42
|
`}
|
|
43
43
|
</div>
|
|
44
|
-
`}function
|
|
44
|
+
`}function Nb(e){var t,n,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=Nb(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function iu(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=Nb(e))&&(i&&(i+=" "),i+=t);return i}function S2(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:r,title:o}=e,a=Hi(()=>R2(t),[t]),s=u=>u.action&&!u.disabled,c=(u,l)=>{if(s(l))return n(u,l)};return ct`
|
|
45
45
|
<div class="djs-popup-header">
|
|
46
46
|
<h3 class="djs-popup-title" title=${o}>${o}</h3>
|
|
47
|
-
${a.map(u=>
|
|
47
|
+
${a.map(u=>ct`
|
|
48
48
|
<ul key=${u.id} class="djs-popup-header-group" data-header-group=${u.id}>
|
|
49
49
|
|
|
50
|
-
${u.entries.map(l=>
|
|
50
|
+
${u.entries.map(l=>ct`
|
|
51
51
|
<li key=${l.id}>
|
|
52
52
|
<${s(l)?"button":"span"}
|
|
53
|
-
class=${
|
|
54
|
-
onClick=${
|
|
53
|
+
class=${C2(l,l===i)}
|
|
54
|
+
onClick=${f=>c(f,l)}
|
|
55
55
|
title=${l.title||l.label}
|
|
56
56
|
data-id=${l.id}
|
|
57
57
|
aria-disabled=${l.disabled||void 0}
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
onFocus=${()=>s(l)&&r(l)}
|
|
61
61
|
onBlur=${()=>s(l)&&r(null)}
|
|
62
62
|
>
|
|
63
|
-
${l.imageUrl&&
|
|
64
|
-
${l.label?
|
|
63
|
+
${l.imageUrl&&ct`<img class="djs-popup-entry-icon" src=${l.imageUrl} alt="" />`||l.imageHtml&&ct`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:l.imageHtml}} />`}
|
|
64
|
+
${l.label?ct`
|
|
65
65
|
<span class="djs-popup-label">${l.label}</span>
|
|
66
66
|
`:null}
|
|
67
67
|
</${l.action?"button":"span"}>
|
|
@@ -70,11 +70,11 @@
|
|
|
70
70
|
</ul>
|
|
71
71
|
`)}
|
|
72
72
|
</div>
|
|
73
|
-
`}function
|
|
73
|
+
`}function R2(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 C2(e,t){return iu("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function $b(e,t){return`${e}-entry-${t.id}`}function P2(e){const{idPrefix:t,entry:n,selected:i,onMouseEnter:r,onMouseLeave:o,onAction:a}=e,s=(u,l)=>{if(!n.disabled)return a(u,n,l)},c=!n.entries;return ct`
|
|
74
74
|
<li
|
|
75
|
-
class=${
|
|
75
|
+
class=${iu("entry",{selected:i,disabled:n.disabled})}
|
|
76
76
|
data-id=${n.id}
|
|
77
|
-
id=${
|
|
77
|
+
id=${$b(t,n)}
|
|
78
78
|
role="option"
|
|
79
79
|
aria-selected=${i||void 0}
|
|
80
80
|
aria-haspopup=${n.entries?"true":void 0}
|
|
@@ -88,17 +88,17 @@
|
|
|
88
88
|
>
|
|
89
89
|
<div class="djs-popup-entry-content">
|
|
90
90
|
<span
|
|
91
|
-
class=${
|
|
91
|
+
class=${iu("djs-popup-entry-name",n.className)}
|
|
92
92
|
>
|
|
93
|
-
${n.imageUrl&&
|
|
93
|
+
${n.imageUrl&&ct`<img class="djs-popup-entry-icon" src=${n.imageUrl} alt="" />`||n.imageHtml&&ct`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:n.imageHtml}} />`}
|
|
94
94
|
|
|
95
|
-
${n.label?
|
|
95
|
+
${n.label?ct`
|
|
96
96
|
<span class="djs-popup-label">
|
|
97
97
|
${n.label}
|
|
98
98
|
</span>
|
|
99
99
|
`:null}
|
|
100
100
|
|
|
101
|
-
${n.documentationRef&&
|
|
101
|
+
${n.documentationRef&&ct`
|
|
102
102
|
<a
|
|
103
103
|
class="djs-popup-entry-docs"
|
|
104
104
|
href=${n.documentationRef}
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
</a>
|
|
116
116
|
`}
|
|
117
117
|
</span>
|
|
118
|
-
${n.description&&
|
|
118
|
+
${n.description&&ct`
|
|
119
119
|
<span
|
|
120
120
|
class="djs-popup-entry-description"
|
|
121
121
|
>
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
</span>
|
|
124
124
|
`}
|
|
125
125
|
</div>
|
|
126
|
-
${n.entries&&
|
|
126
|
+
${n.entries&&ct`
|
|
127
127
|
<div class="djs-popup-entry-chevron" aria-hidden="true">
|
|
128
128
|
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
129
129
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.96967 1.46967C4.26256 1.17678 4.73744 1.17678 5.03033 1.46967L9.03033 5.46967C9.32322 5.76256 9.32322 6.23744 9.03033 6.53033L5.03033 10.5303C4.73744 10.8232 4.26256 10.8232 3.96967 10.5303C3.67678 10.2374 3.67678 9.76256 3.96967 9.46967L7.43934 6L3.96967 2.53033C3.67678 2.23744 3.67678 1.76256 3.96967 1.46967Z" fill="currentColor"/>
|
|
@@ -131,20 +131,20 @@
|
|
|
131
131
|
</div>
|
|
132
132
|
`}
|
|
133
133
|
</li>
|
|
134
|
-
`}function
|
|
134
|
+
`}function A2(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:r,idPrefix:o,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:u,...l}=e,f=tu();Cf(()=>{if(!r||!r.current)return;const h=f.current;if(!h)return;const m=h.querySelector(".selected");m&&T2(m)},[t]);const p=()=>{r.current=!1},d=h=>{r.current||n(h)},g=()=>{r.current||n(null)};return ct`
|
|
135
135
|
<div
|
|
136
136
|
class="djs-popup-results"
|
|
137
|
-
ref=${
|
|
137
|
+
ref=${f}
|
|
138
138
|
id=${a}
|
|
139
139
|
role="listbox"
|
|
140
140
|
aria-label=${s}
|
|
141
141
|
tabIndex=${c}
|
|
142
142
|
aria-activedescendant=${u}
|
|
143
|
-
onMouseMove=${
|
|
143
|
+
onMouseMove=${p}
|
|
144
144
|
>
|
|
145
|
-
${i.map(h=>
|
|
146
|
-
${h.name&&
|
|
147
|
-
<div key=${h.id} id=${
|
|
145
|
+
${i.map(h=>ct`
|
|
146
|
+
${h.name&&ct`
|
|
147
|
+
<div key=${h.id} id=${Fb(o,h)} class="entry-header" title=${h.name}>
|
|
148
148
|
${h.name}
|
|
149
149
|
</div>
|
|
150
150
|
`}
|
|
@@ -152,10 +152,10 @@
|
|
|
152
152
|
class="djs-popup-group"
|
|
153
153
|
data-group=${h.id}
|
|
154
154
|
role="group"
|
|
155
|
-
aria-labelledby=${h.name?
|
|
155
|
+
aria-labelledby=${h.name?Fb(o,h):void 0}
|
|
156
156
|
>
|
|
157
|
-
${h.entries.map(m=>
|
|
158
|
-
<${
|
|
157
|
+
${h.entries.map(m=>ct`
|
|
158
|
+
<${P2}
|
|
159
159
|
key=${m.id}
|
|
160
160
|
idPrefix=${o}
|
|
161
161
|
entry=${m}
|
|
@@ -168,36 +168,36 @@
|
|
|
168
168
|
</ul>
|
|
169
169
|
`)}
|
|
170
170
|
</div>
|
|
171
|
-
`}function
|
|
172
|
-
<${
|
|
171
|
+
`}function Fb(e,t){return`${e}-group-${t.id}`}function T2(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const M2=new Po("djs-popup");function k2(e){const{onClose:t,onSelect:n,className:i,headerEntries:r,position:o,title:a,width:s,scale:c,search:u,emptyPlaceholder:l,searchFn:f,entries:p,onOpened:d,onClosed:g}=e,[h,m]=Rf([]);eu(()=>{m([])},[p]);const[_,y]=Rf(""),x=_.trim().length>0,S=Hi(()=>L2(p),[p]),P=Hi(()=>jt(u)?S.length>5:!1,[u,S]),C=Hi(()=>{const U=h.length?h[h.length-1].entries:p;return P?x?f(S.filter(({searchable:q})=>q!==!1),_,{keys:["label","search","description"]}).map(({item:q})=>q):U.filter(({rank:q=0})=>q>=0):U},[P,x,S,_,f,h,p]),D=Hi(()=>x?C.length?[{id:"default",entries:C}]:[]:I2(C),[C,x]),[T,$]=Rf(C[0]),k=tu(null),O=tu(!1),j=Hi(()=>M2.next(),[]),se=`${j}-results`,we=T&&$b(j,T);eu(()=>{const U=k.current;U&&C.includes(U)?$(U):$(C[0]),k.current=null},[C]);const Ke=$a(U=>{const q=D2(D);let Ge=q.indexOf(T)+U;Ge<0&&(Ge=q.length-1),Ge>=q.length&&(Ge=0),O.current=!0,$(q[Ge])},[D,T]),Y=$a(U=>{U>0&&T&&T.entries&&(O.current=!0,m(q=>[...q,T])),U<0&&h.length>0&&(O.current=!0,k.current=h[h.length+U],m(q=>q.slice(0,U)))},[T,h]),ue=$a((U,q,K)=>{if(!(!q||q.disabled))return q.entries?(U.preventDefault(),Y(1)):n(U,q,K)},[n,Y]),_e=$a(U=>{if(U.key==="Enter"&&T){const q=U.target;return!!Mr(q,"a, button",!0)||T.disabled?void 0:ue(U,T)}if(U.key==="Backspace"){const q=U.target;if(!(ll(q,"input")&&q.value!==""))return Y(-1),U.preventDefault()}if(U.key==="ArrowUp")return Ke(-1),U.preventDefault();if(U.key==="ArrowDown")return Ke(1),U.preventDefault();if(U.key==="ArrowRight")return Y(1),U.preventDefault();if(U.key==="ArrowLeft")return Y(-1),U.preventDefault()},[T,Ke,Y,ue]),le=$a(U=>{ll(U.target,"input")&&y(()=>U.target.value)},[y]);eu(()=>(d(),()=>{g()}),[]);const xe=!x&&h.length>0,ce=(a||r.length>0)&&!xe;return ct`
|
|
172
|
+
<${jb}
|
|
173
173
|
onClose=${t}
|
|
174
|
-
onKeyup=${
|
|
175
|
-
onKeydown=${
|
|
174
|
+
onKeyup=${le}
|
|
175
|
+
onKeydown=${_e}
|
|
176
176
|
className=${i}
|
|
177
177
|
position=${o}
|
|
178
178
|
width=${s}
|
|
179
179
|
scale=${c}
|
|
180
180
|
navigationStack=${h}
|
|
181
181
|
>
|
|
182
|
-
${
|
|
183
|
-
<${
|
|
182
|
+
${ce&&ct`
|
|
183
|
+
<${S2}
|
|
184
184
|
headerEntries=${r}
|
|
185
185
|
onSelect=${n}
|
|
186
186
|
selectedEntry=${T}
|
|
187
|
-
setSelectedEntry=${
|
|
187
|
+
setSelectedEntry=${$}
|
|
188
188
|
title=${a}
|
|
189
189
|
/>
|
|
190
190
|
`}
|
|
191
|
-
${
|
|
192
|
-
<${
|
|
191
|
+
${xe&&ct`
|
|
192
|
+
<${E2}
|
|
193
193
|
navigationStack=${h}
|
|
194
194
|
setNavigationStack=${m}
|
|
195
195
|
/>
|
|
196
196
|
`}
|
|
197
|
-
${
|
|
197
|
+
${p.length>0&&ct`
|
|
198
198
|
<div class="djs-popup-body">
|
|
199
199
|
|
|
200
|
-
${P&&
|
|
200
|
+
${P&&ct`
|
|
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,38 +208,38 @@
|
|
|
208
208
|
role="combobox"
|
|
209
209
|
aria-label="${a||"Search"}"
|
|
210
210
|
aria-expanded="true"
|
|
211
|
-
aria-controls=${
|
|
212
|
-
aria-activedescendant=${
|
|
211
|
+
aria-controls=${se}
|
|
212
|
+
aria-activedescendant=${we||void 0}
|
|
213
213
|
aria-autocomplete="list"
|
|
214
214
|
/>
|
|
215
215
|
</div>
|
|
216
216
|
`}
|
|
217
217
|
|
|
218
|
-
${
|
|
218
|
+
${x&&ct`
|
|
219
219
|
<div class="djs-popup-search-count" aria-live="polite">
|
|
220
220
|
${C.length} ${C.length===1?"result":"results"} found
|
|
221
221
|
</div>
|
|
222
222
|
`}
|
|
223
223
|
|
|
224
|
-
<${
|
|
224
|
+
<${A2}
|
|
225
225
|
groupedEntries=${D}
|
|
226
226
|
selectedEntry=${T}
|
|
227
|
-
setSelectedEntry=${
|
|
227
|
+
setSelectedEntry=${$}
|
|
228
228
|
keyboardSelection=${O}
|
|
229
|
-
onAction=${
|
|
230
|
-
idPrefix=${
|
|
231
|
-
id=${
|
|
229
|
+
onAction=${ue}
|
|
230
|
+
idPrefix=${j}
|
|
231
|
+
id=${se}
|
|
232
232
|
ariaLabel=${a||"Results"}
|
|
233
233
|
tabIndex=${P?-1:0}
|
|
234
|
-
ariaActivedescendant=${P?void 0:
|
|
234
|
+
ariaActivedescendant=${P?void 0:we||void 0}
|
|
235
235
|
/>
|
|
236
236
|
|
|
237
|
-
${T&&T.documentationRef&&
|
|
237
|
+
${T&&T.documentationRef&&ct`
|
|
238
238
|
<div class="djs-popup-footer">
|
|
239
239
|
<a
|
|
240
240
|
class="djs-popup-footer-docs"
|
|
241
241
|
href=${T.documentationRef}
|
|
242
|
-
onClick=${
|
|
242
|
+
onClick=${U=>U.stopPropagation()}
|
|
243
243
|
aria-label=${T.label?`Open entry documentation for ${T.label}`:"Open entry documentation"}
|
|
244
244
|
target="_blank"
|
|
245
245
|
rel="noopener"
|
|
@@ -254,14 +254,14 @@
|
|
|
254
254
|
`}
|
|
255
255
|
</div>
|
|
256
256
|
`}
|
|
257
|
-
${l&&C.length===0&&
|
|
258
|
-
<div class="djs-popup-no-results">${
|
|
257
|
+
${l&&C.length===0&&ct`
|
|
258
|
+
<div class="djs-popup-no-results">${qt(l)?l(_):l}</div>
|
|
259
259
|
`}
|
|
260
|
-
</${
|
|
261
|
-
`}function
|
|
260
|
+
</${jb}>
|
|
261
|
+
`}function jb(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,navigationStack:a,position:s}=e,c=tu();return Cf(()=>{if(typeof s!="function")return;const u=c.current,l=s(u);u.style.left=`${l.x}px`,u.style.top=`${l.y}px`},[c.current,s]),Cf(()=>{const u=c.current;if(!u)return;(u.querySelector("input")||u.querySelector('[role="listbox"]')||u).focus()},[a]),eu(()=>{const u=f=>{if(f.key==="Escape")return f.preventDefault(),t()},l=f=>{if(!Mr(f.target,".djs-popup",!0))return t()};return document.documentElement.addEventListener("keydown",u),document.body.addEventListener("click",l,!0),()=>{document.documentElement.removeEventListener("keydown",u),document.body.removeEventListener("click",l,!0)}},[]),ct`
|
|
262
262
|
<div
|
|
263
|
-
class=${
|
|
264
|
-
style=${
|
|
263
|
+
class=${iu("djs-popup",r)}
|
|
264
|
+
style=${O2(e)}
|
|
265
265
|
onKeydown=${n}
|
|
266
266
|
onKeyup=${i}
|
|
267
267
|
ref=${c}
|
|
@@ -269,10 +269,10 @@
|
|
|
269
269
|
>
|
|
270
270
|
${o}
|
|
271
271
|
</div>
|
|
272
|
-
`}function
|
|
273
|
-
<${
|
|
274
|
-
onClose=${
|
|
275
|
-
onSelect=${(
|
|
272
|
+
`}function O2(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:jt(t)?n:void 0,maxWidth:jt(t)?"unset":void 0,"transform-origin":"top left"}}function D2(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function L2(e){const t=[];function n(i){i.forEach(r=>{if(r.entries){n(r.entries);return}t.push(r)})}return n(e),t}function I2(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 B2="data-id",Hb=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],N2=1e3;function St(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var r=jt(e&&e.scale)?e.scale:{min:1,max:1};this._config={scale:r},t.on("diagram.destroy",()=>{this.close()}),t.on("element.changed",o=>{const a=this.isOpen()&&this._current.target;o.element===a&&this.refresh()})}St.$inject=["config.popupMenu","eventBus","canvas","search"],St.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:r,options:o}=this._current,a=zb(n),s=Object.entries(i).map(([p,d])=>({id:p,...d})),c=e&&(p=>this._ensureVisible(p,e)),u=this._updateScale(this._current.container);Sb(ct`
|
|
273
|
+
<${k2}
|
|
274
|
+
onClose=${p=>this.close(p)}
|
|
275
|
+
onSelect=${(p,d,g)=>this.trigger(p,d,g)}
|
|
276
276
|
position=${c}
|
|
277
277
|
className=${t}
|
|
278
278
|
entries=${a}
|
|
@@ -284,7 +284,7 @@
|
|
|
284
284
|
searchFn=${this._search}
|
|
285
285
|
...${{...o}}
|
|
286
286
|
/>
|
|
287
|
-
`,this._current.container)},
|
|
287
|
+
`,this._current.container)},St.prototype.open=function(e,t,n,i){if(!e)throw new Error("target is missing");if(!t)throw new Error("providers for <"+t+"> not found");if(!n)throw new Error("position is missing");var r=this._eventBus.fire("popupMenu.open.allowed",{target:e,providerId:t});if(r===!1)return;this.isOpen()&&this.close();const{entries:o,headerEntries:a,emptyPlaceholder:s}=this._getContext(e,t);this._current={position:n,providerId:t,target:e,entries:o,headerEntries:a,emptyPlaceholder:s,container:this._createContainer({provider:t}),options:i},this._emit("open"),this._bindAutoClose(),this._render()},St.prototype.refresh=function(){if(!this.isOpen())return;const{target:e,providerId:t}=this._current,{entries:n,headerEntries:i,emptyPlaceholder:r}=this._getContext(e,t);this._current={...this._current,entries:n,headerEntries:i,emptyPlaceholder:r},this._emit("refresh"),this._render()},St.prototype._getContext=function(e,t){const n=this._getProviders(t);if(!n||!n.length)throw new Error("provider for <"+t+"> not found");const i=this._getEntries(e,n),r=this._getHeaderEntries(e,n),o=this._getEmptyPlaceholder(n);return{entries:i,headerEntries:r,emptyPlaceholder:o,empty:!(Object.keys(i).length||Object.keys(r).length)}},St.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},St.prototype.reset=function(){const e=this._current.container;Sb(null,e),di(e)},St.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},St.prototype._onOpened=function(){this._emit("opened")},St.prototype._onClosed=function(){this._emit("closed")},St.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=mt(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},St.prototype._bindAutoClose=function(){this._eventBus.once(Hb,this.close,this)},St.prototype._unbindAutoClose=function(){this._eventBus.off(Hb,this.close,this)},St.prototype._updateScale=function(){var e=this._canvas.zoom(),t=this._config.scale,n,i,r=e;return t!==!0&&(t===!1?(n=1,i=1):(n=t.min,i=t.max),jt(n)&&e<n&&(r=n),jt(i)&&e>i&&(r=i)),r},St.prototype._ensureVisible=function(e,t){var n=document.documentElement.getBoundingClientRect(),i=e.getBoundingClientRect(),r={},o=t.x,a=t.y;return t.x+i.width>n.width&&(r.x=!0),t.y+i.height>n.height&&(r.y=!0),r.x&&r.y?(o=t.x-i.width,a=t.y-i.height):r.x?(o=t.x-i.width,a=t.y):r.y&&t.y<i.height?(o=t.x,a=10):r.y&&(o=t.x,a=t.y-i.height),t.y<n.top&&(a=t.y+i.height),{x:o,y:a}},St.prototype.isEmpty=function(e,t){if(!e)throw new Error("target is missing");if(!t)throw new Error("provider ID is missing");const n=this._getProviders(t);return!n||!n.length?!0:this._getContext(e,t).empty},St.prototype.registerProvider=function(e,t,n){n||(n=t,t=N2),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},St.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},St.prototype._getEntries=function(e,t){var n={};return I(t,function(i){if(!i.getPopupMenuEntries){I(i.getEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=ui(o,["id"])});return}var r=i.getPopupMenuEntries(e);qt(r)?n=r(n):I(r,function(o,a){n[a]=o})}),n},St.prototype._getHeaderEntries=function(e,t){var n={};return I(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;I(i.getHeaderEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=ui(o,["id"])});return}var r=i.getPopupMenuHeaderEntries(e);qt(r)?n=r(n):I(r,function(o,a){n[a]=o})}),n},St.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>qt(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},St.prototype.isOpen=function(){return!!this._current},St.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let r=Mr(e.delegateTarget||e.target,".entry",!0),o=un(r,B2);t={id:o,...this._getEntry(o)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(qt(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},St.prototype._getEntry=function(e){var t=this._current.entries[e]||this._current.headerEntries[e];if(!t)throw new Error("entry not found");return t};function zb(e,t=[]){return Object.entries(e).map(([n,i])=>{const r={id:n,...i};return r.entries?r.entries=zb(r.entries,[...t,...Gb(r.search)]):t.length&&(r.search=[...t,...Gb(r.search)]),r})}function Gb(e){return e?ke(e)?e:[e]:[]}function $2(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=F2(o,r,i);return a?{item:o,tokens:a}:[]}).sort(j2(i))}function F2(e,t,n){const{matchedWords:i,tokens:r}=n.reduce((o,a)=>{const s=e[a],{tokens:c,matchedWords:u}=ke(s)?s.reduce((l,f)=>{const{tokens:p,matchedWords:d}=Yb(f,t);return{tokens:[...l.tokens,p],matchedWords:{...l.matchedWords,...d}}},{matchedWords:{},tokens:[]}):Yb(s,t);return{tokens:{...o.tokens,[a]:c},matchedWords:{...o.matchedWords,...u}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:r}function j2(e){return(t,n)=>{let i=0,r=1;for(const o of e){const a=H2(t.tokens[o],n.tokens[o]);if(a!==0){i+=a*r,r*=Vb;continue}const s=z2(t.item[o],n.item[o]);if(s!==0){i+=s*r,r*=Vb;continue}}return i}}function H2(e,t){return Wb(t)-Wb(e)}const Vb=.5,Io={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function Wb(e){const t=e.reduce((s,c)=>s+Ub(c),0),n=e.flat(),i=n.reduce((s,c)=>s+c.value.length,0),r=n.reduce((s,c)=>s+(c.match?c.value.length:0),0),o=i?r/i:0;return t*(1+o)}function Ub(e){if(ke(e))return Math.max(...e.map(Ub));const t=Math.log(e.value.length);return e.match?(e.start?e.end?Io.FULL:e.wordEnd?Io.START_FULL_WORD:Io.START_WORD_PART:e.wordStart?Io.WORD_START:Io.WORD_PART)*t:Io.NO_MATCH*t}function qb(e=""){return ke(e)?e.join(", "):e}function z2(e,t){return qb(e).localeCompare(qb(t))}function Yb(e,t){var u;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map(G2),o=[`(?<all>${r.join("\\s+")})`,...r].join("|"),a=new RegExp(o,"ig");let s,c=0;for(;s=a.exec(e);){const[l]=s,f=s.index,p=s.index+l.length,d=f===0,g=p===e.length,h=!!((u=s.groups)!=null&&u.all),m=d||/\s/.test(e.charAt(f-1)),_=g||/\s/.test(e.charAt(p));s.index>c&&n.push({value:e.slice(c,s.index),index:c}),n.push({value:l,index:s.index,match:!0,wordStart:m,wordEnd:_,start:d,end:g,all:h});const y=h?t:[l];for(const x of y)i[x.toLowerCase()]=!0;c=s.index+l.length}return c<e.length&&n.push({value:e.slice(c),index:c}),{tokens:n,matchedWords:i}}function G2(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const Kb={search:["value",$2]},Tf={__depends__:[Kb],__init__:["popupMenu"],popupMenu:["type",St]};var Xb={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>`},N2=900;function No(e,t,n,i){e.registerProvider(N2,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}No.$inject=["contextPad","popupMenu","translate","canvas"],No.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&H(t,this._getEntries(e)),t},No.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},No.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${Ub.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);H(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},No.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 B2=["left","center","right","top","middle","bottom"];function ja(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}ja.$inject=["popupMenu","alignElements","translate","rules"],ja.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&H(t,this._getEntries(e)),t},ja.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},ja.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return L(B2,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:Ub[o],action:function(){t.trigger(e,o),i.close()}}}),r};function iu(e){Gn.call(this,e)}iu.$inject=["eventBus"],de(iu,Gn),iu.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=Ge(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=Cs(n),n.length<2?!1:n})};const $2={__depends__:[KM,ib,Pf],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",No],alignElementsMenuProvider:["type",ja],bpmnAlignElements:["type",iu]};function zi(e,t,n,i){J.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=ku(Jr(a.closure.topLevel)),c=a.hints,u=c?c.autoResize:!0;if(u!==!1){var l=eo(s,function(p){return p.parent.id});L(l,function(p,f){ke(u)&&(p=p.filter(function(d){return lt(u,to({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)})}zi.$inject=["eventBus","elementRegistry","modeling","rules"],de(zi,J),zi.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=Pe(Tt(e)),o=Pe(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),Ts(H({},o,a))},zi.prototype._expand=function(e,t){typeof t=="string"&&(t=this._elementRegistry.get(t));var n=this._rules.allowed("element.autoResize",{elements:e,target:t});if(n){var i=this._getOptimalBounds(e,t);if(j2(i,t)){var r=F2(Qn(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},zi.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},zi.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},zi.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function j2(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function F2(e,t){var n="";return e=Pe(e),t=Pe(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 ru(e){e.invoke(zi,this)}ru.$inject=["injector"],de(ru,zi),ru.prototype.resize=function(e,t,n){x(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function Fa(e){Gn.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}Fa.$inject=["eventBus"],de(Fa,Gn),Fa.prototype.canResize=function(e,t){return!1};function ou(e,t){Fa.call(this,e),this._modeling=t}de(ou,Fa),ou.$inject=["eventBus","modeling"],ou.prototype.canResize=function(e,t){if(x(t.di,"bpmndi:BPMNPlane")||!x(t,"bpmn:Participant")&&!x(t,"bpmn:Lane")&&!x(t,"bpmn:SubProcess"))return!1;var n=!0;return L(e,function(i){if(x(i,"bpmn:Lane")||Fe(i)){n=!1;return}}),n};const H2={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",ru],bpmnAutoResizeProvider:["type",ou]};function Bo(e,t,n){this._canvas=n,this._opts=H({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()})}Bo.$inject=["config.autoScroll","eventBus","canvas"],Bo.prototype.startScroll=function(e){var t=this._canvas,n=this._opts,i=this,r=t.getContainer().getBoundingClientRect(),o=[e.x,e.y,r.width-e.x,r.height-e.y];this.stopScroll();for(var a=0,s=0,c=0;c<4;c++)z2(o[c],n.scrollThresholdOut[c],n.scrollThresholdIn[c])&&(c===0?a=n.scrollStep:c==1?s=n.scrollStep:c==2?a=-n.scrollStep:c==3&&(s=-n.scrollStep));(a!==0||s!==0)&&(t.scroll({dx:a,dy:s}),this._scrolling=setTimeout(function(){i.startScroll(e)},n.scrollRepeatTimeout))};function z2(e,t,n){return t<e&&e<n}Bo.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Bo.prototype.setOptions=function(e){this._opts=H({},this._opts,e)},Bo.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Nr(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const G2={__depends__:[Ni],__init__:["autoScroll"],autoScroll:["type",Bo]};var qb="djs-bendpoint",Yb="djs-segment-dragger";function V2(e,t){var n=Nr(t),i=e._container.getBoundingClientRect(),r;r={x:i.left,y:i.top};var o=e.viewbox();return{x:o.x+(n.x-r.x)/o.scale,y:o.y+(n.y-r.y)/o.scale}}function Af(e,t,n){var i=V2(e,n),r=Ul(t,i);return r}function Tf(e,t){var n=Ce("g");qe(n).add(qb),Be(e,n);var i=Ce("circle");he(i,{cx:0,cy:0,r:4}),qe(i).add("djs-visual"),Be(n,i);var r=Ce("circle");return he(r,{cx:0,cy:0,r:10}),qe(r).add("djs-hit"),Be(n,r),t&&qe(n).add(t),n}function W2(e,t,n,i){var r=Ce("g");Be(e,r);var o=18,a=6,s=11,c=q2(t,n,i),u=a+s,l=Ce("rect");he(l,{x:-o/2,y:-a/2,width:o,height:a}),qe(l).add("djs-visual"),Be(r,l);var p=Ce("rect");return he(p,{x:-c/2,y:-u/2,width:c,height:u}),qe(p).add("djs-hit"),Be(r,p),xm(r,i==="v"?90:0),r}function Kb(e,t,n){var i=Ce("g"),r=xl(t,n),o=Mi(t,n);return Be(e,i),W2(i,t,n,o),qe(i).add(Yb),qe(i).add(o==="h"?"horizontal":"vertical"),en(i,r.x,r.y),i}function Mf(e){return Math.abs(Math.round(e*2/3))}function U2(e,t){var n=Y2(e,t);return Ql(e,n)}function q2(e,t,n){var i=t.x-e.x,r=t.y-e.y;return Mf(n==="h"?i:r)}function Y2(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=sg(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function Xb(e,t,n,i,r){function o(_,S,P){var C=_.index,D=_.point,T,N,k,O,F,ae;return C<=0||_.bendpoint?!1:(T=S[C-1],N=S[C],k=xl(T,N),O=Mi(T,N),F=Math.abs(D.x-k.x),ae=Math.abs(D.y-k.y),O&&F<=P&&ae<=P)}function a(_,S){var P=_.waypoints,C,D,T,N;return S.index<=0||S.bendpoint||(C={start:P[S.index-1],end:P[S.index]},D=Mi(C.start,C.end),!D)?null:(D==="h"?T=C.end.x-C.start.x:T=C.end.y-C.start.y,N=Mf(T)/2,N)}function s(_,S){var P=S.waypoints,C=Af(t,P,_),D;if(C){D=a(S,C);var T;if(o(C,P,D)?T=r.start(_,S,C.index):T=i.start(_,S,C.index,!C.bendpoint),T!==!1)return!0}}function c(_,S,P){Ne.bind(_,S,function(C){n.triggerMouseEvent(S,C,P),C.stopPropagation()})}function u(_,S){var P=t.getLayer("overlays"),C=ot('.djs-bendpoints[data-element-id="'+La(_.id)+'"]',P);return!C&&S&&(C=Ce("g"),he(C,{"data-element-id":_.id}),qe(C).add("djs-bendpoints"),Be(P,C),c(C,"mousedown",_),c(C,"click",_),c(C,"dblclick",_)),C}function l(_,S){return ot('.djs-segment-dragger[data-segment-idx="'+_+'"]',S)}function p(_,S){S.waypoints.forEach(function(P,C){var D=Tf(_);Be(_,D),en(D,P.x,P.y)}),Tf(_,"floating")}function f(_,S){for(var P=S.waypoints,C,D,T,N=1;N<P.length;N++)C=P[N-1],D=P[N],Mi(C,D)&&(T=Kb(_,C,D),he(T,{"data-segment-idx":N}),c(T,"mousemove",S))}function d(_){L(ws("."+qb,_),function(S){$t(S)})}function g(_){L(ws("."+Yb,_),function(S){$t(S)})}function h(_){var S=u(_);return S||(S=u(_,!0),p(S,_),f(S,_)),S}function m(_){var S=u(_);S&&(g(S),d(S),f(S,_),p(S,_))}function w(_,S){var P=ot(".floating",_),C=S.point;P&&(en(P,C.x,C.y),qe(P).add("positioned"))}function y(_,S,P){var C=l(S.index,_),D=P[S.index-1],T=P[S.index],N=S.point,k=xl(D,T),O=Mi(D,T),F,ae;C&&(F=K2(C),ae={x:N.x-k.x,y:N.y-k.y},O==="v"&&(ae={x:ae.y,y:ae.x}),en(F,ae.x,ae.y))}e.on("connection.changed",function(_){m(_.element)}),e.on("connection.remove",function(_){var S=u(_.element);S&&$t(S)}),e.on("element.marker.update",function(_){var S=_.element,P;S.waypoints&&(P=h(S),_.add?qe(P).add(_.marker):qe(P).remove(_.marker))}),e.on("element.mousemove",function(_){var S=_.element,P=S.waypoints,C,D;if(P){if(C=u(S,!0),D=Af(t,P,_.originalEvent),!D)return;w(C,D),D.bendpoint||y(C,D,P)}}),e.on("element.mousedown",function(_){if(cr(_)){var S=_.originalEvent,P=_.element;if(P.waypoints)return s(S,P)}}),e.on("selection.changed",function(_){var S=_.newSelection,P=S[0];P&&P.waypoints&&h(P)}),e.on("element.hover",function(_){var S=_.element;S.waypoints&&h(S)}),e.on("element.out",function(_){var S=_.element;if(S.waypoints){var P=u(S);if(P){var C=ot(".floating",P);C&&qe(C).remove("positioned")}}}),e.on("element.updateId",function(_){var S=_.element,P=_.newId;if(S.waypoints){var C=u(S);C&&he(C,{"data-element-id":P})}}),this.addHandles=h,this.updateHandles=m,this.getBendpointsContainer=u,this.getSegmentDragger=l}Xb.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function K2(e){return ot(".djs-visual",e)}var Zb=Math.round,Vr="reconnectStart",Wr="reconnectEnd",Ha="updateWaypoints";function kf(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,g;!u&&c===0?g=Vr:!u&&c===d.length-1?g=Wr:g=Ha;var h=g===Ha?"connection.updateWaypoints":"connection.reconnect",m=r.allowed(h,{connection:s,source:p,target:f});if(m===!1&&(m=r.allowed(h,{connection:s,source:f,target:p})),m!==!1)return i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:l,context:{allowed:m,bendpointIndex:c,connection:s,source:p,target:f,insert:u,type:g}}})},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 g=f===Ha?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(g,{connection:c,source:f===Vr?p:u,target:f===Wr?p:l}),d){s.source=f===Vr?p:u,s.target=f===Wr?p:l;return}d===!1&&(d=s.allowed=r.allowed(g,{connection:c,source:f===Wr?p:l,target:f===Vr?p:u})),d&&(s.source=f===Wr?p:l,s.target=f===Vr?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!==Ha&&(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,g=s.target,h=s.type,m=s.hints||{},w={x:Zb(a.x),y:Zb(a.y)};if(!c)return!1;h===Ha?(p?f.splice(u,0,w):f[u]=w,m.bendpointMove={insert:p,bendpointIndex:u},f=this.cropWaypoints(l,f),o.updateWaypoints(l,fS(f),m)):(h===Vr?(m.docking="source",au(s)&&(m.docking="target",m.newWaypoints=f.reverse())):h===Wr&&(m.docking="target",au(s)&&(m.docking="source",m.newWaypoints=f.reverse())),o.reconnect(l,d,g,w,m))},this)}kf.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],kf.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 au(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===Vr)return t&&i&&t===i&&n!==i;if(r===Wr)return t&&n&&t===n&&n!==i}var X2="reconnectStart",Z2="reconnectEnd",Qb="updateWaypoints",za="connect-ok",su="connect-not-ok",Jb="connect-hover",e_="djs-updating",t_="djs-dragging",n_=1100;function i_(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=Tf(i.getLayer("overlays"));qe(f).add("djs-dragging"),i.addMarker(c,t_),i.addMarker(c,e_)}),n.on("bendpoint.move.hover",function(o){var a=o.context,s=a.allowed,c=a.hover,u=a.type;if(c){if(i.addMarker(c,Jb),u===Qb)return;s?(i.removeMarker(c,su),i.addMarker(c,za)):s===!1&&(i.removeMarker(c,za),i.addMarker(c,su))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],n_,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,Jb),i.removeMarker(s,c?za:su))}),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,g=f.target,h=f.waypoints.slice(),m={x:o.x,y:o.y},w=a.hints||{},y={};r&&(w.connectionStart&&(y.connectionStart=w.connectionStart),w.connectionEnd&&(y.connectionEnd=w.connectionEnd),p===X2?au(a)?(y.connectionEnd=y.connectionEnd||m,y.source=g,y.target=l||d,h=h.reverse()):(y.connectionStart=y.connectionStart||m,y.source=l||d,y.target=g):p===Z2?au(a)?(y.connectionStart=y.connectionStart||m,y.source=l||g,y.target=d,h=h.reverse()):(y.connectionEnd=y.connectionEnd||m,y.source=d,y.target=l||g):(y.noCropping=!0,y.noLayout=!0,h[c]=m),p===Qb&&(h=e.cropWaypoints(f,h)),y.waypoints=h,r.drawPreview(a,s,y)),en(u,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],n_,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,u=a.hover,l=a.target,p=a.waypoints;s.waypoints=p,$t(c),i.removeMarker(s,e_),i.removeMarker(s,t_),u&&(i.removeMarker(u,za),i.removeMarker(u,l?za:su)),r&&r.cleanUp(a)})}i_.$inject=["bendpointMove","injector","eventBus","canvas"];var r_="connect-hover",o_="djs-updating";function a_(e,t,n){return Of(e,t,e[t]+n)}function Of(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function Q2(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 Of(t,i,s)}function s_(e){return e==="x"?"y":"x"}function c_(e,t,n){var i,r;return e.original?e.original:(i=Oe(t),r=s_(n),Of(e,r,i[r]))}function u_(e,t,n,i,r,o){var a=e.get("connectionDocking",!1);this.start=function(p,f,d){var g,h=n.getGraphics(f),m=d-1,w=d,y=f.waypoints,_=y[m],S=y[w],P=Af(n,y,p),C,D,T;if(C=Mi(_,S),!!C)return D=C==="v"?"x":"y",m===0&&(_=c_(_,f.source,D)),w===y.length-1&&(S=c_(S,f.target,D)),P?T=P.point:T={x:(_.x+S.x)/2,y:(_.y+S.y)/2},g={connection:f,segmentStartIndex:m,segmentEndIndex:w,segmentStart:_,segmentEnd:S,axis:D,dragPosition:T},i.init(p,T,"connectionSegment.move",{cursor:D==="x"?"resize-ew":"resize-ns",data:{connection:f,connectionGfx:h,context:g}})};function s(p,f){if(!a)return f;var d=p.waypoints,g;return p.waypoints=f,g=a.getCroppedWaypoints(p),p.waypoints=d,g}function c(p){r.update("connection",p.connection,p.connectionGfx)}function u(p,f,d){var g=p.newWaypoints,h=p.segmentStartIndex+f,m=g[h],w=p.segmentEndIndex+f,y=g[w],_=s_(p.axis),S=Q2(d,m,y,_);en(p.draggerGfx,S.x,S.y)}function l(p,f){var d=0,g=p.filter(function(h,m){return _l(p[m-1],p[m+1],h)?(d=m<=f?d-1:d,!1):!0});return{waypoints:g,segmentOffset:d}}t.on("connectionSegment.move.start",function(p){var f=p.context,d=p.connection,g=n.getLayer("overlays");f.originalWaypoints=d.waypoints.slice(),f.draggerGfx=Kb(g,f.segmentStart,f.segmentEnd),qe(f.draggerGfx).add("djs-dragging"),n.addMarker(d,o_)}),t.on("connectionSegment.move.move",function(p){var f=p.context,d=f.connection,g=f.segmentStartIndex,h=f.segmentEndIndex,m=f.segmentStart,w=f.segmentEnd,y=f.axis,_=f.originalWaypoints.slice(),S=a_(m,y,p["d"+y]),P=a_(w,y,p["d"+y]),C=_.length,D=0;_[g]=S,_[h]=P;var T,N;g<2&&(T=Jt(d.source,S),g===1?T==="intersect"&&(_.shift(),_[0]=S,D--):T!=="intersect"&&(_.unshift(m),D++)),h>C-3&&(N=Jt(d.target,P),h===C-2?N==="intersect"&&(_.pop(),_[_.length-1]=P):N!=="intersect"&&_.push(w)),f.newWaypoints=d.waypoints=s(d,_),u(f,D,p),f.newSegmentStartIndex=g+D,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,r_)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,r_)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,d=f.connection;f.draggerGfx&&$t(f.draggerGfx),n.removeMarker(d,o_)}),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,g=f.newWaypoints,h=f.newSegmentStartIndex;g=g.map(function(P){return{original:P.original,x:Math.round(P.x),y:Math.round(P.y)}});var m=l(g,h),w=m.waypoints,y=s(d,w),_=m.segmentOffset,S={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:h+_}};o.updateWaypoints(d,y,S)})}u_.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var J2=Math.abs,l_=Math.round;function ek(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],J2(r-e)<=n)return r}function p_(e){return{x:e.x,y:e.y}}function f_(e){return{x:e.x+e.width,y:e.y+e.height}}function qn(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:l_(e.x+e.width/2),y:l_(e.y+e.height/2)}}function $o(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function Dt(e,t,n){if(typeof t!="string")throw new Error("axis must be in [x, y]");if(typeof n!="number"&&n!==!1)throw new Error("value must be Number or false");var i,r=e[t],o=e.snapped=e.snapped||{};return n===!1?o[t]=!1:(o[t]=!0,i=n-r,e[t]+=i,e["d"+t]+=i),r}function d_(e){return e.children||[]}var tk=Math.abs,h_=Math.round,Df=10;function m_(e){function t(o,a){if(ke(o)){for(var s=o.length;s--;)if(tk(o[s]-a)<=Df)return o[s]}else{o=+o;var c=a%o;if(c<Df)return a-c;if(c>o-Df)return a-c+o}return a}function n(o,a){if(o.waypoints)return U2(a,o);if(o.width)return{x:h_(o.width/2+o.x),y:h_(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,g=a.axis;if(s)return s;var h=[u[p-1],l,f,u[d+1]];return p<2&&h.unshift(n(c.source,o)),d>u.length-3&&h.unshift(n(c.target,o)),a.snapPoints=s={horizontal:[],vertical:[]},L(h,function(m){m&&(m=m.original||m,g==="y"&&s.horizontal.push(m.y),g==="x"&&s.vertical.push(m.x))}),s}e.on("connectionSegment.move.move",1500,function(o){var a=i(o),s=o.x,c=o.y,u,l;if(a){u=t(a.vertical,s),l=t(a.horizontal,c);var p=s-u,f=c-l;H(o,{dx:o.dx-p,dy:o.dy-f,x:u,y:l}),(p||a.vertical.indexOf(s)!==-1)&&Dt(o,"x",u),(f||a.horizontal.indexOf(c)!==-1)&&Dt(o,"y",l)}});function r(o){var a=o.snapPoints,s=o.connection.waypoints,c=o.bendpointIndex;if(a)return a;var u=[s[c-1],s[c+1]];return o.snapPoints=a={horizontal:[],vertical:[]},L(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);!st(s)||!c||!c.x||!c.y||(Dt(o,"x",c.x),Dt(o,"y",c.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(o){var a=o.context,s=r(a),c=a.hover,u=c&&n(c,o),l=o.x,p=o.y,f,d;if(s){f=t(u?s.vertical.concat([u.x]):s.vertical,l),d=t(u?s.horizontal.concat([u.y]):s.horizontal,p);var g=l-f,h=p-d;H(o,{dx:o.dx-g,dy:o.dy-h,x:o.x-g,y:o.y-h}),(g||s.vertical.indexOf(l)!==-1)&&Dt(o,"x",f),(h||s.horizontal.indexOf(p)!==-1)&&Dt(o,"y",d)}})}m_.$inject=["eventBus"];const nk={__depends__:[Ni,bi],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",Xb],bendpointMove:["type",kf],bendpointMovePreview:["type",i_],connectionSegmentMove:["type",u_],bendpointSnapping:["type",m_]};function g_(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),!Qr(l)){if(l!==!1){s.source=c,s.target=u;return}l=s.canExecute=o(c,u),!Qr(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,g={connectionStart:Lf(s)?l:u,connectionEnd:Lf(s)?u:l};Vt(c)&&(d=c),s.connection=n.connect(p,f,d,g)}),this.start=function(a,s,c,u){Vt(c)||(u=c,c=Oe(s)),t.init(a,"connect",{autoActivate:u,data:{shape:s,context:{start:s,connectionStart:c}}})}}g_.$inject=["eventBus","dragging","modeling","rules"];function Lf(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var ik=1100,rk=900,y_="connect-ok",v_="connect-not-ok";function b_(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},g=f,h=d;Lf(o)&&(g=d,h=f),i.drawPreview(o,a,{source:c||u,target:p||s,connectionStart:g,connectionEnd:h})}),t.on("connect.hover",rk,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?y_:v_)}),t.on(["connect.out","connect.cleanup"],ik,function(r){var o=r.hover;o&&(n.removeMarker(o,y_),n.removeMarker(o,v_))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}b_.$inject=["injector","eventBus","canvas"];const If={__depends__:[Vn,bi,Ni],__init__:["connectPreview"],connect:["type",g_],connectPreview:["type",b_]};var ok="djs-dragger";function Gi(e,t,n,i){this._canvas=t,this._graphicsFactory=n,this._elementFactory=i,this._connectionDocking=e.get("connectionDocking",!1),this._layouter=e.get("layouter",!1)}Gi.$inject=["injector","canvas","graphicsFactory","elementFactory"],Gi.prototype.drawPreview=function(e,t,n){n=n||{};var i=e.connectionPreviewGfx,r=e.getConnection,o=n.source,a=n.target,s=n.waypoints,c=n.connectionStart,u=n.connectionEnd,l=n.noLayout,p=n.noCropping,f=n.noNoop,d,g=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),Es(i),r||(r=e.getConnection=ak(function(h,m,w){return g.getConnection(h,m,w)})),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?Oe(o):c,a?Oe(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)"})},Gi.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||Oe(n),o=t.connectionEnd||Oe(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);Be(e,s)},Gi.prototype.cropWaypoints=function(e,t,n,i){var r=this._graphicsFactory,o=n&&r.getShapePath(n),a=i&&r.getShapePath(i),s=r.getConnectionPath({waypoints:[e,t]});return e=n&&na(o,s,!0)||e,t=i&&na(a,s,!1)||t,[e,t]},Gi.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&$t(e.connectionPreviewGfx)},Gi.prototype.getConnection=function(e){var t=sk(e);return this._elementFactory.createConnection(t)},Gi.prototype.createConnectionPreviewGfx=function(){var e=Ce("g");return he(e,{pointerEvents:"none"}),qe(e).add(ok),Be(this._canvas.getActiveLayer(),e),e},Gi.prototype.createNoopConnection=function(e,t){return Qo([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function ak(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 sk(e){return Vt(e)?e:{}}const ck={__init__:["connectionPreview"],connectionPreview:["type",Gi]},cu="complex-preview";class __{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(cu);n.filter(s=>!uk(s)).forEach(s=>{let c;st(s)?(c=this._graphicsFactory._createContainer("connection",Ce("g")),this._graphicsFactory.drawConnection(Dr(c),s)):(c=this._graphicsFactory._createContainer("shape",Ce("g")),this._graphicsFactory.drawShape(Dr(c),s),en(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);st(s)?en(u,c.x,c.y):en(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",Ce("g"));this._graphicsFactory.drawShape(Dr(u),s,{width:c.width,height:c.height}),en(u,c.x,c.y),this._previewSupport.addDragger(s,a,u)})}cleanUp(){Es(this._canvas.getLayer(cu)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(cu)}hide(){this._canvas.hideLayer(cu)}}__.$inject=["canvas","graphicsFactory","previewSupport"];function uk(e){return e.hidden}const lk={__depends__:[Ao],__init__:["complexPreview"],complexPreview:["type",__]},x_=Math.round;function uu(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}uu.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(H({type:t},n)),l=a.fire("autoPlace",{source:e,shape:u});if(!l)return;H(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=>!Qr(d))})},uu.prototype.cleanUp=function(){this._complexPreview.cleanUp()},uu.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const pk={__depends__:[Nc,lk,sf],__init__:["appendPreview"],appendPreview:["type",uu]};var w_=Math.min,E_=Math.max;function Nf(e){e.preventDefault()}function Ga(e){e.stopPropagation()}function fk(e){return e.nodeType===Node.TEXT_NODE}function dk(e){return[].slice.call(e)}function ii(e){this.container=e.container,this.parent=ft('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=ot("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=mn(this.autoResize,this),this.handlePaste=mn(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=Qn(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);H(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=Qn(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return H(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},u),i.centerVertically&&H(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},u),a.innerText=n,Ne.bind(a,"keydown",this.keyHandler),Ne.bind(a,"mousedown",Ga),Ne.bind(a,"paste",r.handlePaste),Ne.bind(a,"focusout",this.focusoutHandler),i.autoResize&&Ne.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=hk(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=dk(a.childNodes),c,u;if(fk(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(g,h){h===f?g.textContent=n.textContent.substring(0,r)+e+i.textContent.substring(o):h>f&&h<=d&&di(g)}),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=ft('<div class="djs-direct-editing-resize-handle"></div>');var s,c,u,l,p=function(g){Nf(g),Ga(g),s=g.clientX,c=g.clientY;var h=t.getBoundingClientRect();u=h.width,l=h.height,Ne.bind(document,"mousemove",f),Ne.bind(document,"mouseup",d)},f=function(g){Nf(g),Ga(g);var h=w_(E_(u+g.clientX-s,i),o),m=w_(E_(l+g.clientY-c,r),a);t.style.width=h+"px",t.style.height=m+"px",e.resizeHandler({width:u,height:l,dx:g.clientX-s,dy:g.clientY-c})},d=function(g){Nf(g),Ga(g),Ne.unbind(document,"mousemove",f,!1),Ne.unbind(document,"mouseup",d,!1)};Ne.bind(n,"mousedown",p)}H(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"),Ne.unbind(t,"keydown",this.keyHandler),Ne.unbind(t,"mousedown",Ga),Ne.unbind(t,"input",this.autoResize),Ne.unbind(t,"paste",this.handlePaste),Ne.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),di(n)),di(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 hk(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 ii({container:t.getContainer(),keyHandler:mn(this._handleKey,this),resizeHandler:mn(this._handleResize,this),focusoutHandler:mn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}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=lt(this._providers,function(i){return(t=i.activate(e))?i:null});return t&&(this.$textbox=this._textbox.create(t.bounds,t.style,t.text,t.options),this._active={element:e,context:t,provider:n},t.options&&t.options.resizable&&(this.resizable=!0),this._fire("activate")),!!t};const S_={__depends__:[fc],__init__:["directEditing"],directEditing:["type",Dn]};function mk(e){return function(t){var n=t.target,i=te(e),r=i.eventDefinitions&&i.eventDefinitions[0],o=i.$type===n.type,a=(r&&r.$type)===n.eventDefinitionType,s=!!n.triggeredByEvent==!!i.triggeredByEvent,c=n.isExpanded===void 0||n.isExpanded===Ue(e);return!o||!a||!s||!c}}const gk={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=gk[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var yk=[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")],vk=[Q("none-start-event",{actionName:"replace-with-none-start"}),Q("none-intermediate-throwing"),Q("none-end-event",{actionName:"replace-with-none-end"})],bk=[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")],_k=[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")],xk=[Q("exclusive-gateway"),Q("parallel-gateway"),Q("inclusive-gateway"),Q("complex-gateway"),Q("event-based-gateway")],wk=[Q("transaction"),Q("event-subprocess"),Q("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),Q("collapsed-subprocess")],Ek=[Q("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),Q("transaction"),Q("event-subprocess"),Q("collapsed-ad-hoc-subprocess")],R_=[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")],Sk=R_,C_=[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"})],Rk=[Q("data-store-reference")],Ck=[Q("data-object-reference")],Pk=[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")],Ak=[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")],Tk=[{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"}],Mk=[Q("expanded-pool"),Q("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],kk={"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 P_={"start-event-non-interrupting":`
|
|
315
|
+
</svg>`},V2=900;function Bo(e,t,n,i){e.registerProvider(V2,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}Bo.$inject=["contextPad","popupMenu","translate","canvas"],Bo.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&z(t,this._getEntries(e)),t},Bo.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Bo.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${Xb.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);z(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},Bo.prototype._getMenuPosition=function(e){var t=5,n=this._contextPad.getPad(e).html,i=n.getBoundingClientRect(),r={x:i.left,y:i.bottom+t};return r};var W2=["left","center","right","top","middle","bottom"];function Fa(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}Fa.$inject=["popupMenu","alignElements","translate","rules"],Fa.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&z(t,this._getEntries(e)),t},Fa.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Fa.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return I(W2,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:Xb[o],action:function(){t.trigger(e,o),i.close()}}}),r};function ru(e){Yn.call(this,e)}ru.$inject=["eventBus"],ye(ru,Yn),ru.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=Ue(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=Ps(n),n.length<2?!1:n})};const U2={__depends__:[i2,sb,Tf],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Bo],alignElementsMenuProvider:["type",Fa],bpmnAlignElements:["type",ru]};function zi(e,t,n,i){te.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=i;var r=this;this.postExecuted(["shape.create"],function(o){var a=o.context,s=a.hints||{},c=a.shape,u=a.parent||a.newParent;s.autoResize!==!1&&r._expand([c],u)}),this.postExecuted(["elements.move"],function(o){var a=o.context,s=Ou(Qr(a.closure.topLevel)),c=a.hints,u=c?c.autoResize:!0;if(u!==!1){var l=Jr(s,function(f){return f.parent.id});I(l,function(f,p){ke(u)&&(f=f.filter(function(d){return lt(u,eo({id:d.id}))})),r._expand(f,p)})}}),this.postExecuted(["shape.toggleCollapse"],function(o){var a=o.context,s=a.hints,c=a.shape;s&&s.autoResize===!1||c.collapsed||r._expand(c.children||[],c)}),this.postExecuted(["shape.resize"],function(o){var a=o.context,s=a.hints,c=a.shape,u=c.parent;s&&s.autoResize===!1||u&&r._expand([c],u)})}zi.$inject=["eventBus","elementRegistry","modeling","rules"],ye(zi,te),zi.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=Te(kt(e)),o=Te(t),a={};return r.top-o.top<i.top&&(a.top=r.top-n.top),r.left-o.left<i.left&&(a.left=r.left-n.left),o.right-r.right<i.right&&(a.right=r.right+n.right),o.bottom-r.bottom<i.bottom&&(a.bottom=r.bottom+n.bottom),Ms(z({},o,a))},zi.prototype._expand=function(e,t){typeof t=="string"&&(t=this._elementRegistry.get(t));var n=this._rules.allowed("element.autoResize",{elements:e,target:t});if(n){var i=this._getOptimalBounds(e,t);if(q2(i,t)){var r=Y2(ni(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},zi.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},zi.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},zi.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function q2(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function Y2(e,t){var n="";return e=Te(e),t=Te(t),e.top>t.top&&(n=n.concat("n")),e.right<t.right&&(n=n.concat("w")),e.bottom<t.bottom&&(n=n.concat("s")),e.left>t.left&&(n=n.concat("e")),n}function ou(e){e.invoke(zi,this)}ou.$inject=["injector"],ye(ou,zi),ou.prototype.resize=function(e,t,n){w(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function ja(e){Yn.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}ja.$inject=["eventBus"],ye(ja,Yn),ja.prototype.canResize=function(e,t){return!1};function au(e,t){ja.call(this,e),this._modeling=t}ye(au,ja),au.$inject=["eventBus","modeling"],au.prototype.canResize=function(e,t){if(w(t.di,"bpmndi:BPMNPlane")||!w(t,"bpmn:Participant")&&!w(t,"bpmn:Lane")&&!w(t,"bpmn:SubProcess"))return!1;var n=!0;return I(e,function(i){if(w(i,"bpmn:Lane")||ze(i)){n=!1;return}}),n};const K2={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",ou],bpmnAutoResizeProvider:["type",au]};function No(e,t,n){this._canvas=n,this._opts=z({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var i=this;t.on("drag.move",function(r){var o=i._toBorderPoint(r);i.startScroll(o)}),t.on(["drag.cleanup"],function(){i.stopScroll()})}No.$inject=["config.autoScroll","eventBus","canvas"],No.prototype.startScroll=function(e){var t=this._canvas,n=this._opts,i=this,r=t.getContainer().getBoundingClientRect(),o=[e.x,e.y,r.width-e.x,r.height-e.y];this.stopScroll();for(var a=0,s=0,c=0;c<4;c++)X2(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 X2(e,t,n){return t<e&&e<n}No.prototype.stopScroll=function(){clearTimeout(this._scrolling)},No.prototype.setOptions=function(e){this._opts=z({},this._opts,e)},No.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Br(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const Z2={__depends__:[Bi],__init__:["autoScroll"],autoScroll:["type",No]};var Zb="djs-bendpoint",Qb="djs-segment-dragger";function Q2(e,t){var n=Br(t),i=e._container.getBoundingClientRect(),r;r={x:i.left,y:i.top};var o=e.viewbox();return{x:o.x+(n.x-r.x)/o.scale,y:o.y+(n.y-r.y)/o.scale}}function Mf(e,t,n){var i=Q2(e,n),r=Yl(t,i);return r}function kf(e,t){var n=Ce("g");Xe(n).add(Zb),Fe(e,n);var i=Ce("circle");ve(i,{cx:0,cy:0,r:4}),Xe(i).add("djs-visual"),Fe(n,i);var r=Ce("circle");return ve(r,{cx:0,cy:0,r:10}),Xe(r).add("djs-hit"),Fe(n,r),t&&Xe(n).add(t),n}function J2(e,t,n,i){var r=Ce("g");Fe(e,r);var o=18,a=6,s=11,c=tk(t,n,i),u=a+s,l=Ce("rect");ve(l,{x:-o/2,y:-a/2,width:o,height:a}),Xe(l).add("djs-visual"),Fe(r,l);var f=Ce("rect");return ve(f,{x:-c/2,y:-u/2,width:c,height:u}),Xe(f).add("djs-hit"),Fe(r,f),Rm(r,i==="v"?90:0),r}function Jb(e,t,n){var i=Ce("g"),r=El(t,n),o=Mi(t,n);return Fe(e,i),J2(i,t,n,o),Xe(i).add(Qb),Xe(i).add(o==="h"?"horizontal":"vertical"),nn(i,r.x,r.y),i}function Of(e){return Math.abs(Math.round(e*2/3))}function ek(e,t){var n=nk(e,t);return ep(e,n)}function tk(e,t,n){var i=t.x-e.x,r=t.y-e.y;return Of(n==="h"?i:r)}function nk(e,t){for(var n=t.waypoints,i=1/0,r,o=0;o<n.length-1;o++){var a=n[o],s=n[o+1],c=pg(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function e_(e,t,n,i,r){function o(x,S,P){var C=x.index,D=x.point,T,$,k,O,j,se;return C<=0||x.bendpoint?!1:(T=S[C-1],$=S[C],k=El(T,$),O=Mi(T,$),j=Math.abs(D.x-k.x),se=Math.abs(D.y-k.y),O&&j<=P&&se<=P)}function a(x,S){var P=x.waypoints,C,D,T,$;return S.index<=0||S.bendpoint||(C={start:P[S.index-1],end:P[S.index]},D=Mi(C.start,C.end),!D)?null:(D==="h"?T=C.end.x-C.start.x:T=C.end.y-C.start.y,$=Of(T)/2,$)}function s(x,S){var P=S.waypoints,C=Mf(t,P,x),D;if(C){D=a(S,C);var T;if(o(C,P,D)?T=r.start(x,S,C.index):T=i.start(x,S,C.index,!C.bendpoint),T!==!1)return!0}}function c(x,S,P){Ne.bind(x,S,function(C){n.triggerMouseEvent(S,C,P),C.stopPropagation()})}function u(x,S){var P=t.getLayer("overlays"),C=ot('.djs-bendpoints[data-element-id="'+La(x.id)+'"]',P);return!C&&S&&(C=Ce("g"),ve(C,{"data-element-id":x.id}),Xe(C).add("djs-bendpoints"),Fe(P,C),c(C,"mousedown",x),c(C,"click",x),c(C,"dblclick",x)),C}function l(x,S){return ot('.djs-segment-dragger[data-segment-idx="'+x+'"]',S)}function f(x,S){S.waypoints.forEach(function(P,C){var D=kf(x);Fe(x,D),nn(D,P.x,P.y)}),kf(x,"floating")}function p(x,S){for(var P=S.waypoints,C,D,T,$=1;$<P.length;$++)C=P[$-1],D=P[$],Mi(C,D)&&(T=Jb(x,C,D),ve(T,{"data-segment-idx":$}),c(T,"mousemove",S))}function d(x){I(Es("."+Zb,x),function(S){zt(S)})}function g(x){I(Es("."+Qb,x),function(S){zt(S)})}function h(x){var S=u(x);return S||(S=u(x,!0),f(S,x),p(S,x)),S}function m(x){var S=u(x);S&&(g(S),d(S),p(S,x),f(S,x))}function _(x,S){var P=ot(".floating",x),C=S.point;P&&(nn(P,C.x,C.y),Xe(P).add("positioned"))}function y(x,S,P){var C=l(S.index,x),D=P[S.index-1],T=P[S.index],$=S.point,k=El(D,T),O=Mi(D,T),j,se;C&&(j=ik(C),se={x:$.x-k.x,y:$.y-k.y},O==="v"&&(se={x:se.y,y:se.x}),nn(j,se.x,se.y))}e.on("connection.changed",function(x){m(x.element)}),e.on("connection.remove",function(x){var S=u(x.element);S&&zt(S)}),e.on("element.marker.update",function(x){var S=x.element,P;S.waypoints&&(P=h(S),x.add?Xe(P).add(x.marker):Xe(P).remove(x.marker))}),e.on("element.mousemove",function(x){var S=x.element,P=S.waypoints,C,D;if(P){if(C=u(S,!0),D=Mf(t,P,x.originalEvent),!D)return;_(C,D),D.bendpoint||y(C,D,P)}}),e.on("element.mousedown",function(x){if(sr(x)){var S=x.originalEvent,P=x.element;if(P.waypoints)return s(S,P)}}),e.on("selection.changed",function(x){var S=x.newSelection,P=S[0];P&&P.waypoints&&h(P)}),e.on("element.hover",function(x){var S=x.element;S.waypoints&&h(S)}),e.on("element.out",function(x){var S=x.element;if(S.waypoints){var P=u(S);if(P){var C=ot(".floating",P);C&&Xe(C).remove("positioned")}}}),e.on("element.updateId",function(x){var S=x.element,P=x.newId;if(S.waypoints){var C=u(S);C&&ve(C,{"data-element-id":P})}}),this.addHandles=h,this.updateHandles=m,this.getBendpointsContainer=u,this.getSegmentDragger=l}e_.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function ik(e){return ot(".djs-visual",e)}var t_=Math.round,Vr="reconnectStart",Wr="reconnectEnd",Ha="updateWaypoints";function Df(e,t,n,i,r,o){this._injector=e,this.start=function(a,s,c,u){var l=n.getGraphics(s),f=s.source,p=s.target,d=s.waypoints,g;!u&&c===0?g=Vr:!u&&c===d.length-1?g=Wr:g=Ha;var h=g===Ha?"connection.updateWaypoints":"connection.reconnect",m=r.allowed(h,{connection:s,source:f,target:p});if(m===!1&&(m=r.allowed(h,{connection:s,source:p,target:f})),m!==!1)return i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:l,context:{allowed:m,bendpointIndex:c,connection:s,source:f,target:p,insert:u,type:g}}})},t.on("bendpoint.move.hover",function(a){var s=a.context,c=s.connection,u=c.source,l=c.target,f=a.hover,p=s.type;s.hover=f;var d;if(f){var g=p===Ha?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(g,{connection:c,source:p===Vr?f:u,target:p===Wr?f:l}),d){s.source=p===Vr?f:u,s.target=p===Wr?f:l;return}d===!1&&(d=s.allowed=r.allowed(g,{connection:c,source:p===Wr?f:l,target:p===Vr?f:u})),d&&(s.source=p===Wr?f:l,s.target=p===Vr?f:u)}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(a){var s=a.context,c=s.type;s.hover=null,s.source=null,s.target=null,c!==Ha&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(a){var s=a.context,c=s.allowed,u=s.bendpointIndex,l=s.connection,f=s.insert,p=l.waypoints.slice(),d=s.source,g=s.target,h=s.type,m=s.hints||{},_={x:t_(a.x),y:t_(a.y)};if(!c)return!1;h===Ha?(f?p.splice(u,0,_):p[u]=_,m.bendpointMove={insert:f,bendpointIndex:u},p=this.cropWaypoints(l,p),o.updateWaypoints(l,_S(p),m)):(h===Vr?(m.docking="source",su(s)&&(m.docking="target",m.newWaypoints=p.reverse())):h===Wr&&(m.docking="target",su(s)&&(m.docking="source",m.newWaypoints=p.reverse())),o.reconnect(l,d,g,_,m))},this)}Df.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],Df.prototype.cropWaypoints=function(e,t){var n=this._injector.get("connectionDocking",!1);if(!n)return t;var i=e.waypoints;return e.waypoints=t,e.waypoints=n.getCroppedWaypoints(e),t=e.waypoints,e.waypoints=i,t};function su(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===Vr)return t&&i&&t===i&&n!==i;if(r===Wr)return t&&n&&t===n&&n!==i}var rk="reconnectStart",ok="reconnectEnd",n_="updateWaypoints",za="connect-ok",cu="connect-not-ok",i_="connect-hover",r_="djs-updating",o_="djs-dragging",a_=1100;function s_(e,t,n,i){this._injector=t;var r=t.get("connectionPreview",!1);n.on("bendpoint.move.start",function(o){var a=o.context,s=a.bendpointIndex,c=a.connection,u=a.insert,l=c.waypoints,f=l.slice();a.waypoints=l,u&&f.splice(s,0,{x:o.x,y:o.y}),c.waypoints=f;var p=a.draggerGfx=kf(i.getLayer("overlays"));Xe(p).add("djs-dragging"),i.addMarker(c,o_),i.addMarker(c,r_)}),n.on("bendpoint.move.hover",function(o){var a=o.context,s=a.allowed,c=a.hover,u=a.type;if(c){if(i.addMarker(c,i_),u===n_)return;s?(i.removeMarker(c,cu),i.addMarker(c,za)):s===!1&&(i.removeMarker(c,za),i.addMarker(c,cu))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],a_,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,i_),i.removeMarker(s,c?za:cu))}),n.on("bendpoint.move.move",function(o){var a=o.context,s=a.allowed,c=a.bendpointIndex,u=a.draggerGfx,l=a.hover,f=a.type,p=a.connection,d=p.source,g=p.target,h=p.waypoints.slice(),m={x:o.x,y:o.y},_=a.hints||{},y={};r&&(_.connectionStart&&(y.connectionStart=_.connectionStart),_.connectionEnd&&(y.connectionEnd=_.connectionEnd),f===rk?su(a)?(y.connectionEnd=y.connectionEnd||m,y.source=g,y.target=l||d,h=h.reverse()):(y.connectionStart=y.connectionStart||m,y.source=l||d,y.target=g):f===ok?su(a)?(y.connectionStart=y.connectionStart||m,y.source=l||g,y.target=d,h=h.reverse()):(y.connectionEnd=y.connectionEnd||m,y.source=d,y.target=l||g):(y.noCropping=!0,y.noLayout=!0,h[c]=m),f===n_&&(h=e.cropWaypoints(p,h)),y.waypoints=h,r.drawPreview(a,s,y)),nn(u,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],a_,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,u=a.hover,l=a.target,f=a.waypoints;s.waypoints=f,zt(c),i.removeMarker(s,r_),i.removeMarker(s,o_),u&&(i.removeMarker(u,za),i.removeMarker(u,l?za:cu)),r&&r.cleanUp(a)})}s_.$inject=["bendpointMove","injector","eventBus","canvas"];var c_="connect-hover",u_="djs-updating";function l_(e,t,n){return Lf(e,t,e[t]+n)}function Lf(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function ak(e,t,n,i){var r=Math.max(t[i],n[i]),o=Math.min(t[i],n[i]),a=20,s=Math.min(Math.max(o+a,e[i]),r-a);return Lf(t,i,s)}function p_(e){return e==="x"?"y":"x"}function f_(e,t,n){var i,r;return e.original?e.original:(i=Oe(t),r=p_(n),Lf(e,r,i[r]))}function d_(e,t,n,i,r,o){var a=e.get("connectionDocking",!1);this.start=function(f,p,d){var g,h=n.getGraphics(p),m=d-1,_=d,y=p.waypoints,x=y[m],S=y[_],P=Mf(n,y,f),C,D,T;if(C=Mi(x,S),!!C)return D=C==="v"?"x":"y",m===0&&(x=f_(x,p.source,D)),_===y.length-1&&(S=f_(S,p.target,D)),P?T=P.point:T={x:(x.x+S.x)/2,y:(x.y+S.y)/2},g={connection:p,segmentStartIndex:m,segmentEndIndex:_,segmentStart:x,segmentEnd:S,axis:D,dragPosition:T},i.init(f,T,"connectionSegment.move",{cursor:D==="x"?"resize-ew":"resize-ns",data:{connection:p,connectionGfx:h,context:g}})};function s(f,p){if(!a)return p;var d=f.waypoints,g;return f.waypoints=p,g=a.getCroppedWaypoints(f),f.waypoints=d,g}function c(f){r.update("connection",f.connection,f.connectionGfx)}function u(f,p,d){var g=f.newWaypoints,h=f.segmentStartIndex+p,m=g[h],_=f.segmentEndIndex+p,y=g[_],x=p_(f.axis),S=ak(d,m,y,x);nn(f.draggerGfx,S.x,S.y)}function l(f,p){var d=0,g=f.filter(function(h,m){return wl(f[m-1],f[m+1],h)?(d=m<=p?d-1:d,!1):!0});return{waypoints:g,segmentOffset:d}}t.on("connectionSegment.move.start",function(f){var p=f.context,d=f.connection,g=n.getLayer("overlays");p.originalWaypoints=d.waypoints.slice(),p.draggerGfx=Jb(g,p.segmentStart,p.segmentEnd),Xe(p.draggerGfx).add("djs-dragging"),n.addMarker(d,u_)}),t.on("connectionSegment.move.move",function(f){var p=f.context,d=p.connection,g=p.segmentStartIndex,h=p.segmentEndIndex,m=p.segmentStart,_=p.segmentEnd,y=p.axis,x=p.originalWaypoints.slice(),S=l_(m,y,f["d"+y]),P=l_(_,y,f["d"+y]),C=x.length,D=0;x[g]=S,x[h]=P;var T,$;g<2&&(T=tn(d.source,S),g===1?T==="intersect"&&(x.shift(),x[0]=S,D--):T!=="intersect"&&(x.unshift(m),D++)),h>C-3&&($=tn(d.target,P),h===C-2?$==="intersect"&&(x.pop(),x[x.length-1]=P):$!=="intersect"&&x.push(_)),p.newWaypoints=d.waypoints=s(d,x),u(p,D,f),p.newSegmentStartIndex=g+D,c(f)}),t.on("connectionSegment.move.hover",function(f){f.context.hover=f.hover,n.addMarker(f.hover,c_)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(f){var p=f.context.hover;p&&n.removeMarker(p,c_)}),t.on("connectionSegment.move.cleanup",function(f){var p=f.context,d=p.connection;p.draggerGfx&&zt(p.draggerGfx),n.removeMarker(d,u_)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(f){var p=f.context,d=p.connection;d.waypoints=p.originalWaypoints,c(f)}),t.on("connectionSegment.move.end",function(f){var p=f.context,d=p.connection,g=p.newWaypoints,h=p.newSegmentStartIndex;g=g.map(function(P){return{original:P.original,x:Math.round(P.x),y:Math.round(P.y)}});var m=l(g,h),_=m.waypoints,y=s(d,_),x=m.segmentOffset,S={segmentMove:{segmentStartIndex:p.segmentStartIndex,newSegmentStartIndex:h+x}};o.updateWaypoints(d,y,S)})}d_.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var sk=Math.abs,h_=Math.round;function ck(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],sk(r-e)<=n)return r}function m_(e){return{x:e.x,y:e.y}}function g_(e){return{x:e.x+e.width,y:e.y+e.height}}function Qn(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:h_(e.x+e.width/2),y:h_(e.y+e.height/2)}}function $o(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function It(e,t,n){if(typeof t!="string")throw new Error("axis must be in [x, y]");if(typeof n!="number"&&n!==!1)throw new Error("value must be Number or false");var i,r=e[t],o=e.snapped=e.snapped||{};return n===!1?o[t]=!1:(o[t]=!0,i=n-r,e[t]+=i,e["d"+t]+=i),r}function y_(e){return e.children||[]}var uk=Math.abs,v_=Math.round,If=10;function b_(e){function t(o,a){if(ke(o)){for(var s=o.length;s--;)if(uk(o[s]-a)<=If)return o[s]}else{o=+o;var c=a%o;if(c<If)return a-c;if(c>o-If)return a-c+o}return a}function n(o,a){if(o.waypoints)return ek(a,o);if(o.width)return{x:v_(o.width/2+o.x),y:v_(o.height/2+o.y)}}function i(o){var a=o.context,s=a.snapPoints,c=a.connection,u=c.waypoints,l=a.segmentStart,f=a.segmentStartIndex,p=a.segmentEnd,d=a.segmentEndIndex,g=a.axis;if(s)return s;var h=[u[f-1],l,p,u[d+1]];return f<2&&h.unshift(n(c.source,o)),d>u.length-3&&h.unshift(n(c.target,o)),a.snapPoints=s={horizontal:[],vertical:[]},I(h,function(m){m&&(m=m.original||m,g==="y"&&s.horizontal.push(m.y),g==="x"&&s.vertical.push(m.x))}),s}e.on("connectionSegment.move.move",1500,function(o){var a=i(o),s=o.x,c=o.y,u,l;if(a){u=t(a.vertical,s),l=t(a.horizontal,c);var f=s-u,p=c-l;z(o,{dx:o.dx-f,dy:o.dy-p,x:u,y:l}),(f||a.vertical.indexOf(s)!==-1)&&It(o,"x",u),(p||a.horizontal.indexOf(c)!==-1)&&It(o,"y",l)}});function r(o){var a=o.snapPoints,s=o.connection.waypoints,c=o.bendpointIndex;if(a)return a;var u=[s[c-1],s[c+1]];return o.snapPoints=a={horizontal:[],vertical:[]},I(u,function(l){l&&(l=l.original||l,a.horizontal.push(l.y),a.vertical.push(l.x))}),a}e.on(["connect.hover","connect.move","connect.end"],1500,function(o){var a=o.context,s=a.hover,c=s&&n(s,o);!at(s)||!c||!c.x||!c.y||(It(o,"x",c.x),It(o,"y",c.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(o){var a=o.context,s=r(a),c=a.hover,u=c&&n(c,o),l=o.x,f=o.y,p,d;if(s){p=t(u?s.vertical.concat([u.x]):s.vertical,l),d=t(u?s.horizontal.concat([u.y]):s.horizontal,f);var g=l-p,h=f-d;z(o,{dx:o.dx-g,dy:o.dy-h,x:o.x-g,y:o.y-h}),(g||s.vertical.indexOf(l)!==-1)&&It(o,"x",p),(h||s.horizontal.indexOf(f)!==-1)&&It(o,"y",d)}})}b_.$inject=["eventBus"];const lk={__depends__:[Bi,bi],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",e_],bendpointMove:["type",Df],bendpointMovePreview:["type",s_],connectionSegmentMove:["type",d_],bendpointSnapping:["type",b_]};function __(e,t,n,i){function r(a,s){return i.allowed("connection.create",{source:a,target:s})}function o(a,s){return r(s,a)}e.on("connect.hover",function(a){var s=a.context,c=s.start,u=a.hover,l;if(s.hover=u,l=s.canExecute=r(c,u),!Zr(l)){if(l!==!1){s.source=c,s.target=u;return}l=s.canExecute=o(c,u),!Zr(l)&&l!==!1&&(s.source=u,s.target=c)}}),e.on(["connect.out","connect.cleanup"],function(a){var s=a.context;s.hover=null,s.source=null,s.target=null,s.canExecute=!1}),e.on("connect.end",function(a){var s=a.context,c=s.canExecute,u=s.connectionStart,l={x:a.x,y:a.y},f=s.source,p=s.target;if(!c)return!1;var d=null,g={connectionStart:Bf(s)?l:u,connectionEnd:Bf(s)?u:l};Ut(c)&&(d=c),s.connection=n.connect(f,p,d,g)}),this.start=function(a,s,c,u){Ut(c)||(u=c,c=Oe(s)),t.init(a,"connect",{autoActivate:u,data:{shape:s,context:{start:s,connectionStart:c}}})}}__.$inject=["eventBus","dragging","modeling","rules"];function Bf(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var pk=1100,fk=900,x_="connect-ok",w_="connect-not-ok";function E_(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",function(r){var o=r.context,a=o.canExecute,s=o.hover,c=o.source,u=o.start,l=o.startPosition,f=o.target,p=o.connectionStart||l,d=o.connectionEnd||{x:r.x,y:r.y},g=p,h=d;Bf(o)&&(g=d,h=p),i.drawPreview(o,a,{source:c||u,target:f||s,connectionStart:g,connectionEnd:h})}),t.on("connect.hover",fk,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?x_:w_)}),t.on(["connect.out","connect.cleanup"],pk,function(r){var o=r.hover;o&&(n.removeMarker(o,x_),n.removeMarker(o,w_))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}E_.$inject=["injector","eventBus","canvas"];const Nf={__depends__:[Kn,bi,Bi],__init__:["connectPreview"],connect:["type",__],connectPreview:["type",E_]};var dk="djs-dragger";function Gi(e,t,n,i){this._canvas=t,this._graphicsFactory=n,this._elementFactory=i,this._connectionDocking=e.get("connectionDocking",!1),this._layouter=e.get("layouter",!1)}Gi.$inject=["injector","canvas","graphicsFactory","elementFactory"],Gi.prototype.drawPreview=function(e,t,n){n=n||{};var i=e.connectionPreviewGfx,r=e.getConnection,o=n.source,a=n.target,s=n.waypoints,c=n.connectionStart,u=n.connectionEnd,l=n.noLayout,f=n.noCropping,p=n.noNoop,d,g=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),Ss(i),r||(r=e.getConnection=hk(function(h,m,_){return g.getConnection(h,m,_)})),t&&(d=r(t,o,a)),!d){!p&&this.drawNoopPreview(i,n);return}d.waypoints=s||[],this._layouter&&!l&&(d.waypoints=this._layouter.layoutConnection(d,{source:o,target:a,connectionStart:c,connectionEnd:u,waypoints:n.waypoints||d.waypoints})),(!d.waypoints||!d.waypoints.length)&&(d.waypoints=[o?Oe(o):c,a?Oe(a):u]),this._connectionDocking&&(o||a)&&!f&&(d.waypoints=this._connectionDocking.getCroppedWaypoints(d,o,a)),this._graphicsFactory.drawConnection(i,d,{stroke:"var(--element-dragger-color)"})},Gi.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||Oe(n),o=t.connectionEnd||Oe(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);Fe(e,s)},Gi.prototype.cropWaypoints=function(e,t,n,i){var r=this._graphicsFactory,o=n&&r.getShapePath(n),a=i&&r.getShapePath(i),s=r.getConnectionPath({waypoints:[e,t]});return e=n&&na(o,s,!0)||e,t=i&&na(a,s,!1)||t,[e,t]},Gi.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&zt(e.connectionPreviewGfx)},Gi.prototype.getConnection=function(e){var t=mk(e);return this._elementFactory.createConnection(t)},Gi.prototype.createConnectionPreviewGfx=function(){var e=Ce("g");return ve(e,{pointerEvents:"none"}),Xe(e).add(dk),Fe(this._canvas.getActiveLayer(),e),e},Gi.prototype.createNoopConnection=function(e,t){return Qo([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function hk(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 mk(e){return Ut(e)?e:{}}const gk={__init__:["connectionPreview"],connectionPreview:["type",Gi]},uu="complex-preview";class S_{constructor(t,n,i){this._canvas=t,this._graphicsFactory=n,this._previewSupport=i,this._markers=[]}create(t){this.cleanUp();const{created:n=[],moved:i=[],removed:r=[],resized:o=[]}=t,a=this._canvas.getLayer(uu);n.filter(s=>!yk(s)).forEach(s=>{let c;at(s)?(c=this._graphicsFactory._createContainer("connection",Ce("g")),this._graphicsFactory.drawConnection(Dr(c),s)):(c=this._graphicsFactory._createContainer("shape",Ce("g")),this._graphicsFactory.drawShape(Dr(c),s),nn(c,s.x,s.y)),this._previewSupport.addDragger(s,a,c)}),i.forEach(({element:s,delta:c})=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"]);const u=this._previewSupport.addDragger(s,a);at(s)?nn(u,c.x,c.y):nn(u,s.x+c.x,s.y+c.y)}),r.forEach(s=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"])}),o.forEach(({shape:s,bounds:c})=>{this._canvas.addMarker(s,"djs-hidden"),this._markers.push([s,"djs-hidden"]),this._previewSupport.addDragger(s,a,void 0,"djs-dragging");const u=this._graphicsFactory._createContainer("shape",Ce("g"));this._graphicsFactory.drawShape(Dr(u),s,{width:c.width,height:c.height}),nn(u,c.x,c.y),this._previewSupport.addDragger(s,a,u)})}cleanUp(){Ss(this._canvas.getLayer(uu)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(uu)}hide(){this._canvas.hideLayer(uu)}}S_.$inject=["canvas","graphicsFactory","previewSupport"];function yk(e){return e.hidden}const vk={__depends__:[Ao],__init__:["complexPreview"],complexPreview:["type",S_]},R_=Math.round;function lu(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}lu.prototype.create=function(e,t,n){const i=this._complexPreview,r=this._connectionDocking,o=this._elementFactory,a=this._eventBus,s=this._layouter,c=this._rules,u=o.createShape(z({type:t},n)),l=a.fire("autoPlace",{source:e,shape:u});if(!l)return;z(u,{x:l.x-R_(u.width/2),y:l.y-R_(u.height/2)});const f=c.allowed("connection.create",{source:e,target:u,hints:{targetParent:e.parent}});let p=null;f&&(p=o.createConnection(f),p.waypoints=s.layoutConnection(p,{source:e,target:u}),p.waypoints=r.getCroppedWaypoints(p,e,u)),i.create({created:[u,p].filter(d=>!Zr(d))})},lu.prototype.cleanUp=function(){this._complexPreview.cleanUp()},lu.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const bk={__depends__:[Nc,vk,uf],__init__:["appendPreview"],appendPreview:["type",lu]};var C_=Math.min,P_=Math.max;function $f(e){e.preventDefault()}function Ga(e){e.stopPropagation()}function _k(e){return e.nodeType===Node.TEXT_NODE}function xk(e){return[].slice.call(e)}function ai(e){this.container=e.container,this.parent=mt('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=ot("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=bn(this.autoResize,this),this.handlePaste=bn(this.handlePaste,this)}ai.prototype.create=function(e,t,n,i){var r=this,o=this.parent,a=this.content,s=this.container;i=this.options=i||{},t=this.style=t||{};var c=ni(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);z(o.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},c);var u=ni(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return z(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},u),i.centerVertically&&z(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},u),a.innerText=n,Ne.bind(a,"keydown",this.keyHandler),Ne.bind(a,"mousedown",Ga),Ne.bind(a,"paste",r.handlePaste),Ne.bind(a,"focusout",this.focusoutHandler),i.autoResize&&Ne.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},ai.prototype.handlePaste=function(e){var t=this.options,n=this.style;e.preventDefault();var i;if(e.clipboardData?i=e.clipboardData.getData("text/plain"):i=window.clipboardData.getData("Text"),this.insertText(i),t.autoResize){var r=this.autoResize(n);r&&this.resizeHandler(r)}},ai.prototype.insertText=function(e){e=wk(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},ai.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=xk(a.childNodes),c,u;if(_k(a)){var l=n.textContent;n.textContent=l.substring(0,r)+e+l.substring(o),c=n,u=r+e.length}else if(n===this.content&&i===this.content){var f=document.createTextNode(e);this.content.insertBefore(f,s[r]),c=f,u=f.textContent.length}else{var p=s.indexOf(n),d=s.indexOf(i);s.forEach(function(g,h){h===p?g.textContent=n.textContent.substring(0,r)+e+i.textContent.substring(o):h>p&&h<=d&&di(g)}),c=n,u=r+e.length}c&&u!==void 0&&setTimeout(function(){self.setSelection(c,u)})},ai.prototype.autoResize=function(){var e=this.parent,t=this.content,n=parseInt(this.style.fontSize)||12;if(t.scrollHeight>e.offsetHeight||t.scrollHeight<e.offsetHeight-n){var i=e.getBoundingClientRect(),r=t.scrollHeight;e.style.height=r+"px",this.resizeHandler({width:i.width,height:i.height,dx:0,dy:r-i.height})}},ai.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,i=parseInt(this.style.minWidth)||0,r=parseInt(this.style.minHeight)||0,o=parseInt(this.style.maxWidth)||1/0,a=parseInt(this.style.maxHeight)||1/0;if(!n){n=this.resizeHandle=mt('<div class="djs-direct-editing-resize-handle"></div>');var s,c,u,l,f=function(g){$f(g),Ga(g),s=g.clientX,c=g.clientY;var h=t.getBoundingClientRect();u=h.width,l=h.height,Ne.bind(document,"mousemove",p),Ne.bind(document,"mouseup",d)},p=function(g){$f(g),Ga(g);var h=C_(P_(u+g.clientX-s,i),o),m=C_(P_(l+g.clientY-c,r),a);t.style.width=h+"px",t.style.height=m+"px",e.resizeHandler({width:u,height:l,dx:g.clientX-s,dy:g.clientY-c})},d=function(g){$f(g),Ga(g),Ne.unbind(document,"mousemove",p,!1),Ne.unbind(document,"mouseup",d,!1)};Ne.bind(n,"mousedown",f)}z(n.style,{position:"absolute",bottom:"0px",right:"0px",cursor:"nwse-resize",width:"0",height:"0",borderTop:(parseInt(this.style.fontSize)/4||3)+"px solid transparent",borderRight:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderBottom:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderLeft:(parseInt(this.style.fontSize)/4||3)+"px solid transparent"}),t.appendChild(n)},ai.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),Ne.unbind(t,"keydown",this.keyHandler),Ne.unbind(t,"mousedown",Ga),Ne.unbind(t,"input",this.autoResize),Ne.unbind(t,"paste",this.handlePaste),Ne.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),di(n)),di(e)},ai.prototype.getValue=function(){return this.content.innerText.trim()},ai.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},ai.prototype.setSelection=function(e,t){var n=document.createRange();e===null?n.selectNodeContents(this.content):(n.setStart(e,t),n.setEnd(e,t));var i=window.getSelection();i.removeAllRanges(),i.addRange(n)};function wk(e){return e.replace(/\r\n|\r|\n/g,`
|
|
316
|
+
`)}function Ln(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new ai({container:t.getContainer(),keyHandler:bn(this._handleKey,this),resizeHandler:bn(this._handleResize,this),focusoutHandler:bn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}Ln.$inject=["eventBus","canvas"],Ln.prototype.registerProvider=function(e){this._providers.push(e)},Ln.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},Ln.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},Ln.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},Ln.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},Ln.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},Ln.prototype.complete=function(){var e=this._active;if(e){var t,n=e.context.bounds,i=this.$textbox.getBoundingClientRect(),r=this.getValue(),o=e.context.text;(r!==o||i.height!==n.height||i.width!==n.width)&&(t=this._textbox.container.getBoundingClientRect(),e.provider.update(e.element,r,e.context.text,{x:i.left-t.left,y:i.top-t.top,width:i.width,height:i.height})),this._fire("complete"),this.close()}},Ln.prototype.getValue=function(){return this._textbox.getValue()},Ln.prototype._handleKey=function(e){e.stopPropagation();var t=e.keyCode||e.charCode;if(t===27)return e.preventDefault(),this.cancel();if(t===13&&!e.shiftKey)return e.preventDefault(),this.complete()},Ln.prototype._handleResize=function(e){this._fire("resize",e)},Ln.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},Ln.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=lt(this._providers,function(i){return(t=i.activate(e))?i:null});return t&&(this.$textbox=this._textbox.create(t.bounds,t.style,t.text,t.options),this._active={element:e,context:t,provider:n},t.options&&t.options.resizable&&(this.resizable=!0),this._fire("activate")),!!t};const A_={__depends__:[dc],__init__:["directEditing"],directEditing:["type",Ln]};function Ek(e){return function(t){var n=t.target,i=ie(e),r=i.eventDefinitions&&i.eventDefinitions[0],o=i.$type===n.type,a=(r&&r.$type)===n.eventDefinitionType,s=!!n.triggeredByEvent==!!i.triggeredByEvent,c=n.isExpanded===void 0||n.isExpanded===Ye(e);return!o||!a||!s||!c}}const Sk={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 ee(e,t={}){var n=Sk[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var Rk=[ee("none-start-event",{actionName:"replace-with-none-start"}),ee("none-intermediate-throwing"),ee("none-end-event",{actionName:"replace-with-none-end"}),ee("message-start"),ee("timer-start"),ee("conditional-start"),ee("signal-start")],Ck=[ee("none-start-event",{actionName:"replace-with-none-start"}),ee("none-intermediate-throwing"),ee("none-end-event",{actionName:"replace-with-none-end"})],Pk=[ee("none-start-event",{actionName:"replace-with-none-start"}),ee("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),ee("none-end-event",{actionName:"replace-with-none-end"}),ee("message-intermediate-catch"),ee("message-intermediate-throw"),ee("timer-intermediate-catch"),ee("escalation-intermediate-throw"),ee("conditional-intermediate-catch"),ee("link-intermediate-catch"),ee("link-intermediate-throw"),ee("compensation-intermediate-throw"),ee("signal-intermediate-catch"),ee("signal-intermediate-throw")],Ak=[ee("none-start-event",{actionName:"replace-with-none-start"}),ee("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),ee("none-end-event",{actionName:"replace-with-none-end"}),ee("message-end"),ee("escalation-end"),ee("error-end"),ee("cancel-end"),ee("compensation-end"),ee("signal-end"),ee("terminate-end")],Tk=[ee("exclusive-gateway"),ee("parallel-gateway"),ee("inclusive-gateway"),ee("complex-gateway"),ee("event-based-gateway")],Mk=[ee("transaction"),ee("event-subprocess"),ee("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),ee("collapsed-subprocess")],kk=[ee("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),ee("transaction"),ee("event-subprocess"),ee("collapsed-ad-hoc-subprocess")],T_=[ee("transaction"),ee("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),ee("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),ee("event-subprocess")],Ok=T_,M_=[ee("task"),ee("user-task"),ee("service-task"),ee("send-task"),ee("receive-task"),ee("manual-task"),ee("rule-task"),ee("script-task"),ee("call-activity"),ee("collapsed-subprocess"),ee("expanded-subprocess"),ee("collapsed-ad-hoc-subprocess"),ee("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],Dk=[ee("data-store-reference")],Lk=[ee("data-object-reference")],Ik=[ee("message-boundary"),ee("timer-boundary"),ee("escalation-boundary"),ee("conditional-boundary"),ee("error-boundary"),ee("cancel-boundary"),ee("signal-boundary"),ee("compensation-boundary"),ee("non-interrupting-message-boundary"),ee("non-interrupting-timer-boundary"),ee("non-interrupting-escalation-boundary"),ee("non-interrupting-conditional-boundary"),ee("non-interrupting-signal-boundary")],Bk=[ee("message-start"),ee("timer-start"),ee("conditional-start"),ee("signal-start"),ee("error-start"),ee("escalation-start"),ee("compensation-start"),ee("non-interrupting-message-start"),ee("non-interrupting-timer-start"),ee("non-interrupting-conditional-start"),ee("non-interrupting-signal-start"),ee("non-interrupting-escalation-start")],Nk=[{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"}],$k=[ee("expanded-pool"),ee("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],Fk={"bpmn:MessageEventDefinition":[ee("message-start"),ee("message-intermediate-catch"),ee("message-intermediate-throw"),ee("message-end")],"bpmn:TimerEventDefinition":[ee("timer-start"),ee("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[ee("conditional-start"),ee("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[ee("signal-start"),ee("signal-intermediate-catch"),ee("signal-intermediate-throw"),ee("signal-end")],"bpmn:ErrorEventDefinition":[ee("error-start"),ee("error-end")],"bpmn:EscalationEventDefinition":[ee("escalation-start"),ee("escalation-intermediate-throw"),ee("escalation-end")],"bpmn:CompensateEventDefinition":[ee("compensation-start"),ee("compensation-intermediate-throw"),ee("compensation-end")]};const k_={"start-event-non-interrupting":`
|
|
317
317
|
<svg viewBox="0 0 2048 2048" xmlns="http://www.w3.org/2000/svg">
|
|
318
318
|
<g transform="translate(0 995.64)">
|
|
319
319
|
<path d="m1899 28.357c21.545 567.43-598.38 1023.5-1133.6 835.92-548.09-147.21-801.57-873.95-463.59-1330 302.62-480.3 1071.7-507.54 1407.6-49.847 122.14 153.12 190.07 348.07 189.59 543.91z" fill="none" stroke="currentColor" stroke-dasharray="418.310422, 361.2328165" stroke-linecap="round" stroke-width="100"/>
|
|
@@ -324,7 +324,7 @@
|
|
|
324
324
|
<circle cx="1024" cy="28.357" r="875" stroke-dasharray="418.310422, 361.2328165" stroke-width="100"/>
|
|
325
325
|
<circle cx="1024" cy="28.357" r="685" stroke-dasharray="348.31044857,261.23283643" stroke-dashoffset="500" stroke-width="100"/>
|
|
326
326
|
</g>
|
|
327
|
-
</svg>`};function Yn(e,t,n,i,r,o,a,s){this._bpmnFactory=e,this._popupMenu=t,this._modeling=n,this._moddle=i,this._bpmnReplace=r,this._rules=o,this._translate=a,this._moddleCopy=s,this._register()}Yn.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Yn.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Yn.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],r,o=[];if(ke(e)||!n.allowed("shape.replace",{element:e}))return{};var a=mk(e);return x(t,"bpmn:DataObjectReference")?this._createEntries(e,Rk):x(t,"bpmn:DataStoreReference")&&!x(e.parent,"bpmn:Collaboration")?this._createEntries(e,Ck):(x(t,"bpmn:Event")&&!x(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=kk[r]||[],!un(t.$parent)&&x(t.$parent,"bpmn:SubProcess")&&(i=Ge(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),x(t,"bpmn:StartEvent")&&!x(t.$parent,"bpmn:SubProcess")?(o=Ge(yk.concat(i),a),this._createEntries(e,o)):x(t,"bpmn:Participant")?(o=Ge(Mk,function(c){return Ue(e)!==c.target.isExpanded}),this._createEntries(e,o)):x(t,"bpmn:StartEvent")&&un(t.$parent)?(o=Ge(Ak.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)):x(t,"bpmn:StartEvent")&&!un(t.$parent)&&x(t.$parent,"bpmn:SubProcess")?(o=Ge(vk.concat(i),a),this._createEntries(e,o)):x(t,"bpmn:EndEvent")?(o=Ge(_k.concat(i),function(c){var u=c.target;return u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!x(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,o)):x(t,"bpmn:BoundaryEvent")?(o=Ge(Pk,function(c){var u=c.target;if(u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!x(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)):x(t,"bpmn:IntermediateCatchEvent")||x(t,"bpmn:IntermediateThrowEvent")?(o=Ge(bk.concat(i),a),this._createEntries(e,o)):x(t,"bpmn:Gateway")?(o=Ge(xk,a),this._createEntries(e,o)):x(t,"bpmn:Transaction")?(o=Ge(R_,a),this._createEntries(e,o)):un(t)&&Ue(e)?(o=Ge(Sk,a),this._createEntries(e,o)):x(t,"bpmn:AdHocSubProcess")&&Ue(e)?(o=Ge(Ek,a),this._createEntries(e,o)):x(t,"bpmn:SubProcess")&&Ue(e)?(o=Ge(wk,a),this._createEntries(e,o)):x(t,"bpmn:SubProcess")&&!Ue(e)?(o=Ge(C_,function(c){var u=c.target.type===e.type,l=c.target.isExpanded===!0;return u===l}),this._createEntries(e,o)):x(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,Tk):x(t,"bpmn:FlowNode")?(o=Ge(C_,a),this._createEntries(e,o)):{})},Yn.prototype.getPopupMenuHeaderEntries=function(e){var t={};return x(e,"bpmn:Activity")&&!un(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),x(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),x(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),wg(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Yn.prototype._createEntries=function(e,t){var n={},i=this;return L(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},Yn.prototype._createSequenceFlowEntries=function(e,t){var n=te(e),i={},r=this._modeling,o=this._moddle,a=this;return L(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(x(n.sourceRef,"bpmn:ExclusiveGateway")||x(n.sourceRef,"bpmn:InclusiveGateway")||x(n.sourceRef,"bpmn:ComplexGateway")||x(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&&x(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:x(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e,{conditionExpression:void 0})})}),(x(n.sourceRef,"bpmn:ExclusiveGateway")||x(n.sourceRef,"bpmn:InclusiveGateway")||x(n.sourceRef,"bpmn:ComplexGateway")||x(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e.source,{default:void 0})})})}}),i},Yn.prototype._createEntry=function(e,t,n){var i=this._translate,r=this._bpmnReplace.replaceElement,o=function(){return r(t,e.target)},a=e.label;return a&&typeof a=="function"&&(a=a(t)),n=n||o,{label:i(a),className:e.className,action:n}},Yn.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(u,l){if(l.active){t._modeling.updateProperties(e,{loopCharacteristics:void 0});return}var p=e.businessObject.get("loopCharacteristics");p&&x(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=te(e),o=r.loopCharacteristics,a,s,c;return o&&(a=o.isSequential,s=o.isSequential===void 0,c=o.isSequential!==void 0&&!o.isSequential),{"toggle-parallel-mi":{className:"bpmn-icon-parallel-mi-marker",title:n("Parallel multi-instance"),active:c,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!1}},"toggle-sequential-mi":{className:"bpmn-icon-sequential-mi-marker",title:n("Sequential multi-instance"),active:a,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!0}},"toggle-loop":{className:"bpmn-icon-loop-marker",title:n("Loop"),active:s,action:i,options:{loopCharacteristics:"bpmn:StandardLoopCharacteristics"}}}},Yn.prototype._getCollectionHeaderEntries=function(e){var t=this,n=this._translate,i=e.businessObject.dataObjectRef;if(!i)return{};function r(a,s){t._modeling.updateModdleProperties(e,i,{isCollection:!s.active})}var o=i.isCollection;return{"toggle-is-collection":{className:"bpmn-icon-parallel-mi-marker",title:n("Collection"),active:o,action:r}}},Yn.prototype._getParticipantMultiplicityHeaderEntries=function(e){var t=this,n=this._bpmnFactory,i=this._translate;function r(a,s){var c=s.active,u;c||(u=n.create("bpmn:ParticipantMultiplicity")),t._modeling.updateProperties(e,{participantMultiplicity:u})}var o=e.businessObject.participantMultiplicity;return{"toggle-participant-multiplicity":{className:"bpmn-icon-parallel-mi-marker",title:i("Participant multiplicity"),active:!!o,action:r}}},Yn.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=te(e),i=this,r=Eg(e),o=x(e,"bpmn:BoundaryEvent")?P_["intermediate-event-non-interrupting"]:P_["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 Ok={__depends__:[Pf,Gy,Nc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Yn]};function Va(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 g=d.context,h=g.shape;if(!(!ma(d)||!i.isOpen(h))){var m=i.getEntries(h);m.replace&&m.replace.action.click(d,h)}}),n.on("contextPad.close",function(){f.cleanUp()})}Va.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Va.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&H(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},Va.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return ke(t)?Cr(e,n=>t.includes(n)):t},Va.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,r=this._connect,o=this._create,a=this._popupMenu,s=this._autoPlace,c=this._translate,u=this._appendPreview,l={};if(e.type==="label")return this._isDeleteAllowed([e])&&H(l,g()),l;var p=e.businessObject;function f(_,S){r.start(_,S)}function d(_,S){n.removeElements([S])}function g(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function h(_){var S=5,P=t.getPad(_).html,C=P.getBoundingClientRect(),D={x:C.left,y:C.bottom+S};return D}function m(_,S,P,C){function D(k,O){var F=i.createShape(H({type:_},C));o.start(k,F,{source:O})}var T=s?function(k,O){var F=i.createShape(H({type:_},C));s.append(O,F)}:D,N=s?function(k,O){return u.create(O,_,C),()=>{u.cleanUp()}}:null;return{group:"model",className:S,title:P,action:{dragstart:D,click:T,hover:N}}}function w(_){return function(S,P){n.splitLane(P,_),t.open(P,!0)}}if(ze(p,["bpmn:Lane","bpmn:Participant"])&&Ue(e)){var y=ar(e);H(l,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(_,S){n.addLane(S,"top")}}}}),y.length<2&&((qt(e)?e.height>=120:e.width>=120)&&H(l,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:w(2)}}}),(qt(e)?e.height>=180:e.width>=180)&&H(l,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:w(3)}}})),H(l,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(_,S){n.addLane(S,"bottom")}}}})}return x(p,"bpmn:FlowNode")&&(x(p,"bpmn:EventBasedGateway")?H(l,{"append.receive-task":m("bpmn:ReceiveTask","bpmn-icon-receive-task",c("Append receive task")),"append.message-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):A_(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?H(l,{"append.compensation-activity":m("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!x(p,"bpmn:EndEvent")&&!p.isForCompensation&&!A_(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!un(p)&&H(l,{"append.end-event":m("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append end event")),"append.gateway":m("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append gateway")),"append.append-task":m("bpmn:Task","bpmn-icon-task",c("Append task")),"append.intermediate-event":m("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append intermediate/boundary event"))})),a.isEmpty(e,"bpmn-replace")||H(l,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(_,S){var P=H(h(S),{cursor:{x:_.x,y:_.y}});a.open(S,"bpmn-replace",P,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),x(p,"bpmn:SequenceFlow")&&H(l,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),x(p,"bpmn:MessageFlow")&&H(l,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),ze(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&H(l,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect to other element"),action:{click:f,dragstart:f}}}),x(p,"bpmn:TextAnnotation")&&H(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:f,dragstart:f}}}),ze(p,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&H(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:f,dragstart:f}}}),x(p,"bpmn:Group")&&H(l,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&H(l,g()),l};function A_(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return L(o,function(a){a.$type===n&&(r=!0)}),i&&r}const Dk={__depends__:[pk,S_,ib,Vn,If,hc,Ok],__init__:["contextPadProvider"],contextPadProvider:["type",Va]};var Lk={horizontal:["x","width"],vertical:["y","height"]},T_=5;function Vi(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return ke(i)?i:i?n:[]})}Vi.$inject=["modeling","rules"],Vi.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},Vi.prototype.trigger=function(e,t){var n=this._modeling,i,r;if(!(e.length<3)&&(this._setOrientation(t),r=this._filterElements(e),i=this._createGroups(r),!(i.length<=2)))return n.distributeElements(i,this._axis,this._dimension),i},Vi.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(L(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 L(o,function(a,s){var c=n._findRange(a,i,r),u,l=t[t.length-1];l&&n._hasIntersection(l.range,c)?t[t.length-1].elements.push(a):(u={range:c,elements:[a]},t.push(u))}),t},Vi.prototype._setOrientation=function(e){var t=Lk[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+T_,max:t+n-T_}};const Ik={__init__:["distributeElements"],distributeElements:["type",Vi]};function lu(e){Gn.call(this,e)}lu.$inject=["eventBus"],de(lu,Gn),lu.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=Ge(t,function(n){var i=ze(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=Cs(t),t.length<3?!1:t})};var M_={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
|
|
327
|
+
</svg>`};function Jn(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()}Jn.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Jn.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Jn.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],r,o=[];if(ke(e)||!n.allowed("shape.replace",{element:e}))return{};var a=Ek(e);return w(t,"bpmn:DataObjectReference")?this._createEntries(e,Dk):w(t,"bpmn:DataStoreReference")&&!w(e.parent,"bpmn:Collaboration")?this._createEntries(e,Lk):(w(t,"bpmn:Event")&&!w(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=Fk[r]||[],!pn(t.$parent)&&w(t.$parent,"bpmn:SubProcess")&&(i=Ue(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),w(t,"bpmn:StartEvent")&&!w(t.$parent,"bpmn:SubProcess")?(o=Ue(Rk.concat(i),a),this._createEntries(e,o)):w(t,"bpmn:Participant")?(o=Ue($k,function(c){return Ye(e)!==c.target.isExpanded}),this._createEntries(e,o)):w(t,"bpmn:StartEvent")&&pn(t.$parent)?(o=Ue(Bk.concat(i),function(c){var u=c.target,l=u.isInterrupting!==!1,f=t.isInterrupting===l;return a(c)||!a(c)&&!f}),this._createEntries(e,o)):w(t,"bpmn:StartEvent")&&!pn(t.$parent)&&w(t.$parent,"bpmn:SubProcess")?(o=Ue(Ck.concat(i),a),this._createEntries(e,o)):w(t,"bpmn:EndEvent")?(o=Ue(Ak.concat(i),function(c){var u=c.target;return u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!w(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,o)):w(t,"bpmn:BoundaryEvent")?(o=Ue(Ik,function(c){var u=c.target;if(u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!w(t.attachedToRef,"bpmn:Transaction"))return!1;var l=u.cancelActivity!==!1,f=t.cancelActivity==l;return a(c)||!a(c)&&!f}),this._createEntries(e,o)):w(t,"bpmn:IntermediateCatchEvent")||w(t,"bpmn:IntermediateThrowEvent")?(o=Ue(Pk.concat(i),a),this._createEntries(e,o)):w(t,"bpmn:Gateway")?(o=Ue(Tk,a),this._createEntries(e,o)):w(t,"bpmn:Transaction")?(o=Ue(T_,a),this._createEntries(e,o)):pn(t)&&Ye(e)?(o=Ue(Ok,a),this._createEntries(e,o)):w(t,"bpmn:AdHocSubProcess")&&Ye(e)?(o=Ue(kk,a),this._createEntries(e,o)):w(t,"bpmn:SubProcess")&&Ye(e)?(o=Ue(Mk,a),this._createEntries(e,o)):w(t,"bpmn:SubProcess")&&!Ye(e)?(o=Ue(M_,function(c){var u=c.target.type===e.type,l=c.target.isExpanded===!0;return u===l}),this._createEntries(e,o)):w(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,Nk):w(t,"bpmn:FlowNode")?(o=Ue(M_,a),this._createEntries(e,o)):{})},Jn.prototype.getPopupMenuHeaderEntries=function(e){var t={};return w(e,"bpmn:Activity")&&!pn(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),w(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),w(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),Cg(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Jn.prototype._createEntries=function(e,t){var n={},i=this;return I(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},Jn.prototype._createSequenceFlowEntries=function(e,t){var n=ie(e),i={},r=this._modeling,o=this._moddle,a=this;return I(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(w(n.sourceRef,"bpmn:ExclusiveGateway")||w(n.sourceRef,"bpmn:InclusiveGateway")||w(n.sourceRef,"bpmn:ComplexGateway")||w(n.sourceRef,"bpmn:Activity"))&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e.source,{default:n})})});break;case"replace-with-conditional-flow":!n.conditionExpression&&w(n.sourceRef,"bpmn:Activity")&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){var c=o.create("bpmn:FormalExpression",{body:""});r.updateProperties(e,{conditionExpression:c})})});break;default:w(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e,{conditionExpression:void 0})})}),(w(n.sourceRef,"bpmn:ExclusiveGateway")||w(n.sourceRef,"bpmn:InclusiveGateway")||w(n.sourceRef,"bpmn:ComplexGateway")||w(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e.source,{default:void 0})})})}}),i},Jn.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}},Jn.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(u,l){if(l.active){t._modeling.updateProperties(e,{loopCharacteristics:void 0});return}var f=e.businessObject.get("loopCharacteristics");f&&w(f,l.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,f,{isSequential:l.options.isSequential}):(f=t._moddle.create(l.options.loopCharacteristics,{isSequential:l.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:f}))}var r=ie(e),o=r.loopCharacteristics,a,s,c;return o&&(a=o.isSequential,s=o.isSequential===void 0,c=o.isSequential!==void 0&&!o.isSequential),{"toggle-parallel-mi":{className:"bpmn-icon-parallel-mi-marker",title:n("Parallel multi-instance"),active:c,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!1}},"toggle-sequential-mi":{className:"bpmn-icon-sequential-mi-marker",title:n("Sequential multi-instance"),active:a,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!0}},"toggle-loop":{className:"bpmn-icon-loop-marker",title:n("Loop"),active:s,action:i,options:{loopCharacteristics:"bpmn:StandardLoopCharacteristics"}}}},Jn.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}}},Jn.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}}},Jn.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=ie(e),i=this,r=Pg(e),o=w(e,"bpmn:BoundaryEvent")?k_["intermediate-event-non-interrupting"]:k_["start-event-non-interrupting"],a=!n[r];return{"toggle-non-interrupting":{imageHtml:o,title:t("Toggle non-interrupting"),active:a,action:function(){i._modeling.updateProperties(e,{[r]:!!a})}}}};const jk={__depends__:[Tf,qy,Nc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Jn]};function Va(e,t,n,i,r,o,a,s,c,u,l,f,p){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=r,this._elementFactory=o,this._connect=a,this._create=s,this._popupMenu=c,this._canvas=u,this._rules=l,this._translate=f,this._eventBus=n,this._appendPreview=p,e.autoPlace!==!1&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(d){var g=d.context,h=g.shape;if(!(!ma(d)||!i.isOpen(h))){var m=i.getEntries(h);m.replace&&m.replace.action.click(d,h)}}),n.on("contextPad.close",function(){p.cleanUp()})}Va.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Va.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&z(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},Va.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return ke(t)?Cr(e,n=>t.includes(n)):t},Va.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,r=this._connect,o=this._create,a=this._popupMenu,s=this._autoPlace,c=this._translate,u=this._appendPreview,l={};if(e.type==="label")return this._isDeleteAllowed([e])&&z(l,g()),l;var f=e.businessObject;function p(x,S){r.start(x,S)}function d(x,S){n.removeElements([S])}function g(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function h(x){var S=5,P=t.getPad(x).html,C=P.getBoundingClientRect(),D={x:C.left,y:C.bottom+S};return D}function m(x,S,P,C){function D(k,O){var j=i.createShape(z({type:x},C));o.start(k,j,{source:O})}var T=s?function(k,O){var j=i.createShape(z({type:x},C));s.append(O,j)}:D,$=s?function(k,O){return u.create(O,x,C),()=>{u.cleanUp()}}:null;return{group:"model",className:S,title:P,action:{dragstart:D,click:T,hover:$}}}function _(x){return function(S,P){n.splitLane(P,x),t.open(P,!0)}}if(We(f,["bpmn:Lane","bpmn:Participant"])&&Ye(e)){var y=or(e);z(l,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(x,S){n.addLane(S,"top")}}}}),y.length<2&&((Kt(e)?e.height>=120:e.width>=120)&&z(l,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:_(2)}}}),(Kt(e)?e.height>=180:e.width>=180)&&z(l,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:_(3)}}})),z(l,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(x,S){n.addLane(S,"bottom")}}}})}return w(f,"bpmn:FlowNode")&&(w(f,"bpmn:EventBasedGateway")?z(l,{"append.receive-task":m("bpmn:ReceiveTask","bpmn-icon-receive-task",c("Append receive task")),"append.message-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):O_(f,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?z(l,{"append.compensation-activity":m("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!w(f,"bpmn:EndEvent")&&!f.isForCompensation&&!O_(f,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!pn(f)&&z(l,{"append.end-event":m("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append end event")),"append.gateway":m("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append gateway")),"append.append-task":m("bpmn:Task","bpmn-icon-task",c("Append task")),"append.intermediate-event":m("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append intermediate/boundary event"))})),a.isEmpty(e,"bpmn-replace")||z(l,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(x,S){var P=z(h(S),{cursor:{x:x.x,y:x.y}});a.open(S,"bpmn-replace",P,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),w(f,"bpmn:SequenceFlow")&&z(l,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),w(f,"bpmn:MessageFlow")&&z(l,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),We(f,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&z(l,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect to other element"),action:{click:p,dragstart:p}}}),w(f,"bpmn:TextAnnotation")&&z(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:p,dragstart:p}}}),We(f,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&z(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:p,dragstart:p}}}),w(f,"bpmn:Group")&&z(l,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&z(l,g()),l};function O_(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return I(o,function(a){a.$type===n&&(r=!0)}),i&&r}const Hk={__depends__:[bk,A_,sb,Kn,Nf,mc,jk],__init__:["contextPadProvider"],contextPadProvider:["type",Va]};var zk={horizontal:["x","width"],vertical:["y","height"]},D_=5;function Vi(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return ke(i)?i:i?n:[]})}Vi.$inject=["modeling","rules"],Vi.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},Vi.prototype.trigger=function(e,t){var n=this._modeling,i,r;if(!(e.length<3)&&(this._setOrientation(t),r=this._filterElements(e),i=this._createGroups(r),!(i.length<=2)))return n.distributeElements(i,this._axis,this._dimension),i},Vi.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(I(t,function(o){r=o(r,n,i)}),r):e},Vi.prototype._createGroups=function(e){var t=[],n=this,i=this._axis,r=this._dimension;if(!i)throw new Error('must have a defined "axis" and "dimension"');var o=ci(e,i);return I(o,function(a,s){var c=n._findRange(a,i,r),u,l=t[t.length-1];l&&n._hasIntersection(l.range,c)?t[t.length-1].elements.push(a):(u={range:c,elements:[a]},t.push(u))}),t},Vi.prototype._setOrientation=function(e){var t=zk[e];this._axis=t[0],this._dimension=t[1]},Vi.prototype._hasIntersection=function(e,t){return Math.max(e.min,e.max)>=Math.min(t.min,t.max)&&Math.min(e.min,e.max)<=Math.max(t.min,t.max)},Vi.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+D_,max:t+n-D_}};const Gk={__init__:["distributeElements"],distributeElements:["type",Vi]};function pu(e){Yn.call(this,e)}pu.$inject=["eventBus"],ye(pu,Yn),pu.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=Ue(t,function(n){var i=We(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=Ps(t),t.length<3?!1:t})};var L_={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
|
|
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>`},Nk=900;function Wa(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",Nk,this)}Wa.$inject=["popupMenu","distributeElements","translate","rules"],Wa.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&H(t,this._getEntries(e)),t},Wa.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Wa.prototype._getEntries=function(e){var t=this._distributeElements,n=this._translate,i=this._popupMenu,r={"distribute-elements-horizontal":{group:"distribute",title:n("Distribute elements horizontally"),className:"bjs-align-elements-menu-entry",imageHtml:M_.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:M_.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const Bk={__depends__:[Pf,Ik],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",lu],distributeElementsMenuProvider:["type",Wa]};var k_="is not a registered action",$k="is already registered";function Kn(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}Kn.$inject=["eventBus","injector"],Kn.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),i=e.get("selection",!1),r=e.get("zoomScroll",!1),o=e.get("copyPaste",!1),a=e.get("canvas",!1),s=e.get("rules",!1),c=e.get("keyboardMove",!1),u=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),o&&i&&this.register("copy",function(){var l=i.get();if(l.length)return o.copy(l)}),o&&i&&this.register("duplicate",function(){var l=i.get();if(l.length)return o.duplicate(l)}),o&&this.register("paste",function(){o.paste()}),o&&i&&s&&this.register("cut",function(){var l=i.get();if(l.length){var p=s.allowed("elements.delete",{elements:l});if(p!==!1){var f=ke(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&&(ke(p)?f=p:f=l,f.length&&n.removeElements(f.slice()))}}),c&&this.register("moveCanvas",function(l){c.moveCanvas(l)}),u&&this.register("moveSelection",function(l){u.moveSelection(l.direction,l.accelerated)})},Kn.prototype.trigger=function(e,t){if(!this._actions[e])throw Bf(e,k_);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},Kn.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);L(e,function(i,r){n._registerAction(r,i)})},Kn.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Bf(e,$k);this._actions[e]=t},Kn.prototype.unregister=function(e){if(!this.isRegistered(e))throw Bf(e,k_);this._actions[e]=void 0},Kn.prototype.getActions=function(){return Object.keys(this._actions)},Kn.prototype.isRegistered=function(e){return!!this._actions[e]};function Bf(e,t){return new Error(e+" "+t)}const jk={__init__:["editorActions"],editorActions:["type",Kn]};function pu(e){e.invoke(Kn,this)}de(pu,Kn),pu.$inject=["injector"],pu.prototype._registerDefaultActions=function(e){Kn.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),i=e.get("selection",!1),r=e.get("spaceTool",!1),o=e.get("lassoTool",!1),a=e.get("handTool",!1),s=e.get("globalConnect",!1),c=e.get("distributeElements",!1),u=e.get("alignElements",!1),l=e.get("directEditing",!1),p=e.get("searchPad",!1),f=e.get("modeling",!1),d=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",function(){var g=t.getRootElement(),h=n.filter(function(m){return m!==g});return i.select(h),h}),r&&this._registerAction("spaceTool",function(){r.toggle()}),o&&this._registerAction("lassoTool",function(){o.toggle()}),a&&this._registerAction("handTool",function(){a.toggle()}),s&&this._registerAction("globalConnectTool",function(){s.toggle()}),i&&c&&this._registerAction("distributeElements",function(g){var h=i.get(),m=g.type;h.length&&c.trigger(h,m)}),i&&u&&this._registerAction("alignElements",function(g){var h=i.get(),m=[],w=g.type;h.length&&(m=Ge(h,function(y){return!x(y,"bpmn:Lane")}),u.trigger(m,w))}),i&&f&&this._registerAction("setColor",function(g){var h=i.get();h.length&&f.setColor(h,g)}),i&&l&&this._registerAction("directEditing",function(){var g=i.get();g.length&&l.activate(g[0])}),p&&this._registerAction("find",function(){p.toggle()}),t&&f&&this._registerAction("moveToOrigin",function(){var g=t.getRootElement(),h,m;x(g,"bpmn:Collaboration")?m=n.filter(function(w){return x(w.parent,"bpmn:Collaboration")}):m=n.filter(function(w){return w!==g&&!x(w.parent,"bpmn:SubProcess")}),h=Tt(m),f.moveElements(m,{x:-h.x,y:-h.y},g)}),i&&d&&this._registerAction("replaceElement",function(g){d.triggerEntry("replace","click",g)})};const Fk={__depends__:[jk],editorActions:["type",pu]};function O_(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;ze(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}O_.$inject=["eventBus"];function Ur(e,t){J.call(this,e),this._gridSnapping=t;var n=this;this.preExecute("shape.resize",function(i){var r=i.context,o=r.hints||{},a=o.autoResize;if(a){var s=r.shape,c=r.newBounds;wn(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}Ur.$inject=["eventBus","gridSnapping","modeling"],de(Ur,J),Ur.prototype.snapSimple=function(e,t){var n=this._gridSnapping;return t.width=n.snapValue(t.width,{min:t.width}),t.height=n.snapValue(t.height,{min:t.height}),t.x=e.x+e.width/2-t.width/2,t.y=e.y+e.height/2-t.height/2,t},Ur.prototype.snapComplex=function(e,t){return/w|e/.test(t)&&(e=this.snapHorizontally(e,t)),/n|s/.test(t)&&(e=this.snapVertically(e,t)),e},Ur.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,i=/w/.test(t),r=/e/.test(t),o={};return o.width=n.snapValue(e.width,{min:e.width}),r&&(i?(o.x=n.snapValue(e.x,{max:e.x}),o.width+=n.snapValue(e.x-o.x,{min:e.x-o.x})):e.x=e.x+e.width-o.width),H(e,o),e},Ur.prototype.snapVertically=function(e,t){var n=this._gridSnapping,i=/n/.test(t),r=/s/.test(t),o={};return o.height=n.snapValue(e.height,{min:e.height}),i&&(r?(o.y=n.snapValue(e.y,{max:e.y}),o.height+=n.snapValue(e.y-o.y,{min:e.y-o.y})):e.y=e.y+e.height-o.height),H(e,o),e};var Hk=2e3;function D_(e,t){e.on(["spaceTool.move","spaceTool.end"],Hk,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)}})}D_.$inject=["eventBus","gridSnapping"];const zk={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Ur],gridSnappingSpaceToolBehavior:["type",D_]};var fu=10;function $f(e,t,n){return n||(n="round"),Math[n](e/t)*t}var Gk=1200,Vk=800;function br(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",Vk,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"],Gk,function(o){var a=o.originalEvent;if(!(!r.active||a&&Tn(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(u){var l={},p=Uk(o,u,e);p&&(l.offset=p);var f=Wk(o,u);f&&H(l,f),$o(o,u)||r.snapEvent(o,u,l)})}})}br.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);Dt(e,t,i)},br.prototype.getGridSpacing=function(){return fu},br.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=$f(e,fu);var i,r;return t&&t.min&&(i=t.min,Le(i)&&(i=$f(i+n,fu,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,Le(r)&&(r=$f(r+n,fu,"floor"),e=Math.min(e,r))),e-=n,e},br.prototype.isActive=function(){return this.active},br.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},br.prototype.toggleActive=function(){this.setActive(!this.active)},br.$inject=["elementRegistry","eventBus","config.gridSnapping"];function Wk(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&&(du(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&&(du(t)?I_(s)?a.x.max=c.left:a.x.min=c.right:L_(s)?a.y.max=c.top:a.y.min=c.bottom),u&&(du(t)?I_(s)?a.x.min=u.left:a.x.max=u.right:L_(s)?a.y.min=u.top:a.y.max=u.bottom),a[t]}function Uk(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&Le(s[t])||(s||(s=o.snapOffset={}),Le(s[t])||(s[t]=0),!r)||(n.get(r.id)||(du(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 du(e){return e==="x"}function L_(e){return e.indexOf("n")!==-1}function I_(e){return e.indexOf("w")!==-1}const qk={__depends__:[zk],__init__:["gridSnapping"],gridSnapping:["type",br]};var Yk=2e3;function N_(e,t,n){e.on("autoPlace",Yk,function(i){var r=i.source,o=Oe(r),a=i.shape,s=Iv(r,a,n);return["x","y"].forEach(function(c){var u={};s[c]!==o[c]&&(s[c]>o[c]?u.min=s[c]:u.max=s[c],x(a,"bpmn:TextAnnotation")&&(Kk(c)?u.offset=-a.width/2:u.offset=-a.height/2),s[c]=t.snapValue(s[c],u))}),s})}N_.$inject=["eventBus","gridSnapping","elementRegistry"];function Kk(e){return e==="x"}var Xk=1750;function B_(e,t,n){t.on(["create.start","shape.move.start"],Xk,function(i){var r=i.context,o=r.shape,a=e.getRootElement();if(!(!x(o,"bpmn:Participant")||!x(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}))}})}B_.$inject=["canvas","eventBus","gridSnapping"];var Zk=3e3;function hu(e,t,n){J.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],Zk,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||Qk(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}hu.$inject=["eventBus","gridSnapping","modeling"],de(hu,J),hu.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=tO(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function Qk(e){return e.length>3}function Jk(e){return e==="h"}function eO(e){return e==="v"}function tO(e,t,n){var i=Mi(t,n),r={};return Jk(i)&&(r.y=e.snapValue(t.y)),eO(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=H({},t,r),n=H({},n,r)),[t,n]}const nO={__depends__:[qk,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",N_],gridSnappingParticipantBehavior:["type",B_],gridSnappingLayoutConnectionBehavior:["type",hu]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",O_]};var iO=30,$_=30;function Ua(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var r=i.element,o=i.gfx;if(x(r,"bpmn:Lane"))return n._createParticipantHit(r,o);if(x(r,"bpmn:Participant"))return Ue(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(x(r,"bpmn:SubProcess"))return Ue(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}Ua.$inject=["eventBus","interactionEvents"],Ua.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Ua.prototype._createParticipantHit=function(e,t){this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height});var n=qt(e)?{width:iO,height:e.height}:{width:e.width,height:$_};return this._interactionEvents.createBoxHit(t,"all",n),!0},Ua.prototype._createSubProcessHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"all",{width:e.width,height:$_}),!0};const rO={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Ua]};function mu(e){e.invoke(ko,this)}de(mu,ko),mu.$inject=["injector"],mu.prototype.registerBindings=function(e,t){ko.prototype.registerBindings.call(this,e,t);function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("selectElements",function(i){var r=i.keyEvent;if(e.isKey(["a","A"],r)&&e.isCmd(r))return t.trigger("selectElements"),!0}),n("find",function(i){var r=i.keyEvent;if(e.isKey(["f","F"],r)&&e.isCmd(r))return t.trigger("find"),!0}),n("spaceTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["s","S"],r))return t.trigger("spaceTool"),!0}),n("lassoTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["l","L"],r))return t.trigger("lassoTool"),!0}),n("handTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["h","H"],r))return t.trigger("handTool"),!0}),n("globalConnectTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["c","C"],r))return t.trigger("globalConnectTool"),!0}),n("directEditing",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["e","E"],r))return t.trigger("directEditing"),!0}),n("replaceElement",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["r","R"],r))return t.trigger("replaceElement",r),!0})};const oO={__depends__:[ff],__init__:["keyboardBindings"],keyboardBindings:["type",mu]};var aO={moveSpeed:1,moveSpeedAccelerated:10},sO=1500,j_="left",F_="up",H_="right",z_="down",cO={ArrowLeft:j_,Left:j_,ArrowUp:F_,Up:F_,ArrowRight:H_,Right:H_,ArrowDown:z_,Down:z_},uO={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 G_(e,t,n,i,r){var o=this;this._config=H({},aO,e||{}),t.addListener(sO,function(a){var s=a.keyEvent,c=cO[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=uO[a](u),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,l)}}}G_.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const lO={__depends__:[ff,Vn],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",G_]};var V_=10;function qa(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=aC(l,p,u),c.newBounds=cC(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:Pe(l)})}function s(c){var u=c.shape,l=c.canExecute,p=c.newBounds;if(l){if(p=sm(p),!pO(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)})}qa.prototype.canResize=function(e){var t=this._rules,n=Qn(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},qa.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=H({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,W_(t,o),"resize",{autoActivate:!0,cursor:fO(o),data:{shape:t,context:r}})},qa.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:V_,height:V_},r=Ym(t,e.childrenBoxPadding),uC(n,t,i,r)},qa.$inject=["eventBus","rules","modeling","dragging"];function pO(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function W_(e,t){var n=Oe(e),i=Pe(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 fO(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 U_="djs-resizing",q_="resize-not-ok",dO=500;function Y_(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,U_)),s.width>5&&he(c,{x:s.x,width:s.width}),s.height>5&&he(c,{y:s.y,height:s.height}),o.canExecute?qe(c).remove(q_):qe(c).add(q_)}function r(o){var a=o.shape,s=o.frame;s&&$t(o.frame),t.removeMarker(a,U_)}e.on("resize.move",dO,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}Y_.$inject=["eventBus","canvas","previewSupport"];var gu=-6,yu=8,vu=20,Ya="djs-resizer",hO=["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&&L(a,mn(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}_r.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){cr(o)&&i.activate(o,e,n)}Ne.bind(t,"mousedown",r),Ne.bind(t,"touchstart",r)},_r.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=mO(i),a=Ce("g");qe(a).add(Ya),qe(a).add(Ya+"-"+e.id),qe(a).add(Ya+"-"+i),Be(r,a);var s=Ce("rect");he(s,{x:-yu/2+o.x,y:-yu/2+o.y,width:yu,height:yu}),qe(s).add(Ya+"-visual"),Be(a,s);var c=Ce("rect");return he(c,{x:-vu/2+o.x,y:-vu/2+o.y,width:vu,height:vu}),qe(c).add(Ya+"-hit"),Be(a,c),Os(a,t,n),a},_r.prototype.createResizer=function(e,t){var n=W_(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},_r.prototype.addResizer=function(e){var t=this;st(e)||L(hO,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},_r.prototype.removeResizers=function(){var e=this._getResizersParent();Es(e)},_r.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},_r.$inject=["eventBus","canvas","selection","resize"];function mO(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-gu:e.indexOf("w")!==-1&&(t.x=gu),e.indexOf("s")!==-1?t.y=-gu:e.indexOf("n")!==-1&&(t.y=gu),t}const K_={__depends__:[bi,Ni,Ao],__init__:["resize","resizePreview","resizeHandles"],resize:["type",qa],resizePreview:["type",Y_],resizeHandles:["type",_r]};var gO=2e3;function Ka(e,t,n,i,r,o,a){this._bpmnFactory=t,this._canvas=n,this._modeling=r,this._textRenderer=a,i.registerProvider(this),e.on("element.dblclick",function(c){s(c.element,!0)}),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open","root.set","selection.changed"],function(){i.isActive()&&i.complete()}),e.on(["shape.remove","connection.remove"],gO,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||ze(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}Ka.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Ka.prototype.activate=function(e){var t=Bn(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);H(n,i);var r={},o=n.style||{};return H(o,{backgroundColor:null,border:null}),(ze(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||X_(e))&&H(r,{centerVertically:!0}),rr(e)&&(H(r,{resizable:!0,autoResize:!0}),H(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),x(e,"bpmn:TextAnnotation")&&(H(r,{resizable:!0,autoResize:!0}),H(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),H(n,{options:r,style:o}),n}},Ka.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),r={x:i.x+i.width/2,y:i.y+i.height/2},o={x:i.x,y:i.y},a=t.zoom(),s=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),u=c.fontSize*a,l=c.lineHeight,p=s.fontSize*a,f=s.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(x(e,"bpmn:Lane")||bO(e)){var g=qt(e),h=g?{width:i.height,height:30*a,x:i.x-i.height/2+15*a,y:r.y-30*a/2}:{width:i.width,height:30*a};H(o,h),H(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:g?"rotate(-90deg)":null})}if(vO(e)){var m=qt(e),w=m?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:r.x-i.height/2,y:r.y-i.width/2};H(o,w),H(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:m?null:"rotate(-90deg)"})}(ze(e,["bpmn:Task","bpmn:CallActivity"])||X_(e))&&(H(o,{width:i.width,height:i.height}),H(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),yO(e)&&(H(o,{width:i.width,x:i.x}),H(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var y=1,_=i.width+2*y;if(n.labelTarget&&(H(o,{width:_,height:i.height+2*y,x:i.x-y,y:i.y-y}),H(d,{fontSize:u+"px",lineHeight:l})),rr(n)&&!Is(n)&&!Fe(n)){var S=Rl(e),P=t.getAbsoluteBBox({x:S.x,y:S.y,width:0,height:0}),C=u,D=Lr.width*a+2*y;H(o,{width:D,height:C+2*y,x:P.x-D/2,y:P.y-C/2-y}),H(d,{fontSize:u+"px",lineHeight:l})}return x(e,"bpmn:TextAnnotation")&&(H(o,{width:i.width+2*y,height:i.height+2*y,x:i.x-y,y:i.y-y,minWidth:30*a,minHeight:10*a}),H(d,{textAlign:"left",paddingTop:mo*a+"px",paddingBottom:mo*a+"px",paddingLeft:mo*a+"px",paddingRight:mo*a+"px",fontSize:p+"px",lineHeight:f})),{bounds:o,style:d}},Ka.prototype.update=function(e,t,n,i){var r,o;x(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}),_O(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function X_(e){return x(e,"bpmn:SubProcess")&&!Ue(e)}function yO(e){return x(e,"bpmn:SubProcess")&&Ue(e)}function vO(e){return x(e,"bpmn:Participant")&&!Ue(e)}function bO(e){return x(e,"bpmn:Participant")&&Ue(e)}function _O(e){return!e||!e.trim()}var Z_="djs-element-hidden",Q_="djs-label-hidden";function J_(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,x(o,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(o),s=Ce("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=Ce("path");he(p,{d:l,strokeWidth:2,stroke:xO(o)}),Be(s,p),Be(r,s),en(s,o.x,o.y)}x(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,Z_):(x(o,"bpmn:Task")||x(o,"bpmn:CallActivity")||x(o,"bpmn:SubProcess")||x(o,"bpmn:Participant")||x(o,"bpmn:Lane"))&&t.addMarker(o,Q_)}),e.on("directEditing.resize",function(c){if(x(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}});he(i.path,{d:f})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var u=c.active;u&&(t.removeMarker(u.element.label||u.element,Z_),t.removeMarker(o,Q_)),o=void 0,a=void 0,s&&($t(s),s=void 0)})}J_.$inject=["eventBus","canvas","pathMap"];function xO(e,t){var n=Ye(e);return n.get("stroke")||t||"black"}const wO={__depends__:[Gp,K_,S_],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Ka],labelEditingPreview:["type",J_]};var EO=500,SO=1e3;function wi(e,t,n){this._eventBus=e,this._elementRegistry=n,this._outlineOffset=5,this._outlineStyle=t.cls("djs-outline",["no-fill"]);var i=this;function r(o){cS(o)||i.createOutline(o)}e.on("element.hover",function(o){r(o.element)}),e.on("selection.changed",function(o){L(o.newSelection,r)}),e.on(["shape.changed","connection.changed"],EO,function(o){var a=o.element,s=o.gfx,c=ot(".djs-outline",s);c&&i.updateOutline(a,c)})}wi.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=ot(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),Be(t,n),this.updateOutline(e,n)),n},wi.prototype._createOutlineGfx=function(){var e=Ce("rect");return he(e,H({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},wi.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},wi.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&L(i,function(r){n=n||r.updateOutline(t,e)}),n||he(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},wi.prototype.updateConnectionOutline=function(e,t){var n=Tt(t);he(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},wi.prototype.registerProvider=function(e,t){t||(t=e,e=SO),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},wi.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},wi.prototype.getOutline=function(e){var t,n=this._getProviders();return L(n,function(i){Wt(i.getOutline)&&(t=t||i.getOutline(e))}),t},wi.$inject=["eventBus","styles","elementRegistry"];var bu=6;function jf(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)})}jf.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Es(t);var n=e.length>1,i=this._canvas.getContainer();if(qe(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=RO(Tt(e)),o=Ce("rect");he(o,H({rx:3},r)),qe(o).add("djs-selection-outline"),Be(t,o)}},jf.$inject=["eventBus","canvas","selection"];function RO(e){return{x:e.x-bu,y:e.y-bu,width:e.width+bu*2,height:e.height+bu*2}}const Ff={__depends__:[Vn],__init__:["outline","multiSelectionOutline"],outline:["type",wi],multiSelectionOutline:["type",jf]},ex=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],tx={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},CO=15,_u=2;function nx(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(g=>ze(g,ex));if(f.length===1){const g=f[0];Fe(g)?a(g,g.labelTarget):(d=g.labels)!=null&&d.length&&a(g.labels[0],g)}if(f.length===2){const g=f.find(Fe),h=f.find(m=>{var w;return(w=m.labels)==null?void 0:w.includes(g)});g&&h&&a(g,h)}}),e.on("shape.changed",function({element:p}){var f;!ze(p,ex)||!l(p)||(Fe(p)?a(p,p.labelTarget):(f=p.labels)!=null&&f.length&&a(p.labels[0],p))});function a(p,f){const d=Qo([Oe(f),Oe(p)],tx),g=d.getAttribute("d"),m=r.isSelected(p)?c(p):u(p),w=na(m,g);if(!w)return;const _=r.isSelected(f)?c(f):u(f),S=na(_,g)||Oe(f);fa(S,w)<CO||(yl(d,[S,w]),Be(o,d))}function s(){ws(`.${tx.class}`,o).forEach($t)}function c(p){const f=i.getOutline(p);if(!f)return u(p);if(f.x){const d={x:p.x+xr(f,"x")-_u,y:p.y+xr(f,"y")-_u,width:xr(f,"width")+_u*2,height:xr(f,"height")+_u*2};return Pl(d,xr(f,"rx"))}if(f.cx){const d=xr(f,"r"),g={x:p.x+xr(f,"cx")-d,y:p.y+xr(f,"cy")-d,width:d*2,height:d*2};return km(g)}}function u(p){return n.getShapePath(p)}function l(p){return r.isSelected(p)}}nx.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function xr(e,t){return parseFloat(he(e,t)||0)}const PO={__depends__:[Vn,Ff],__init__:["labelLink"],labelLink:["type",nx]};var AO=new Po("tt");function TO(e){var t=ft('<div class="djs-tooltip-container" />');return dn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function MO(e,t,n){dn(e,{left:t+"px",top:n+"px"})}function Hf(e,t){e.style.display=t===!1?"none":""}var ix="djs-tooltip",zf="."+ix;function vn(e,t){this._eventBus=e,this._canvas=t,this._ids=AO,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=TO(t.getContainer());var n=this;Cn.bind(this._tooltipRoot,zf,"mousedown",function(i){i.stopPropagation()}),Cn.bind(this._tooltipRoot,zf,"mouseover",function(i){n.trigger("mouseover",i)}),Cn.bind(this._tooltipRoot,zf,"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=H({},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(sn(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&&(di(t.html),di(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},vn.prototype.show=function(){Hf(this._tooltipRoot)},vn.prototype.hide=function(){Hf(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)),wn(n)&&(n=ft(n)),i=ft('<div data-tooltip-id="'+t+'" class="'+ix+'">'),dn(i,{position:"absolute"}),i.appendChild(n),e.type&&yt(i).add("djs-tooltip-"+e.type),e.className&&yt(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;MO(n,t.x,t.y)},vn.prototype._updateTooltipVisibilty=function(e){L(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),Hf(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 kO={__init__:["tooltips"],tooltips:["type",vn]};var OO="flow elements must be children of pools/participants",DO="Data object must be placed within a pool/participant.";function rx(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;x(s,"bpmn:Collaboration")&&(x(a,"bpmn:FlowNode")?i(r,n(OO)):x(a,"bpmn:DataObjectReference")&&i(r,n(DO)))})}rx.$inject=["eventBus","tooltips","translate"];const LO={__depends__:[kO],__init__:["modelingFeedback"],modelingFeedback:["type",rx]};var IO=500,NO=1250,BO=1500,xu=Math.round;function $O(e){return{x:e.x+xu(e.width/2),y:e.y+xu(e.height/2)}}function ox(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",BO,function(s){var c=s.context,u=s.shape,l=i.get().slice();l.indexOf(u)===-1&&(l=[u]),l=jO(l),H(c,{shapes:l,validatedShapes:l,shape:u})}),e.on("shape.move.start",NO,function(s){var c=s.context,u=c.validatedShapes,l;if(l=c.canExecute=o(u),!l)return!1}),e.on("shape.move.move",IO,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=xu(u.x),u.y=xu(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(cr(s)){var c=Eo(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,u,l){if(Vt(u)&&(l=u,u=!1),!(c.waypoints||!c.parent)&&!qe(s.target).has("djs-hit-no-move")){var p=$O(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}ox.$inject=["eventBus","dragging","modeling","selection","rules"];function jO(e){var t=eo(e,"id");return Ge(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var ax=499,Gf="djs-dragging",sx="drop-ok",cx="drop-not-ok",ux="new-parent",lx="attach-ok";function px(e,t,n,i){function r(c){var u=o(c),l=FO(u);return l}function o(c){var u=Jo(c),l=u.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),p=u.concat(l),f=[...new Set(p)];return f}function a(c,u){[lx,sx,cx,ux].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,Gf),c.allDraggedElements?c.allDraggedElements.push(u):c.allDraggedElements=[u]}e.on("shape.move.start",ax,function(c){var u=c.context,l=u.shapes,p=u.allDraggedElements,f=r(l);if(!u.dragGroup){var d=Ce("g");he(d,n.cls("djs-drag-group",["no-events"]));var g=t.getActiveLayer();Be(g,d),u.dragGroup=d}f.forEach(function(h){i.addDragger(h,u.dragGroup)}),p?p=ku([p,o(l)]):p=o(l),L(p,function(h){t.addMarker(h,Gf)}),u.allDraggedElements=p,u.differentParents=HO(l)}),e.on("shape.move.move",ax,function(c){var u=c.context,l=u.dragGroup,p=u.target,f=u.shape.parent,d=u.canExecute;p&&(d==="attach"?a(p,lx):u.canExecute&&f&&p.id!==f.id?a(p,ux):a(p,u.canExecute?sx:cx)),en(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;L(l,function(f){t.removeMarker(f,Gf)}),p&&$t(p)}),this.makeDraggable=s}px.$inject=["eventBus","canvas","styles","previewSupport"];function FO(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=Ge(e,function(i){return st(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function HO(e){return B0(eo(e,function(t){return t.parent&&t.parent.id}))!==1}const zO={__depends__:[fc,Vn,Ff,bi,Ni,Ao],__init__:["move","movePreview"],move:["type",ox],movePreview:["type",px]};var fx=".djs-palette-toggle",dx=".entry",GO=fx+", "+dx,Vf="djs-palette-",VO="shown",Wf="open",hx="two-column",WO=1e3;function Lt(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()})}Lt.$inject=["eventBus","canvas"],Lt.prototype.registerProvider=function(e,t){t||(t=e,e=WO),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},Lt.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(qO,{})},Lt.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},Lt.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=ft(Lt.HTML_MARKUP);n.appendChild(i),yt(n).add(Vf+VO),Cn.bind(i,GO,"click",function(r){var o=r.delegateTarget;if(cl(o,fx))return e.toggle();e.trigger("click",r)}),Ne.bind(i,"mousedown",function(r){r.stopPropagation()}),Cn.bind(i,dx,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},Lt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},Lt.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,r,o=yt(n),a=yt(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(hx,r),a.toggle(Vf+hx,r),"open"in e&&(o.toggle(Wf,e.open),a.toggle(Vf+Wf,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},Lt.prototype._update=function(){var e=ot(".djs-palette-entries",this._container),t=this._entries=this.getEntries();_s(e),L(t,function(n,i){var r=n.group||"default",o=ot("[data-group="+La(r)+"]",e);o||(o=ft('<div class="group"></div>'),sn(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=ft(a);if(o.appendChild(s),!n.separator&&(sn(s,"data-action",i),n.title&&sn(s,"title",n.title),n.className&&UO(s,n.className),n.imageUrl)){var c=ft("<img>");sn(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},Lt.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=sn(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},Lt.prototype.triggerEntry=function(e,t,n,i){var r=this._entries,o,a;if(o=r[e],!!o&&(a=o.action,this._eventBus.fire("palette.trigger",{entry:o,event:n})!==!1)){if(Wt(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},Lt.prototype._layoutChanged=function(){this._toggleState({})},Lt.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},Lt.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},Lt.prototype.open=function(){this._toggleState({open:!0})},Lt.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Lt.prototype.isActiveTool=function(e){return e&&this._activeTool===e},Lt.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=ot(".djs-palette-entries",this._container),this._toolsContainer=ot("[data-group=tools]",t)),n=this._toolsContainer,L(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=yt(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},Lt.prototype.isOpen=function(){return yt(this._container).has(Wf)},Lt.prototype._getParentContainer=function(){return this._canvas.getContainer()},Lt.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function UO(e,t){var n=yt(e),i=ke(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function qO(e,t){var n=t.getPaletteEntries();return Wt(n)?n(e):(L(n,function(i,r){e[r]=i}),e)}const YO={__init__:["palette"],palette:["type",Lt]};var mx="crosshair",gx="selected",KO="djs-dragging-active-lasso";function wr(e,t,n,i,r,o,a){this._selection=r,this._dragging=n,this._mouse=a;var s=this,c={create:function(p){var f=t.getActiveLayer(),d=p.frame=Ce("rect");he(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),Be(f,d),u(!0),this.update(p)},update:function(p){var f=p.frame,d=p.bbox;f&&d&&he(f,{x:d.x,y:d.y,width:d.width,height:d.height});var g=p.marked,h=p.lastMarked;if(g&&h){for(const m of h)g.has(m)||t.removeMarker(m,gx);for(const m of g)h.has(m)||t.addMarker(m,gx)}},remove:function(p){this.update(p),p.frame&&$t(p.frame),u(!1)}};function u(p){qe(t.getContainer()).toggle(KO,p)}function l(p){var f=i.getAll();return new Set(Jr(uo(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=yx(p),f.add=oc(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=yx(p),g=l(d),h=f.initialMarked.union(g);f.lastMarked=f.marked,f.marked=h,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(oc(p))return s.activateLasso(p.originalEvent),!0})}wr.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],wr.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:mx,data:{context:{}},keepSelection:!0})},wr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:mx,data:{context:{}},keepSelection:!0})},wr.prototype._select=function(e){this._selection.select(e)},wr.prototype.select=function(e,t,n=[]){var i=Jr(uo(e,t));this._select([...n,...i])},wr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},wr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function yx(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 XO={__depends__:[gc,va],__init__:["lassoTool"],lassoTool:["type",wr]};var Uf=1500,vx="grab";function jo(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",Uf,function(c){if(ma(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(Uf,function(c){if(!(!bx(c.keyEvent)||a.isActive())){var u=a._mouse.getLastMoveEvent();a.activateMove(u,!!u)}},"keyboard.keydown"),s&&s.addListener(Uf,function(c){!bx(c.keyEvent)||!a.isActive()||a.toggle()},"keyboard.keyup"),e.on("hand.end",function(c){var u=c.originalEvent.target;if(!c.hover&&!(u instanceof SVGElement))return!1;e.once("hand.ended",function(){a.activateMove(c.originalEvent,{reactivate:!0})})}),e.on("hand.move.move",function(c){var u=t.viewbox().scale;t.scroll({dx:c.dx*u,dy:c.dy*u})}),e.on("hand.move.end",function(c){var u=c.context,l=u.reactivate;return!ma(c)&&l&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}jo.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],jo.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:vx,data:{context:n||{}}})},jo.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:vx,data:{context:{reactivate:n}}})},jo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},jo.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function bx(e){return jt("Space",e)}const ZO={__depends__:[gc,va],__init__:["handTool"],handTool:["type",jo]};var _x="connect-ok",xx="connect-not-ok";function Fo(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?_x:xx))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var u=c.context.startTarget,l=c.context.canStartConnect;u&&i.removeMarker(u,l?_x:xx)}),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})}Fo.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Fo.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Fo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Fo.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Fo.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const QO={__depends__:[If,bi,Ni,gc,va],globalConnect:["type",Fo]};function qf(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)}qf.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],qf.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,g,h){function m(w){var y=n.createShape(H({type:p},h));t.start(w,y)}return{group:f,className:d,title:g,action:{dragstart:m,click:m}}}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 H(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 JO={__depends__:[YO,hc,Ky,XO,ZO,QO,ca],__init__:["paletteProvider"],paletteProvider:["type",qf]};var eD=250;function Yf(e,t,n,i,r){J.call(this,e);function o(s){var c=s.canExecute.replacements;L(c,function(u){var l=u.oldElementId,p={type:u.newElementType};if(!s.visualReplacements[l]){var f=t.get(l);H(p,{x:f.x,y:f.y});var d=n.createShape(p);i.addShape(d,f.parent);var g=ot('[data-element-id="'+La(f.id)+'"]',s.dragGroup);g&&he(g,{display:"none"});var h=r.addDragger(d,s.dragGroup);s.visualReplacements[l]=h,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;L(c,function(u,l){var p=ot('[data-element-id="'+La(l)+'"]',s.dragGroup);p&&he(p,{display:"inline"}),u.remove(),c[l]&&delete c[l]})}e.on("shape.move.move",eD,function(s){var c=s.context,u=c.canExecute;c.visualReplacements||(c.visualReplacements={}),u&&u.replacements?o(c):a(c)})}Yf.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],de(Yf,J);const tD={__depends__:[Ao],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Yf]};var nD=1250,Kf=40,iD=20,rD=10,wx=20,Ex=["x","y"],oD=Math.abs;function Sx(e){e.on(["connect.hover","connect.move","connect.end"],nD,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&Tn(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&aD(t,o,lD(o)),o&&uD(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=qn(r),ze(o,["bpmn:Event","bpmn:Gateway"])&&Rx(t,qn(o)),ze(o,["bpmn:Task","bpmn:SubProcess"])&&sD(t,o),x(a,"bpmn:BoundaryEvent")&&s===a.host&&cD(t)):Cx(i,"bpmn:MessageFlow")?(x(r,"bpmn:Event")&&(n.connectionStart=qn(r)),x(o,"bpmn:Event")&&Rx(t,qn(o))):n.connectionStart=n.initialConnectionStart)})}Sx.$inject=["eventBus"];function aD(e,t,n){Ex.forEach(function(i){var r=Px(i,t);e[i]<t[i]+n?Dt(e,i,t[i]+n):e[i]>t[i]+r-n&&Dt(e,i,t[i]+r-n)})}function sD(e,t){var n=qn(t);Ex.forEach(function(i){pD(e,t,i)&&Dt(e,i,n[i])})}function cD(e){var t=e.context,n=t.source,i=t.target;if(!fD(t)){var r=qn(n),o=Jt(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;oD(c-r[s])<Kf&&(c>r[s]?u=r[s]+Kf:u=r[s]-Kf,Dt(e,s,u))})}}function Rx(e,t){Dt(e,"x",t.x),Dt(e,"y",t.y)}function Cx(e,t){return e&&e.type===t}function uD(e,t){return Ui(t,function(n){return Cx(e,n)})}function Px(e,t){return e==="x"?t.width:t.height}function lD(e){return x(e,"bpmn:Task")?rD:iD}function pD(e,t,n){return e[n]>t[n]+wx&&e[n]<t[n]+Px(n,t)-wx}function fD(e){var t=e.hover,n=e.source;return t&&n&&t===n}function Er(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}Er.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},Er.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},Er.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},Er.prototype.getSnapLocations=function(){return this._snapLocations},Er.prototype.setSnapLocations=function(e){this._snapLocations=e},Er.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new wu,n.initDefaults(this._defaultSnaps)),n};function wu(){this._snapValues={}}wu.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)},wu.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&ek(e[n],r[n],i)},wu.prototype.initDefaults=function(e){var t=this;L(e||{},function(n,i){L(n,function(r){t.add(i,r)})})};var dD=1250;function Ei(e,t,n){var i=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],function(r){i.initSnap(r)}),t.on(["create.move","create.end","shape.move.move","shape.move.end"],dD,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&Tn(r.originalEvent))&&!($o(r)||!c)){var u=s.pointsForTarget(c);u.initialized||(u=i.addSnapTargetPoints(u,a,c),u.initialized=!0),n.snap(r,u)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){n.hide()})}Ei.$inject=["elementRegistry","eventBus","snapping"],Ei.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new Er);var o;t.get(i.id)?o=qn(i,e):o={x:e.x+qn(i).x,y:e.y+qn(i).y};var a={x:o.x-i.width/2,y:o.y-i.height/2},s={x:o.x+i.width/2,y:o.y+i.height/2};return r.setSnapOrigin("mid",{x:o.x-e.x,y:o.y-e.y}),Fe(i)||(r.setSnapOrigin("top-left",{x:a.x-e.x,y:a.y-e.y}),r.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),r},Ei.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return L(i,function(r){if(Fe(r)){Fe(t)&&e.add("mid",qn(r));return}if(st(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);L(o,function(a){e.add("mid",a)});return}e.add("mid",qn(r))}),!Le(t.x)||!Le(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",qn(t)),e},Ei.prototype.getSnapTargets=function(e,t){return d_(t).filter(function(n){return!hD(n)})};function hD(e){return!!e.hidden}var Ax=1500;function Ho(e,t){t.invoke(Ei,this),e.on(["create.move","create.end"],Ax,vD),e.on(["create.move","create.end","shape.move.move","shape.move.end"],Ax,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!$o(n)&&mD(n,o)})}de(Ho,Ei),Ho.$inject=["eventBus","injector"],Ho.prototype.initSnap=function(e){var t=Ei.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return L(n.outgoing,function(r){var o=r.waypoints[0];o=o.original||o,t.setSnapOrigin(r.id+"-docking",Mx(o,i,e))}),L(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",Mx(o,i,e))}),x(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Ho.prototype.addSnapTargetPoints=function(e,t,n){Ei.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);L(i,function(o){(yD(o)||gD([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",p_(o)),e.add("bottom-right",f_(o)))});var r=this._elementRegistry;return L(t.incoming,function(o){if(r.get(t.id)){Tx(i,o.source)||e.add("mid",Oe(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),L(t.outgoing,function(o){if(r.get(t.id)){Tx(i,o.target)||e.add("mid",Oe(o.target));var a=o.waypoints[o.waypoints.length-1];e.add(o.id+"-docking",a.original||a)}}),x(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},Ho.prototype.getSnapTargets=function(e,t){return Ei.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!x(n,"bpmn:Lane")})};function mD(e,t){var n=Pe(t),i=Wg(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=Oe(o),/top/.test(i)?Dt(e,"y",n.top-a.y):/bottom/.test(i)&&Dt(e,"y",n.bottom-a.y),/left/.test(i)?Dt(e,"x",n.left-a.x):/right/.test(i)&&Dt(e,"x",n.right-a.x)}function gD(e,t){return e.every(function(n){return x(n,t)})}function yD(e){return x(e,"bpmn:SubProcess")&&Ue(e)?!0:x(e,"bpmn:Participant")}function vD(e){var t=e.context,n=t.createConstraints;if(n){var i=n.top,r=n.right,o=n.bottom,a=n.left;(a&&a>=e.x||r&&r<=e.x)&&Dt(e,"x",e.x),(i&&i>=e.y||o&&o<=e.y)&&Dt(e,"y",e.y)}}function Tx(e,t){return e.indexOf(t)!==-1}function Mx(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var bD=1250;function Xa(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],bD,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&Tn(i.originalEvent))&&!$o(i)){var u=c.pointsForTarget(a);u.initialized||(u=n.addSnapTargetPoints(u,o,a,s),u.initialized=!0),wD(s)&&Dt(i,"x",i.x),ED(s)&&Dt(i,"y",i.y),t.snap(i,u)}}),e.on(["resize.cleanup"],function(){t.hide()})}Xa.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new Er);var o=kx(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},Xa.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return L(r,function(o){e.add("corner",f_(o)),e.add("corner",p_(o))}),e.add("corner",kx(t,i)),e},Xa.$inject=["eventBus","snapping"],Xa.prototype.getSnapTargets=function(e,t){return d_(t).filter(function(n){return!_D(n,e)&&!st(n)&&!xD(n)&&!Fe(n)})};function kx(e,t){var n=Oe(e),i=Pe(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 _D(e,t){return e.host===t}function xD(e){return!!e.hidden}function wD(e){return e==="n"||e==="s"}function ED(e){return e==="e"||e==="w"}var SD=7,RD=1e3;function Sr(e){this._canvas=e,this._asyncHide=Du(mn(this.hide,this),RD)}Sr.$inject=["canvas"],Sr.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:$o(e,"x"),y:$o(e,"y")};L(r,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(L(["x","y"],function(u){var l;o[u]||(l=t.snap(c,a,u,SD),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),L(["x","y"],function(a){var s=o[a];Vt(s)&&Dt(e,a,s.originValue)})},Sr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=Ce("path");return he(n,{d:"M0,0 L0,0"}),qe(n).add("djs-snap-line"),Be(t,n),{update:function(i){Le(i)?e==="horizontal"?he(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):he(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):he(n,{display:"none"})}}},Sr.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Sr.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},Sr.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Sr.prototype.hide=function(){L(this._snapLines,function(e){e.update()})};const CD={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",Ei],resizeSnapping:["type",Xa],snapping:["type",Sr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",Sx],createMoveSnapping:["type",Ho]};var Ox=300;function $e(e,t,n,i){this._open=!1,this._results={},this._eventMaps=[],this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._canvas=e,this._eventBus=t,this._selection=n,this._translate=i,this._container=this._getBoxHtml(),this._searchInput=ot($e.INPUT_SELECTOR,this._container),this._resultsContainer=ot($e.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}$e.$inject=["canvas","eventBus","selection","translate"],$e.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:Cn.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,$e.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,$e.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,$e.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,$e.INPUT_SELECTOR,"keydown",function(n){jt("ArrowUp",n)&&n.preventDefault(),jt("ArrowDown",n)&&n.preventDefault()}),t(this._container,$e.INPUT_SELECTOR,"keyup",function(n){if(jt("Escape",n))return e.close();if(jt("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(jt("ArrowUp",n))return e._scrollToDirection(!0);if(jt("ArrowDown",n))return e._scrollToDirection();jt(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},$e.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){Cn.unbind(e.el,e.type,e.listener)})},$e.prototype._search=function(e){var t=this;if(this._clearResults(),!!e.trim()){var n=this._searchProvider.find(e);if(n=n.filter(function(r){return!t._canvas.getRootElements().includes(r.element)}),!n.length){this._selection.select(null);return}n.forEach(function(r){var o=r.element.id,a=t._createResultNode(r,o);t._results[o]={element:r.element,node:a}});var i=ot($e.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},$e.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},$e.prototype._scrollToNode=function(e){if(!(!e||e===this._getCurrentResult())){var t=e.offsetTop,n=this._resultsContainer.scrollTop,i=t-this._resultsContainer.clientHeight+e.clientHeight;t<n?this._resultsContainer.scrollTop=t:n<i&&(this._resultsContainer.scrollTop=i)}},$e.prototype._clearResults=function(){_s(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},$e.prototype._getCurrentResult=function(){return ot($e.RESULT_SELECTED_SELECTOR,this._resultsContainer)},$e.prototype._createResultNode=function(e,t){var n=ft($e.RESULT_HTML);return e.primaryTokens.length>0&&Dx(n,e.primaryTokens,$e.RESULT_PRIMARY_HTML),Dx(n,e.secondaryTokens,$e.RESULT_SECONDARY_HTML),sn(n,$e.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},$e.prototype.registerProvider=function(e){this._searchProvider=e},$e.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._cachedRootElement=this._canvas.getRootElement(),this._cachedSelection=this._selection.get(),this._cachedViewbox=this._canvas.viewbox(),this._selection.select(null),this._bindEvents(),this._open=!0,yt(this._canvas.getContainer()).add("djs-search-open"),yt(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},$e.prototype.close=function(e=!0){this.isOpen()&&(e&&(this._cachedRootElement&&this._canvas.setRootElement(this._cachedRootElement),this._cachedSelection&&this._selection.select(this._cachedSelection),this._cachedViewbox&&this._canvas.viewbox(this._cachedViewbox),this._eventBus.fire("searchPad.restored")),this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._unbindEvents(),this._open=!1,yt(this._canvas.getContainer()).remove("djs-search-open"),yt(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},$e.prototype.toggle=function(){this.isOpen()?this.close():this.open()},$e.prototype.isOpen=function(){return this._open},$e.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&yt(t).remove($e.RESULT_SELECTED_CLASS);var n=sn(e,$e.RESULT_ID_ATTRIBUTE),i=this._results[n].element;yt(e).add($e.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:Ox}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},$e.prototype._select=function(e){var t=sn(e,$e.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:Ox}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},$e.prototype._getBoxHtml=function(){const e=ft($e.BOX_HTML),t=ot($e.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function Dx(e,t,n){var i=PD(t),r=ft(n);r.innerHTML=i,e.appendChild(r)}function PD(e){var t="";return e.forEach(function(n){var i=Hv(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+$e.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}$e.CONTAINER_SELECTOR=".djs-search-container",$e.INPUT_SELECTOR=".djs-search-input input",$e.RESULTS_CONTAINER_SELECTOR=".djs-search-results",$e.RESULT_SELECTOR=".djs-search-result",$e.RESULT_SELECTED_CLASS="djs-search-result-selected",$e.RESULT_SELECTED_SELECTOR="."+$e.RESULT_SELECTED_CLASS,$e.RESULT_ID_ATTRIBUTE="data-result-id",$e.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",$e.BOX_HTML=`<div class="djs-search-container djs-scrollable">
|
|
335
|
+
</svg>`},Vk=900;function Wa(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",Vk,this)}Wa.$inject=["popupMenu","distributeElements","translate","rules"],Wa.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&z(t,this._getEntries(e)),t},Wa.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Wa.prototype._getEntries=function(e){var t=this._distributeElements,n=this._translate,i=this._popupMenu,r={"distribute-elements-horizontal":{group:"distribute",title:n("Distribute elements horizontally"),className:"bjs-align-elements-menu-entry",imageHtml:L_.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:L_.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const Wk={__depends__:[Tf,Gk],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",pu],distributeElementsMenuProvider:["type",Wa]};var I_="is not a registered action",Uk="is already registered";function ei(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}ei.$inject=["eventBus","injector"],ei.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),i=e.get("selection",!1),r=e.get("zoomScroll",!1),o=e.get("copyPaste",!1),a=e.get("canvas",!1),s=e.get("rules",!1),c=e.get("keyboardMove",!1),u=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),o&&i&&this.register("copy",function(){var l=i.get();if(l.length)return o.copy(l)}),o&&i&&this.register("duplicate",function(){var l=i.get();if(l.length)return o.duplicate(l)}),o&&this.register("paste",function(){o.paste()}),o&&i&&s&&this.register("cut",function(){var l=i.get();if(l.length){var f=s.allowed("elements.delete",{elements:l});if(f!==!1){var p=ke(f)?f:l;return o.cut(p.slice())}}}),r&&this.register("stepZoom",function(l){r.stepZoom(l.value)}),a&&this.register("zoom",function(l){a.zoom(l.value)}),n&&i&&s&&this.register("removeSelection",function(){var l=i.get();if(l.length){var f=s.allowed("elements.delete",{elements:l}),p;f!==!1&&(ke(f)?p=f:p=l,p.length&&n.removeElements(p.slice()))}}),c&&this.register("moveCanvas",function(l){c.moveCanvas(l)}),u&&this.register("moveSelection",function(l){u.moveSelection(l.direction,l.accelerated)})},ei.prototype.trigger=function(e,t){if(!this._actions[e])throw Ff(e,I_);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},ei.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);I(e,function(i,r){n._registerAction(r,i)})},ei.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Ff(e,Uk);this._actions[e]=t},ei.prototype.unregister=function(e){if(!this.isRegistered(e))throw Ff(e,I_);this._actions[e]=void 0},ei.prototype.getActions=function(){return Object.keys(this._actions)},ei.prototype.isRegistered=function(e){return!!this._actions[e]};function Ff(e,t){return new Error(e+" "+t)}const qk={__init__:["editorActions"],editorActions:["type",ei]};function fu(e){e.invoke(ei,this)}ye(fu,ei),fu.$inject=["injector"],fu.prototype._registerDefaultActions=function(e){ei.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),i=e.get("selection",!1),r=e.get("spaceTool",!1),o=e.get("lassoTool",!1),a=e.get("handTool",!1),s=e.get("globalConnect",!1),c=e.get("distributeElements",!1),u=e.get("alignElements",!1),l=e.get("directEditing",!1),f=e.get("searchPad",!1),p=e.get("modeling",!1),d=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",function(){var g=t.getRootElement(),h=n.filter(function(m){return m!==g});return i.select(h),h}),r&&this._registerAction("spaceTool",function(){r.toggle()}),o&&this._registerAction("lassoTool",function(){o.toggle()}),a&&this._registerAction("handTool",function(){a.toggle()}),s&&this._registerAction("globalConnectTool",function(){s.toggle()}),i&&c&&this._registerAction("distributeElements",function(g){var h=i.get(),m=g.type;h.length&&c.trigger(h,m)}),i&&u&&this._registerAction("alignElements",function(g){var h=i.get(),m=[],_=g.type;h.length&&(m=Ue(h,function(y){return!w(y,"bpmn:Lane")}),u.trigger(m,_))}),i&&p&&this._registerAction("setColor",function(g){var h=i.get();h.length&&p.setColor(h,g)}),i&&l&&this._registerAction("directEditing",function(){var g=i.get();g.length&&l.activate(g[0])}),f&&this._registerAction("find",function(){f.toggle()}),t&&p&&this._registerAction("moveToOrigin",function(){var g=t.getRootElement(),h,m;w(g,"bpmn:Collaboration")?m=n.filter(function(_){return w(_.parent,"bpmn:Collaboration")}):m=n.filter(function(_){return _!==g&&!w(_.parent,"bpmn:SubProcess")}),h=kt(m),p.moveElements(m,{x:-h.x,y:-h.y},g)}),i&&d&&this._registerAction("replaceElement",function(g){d.triggerEntry("replace","click",g)})};const Yk={__depends__:[qk],editorActions:["type",fu]};function B_(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;We(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}B_.$inject=["eventBus"];function Ur(e,t){te.call(this,e),this._gridSnapping=t;var n=this;this.preExecute("shape.resize",function(i){var r=i.context,o=r.hints||{},a=o.autoResize;if(a){var s=r.shape,c=r.newBounds;En(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}Ur.$inject=["eventBus","gridSnapping","modeling"],ye(Ur,te),Ur.prototype.snapSimple=function(e,t){var n=this._gridSnapping;return t.width=n.snapValue(t.width,{min:t.width}),t.height=n.snapValue(t.height,{min:t.height}),t.x=e.x+e.width/2-t.width/2,t.y=e.y+e.height/2-t.height/2,t},Ur.prototype.snapComplex=function(e,t){return/w|e/.test(t)&&(e=this.snapHorizontally(e,t)),/n|s/.test(t)&&(e=this.snapVertically(e,t)),e},Ur.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,i=/w/.test(t),r=/e/.test(t),o={};return o.width=n.snapValue(e.width,{min:e.width}),r&&(i?(o.x=n.snapValue(e.x,{max:e.x}),o.width+=n.snapValue(e.x-o.x,{min:e.x-o.x})):e.x=e.x+e.width-o.width),z(e,o),e},Ur.prototype.snapVertically=function(e,t){var n=this._gridSnapping,i=/n/.test(t),r=/s/.test(t),o={};return o.height=n.snapValue(e.height,{min:e.height}),i&&(r?(o.y=n.snapValue(e.y,{max:e.y}),o.height+=n.snapValue(e.y-o.y,{min:e.y-o.y})):e.y=e.y+e.height-o.height),z(e,o),e};var Kk=2e3;function N_(e,t){e.on(["spaceTool.move","spaceTool.end"],Kk,function(n){var i=n.context;if(i.initialized){var r=i.axis,o;r==="x"?(o=t.snapValue(n.dx),n.x=n.x+o-n.dx,n.dx=o):(o=t.snapValue(n.dy),n.y=n.y+o-n.dy,n.dy=o)}})}N_.$inject=["eventBus","gridSnapping"];const Xk={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Ur],gridSnappingSpaceToolBehavior:["type",N_]};var du=10;function jf(e,t,n){return n||(n="round"),Math[n](e/t)*t}var Zk=1200,Qk=800;function vr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",Qk,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"],Zk,function(o){var a=o.originalEvent;if(!(!r.active||a&&Mn(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(u){var l={},f=eO(o,u,e);f&&(l.offset=f);var p=Jk(o,u);p&&z(l,p),$o(o,u)||r.snapEvent(o,u,l)})}})}vr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);It(e,t,i)},vr.prototype.getGridSpacing=function(){return du},vr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=jf(e,du);var i,r;return t&&t.min&&(i=t.min,Ie(i)&&(i=jf(i+n,du,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,Ie(r)&&(r=jf(r+n,du,"floor"),e=Math.min(e,r))),e-=n,e},vr.prototype.isActive=function(){return this.active},vr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},vr.prototype.toggleActive=function(){this.setActive(!this.active)},vr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function Jk(e,t){var n=e.context,i=n.createConstraints,r=n.resizeConstraints||{},o=n.gridSnappingContext,a=o.snapConstraints;if(a&&a[t])return a[t];a||(a=o.snapConstraints={}),a[t]||(a[t]={});var s=n.direction;i&&(hu(t)?(a.x.min=i.left,a.x.max=i.right):(a.y.min=i.top,a.y.max=i.bottom));var c=r.min,u=r.max;return c&&(hu(t)?F_(s)?a.x.max=c.left:a.x.min=c.right:$_(s)?a.y.max=c.top:a.y.min=c.bottom),u&&(hu(t)?F_(s)?a.x.min=u.left:a.x.max=u.right:$_(s)?a.y.min=u.top:a.y.max=u.bottom),a[t]}function eO(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&Ie(s[t])||(s||(s=o.snapOffset={}),Ie(s[t])||(s[t]=0),!r)||(n.get(r.id)||(hu(t)?s[t]+=r[t]+r.width/2:s[t]+=r[t]+r.height/2),!a)||(t==="x"?/left/.test(a)?s[t]-=r.width/2:/right/.test(a)&&(s[t]+=r.width/2):/top/.test(a)?s[t]-=r.height/2:/bottom/.test(a)&&(s[t]+=r.height/2)),s[t]}function hu(e){return e==="x"}function $_(e){return e.indexOf("n")!==-1}function F_(e){return e.indexOf("w")!==-1}const tO={__depends__:[Xk],__init__:["gridSnapping"],gridSnapping:["type",vr]};var nO=2e3;function j_(e,t,n){e.on("autoPlace",nO,function(i){var r=i.source,o=Oe(r),a=i.shape,s=Fv(r,a,n);return["x","y"].forEach(function(c){var u={};s[c]!==o[c]&&(s[c]>o[c]?u.min=s[c]:u.max=s[c],w(a,"bpmn:TextAnnotation")&&(iO(c)?u.offset=-a.width/2:u.offset=-a.height/2),s[c]=t.snapValue(s[c],u))}),s})}j_.$inject=["eventBus","gridSnapping","elementRegistry"];function iO(e){return e==="x"}var rO=1750;function H_(e,t,n){t.on(["create.start","shape.move.start"],rO,function(i){var r=i.context,o=r.shape,a=e.getRootElement();if(!(!w(o,"bpmn:Participant")||!w(a,"bpmn:Process")||!a.children.length)){var s=r.createConstraints;s&&(o.width=n.snapValue(o.width,{min:o.width}),o.height=n.snapValue(o.height,{min:o.height}))}})}H_.$inject=["canvas","eventBus","gridSnapping"];var oO=3e3;function mu(e,t,n){te.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],oO,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||aO(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}mu.$inject=["eventBus","gridSnapping","modeling"],ye(mu,te),mu.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=uO(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function aO(e){return e.length>3}function sO(e){return e==="h"}function cO(e){return e==="v"}function uO(e,t,n){var i=Mi(t,n),r={};return sO(i)&&(r.y=e.snapValue(t.y)),cO(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=z({},t,r),n=z({},n,r)),[t,n]}const lO={__depends__:[tO,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",j_],gridSnappingParticipantBehavior:["type",H_],gridSnappingLayoutConnectionBehavior:["type",mu]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",B_]};var pO=30,z_=30;function Ua(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var r=i.element,o=i.gfx;if(w(r,"bpmn:Lane"))return n._createParticipantHit(r,o);if(w(r,"bpmn:Participant"))return Ye(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(w(r,"bpmn:SubProcess"))return Ye(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}Ua.$inject=["eventBus","interactionEvents"],Ua.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Ua.prototype._createParticipantHit=function(e,t){this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height});var n=Kt(e)?{width:pO,height:e.height}:{width:e.width,height:z_};return this._interactionEvents.createBoxHit(t,"all",n),!0},Ua.prototype._createSubProcessHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"all",{width:e.width,height:z_}),!0};const fO={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Ua]};function gu(e){e.invoke(ko,this)}ye(gu,ko),gu.$inject=["injector"],gu.prototype.registerBindings=function(e,t){ko.prototype.registerBindings.call(this,e,t);function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("selectElements",function(i){var r=i.keyEvent;if(e.isKey(["a","A"],r)&&e.isCmd(r))return t.trigger("selectElements"),!0}),n("find",function(i){var r=i.keyEvent;if(e.isKey(["f","F"],r)&&e.isCmd(r))return t.trigger("find"),!0}),n("spaceTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["s","S"],r))return t.trigger("spaceTool"),!0}),n("lassoTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["l","L"],r))return t.trigger("lassoTool"),!0}),n("handTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["h","H"],r))return t.trigger("handTool"),!0}),n("globalConnectTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["c","C"],r))return t.trigger("globalConnectTool"),!0}),n("directEditing",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["e","E"],r))return t.trigger("directEditing"),!0}),n("replaceElement",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["r","R"],r))return t.trigger("replaceElement",r),!0})};const dO={__depends__:[hf],__init__:["keyboardBindings"],keyboardBindings:["type",gu]};var hO={moveSpeed:1,moveSpeedAccelerated:10},mO=1500,G_="left",V_="up",W_="right",U_="down",gO={ArrowLeft:G_,Left:G_,ArrowUp:V_,Up:V_,ArrowRight:W_,Right:W_,ArrowDown:U_,Down:U_},yO={left:function(e){return{x:-e,y:0}},up:function(e){return{x:0,y:-e}},right:function(e){return{x:e,y:0}},down:function(e){return{x:0,y:e}}};function q_(e,t,n,i,r){var o=this;this._config=z({},hO,e||{}),t.addListener(mO,function(a){var s=a.keyEvent,c=gO[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=yO[a](u),f=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});f&&n.moveElements(c,l)}}}q_.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const vO={__depends__:[hf,Kn],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",q_]};var Y_=10;function qa(e,t,n,i){this._dragging=i,this._rules=t;var r=this;function o(c,u){var l=c.shape,f=c.direction,p=c.resizeConstraints,d;c.delta=u,d=hC(l,f,u),c.newBounds=gC(d,p),c.canExecute=r.canResize(c)}function a(c){var u=c.resizeConstraints,l=c.minBounds;u===void 0&&(l===void 0&&(l=r.computeMinResizeBox(c)),c.resizeConstraints={min:Te(l)})}function s(c){var u=c.shape,l=c.canExecute,f=c.newBounds;if(l){if(f=pm(f),!bO(u,f))return;n.resizeShape(u,f)}}e.on("resize.start",function(c){a(c.context)}),e.on("resize.move",function(c){var u={x:c.dx,y:c.dy};o(c.context,u)}),e.on("resize.end",function(c){s(c.context)})}qa.prototype.canResize=function(e){var t=this._rules,n=ni(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},qa.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=z({shape:t},n),o=r.direction,!o)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");i.init(e,K_(t,o),"resize",{autoActivate:!0,cursor:_O(o),data:{shape:t,context:r}})},qa.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:Y_,height:Y_},r=Qm(t,e.childrenBoxPadding),yC(n,t,i,r)},qa.$inject=["eventBus","rules","modeling","dragging"];function bO(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function K_(e,t){var n=Oe(e),i=Te(e),r={x:n.x,y:n.y};return t.indexOf("n")!==-1?r.y=i.top:t.indexOf("s")!==-1&&(r.y=i.bottom),t.indexOf("e")!==-1?r.x=i.right:t.indexOf("w")!==-1&&(r.x=i.left),r}function _O(e){var t="resize-";return e==="n"||e==="s"?t+"ns":e==="e"||e==="w"?t+"ew":e==="nw"||e==="se"?t+"nwse":t+"nesw"}var X_="djs-resizing",Z_="resize-not-ok",xO=500;function Q_(e,t,n){function i(o){var a=o.shape,s=o.newBounds,c=o.frame;c||(c=o.frame=n.addFrame(a,t.getActiveLayer()),t.addMarker(a,X_)),s.width>5&&ve(c,{x:s.x,width:s.width}),s.height>5&&ve(c,{y:s.y,height:s.height}),o.canExecute?Xe(c).remove(Z_):Xe(c).add(Z_)}function r(o){var a=o.shape,s=o.frame;s&&zt(o.frame),t.removeMarker(a,X_)}e.on("resize.move",xO,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}Q_.$inject=["eventBus","canvas","previewSupport"];var yu=-6,vu=8,bu=20,Ya="djs-resizer",wO=["n","w","s","e","nw","ne","se","sw"];function br(e,t,n,i){this._resize=i,this._canvas=t;var r=this;e.on("selection.changed",function(o){var a=o.newSelection;r.removeResizers(),a.length===1&&I(a,bn(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}br.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){sr(o)&&i.activate(o,e,n)}Ne.bind(t,"mousedown",r),Ne.bind(t,"touchstart",r)},br.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=EO(i),a=Ce("g");Xe(a).add(Ya),Xe(a).add(Ya+"-"+e.id),Xe(a).add(Ya+"-"+i),Fe(r,a);var s=Ce("rect");ve(s,{x:-vu/2+o.x,y:-vu/2+o.y,width:vu,height:vu}),Xe(s).add(Ya+"-visual"),Fe(a,s);var c=Ce("rect");return ve(c,{x:-bu/2+o.x,y:-bu/2+o.y,width:bu,height:bu}),Xe(c).add(Ya+"-hit"),Fe(a,c),Ds(a,t,n),a},br.prototype.createResizer=function(e,t){var n=K_(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},br.prototype.addResizer=function(e){var t=this;at(e)||I(wO,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},br.prototype.removeResizers=function(){var e=this._getResizersParent();Ss(e)},br.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},br.$inject=["eventBus","canvas","selection","resize"];function EO(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-yu:e.indexOf("w")!==-1&&(t.x=yu),e.indexOf("s")!==-1?t.y=-yu:e.indexOf("n")!==-1&&(t.y=yu),t}const J_={__depends__:[bi,Bi,Ao],__init__:["resize","resizePreview","resizeHandles"],resize:["type",qa],resizePreview:["type",Q_],resizeHandles:["type",br]};var SO=2e3;function Ka(e,t,n,i,r,o,a){this._bpmnFactory=t,this._canvas=n,this._modeling=r,this._textRenderer=a,i.registerProvider(this),e.on("element.dblclick",function(c){s(c.element,!0)}),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open","root.set","selection.changed"],function(){i.isActive()&&i.complete()}),e.on(["shape.remove","connection.remove"],SO,function(c){i.isActive(c.element)&&i.cancel()}),e.on(["commandStack.changed"],function(c){i.isActive()&&i.cancel()}),e.on("directEditing.activate",function(c){o.removeResizers()}),e.on("create.end",500,function(c){var u=c.context,l=u.shape,f=c.context.canExecute,p=c.isTouch;p||f&&(u.hints&&u.hints.createElementsBehavior===!1||s(l))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,u){(u||We(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}Ka.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Ka.prototype.activate=function(e){var t=jn(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);z(n,i);var r={},o=n.style||{};return z(o,{backgroundColor:null,border:null}),(We(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||ex(e))&&z(r,{centerVertically:!0}),ir(e)&&(z(r,{resizable:!0,autoResize:!0}),z(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),w(e,"bpmn:TextAnnotation")&&(z(r,{resizable:!0,autoResize:!0}),z(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),z(n,{options:r,style:o}),n}},Ka.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),r={x:i.x+i.width/2,y:i.y+i.height/2},o={x:i.x,y:i.y},a=t.zoom(),s=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),u=c.fontSize*a,l=c.lineHeight,f=s.fontSize*a,p=s.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(w(e,"bpmn:Lane")||PO(e)){var g=Kt(e),h=g?{width:i.height,height:30*a,x:i.x-i.height/2+15*a,y:r.y-30*a/2}:{width:i.width,height:30*a};z(o,h),z(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:g?"rotate(-90deg)":null})}if(CO(e)){var m=Kt(e),_=m?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:r.x-i.height/2,y:r.y-i.width/2};z(o,_),z(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:m?null:"rotate(-90deg)"})}(We(e,["bpmn:Task","bpmn:CallActivity"])||ex(e))&&(z(o,{width:i.width,height:i.height}),z(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),RO(e)&&(z(o,{width:i.width,x:i.x}),z(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var y=1,x=i.width+2*y;if(n.labelTarget&&(z(o,{width:x,height:i.height+2*y,x:i.x-y,y:i.y-y}),z(d,{fontSize:u+"px",lineHeight:l})),ir(n)&&!Bs(n)&&!ze(n)){var S=Pl(e),P=t.getAbsoluteBBox({x:S.x,y:S.y,width:0,height:0}),C=u,D=Lr.width*a+2*y;z(o,{width:D,height:C+2*y,x:P.x-D/2,y:P.y-C/2-y}),z(d,{fontSize:u+"px",lineHeight:l})}return w(e,"bpmn:TextAnnotation")&&(z(o,{width:i.width+2*y,height:i.height+2*y,x:i.x-y,y:i.y-y,minWidth:30*a,minHeight:10*a}),z(d,{textAlign:"left",paddingTop:mo*a+"px",paddingBottom:mo*a+"px",paddingLeft:mo*a+"px",paddingRight:mo*a+"px",fontSize:f+"px",lineHeight:p})),{bounds:o,style:d}},Ka.prototype.update=function(e,t,n,i){var r,o;w(e,"bpmn:TextAnnotation")&&(o=this._canvas.getAbsoluteBBox(e),r={x:e.x,y:e.y,width:e.width/o.width*i.width,height:e.height/o.height*i.height}),AO(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function ex(e){return w(e,"bpmn:SubProcess")&&!Ye(e)}function RO(e){return w(e,"bpmn:SubProcess")&&Ye(e)}function CO(e){return w(e,"bpmn:Participant")&&!Ye(e)}function PO(e){return w(e,"bpmn:Participant")&&Ye(e)}function AO(e){return!e||!e.trim()}var tx="djs-element-hidden",nx="djs-label-hidden";function ix(e,t,n){var i=this,r=t.getDefaultLayer(),o,a,s;e.on("directEditing.activate",function(c){var u=c.active;if(o=u.element.label||u.element,w(o,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(o),s=Ce("g");var l=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:o.height,position:{mx:0,my:0}}),f=i.path=Ce("path");ve(f,{d:l,strokeWidth:2,stroke:TO(o)}),Fe(s,f),Fe(r,s),nn(s,o.x,o.y)}w(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,tx):(w(o,"bpmn:Task")||w(o,"bpmn:CallActivity")||w(o,"bpmn:SubProcess")||w(o,"bpmn:Participant")||w(o,"bpmn:Lane"))&&t.addMarker(o,nx)}),e.on("directEditing.resize",function(c){if(w(o,"bpmn:TextAnnotation")){var u=c.height,l=c.dy,f=Math.max(o.height/a.height*(u+l),0),p=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:f,position:{mx:0,my:0}});ve(i.path,{d:p})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var u=c.active;u&&(t.removeMarker(u.element.label||u.element,tx),t.removeMarker(o,nx)),o=void 0,a=void 0,s&&(zt(s),s=void 0)})}ix.$inject=["eventBus","canvas","pathMap"];function TO(e,t){var n=Ze(e);return n.get("stroke")||t||"black"}const MO={__depends__:[Wp,J_,A_],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Ka],labelEditingPreview:["type",ix]};var kO=500,OO=1e3;function wi(e,t,n){this._eventBus=e,this._elementRegistry=n,this._outlineOffset=5,this._outlineStyle=t.cls("djs-outline",["no-fill"]);var i=this;function r(o){gS(o)||i.createOutline(o)}e.on("element.hover",function(o){r(o.element)}),e.on("selection.changed",function(o){I(o.newSelection,r)}),e.on(["shape.changed","connection.changed"],kO,function(o){var a=o.element,s=o.gfx,c=ot(".djs-outline",s);c&&i.updateOutline(a,c)})}wi.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=ot(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),Fe(t,n),this.updateOutline(e,n)),n},wi.prototype._createOutlineGfx=function(){var e=Ce("rect");return ve(e,z({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},wi.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},wi.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&I(i,function(r){n=n||r.updateOutline(t,e)}),n||ve(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},wi.prototype.updateConnectionOutline=function(e,t){var n=kt(t);ve(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},wi.prototype.registerProvider=function(e,t){t||(t=e,e=OO),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},wi.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},wi.prototype.getOutline=function(e){var t,n=this._getProviders();return I(n,function(i){qt(i.getOutline)&&(t=t||i.getOutline(e))}),t},wi.$inject=["eventBus","styles","elementRegistry"];var _u=6;function Hf(e,t,n){this._canvas=t;var i=this;e.on("element.changed",function(r){n.isSelected(r.element)&&i._updateMultiSelectionOutline(n.get())}),e.on("selection.changed",function(r){var o=r.newSelection;i._updateMultiSelectionOutline(o)})}Hf.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Ss(t);var n=e.length>1,i=this._canvas.getContainer();if(Xe(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=DO(kt(e)),o=Ce("rect");ve(o,z({rx:3},r)),Xe(o).add("djs-selection-outline"),Fe(t,o)}},Hf.$inject=["eventBus","canvas","selection"];function DO(e){return{x:e.x-_u,y:e.y-_u,width:e.width+_u*2,height:e.height+_u*2}}const zf={__depends__:[Kn],__init__:["outline","multiSelectionOutline"],outline:["type",wi],multiSelectionOutline:["type",Hf]},rx=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],ox={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},LO=15,xu=2;function ax(e,t,n,i,r){const o=t.getLayer("overlays");e.on(["selection.changed","shape.changed"],function(){s()}),e.on("selection.changed",function({newSelection:f}){var d;const p=f.filter(g=>We(g,rx));if(p.length===1){const g=p[0];ze(g)?a(g,g.labelTarget):(d=g.labels)!=null&&d.length&&a(g.labels[0],g)}if(p.length===2){const g=p.find(ze),h=p.find(m=>{var _;return(_=m.labels)==null?void 0:_.includes(g)});g&&h&&a(g,h)}}),e.on("shape.changed",function({element:f}){var p;!We(f,rx)||!l(f)||(ze(f)?a(f,f.labelTarget):(p=f.labels)!=null&&p.length&&a(f.labels[0],f))});function a(f,p){const d=Qo([Oe(p),Oe(f)],ox),g=d.getAttribute("d"),m=r.isSelected(f)?c(f):u(f),_=na(m,g);if(!_)return;const x=r.isSelected(p)?c(p):u(p),S=na(x,g)||Oe(p);fa(S,_)<LO||(bl(d,[S,_]),Fe(o,d))}function s(){Es(`.${ox.class}`,o).forEach(zt)}function c(f){const p=i.getOutline(f);if(!p)return u(f);if(p.x){const d={x:f.x+_r(p,"x")-xu,y:f.y+_r(p,"y")-xu,width:_r(p,"width")+xu*2,height:_r(p,"height")+xu*2};return Tl(d,_r(p,"rx"))}if(p.cx){const d=_r(p,"r"),g={x:f.x+_r(p,"cx")-d,y:f.y+_r(p,"cy")-d,width:d*2,height:d*2};return Im(g)}}function u(f){return n.getShapePath(f)}function l(f){return r.isSelected(f)}}ax.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function _r(e,t){return parseFloat(ve(e,t)||0)}const IO={__depends__:[Kn,zf],__init__:["labelLink"],labelLink:["type",ax]};var BO=new Po("tt");function NO(e){var t=mt('<div class="djs-tooltip-container" />');return mn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function $O(e,t,n){mn(e,{left:t+"px",top:n+"px"})}function Gf(e,t){e.style.display=t===!1?"none":""}var sx="djs-tooltip",Vf="."+sx;function xn(e,t){this._eventBus=e,this._canvas=t,this._ids=BO,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=NO(t.getContainer());var n=this;Pn.bind(this._tooltipRoot,Vf,"mousedown",function(i){i.stopPropagation()}),Pn.bind(this._tooltipRoot,Vf,"mouseover",function(i){n.trigger("mouseover",i)}),Pn.bind(this._tooltipRoot,Vf,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}xn.$inject=["eventBus","canvas"],xn.prototype.add=function(e){if(!e.position)throw new Error("must specifiy tooltip position");if(!e.html)throw new Error("must specifiy tooltip html");var t=this._ids.next();return e=z({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},xn.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(un(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},xn.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},xn.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},xn.prototype.setTimeout=function(e){if(e=this.get(e),!!e){this.clearTimeout(e);var t=this;e.removeTimer=setTimeout(function(){t.remove(e)},e.timeout)}},xn.prototype.remove=function(e){var t=this.get(e);t&&(di(t.html),di(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},xn.prototype.show=function(){Gf(this._tooltipRoot)},xn.prototype.hide=function(){Gf(this._tooltipRoot,!1)},xn.prototype._updateRoot=function(e){var t=e.scale||1,n=e.scale||1,i="matrix("+t+",0,0,"+n+","+-1*e.x*t+","+-1*e.y*n+")";this._tooltipRoot.style.transform=i,this._tooltipRoot.style["-ms-transform"]=i},xn.prototype._addTooltip=function(e){var t=e.id,n=e.html,i,r=this._tooltipRoot;n.get&&n.constructor.prototype.jquery&&(n=n.get(0)),En(n)&&(n=mt(n)),i=mt('<div data-tooltip-id="'+t+'" class="'+sx+'">'),mn(i,{position:"absolute"}),i.appendChild(n),e.type&&_t(i).add("djs-tooltip-"+e.type),e.className&&_t(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},xn.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;$O(n,t.x,t.y)},xn.prototype._updateTooltipVisibilty=function(e){I(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),Gf(i,r))})},xn.prototype._init=function(){var e=this;function t(n){e._updateRoot(n),e._updateTooltipVisibilty(n),e.show()}this._eventBus.on("canvas.viewbox.changing",function(n){e.hide()}),this._eventBus.on("canvas.viewbox.changed",function(n){t(n.viewbox)})};const FO={__init__:["tooltips"],tooltips:["type",xn]};var jO="flow elements must be children of pools/participants",HO="Data object must be placed within a pool/participant.";function cx(e,t,n){function i(r,o,a){t.add({position:{x:r.x+5,y:r.y+5},type:"error",timeout:2e3,html:"<div>"+o+"</div>"})}e.on(["shape.move.rejected","create.rejected"],function(r){var o=r.context,a=o.shape,s=o.target;w(s,"bpmn:Collaboration")&&(w(a,"bpmn:FlowNode")?i(r,n(jO)):w(a,"bpmn:DataObjectReference")&&i(r,n(HO)))})}cx.$inject=["eventBus","tooltips","translate"];const zO={__depends__:[FO],__init__:["modelingFeedback"],modelingFeedback:["type",cx]};var GO=500,VO=1250,WO=1500,wu=Math.round;function UO(e){return{x:e.x+wu(e.width/2),y:e.y+wu(e.height/2)}}function ux(e,t,n,i,r){function o(s,c,u,l){return r.allowed("elements.move",{shapes:s,delta:c,position:u,target:l})}e.on("shape.move.start",WO,function(s){var c=s.context,u=s.shape,l=i.get().slice();l.indexOf(u)===-1&&(l=[u]),l=qO(l),z(c,{shapes:l,validatedShapes:l,shape:u})}),e.on("shape.move.start",VO,function(s){var c=s.context,u=c.validatedShapes,l;if(l=c.canExecute=o(u),!l)return!1}),e.on("shape.move.move",GO,function(s){var c=s.context,u=c.validatedShapes,l=s.hover,f={x:s.dx,y:s.dy},p={x:s.x,y:s.y},d;if(d=o(u,f,p,l),c.delta=f,c.canExecute=d,d===null){c.target=null;return}c.target=l}),e.on("shape.move.end",function(s){var c=s.context,u=c.delta,l=c.canExecute,f=l==="attach",p=c.shapes;if(l===!1)return!1;u.x=wu(u.x),u.y=wu(u.y),!(u.x===0&&u.y===0)&&n.moveElements(p,u,c.target,{primaryShape:c.shape,attach:f})}),e.on("element.mousedown",function(s){if(sr(s)){var c=Eo(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,u,l){if(Ut(u)&&(l=u,u=!1),!(c.waypoints||!c.parent)&&!Xe(s.target).has("djs-hit-no-move")){var f=UO(c),p=t.init(s,f,"shape.move",{cursor:"grabbing",autoActivate:u,data:{shape:c,context:l||{}}});if(p!==!1)return!0}}this.start=a}ux.$inject=["eventBus","dragging","modeling","selection","rules"];function qO(e){var t=Jr(e,"id");return Ue(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var lx=499,Wf="djs-dragging",px="drop-ok",fx="drop-not-ok",dx="new-parent",hx="attach-ok";function mx(e,t,n,i){function r(c){var u=o(c),l=YO(u);return l}function o(c){var u=Jo(c),l=u.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),f=u.concat(l),p=[...new Set(f)];return p}function a(c,u){[hx,px,fx,dx].forEach(function(l){l===u?t.addMarker(c,l):t.removeMarker(c,l)})}function s(c,u,l){i.addDragger(u,c.dragGroup),l&&t.addMarker(u,Wf),c.allDraggedElements?c.allDraggedElements.push(u):c.allDraggedElements=[u]}e.on("shape.move.start",lx,function(c){var u=c.context,l=u.shapes,f=u.allDraggedElements,p=r(l);if(!u.dragGroup){var d=Ce("g");ve(d,n.cls("djs-drag-group",["no-events"]));var g=t.getActiveLayer();Fe(g,d),u.dragGroup=d}p.forEach(function(h){i.addDragger(h,u.dragGroup)}),f?f=Ou([f,o(l)]):f=o(l),I(f,function(h){t.addMarker(h,Wf)}),u.allDraggedElements=f,u.differentParents=KO(l)}),e.on("shape.move.move",lx,function(c){var u=c.context,l=u.dragGroup,f=u.target,p=u.shape.parent,d=u.canExecute;f&&(d==="attach"?a(f,hx):u.canExecute&&p&&f.id!==p.id?a(f,dx):a(f,u.canExecute?px:fx)),nn(l,c.dx,c.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(c){var u=c.context,l=u.target;l&&a(l,null)}),e.on("shape.move.cleanup",function(c){var u=c.context,l=u.allDraggedElements,f=u.dragGroup;I(l,function(p){t.removeMarker(p,Wf)}),f&&zt(f)}),this.makeDraggable=s}mx.$inject=["eventBus","canvas","styles","previewSupport"];function YO(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=Ue(e,function(i){return at(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function KO(e){return G0(Jr(e,function(t){return t.parent&&t.parent.id}))!==1}const XO={__depends__:[dc,Kn,zf,bi,Bi,Ao],__init__:["move","movePreview"],move:["type",ux],movePreview:["type",mx]};var gx=".djs-palette-toggle",yx=".entry",ZO=gx+", "+yx,Uf="djs-palette-",QO="shown",qf="open",vx="two-column",JO=1e3;function Bt(e,t){this._eventBus=e,this._canvas=t;var n=this;e.on("tool-manager.update",function(i){var r=i.tool;n.updateToolHighlight(r)}),e.on("i18n.changed",function(){n._update()}),e.on("diagram.init",function(){n._diagramInitialized=!0,n._rebuild()})}Bt.$inject=["eventBus","canvas"],Bt.prototype.registerProvider=function(e,t){t||(t=e,e=JO),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},Bt.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(tD,{})},Bt.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},Bt.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=mt(Bt.HTML_MARKUP);n.appendChild(i),_t(n).add(Uf+QO),Pn.bind(i,ZO,"click",function(r){var o=r.delegateTarget;if(ll(o,gx))return e.toggle();e.trigger("click",r)}),Ne.bind(i,"mousedown",function(r){r.stopPropagation()}),Pn.bind(i,yx,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},Bt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},Bt.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,r,o=_t(n),a=_t(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(vx,r),a.toggle(Uf+vx,r),"open"in e&&(o.toggle(qf,e.open),a.toggle(Uf+qf,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},Bt.prototype._update=function(){var e=ot(".djs-palette-entries",this._container),t=this._entries=this.getEntries();xs(e),I(t,function(n,i){var r=n.group||"default",o=ot("[data-group="+La(r)+"]",e);o||(o=mt('<div class="group"></div>'),un(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=mt(a);if(o.appendChild(s),!n.separator&&(un(s,"data-action",i),n.title&&un(s,"title",n.title),n.className&&eD(s,n.className),n.imageUrl)){var c=mt("<img>");un(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},Bt.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=un(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},Bt.prototype.triggerEntry=function(e,t,n,i){var r=this._entries,o,a;if(o=r[e],!!o&&(a=o.action,this._eventBus.fire("palette.trigger",{entry:o,event:n})!==!1)){if(qt(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},Bt.prototype._layoutChanged=function(){this._toggleState({})},Bt.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},Bt.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},Bt.prototype.open=function(){this._toggleState({open:!0})},Bt.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Bt.prototype.isActiveTool=function(e){return e&&this._activeTool===e},Bt.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=ot(".djs-palette-entries",this._container),this._toolsContainer=ot("[data-group=tools]",t)),n=this._toolsContainer,I(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=_t(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},Bt.prototype.isOpen=function(){return _t(this._container).has(qf)},Bt.prototype._getParentContainer=function(){return this._canvas.getContainer()},Bt.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function eD(e,t){var n=_t(e),i=ke(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function tD(e,t){var n=t.getPaletteEntries();return qt(n)?n(e):(I(n,function(i,r){e[r]=i}),e)}const nD={__init__:["palette"],palette:["type",Bt]};var bx="crosshair",_x="selected",iD="djs-dragging-active-lasso";function xr(e,t,n,i,r,o,a){this._selection=r,this._dragging=n,this._mouse=a;var s=this,c={create:function(f){var p=t.getActiveLayer(),d=f.frame=Ce("rect");ve(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),Fe(p,d),u(!0),this.update(f)},update:function(f){var p=f.frame,d=f.bbox;p&&d&&ve(p,{x:d.x,y:d.y,width:d.width,height:d.height});var g=f.marked,h=f.lastMarked;if(g&&h){for(const m of h)g.has(m)||t.removeMarker(m,_x);for(const m of g)h.has(m)||t.addMarker(m,_x)}},remove:function(f){this.update(f),f.frame&&zt(f.frame),u(!1)}};function u(f){Xe(t.getContainer()).toggle(iD,f)}function l(f){var p=i.getAll();return new Set(Qr(uo(p,f)))}o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(f){var p=f.originalEvent.target;!f.hover&&!(p instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(f.originalEvent,!0)})}),e.on("lasso.end",0,function(f){var p=f.context;s._select(Array.from(p.marked))}),e.on("lasso.start",function(f){var p=f.context;p.bbox=xx(f),p.add=ac(f),p.lastMarked=new Set(r.get()),p.add?p.marked=p.lastMarked:p.marked=new Set,p.initialMarked=p.marked,c.create(p)}),e.on("lasso.move",function(f){var p=f.context,d=p.bbox=xx(f),g=l(d),h=p.initialMarked.union(g);p.lastMarked=p.marked,p.marked=h,c.update(p)}),e.on("lasso.cleanup",function(f){var p=f.context;p.lastMarked=p.marked,p.marked=new Set(r.get()),c.remove(f.context)}),e.on("element.mousedown",1500,function(f){if(ac(f))return s.activateLasso(f.originalEvent),!0})}xr.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],xr.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:bx,data:{context:{}},keepSelection:!0})},xr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:bx,data:{context:{}},keepSelection:!0})},xr.prototype._select=function(e){this._selection.select(e)},xr.prototype.select=function(e,t,n=[]){var i=Qr(uo(e,t));this._select([...n,...i])},xr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},xr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function xx(e){var t={x:e.x-e.dx,y:e.y-e.dy},n={x:e.x,y:e.y},i;return t.x<=n.x&&t.y<n.y||t.x<n.x&&t.y<=n.y?i={x:t.x,y:t.y,width:n.x-t.x,height:n.y-t.y}:t.x>=n.x&&t.y<n.y||t.x>n.x&&t.y<=n.y?i={x:n.x,y:t.y,width:t.x-n.x,height:n.y-t.y}:t.x<=n.x&&t.y>n.y||t.x<n.x&&t.y>=n.y?i={x:t.x,y:n.y,width:n.x-t.x,height:t.y-n.y}:t.x>=n.x&&t.y>n.y||t.x>n.x&&t.y>=n.y?i={x:n.x,y:n.y,width:t.x-n.x,height:t.y-n.y}:i={x:n.x,y:n.y,width:0,height:0},i}const rD={__depends__:[yc,va],__init__:["lassoTool"],lassoTool:["type",xr]};var Yf=1500,wx="grab";function Fo(e,t,n,i,r,o){this._dragging=n,this._mouse=o;var a=this,s=i.get("keyboard",!1);r.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",Yf,function(c){if(ma(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(Yf,function(c){if(!(!Ex(c.keyEvent)||a.isActive())){var u=a._mouse.getLastMoveEvent();a.activateMove(u,!!u)}},"keyboard.keydown"),s&&s.addListener(Yf,function(c){!Ex(c.keyEvent)||!a.isActive()||a.toggle()},"keyboard.keyup"),e.on("hand.end",function(c){var u=c.originalEvent.target;if(!c.hover&&!(u instanceof SVGElement))return!1;e.once("hand.ended",function(){a.activateMove(c.originalEvent,{reactivate:!0})})}),e.on("hand.move.move",function(c){var u=t.viewbox().scale;t.scroll({dx:c.dx*u,dy:c.dy*u})}),e.on("hand.move.end",function(c){var u=c.context,l=u.reactivate;return!ma(c)&&l&&e.once("hand.move.ended",function(f){a.activateHand(f.originalEvent,!0,!0)}),!1})}Fo.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Fo.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:wx,data:{context:n||{}}})},Fo.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:wx,data:{context:{reactivate:n}}})},Fo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Fo.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function Ex(e){return Gt("Space",e)}const oD={__depends__:[yc,va],__init__:["handTool"],handTool:["type",Fo]};var Sx="connect-ok",Rx="connect-not-ok";function jo(e,t,n,i,r,o,a){var s=this;this._dragging=t,this._rules=o,this._mouse=a,r.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",function(c){var u=c.context,l=c.hover,f=u.canStartConnect=s.canStartConnect(l);f!==null&&(u.startTarget=l,i.addMarker(l,f?Sx:Rx))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var u=c.context.startTarget,l=c.context.canStartConnect;u&&i.removeMarker(u,l?Sx:Rx)}),e.on(["global-connect.ended"],function(c){var u=c.context,l=u.startTarget,f={x:c.x,y:c.y},p=s.canStartConnect(l);if(p)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,l,f)}),!1})}jo.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],jo.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},jo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},jo.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},jo.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const aD={__depends__:[Nf,bi,Bi,yc,va],globalConnect:["type",jo]};function Kf(e,t,n,i,r,o,a,s){this._palette=e,this._create=t,this._elementFactory=n,this._spaceTool=i,this._lassoTool=r,this._handTool=o,this._globalConnect=a,this._translate=s,e.registerProvider(this)}Kf.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],Kf.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,i=this._spaceTool,r=this._lassoTool,o=this._handTool,a=this._globalConnect,s=this._translate;function c(f,p,d,g,h){function m(_){var y=n.createShape(z({type:f},h));t.start(_,y)}return{group:p,className:d,title:g,action:{dragstart:m,click:m}}}function u(f){var p=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),d=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:p});t.start(f,[p,d],{hints:{autoSelect:[p]}})}function l(f){t.start(f,n.createParticipantShape())}return z(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:s("Activate hand tool"),action:{click:function(f){o.activateHand(f)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:s("Activate lasso tool"),action:{click:function(f){r.activateSelection(f)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:s("Activate create/remove space tool"),action:{click:function(f){i.activateSelection(f)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:s("Activate global connect tool"),action:{click:function(f){a.start(f)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":c("bpmn:StartEvent","event","bpmn-icon-start-event-none",s("Create start event")),"create.intermediate-event":c("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",s("Create intermediate/boundary event")),"create.end-event":c("bpmn:EndEvent","event","bpmn-icon-end-event-none",s("Create end event")),"create.exclusive-gateway":c("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",s("Create gateway")),"create.task":c("bpmn:Task","activity","bpmn-icon-task",s("Create task")),"create.data-object":c("bpmn:DataObjectReference","data-object","bpmn-icon-data-object",s("Create data object reference")),"create.data-store":c("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",s("Create data store reference")),"create.subprocess-expanded":{group:"activity",className:"bpmn-icon-subprocess-expanded",title:s("Create expanded sub-process"),action:{dragstart:u,click:u}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:s("Create pool/participant"),action:{dragstart:l,click:l}},"create.group":c("bpmn:Group","artifact","bpmn-icon-group",s("Create group"))}),e};const sD={__depends__:[nD,mc,Jy,rD,oD,aD,ca],__init__:["paletteProvider"],paletteProvider:["type",Kf]};var cD=250;function Xf(e,t,n,i,r){te.call(this,e);function o(s){var c=s.canExecute.replacements;I(c,function(u){var l=u.oldElementId,f={type:u.newElementType};if(!s.visualReplacements[l]){var p=t.get(l);z(f,{x:p.x,y:p.y});var d=n.createShape(f);i.addShape(d,p.parent);var g=ot('[data-element-id="'+La(p.id)+'"]',s.dragGroup);g&&ve(g,{display:"none"});var h=r.addDragger(d,s.dragGroup);s.visualReplacements[l]=h,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;I(c,function(u,l){var f=ot('[data-element-id="'+La(l)+'"]',s.dragGroup);f&&ve(f,{display:"inline"}),u.remove(),c[l]&&delete c[l]})}e.on("shape.move.move",cD,function(s){var c=s.context,u=c.canExecute;c.visualReplacements||(c.visualReplacements={}),u&&u.replacements?o(c):a(c)})}Xf.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],ye(Xf,te);const uD={__depends__:[Ao],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Xf]};var lD=1250,Zf=40,pD=20,fD=10,Cx=20,Px=["x","y"],dD=Math.abs;function Ax(e){e.on(["connect.hover","connect.move","connect.end"],lD,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&Mn(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&hD(t,o,vD(o)),o&&yD(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Qn(r),We(o,["bpmn:Event","bpmn:Gateway"])&&Tx(t,Qn(o)),We(o,["bpmn:Task","bpmn:SubProcess"])&&mD(t,o),w(a,"bpmn:BoundaryEvent")&&s===a.host&&gD(t)):Mx(i,"bpmn:MessageFlow")?(w(r,"bpmn:Event")&&(n.connectionStart=Qn(r)),w(o,"bpmn:Event")&&Tx(t,Qn(o))):n.connectionStart=n.initialConnectionStart)})}Ax.$inject=["eventBus"];function hD(e,t,n){Px.forEach(function(i){var r=kx(i,t);e[i]<t[i]+n?It(e,i,t[i]+n):e[i]>t[i]+r-n&&It(e,i,t[i]+r-n)})}function mD(e,t){var n=Qn(t);Px.forEach(function(i){bD(e,t,i)&&It(e,i,n[i])})}function gD(e){var t=e.context,n=t.source,i=t.target;if(!_D(t)){var r=Qn(n),o=tn(r,i,-10),a=[];/top|bottom/.test(o)&&a.push("x"),/left|right/.test(o)&&a.push("y"),a.forEach(function(s){var c=e[s],u;dD(c-r[s])<Zf&&(c>r[s]?u=r[s]+Zf:u=r[s]-Zf,It(e,s,u))})}}function Tx(e,t){It(e,"x",t.x),It(e,"y",t.y)}function Mx(e,t){return e&&e.type===t}function yD(e,t){return Wi(t,function(n){return Mx(e,n)})}function kx(e,t){return e==="x"?t.width:t.height}function vD(e){return w(e,"bpmn:Task")?fD:pD}function bD(e,t,n){return e[n]>t[n]+Cx&&e[n]<t[n]+kx(n,t)-Cx}function _D(e){var t=e.hover,n=e.source;return t&&n&&t===n}function wr(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}wr.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},wr.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},wr.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},wr.prototype.getSnapLocations=function(){return this._snapLocations},wr.prototype.setSnapLocations=function(e){this._snapLocations=e},wr.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new Eu,n.initDefaults(this._defaultSnaps)),n};function Eu(){this._snapValues={}}Eu.prototype.add=function(e,t){var n=this._snapValues[e];n||(n=this._snapValues[e]={x:[],y:[]}),n.x.indexOf(t.x)===-1&&n.x.push(t.x),n.y.indexOf(t.y)===-1&&n.y.push(t.y)},Eu.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&ck(e[n],r[n],i)},Eu.prototype.initDefaults=function(e){var t=this;I(e||{},function(n,i){I(n,function(r){t.add(i,r)})})};var xD=1250;function Ei(e,t,n){var i=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],function(r){i.initSnap(r)}),t.on(["create.move","create.end","shape.move.move","shape.move.end"],xD,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&Mn(r.originalEvent))&&!($o(r)||!c)){var u=s.pointsForTarget(c);u.initialized||(u=i.addSnapTargetPoints(u,a,c),u.initialized=!0),n.snap(r,u)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){n.hide()})}Ei.$inject=["elementRegistry","eventBus","snapping"],Ei.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new wr);var o;t.get(i.id)?o=Qn(i,e):o={x:e.x+Qn(i).x,y:e.y+Qn(i).y};var a={x:o.x-i.width/2,y:o.y-i.height/2},s={x:o.x+i.width/2,y:o.y+i.height/2};return r.setSnapOrigin("mid",{x:o.x-e.x,y:o.y-e.y}),ze(i)||(r.setSnapOrigin("top-left",{x:a.x-e.x,y:a.y-e.y}),r.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),r},Ei.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return I(i,function(r){if(ze(r)){ze(t)&&e.add("mid",Qn(r));return}if(at(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);I(o,function(a){e.add("mid",a)});return}e.add("mid",Qn(r))}),!Ie(t.x)||!Ie(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Qn(t)),e},Ei.prototype.getSnapTargets=function(e,t){return y_(t).filter(function(n){return!wD(n)})};function wD(e){return!!e.hidden}var Ox=1500;function Ho(e,t){t.invoke(Ei,this),e.on(["create.move","create.end"],Ox,CD),e.on(["create.move","create.end","shape.move.move","shape.move.end"],Ox,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!$o(n)&&ED(n,o)})}ye(Ho,Ei),Ho.$inject=["eventBus","injector"],Ho.prototype.initSnap=function(e){var t=Ei.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return I(n.outgoing,function(r){var o=r.waypoints[0];o=o.original||o,t.setSnapOrigin(r.id+"-docking",Lx(o,i,e))}),I(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",Lx(o,i,e))}),w(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Ho.prototype.addSnapTargetPoints=function(e,t,n){Ei.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);I(i,function(o){(RD(o)||SD([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",m_(o)),e.add("bottom-right",g_(o)))});var r=this._elementRegistry;return I(t.incoming,function(o){if(r.get(t.id)){Dx(i,o.source)||e.add("mid",Oe(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),I(t.outgoing,function(o){if(r.get(t.id)){Dx(i,o.target)||e.add("mid",Oe(o.target));var a=o.waypoints[o.waypoints.length-1];e.add(o.id+"-docking",a.original||a)}}),w(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},Ho.prototype.getSnapTargets=function(e,t){return Ei.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!w(n,"bpmn:Lane")})};function ED(e,t){var n=Te(t),i=Kg(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=Oe(o),/top/.test(i)?It(e,"y",n.top-a.y):/bottom/.test(i)&&It(e,"y",n.bottom-a.y),/left/.test(i)?It(e,"x",n.left-a.x):/right/.test(i)&&It(e,"x",n.right-a.x)}function SD(e,t){return e.every(function(n){return w(n,t)})}function RD(e){return w(e,"bpmn:SubProcess")&&Ye(e)?!0:w(e,"bpmn:Participant")}function CD(e){var t=e.context,n=t.createConstraints;if(n){var i=n.top,r=n.right,o=n.bottom,a=n.left;(a&&a>=e.x||r&&r<=e.x)&&It(e,"x",e.x),(i&&i>=e.y||o&&o<=e.y)&&It(e,"y",e.y)}}function Dx(e,t){return e.indexOf(t)!==-1}function Lx(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var PD=1250;function Xa(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],PD,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&Mn(i.originalEvent))&&!$o(i)){var u=c.pointsForTarget(a);u.initialized||(u=n.addSnapTargetPoints(u,o,a,s),u.initialized=!0),MD(s)&&It(i,"x",i.x),kD(s)&&It(i,"y",i.y),t.snap(i,u)}}),e.on(["resize.cleanup"],function(){t.hide()})}Xa.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new wr);var o=Ix(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},Xa.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return I(r,function(o){e.add("corner",g_(o)),e.add("corner",m_(o))}),e.add("corner",Ix(t,i)),e},Xa.$inject=["eventBus","snapping"],Xa.prototype.getSnapTargets=function(e,t){return y_(t).filter(function(n){return!AD(n,e)&&!at(n)&&!TD(n)&&!ze(n)})};function Ix(e,t){var n=Oe(e),i=Te(e),r={x:n.x,y:n.y};return t.indexOf("n")!==-1?r.y=i.top:t.indexOf("s")!==-1&&(r.y=i.bottom),t.indexOf("e")!==-1?r.x=i.right:t.indexOf("w")!==-1&&(r.x=i.left),r}function AD(e,t){return e.host===t}function TD(e){return!!e.hidden}function MD(e){return e==="n"||e==="s"}function kD(e){return e==="e"||e==="w"}var OD=7,DD=1e3;function Er(e){this._canvas=e,this._asyncHide=Lu(bn(this.hide,this),DD)}Er.$inject=["canvas"],Er.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:$o(e,"x"),y:$o(e,"y")};I(r,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(I(["x","y"],function(u){var l;o[u]||(l=t.snap(c,a,u,OD),l!==void 0&&(o[u]={value:l,originValue:l-s[u]}))}),o.x&&o.y)return!1}),this.showSnapLine("vertical",o.x&&o.x.value),this.showSnapLine("horizontal",o.y&&o.y.value),I(["x","y"],function(a){var s=o[a];Ut(s)&&It(e,a,s.originValue)})},Er.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=Ce("path");return ve(n,{d:"M0,0 L0,0"}),Xe(n).add("djs-snap-line"),Fe(t,n),{update:function(i){Ie(i)?e==="horizontal"?ve(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):ve(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):ve(n,{display:"none"})}}},Er.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Er.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},Er.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Er.prototype.hide=function(){I(this._snapLines,function(e){e.update()})};const LD={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",Ei],resizeSnapping:["type",Xa],snapping:["type",Er]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",Ax],createMoveSnapping:["type",Ho]};var Bx=300;function je(e,t,n,i){this._open=!1,this._results={},this._eventMaps=[],this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._canvas=e,this._eventBus=t,this._selection=n,this._translate=i,this._container=this._getBoxHtml(),this._searchInput=ot(je.INPUT_SELECTOR,this._container),this._resultsContainer=ot(je.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}je.$inject=["canvas","eventBus","selection","translate"],je.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:Pn.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,je.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,je.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,je.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,je.INPUT_SELECTOR,"keydown",function(n){Gt("ArrowUp",n)&&n.preventDefault(),Gt("ArrowDown",n)&&n.preventDefault()}),t(this._container,je.INPUT_SELECTOR,"keyup",function(n){if(Gt("Escape",n))return e.close();if(Gt("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(Gt("ArrowUp",n))return e._scrollToDirection(!0);if(Gt("ArrowDown",n))return e._scrollToDirection();Gt(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},je.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){Pn.unbind(e.el,e.type,e.listener)})},je.prototype._search=function(e){var t=this;if(this._clearResults(),!!e.trim()){var n=this._searchProvider.find(e);if(n=n.filter(function(r){return!t._canvas.getRootElements().includes(r.element)}),!n.length){this._selection.select(null);return}n.forEach(function(r){var o=r.element.id,a=t._createResultNode(r,o);t._results[o]={element:r.element,node:a}});var i=ot(je.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},je.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},je.prototype._scrollToNode=function(e){if(!(!e||e===this._getCurrentResult())){var t=e.offsetTop,n=this._resultsContainer.scrollTop,i=t-this._resultsContainer.clientHeight+e.clientHeight;t<n?this._resultsContainer.scrollTop=t:n<i&&(this._resultsContainer.scrollTop=i)}},je.prototype._clearResults=function(){xs(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},je.prototype._getCurrentResult=function(){return ot(je.RESULT_SELECTED_SELECTOR,this._resultsContainer)},je.prototype._createResultNode=function(e,t){var n=mt(je.RESULT_HTML);return e.primaryTokens.length>0&&Nx(n,e.primaryTokens,je.RESULT_PRIMARY_HTML),Nx(n,e.secondaryTokens,je.RESULT_SECONDARY_HTML),un(n,je.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},je.prototype.registerProvider=function(e){this._searchProvider=e},je.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._cachedRootElement=this._canvas.getRootElement(),this._cachedSelection=this._selection.get(),this._cachedViewbox=this._canvas.viewbox(),this._selection.select(null),this._bindEvents(),this._open=!0,_t(this._canvas.getContainer()).add("djs-search-open"),_t(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},je.prototype.close=function(e=!0){this.isOpen()&&(e&&(this._cachedRootElement&&this._canvas.setRootElement(this._cachedRootElement),this._cachedSelection&&this._selection.select(this._cachedSelection),this._cachedViewbox&&this._canvas.viewbox(this._cachedViewbox),this._eventBus.fire("searchPad.restored")),this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._unbindEvents(),this._open=!1,_t(this._canvas.getContainer()).remove("djs-search-open"),_t(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},je.prototype.toggle=function(){this.isOpen()?this.close():this.open()},je.prototype.isOpen=function(){return this._open},je.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&_t(t).remove(je.RESULT_SELECTED_CLASS);var n=un(e,je.RESULT_ID_ATTRIBUTE),i=this._results[n].element;_t(e).add(je.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:Bx}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},je.prototype._select=function(e){var t=un(e,je.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:Bx}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},je.prototype._getBoxHtml=function(){const e=mt(je.BOX_HTML),t=ot(je.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function Nx(e,t,n){var i=ID(t),r=mt(n);r.innerHTML=i,e.appendChild(r)}function ID(e){var t="";return e.forEach(function(n){var i=Wv(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+je.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}je.CONTAINER_SELECTOR=".djs-search-container",je.INPUT_SELECTOR=".djs-search-input input",je.RESULTS_CONTAINER_SELECTOR=".djs-search-results",je.RESULT_SELECTOR=".djs-search-result",je.RESULT_SELECTED_CLASS="djs-search-result-selected",je.RESULT_SELECTED_SELECTOR="."+je.RESULT_SELECTED_CLASS,je.RESULT_ID_ATTRIBUTE="data-result-id",je.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",je.BOX_HTML=`<div class="djs-search-container djs-scrollable">
|
|
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>`,je.RESULT_HTML='<div class="djs-search-result"></div>',je.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',je.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const BD={__depends__:[ca,Fc,Kn],searchPad:["type",je]};function Qf(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}Qf.$inject=["elementRegistry","searchPad","canvas","search"],Qf.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!ze(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:jn(i),id:i.id})),e,{keys:["label","id"]}).map(ND)};function ND(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const $D={__depends__:[BD,Kb],__init__:["bpmnSearch"],bpmnSearch:["type",Qf]},FD="M44.7648 11.3263L36.9892 2.64074C36.0451 1.58628 34.5651 0.988708 33.1904 0.988708H5.98667C3.22688 0.988708 0.989624 3.34892 0.989624 6.26039V55.0235C0.989624 57.9349 3.22688 60.2952 5.98667 60.2952H40.966C43.7257 60.2952 45.963 57.9349 45.963 55.0235V14.9459C45.963 13.5998 45.6407 12.3048 44.7648 11.3263Z",jD="M1.03845 48.1347C1.03845 49.3511 1.07295 50.758 1.38342 52.064C1.69949 53.3938 2.32428 54.7154 3.56383 55.6428C6.02533 57.4841 10.1161 58.7685 14.8212 59.6067C19.5772 60.4538 25.1388 60.8738 30.6831 60.8738C36.2276 60.8738 41.7891 60.4538 46.545 59.6067C51.2504 58.7687 55.3412 57.4842 57.8028 55.6429C59.0424 54.7156 59.6673 53.3938 59.9834 52.064C60.2938 50.7579 60.3285 49.351 60.3285 48.1344V13.8415C60.3285 12.6249 60.2938 11.218 59.9834 9.91171C59.6673 8.58194 59.0423 7.2602 57.8027 6.33294C55.341 4.49168 51.2503 3.20723 46.545 2.36914C41.7891 1.522 36.2276 1.10204 30.6831 1.10205C25.1388 1.10206 19.5772 1.52206 14.8213 2.36923C10.1162 3.20734 6.02543 4.49183 3.5639 6.33314C2.32433 7.26038 1.69951 8.58206 1.38343 9.91181C1.07295 11.2179 1.03845 12.6247 1.03845 13.8411V48.1347Z",HD={width:36,height:50},zD={width:50,height:50};function $x(e,t,n){return Ce("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const ti=5;function Su(e,t){this._styles=t,e.registerProvider(this)}Su.$inject=["outline","styles"],Su.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(fR(e))return n=Ce("rect"),ve(n,z({x:-ti,y:-ti,rx:4,width:e.width+ti*2,height:e.height+ti*2},t)),n;if(!ze(e))return w(e,"bpmn:Gateway")?(n=Ce("rect"),z(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),ve(n,z({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):We(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=Ce("rect"),ve(n,z({x:-ti,y:-ti,rx:14,width:e.width+ti*2,height:e.height+ti*2},t))):w(e,"bpmn:EndEvent")?(n=Ce("circle"),ve(n,z({cx:e.width/2,cy:e.height/2,r:e.width/2+ti+1},t))):w(e,"bpmn:Event")?(n=Ce("circle"),ve(n,z({cx:e.width/2,cy:e.height/2,r:e.width/2+ti},t))):w(e,"bpmn:DataObjectReference")&&Fx(e,"bpmn:DataObjectReference")?n=$x(FD,{x:-6,y:-6},t):w(e,"bpmn:DataStoreReference")&&Fx(e,"bpmn:DataStoreReference")&&(n=$x(jD,{x:-6,y:-6},t)),n},Su.prototype.updateOutline=function(e,t){if(!ze(e))return We(e,["bpmn:SubProcess","bpmn:Group"])?(ve(t,{width:e.width+ti*2,height:e.height+ti*2}),!0):!!We(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function Fx(e,t){var n;return t==="bpmn:DataObjectReference"?n=HD:t==="bpmn:DataStoreReference"&&(n=zD),e.width===n.width&&e.height===n.height}const GD={__depends__:[zf],__init__:["outlineProvider"],outlineProvider:["type",Su]};var VD='<?xml version="1.0" encoding="UTF-8"?><bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" targetNamespace="http://bpmn.io/schema/bpmn" id="Definitions_1"><bpmn:process id="Process_1" isExecutable="false"><bpmn:startEvent id="StartEvent_1"/></bpmn:process><bpmndi:BPMNDiagram id="BPMNDiagram_1"><bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1"><bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"><dc:Bounds height="36.0" width="36.0" x="173.0" y="102.0"/></bpmndi:BPMNShape></bpmndi:BPMNPlane></bpmndi:BPMNDiagram></bpmn:definitions>';function Si(e){fo.call(this,e)}ye(Si,fo),Si.Viewer=gr,Si.NavigatedViewer=Ia,Si.prototype.createDiagram=function(){return this.importXML(VD)},Si.prototype._interactionModules=[Qv,eb,ib],Si.prototype._modelingModules=[U2,Nc,Z2,K2,lk,Nf,gk,Hk,zy,mc,Wk,Yk,lO,fO,dO,vO,MO,IO,uf,zO,XO,sD,uD,J_,LD,$D,GD],Si.prototype._modules=[].concat(gr.prototype._modules,Si.prototype._interactionModules,Si.prototype._modelingModules);const WD=((e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n})(Mt.defineComponent({__name:"BpmnModelerView",props:{xml:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,r=n,o=Mt.ref();let a;async function s(u){if(!a)throw new Error("modeler not mounted");try{const{warnings:l}=await a.importXML(u),f=Yu(l);return r("imported",f),{warnings:f}}catch(l){throw r("import-error",l),l}}async function c(){if(!a)throw new Error("modeler not mounted");const{xml:u}=await a.saveXML({format:!0});return u??""}return Mt.onMounted(async()=>{a=new Si({container:o.value,moddleExtensions:cs}),i.xml&&await s(i.xml),r("ready")}),Mt.watch(()=>i.xml,u=>{u&&a&&s(u)}),Mt.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(u,l)=>(Mt.openBlock(),Mt.createElementBlock("div",{ref_key:"container",ref:o,class:"bpmn-modeler-view"},null,512))}}),[["__scopeId","data-v-a9b41c97"]]);ae.APPLY_BPMN_OPS_SCHEMA=F0,ae.BPMN_MODDLE_EXTENSIONS=cs,ae.BWL_MODDLE_SCHEMA=ad,ae.BWL_NS=od,ae.BWL_PREFIX=Tu,ae.BWL_SIDES=Mu,ae.BpmnModelerView=WD,ae.EDITOR=p1,ae.FLOW_LABEL_INDENT=jd,ae.HEADLESS_BPMN_MODULES=zv,ae.HEADLESS_TEXT_METRICS=io,ae.I18N_NS=yE,ae.I18N_PREFIX=kd,ae.LABEL_FORK_MARGIN=Qu,ae.MVP_FLOW_NODE_TYPES=Ri,ae.SYMBOLIC_OP_KINDS=ud,ae.SYMBOLIC_OP_SCHEMA=ld,ae.UNDO_EPISODE_COMMAND=ku,ae.applyBpmnOpBatch=Ih,ae.applyBpmnOps=kh,ae.approximateTextWidth=ro,ae.auditBpmnGeometry=Zd,ae.auditBpmnGeometryXml=HE,ae.auditGeometry=ri,ae.auditTargetsOf=Gn,ae.axisSegmentsOf=dn,ae.blackBoxNameRect=Xu,ae.buildBpmnOpBatch=l1,ae.buildRegistryIndex=Jd,ae.containerBoundarySegments=Ko,ae.createBpmnEditorController=f1,ae.createBpmnModdle=Od,ae.createHeadlessBpmnModeler=OM,ae.crossedShapesOf=hn,ae.crossingCost=Nn,ae.describeProcess=Lh,ae.describeProcessXml=u1,ae.edgeCrossCount=ds,ae.edgeCrossingPairsOf=el,ae.edgeCrossingStatsOf=Wd,ae.executeAsUndoEpisode=cd,ae.forwardThreePointCandidates=il,ae.geometryFindingKey=ii,ae.installHeadlessBpmnDom=Ld,ae.isEdgeOverlapFinding=Zu,ae.isMvpFlowNodeType=rd,ae.labelRectsOf=so,ae.lineCrossesLabel=Pi,ae.lineThroughLabel=zd,ae.lineThroughShapeLabel=Kd,ae.loadBpmnXml=qu,ae.lowerOps=Mh,ae.oppositeOverlapCount=TE,ae.oppositeOverlapOf=Fd,ae.planBackEdgeBoundaryClearance=lh,ae.planCrossPoolRoute=sh,ae.planEdgeRepair=rh,ae.planLabelLineClearance=_h,ae.planLabelPlacement=bh,ae.planMiddleSegmentShifts=th,ae.planOppositeOverlapRepair=fh,ae.planSegmentDetours=nl,ae.planShapeLabelClearance=Eh,ae.repairIntroducedBoundaryHugging=ph,ae.repairIntroducedCrossings=oh,ae.repairIntroducedFakeMerges=hh,ae.repairIntroducedLabelLines=xh,ae.repairIntroducedOppositeOverlaps=vh,ae.repairIntroducedShapeLabelLines=Sh,ae.repairIntroducedSharedSegmentLabels=wh,ae.rerouteIntroducedCrossPoolEdges=ch,ae.resolverServicesOf=Ah,ae.saveBpmnXml=vE,ae.sceneCrossingCost=Vd,ae.sceneFromDefinitions=Xd,ae.sceneFromRegistry=ft,ae.sharedSegmentUnderLabel=fs,ae.sharedSpansOf=ps,ae.unreadableOverlapCount=Bn,ae.unreadableOverlapOf=oo,ae.validateOps=Ph,ae.warningMessages=Yu,Object.defineProperty(ae,Symbol.toStringTag,{value:"Module"})}));
|